{"lang": "Python 2", "source_code": "inputc = raw_input()\nsum1 = 0\nfor c in inputc[0:3]:\n\tsum1 += int(c)\n\nsum2 = 0\nfor c in inputc[3:6]:\n\tsum2 += int(c)\n\n# print sum1,sum2\nif sum1 == sum2 : \n\tprint 0\n\texit()\n\ncha =sum1-sum2 \n# print cha\nnums= map(int,inputc)\navs1 = []\nfor num in nums[0:3]:\n\tavs1.append( 9-num )\nfor num in nums[3:6]:\n\tavs1.append(0-num)\n\n\navs2 = []\nfor num in nums[0:3]:\n\tavs2.append( 0-num )\nfor num in nums[3:6]:\n\tavs2.append(9-num)\n\ndef cmpp(a,b):\n\tif a<0:a=0-a\n\tif b<0:b=0-b\n\treturn b-a\n   \navs1.sort(cmp=cmpp )\navs2.sort(cmp=cmpp )\n\navs=avs1\nif cha>0:\n\tavs=avs2 \ncount=1\nfor av in avs:\n\tif (av>0 and cha>0) or (av<=0 and cha <=0):\n\t\tresult=cha-av\n\tif (av<= 0 and cha>0) or (cha<=0 and av>0):\n\t\tresult=cha +av\n\n\tif cha>0:\n\n\t\tif result>0:\n\t\t\tcha=result\n\t\t\tcount+=1\n\t\telse:\n\t\t\tprint count\n\t\t\tbreak\n\telse:\n\t\tif result<0:\n\t\t\tcha=result\n\t\t\tcount+=1\n\t\telse:\n\t\t\tprint count\n\t\t\tbreak", "lang_cluster": "Python", "tags": ["brute force", "greedy", "implementation"], "code_uid": "5edb4b89998d706dc368e0519bd9b23f", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "'''\n21st august 2017 monday\ncodeforces 825b yh\n'''\nfrom sys import stdin\n\nt = map(int, list(stdin.readline().strip()))\n\nsum_left = sum(t[:3])\nsum_right = sum(t[3:])\n\nif sum_left == sum_right:\n\tprint 0\nelif sum_left < sum_right:\n\td = sum_right - sum_left\n\tfor i in xrange(3):\n\t\tt[i] = 9 - t[i]\n\tt.sort(reverse=True)\n\ti = 0\n\twhile d > 0:\n\t\td -= t[i]\n\t\ti += 1\n\tprint i\nelse:\n\td = sum_left - sum_right\n\tfor i in xrange(3, 6):\n\t\tt[i] = 9 - t[i]\n\tt.sort(reverse=True)\n\ti = 0\n\twhile d > 0:\n\t\td -= t[i]\n\t\ti += 1\n\tprint i\n", "lang_cluster": "Python", "tags": ["brute force", "greedy", "implementation"], "code_uid": "f57a99b6e3fa68232a509daca5d27ebb", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "k=int(raw_input())\nl=int(raw_input())\nif l%k==0:\n    i=0\n    while k**i<l:\n        i+=1\n    if k**i==l:\n        print 'YES'\n        print i-1\n    else:\n        print 'NO'\nelse:\n    print 'NO'", "lang_cluster": "Python", "tags": ["math"], "code_uid": "17aae43066fa57167cdf2963c231811f", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "k=int(input())\nl=int(input())\nc=0\nwhile k**c<l:\n       c+=1\nif k**c==l:\n       print(\"YES\")\n       print(c-1)\nelse:\n       print(\"NO\")", "lang_cluster": "Python", "tags": ["math"], "code_uid": "d43a60af126271cdab9676b0e6b5a515", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x1, y1, x2, y2 = map(int, raw_input().split())\nprint ((y2 - y1) / 2 + 1) * (x2 - x1 + 1) - (x2 - x1) / 2\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "efb1e69667c7e904e83c401b956544b1", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x,y,xx,yy=map(int,raw_input().split())\ndy=abs(yy-y)\ndx=abs(x-xx)\nprint (dx/2+1)*(dy/2+1)+(dx/2)*dy/2", "lang_cluster": "Python", "tags": ["math"], "code_uid": "4daf5e052e91b87b952ad9becd5f1264", "src_uid": "00cffd273df24d1676acbbfd9a39630d", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def zip_sorted(a,b):\n\n\t# sorted  by a\n\ta,b = zip(*sorted(zip(a,b)))\n\t# sorted by b\n\tsorted(zip(a, b), key=lambda x: x[1])\n\n\treturn a,b\n\na   = [int(n1) for n1 in input().split()]\nb   = [int(n1) for n1 in input().split()]\nc   = [int(n1) for n1 in input().split()]\n\ncount = 0\nfor i in range(1,(10**5)+1):\n\ta[0] = i\n\tb[1] = sum(a)-sum(b)\n\tif b[1]>0:\n\t\tif sum(a)==sum(b):\n\t\t\tc[2] = sum(a)-(b[1]+a[0])\n\t\t\tif c[2]>0:\n\t\t\t\tif sum(c)==sum(a)==sum(b)==(c[0]+b[0]+a[0])==(c[1]+b[1]+a[1])==(c[1]+b[1]+a[1]):\n\t\t\t\t\tcount = 1\n\t\t\t\t\tbreak\n\t\t\t\telse:\n\t\t\t\t\ta[0] = 0\n\t\t\t\t\tb[1] = 0\n\t\t\t\t\tc[2] = 0\n\t\t\telse:\n\t\t\t\ta[0] = 0\n\t\t\t\tb[1] = 0\n\t\t\t\tc[2] = 0\n\t\telse:\n\t\t\ta[0] = 0\n\t\t\tb[1] = 0\n\t\t\tc[2] = 0\n\telse:\n\t\ta[0] = 0\n\t\tb[1] = 0\n\t\tc[2] = 0\n\nprint(*a)\nprint(*b)\nprint(*c)\n\n\n\n'''\nfor i in range(n):\nfor j in range(n):\nfor k1 in range(len(a)):\nfor k2 in range(len(a)):\nfor k3 in range(len(a)):\n\n'''", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "79f56334a31f88e884fbde9065fbb041", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "M = 100000\n\nI = lambda:map(int, raw_input().split())\n\ndata = []\n\nfor i in range(3):\n    data.append(I())\n\na = sum(data[0])\nb = sum(data[1])\nc = sum(data[2])\n\n# x + a = y + b = z + c\nm = min(a, b, c)\ndata[0][0] = (b + c - a)/2\ndata[1][1] = (c + a - b)/2\ndata[2][2] = (a + b - c)/2\n\nfor d in data:\n    for v in d:\n        print v,\n    print ''\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "60cd84b620530eeef933c9ffb6d75d92", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n,p,l,r = map(int,raw_input().split())\nans = 0\nif p<l:\n    ans = (l-p)\n    p = l\nelif p>r:\n    ans = (p-r)\n    p = r\n\nif p==l :\n    if 1<l:\n        ans+=1\n    if n>r:\n        ans+=(r-p)+1\n    print(ans)\nelif p==r:\n    if n>r:\n        ans+=1\n    if 1<l:\n        ans+=(p-l)+1\n    print(ans)\nelse: \n    x = ans + (r-p)+(r-l)+2\n    if 1<l:\n        ans+=(p-l)+1\n        p = l\n    if n>r:\n        ans+=(r-p)+1\n    print(min(x,ans))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "7bc3ab3802e0e372d722785439cf72de", "src_uid": "5deaac7bd3afedee9b10e61997940f78", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def my_get_ans(n, pos, l, r):\n    if l == 1 and r == n:\n        return 0\n\n    else:\n        if l == 1 and r != n:\n            return abs(pos - r) + 1\n\n        elif l != 1 and r == n:\n            return abs(pos - l) + 1\n\n        else:\n            if l <= pos <= r:\n                return r - l + 2 + min(abs(pos - l), abs(pos - r))\n\n            elif pos < l:\n                return r - l + 2 + abs(pos - l)\n\n            else:\n                return r - l + 2 + abs(pos - r)\n\nprint(my_get_ans(*map(int, input().split())))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "da907f50aa62717837063c35cb5b18e6", "src_uid": "5deaac7bd3afedee9b10e61997940f78", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\ns=input()\nans,i,k='',0,1\nwhile i<n:\n    ans+=s[i]\n    i,k=i+k,k+1\nprint(ans)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "4737ecb3e13f71ecce2eade6f86c4167", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\nstr1 = raw_input()\ns = 0\nr = ''\nfor i in range(1, n+1):\n    r += str1[s:s+1]\n    s += i\nprint r\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "2ec545d228681fc44269cda43631fea1", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "def main():\n    p1, t1 = map(int, raw_input().split())\n    p2, t2 = map(int, raw_input().split())\n    h, s = map(int, raw_input().split())\n    if t1 > t2:\n        p1, p2 = p2, p1\n        t1, t2 = t2, t1\n    p = p1 + p2 - s\n    if t1 == t2:\n        print (h + p - 1) / p * t1\n        return\n    p1 -= s\n    p2 -= s\n    ans = 1 << 63\n    d1 = [ans] * 20001\n    d2 = [ans] * 20001\n    e = u = 0\n    r1, r2 = t1, t2\n    while e < h:\n        if r1 == r2:\n            e += p\n            u += r1\n            r1, r2 = t1, t2\n            d1[e] = u\n            break\n        elif r1 < r2:\n            if d2[e+p] > u + r2:\n                d2[e+p] = u + r2\n            e += p1\n            u += r1\n            r2 -= r1\n            r1 = t1\n        else:\n            if d2[e+p] > u + r1:\n                d2[e+p] = u + r1\n            e += p2\n            u += r2\n            r1 -= r2\n            r2 = t2\n        d1[e] = u\n    d3 = [ans] * (h + 1)\n    d1[0] = d3[0] = 0\n    for i in xrange(e - 1, 0, -1):\n        if d1[i] > d1[i+1]:\n            d1[i] = d1[i+1]\n    v = [(i, d2[i]) for i in xrange(e + 1) if d2[i]]\n    for i in xrange(h + 1):\n        for j, x in v:\n            k = i + j\n            if k > h:\n                k = h\n            if d3[k] > d3[i] + x:\n                d3[k] = d3[i] + x\n        if ans > d3[i] + d1[h-i]:\n            ans = d3[i] + d1[h-i]\n    print ans\nmain()\n", "lang_cluster": "Python", "tags": ["dp", "binary search"], "code_uid": "a3250ccb9d49257e1a304c7de328ca82", "src_uid": "ca9d48e48e69b931236907a9ac262433", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "s = input().split()\r\np1 = int(s[0])\r\nt1 = int(s[1])\r\ns = input().split()\r\np2 = int(s[0])\r\nt2 = int(s[1])\r\ns = input().split()\r\nh = int(s[0])\r\ns = int(s[1])\r\ndp = [1145141919810] * (h+5)\r\ndp[0] = 0\r\nfor i in range(1,h+1):\r\n    dp[i] = min(dp[max(0,i-(p1-s))]+t1,dp[max(0,i-(p2-s))]+t2)\r\n    for j in range(1,i+1):\r\n        if(t1 * j >= t2):\r\n            dp[i] = min(dp[i],dp[max(0,i-(j-1)*(p1-s)-((j*t1-t2)//t2)*(p2-s)-(p1+p2-s))]+t1*j)\r\n        if(t2 * j >= t1):\r\n            dp[i] = min(dp[i],dp[max(0,i-(j-1)*(p2-s)-((j*t2-t1)//t1)*(p1-s)-(p1+p2-s))]+t2*j)\r\nprint(dp[h])", "lang_cluster": "Python", "tags": ["dp", "binary search"], "code_uid": "cc9125bab195e17904b7461524d2b2c7", "src_uid": "ca9d48e48e69b931236907a9ac262433", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def R():\n    return map(int, input().split())\n\n\na1, b1, c1 = R()\na2, b2, c2 = R()\n\n\ndef Z(x, y, z):\n    return not x and not y and z\n\n\nprint(\"1\") if (a1*b2-a2*b1) else print(\"0\") if Z(a1, b1, c1) or Z(a2,\n                                                                  b2, c2) or (c1*b2-c2*b1) or (a1*c2-a2*c1) else print(\"-1\")", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "e83996ba0f6741a20e3e446f433dd593", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#codeforces 21b intersection, math\n\ndef readGen(transform):\n\twhile (True):\n\t\tn=0\n\t\ttmp=input().split()\n\t\tm=len(tmp)\n\t\twhile (n<m):\n\t\t\tyield(transform(tmp[n]))\n\t\t\tn+=1\n\nreadint=readGen(int)\nA1,B1,C1=next(readint),next(readint),next(readint)\nA2,B2,C2=next(readint),next(readint),next(readint)\n\ndef cross(a,b,c,d): return a*d-b*c\n\ndef zero(A1,B1): return A1**2 + B1**2 == 0\n\ndef lineIntersect(A1,B1,C1,A2,B2,C2):\n\tif (cross(A1,B1,A2,B2)==0):\n\t\tif (cross(A1,C1,A2,C2)==0 and cross(B1,C1,B2,C2)==0):\n\t\t\t# same line\n\t\t\treturn -1\n\t\telse:\n\t\t\t# parallel\n\t\t\treturn 0\n\telse:\n\t\t# cross\n\t\treturn 1\n\t\ndef judge(A1,B1,C1,A2,B2,C2):\n\tif (zero(A1,B1) and C1!=0): return 0\n\tif (zero(A2,B2) and C2!=0): return 0\n\t\n\tif (not zero(A1,B1) and not zero(A2,B2)):\n\t\t# line and line\n\t\treturn lineIntersect(A1,B1,C1,A2,B2,C2)\n\telse:\n\t\treturn -1\n\t\nprint(judge(A1,B1,C1,A2,B2,C2))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "4109f2b958132d632c3062cbdaf4de4f", "src_uid": "c8e869cb17550e888733551c749f2e1a", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\nM = 998244353 \nn=int(input())\na,b=1,1\nfor i in range(n-1):a,b=b,a+b\nprint(a*pow(1<<n,M-2,M)%M)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "e5ba5f8702002e06241ae006352b9a34", "src_uid": "cec37432956bb0a1ce62a0188fe2d805", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nimport sys\nm=998244353\ninput=sys.stdin.readline\n\nfibo=[1,1]\nfor i in range(200002):\n    fibo.append(fibo[-1]+fibo[-2])\n    fibo[-1]%=m\n\nn=int(input())\ndeno=1<<n\ninv=pow(deno,m-2,m)\nans=(fibo[n-1]*inv)%m\nprint(ans)\n    \n            \n    \n        \n\n    \n    \n        \n    \n\n    \n    \n\n\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "21c199e6a18a5869cfdf1c25de9f992f", "src_uid": "cec37432956bb0a1ce62a0188fe2d805", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b,c = map(int,raw_input().split())\ncount = 0\ncount += 2*c\nif a==0 and b == 0:\n    count += 0\nelif a != 0 and b ==0:\n    count += 1\nelif a == 0 and b!=0:\n    count += 1\nelif a==b:\n    count += 2*a\nelse:\n    count += 2*min(a,b) + 1\nprint count\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "1c8c863b3f21bd79405da603b0b90b93", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b, c = map(int, input().split())\nif abs(a - b) <= 1:\n    print(a + b + 2 * c)\nelse:\n    if a < b:\n        print(a + a + 1 + 2 * c)\n    else:\n        print(b + b + 1 + 2 * c)\n\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "14f2fcbebe004325f3e048c145c5315a", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "m,d=map(int,input().split())\na=[]\nif m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12:\n    for i in range(d,8):\n        a.append(1)\n    c=(31-len(a))/7\n    if c>4:\n        print(6)\n    else:\n        print(5)    \nif m==4 or m==6 or m==9 or m==11:\n    for i in range(d,8):\n        a.append(1)\n    c=(30-len(a))/7\n    if c<=4:\n        print(5)\n    else:\n        print(6)\nif m==2:\n    for i in range(d,8):\n        a.append(1)\n    c=(28-len(a))/7\n    if c==3:\n        print(4)\n    elif c<=4:\n        print(5)\n    ", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "09d65d01ae958f50af3de436a9fa8e72", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#CF 393 yl1\n# Petr\n#n=int(input())\n\nm,d=list(map(int,input().split()))\n\nif m==2:\n    n=28\nelif m in {1,3,5,7,8,10,12}:\n    n=31\nelse:n=30\n#{1,3,5,8,10,12}\n# for i in range(n):\nn+=d-1\nif n%7==0:\n    n=n//7\nelse:\n    n=n//7+1\nprint(n)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "4bfa8bc6dc6b153d14eaa0b3646fc4fb", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\nn, r = [float(x) for x in raw_input().split()]\nprint(int(math.ceil((n*2)/r)+math.ceil((n*5)/r)+math.ceil((n*8)/r)))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "8f37c6cf834a24dabcd228809ed4777e", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import ceil as cs\nn,k=map(int,input().split())\nr,g,b=2*n,5*n,8*n\nprint(cs(r/k)+cs(g/k)+cs(b/k))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "ae3459dc0a24181296886ec40eac7844", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\narr =[[0 for _ in range(5)] for _ in range(5)]\n# print(arr)\nfor i in range(5):\n    arr[i] = list(map(int,input().split()))\n    if 1 in arr[i]:\n        for j in range(5):\n            if arr[i][j] == 1:\n                posI = i\n                posJ = j\nprint(abs(posI-2)+abs(posJ-2))    \n    ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "8b16dff9e9d3ce46479eba13e3e5b818", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "for i in xrange(5):\n    s = raw_input().split()\n    if '1' in s:\n        t = i\n        c = s.index('1')\nprint abs(2-t)+abs(c-2)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "73308ba2e16f59bad4d4d78e6e0190c6", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# enumerate range float sorted reversed\ndef print_ints(a):\n    print ' '.join(map(str, a))\n\ndef f(l):\n    s = 0\n    i = 0\n    n = len(l)\n    need = n*4.5\n    s = sum(l)\n    c = 0\n    for e in sorted(l):\n        if s >= need:\n            break\n        s += (5-e)\n        c += 1\n    print c\n    return\n        \n\nread_ints = lambda: map(int, raw_input().strip().split())\nread_floats= lambda: map(float, raw_input().strip().split())\nn = int(raw_input())\nl = read_ints()\n\nf(l)\n", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "a148412350ec4bab119c9f9ddd2da39d", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nquery = list(map(int,input().split()))\n\ngrades = [0,0,0,0]\ndef solution(grades,n):\n    for x in query:\n        grades[x-2]+=1\n    ave = (grades[0]*2+grades[1]*3+grades[2]*4+grades[3]*5)/n\n    if ave>=4.5:\n        return 0\n    else: \n        temp = (grades[0]*3)/n+ave\n        if temp>=4.5:\n            return int((4.5-ave)*n/3+0.99)\n        tempn = temp+(grades[1]*2)/n\n        if tempn>=4.5:\n            return (grades[0]+int((4.5-temp)*n/2+0.99))\n        return grades[1]+grades[0]+int((4.5-tempn)*n+0.99)\nprint(solution(grades,n))", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "ba34a59bbadba467f7b850bb8d6c656d", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nm=input()\na=0\nb=0\nfor i in range(1,len(m)):\n    if m[i]=='F' and m[i-1]=='S':\n        a+=1\n    elif m[i]=='S' and m[i-1]=='F':\n        b+=1\nif a>b:\n    print('YES')\nelse:\n    print('NO')", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "322079e1665bb026d21553c5a0e4027c", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\ns = input();\ncnt1 = 0\ncnt2 = 0\ns1 = \"\"\nfor i in range(1, n):\n    if s[i-1] == \"S\" and s[i] == \"F\":\n        cnt1 += 1\n    elif s[i-1] == \"F\" and s[i] == \"S\":\n        cnt2 += 1\nif cnt1 > cnt2:\n    print(\"YES\")\nelse:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "c91360a8264ea6f0b2539367b89de198", "src_uid": "ab8a2070ea758d118b3c09ee165d9517", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m = map(int,raw_input().split())\n\ncount = 0\nfor a in range(max(n,m)+1):\n    for b in range(max(n,m)+1):\n        if a*a+b == n and a+b*b == m:\n            count += 1\n\nprint count", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "c5cdde1970646c68958d4abcd935fba8", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# DON'T USE PYTHON FOR RECURSION\n# TRY PYPY\nimport math\nimport operator\nimport sys\nfrom collections import Counter, defaultdict\nfrom math import ceil, floor, pi, sin, sqrt\nfrom sys import exit, stdin, stdout\n\n\ndef main():\n    # stdin = open('.in')\n    n, m = map(int, stdin.readline().strip().split(' '))\n    ans = 0\n    for a in range(1001):\n        for b in range(1001):\n            ans += a * a + b == n and a + b * b == m\n    print ans\n\n\nmain()\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "44e9d903e19792894587fad399037684", "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b, c, d = map(int, raw_input().split())\nm = max(3 * a / 10, a - (a / 250) * c)\nv = max(3 * b / 10, b - (b / 250) * d)\nif m > v: print \"Misha\"\nelif m < v: print \"Vasya\"\nelse: print \"Tie\"\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "dd49b5382762a8d8bc4ada89debfbbcd", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#sys.setrecursionlimit(300000)\nimport sys\nimport math as m\ndef main():\n    pass\ndef binary(n):\n    #decimal to binary\n    return (bin(n).replace(\"0b\", \"\"))\ndef decimal(s):\n    #binary to decimal\n    return (int(s, 2))\ndef pow2(n):\n    #power of a number base 2\n    p = 0\n    while n > 1:\n        n //= 2\n        p += 1\n    return (p)\ndef isPrime(n):\n    # if  number is prime in \u221an time\n    if (n == 1):\n        return (False)\n    else:\n        root = int(n ** 0.5)\n        root += 1\n        for i in range(2, root):\n            if (n % i == 0):\n                return (False)\n        return (True)\ndef lts(l):\n    #list to string ,no spaces\n    s=''.join(map(str,l))\n    return s\ndef stl(s):\n    #for each character in string to list with no spaces -->\n    l=list(s)\n    #for space in string  -->\n    #l=list(s.split(\" \"))\n    return l\n#Returns list of numbers with a particular sum\ndef sq(a,target,arr=[]):\n    s=sum(arr)\n    if(s==target):\n        return arr\n    if(s>=target):\n        return\n    for i in range(len(a)):\n        n=a[i]\n        remaining=a[i+1:]\n        ans=sq(remaining,target,arr+[n])\n        if(ans):\n            return ans\n\n#1000000007\nmod=int(1e9)+7\ndef sinp(): return sys.stdin.readline().strip()\ndef iinp(): return int(input())\ndef ninp(): return map(int, sys.stdin.readline().strip().split())\ndef llinp(): return list(map(int, sys.stdin.readline().strip().split()))\ndef p(xyz): print(xyz)\ndef p2(a,b):print(a,b)\n#for _ in range(iinp()):\na,b,c,d=ninp()\nm1=max(3*a/10,a-(a/250)*c)\nm2=max(3*b/10,b-(b/250)*d)\nif(m1==m2):\n    print(\"Tie\")\nelif(m1>m2):\n    print(\"Misha\")\nelse:\n    print(\"Vasya\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "783adcc7f8fea64d65ff0fa8d84d116c", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ns = input()\n\na,b = list(s[:n]), list(s[n:])\n\na.sort()\nb.sort()\n\nq=p=1\nfor i in range(n):\n     if a[i]>b[i]:\n          p=0\n     elif  a[i]<b[i]:\n          q=0\n     else:\n          p=q=0\nif(p+q>0):\n     print(\"YES\")\nelse:\n     print(\"NO\")\n", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "30d3f38b23f3bed6285ec282ba32a833", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nl=list(input())\na=l[0:n]\nb=l[n:2*n]\na.sort()\nb.sort()\ncount1=True\ncount2=True\nflag=0\nfor i in range(n):\n  if a[i]>b[i]:\n    count1=False\n  else:\n    count2=False\n  if (count1==False and count2==False) or (a[i]==b[i]):\n    print('NO')\n    flag=1\n    break\nif flag==0:\n  print('YES')\n  ", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "5ba2789985ca77388eac0021778b0a43", "src_uid": "e4419bca9d605dbd63f7884377e28769", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n\nI = lambda: int(input())\nreadline = lambda: sys.stdin.readline().strip('\\n')\nRM = readmap  = lambda x=int: map(x,readline().split(' '))\n\n#1321 625 div2\n#C: Remove Adjacent\nn,s = I(),readline()\nfor i in range(25,0,-1):\n    y = chr(ord('a')+i)\n    x = chr(ord('a')+i-1)\n    while True: \n        temp = len(s)\n        s = s.replace(x+y,x).replace(y+x,x)\n        if len(s) == temp:\n            break\nprint(n-len(s))\nquit()\n#B:Journey Planning\n#overkill approach: dynamic programming; TLE\n#pmax0 = 0\n#bmax = b.copy()\n#for i in range(n-1,-1,-1):\n#    if max0<b[i]:\n#        max0 = max(max0,b[i])\n#        continue\n#    bmax[i] += max([0]+[bmax[j] for j in range(i+1,n) if j-i == b[j]-b[i]])\n#    max0 = max(max0,b[i])\n#print(max(bmax))\n\n#**trick: find common features in the sequence in O(1)**\nd = {}\nfor i,x in zip(range(I()),RM()):\n    d[x-i] = d.get(x-i,0) + x\nprint(max(d.values()))\nquit()\n#A: contest for robots\nn,a,b =I(),[*RM()],[*RM()]\ncount1,count2 = 0,0\nfor i,j in zip(a,b):\n    count1 += i & ~j\n    count2 += j & ~i\nprint(divmod(count2,count1)[0]+1 if count1 else -1)\n", "lang_cluster": "Python", "tags": ["brute force", "greedy", "strings", "constructive algorithms"], "code_uid": "0d1d7bde2040bfb4500be34572c7df04", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "m=int(input())\ns=input()+'0'\nnum=[]\nle=len(s)\nco=1\nfor i in range(le-1):\n    if s[i]!=s[i+1]:\n        num.append([ord(s[i]),co])\n        co=1\n    else:\n        co+=1\nli=len(num)\nmi=min(num)\ni2=mi[0]\nfor l in range(li):\n    ma=max(num)\n    i1=num.index(ma)\n    le=len(num)\n    if le<2 or i2==ma[0]:\n        break\n    elif i1==0:\n        if num[i1][0]==num[i1+1][0]+1:\n            num.remove(ma)\n        else:\n            num[i1][0]-=90\n    elif i1==le-1:\n        if num[i1][0]==num[i1-1][0]+1:\n            num.remove(ma)\n        else:\n            num[i1][0]-=90\n    elif num[i1][0]==num[i1+1][0]+1 or num[i1][0]==num[i1-1][0]+1:\n         num.remove(ma)\n    else:\n        num[i1][0]-=90\n    numd=[]\n    num.append([1,0])\n    lc=len(num)\n    for i in range(lc-1):\n        if num[i][0]==num[i+1][0]:\n            num[i][1]=num[i][1]+num[i+1][1]\n            num[i+1]=num[i]\n        else:\n            numd.append(num[i])\n    num=numd[:]\nto=0\nfor i in num:\n    to+=i[1]\nprint(m-to)\n", "lang_cluster": "Python", "tags": ["brute force", "greedy", "strings", "constructive algorithms"], "code_uid": "4d90d0cdef1a876dd8f755ae66a4afad", "src_uid": "9ce37bc2d361f5bb8a0568fb479b8a38", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = input()\na = a.split(' ')\na = list(map(int,a))\ndef really_big(n,s):\n    if s >= n:\n        return 0\n    i = s + 1\n    while i <= n:\n        t,b = i,0\n        while t > 0:\n            b = b + (t % 10)\n            t = t // 10\n        if i - b >= s:\n            return n - i + 1\n            break\n        else:\n            i += 1\n    return 0\nprint(really_big(a[0],a[1]))", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "binary search"], "code_uid": "b7c80df99ee3eadc540e99dd2828277c", "src_uid": "9704e2ac6a158d5ced8fd1dc1edb356b", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def nine(p) :\n    \n    s=''\n    for i in range(p) :\n        s+='9'\n    return int(s)\ndef prosh(p) :\n    ans=0\n    for i in range(1,p+1) :\n        ans+=nine(i)*9\n    return ans\n        \nn,k=map(int,input().split())\nl=[0]*29\nfor i in range(19) :\n    \n    e=nine(19-i)\n    \n    l[i]=k//e\n    \n    k-=l[i]*e\n    \n    if k==0 :\n        \n        break\n    if i==18  or k%e>prosh(19-i-1) :\n        \n        l[i]+=1\n        break\notv=0\nfor i in range(19) :\n    \n    otv+=10**(19-i)*l[i]\n\nprint(max(n-otv+1,0))\n    \n    \n    \n        \n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "binary search"], "code_uid": "9533811eed05a6177d907b216fec3f8b", "src_uid": "9704e2ac6a158d5ced8fd1dc1edb356b", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, k = map(int, input().split())\na = list(map(int, input().split()))\n\nc = 0\n\nwhile a:\n    if a[0] > k and a[-1] > k:\n        break\n\n    if a[0] <= k:\n        a.pop(0)\n        c += 1\n    elif a[-1] <= k:\n        a.pop()\n        c += 1\n\nprint(c)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "3e80e5775b04dc147b551201c1ee837d", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,k=map(int,input().split())\na=list(map(int,input().split()))\nc=0\nd=0\nfor i in range(len(a)):\n\tif(a[i]>k):\n\t\tbreak\n\telse:\n\t\tc=c+1\nif(c!=n):\t\n\tfor i in range(len(a)):\n\t\tif(a[n-i-1]>k):\n\t\t\tbreak\n\t\telse:\n\t\t\td=d+1\n\t\t\nprint(c+d)\n\n\t\t", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "fea1c0a3bed5071cf86553c1e5fc7372", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m,a, b = map(int, input().split())\nif(m>=n):\n    print('Second')\nelse:\n    print('First')", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "fa3bb339e049096f839cf4ba8abd08d9", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def Spider ():\n    a, b, c, d = map(int, input().split())\n    if b >= a: print(\"Second\")\n    else: print(\"First\")\nTIMES = 1\n#TIMES = int(input())\nfor TIME_TEMP in range(TIMES):\n    Spider()", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "952490383b434e955991bcbddec1b56d", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\ndef main():\n    s = raw_input()\n    for l in xrange(len(s)-1, 0, -1):\n        for b in xrange(0, len(s)-l+1):\n            if s[b:b+l] in s[b+1:]:\n                print l\n                return 0\n    print 0\n    return 0\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "08e1cdda7a9c894eccf5ad63fc1e648a", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def all_substrings(s):\n\tl = set([])\n\tfor i in range(0, len(s)):\n\t\tfor j in range(1, len(s)+1):\n\t\t\tl.add(s[i:j])\n#\tprint l\n\tm = -1\n\tfor substring in l:\n\t\tc = occurrences(s, substring)\n\t\tif c> 1:\n\t\t\tm = max(m, len(substring))\n\tif m == -1: return 0\n\treturn m\n\ndef occurrences(string, sub):\n    count = start = 0\n    while True:\n        start = string.find(sub, start) + 1\n        if start > 0:\n            count+=1\n        else:\n            return count\n\nr = raw_input().strip()\nprint all_substrings(r)\n#print all_substrings('abcd')\n#print all_substrings('ababa')\n#print all_substrings('zzz')\t\t\n", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "9dceeb2ec2dd3df5026cb6ecde0801bd", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "q=int(input())\nprint(3*q*(q+1) + 1)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "e26542487de9a5d01d2729ace9cfd3d0", "src_uid": "c046895a90f2e1381a7c1867020453bd", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=int(raw_input())\n\nn=((6*(n*(n+1)))/2)+1\nprint n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "4ad77caa780679e908b6e4290f714c10", "src_uid": "c046895a90f2e1381a7c1867020453bd", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\nimport math\n\ndef doit(A,B,C): return 2*(A+1)*(B+C+2) + B*C\n\nn=eval(sys.stdin.readline().strip('\\n\\r ').split()[0])\n\nif n==1:\n  print( \"17 17\")\n  exit(0)\n\nr=int(math.sqrt(float(n))) + 1\nr3=int(10**(math.log10(float(n))/3)) - 1\n\nmx = (8*n) + 9\nmn = mx\nwhile r>0:\n  if (n%r)==0:\n    A = r\n    m = n / r\n    B = int( math.sqrt(float(m)) ) + 1\n    while B>0:\n      if (m%B) == 0:\n        C = m/B\n        mn = min( [mn, doit(A,B,C),doit(B,A,C),doit(C,B,A)] )\n      B-=1\n  r-=1\n\nprint( \"%d %d\" % ( mn, mx, ) )\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "9e8e5f36d5937b0f41b99667c25ce9fc", "src_uid": "2468eead8acc5b8f5ddc51bfa2bd4fb7", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\nfrom math import sqrt\n\nif(__name__=='__main__'):\n    n=raw_input()\n    n=int(n)\n    \n    minAns=1L<<64\n    maxAns=-minAns\n    for i in xrange(1,int(sqrt(n))+5):\n        if(n%i==0):\n            m=n/i\n            for j in xrange(1,int(sqrt(m))+5):\n                if(m%j==0):\n                    ret=i+1\n                    ret=ret*(j+2)*(m/j+2)-n\n                    maxAns=max(ret,maxAns)\n                    if(ret>0): minAns=min(ret,minAns)\n                    \n                    ret=i+2\n                    ret=ret*(j+1)*(m/j+2)-n\n                    maxAns=max(ret,maxAns)\n                    if(ret>0): minAns=min(ret,minAns)\n                    \n                    ret=i+2\n                    ret=ret*(j+2)*(m/j+1)-n\n                    maxAns=max(ret,maxAns)\n                    if(ret>0): minAns=min(ret,minAns)\n    print minAns,maxAns\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "bdbddf2e00c24802b5ab33fafa098309", "src_uid": "2468eead8acc5b8f5ddc51bfa2bd4fb7", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\nN = int(raw_input())\nx = map(int,raw_input().strip('\\n').split(' '))\ny = map(int,raw_input().strip('\\n').split(' '))\nif(sum(x)>=sum(y)):\n\tprint(\"Yes\")\nelse:\n\tprint(\"No\")", "lang_cluster": "Python", "tags": ["math"], "code_uid": "fbff945cb97ecca337c9f6dd5681efc9", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n   = int(input())\nxl  = list(map(int,input().split()))\nyl  = list(map(int,input().split()))\nprint('Yes' if sum(xl)>=sum(yl) else 'No')\n\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "ef871b22590a11472293a824955235d8", "src_uid": "e0ddac5c6d3671070860dda10d50c28a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\n\nfor i in range(n//2, 0, -1):\n    if n % i != 0 or i == 1:\n        found = True\n        for j in range(i-1, 1, -1):\n            if i % j == 0 and (n-i) % j == 0:\n                found = False\n                break\n        if found:\n            print(i, n-i)\n            break\n", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms"], "code_uid": "f1092a599a7147f4b68b5be9ebf22d22", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nn = int(input())\n\nif n%2==0:\n\tl=n/2\nelse:\n\tl=(n+1)/2\n\nmax_value=0\n\na1=0\nb1=0\n\nfor i in range(int(l)):\n\ta = i\n\tb = n-i\n\n\tif math.gcd(a,b)!=1:\n\t\tcontinue\n\n\telif a/b>max_value:\n\t\tmax_value=a/b\n\t\ta1=a\n\t\tb1=b\n\nprint (a1 , b1)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms"], "code_uid": "7b9497ed93aac689da1b6d39f6d19147", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a=input()\nb=input()\ndef isSubSequence(str1,str2): \n   m = len(str1) \n   n = len(str2) \n      \n   j = 0    # Index of str1 \n   i = 0    # Index of str2 \n      \n    # Traverse both str1 and str2 \n    # Compare current character of str2 with  \n    # first unmatched character of str1 \n    # If matched, then move ahead in str1 \n      \n   while j<m and i<n: \n      if str1[j] == str2[i]:     \n         j = j+1    \n      i = i + 1\n          \n    # If all characters of str1 matched, then j is equal to m \n   return j==m \n      \nc=a\ns=0\nfor i in b:\n   if i not in c:\n      s=-1\n      break\n   else:\n      d=c.index(i)\n      c=c[:d]+c[d+1:]\nif s==-1:\n   print(\"need tree\")\nelse:\n   if len(b)>len(a):\n      print(\"need tree\")\n   elif len(b)==len(a):\n      print(\"array\")\n   else:\n      if isSubSequence(b,a):\n         print(\"automaton\")\n      else:\n         print(\"both\")\n         \n      \n   ", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "f0fcfe45ab60a87cc69c58238edf724a", "src_uid": "edb9d51e009a59a340d7d589bb335c14", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s=input()\nt=input()\nss=sorted(s)\nst=sorted(t)\nif ss==st:\n    print('array')\n    exit(0)\nelse:\n    c=0\n    for i in range(len(s)):\n        if s[i]==t[c]:\n            c+=1\n        if c==len(t):break\n    if c==len(t):\n        print('automaton')\n        exit(0)\n    else:\n        c = 0\n        for i in range(len(s)):\n            if ss[i] == st[c]:\n                c += 1\n            if c == len(t): break\n        if c == len(t):\n            print('both')\n            exit(0)\n    print('need tree')", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "7d85d09a1b29812cb982c775587cc5bf", "src_uid": "edb9d51e009a59a340d7d589bb335c14", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from decimal import *\na=input()\nb=Decimal(a)\nif(round(b)==b):\n    print (\"%d\"%b)\nelse:\n    print (b)\n\n\t \t \n", "lang_cluster": "Python", "tags": ["brute force", "math", "strings", "implementation"], "code_uid": "be1db919446c5f1826acb35a3fb43933", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x, y = raw_input().split('.')\nl = y.split('e')\nl.append(x)\nd, b, a = map(str, l)\n   \nif d == '0':\n    d = '' + '0' * int(b)\nelif int(b) == len(d):\n    ans = a + d\nelif int(b) > len(d):\n    d = d + '0' * (int(b) - len(d))\nelse:\n    d = d[0:int(b)] + '.' + d[int(b):]\n    \nans = a + d\n    \nprint ans", "lang_cluster": "Python", "tags": ["brute force", "math", "strings", "implementation"], "code_uid": "c0a7b4d2f6e7419f2fe2d9094e496835", "src_uid": "a79358099f08f3ec50c013d47d910eef", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/python\ndef triangle(l):\n    return l[0] + l[1] > l[2]\n\ndef degenerate(l):\n    return l[0] + l[1] == l[2]\n\ndef solve(l):\n    for i in range(4):\n        copy = list(l)\n        del copy[i]\n        if triangle(copy):\n            return \"TRIANGLE\"\n\n    for i in range(4):\n        copy = list(l)\n        del copy[i]\n        if degenerate(copy):\n            return \"SEGMENT\"\n    return \"IMPOSSIBLE\"\n\nl = sorted(map(int, raw_input().split(\" \")))\n\nprint solve(l)\n", "lang_cluster": "Python", "tags": ["brute force", "geometry"], "code_uid": "0bf9c62f8a55af234cb2351fd693faf5", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input()\n\n#s = '4 2 1 3'\n#s = '7 2 2 4'\n#s = '10 10 10 10'\ns = s.split(' ')\nl = [int(s[0]),int(s[1]),int(s[2]),int(s[3])]\nl.sort()\ntmp = l[0]\n\nif l[0] + l[1] > l[2]:\n\tprint(\"TRIANGLE\")\nelse:\n\tl.pop(0)\n\tif l[0] + l[1] > l[2]:\n\t\tprint(\"TRIANGLE\")\n\telse:\n\t\tl.append(tmp)\n\t\tl.sort()\n\t\tif l[0] + l[1] == l[2] or l[1] + l[2] == l[3]:\n\t\t\tprint(\"SEGMENT\")\n\t\telse:\n\t\t\tprint(\"IMPOSSIBLE\")", "lang_cluster": "Python", "tags": ["brute force", "geometry"], "code_uid": "e1ccdedc4adcff3c7e092dd30bc7cf6c", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "code = input()\nb = 96\nres = True\nfor k in code:\n    if ord(k) > b + 1:\n        res = False\n    elif ord(k) == b + 1:\n        b += 1\nif res:\n    print(\"YES\")\nelse:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["greedy", "strings", "implementation"], "code_uid": "70407adfc09239648fc890261d02dac1", "src_uid": "c4551f66a781b174f95865fa254ca972", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "if __name__ == '__main__':\n    obfuscation = input()\n    letters = 'abcdefghijklmnopqrstuvwxyz'\n\n    obfuscation = list(obfuscation)\n    letters = list(letters)\n\n    i = len(obfuscation)\n    posibility = 'NO'\n    while i:\n        if obfuscation[0] != letters[0]:\n            posibility = 'NO'\n            break\n        else:\n            while letters[0] in obfuscation:\n                obfuscation.remove(letters[0])\n                i -= 1\n                if len(obfuscation) == 0:\n                    posibility = 'YES'\n                    break\n            letters.remove(letters[0])\n\n    print(posibility)", "lang_cluster": "Python", "tags": ["greedy", "strings", "implementation"], "code_uid": "a682dc2f576fcf7c5e1ff861157b5073", "src_uid": "c4551f66a781b174f95865fa254ca972", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = [int(i) for i in input().split(\" \")]\nna = [int(i) for i in input().split(\" \")]\nma = [int(i) for i in input().split(\" \")]\nintersection = set(na) & set(ma)\nif len(intersection) != 0:\n\tprint(min(intersection))\nelse:\n\tarr = set()\n\tfor i in na:\n\t\tfor j in ma:\n\t\t\tarr.add(i*10+j)\n\t\t\tarr.add(j*10+i)\n\tprint(min(arr))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "7b10a5dd878a349f713d3acf2d892bde", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m=[int(x) for x in input().split()]\na=set([int(x) for x in input().split()])\nb=set([int(x) for x in input().split()])\nc=list(a&b)\nif len(c)!=0:\n    print(min(c))\nelse:\n    e=str(min(a))+str(min(b))\n    print(min([int(e),int(e[::-1])]))", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "a511b08e23af2af89259009b3b398a35", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\nn,a,b,c = map(int,sys.stdin.readline().split())\nn=n%4\nmn=100000000000000\nfor i in range(64):\n    l=n\n    sm=0\n    aa=i%4\n    sm+=a*aa\n    l+=aa\n    aa=i/4\n    bb=aa%4\n    l+=2*bb\n    sm+=b*bb\n    cc=aa/4\n    l+=3*cc\n    sm+=cc*c\n    if l%4==0:\n      if sm<mn:\n        mn=sm\n\nprint mn\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "89bd45d03aa39511f0b471cbee8500dd", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,a,b,c = map(int,raw_input().split())\nif n%4==0:\n\tprint 0\nelse:\n\ts=4-n%4\n\tif s==1:\n\t\tprint min(a,b+c,c*3)\n\telif s==2:\n\t\tprint min(a*2,b,c*2)\n\telse:\n\t\tprint min(a*3,a+b,c)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "a961d0d3f9cbd3ed5cb98b4e5a5ab59c", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s = input()\ncurr = 0\nmax_jump = 0\nfor c in s:\n    curr += 1\n    max_jump = max(curr, max_jump)\n    if c == 'A' or c == 'E' or c == 'I' or c == 'O' or c == 'U' or c == 'Y':\n        curr = 0\n\ncurr += 1\nmax_jump = max(curr, max_jump)\nprint(max_jump)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "ab0906ab9539a4c334160a3178f05071", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def main():\n    inpstr = raw_input()\n    ans = 0\n    tmpans = 1\n    vowels = [ 'A', 'E', 'I', 'O', 'U', 'Y' ]\n    for ch in inpstr:\n        if ch in vowels:\n            ans = max( ans, tmpans )\n            tmpans = 1\n        else:\n            tmpans = tmpans + 1\n    ans = max( ans, tmpans )\n    print ans \n\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "efde51ac0aff1d9e551fc4277780d0db", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "la = sorted(input().split())\nres = 2\nif int(la[0][0]) == int(la[1][0]) - 1 == int(la[2][0]) - 2:\n    if la[0][1] == la[1][1] == la[2][1]:\n        res = 0\n    elif la[0][1] == la[1][1] or la[1][1] == la[2][1] or la[0][1] == la[2][1]:\n        res = 1\nelif la[0][0] == la[1][0] == la[2][0]:\n    if la[0][1] == la[1][1] == la[2][1]:\n        res = 0\n    elif la[0][1] == la[1][1] or la[1][1] == la[2][1] or la[0][1] == la[2][1]:\n        res = 1\nelse:\n    if int(la[0][0]) == int(la[1][0]) - 2:\n        if la[0][1] == la[1][1]:\n            res = 1\n    if int(la[1][0]) == int(la[2][0]) - 2:\n        if la[1][1] == la[2][1]:\n            res = 1\n    if int(la[0][0]) == int(la[2][0]) - 2:\n        if la[0][1] == la[2][1]:\n            res = 1\n    if int(la[0][0]) == int(la[2][0]) - 1:\n        if la[0][1] == la[2][1]:\n            res = 1\n    if int(la[1][0]) == int(la[2][0]) - 1:\n        if la[1][1] == la[2][1]:\n            res = 1\n    if int(la[0][0]) == int(la[1][0]) - 1:\n        if la[0][1] == la[1][1]:\n            res = 1\n    if int(la[0][0]) == int(la[1][0]):\n        if la[0][1] == la[1][1]:\n            res = 1\n    if int(la[1][0]) == int(la[2][0]):\n        if la[1][1] == la[2][1]:\n            res = 1\n    if int(la[0][0]) == int(la[2][0]):\n        if la[0][1] == la[2][1]:\n            res = 1\nprint(res)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "ee7dc81e03f851a2b4cdb78046e69041", "src_uid": "7e42cebc670e76ace967e01021f752d3", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# coding: UTF-8\nimport sys\n#sys.setrecursionlimit(n)\nimport heapq\nimport re\nimport bisect\nimport random\nimport math\nimport itertools\nfrom collections import defaultdict, deque\nfrom copy import deepcopy\nfrom decimal import *\n\nreadl= lambda: list(map(str, sys.stdin.readline().split()))\nreadt= lambda: tuple(map(int, sys.stdin.readline().split()))\nread = lambda: sys.stdin.readline().rstrip()\nreadi = lambda: int(read())\nreadmi = lambda: map(int, sys.stdin.readline().split())\nreadms = lambda: map(str, sys.stdin.readline().split())\n\nt = readl()\nn = []\nm = []\nt.sort()\nfor i in t:\n    n.append(int(i[0]))\n    m.append(i[1])\ncount = 2\nif m[0] == m[1] == m[2]:\n    if n[0] == n[1] == n[2] or (n[0] + 1 == n[1] and n[1] + 1 == n[2]):\n        print(0)\n    elif n[0] == n[1] or n[0] == n[2] or n[1] == n[2]:\n        print(1)\n    elif n[0] + 1 == n[1] or n[0] + 2 == n[1] or n[1] + 1 == n[2] or n[1] + 2 == n[2] or n[0] + 1 == n[2] or n[0] + 2 == n[2]:\n        print(1)\n    else:\n        print(2)\nelif m[0] == m[1]:\n    if n[0] == n[1] or n[0] + 1 == n[1] or n[0] + 2 == n[1]:\n        print(1)\n    else:\n        print(2)\nelif m[0] == m[2]:\n    if n[0] == n[2] or n[0] + 1 == n[2] or n[0] + 2 == n[2]:\n        print(1)\n    else:\n        print(2) \nelif m[1] == m[2]:\n    if n[1] == n[2] or n[1] + 1 == n[2] or n[1] + 2 == n[2]:\n        print(1)\n    else:\n        print(2)\nelse:\n    print(2)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "1ffd32a907dd7cfa3cd6c04642a7850b", "src_uid": "7e42cebc670e76ace967e01021f752d3", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "nnn=\"312831303130313130313031312831303130313130313031312831303130313130313031\"\nnnl=\"312831303130313130313031312831303130313130313031312931303130313130313031\"\nnln=\"312831303130313130313031312931303130313130313031312831303130313130313031\"\nlnn=\"312931303130313130313031312831303130313130313031312831303130313130313031\"\nN=int(input())\ns=input().split()\ns=''.join(s)\nif s in nnn or s in nnl or s in nln or s in lnn:\n\tprint(\"YES\")\nelse:\n\tprint(\"NO\")\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f7a483432ed1a322351a74139510608e", "src_uid": "d60c8895cebcc5d0c6459238edbdb945", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def solution():\n    days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n    n = int(raw_input())\n    arr = list(map(int, raw_input().split()))\n    ans = False\n    for i in range(12):\n        v_present = False\n        break_check = False\n        for j in range(n):\n            if days[(i + j) % 12] != arr[j]:\n                if days[(i + j) % 12] == 28 and arr[j] == 29 and not v_present:\n                    v_present = True\n                    continue\n                break_check = True\n                break\n        if not break_check:\n            ans = True\n            break\n    return ans\n\n\nif __name__ == '__main__':\n    if solution():\n        print 'Yes'\n    else:\n        print 'No'\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "7ded217550bbe98ce82924f620668910", "src_uid": "d60c8895cebcc5d0c6459238edbdb945", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "import math\r\ndef lcm(i,j):\r\n  return i//math.gcd(i,j)*j\r\n\r\nn,m=map(int,input().split())\r\n\r\nc=[0]*20\r\nfor bit in range(1,1<<20):\r\n  bitcnt=0\r\n  L=1\r\n  mx=-1\r\n  right=1<<30\r\n  left=-1\r\n  for i in range(20):\r\n    if (bit>>i)&1:\r\n      bitcnt+=1\r\n      mx=i\r\n      left=i+1\r\n      right=min(right,m*(i+1))\r\n      if L!=-1:\r\n        L=lcm(L,i+1)\r\n        if L>2**28:\r\n          L=-1\r\n  if L==-1:\r\n    continue\r\n  if bitcnt%2==1:\r\n    c[mx]+=max(0,right//L-(left-1)//L)\r\n  else:\r\n    c[mx]-=max(0,right//L-(left-1)//L)\r\n\r\nfor i in range(1,20):\r\n  c[i]+=c[i-1]\r\n\r\nseen=[False]*(n+1)\r\nseen[1]=True\r\nans=1\r\n\r\nfor i in range(2,n+1):\r\n  if seen[i]:continue\r\n  tmp=1\r\n  now=i\r\n  seen[now]=True\r\n  while now*i<=n:\r\n    tmp+=1\r\n    now*=i\r\n    seen[now]=True\r\n  \r\n  ans+=c[tmp-1]\r\n\r\nprint(ans)", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "number theory"], "code_uid": "7e2fcba0e2880d970543298b0f0794a2", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "import sys\r\nfrom math import floor, sqrt\r\n\r\ninput = sys.stdin.readline\r\n\r\ndef main():\r\n\tn, m = map(int, input().split())\r\n\r\n\trar = [-1]*(n+1)\r\n\r\n\tfor i in range(2, n+1):\r\n\t\tif rar[i] == -1:\r\n\t\t\trar[i] = 1\r\n\t\t\tcuri = i*i\r\n\t\t\twhile curi <= n:\r\n\t\t\t\trar[i] += 1\r\n\t\t\t\trar[curi] = 0\r\n\t\t\t\tcuri *= i\r\n\r\n\tans = 0\r\n\r\n\tcheck = [0] * (m*20 + 1)\r\n\r\n\tkar = [0] * (21)\r\n\r\n\tfor k in range(1, 21):\r\n\t\tfor j in range(k, m*k + 1, k):\r\n\t\t\tcheck[j] = 1\r\n\t\tkar[k] = sum(check)\r\n\r\n\t#print(kar)\r\n\r\n\tfor i in range(2, n+1):\r\n\t\tif rar[i]:\r\n\t\t\tans += kar[rar[i]]\r\n\r\n\r\n\t\t\t\t\r\n\r\n\r\n\t#print(rar)\r\n\r\n\tprint(ans + 1)\r\n\r\n\r\nmain()", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "number theory"], "code_uid": "64780e8323617821c1ebf028399ff083", "src_uid": "6ca310cb0b6fc4e62e63a731cd55aead", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\nif n%4==0:\n\tprint((n//2)//2-1)\nelif n%2==0:\n\tprint((n//2)//2)\nelse:\n\tprint(0)\t\t\t\t\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "b35ac314026002407372d4a4752e1d31", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\n\nif n % 2 != 0:\n    print '0'\nelif n % 4 == 0:\n    print str(n/4 - 1)\nelse:\n    print str(n/4)", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "f3e0bd2ad98286865741edefac79b249", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\ninput=sys.stdin.buffer.readline\n\nn,m=map(int,input().split())\narr=list(map(int,input().split()))\ns=0\nans=0\nfor i in range(n):\n\ts+=arr[i]\n\tif s>m:\n\t\tans+=1\n\t\ts=arr[i]\nif s>0:\n\tprint(ans+1)\nelse:\n\tprint(ans)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "ba8868f3a4008cb4aa783b61bd1c2cda", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "I=lambda:map(int,raw_input().split())\nn,m=I();a=I();k=b=0\nfor i in range(n):\n    k+=[0,1][b+a[i]>m]\n    b=[b+a[i],a[i]][b+a[i]>m]\nprint k+1", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "247371a76024d36dd8abd5d51c84db85", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "for i in range(1):\n    n,m,k=map(int,input().split())\n    s=(m+k)%n\n    if s==0:\n        print(n)\n    else:\n        print(s)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "da3abf19b7ef387466a9c7fd5850b9b0", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "def main():\n\tn,a,b = map(int,raw_input().split())\n\tif b > 0:\n\t\tarr = range(a,n+1)+range(1,a)\n\telse:\n\t\tarr = range(a,0,-1)+range(n,a,-1)\n\t#print arr\n\tans = a\n\tfor i in range(1,abs(b)+1):\n\t\tans = arr[i%n]\n\tprint ans\nmain()", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "061291d025b08eb9881988a7604b6820", "src_uid": "cd0e90042a6aca647465f1d51e6dffc4", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n1=int(input())\na=int(n1/1234567)\nb=int(n1/123456)\nt=0\nresultado=0\nfor x in range(0,a+1):\n    for i in range(0,b+1):\n        resultado=n1-(1234567*x+123456*i)\n        if(resultado%1234==0 and resultado>=0):\n            print(\"YES\")\n            t=1\n            break\n    if(t==1):\n        break\nif(t==0):\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "b9adee697d1c5b42ab1bee93003405fa", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\nfor a in range(2000):\n    for b in range((n-1234567*a)//123456+50):\n        rem = n - 1234567*a - 123456 * b\n        if (rem%1234 == 0 and rem//1234 >= 0):\n            print(\"YES\")\n            quit()\nprint(\"NO\")\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "f06c2bdaffb552c6dfd1738b66d4f023", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# print (\"Input digits and base for number one\")\nn1, b1 = (int(x) for x in input().split())\n# print (\"Input all the digits\")\nd1 = list(int(x) for x in input().split())\nd1.reverse()\n\n# print (\"Input digits and base for number two\")\nn2, b2 = (int(x) for x in input().split())\n# print (\"Input all the digits\")\nd2 = list(int(x) for x in input().split())\nd2.reverse()\n\n# Compute base ten representation of number one\nanswer1 = 0\npower1 = 1\nfor digit in d1:\n    answer1 += digit*power1\n    power1 *= b1\n# print(answer1)\n\n# Compute base ten representation of number two\nanswer2 = 0\npower2 = 1\nfor digit in d2:\n    answer2 += digit*power2\n    power2 *= b2\n# print(answer2)\n\nif answer1 < answer2:\n    print(\"<\")\nelif answer2 < answer1:\n    print(\">\")\nelse:\n    print(\"=\")\n\n    \n\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "5d2534cf865c2e35261f5d50a163ee60", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n, bx = map(int, raw_input().split())\nx = map(int, raw_input().split())\nm, by = map(int, raw_input().split())\ny = map(int, raw_input().split())\n\nnumx = 0\nfor e, v in enumerate(reversed(x)):\n    numx += v*(bx**e)\nnumy = 0\nfor e, v in enumerate(reversed(y)):\n    numy += v*(by**e)\n\nif numx < numy:\n    print('<')\nelif numx > numy:\n    print('>')\nelse:\n    print('=')\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "314a4151107409d3972b7922b8183553", "src_uid": "d6ab5f75a7bee28f0af2bf168a0b2e67", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "from collections import defaultdict, OrderedDict\nInputList = lambda Dtype : [Dtype(x) for x in input().split()]\ndef solve():\n\tN = int(input())\n\tans = [0,3,5,7,8]\n\tif N < 5: return ans[N]\n\tdef valid(x):\n\t\treturn x % 4 == 0 or x & 1\n\tdef loc(x):\n\t\tp = x-1\n\t\tdone_upto = (p+1)//2 - 1 + (p//4) - 1\n\t\treturn done_upto+1 if valid(x) else done_upto\n\tMin = 0; Max = 3*10**9\n\twhile Min < Max:\n\t\tMid = (Min+Max)//2\n\t\tif loc(Mid) == N:\n\t\t\treturn Mid if valid(Mid) else Mid-1\n\t\tif loc(Mid) < N:\n\t\t\tMin = Mid+1\n\t\telse:\n\t\t\tMax = Mid\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\nReturnMode = True\nt = 1\n\nif not t: t = int(input())\n\nif ReturnMode:\n\tfor _ in range(t):\n\t\tans = solve()\n\t\tif type(ans) == list: print(*ans)\n\t\telse: print(ans)\nelse: \n\tfor _ in range(t): solve()\n", "lang_cluster": "Python", "tags": ["math", "geometry", "binary search"], "code_uid": "b8a7f1cc6189383c661f7edc42cbc168", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\r\n\r\nbase = 3\r\nif n == 1:\r\n    print(base)\r\nelse:\r\n    krug = n // base\r\n    if n % base == 2:\r\n        krug += 1 \r\n    \r\n    res = 5\r\n    res += (krug - 1) * 4\r\n    if n % base == 0:\r\n        res += 2\r\n    elif n % base == 1:\r\n        res += 3\r\n    \r\n    print(res)", "lang_cluster": "Python", "tags": ["math", "geometry", "binary search"], "code_uid": "1c961450efb62f57aec739358eae7d47", "src_uid": "d0a8604b78ba19ab769fd1ec90a72e4e", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\nmod4 = n % 4\nif mod4 == 1:\n    print(8)\nelif mod4 == 2:\n    print(4)\nelif mod4 == 3:\n    print(2)\nelif n == 0:\n    print(1)\nelse:\n    print(6)", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "d5a2c925c91d5625646f0887b8429d1d", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\n\nif n==0:\n    print(1)\nelif n%4==1:\n    print(8)\n\n\nelif n%4==2:\n    print(4)\n\n\nelif n%4==3:\n    print(2)\n\n\nelif n%4==0:\n    print(6)", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "432cb10df5fda23d733baa51286fa373", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nn, k = map(int, input().split())\n\ndiffs = []\nfor i in range(1, math.ceil(math.sqrt(n)) + 1):\n    if n % i == 0:\n        a = i*k + (n//i)\n        b = k*(n//i) + i\n        if (a // k) * (a % k) == n:\n            diffs.append(a)\n        if (b // k) * (b % k) == n:\n            diffs.append(b)\n\n# print(diffs)\nans = min(diffs)\nprint(ans)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "83f3ef4575863aba2b09b270268e9fec", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a,b=input().split()\na=int(a)\nb=int(b)\nfor i in reversed(range(b)):\n    if a%i==0:\n        print(int(((a*b)/i)+i))\n        break\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "0a1d03e00ae651f28b6d364e57e53c39", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, k = map(int, input().split())\na = input()\na = a.lower()\nf = [0] * 26\nfor i in a:\n    f[ord(i) - 97] += 1\nif max(f) > k:\n    print(\"NO\")\nelse:\n    print(\"YES\")\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "0efc6376ee6f1b20adfdaf1e661db9b7", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = map(int, raw_input().split())\nc = raw_input()\nmp = {}\n\n\nfor i in c:\n    try:\n        mp[i] += 1\n    except:\n        mp[i] = 1\n\nmaxx = 0\nfor key, value in mp.iteritems():\n    if value > maxx:\n        maxx = value\n\nif maxx > s[1]:\n    print \"NO\"\nelse:\n    print \"YES\"\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "dcb34e63165e0e5b3463fd78af2929dd", "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def solve():\n    m = 10**6 + 3\n    p = input()\n    p = p.replace(\">\",\"1000\")\n    p = p.replace(\"<\", \"1001\")\n    p = p.replace(\"+\", \"1010\")\n    p = p.replace(\"-\", \"1011\")\n    p = p.replace(\".\", \"1100\")\n    p = p.replace(\",\", \"1101\")\n    p = p.replace(\"[\", \"1110\")\n    p = p.replace(\"]\", \"1111\")\n    x = int(p,2) % m\n    print(x)\nsolve()", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f20743c64f7e95d2342b6407d6a00936", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def bintodec(s):\n    num=0\n    mod=1000003\n    p=2\n    k=0\n    for i in range(len(s)-1,-1,-1):\n        num+= int(s[i])*(p**k)\n        k+=1\n        num=num%mod\n    return num%mod\n    \n\ndic={'>':'1000' , '<' : '1001' , '+' : '1010' , '-' :'1011' , '.':'1100' ,',':'1101','[':'1110',']':'1111'}\ns= input()\nans=''\nmod=1000003\nfor i in range(len(s)):\n    ans+=dic[s[i]]\nprint(bintodec(ans))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "da08d9857d1e588de0bb494a6829e60c", "src_uid": "04fc8dfb856056f35d296402ad1b2da1", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, m = map( int, raw_input().split())\nres = 1\nfinal = 1\nfor i in range(m):\n  res = res*2 % (10**9 +9)\nfor i in range(n):\n    final = (final*(res-1)) % (10**9+9)\n    res -= 1\nprint final \n  \n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "combinatorics"], "code_uid": "3e6622f52f3d4491990e4595a3e50cd5", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, m = map(int, raw_input().split())\n\nk = (2 ** m) % 1000000009\nx = 1\ny = k - 1\nkk = k\nfor i in xrange(1, n):\n    kk = (kk * k) % 1000000009\n    x = ((i + 1) * y + k * x) % 1000000009\n    y = (kk - x) % 1000000009\nprint y\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "combinatorics"], "code_uid": "01988ec00f99917148a8ef0ae7d69cb1", "src_uid": "fef4d9c94a93fcf6d536f33503b1d4b8", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "mem = dict()\n\ndef C(f,h,kf,kh,kf_init,kh_init):\n    if f + h == 0:\n        return 1\n    else:\n        if (f,h,kf,kh) not in mem:\n            mem[(f,h,kf,kh)] = F(f,h,kf,kh,kf_init,kh_init) + H(f,h,kf,kh,kf_init,kh_init)\n        return mem[(f,h,kf,kh)]\n\ndef F(f,h,kf,kh,kf_init,kh_init):\n    if f>0 and kf>0:\n        return C(f-1,h,kf-1,kh_init,kf_init,kh_init)\n    else:\n        return 0\n\ndef H(f,h,kf,kh,kf_init,kh_init):\n    if h>0 and kh>0:\n        return C(f,h-1,kf_init,kh-1,kf_init,kh_init)\n    else:\n        return 0\n\nf,h,kf_init,kh_init = map(int,input().split())\nprint(C(f,h,kf_init,kh_init,kf_init,kh_init) % 100000000)", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "4731eb4df4bf98f0d46638ba253718c8", "src_uid": "63aabef26fe008e4c6fc9336eb038289", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from sys import stdin, setrecursionlimit\nfrom collections import *\nfrom types import GeneratorType\n\n# setrecursionlimit(200000)\nadd = lambda a, b: (a % mod + b % mod) % mod\nrints, mod = lambda: [int(x) for x in stdin.readline().split()], 100000000\n\n\ndef bootstrap(f, stack=[]):\n    def wrappedfunc(*args, **kwargs):\n        if stack:\n            return f(*args, **kwargs)\n        else:\n            to = f(*args, **kwargs)\n            while True:\n                if type(to) is GeneratorType:\n                    stack.append(to)\n                    to = next(to)\n                else:\n                    stack.pop()\n                    if not stack:\n                        break\n                    to = stack[-1].send(to)\n            return to\n\n    return wrappedfunc\n\n\n@bootstrap\ndef dp(i1, i2, j, k):\n    if i1 + i2 >= n1 + n2:\n        yield 1\n\n    # print(i1, i2, j, k)\n    if mem[i1][i2][j][k] != -1:\n        yield mem[i1][i2][j][k]\n\n    mem[i1][i2][j][k] = 0\n    if i1 < n1:\n        if j != 0:\n            t = yield dp(i1 + 1, i2, 0, 1)\n            mem[i1][i2][j][k] = add(mem[i1][i2][j][k], t)\n\n        elif k < k1:\n            t = yield dp(i1 + 1, i2, 0, k + 1)\n            mem[i1][i2][j][k] = add(mem[i1][i2][j][k], t)\n\n    if i2 < n2:\n        if j != 1:\n            t = yield dp(i1, i2 + 1, 1, 1)\n            mem[i1][i2][j][k] = add(mem[i1][i2][j][k], t)\n\n        elif k < k2:\n            t = yield dp(i1, i2 + 1, 1, k + 1)\n            mem[i1][i2][j][k] = add(mem[i1][i2][j][k], t)\n\n    yield mem[i1][i2][j][k]\n\n\nn1, n2, k1, k2 = rints()\nmem = [[[[-1 for _ in range(11)] for _ in range(3)] for _ in range(101)] for _ in range(101)]\nprint(dp(0, 0, 2, 0))\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "3b9f5b12b92c81126b805f3f6478a16c", "src_uid": "63aabef26fe008e4c6fc9336eb038289", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\nimport os\nimport random\nimport re\nimport sys\n \n# Complete the function below.\n \ns=str(input())\ns=s.lower()\n \nvowels = ('a', 'e', 'i', 'o', 'u', 'y')  \nfor x in s: \n    if x in vowels: \n        s = s.replace(x, \"\")\na='.'+'.'.join(s)\n \nprint(a)", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "65c8589054a33fb292815468a4fa6600", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a = list(input().lower())\nb=str()\nfor i in range(len(a)):\n    if a[i] not in 'aoyeui':\n        b += '.'+a[i]\nprint(b)", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "54b97d870485d87dcab45e99542d759b", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "y,b,r=map(int,input().split())\nm=min(y,b,r)\nif y==b and y==r:\n    print(3*b-3)\nelse:\n    if m==y and y!=b and y!=r:\n        if r<y+2:\n            print(3*y)\n        else:\n            print(3*y+3)\n    elif m==b and b!=r:\n        print(3*b)\n    elif m==r:\n        print(3*r-3)", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "0de5afa1aac9fa3ee7daae04ef25e11b", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "y, b, r = map(int, input().split())\nm=1;n=2; o=3\nmix = 6\nwhile m<y and n<b and o<r:\n    m+=1; n+=1; o+=1\n    mix = (m+n+o)\nprint(mix)", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "9e38f08016b4c6411279f122a19069d4", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "l = []\n\nfor _ in range(11):\n    s = input().replace(' ', '')\n    if len(s):\n        l.append(list(s))\n\nx, y = map(int, input().split())\n\nx -= 1\ny -= 1\n\nx %= 3\ny %= 3\n\nok = False\n\nfor i in range(x * 3, x * 3 + 3):\n    for j in range(y * 3, y * 3 + 3):\n        if l[i][j] == '.':\n            ok = True\n            l[i][j] = '!'\n\nif not ok:\n    for i in range(9):\n        for j in range(9):\n            if l[i][j] == '.':\n                l[i][j] = '!'\n\nfor i in range(9):\n    for j in range(9):\n        print(l[i][j], end='')\n        if j % 3 == 2:\n            print(' ', end='')\n    print()\n    if i % 3 == 2:\n            print()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f106deef1b83721c53763480e59bfddf", "src_uid": "8f0fad22f629332868c39969492264d3", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    ls = []\n    for i in range(11):\n        l = list(filter(lambda c: c != ' ', input()))\n        if l:\n            ls.append(l)\n\n    r, c = list(map(lambda c: int(c) - 1, input().split(' ')))\n\n    flag = False\n    cr, cc = r % 3, c % 3\n    for i in range(cr * 3, cr * 3 + 3):\n        for j in range(cc * 3, cc * 3 + 3):\n            if ls[i][j] not in ['x', 'o']:\n                ls[i][j] = '!'\n                flag = True\n    \n    if not flag:\n        for i in range(9):\n            for j in range(9):\n                if ls[i][j] not in ['x', 'o']:\n                    ls[i][j] = '!'\n\n    for i in range(3):\n        for j in range(3):\n            l = ls[i * 3 + j]\n            print(' '.join(map(lambda xx: ''.join(xx), [l[0:3], l[3:6], l[6:9]])))\n        print('')\n\nmain()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "1eff3d9c8d659d65ba2ba2b25b161ece", "src_uid": "8f0fad22f629332868c39969492264d3", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input().split(\" \")\ndif = []\nfor letter in s:\n  if letter in dif: continue\n  else : dif.append(letter)\n\nprint 4 - len(dif)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "94a48debdf4cd266aa38b3db86066c0e", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "sum=input()\ncolors=sum.split()\ncount=dict()\nd=0\nfor color in colors:\n    count[color]=count.get(color,0)+1\nfor i,j in count.items():\n    if j>1:\n        d=d+j-1\nprint(d)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "89f68fb05c6545b9d0c48e01c35f107c", "src_uid": "38c4864937e57b35d3cce272f655e20f", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "maximal = 1000000007\ndef binpow (a, n):\n    if n==0:\n        return 1\n    if n%2 == 1:\n        return (binpow(a, n-1) * a) % maximal\n    else:\n        b = binpow(a, int(n/2)) % maximal\n        return (b*b) % maximal\nn, m = map(int, input().split())\nsf = (binpow(2, m) - 1 + maximal) % maximal\nrez = binpow(sf, n) % maximal\nprint(str(int(rez)))\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "af69ac65982c72a414ade5438e1c874f", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m = map(int,input().split())\np = 10**9+7\nprint(pow((pow(2,m,p)-1),n,p))\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "b84dd26488e5345e428efc0c01d5a49b", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def check(h,m):\n    if('7' in str(h) or '7' in str(m)):\n        return True\n    return False\n\n\nx=int(input())\nh,m=map(int,input().split())\nc=0\nwhile True:\n    if not check(h,m):\n        m-=x\n        c+=1\n        if m<0:\n            m=(m+60)%60\n            h-=1\n        if h<0:\n            h=23\n            m=(m+60)%60\n    else:\n        break\nprint(c)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "4a0d9fdb2f8cce93a73f95e60e8d1a4f", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "f=[7,17,27,37,47,57]\nx=input()\ns=raw_input()\nh,m=map(int,s.split())\nif '7' in s:\n    print 0\nelse:\n    t=h*60+m\n    cnt=1\n    while True:\n        t=(t-x)%1440\n        h,m=t/60,t%60\n        if h in f or m in f:\n            print cnt\n            exit()\n        else:\n            cnt+=1\n    print cnt", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "79f4518e6c2c9e525dd4c9d5a30a271c", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\n\nsum = 1\n\nfor i in range(1, n):\n    sum = sum + 4 * i\n    \nprint(sum)", "lang_cluster": "Python", "tags": ["math", "dp", "implementation"], "code_uid": "e7cbbaf50f15604762d4ec5f4d0827da", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main(args):\n    n=int(input())\n    a=1\n    for i in range(n):\n        a+=i*4\n    print(a)\n\nif __name__ == '__main__':\n    import sys\n    sys.exit(main(sys.argv))", "lang_cluster": "Python", "tags": ["math", "dp", "implementation"], "code_uid": "ce6d8ae32278e4014b09808dd347d47f", "src_uid": "758d342c1badde6d0b4db81285be780c", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nn = int(input())\nnums = input().split()\nfor i in range(n):\n    nums[i] = int(nums[i])\nnums.sort()\nif (nums[n-1] > 25):\n    print(nums[n-1] - 25)\nelse:\n    print(0)\n\n\n\n\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "25e15f0209d09a77ff1d228f164035ce", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\nl = map(int,raw_input().split())\nl.sort()\nif l[n-1]<=25:\n    print 0\nelse:\n    print l[n-1]-25\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "b37843556cda9212226491b596d36bb4", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a=int(raw_input())\ns=('','Washington','Adams','Jefferson','Madison','Monroe','Adams','Jackson','Van Buren','Harrison','Tyler','Polk','Taylor','Fillmore','Pierce','Buchanan','Lincoln','Johnson','Grant','Hayes','Garfield','Arthur','Cleveland','Harrison','Cleveland','McKinley','Roosevelt','Taft','Wilson','Harding','Coolidge','Hoover','Roosevelt','Truman','Eisenhower','Kennedy','Johnson','Nixon','Ford','Carter','Reagan')\nprint s[a]", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "49a63c53c659515a30265bd69f987927", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "names = {\n    1: \"Washington\",\n    2: \"Adams\",\n    3: \"Jefferson\",\n    4: \"Madison\",\n    5: \"Monroe\",\n    6: \"Adams\",\n    7: \"Jackson\",\n    8: \"Van Buren\",\n    9: \"Harrison\",\n    10: \"Tyler\",\n    11: \"Polk\",\n    12: \"Taylor\",\n    13: \"Fillmore\",\n    14: \"Pierce\",\n    15: \"Buchanan\",\n    16: \"Lincoln\",\n    17: \"Johnson\",\n    18: \"Grant\",\n    19: \"Hayes\",\n    20: \"Garfield\",\n    21: \"Arthur\",\n    22: \"Cleveland\",\n    23: \"Harrison\",\n    24: \"Cleveland\",\n    25: \"McKinley\",\n    26: \"Roosevelt\",\n    27: \"Taft\",\n    28: \"Wilson\",\n    29: \"Harding\",\n    30: \"Coolidge\",\n    31: \"Hoover\",\n    32: \"Roosevelt\",\n    33: \"Truman\",\n    34: \"Eisenhower\",\n    35: \"Kennedy\",\n    36: \"Johnson\",\n    37: \"Nixon\",\n    38: \"Ford\",\n    39: \"Carter\",\n    40: \"Reagan\",\n    41: \"Bush\",\n    42: \"Clinton\",\n    43: \"Bush\",\n    44: \"Obama\"\n    }\ndef main():\n    n = int(input())\n    print(names[n])\n    return\n\nmain()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "c77379a90113b61da9a06b47d8e75102", "src_uid": "0b51a8318c9ec0c80c0f4dc04fe0bfb3", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "t, s, x = map(int, input().split())\nprint('YES' if x - t >= 0 and x - t != 1 and (x - t) % s <= 1 else 'NO')", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "9b48092e1e3dbbf4822bf53d0c1927e1", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "t, s, x = map(int, raw_input().split())\n\nif t == x:\n\tprint 'YES'\nelse:\n\tif x==t:\n\t\tprint 'YES'\n\telif (x-t)%s in [0,1] and (x-t)>=0 and x!=t+1 :\n\t\tprint 'YES'\n\telse:\n\t\tprint 'NO'\t", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "53b3ac7a461623524e64db71ff3fc630", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "iIn1=int(input())\niIn2=int(input())\niIn3=int(input())\niIn4=int(input())\nprint(((iIn1^iIn2)&(iIn3|iIn4))^((iIn2&iIn3)|(iIn1^iIn4)))", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "1a1e1bcec324a48c7a33aeb05b3d0dab", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "arr = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0,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 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0,\n0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]\nx, y = map(int, input().split())\nif arr[y][x]:\n    print('IN')\nelse:\n    print('OUT')", "lang_cluster": "Python", "tags": ["dfs and similar", "geometry", "implementation"], "code_uid": "f4e493c413e2f42dd1093ad7bfab0cb5", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import itertools\n\ndp = [[[0 for x in xrange(2)] for x in xrange(110)] for x in xrange(110)]\nmod = 1000000007\ndata = map(int, raw_input().split())\n\nn = data[0]\nk = data[1]\nd = data[2]\ndp[0][0][0] = 1\nans = 0\nfor i in range(1, n + 1):\n\tfor j in range(0, n + 1):\n\t\tfor g in range(1, k + 1):\n\t\t\tif(g > j):\n\t\t\t\tbreak\n\t\t\tif(g >= d):\n\t\t\t\tdp[i][j][1] += dp[i - 1][j - g][0]\n\t\t\t\tdp[i][j][1] += dp[i - 1][j - g][1]\n\t\t\telse:\n\t\t\t\tdp[i][j][0] += dp[i - 1][j - g][0]\n\t\t\t\tdp[i][j][1] += dp[i - 1][j - g][1]\n\n\t\t\tdp[i][j][1] %= mod\n\t\t\tdp[i][j][0] %= mod\n\t\tans += dp[i][n][1]\n\t\tans %= mod\nprint ans", "lang_cluster": "Python", "tags": ["dp", "implementation", "trees"], "code_uid": "eded406418d76caba8e031b0d0abb8d3", "src_uid": "894a58c9bba5eba11b843c5c5ca0025d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, k, d = map(int, input().split())\nk = n if n<k else k\ncnt = [0 for _ in range(n+1)]\ncn = [0 for _ in range(n+1)]\ncnt[0] = cn[0] = 1\nfor i in range(1,n+1):\n    for j in range(1,k+1):\n        if i>=j:\n            cnt[i] += cnt[i-j]\n        if i>=j and j<d:\n            cn[i] += cn[i-j]\ns1 = cnt[n]\ns2 = cn[n]\nprint((s1-s2)%1000000007)", "lang_cluster": "Python", "tags": ["dp", "implementation", "trees"], "code_uid": "1625d09f2634ea51f42b20ea15c636b0", "src_uid": "894a58c9bba5eba11b843c5c5ca0025d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# map(int, raw_input().split())\n\na, b, c, d = map(int, raw_input().split())\n\ncount = 0\n\nif a <= b <= c:\n\n    v1 = a\n\n    v2 = b\n\n    v3 = c\n\nelif a <= c <= b:\n\n    v1 = a\n\n    v2 = c\n\n    v3 = b\n\nelif b <= a <= c:\n\n    v1 = b\n\n    v2 = a\n\n    v3 = c\n\nelif b <= c <= a:\n\n    v1 = b\n\n    v2 = c\n\n    v3 = a\n\nelif c <= a <= b:\n\n    v1 = c\n\n    v2 = a\n\n    v3 = b\n\nelse:\n\n    v1 = c\n\n    v2 = b\n\n    v3 = a\n\ncount = 0\n\nif v3-v2 < d:\n\n    count += d-(v3-v2)\n\nif v2-v1 < d:\n\n    count += d-(v2-v1)\n\nprint count", "lang_cluster": "Python", "tags": ["math"], "code_uid": "efbe67efb92943090a9c4376cd7864ae", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b, c, d = map(int, raw_input().split())\na, b, c = sorted((a, b, c,))\nprint max(d - (b - a), 0) + max(d - (c - b), 0)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "6824411d42d9e9f5689e1661136e2683", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "h = []\nv = []\nfor i in range(8):\n    s = input()\n    sl = [i for i in s]\n    h.append(sl)\nfor i in range(8):\n    x = []\n    for j in range(8):\n        x.append(h[j][i])\n    v.append(x)\nans = 0\n\nfor i in h:\n    x = list(set(i))\n    if(len(x)==1 and x[0]=='B'):\n        ans+=1\nfor i in v:\n    x = list(set(i))\n    if(len(x)==1 and x[0]=='B'):\n        ans+=1\nif(ans==16):\n    print(8)\nelse:\n    print(ans)", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms"], "code_uid": "fce9bff91353b76aad9d94ea1282b8fd", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#7A - Kalevitch and Chess\n#We get the costumer's requested board: 8 lines of input\n# W - white\n# B - black\norder = []\nfor i in range(8):\n    order.append(input())\n#Firstly, we create a variable allBlack (reference to an all-black row) and\n    #set it to be true\nallBlack = True\n#We instantiate the count of strokes as zero\ncount = 0\n#Now, we iterate through the board, row by row\nfor row in order:\n    #If we find a row with all 8 swuares marked as black ('B')\n    if row == \"BBBBBBBB\":\n        #We clearly add 1 stroke to the count\n        count += 1\n    else:\n        #else, we say that it's not an all-black row\n        allBlack = False\n#Let's assume that all of the board's squares are marked with 'B'\n#It doesn't matter if we have already iterated through rows,\n#it's allowed to over-paint a square when rows of black cross columns of black\n#The next loop is actually to find columns of black squares\nfor i in range(8):\n    count += 1\n    for ii in range(8):   #This is the second loop, because we have a board of 8x8\n        #If the square is marked with 'W', we bring the count one step back\n        if order[ii][i] == \"W\":\n            count -= 1\n            break\n#The simpliest case: if we got the count result to be 16 black squares,\n            #we will subsequently need 8 strokes\n        #We print this directly, just so our program wouldn't bother\n        #to count the obvious and return a bigger count\nif count == 16:\n    print(\"8\")\n    #Else, we print the number of counts previously computed\nelse:\n    print(count)", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms"], "code_uid": "8f80de3f88ec804850b25ec4b104c1b5", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\nrange = xrange\ninput = raw_input\n\nMOD = 998244353\n\nn,m = [int(x) for x in input().split()]\n\nif n == 2:\n    print 0\n    sys.exit()\n\nk = n - 2\nbig = 3 * 10**5\nchoose = [0] * big\nchoose[k] = 1\nfor i in range(k + 1, big):\n    choose[i] = choose[i - 1] * i * pow(i - k, MOD - 2, MOD) % MOD\n\ns = 0\nfor maxval in range(n - 1, m + 1):\n    s = (s + choose[maxval - 1] * pow(2, n - 3, MOD) * (n - 2)) % MOD\nprint s\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "adc3278f031bb8257c232f01abf06977", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = map(int, input().split())\n\nif n == 2:\n\tprint(0)\n\texit()\n\nmod = 998244353 \nans = ((n-2) * pow(2, n-3, mod)) % mod\n# print(ans)\nfor i in range(m-n+2, m+1):\n\tans = (ans * i) % mod\n# print(ans)\nfact = 1\nfor i in range(2, n):\n\tfact = (fact*i) % mod\n\nfact = pow(fact, mod-2, mod)\nans = (ans * fact) % mod\n\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "b004e39b937b9c1ad4b0251299f48968", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m,z = map(int,raw_input().split())\ndef lcm(x, y):\n   if x > y:\n       z = x\n   else:\n       z = y\n\n   while(True):\n       if((z % x == 0) and (z % y == 0)):\n           lcm = z\n           break\n       z += 1\n\n   return lcm     \nprint (int(z/lcm(n,m)))", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "8b296a16bcd35e53a4cb575b5622a5fa", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m, z = map(int, input().split())\nc = [int(i) for i in range(n, z+1, n)]\na = [int(i) for i in range(m, z+1, m)]\nt = 0\nfor i in c:\n    if i in a:\n        t += 1\nprint(t)", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "5893cddc522764868fb47886045ddb3e", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nfor i in range(int(n**0.5),0,-1):\n\tif n % i == 0:\n\t\tr = i\n\t\tbreak\nprint(r,n//r)", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "09084879814d593fa25bf4221559e05c", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\n\ndef getFactors(x):\n\n    factors = []\n    for i in range(1, int(n**0.5) + 1):\n       if x % i == 0:\n           factors.append(i)\n    \n    return factors\n\nf = getFactors(n)\nb = int( n // f[-1])\na = int( n // b)\nprint( a, b)\n\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "2db5d5733e875eed176ed5122f648dc1", "src_uid": "f52af273954798a4ae38a1378bfbf77a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# -*- coding: cp1251 -*-\nk=[int(j) for j in raw_input(\"\").split()]\n\nn =k[0]  #1\nm =k[1]  #2 \n\ni1 =k[2]  #1  \nj1 =k[3]  #2 \n\na =k[4]  #1  \u0432\u0432\u0435\u0440\u0445 \u0432\u043d\u0438\u0437  | \nb =k[5]  #2  \u0432\u043b\u0435\u0432\u043e \u0432\u043f\u0440\u0430\u0432\u043e  <= =>\n\n# oops! \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u043a\u043e\u043d\u0444\u0435\u0442\u0430 \u0441\u0440\u0430\u0437\u0443 \u0432 \u043d\u0443\u0436\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438))\nif (j1==1 and i1 ==1) or (i1==n and j1==1) or (i1==1 and j1==m) or (i1==n and j1==m):\n    print(\"0\")\n\nelse:\n    # \u043d\u0435\u044f\u0432\u043d\u044b\u0439 \u0431\u0430\u0433: \u043f\u043e\u043b\u0435 \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438 \u0438\u043b\u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430 1, \u0447\u0435\u043c \u0448\u0430\u0433\n    # \u0432\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e\n\n    if n<=a or m<=b:\n        print(\"Poor Inna and pony!\")\n    else:\n\n        # \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0439\u0442\u0438 \u0434\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b (\u0438\u0445 4) \u0431\u0435\u0437 \u0443\u0447\u0435\u0442\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438\n        c=[0]*4\n\n        # 1,1\n        if (i1-1)%a ==0 and (j1-1)%b ==0:\n           if (abs(i1-1)//a + abs(j1-1)//b)%2 == 0:\n                c[0]=max(abs(i1-1)//a, abs(j1-1)//b)\n\n        # n,1  leviy nizhniy\n        if (i1-n)%a ==0 and (j1-1)%b ==0:\n            if (abs(i1-n)//a + abs(j1-1)//b)%2 == 0:\n                c[1]=max(abs(i1-n)//a, abs(j1-1)//b)\n            \n        # 1,m  leviy nizhniy\n        if (i1-1)%a ==0 and (j1-m)%b ==0:\n            if (abs(i1-1)//a + abs(j1-m)//b)%2 == 0:\n                c[2]=max(abs(i1-1)//a, abs(j1-m)//b)\n\n        # n,m  leviy nizhniy\n        if (i1-n)%a ==0 and (j1-m)%b ==0:\n            if (abs(i1-n)//a + abs(j1-m)//b)%2 == 0:\n                c[3]=max(abs(i1-n)//a, abs(j1-m)//b)\n\n\n\n        if c.count(0)==4:\n            print(\"Poor Inna and pony!\")\n        else:\n            c=set(c)\n            c.discard(0)\n            \n            print(min(c))\n\n\n\n\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "ba2bca38d26f2daf06ca0214f45c3478", "src_uid": "51155e9bfa90e0ff29d049cedc3e1862", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m,i,j,a,b = map(int,input().split())\n\npath1=path2=path3=path4=10000000000\n\ntemp1 =temp2=temp3=temp4=0\nif int((i-1)/a) == (i-1)/a and int((j-1)/b) == (j-1)/b:\n\n\n    path1 = (i-1)/a\n    path_1 = (j-1)/b\n    # print(path1,path_1)\n    if path1%2 == 0 and path_1%2 == 0 :\n        path1 = max(path1,path_1)\n        temp1 = 1\n    elif path1%2 != 0 and path_1%2 !=0 :\n        path1 = max(path1,path_1)\n        temp1 = 1\n\n    else:\n        path1 = 100000000000\n        temp1 = 0\n\nif int((i-1)/a) == (i-1)/a and int((m-j)/b) == (m-j)/b:\n    temp = 1\n    path2 = (i-1)/a\n    path_2 = (m-j)/b\n    if path2%2 == 0 and path_2%2 ==0 :\n        path2 = max(path2,path_2)\n        temp2 = 1\n    elif path2%2 != 0 and path_2%2 !=0 :\n        path2 = max(path2,path_2)\n        temp2 = 1\n\n    else:\n        path2 = 100000000000\n        temp2 = 0\n\n\n\nif int((n-i)/a) == (n-i)/a and int((j-1)/b) == (j-1)/b:\n    temp = 1\n    path3 = (n-i)/a\n    path_3 = (j-1)/b\n    if path3%2 == 0 and path_3%2 ==0 :\n        path3 = max(path3,path_3)\n        temp3 = 1\n\n    elif path3%2 != 0 and path_3%2 !=0 :\n        path3 = max(path3,path_3)\n        temp3 = 1\n\n    else:\n        path3 = 10000000000000\n        temp3 = 0\n\nif int((n-i)/a) == (n-i)/a and int((m-j)/b) == (m-j)/b:\n    temp = 1\n    path4 = (n-i)/a\n    path_4 = (m-j)/b\n    if path4%2 == 0 and path_4%2 ==0 :\n        path4 = max(path4,path_4)\n        temp4 = 1\n    elif path4%2 != 0 and path_4%2 !=0 :\n        path4 = max(path4,path_4)\n        temp4 = 1\n    else:\n        path4 = 1900000000000\n        temp4 = 0\n\nmini = min(path1,path2,path3,path4)\nif ((i + a > n and i - a < 1) or (j+b > m and j-b < 1)) and mini!=0:\n    print(\"Poor Inna and pony!\")\n\nelif temp1==0 and temp2==0 and temp3==0 and temp4==0:\n    print(\"Poor Inna and pony!\")\nelse:\n    print(int(min(path1,path2,path3,path4)))\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "71c4e5ee34f9d2fe4641e6f37385b5ea", "src_uid": "51155e9bfa90e0ff29d049cedc3e1862", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,a,b = map(int, raw_input().split())\ndiff = abs(a-b)\nif a>b:\n\ta ,b= b,a\nl = [i for i in range(1,n+1)]\nflag = True\nk=n\nrounds =1\nwhile flag:\n\n\tk=len(l)\n\tif k==2:\n\t\tprint \"Final!\"\n\t\tflag = False\n\t\tbreak\n\trm = []\n\ttmp =[]\n\t#print l\n\tfor i in range(0,k-1,2):\n\t\tc = l[i]\n\t\td =l[i+1]\n\t\tif c == a and b==d:\n\t\t\tprint rounds\n\t\t\tflag =False\n\t\telif c == a:\n\t\t\ttmp.append(c)\n\t\telif d == a:\n\t\t\ttmp.append(d)\n\t\telif c == b:\n\t\t\ttmp.append(c)\n\t\telif d == b:\n\t\t\ttmp.append(d)\n\t\telse:\n\t\t\ttmp.append(c)\n\tl = tmp[:]\n\trounds += 1\n\n\t#print \"hello\"", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "33b54182ff7f972dd21b3b760e9055e6", "src_uid": "a753bfa7bde157e108f34a28240f441f", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "c,a,b=input().split()\nc=int(c)\nlevel=0\nwhile c!=1:\n    level+=1\n    c//=2\na=int(a)-1\nb=int(b)-1\nroundik=0\nwhile a!=b:\n    roundik+=1\n    a//=2\n    b//=2\nif roundik==level:\n    print(\"Final!\")\nelse:\n    print(roundik)", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "fe26456ae3105f8652e100359ffabc37", "src_uid": "a753bfa7bde157e108f34a28240f441f", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def exp(a,p,m):\n    if(p==0):\n        return 1\n    elif(p==1):\n        return a\n    elif(p%2==0):\n        x = exp(a,p>>1,m)\n        return x*x\n    else:\n        return (a*exp(a,p-1,m))%m\ndef prog(s):\n    l = len(s)\n    x = int(s,2)%((10**9)+7)\n    e = exp(2,l-1,(10**9)+7)\n    return (x*e)%((10**9)+7)\ns = raw_input()\nprint prog(s)\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "f624774485b69fea7da9e78ba80b2679", "src_uid": "89b51a31e00424edd1385f2120028b9d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "X = (raw_input())\nn = len(X)\nx = int(X,2)\nprint ((2**(n-1))*(x))%1000000007\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "ad17695c950a53f9cfa41a69ae98d196", "src_uid": "89b51a31e00424edd1385f2120028b9d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n\nimport sys\n\nlength = int(sys.stdin.readline())\nline = sys.stdin.readline()\ni = 0\nres = 0\nwhile i < length:\n\td = [0] * 256\n#\tsys.stdout.write(\"char = \" + line[i] + '\\n')\n\twhile i < length and line[i] >= 'a' and line[i] <= 'z':\n\t\tc = ord(line[i])\n\t\td[c] += 1\n\t\ti += 1\n\tsubres = 0\n\tfor j in range(0, 256):\n#\t\tsys.stdout.write(\"d[\" + str(j) + \"] = \" + str(d[j]) + '\\n')\n#\t\tsys.stdout.write(\"d[j] = \" + str(d[j]) + '\\n')\n\t\tsubres += min(d[j], 1)\n#\tsys.stdout.write(\"subres = \" + str(subres) + '\\n')\n\tres = max(subres, res)\n\twhile i < length and line[i] >= 'A' and line[i] <= 'Z':\n#\t\tsys.stdout.write(\"capital char = \" + line[i] + '\\n')\n\t\ti += 1\nsys.stdout.write(str(res))\n", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "7c41c3d9e69b1b50749f56ef8915b393", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import string\nn=input()\ns=raw_input()\nmaxi=-1\nans=[]\nfor i in range(n):\n    t=s[i]\n    if t in string.lowercase:\n        if t not in ans:\n            ans.append(s[i])\n    else:\n        maxi=max(maxi,len(ans))\n        ans=[]    \nprint max(maxi,len(ans))", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "838633e1def2103753ef80377f4a1d39", "src_uid": "567ce65f87d2fb922b0f7e0957fbada3", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def solve(v):\n    if v < 3:\n        return \"NO\"\n    else:\n        i = 0\n        while 3*i <= v:\n            if (v - 3*i) % 7 == 0:\n                return \"YES\"\n            i += 1\n        return \"NO\"\n\nn = int(raw_input())\nfor _ in range(n):\n    v = int(raw_input())\n    print solve(v)\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "eb57196174312c565e4326c13919e84d", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def calculator(a):\n    if a%3 == 0 or a%7 == 0:\n        return \"YES\"\n    while a>=3:\n        a-=7\n        if a>0 and a%3==0:\n            return \"YES\"\n    return \"NO\"\nfor i in range(int(input())):\n    print(calculator(int(input())))\n    ", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "cc26a8f50c3655dde6009e86559dc2e1", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def pop():\n    global head\n    head-=1\n    if head<0:\n        return 'a'\n    return q[head]\n\nx = int(input())\nx1 =x\nst = input()\ns = ''\nq = []\nhead=0\nfor i in range(ord('a'),ord('a')+x1,1):\n    flag = 0\n    for j in st:\n        if j == chr(i):\n            flag = 1\n    if flag == 0 and chr(i)!='?':\n        q.append(chr(i))\n        head+=1\nflag1=1\nif (len(st)%2  == 1):\n    s=st[len(st)//2]\n    if (s==\"?\"):\n        s=pop()\n    st=st[0:len(st)//2] + st[len(st)//2 +1 : len(st)]\nfor i in range((len(st))//2 - (len(st)+1)%2 ,-1,-1):\n    if st[i] !='?':\n        s=st[i]+s\n        if (st[len(st)-1-i] =='?' or st[len(st)-1-i]== st[i]):\n            s+=st[i]\n        else:\n            flag1=0\n            break\n    else:\n        if (st[len(st)-1-i] == '?'):\n            chs=pop()\n            s+= chs\n            s=chs+s\n            if (x != 1):\n                x-=1\n        else:\n            s=st[len(st)-1-i]+s\n            s+=st[len(st)-1-i]\n\nfor i in range(ord('a'),ord('a')+x1,1):\n    flag = 0\n    for j in s:\n        if j == chr(i):\n            flag = 1\n    if flag == 0:\n        break\nif flag==1 and flag1==1 :\n    print(s)\nelse:\n    print(\"IMPOSSIBLE\")\n\n            \n", "lang_cluster": "Python", "tags": ["expression parsing"], "code_uid": "47c36fca2488b065bd77f206a1dfd378", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "k = int(input())\ns = input()\nans = ['' for _ in range(len(s))]\nr = set([chr(ord('a')+x) for x in range(k)]) - set(s)\nr = list(r)\nr.sort(reverse=True)\n\nc = 0\nfor i in range(len(s)//2):\n    if s[i] == '?' and s[-i - 1] == '?':\n        c += 1\nif len(s) % 2 == 1 and s[len(s)//2] == '?':\n    c += 1\n\nc -= len(r)\nfor i in range(len(s)//2):\n    if s[i] == '?' and s[-i-1] == '?':\n        if c > 0:\n            ans[i] = 'a'\n            c -= 1\n        else:\n            ans[i] = r.pop()\n        ans[-i-1] = ans[i]\n    elif s[i] == '?':\n        ans[i] = ans[-i-1] = s[-i-1]\n    elif s[-i-1] == '?':\n        ans[-i-1] = ans[i] = s[i]\n    else:\n        if s[i] == s[-i-1]:\n            ans[i] = ans[-i-1] = s[i]\n        else:\n            print('IMPOSSIBLE')\n            break\nelse:\n    if len(s) % 2 == 1:\n        if s[len(s)//2] == '?':\n            if r:\n                ans[len(s)//2] = r.pop()\n            else:\n                ans[len(s)//2] = 'a'\n        else:\n            ans[len(s)//2] = s[len(s)//2]\n    if r:\n        print('IMPOSSIBLE')\n    else:\n        print(*ans, sep='')\n", "lang_cluster": "Python", "tags": ["expression parsing"], "code_uid": "71d5a876d095f37778d4db6628a3d186", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nif(n%5==0):\n   u = n/5\nelse:\n   k = n/5\n   u = k+1\nprint(int(u))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "193759ed065ac5ad263fe5acf2fc8fee", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin\n\nx = int(stdin.readline())\nprint(-(-x//5))\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "a5124a4110281271919a91aa3620e711", "src_uid": "4b3d65b1b593829e92c852be213922b6", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b,c = input(),input(),input()\nans=max(a*(b+c),a+b+c,(a+b)*c,a*b*c)\nprint ans\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "adfb732caad746751467f59681ef3ccf", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n1 = int(raw_input())\nn2 = int(raw_input())\nn3 = int(raw_input())\nop1  = n1 + n2 + n3\nop2 = n1*n2*n3\nop3 = (n1 + n2)*n3\nop4 = n1 * (n2 + n3)\nop5 = n1 * n2 + n3\nop6 = n1 + n2 * n3\nlista = [op1, op2, op3, op4, op5, op6]\nprint max(lista)", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "52178d1e55a7a46e1269933f65e7efea", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\nmax=0\nmin=0\nif (m==0 and n!=1) or m>9*n:\n    print(-1,-1)\nelif n==1 and m==0:\n    print(0,0)\nelse:\n    min=10**(n-1)\n    for i in range(m-1):\n        a=(i//9)\n        min+=10**a\n    max=0\n    for i in range(m):\n      b=(n-1-i//9)\n      max+=10**b\n    print(min,max)\n", "lang_cluster": "Python", "tags": ["greedy", "dp", "implementation"], "code_uid": "aa7045bfd1bcc038516c12641bac9029", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s1=(raw_input(\"\")).split(\" \")\nn=int(s1[0])\ns=int(s1[1])\nl=[]\nsum=s\nif sum<=0 or sum>(9*n):\n    if n==1 and sum==0:\n        print \"0 0\"\n    else:\n        print \"-1 -1\"\n    \nelif sum<=9*n:\n    for i in range(n):\n        if sum>=9:\n            l.append(\"9\")\n            sum=sum-9\n        elif sum<9 and sum>0:\n            l.append(str(sum))\n            sum=0\n        elif sum==0:\n            l.append(\"0\")\n    t=\"\"\n    t=\"\".join(l)\n\n    maxi=t\n    j=1\n    flag=1\n    if t[n-1]=='0':\n        j=0\n\n        while t[n-1-j]=='0':\n            flag=0\n            j+=1\n    mini=\"\"\n    if j==(n-1) and flag==0:\n        for i in range(n):\n            if i==0:\n                mini=mini+str((s-1))\n            elif i==n-1:\n                mini=mini+\"1\"\n            else:\n                mini=mini+\"0\"\n        q=''.join(reversed(mini))\n        \n\n        print  q,maxi\n    \n    elif flag==0:\n        k=\"\"\n        for i in range(n):\n            if i!=n-1-j and i!=n-1:\n                k=k+t[i]\n            elif i==n-1-j:\n                k=k+\"0\"\n            else:\n                k=k+t[n-1-j]\n        q=''.join(reversed(k))\n        f=0\n        if q[0]!=\"1\":\n            f=int(q[0])-1\n        h=\"\"\n        for i in range(n):\n            if i==0:\n                h=h+\"1\"\n            elif i==j:\n                h=h+str(f)\n            else:\n                h=h+q[i]\n        print h ,maxi\n\n   \n\n        \n    else:\n        for i in range(n):\n            mini=mini+t[n-1-i]\n        print mini ,maxi\n\n    \n\n     \n", "lang_cluster": "Python", "tags": ["greedy", "dp", "implementation"], "code_uid": "33bd1e0106261d9d77faa35118697bde", "src_uid": "75d062cece5a2402920d6706c655cad7", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from datetime import datetime\ns = datetime.strptime(input(), '%H:%M')\nt = datetime.strptime(input(), '%H:%M')\n\nsec = (s - t).seconds\nhours, rem = divmod(sec, 60**2)\nminutes, sec = divmod(rem, 60)\nprint(str(hours).zfill(2) + ':' + str(minutes).zfill(2))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "df0ab6cea4b32bd0ae17f902cbd1e606", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def f():v=raw_input();return 60*int(v[:2])+int(v[-2:])\nx=f()-f()\nprint\"%02d:%02d\"%(x/60%24,x%60)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "1846bc730de9ffc7ec50de3683e3ed5a", "src_uid": "595c4a628c261104c8eedad767e85775", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x, y, z = map(int, input().split())\na, b, c = map(int, input().split())\nif x <= a and y <= a+b-x and z <= a+b+c-y-x:\n\tprint('YES')\nelse:\n\tprint(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "greedy", "implementation"], "code_uid": "b3b0d434f049555706f458823bd95bc7", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x, y, z =  map(int, input().split())\n\n\na, b, c = map(int, input().split())\n\nn = True\nif x <= a and (x + y) <= (a + b) and (x + y + z) <= (a + b + c):\n    n = False\nif n:\n    print('NO')\nelse:\n    print(\"YES\")\n", "lang_cluster": "Python", "tags": ["brute force", "greedy", "implementation"], "code_uid": "56f393116458e49588a208941dff7e70", "src_uid": "d54201591f7284da5e9ce18984439f4e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=input()\na=map(int,raw_input().split())\nk=0\nwhile(1):\n    n-=a[k%7]\n    if n<=0:\n        print k%7+1;break\n    k+=1", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "a1b61c262d78ad653e8f4b5d648c464a", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=input()\nm=map(int,raw_input().split())\nc = 0\nwhile n > m[c]:\n    n -= m[c]\n    c = (c + 1)%7\nprint c + 1    ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "80da9f19506eff7fcc9671c216c62f24", "src_uid": "007a779d966e2e9219789d6d9da7002c", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\ns = input().split(' ')\nM = 0\nfor word in s:\n    c = 0\n    for char in word:\n        if char.isupper():\n            c += 1\n    M = max(c, M)\nprint(M)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "04bc5118bed4891e1071235cdf338ade", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=input()\ntext=raw_input().split()\nmaxd=0\nl=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']\nfor i in range(len(text)):\n    cnt=0\n    for j in range(len(text[i])):\n        if text[i][j] in l:\n            cnt+=1\n        if cnt>maxd:\n            maxd=cnt\nprint maxd\n            \n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "3f438df2814063a8d48eb2d046cc0d39", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m=map(int,input().split())\nmod=10**9+7\n\nB=[1]\nW=[1]\nBB=[0]\nWW=[0]\n\nfor i in range(1,100010):\n    x=W[-1]+WW[-1]\n    y=B[-1]+BB[-1]\n    z=B[-1]\n    w=W[-1]\n\n    x%=mod\n    y%=mod\n    z%=mod\n    w%=mod\n\n    B.append(x)\n    W.append(y)\n    BB.append(z)\n    WW.append(w)\n\nprint((B[n-1]+W[n-1]+BB[n-1]+WW[n-1]+B[m-1]+W[m-1]+BB[m-1]+WW[m-1]-2)%mod)\n\n\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "93f2aaa0492dc81c6351841812664f99", "src_uid": "0f1ab296cbe0952faa904f2bebe0567b", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "mod = 10**9 + 7\n\nn, m = map(int, raw_input().strip().split())\n\nF = [0, 1]\nfor i in range(2, 100002):\n    F.append(F[i - 1] + F[i - 2])\n    F[i] %= mod\n\nres = 2 * ((F[m + 1] + F[n + 1] - 1)) % mod\nprint(res)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "b4996f615e9f230194f56fd63cadb66b", "src_uid": "0f1ab296cbe0952faa904f2bebe0567b", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "\nif __name__ == \"__main__\":\n    a, b = map(int, raw_input().split())\n    c, d = map(int, raw_input().split())\n\n    res = None\n    for y in range(1000):\n        if b > d:\n            if ((b - d) + y * a) % c == 0:\n                res = b + y * a\n                break\n        else:\n            if ((d - b) + y * c) % a == 0:\n                res = d + y * c\n                break\n\n    if res:\n        print res\n    else:\n        print -1\n\n", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "d48ab3742092f9a41eaeb746198b4d96", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n\ndef solve():\n    a, b = map(int, input().split())\n    c, d = map(int, input().split())\n\n    if b < d:\n        a, c = c, a\n        b, d = d, b\n\n    for i in range(c):\n        if (b - d + i*a) % c == 0:\n            ans = b + i*a\n            print(ans)\n            return\n\n    print(-1)\n\nif __name__ == '__main__':\n    solve()", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "2b4d89d5ec323a8b3448b28a3d18bf29", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,k=map(int,input().split(' '))\na=list(map(int,input().split(' ')))\nvalue=1000000000000\nfor i in (a):\n    if k%i==0:\n        b=int(k/i)\n        if value>b:\n            value=b\nprint(value)   \n        \n    \n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "81e535bdb3f841713db59f5539a20173", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "nk=raw_input()\nNK=[]\nNK=nk.split(' ')\nfor i in range(len(NK)):\n    NK[i]=int(NK[i])\nK=NK[1]\n\n\nch=raw_input()\nch+=' '\nn=len(ch)\n\n\nH=0\nch1=''\ni=0\nwhile( i<n):\n    if(ch[i] != ' '):\n        ch1+=ch[i]\n    else:\n        S=int(ch1)\n        if((K%S==0) and( S>H)):\n            H=S\n        ch1=''\n    i+=1\n\n  \nprint(K/H)\n        \n        \n    \n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "bd9ab6f7ac3226585f7e297b5df9b2d0", "src_uid": "80520be9916045aca3a7de7bc925af1f", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "t, s, q = map(int, input().split())\nr = 1\nwhile t > s * q:\n    s *= q\n    r += 1\nprint(r)\n    \n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "8c9c8726bab6a1aa6a72fee385579963", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "t, s, q = map(int, input().split())\nans = 1\nwhile s * q < t:\n    ans += 1\n    s *= q\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "b950499001cf34b2448297cfdcdd1e19", "src_uid": "0d01bf286fb2c7950ce5d5fa59a17dd9", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,s = raw_input().split()\n\nn,s = int(n), int(s)\ntot=0\nx=raw_input().split()\n\nm = int(max(i for i in x))\n\nfor i in x:\n\ttot+=int(i)\n\nif(tot-m<=s):\n\tprint \"YES\"\nelse:\n\tprint \"NO\"", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "5a59d38af8bf47ef7c50a19c10206c77", "src_uid": "496baae594b32c5ffda35b896ebde629", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def solve(a, s):\n    a.sort()\n    return sum(a[:-1]) <= s\n\nn, s = map(int, raw_input().split())\na = map(int, raw_input().split())\nprint 'YES' if solve(a, s) else 'NO'\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "818166660e36960b9de67aa8f049ce5b", "src_uid": "496baae594b32c5ffda35b896ebde629", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m=map(int,raw_input().split(\" \"))\nmini=n-(2*m)\ns=0\nmaxi=0\nfor i in range(n+1):\n\tif ((i*(i-1))/2)>=m:\n\t\tmaxi=n-i\n\t\tbreak\n\nmini=max(0,mini)\nprint mini,maxi\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "graphs"], "code_uid": "9f7d5ec21c632587f8d46c9d32254e93", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\n\nidx = 0\nwhile (idx * (idx - 1) // 2) < m:\n    idx += 1\n\nprint(max(0, n - m * 2), max(0, n - idx))\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "graphs"], "code_uid": "11fb46bd5c42246201221ad0cdfabab5", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin, stdout\n\n\ndef main():\n    word = stdin.readline()\n    if word.isupper() or word[0].islower() and word[1:].isupper():\n        stdout.write(word.swapcase())\n    elif len(word) == 2 and word.islower():\n        stdout.write(word.upper())\n    elif len(word) == 2 and word.isupper():\n        stdout.write(word.lower())\n    else:\n        stdout.write(word)\n\n\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "b43691ec4f0ba4a188a1e97719736c3b", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = raw_input()\nif a[:1].islower() == True and a[1:].isupper():\n    print a[:1].upper() + a[1:].lower()\nelif a.isupper() == True:\n    print a.lower()\nelif len(a) == 1 and a.islower() == True:\n    print a.upper()\nelse:\n    print a", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "320b9d9ddeb0176c715e1abdb22b9687", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "S=raw_input().split()\nif(S[-1]=='?'):\n\tx=S[-2][-1].lower()\nelse:\n\tx=S[-1][-2].lower()\nif(x=='a' or x=='e' or x=='i' or x=='o' or x=='u' or x=='y'):\n\tprint \"YES\"\nelse:\n\tprint \"NO\"\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "367fe98043152b33ecfa5260c277846d", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a=input().replace(' ','')\nprint('YES' if a.strip().lower()[-2] in 'aeiouy' else \"NO\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "0df7f7625d37884463f6ecec4d35e323", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a= raw_input().split()\nb=list(set(a))\nl=len(b)\nif l>3:\n    print \"Alien\"\nelif l==1:\n    print \"Elephant\"\nelif l==2:\n    i0=a.count(b[0])\n    i1=a.count(b[1])\n    if i0<4 and i1<4:\n        print \"Alien\"\n    elif i0==5 or i1==5:\n        print \"Bear\"\n    else:\n        print \"Elephant\"\nelse:\n    i0=a.count(b[0])\n    i1=a.count(b[1])\n    i2=a.count(b[2])\n    if max(i0,i1,i2)!=4:\n        print \"Alien\"\n    else:\n        print \"Bear\"\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "d3a78b72ea350aae5f66557c95c3f6f9", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "l = list(map(int, input().split(\" \")))\ns = list(set(l))\nm = max(list(map(lambda x: l.count(x), s)))\nif m < 4:\n    print(\"Alien\")\nelif m == 5 or len(s) == 3:\n    print(\"Bear\")\nelse:\n    print(\"Elephant\")\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "384ebf9eb85f60cd2366bc696700e055", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "m,n=map(int,input().split())\r\nA=[input()for _ in range(m)]\r\nS=int(A[0][0]=='*')\r\ni,j=0,0\r\nwhile i<m-1 or j<n-1:\r\n if j==n-1or i<m-1and A[i+1][j]=='*':i+=1\r\n else:j+=1\r\n S+=int(A[i][j]=='*')\r\nprint(S)", "lang_cluster": "Python", "tags": ["greedy", "implementation", "shortest paths"], "code_uid": "9ab1c231b64699258f2aeabe3b7c8e11", "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\na=[input()for i in range(n)]\nl=[]\nfor i in range(n):\n    for j in range(m):\n        if a[i][j]=='*':\n            l+=[(i,j)]\nnow=(0,0)\nans=int(now in l)\nwhile True:\n    mn=99\n    mnt=now\n    for i in l:\n        if i!=now and i[0]>=now[0] and i[1]>=now[1] and mn>sum(i)-sum(now):\n            mn=sum(i)-sum(now)\n            mnt=i\n    if mn==99:\n        break\n    now=mnt\n    ans+=1\nprint(ans)", "lang_cluster": "Python", "tags": ["greedy", "implementation", "shortest paths"], "code_uid": "b3adeecd6825905125c0c00de1090520", "src_uid": "f985d7a6e7650a9b855a4cef26fd9b0d", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input()\nout = 0\nl = [4,7]\nfor ch in s:\n    if ch == '4' or ch == '7':\n        out +=1\nprint(['NO','YES'][any(out == i for i in l)])", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "7049e918c9f4d42b5d1b61be8687e69f", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "inp=input()\ncount=0\ncount2=0\nfor i in inp:\n    if i=='4':\n        count=count+1\n    elif i=='7':\n        count2=count2+1\n\nif (count==4 or count==7) and count2==0:\n    print('YES')\nelif (count2==4 or count2==7) and count==0:\n    print('YES')\nelif count+count2==4 or count+count2==7:\n    print('YES')\nelse:\n    print('NO')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f91d9ae0920fe7715b0ddd669b156e98", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    d, k, a, b, t = map(int, input().split())\n    ans = 0\n    dc = d//k\n    dr = d % k\n    if not dc:\n        print(a*dr)\n    else:\n        way1 = dc*(k*a + t) + dr*a\n        way2 = dc*(k*a + t) - t + dr*b\n        way3 = k*a + (d-k)*b\n        print(min(\n            way1,\n            way2,\n            way3\n        ))\n\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "b8944325b6e0e1db7dac27b7d043f016", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nd, k, a, b, t = map(int, input().split())\n\ndistance = a * t /((b -a )*b) + t /b\ntime = 0\nn = math.ceil((d-distance)/k)\n\n# print(distance)\n# print(n)\nif (k>d):\n    print(d*a)\n    exit(0)\nif (k<distance):\n    time = k*a + (d-k)*b\n    print(time)\n    exit(0)\nif (n*k >=d):\n    time = a*d + d//k*t\n    if (d%k==0):\n        time -= t\nelse:\n    time = n*k*a + (n-1)*t +(d - n*k)*b\nprint(time)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "d3c687ff9f1e2d5778ef0513476bf1be", "src_uid": "359ddf1f1aed9b3256836e5856fe3466", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\n\nmax = 2*(n/7) + min(n%7, 2)\nmin = 2*(n/7)\nif n%7 == 6:\n\tmin+=1\n\nprint min, max", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "brute force"], "code_uid": "6ebd0a2ed2c40bd344814a1e59b60430", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "x=int(input())\nlu=0\nzo=0\nx0=x\nwhile x>0:\n    if x==1:\n        lu+=1\n        x=0\n    elif x>1 and x<7:\n        lu+=2\n        x=0\n    lu+=(x//7)*2\n    x%=7\nwhile x0>0:\n    if x0==6:\n        zo+=1\n        x0=0\n    elif x0<6:\n        x0=0\n    zo+=(x0//7)*2\n    x0%=7\nprint(zo,lu)", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "brute force"], "code_uid": "6e25d100c099583a049d8a60947c9464", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=input()\nout=\"\"\nfor i in n:\n    if i=='7':\n        out+=\"1\"\n    else:\n        out+=\"0\"\nout=out[::-1]\np=0\nfor i in range(len(out)):\n    if out[i]=='0':\n        p+=2**i\n    else:\n        p+=2**(i+1)\nprint(p)", "lang_cluster": "Python", "tags": ["brute force", "implementation", "combinatorics", "bitmasks"], "code_uid": "662c444307e01fc493a48d90c66aa3f7", "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "strno=input()\nn=len(strno)\nsum1=0\nfor i in range(1,n):\n    sum1 += 1<<i\nfor i in range(n):\n    if strno[i]=='7':\n        sum1 += 1<<(n-i-1)\nprint(sum1+1)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "combinatorics", "bitmasks"], "code_uid": "fb6cfef97fd4db13d14f8e18137490ac", "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    n, k = laie()\n    l, ans, h = 0, 0, n * k\n\n    while l <= h:\n        m = (l + h) // 2\n        if fun(m, n, k):\n            ans, h = m, m - 1\n        else:\n            l = m + 1\n\n    print(ans)\n\n\ndef fun(m, n, k):\n    cnt = 0\n    b = 1\n    while m // b != 0:\n        cnt += m // b\n        b *= k\n    return cnt >= n\n\nfrom sys import *\nimport inspect\nimport re\nfrom math import *\nimport threading\nfrom collections import *\nfrom pprint import pprint as pp\nmod = 998244353\nMAX = 10**5\n\n\ndef lai():\n    return int(input())\n\n\ndef laie():\n    return map(int, input().split())\n\n\ndef array():\n    return list(map(int, input().split()))\n\n\ndef deb(p):\n    for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]:\n        m = re.search(r'\\bdeb\\s*\\(\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*\\)', line)\n        print('%s %d' % (m.group(1), p))\n\n\ndef vector(size, val=0):\n    vec = [val for i in range(size)]\n    return vec\n\n\ndef matrix(rowNum, colNum, val=0):\n    mat = []\n    for i in range(rowNum):\n        collumn = [val for j in range(colNum)]\n        mat.append(collumn)\n    return mat\n\n\ndef dmain():\n    sys.setrecursionlimit(100000000)\n    threading.stack_size(40960000)\n    thread = threading.Thread(target=main)\n    thread.start()\n\n\nif __name__ == '__main__':\n    main()\n    # dmain()\n", "lang_cluster": "Python", "tags": ["implementation", "binary search"], "code_uid": "ee6ea1fbc6bbb80269a7dee1b97d2100", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,k=map(int,input().split())\n\nl=0\n\nr=2*10**9\n\nwhile l<r:\n\n\tm=(r+l)//2;s=0;t=1\n\n\twhile m//t:s+=m//t;t*=k\n\n\tif s<n:l=m+1\n\n\telse:r=m\n\nprint(l)\n\n\n\n# Made By Mostafa_Khaled", "lang_cluster": "Python", "tags": ["implementation", "binary search"], "code_uid": "c197b5a29de2c58a9df95d407fb2efe6", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = input()\n\np = a.count('4')\nq = a.count('7')\n\nif p > 0 and p >= q:\n    print('4')\nelif q > 0:\n    print('7')\nelse:\n    print('-1')\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "1472d5f79906c025fc62bcbf12599073", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s=raw_input()\nz=-1\nif s.count('4'):\n\tz=4\nif s.count('7')>s.count('4'):\n\tz=7\nprint z", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "4926bd3caaeba1da6f007c982fef4d2e", "src_uid": "639b8b8d0dc42df46b139f0aeb3a7a0a", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def getDigitSum(n):\n    digitsum = 0\n    while n > 0:\n        digitsum += n % 10\n        n /= 10\n    return digitsum\n\nn = int(raw_input().strip())\nl = max(0, n - 81)\ncount = 0\nresult = []\nwhile l < n :\n    digitsum = getDigitSum(l)\n    if(digitsum + l == n):\n        count += 1\n        result.append(l)\n    l += 1\nprint count\nfor i in result:\n    print i\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "47a40674d69cb435750ab17195d3f6dc", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int (input())\nk = 1\ns = ''\nb = 0\nc = 0\nd = []\nwhile k<100:\n    if n>k:\n        a = n-k\n    \n        s = str(a)\n        for i in range(len(s)):\n                  b+=int(s[i])\n              \n        if a+b == n:\n                    c+=1   \n                    d.append(a)\n    k+=1\n    s = ''\n    b = 0\nprint(c)\nd.sort()\nprint('\\n'.join(str(v) for v in d))\n            \n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "0806a212721c65d84d26466a3dfa5799", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n#-*- coding: utf-8 -*-\n\nfrom collections import defaultdict\nfrom math import factorial as f\nfrom fractions import gcd as g\nfrom random import randint\n\nn = int (raw_input ())\nprint (n - 2) ** 2\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "fcbc16aa165d5ccf52144d236175bf6d", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nprint((n-2)*(n-2))\n\n\n#seeing test test case\n#3 = 1\n#4 = 4\n#5 = 9\n#6 =16", "lang_cluster": "Python", "tags": ["math"], "code_uid": "43cc2339b9e3e036f76b57ebf96ffbc1", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nn = int(input())\nr = [int(n) for n in input().split()]\nb = [int(n) for n in input().split()]\nd = sum(r) - sum(b) - 1\nbig = [r[i] for i in range(n) if r[i] > b[i]]\nif d > 0:\n    print('1')\nelif len(big) == 0:\n    print('-1')\nelse:\n    score = sum(big) - d\n    print(math.ceil(score / len(big)))", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "c033a935d6c401184256e6731462bb69", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "### A. Contest for Robots\n\nn=int(input())\na=[int(x) for x in input().split()]\nb=[int(y) for y in input().split()]\nA=B=t=0\n\nfor i in range(n):\n    if a[i]>b[i]:\n        A+=1\n    elif a[i]<b[i]:\n        B+=1\nif A==0:\n    print(-1)\nelse:\n    print(B//A+1)", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "c29da10503c0a8e720f827d5a7f91f9d", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s, v1, v2, t1, t2=map(int, input().split())\na=s*v1+2*t1\nb=s*v2+2*t2\nif(a<b):\n    print(\"First\")\nif(a>b):\n    print(\"Second\")\nif(a==b):\n    print(\"Friendship\")\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "c2ef9d39b36c9b81bafcc9a9cdb2a418", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\ndef solve(s, v1, v2, t1, t2):\n    time_1 = 2*t1 + v1 * s\n    time_2 = 2*t2 + v2 * s\n\n    if (time_1 < time_2):\n        return \"First\"\n    elif (time_2 < time_1):\n        return \"Second\"\n    else:\n        return \"Friendship\"\n\nif __name__ == \"__main__\":\n    s, v1, v2, t1, t2 = map(int, sys.stdin.readline().split())\n    print solve(s, v1, v2, t1, t2)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "8bd245eb8ab4c00c527f8bb83ee50e4f", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "print 'YES' if sum(map(lambda x: 1 if x in ['H', 'Q', '9'] else 0, raw_input())) > 0 else 'NO'\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f7d54ed08271448c1ff27165f5476dbb", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sun May 29 08:19:41 2016\n\n@author: Dell_\n\"\"\"\n\nimport sys\nif False:\n    input = open('program.txt', 'r')\nelse:\n    input = sys.stdin\n    \ninstructions = ['H', 'Q', '9']\np = input.readline().strip()\nc = 0\n\nfor char in p:\n    if char in instructions:\n        c = 1\n        break\n\nif c == 1:\n    print (\"YES\")\nelse:\n    print (\"NO\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "9ef3ad6de46a801f8d932c616e530195", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import gcd\nn = int(input())\nlcm = 5 * 7 * 8 * 9\nprint(n // lcm)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "75137f7c6a66ea8151539d12f038bd87", "src_uid": "8551308e5ff435e0fc507b89a912408a", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\n\nn=int(input())\na=int(n/2520)\nprint(a)\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "8923aadc04eae99fd17c77525e21a8f5", "src_uid": "8551308e5ff435e0fc507b89a912408a", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "string = input()\nss = string.count('-')\nos = string.count('o')\n\nif os == 0:\n    print(\"YES\")\nelif ss%os == 0:\n    print(\"YES\")\nelse:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "8800e5d4950213f69c83efa45ec08763", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a=raw_input()\n\np=0\nl=0\nfor i in a:\n    if i==\"o\":\n        p+=1\n    else:\n        l+=1\n\nif p==0 or not l%p:\n    print \"YES\"\nelse:\n    print \"NO\"", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "28d31a2ec7c20dfd3cfac4f4c53eaefe", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,x,y=map(int,input().split())\nnum=(y*n)/100\nnum1=(y*n)//100\nz=num-num1\nif z==0 and x<=num:\n    print(num1-x)\nelif z!=0 and x<=num:\n    print(num1+1-x)\nelif x>num:\n    print(0)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "3e99780ed87b76ac6d8e7253acf72309", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys, math\n\ndef readln():\n    return sys.stdin.readline()\n\ndef parse(s, fun=int, sep=\" \"):\n    return map(fun, s.split(sep))\n\ndef write(obj):\n    sys.stdout.write(str(obj))\n\ndef writeln(obj):\n    sys.stdout.write(str(obj) + \"\\n\")\n\n\nn, x, y = parse(readln())\nwriteln(max(0, int(math.ceil(y * n / 100.0 - x))))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "fb59d06c4ef30a037486009433b9ca20", "src_uid": "7038d7b31e1900588da8b61b325e4299", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\ninput = lambda: sys.stdin.readline().strip()\n\nn, k = map(int, input().split())\nls = list(map(int, input().split()))\nls.sort()\narr = []\nfor i in ls:\n    while i!=0:\n        arr.append(i)\n        i//=2\n    arr.append(0)\narr = list(set(arr))\narr.sort()\ncnts = []\nm = 10000000000000000000\nfor x in arr:\n    Cnt = 0\n    S = 0\n    for i in ls:\n        cnt = 0\n        while i>x:\n            i//=2\n            cnt+=1\n        if i==x and Cnt<k: S+=cnt; Cnt+=1\n    if Cnt==k: m = min(m, S)\nprint(m)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "31466e69792d352aae7e2326cf3acb6b", "src_uid": "ed1a2ae733121af6486568e528fe2d84", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\ns = str(input())\na = [int(i) for i in s.split()]\nb = [0] * 200001\nc = [0] * 200001\n\na.sort()\n\nfor elem in a:\n    b[elem] += 1\n    count = 0\n    while elem != 0 and b[elem // 2] < m:\n        elem //= 2\n        count += 1\n        c[elem] += count\n        b[elem] += 1\n\nans = 10000000000\nfor i in range(len(b)):\n    if b[i] >= m:\n        if ans > c[i]:\n            ans = c[i]\nprint(ans)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "5964237719db9ea047c43a424ddc60f6", "src_uid": "ed1a2ae733121af6486568e528fe2d84", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys \n# sys.setrecursionlimit(10**6) \nfrom sys import stdin, stdout\nimport bisect            #c++ upperbound\nimport math\nimport heapq\ndef modinv(n,p):\n    return pow(n,p-2,p)\ndef cin():\n    return map(int,sin().split())\ndef ain():                           #takes array as input\n    return list(map(int,sin().split()))\ndef sin():\n    return input()\ndef inin():\n    return int(input())\nimport math  \ndef Divisors(n) : \n    l = []  \n    for i in range(1, int(math.sqrt(n) + 1)) :\n        if (n % i == 0) : \n            if (n // i == i) : \n                l.append(i) \n            else : \n                l.append(i)\n                l.append(n//i)\n    return l\n\"\"\"*******************************************************\"\"\"\ndef main():\n    n=inin()\n    a=ain()\n    x=n//2\n    p=[]\n    q=[]\n    if(n%2==1):\n        y=x+1\n    else:\n        y=x\n    i=0\n    j=+1\n    f=-1\n    ans=j=0\n    pp=[]\n    qq=[]\n    for i in range(n):\n        if(a[i]!=0):\n            if(a[i]%2==1):\n                y-=1\n            else:\n                x-=1\n            if(f==-1 or a[i]%2^f==0):\n                if(a[i]%2==1):\n                    if(f==-1):\n                        pp.append(j)\n                    else:\n                        p.append(j)\n                    j=0\n                    f=a[i]\n                else:\n                    if(f==-1):\n                        qq.append(j)\n                    else:\n                        q.append(j)\n                    j=0\n            else:\n                ans+=1\n                j=0\n            f=a[i]%2\n        else:\n            j+=1\n    if(f%2==0):\n        qq.append(j)\n    else:\n        pp.append(j)\n    p.sort()\n    q.sort()\n    an=ans\n    xx=x\n    yy=y\n    pp.sort()\n    qq.sort()\n    # print(x,y,p,q,pp,qq)\n    for i in pp:\n        y-=i\n        if(i==0):\n            continue\n        if(y<0):\n            ans+=1\n    for i in qq:\n        x-=i\n        if(i==0):\n            continue\n        if(x<0):\n            ans+=1\n    for i in p:\n        y-=i\n        if(i==0):\n            continue\n        if(y<0):\n            ans+=2\n    for i in q:\n        x-=i\n        if(i==0):\n            continue\n        if(x<0):\n            ans+=2\n    x=xx\n    y=yy\n    for i in p:\n        y-=i\n        if(y<0):\n            y+=i\n            an+=2\n    for i in q:\n        x-=i\n        if(x<0):\n            x+=i\n            an+=2\n    # print(an,qq,x)\n    for i in pp:\n        y-=i\n        if(y<0):\n            y+=i\n            an+=1\n    for i in qq:\n        x-=i\n        if(x<0):\n            x+=i\n            an+=1\n    if(ans==0 and n>1):\n        ans=1\n    print(min(an,ans))\n                \n    \n        \n                    \n######## Python 2 and 3 footer by Pajenegod and c1729\n \n# Note because cf runs old PyPy3 version which doesn't have the sped up\n# unicode strings, PyPy3 strings will many times be slower than pypy2.\n# There is a way to get around this by using binary strings in PyPy3\n# but its syntax is different which makes it kind of a mess to use.\n \n# So on cf, use PyPy2 for best string performance.\n \npy2 = round(0.5)\nif py2:\n    from future_builtins import ascii, filter, hex, map, oct, zip\n    range = xrange\n \nimport os, sys\nfrom io import IOBase, BytesIO\n \nBUFSIZE = 8192\nclass FastIO(BytesIO):\n    newlines = 0\n \n    def __init__(self, file):\n        self._file = file\n        self._fd = file.fileno()\n        self.writable = \"x\" in file.mode or \"w\" in file.mode\n        self.write = super(FastIO, self).write if self.writable else None\n \n    def _fill(self):\n        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])\n        return s\n \n    def read(self):\n        while self._fill(): pass\n        return super(FastIO,self).read()\n \n    def readline(self):\n        while self.newlines == 0:\n            s = self._fill(); self.newlines = s.count(b\"\\n\") + (not s)\n        self.newlines -= 1\n        return super(FastIO, self).readline()\n \n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.getvalue())\n            self.truncate(0), self.seek(0)\n \nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        if py2:\n            self.write = self.buffer.write\n            self.read = self.buffer.read\n            self.readline = self.buffer.readline\n        else:\n            self.write = lambda s:self.buffer.write(s.encode('ascii'))\n            self.read = lambda:self.buffer.read().decode('ascii')\n            self.readline = lambda:self.buffer.readline().decode('ascii')\n \n \nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip('\\r\\n')\n \n# Cout implemented in Python\nimport sys\nclass ostream:\n    def __lshift__(self,a):\n        sys.stdout.write(str(a))\n        return self\ncout = ostream()\nendl = '\\n'\n \n# Read all remaining integers in stdin, type is given by optional argument, this is fast\ndef readnumbers(zero = 0):\n    conv = ord if py2 else lambda x:x\n    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()\n    try:\n        while True:\n            if s[i] >= b'0' [0]:\n                numb = 10 * numb + conv(s[i]) - 48\n            elif s[i] == b'-' [0]: sign = -1\n            elif s[i] != b'\\r' [0]:\n                A.append(sign*numb)\n                numb = zero; sign = 1\n            i += 1\n    except:pass\n    if s and s[-1] >= b'0' [0]:\n        A.append(sign*numb)\n    return A\n \nif __name__== \"__main__\":\n  main()", "lang_cluster": "Python", "tags": ["sortings", "dp", "greedy"], "code_uid": "a4cb7276ee9d2d10d87c179a0d8518ac", "src_uid": "90db6b6548512acfc3da162144169dba", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\na=list(map(int,input().split()))\ne=n//2\no=(n-e)\nptf=[[[0,0] for i in range(e+2)] for j in range(o+2)]\ndt={}\nfor i in range(n):\n    if(a[i]!=0):\n        dt[i+1]=a[i]\nfor i in range(o+1):\n    for j in range(e+1):\n        if(i==0):\n            ptf[i][j][0]=99999\n        if(j==0):\n            ptf[i][j][1]=99999\n        if i+j in dt:\n            if(dt[i+j]%2==1):\n                ptf[i][j][1]=99999\n            else:\n                ptf[i][j][0]=99999\nptf[0][0][0]=0\nptf[0][0][1]=0\nfor i in range(o+1):\n    for j in range(e+1):\n        if(ptf[i][j+1][1]<9999):\n            ptf[i][j+1][1]=min(ptf[i][j][1],ptf[i][j][0]+1)\n        if(ptf[i+1][j][0]<9999):\n            ptf[i+1][j][0]=min(ptf[i][j][0],ptf[i][j][1]+1)\nprint(min(ptf[i][j][0],ptf[i][j][1]))", "lang_cluster": "Python", "tags": ["sortings", "dp", "greedy"], "code_uid": "afe2f4ba7b9c419711afd25b8f08448f", "src_uid": "90db6b6548512acfc3da162144169dba", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m=map(int,input().split())\narr=list(map(int,input().split()))\nprefix=[0]*n\nfor i in range(n):\n\tprefix[i]=prefix[i-1]+arr[i]\nbrr=[]\nfor i in range(n):\n\t\n\tif prefix[i]<=m:\n\t\tprint(0,end=\" \")\n\telse:\n\t\tbrr.sort()\n\t\tct=0\n\t\tsm=prefix[i]\n\t\t# print(brr)\n\t\tfor k in range(len(brr)-1,-1,-1):\n\t\t\tsm-=brr[k]\n\t\t\tct+=1\n\t\t\tif sm<=m:\n\t\t\t\tprint(ct,end=\" \")\n\t\t\t\tbreak\n\tbrr.append(arr[i])\nprint()", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "3d31ebd4adc634b96471a6b5b3b7a6d1", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from bisect import insort\n\nn, m = [int(x) for x in input().split()]\n\nstudents = [int(x) for x in input().split()]\n\ns = 0\n\nheap = []\n\nstd = []\n\nfor i in students:\n\n    if s + i > m:\n        std = heap.copy()\n        t = 0\n        q = s\n        while q + i > m:\n            q -= std.pop()\n            t += 1\n        print(t, end=' ')\n    else:\n        print(\"0 \", end = '')\n    s += i\n    insort(heap, i)\n", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "65ac588db85e1536c70b803cd4496ebf", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# Online Python compiler (interpreter) to run Python online.\n# Write Python 3 code in this online editor and run it.\n\n\nties = int(input())\nscarves = int(input())\nvest = int(input())\njackets = int(input())\nfirst = int(input())\nsecond = int(input())\n\nif second > first:\n    second_suits = min([scarves, vest, jackets]) * second\n    first_suits = min([ties, jackets - min([scarves, vest, jackets])]) * first\nelse:\n    first_suits = min([ties, jackets]) * first\n    second_suits = min([scarves, vest, jackets - min([ties, jackets])]) * second\n    \n\nprint(second_suits + first_suits)", "lang_cluster": "Python", "tags": ["math", "greedy", "brute force"], "code_uid": "fe3adfbbeede61b33d228970e577183c", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "ties=int(input())\nscarves=int(input())\nvests=int(input())\njackets=int(input())\ne=int(input())\nf=int(input())\nans=0\nif f>e:\n    ans+=min(scarves,vests,jackets)*f\n    jackets-=min(scarves,vests,jackets)\n    ans+=(min(ties,jackets)*e)\nelse:\n    ans+=min(ties,jackets)*e\n    jackets-=min(ties,jackets)\n    ans+=min(scarves,vests,jackets)*f\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "greedy", "brute force"], "code_uid": "1ced38bb5fac989a9c8964b91f3001e6", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from fractions import gcd\nt,w,b = [int(r) for r in raw_input().split()]\n\nans = min(w,b)\nlcm = w*b/gcd(w,b)\nans = ans*(t/lcm +1)\nans -= 1\nlast_num = t/lcm * lcm\nans -= max(0,last_num+min(w,b)-1-t)\nden = t\nprint str(ans/gcd(ans,den))+\"/\"+str(den/gcd(ans,den))\n\n1,2,12,13,14,24,25", "lang_cluster": "Python", "tags": ["math"], "code_uid": "e3c2c97dc911e8b10838d18837520fa4", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#------------------------template--------------------------#\nimport os\nimport sys\nfrom math import *\nfrom collections import *\nfrom fractions import *\nfrom bisect import *\nfrom heapq import*\nfrom io import BytesIO, IOBase\ndef vsInput():\n    sys.stdin = open('input.txt', 'r')\n    sys.stdout = open('output.txt', 'w')\nBUFSIZE = 8192\nclass FastIO(IOBase):\n    newlines = 0\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\nALPHA='abcdefghijklmnopqrstuvwxyz'\nM=10**9+7\nEPS=1e-6\ndef value():return tuple(map(int,input().split()))\ndef array():return [int(i) for i in input().split()]\ndef Int():return int(input())\ndef Str():return input()\ndef arrayS():return [i for i in input().split()]\n\n\n#-------------------------code---------------------------#\n# vsInput()\n\nt,w,b=value()\na,b=sorted((w,b))\nlcm=(a*b)//gcd(a,b)\n\nsections=t//lcm\n\n\nans=sections*(a)\nans+=min(a-1,t%lcm)\n\n# print(ans,t%lcm)\nans=Fraction(ans,t)\n\nprint(ans.numerator,'/',ans.denominator,sep=\"\")\n\n\n#  BruteForce\n# for i in range(1,t+1):\n#     print(i,i%a==i%b)\n\n\n\n\n\n\n\n\n\n\n                \n\n    \n\n\n\n\n\n\n\n\n\n    ", "lang_cluster": "Python", "tags": ["math"], "code_uid": "ba36cd30a177d5d5fca479f06965ece3", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\nimport functools\nimport logging\nimport os\nimport sys\nimport time\n\nlogger = logging.getLogger()\nreader = sys.stdin\nis_judge = os.getenv(\"ONLINE_JUDGE\") is not None\n\n\ndef timeit(func):\n    @functools.wraps(func)\n    def timed(*args, **kwargs):\n        if is_judge:\n            rv = func(*args, **kwargs)\n        else:\n            ts = time.time()\n            rv = func(*args, **kwargs)\n            te = time.time()\n\n            logger.debug(\"performance %r %2.2fms\", func.__name__, (te - ts) * 1000)\n        return rv\n    return timed\n\n# ----------------------\n# -     /SOLUTION      -\n# ----------------------\n\n\n@timeit\ndef contains_subsequence(arr, seq):\n    seq_len = len(seq)\n\n    # Empty sequence\n    if seq_len == 0:\n        return True\n\n    i = 0\n    for item in arr:\n        if item == seq[i]:\n            i += 1\n            if i == seq_len:\n                break\n\n    return i == seq_len\n\n\n@timeit\ndef main():\n    # while line := reader.readline():\n    line = reader.readline()\n    if contains_subsequence(line, \"hello\"):\n        print(\"YES\")\n    else:\n        print(\"NO\")\n\n\n# ----------------------\n# -     \\SOLUTION      -\n# ----------------------\n\n\ndef setup():\n    global logger, reader\n\n    if is_judge:\n        logger.setLevel(logging.WARNING)\n    else:\n        # Format logger\n        handler = logging.StreamHandler(sys.stdout)\n        handler.setLevel(logging.DEBUG)\n        formatter = logging.Formatter(\"{asctime}s - {message}\", style='{')\n        handler.setFormatter(formatter)\n\n        logger.addHandler(handler)\n        logger.setLevel(logging.DEBUG)\n\n        # Stdin from file\n        reader = open(\"input.txt\")\n\n\nif __name__ == '__main__':\n    line = input()\n    if contains_subsequence(line, \"hello\"):\n        print(\"YES\")\n    else:\n        print(\"NO\")\n    # setup()\n    # try:\n    #     main()\n    # except KeyboardInterrupt:\n    #     logger.debug(\"KeyboardInterrupt\")\n    # except IOError as e:\n    #     logger.error(f\"I/O error({e.errno}): {e.strerror}\")\n", "lang_cluster": "Python", "tags": ["greedy", "strings"], "code_uid": "e3245c29bc0d78356b770f14911a65a5", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s=str(input())\nx=\"\"\nfor i in range(len(s)):\n    if s[i]==\"h\" or s[i]==\"e\" or s[i]==\"l\" or s[i]==\"o\":\n        x=x+s[i]\ns=x.lower()\nfor i in range(len(s)):\n    if(s.find(\"hh\")!=-1):\n        s=s.replace(\"hh\", \"h\")\n    if(s.find(\"ee\")!=-1):\n        s=s.replace(\"ee\", \"e\")\n    if (s.find(\"lll\")!=-1):\n        s=s.replace(\"lll\", \"ll\")\n    if (s.find(\"oo\")!=-1):\n        s=s.replace(\"oo\", \"o\")\nif (s.find(\"h\")!=-1):\n    s=s.replace(s[0:s.index(\"h\")+1],\"1\",1)\nif(s.find(\"1\")!=-1) and (s.find(\"e\")!=-1):\n    if (s.find(\"1e\")==-1):\n        s=s.replace(s[int(s.index(\"1\")+1):s.index(\"e\")+1],\"2\",1)\n    else:\n        s = s.replace(\"e\", \"2\", 1)\nif(s.find(\"12\")!=-1) and (s.find(\"l\")!=-1):\n    if (s.find(\"12l\") == -1):\n        s=s.replace(s[int(s.index(\"2\")+1):s.index(\"l\")+1],\"3\",1)\n    else:\n        s = s.replace(\"l\", \"3\", 1)\nif(s.find(\"123\")!=-1) and (s.find(\"l\")!=-1):\n    if (s.find(\"123l\") == -1):\n        s=s.replace(s[int(s.index(\"3\")+1):s.index(\"l\")+1],\"4\",1)\n    else:\n        s = s.replace(\"l\", \"4\", 1)\nif(s.find(\"1234\")!=-1) and (s.find(\"o\")!=-1):\n    if (s.find(\"1234o\") == -1):\n        s=s.replace(s[int(s.index(\"4\")+1):s.index(\"o\")+1],\"5\",1)\n    else:\n        s = s.replace(\"o\", \"5\", 1)\n# print(s)\nif(s.find(\"12345\")!=-1):\n    print(\"YES\")\nelse:\n    print(\"NO\")\n\n\n\n\n# if s.find('h(.*?)e(.*?)l(.*?)l(.*?)o')!=-1:\n#     print(\"NO\")\n# else:print(\"YES\")", "lang_cluster": "Python", "tags": ["greedy", "strings"], "code_uid": "250ff9a4a05057650cee9592b4fe6dc1", "src_uid": "c5d19dc8f2478ee8d9cba8cc2e4cd838", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nn=int(input())\nx=n\nf=1\na=[x]\nfor i in range(2,int(math.sqrt(n))+1):\n    while n%i==0:\n        a.append(n//i)\n        n=n//i\n        \n\nif a[-1]!=1:\n    a.append(1)\nfor i in range(len(a)-1):\n    print(a[i],end=' ')\nprint(a[-1])", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "40ce966f4165d852eb859e16812cf3e9", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\ni = 2\nwhile i*i <= n:\n\tif n%i == 0:\n\t\tprint n,\n\t\tn /= i\n\telse: i += 1\nif n != 1:\n\tprint n,\nprint 1", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "9a3b68709754b1725e93ee2df9814e05", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nr,x1,y1,x2,y2=[int(x) for x in input().split()]\nans=(math.sqrt((x2-x1)**2+(y2-y1)**2))/(2*r)\nans=int(math.ceil(ans))\nprint(ans)\n\n\n", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "e995bf7732a2c5da187261deaa3d36cd", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "r,x,y,z,t = map(int, raw_input().strip().split())\nd = complex(z-x, t-y)\nst = int(abs(d))\nif d.real*d.real + d.imag*d.imag == st*st and st % (2*r) == 0:\n    print st/(2*r)\nelse:\n    s = abs(d)/(2*r)\n    st = int(s)\n    print st + 1\n\n", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "f2d9a80bea4cd3909e0d346c410da757", "src_uid": "698da80c7d24252b57cca4e4f0ca7031", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nfrom collections import defaultdict\n\nmp = defaultdict(int)\n\n\ndef primeFactor(a):\n    i = 2\n    while i * i <= a:\n        while a % i == 0:\n            mp[i] += 1\n            a //= i\n        i += 1\n    if a > 1:\n        mp[a] += 1\n\n\ndef trailingZero(a, n):\n    ans = 0\n    while n > 0:\n        ans += n // a\n        n //= a\n    return ans\n\nn, b = map(int, input().split())\nans = int(1e50)\nprimeFactor(b)\nfor it in mp:\n    first = it\n    second = mp[it]\n    temp = trailingZero(first, n)\n    ans = min(ans, temp // second)\nprint(ans)\n\n", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation", "number theory"], "code_uid": "c5f35180ef15a02ed6e393bfaf68100c", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import decimal,math\n# from decimal import Decimal as co\nfrom collections import Counter,defaultdict\nfrom fractions import gcd\nfrom bisect import bisect_right,bisect_left\ndecimal.getcontext().prec = 10\ndef primeFactors(n): \n\td=Counter()\n\twhile n % 2 == 0: \n\t\td[2]+=1 \n\t\tn = n / 2\n\t\t  \n\tfor i in range(3,int(math.sqrt(n))+1,2): \n\t\t  \n\t\twhile n % i== 0: \n\t\t\td[i]+=1 \n\t\t\tn = n / i \n\tif n > 2: \n\t\td[n]+=1\n\treturn d\n \nn,b=map(int,raw_input().split())\nd=primeFactors(b)\nmn=10**21\nfor i in d:\n\ttt=n\n\tpower=i\n\tans=0\n\twhile tt/power:\n\t\tans+=(tt/power)\n\t\tpower*=i\n\tmn=min(mn,ans/d[i])\nprint mn\n\t\t\n# def findPowerOfP(n,p):\n# \tcount=0  \t\t\n# \tr=p\n# \twhile(r<=n):\n# \t\tcount+=(n/r)\n# \t\tr=r*p\t\n# \treturn count\t  \n# a=[] \n# n,b = map(int,raw_input().split())\n# pp =  primeFactors(b)\n# print pp\n# ans= 10**20\n# for i in pp:\n# \tans=min(ans,findPowerOfP(n,i)/pp[i])\n# print ans\t", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation", "number theory"], "code_uid": "91f09e4d0289a9e079750ed695e0d3dd", "src_uid": "491748694c1a53771be69c212a5e0e25", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = input().split()\nfor i in range(4):\n    n[i] = int(n[i])\n    \n    \nif n[0] + n[1] == n[2] + n[3]:\n    print('YES')\n    \nelif n[0] + n[2] == n[1] + n[3]:\n    print('YES')\n    \nelif n[0] + n[3] == n[2] + n[1]:\n    print('YES')\n    \nelif n[0] == n[2] + n[1] + n[3]:\n    print('YES')\n    \nelif  n[1] == n[2] + n[0] + n[3]:\n    print('YES')\n    \nelif n[2] == n[0] + n[1] + n[3]:\n    print('YES')\n    \nelif n[3] == n[0] + n[1] + n[2]:\n    print('YES')\n\nelse:\n    print('NO')", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "7839a6537481b87f53cda0639c63d9da", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import itertools\nimport sys\n\n\ndef rl():\n    return sys.stdin.readline().strip()\n\n\ndef rn():\n    return list(map(int, sys.stdin.readline().strip().split()))\n\n\ndef rln(n):\n    l = [None] * n\n    for i in range(n):\n        l[i] = int(rl())\n    return l\n\n\ndef solve(t):\n    for e in t:\n        if e[0] + e[1] == e[2] + e[3] or e[0] == e[1] + e[2] + e[3]:\n            return True\n    return False\n\n\nif __name__ == '__main__':\n    tab = rn()\n    t = itertools.permutations(tab)\n    print('YES' if solve(t) else 'NO')\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "8675b3d2759e443bcabdfece0b4bfe38", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b = raw_input().split()\n\nif a == b:\n    print(a)\nelse:\n    print(1)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "dd31b7fe84e247c8993cf46a58806b97", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\na, b = map(int,input().split())\nif a == b:\n\tprint(a)\nelse:\n\tprint(1)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "15da08b70cdc95a0f8ab2dc96923e97e", "src_uid": "9c5b6d8a20414d160069010b2965b896", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\n\ndef main():\n    x = int(input())\n    val = 1\n    for i in range(2,x+1):\n        val *= i\n        val %= (10**9)+7\n        # print(val)\n    val -= 2**(x-1)\n    val %= (10**9)+7\n    print(val)\n\nmain()", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "graphs"], "code_uid": "e57a556df17914817f9ae04aa586847b", "src_uid": "3dc1ee09016a25421ae371fa8005fce1", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nans = 1\nmod = 10**9+7\ntemp = 0.5\nfor i in range(n):\n    ans = (ans*(i+1))%mod\n    temp = (temp*2)%mod\nprint((ans-int(temp))%mod)\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "graphs"], "code_uid": "deb197856baeea47d90d7c3c1cf054b6", "src_uid": "3dc1ee09016a25421ae371fa8005fce1", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nif n==1:\n    print(\"-1\")\nelif n%2==0:\n    print(int(n/2))\nelse:\n    print(int(-(n/2+1)))\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "59af7be5db1ade486f7261b58bec4f1f", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = input()\nif s%2==0:\n    print s/2\nelse:\n    print s/2 - s", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "bc5c9e3999b4598db304e1930140dafa", "src_uid": "689e7876048ee4eb7479e838c981f068", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "k=int(input())\nn=int(k**.1)\nm=n**10\nr=''\nfor c in'codeforces':l=n+(m<k);r+=c*l;m=m//n*l\nprint(r)", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "math", "greedy", "strings"], "code_uid": "87eee3d43476efd908f2eb0bd64934e9", "src_uid": "8001a7570766cadcc538217e941b3031", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "'''input\n1\n'''\n \n \n \nfrom bisect import bisect_right as bl\nfrom random import randint as R\nRI = lambda : [int(_x) for _x in raw_input().split()]\n\n\n\n\n\nn = input()\n\nc = [1]*10\n\ndef pro(l):\n\tp=1\n\tfor i in l:\n\t\tp*=i\n\treturn p\n\ncur = 0\nwhile pro(c)<n:\n\tc[cur]+=1\n\tcur = (cur+1)%10\nans = \"\"\ne=0\nfor i in \"codeforces\":\n\tans+=c[e]*i\n\te+=1\nprint ans", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "math", "greedy", "strings"], "code_uid": "e5a322f9e9a03c63e09475f4247e4b95", "src_uid": "8001a7570766cadcc538217e941b3031", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "def main():\n    a = map(int, raw_input().split(' '))\n    s = sum(a)\n    for i in range(6):\n        for j in range(i + 1, 6):\n            for k in range(j + 1, 6):\n                res1 = a[i] + a[j] + a[k]\n                if res1 == s - res1:\n                    print 'YES'\n                    return\n    print 'NO'\n    return\nmain()\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "04e4a5d41af1208be0b3d1908dcf71f5", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = map(int, raw_input().split())\n\ndef dooable(s):\n    import itertools\n    for p in itertools.permutations(s):\n        if sum(p[:3]) == sum(p[3:]):\n            return True\n    return False\nprint [\"NO\", \"YES\"][dooable(s)]\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "c291867c2e32ae3ac093fb12f2431654", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from collections import defaultdict\n\nt = int(input())\nfor _ in range(t):\n    n, k, d = [int(x) for x in input().split()]\n    a = [int(x) for x in input().split()]\n\n    s = set(a[:d])\n    dd = defaultdict(int)\n    for i in a[:d]:\n        dd[i] += 1\n    mn = len(s)\n    for i in range(n - d):\n        #print(i, a[i], a[i+d], s)\n        dd[a[i]] -= 1\n        dd[a[i+d]] += 1\n        s.add(a[i+d])\n        if dd[a[i]] <= 0:\n            dd[a[i]] = 0\n            s.remove(a[i])\n        m = len(s)\n        #print(s, len(s))\n        if m < mn:\n            mn = m\n    print(mn)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "3b1e4d7a3fe3d3cc7995c973754c661d", "src_uid": "56da4ec7cd849c4330d188d8c9bd6094", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def solve():\n    n, k, d = map(int, input().split())\n    a = [int(i) for i in input().split()]\n    min = 100\n    q = 0\n    for i in range(n - d + 1):\n        temp = len(set(a[i:i + d]))\n        if temp == 1:\n            q += 1\n        else:\n            if temp < min:\n                min = temp\n    if n == d:\n        min = len(set(a))\n    print(1 if q > 0 else min)\n\ndef main():\n    t = int(input())\n    for z in range(t):\n        solve()\n\nmain()", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "985415407343b5c2f15c8fb5889ba96b", "src_uid": "56da4ec7cd849c4330d188d8c9bd6094", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "arr1 = raw_input().split(\" \")\narr2 = raw_input().split(\" \")\nn = int(raw_input())\nfor i in range(len(arr1)):\n    arr1[i] = int(arr1[i])\n    arr2[i] = int(arr2[i])\n\nif sum(arr1)!= 0:\n    n -= (sum(arr1)-1)/5+1\nif sum(arr2)!= 0:\n    n -= (sum(arr2)-1)/10+1\nif n >= 0:\n    print \"YES\"\nelse:\n    print \"NO\"\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "9e5e1129ab884169b4cc8a90a296acf3", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "f = lambda: map(int, raw_input().split())\na = (sum(f()) + 4)/5\nb = (sum(f()) + 9)/10\nn = int(raw_input())\nprint ['NO', 'YES'][a+b <= n]", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "8cf6462fd9e601fc67f1f5d61afb7a3a", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "k, s = 1, input()\n\nfor i in range(len(s)-1):\n    if s[i] != s[i+1]:\n        k = 0\n    elif k >= 6:\n        break\n    k += 1\n\nprint(\"NO\" if k < 6 else \"YES\")\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "3fca6aaff2bb9708b0ff5d61951485d1", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "string1=\"1111111\"\nstring2=\"0000000\"\nstring3=input()\nif string1 in string3 or string2 in string3:\n    print(\"YES\")\n\nelse:\n    print(\"NO\")", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "d776166a7e3b79d46352992f449e1f64", "src_uid": "ed9a763362abc6ed40356731f1036b38", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,k=map(int,input().split())\na=[0]*k\nfor i in range(k):\n    if n%k==0:\n        exit(print('Yes'))\n    if a[n%k]!=1:\n        a[n%k]=1\n        n+=n%k\n    else:\n        exit(print('No'))\nprint('Yes')\n        ", "lang_cluster": "Python", "tags": ["math", "matrices", "implementation"], "code_uid": "66fb3dc782c07dbc3cb71f6106e1e96a", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n\n(a,m) = map(int, raw_input().split())\na = a % m\n\nfound = [False for i in xrange(m)]\n\nwhile not (found[a]) and (a != 0):\n  found[a] = True\n  a = (a + a) % m\n\nif a == 0:\n  print \"Yes\"\nelse:\n  print \"No\"\n", "lang_cluster": "Python", "tags": ["math", "matrices", "implementation"], "code_uid": "a193842426e4bae51a8a49469e87e99e", "src_uid": "f726133018e2149ec57e113860ec498a", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin,stdout\ny,bl=map(int,stdin.readline().split())\na,b,c=map(int,stdin.readline().split())\nyr=a*2+b\nbr=b*1+c*3\nc=0\nif yr >= y:\n    c+=yr-y\nif br > bl:\n    c+=br-bl\nstdout.write(str(c))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "c7bbe47e977421651300966fd750bf94", "src_uid": "35202a4601a03d25e18dda1539c5beba", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "inp = input().split(' ')\na = int(inp[0])\nb = int(inp[1])\n\ninp = input().split(' ')\nx = int(inp[0])\ny = int(inp[1])\nz = int(inp[2])\n\nfoo = (2*x + y) - a\nbar = (3*z + y) - b\n\nout = 0\nif foo > 0:\n    out += foo\nif bar > 0:\n    out += bar\nprint(out)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "a2bb8bf277c9a7e38fd36b0ab3be74dc", "src_uid": "35202a4601a03d25e18dda1539c5beba", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b, c = map(int, raw_input().split(' '))\n\nx = a+b-c\ny = -a+b+c\nz = a-b+c\n\nworks = True\nfor i in [x, y, z]:\n  if i%2 != 0 or i < 0:\n    works = False\n\nif works:\n  print x/2, y/2, z/2\nelse:\n  print 'Impossible'\n", "lang_cluster": "Python", "tags": ["brute force", "math", "graphs"], "code_uid": "081f90a986275214f50065ef0d624b68", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b,c=raw_input().split()\na=int(a)\nb=int(b)\nc=int(c)\nx=(a+b-c)/2\ny=(b+c-a)/2\nz=(a+c-b)/2\nif x<0 or y<0 or z<0:\n    print \"Impossible\"\nelif (x==0 and y==0) or(x==0 and z==0) or (y==0 and z==0):\n    print \"Impossible\"\nelif x==0 and y==0 and z==0:\n    print \"Impossible\"\nelif (a+b-c)%2!=0 and (a+c-b)%2!=0 and (b+c-a)%2!=0:\n    print \"Impossible\"\nelse:\n    print x,y,z\n", "lang_cluster": "Python", "tags": ["brute force", "math", "graphs"], "code_uid": "d81691e6813437dce03c0aa71d165620", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = int(raw_input())\nx = int((2*a+1)**.5)\na -= (x*(x+1)/2)\nif a==0:\n\tprint(x)\nelif a>0:\n\tprint(a)\nelse:\n\tprint(x+a)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "1abd23adb62020d3816d8746223c25c7", "src_uid": "1db5631847085815461c617854b08ee5", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\nn -= 1\nst = 1\n\nwhile n-st >= 0:\n    n -= st\n    st += 1\n\nprint(n+1)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "c68f3bb8fdea8834759f2a9ea09f3ca9", "src_uid": "1db5631847085815461c617854b08ee5", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "input()\nc = \"\".join(input().split()).strip('0')\n\nif c.count('1') <= 1:\n    print(c.count('1'))\nelse:\n    print(eval(\"*\".join([str(len(t)+1) for t in c.strip('1').split('1')])))", "lang_cluster": "Python", "tags": ["combinatorics"], "code_uid": "118c6d750ae46bba0579775a93087f1c", "src_uid": "58242665476f1c4fa723848ff0ecda98", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "num = int(raw_input())\nlista = map(int, raw_input().split())\n\nresp = 1\num = False\ncont = 0\n\nfor i in lista:\n    if um: cont += 1\n\n    if i == 1 and um:\n        resp *= cont\n        cont = 0\n\n    if i == 1: \n        um = True\n        \nif not um: resp = 0\nprint resp", "lang_cluster": "Python", "tags": ["combinatorics"], "code_uid": "018a2e3a47dfad8535061ea15a9c3776", "src_uid": "58242665476f1c4fa723848ff0ecda98", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "k2, k3, k5, k6 = map(int, raw_input().split())\n\nA = min(k2, k5, k6)\nB = min(k3, k2 - A)\n\nprint 256 * A + 32 * B\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation", "brute force"], "code_uid": "fd214dc339926a528a27cc9168c0312e", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a,b,c,d=map(int,input().split())\ncount=0\ncounter=0\nm=min(a,min(c,d))\nn=min(a-m,b)\ncount=n*32\ncounter=m*256\nprint(count+counter)\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation", "brute force"], "code_uid": "e518e4eb155fe7e494e53a7c8d27f11b", "src_uid": "082b31cc156a7ba1e0a982f07ecc207e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def sgn(a):\n    if a>0:\n        return 0\n    elif a==0:\n        return 1\n    else:\n        return 2\nx,y,z=map(int,input().split())\nM=sgn(x-y+z)\nm=sgn(x-y-z)\nif M!=m:\n    print(\"?\")\nelse:\n    print([\"+\",\"0\",\"-\"][M])\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "7331431a1f30b0ff275d932d5dbf5c86", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#!/usr/bin/env pypy\nfrom __future__ import division, print_function\n\nimport os\nimport sys\nfrom __builtin__ import xrange as range\nfrom cStringIO import StringIO\nfrom future_builtins import ascii, filter, hex, map, oct, zip\nfrom io import IOBase\n\nimport __pypy__\n\n\ndef main():\n    x, y, z = map(int, input().split())\n    if x == y and z == 0:\n        print('0')\n    elif x - y - z > 0:\n        print('+')\n    elif -y + x + z < 0:\n        print('-')\n    else:\n        print('?')\n\n\n# region fastio\n\nBUFSIZE = 8192\n\n\nclass FastI(IOBase):\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self._buffer = StringIO()\n        self.newlines = 0\n\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(\"\\n\") + (not b)\n            ptr = self._buffer.tell()\n            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)\n        self.newlines -= 1\n        return self._buffer.readline()\n\n\nclass FastO(IOBase):\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self._buffer = __pypy__.builders.StringBuilder()\n        self.write = lambda s: self._buffer.append(s)\n\n    def flush(self):\n        os.write(self._fd, self._buffer.build())\n        self._buffer = __pypy__.builders.StringBuilder()\n\n\ndef print(*args, **kwargs):\n    sep, file = kwargs.pop(\"sep\", \" \"), kwargs.pop(\"file\", sys.stdout)\n    at_start = True\n    for x in args:\n        if not at_start:\n            file.write(sep)\n        file.write(str(x))\n        at_start = False\n    file.write(kwargs.pop(\"end\", \"\\n\"))\n    if kwargs.pop(\"flush\", False):\n        file.flush()\n\n\nsys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\n# endregion\n\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "612db0ab46f5ebcc1616a04fa7d8ffd7", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\nn=int(sys.stdin.readline())\na=int(sys.stdin.readline())\ng=[]\nt=a\nfor i in range(n):\n  if int(t%10)!=0:\n    g=g+[int(t%10)]\n  t=int(t/10)\nb=[]\ndef primes(n):\n    primfac = []\n    d = 2\n    while d*d <= n:\n        while (n % d) == 0:\n            primfac.append(d)  # supposing you want multiple factors repeated\n            n //= d\n        d += 1\n    if n > 1:\n       primfac.append(n)\n    return primfac\n\nfor i in g:\n if i!=1:\n  gg = 2\n  for j in range(2,i+1):\n    if gg<max(primes(j)):\n      gg=max(primes(j))\n  b=b+[gg]\n  if i==9: b=b+[2,3,3]\n  else:\n   for k in range(gg+1,i+1):\n     if k==6: b=b+[3] \n     else:\n      b=b+primes(k)\nprint(int(''.join(map(str, reversed(sorted(b))))))", "lang_cluster": "Python", "tags": ["math", "sortings", "greedy"], "code_uid": "02d409b028d49b8cddd78ad304f1d53d", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=input()\na=raw_input()\nlis=[]\nfor i in a:\n    if i=='9':\n        lis.append(7)\n        lis.append(3)\n        lis.append(3)\n        lis.append(2)\n    if i=='8':\n        lis.append(2)\n        lis.append(2)\n        lis.append(2)\n        lis.append(7)\n    if i=='7':\n        lis.append(7)\n    if i=='6':\n        lis.append(3)\n        lis.append(5)\n    if i=='5':\n        lis.append(5)\n    if i=='4':\n        lis.append(2)\n        lis.append(2)\n        lis.append(3)\n    if i=='3':\n        lis.append(3)\n    if i=='2':\n        lis.append(2)\nlis.sort(reverse=True)\nfor i in range(len(lis)):\n    lis[i]=str(lis[i])\nprint ''.join(lis)\n        \n", "lang_cluster": "Python", "tags": ["math", "sortings", "greedy"], "code_uid": "26042d221d973f0374e62f6693659890", "src_uid": "60dbfc7a65702ae8bd4a587db1e06398", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\ndef prime(n):\n    ok= True\n    for i in range(2, int(math.sqrt(n))):\n        if(n%i==0):\n            ok = False\n            break\n    if(ok):\n        return True\n    else:\n        return False\ndef fact(a,b):\n    ans = 1\n    for i in range(a, b+1):\n        ans*= i\n    return str(ans)-1\ndef comb(n, c):\n    return fact(n)//(fact(n-c)*c)\n\na,b = map(int, input().split())\ndef done(c,d):\n    if(c==0 or d==0):\n        return True\n    else:\n        return False\nwhile(not done(a,b)):\n    if(a >= 2*b):\n        a = int(a%(2*b))\n    else:\n        if(b >= 2*a):\n            b = int(b%(2*a))\n        else:\n            break\nprint(a,b)\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "e2fb2c6b8fbdb42da70e08516a0791e0", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a,b = map(int,input().split())\nwhile(a!=0 and b!=0):\n    if(a>=2*b):\n        a = a%(2*b)\n    elif(b>=2*a):\n        b = b%(2*a)\n    else:\n        break\nprint(a,b)\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "a05c60b9554bf77afcd7e0c3d8fefc2e", "src_uid": "1f505e430eb930ea2b495ab531274114", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nlis = list(map(int,input().split()))\nhun = 0\nthun = 0\nfor i in lis:\n    if i == 100:\n        hun+=1\n    else:\n        thun+=1\n\n# print (hun,thun)\nif thun == 0 or hun == 0:\n    if thun == 0:\n        if hun%2 == 0:\n            print ('YES')\n        else:\n            print ('NO')\n    else:\n        if thun%2 == 0:\n            print ('YES')\n        else:\n            print ('NO')\nelif (200*thun+100*hun)%200 == 0:\n    print ('YES')\nelse:\n    print ('NO')", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "f5c81f5ef83b0789f9308321f6d9e29b", "src_uid": "9679acef82356004e47b1118f8fc836a", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\n#------------------------template--------------------------#\nimport os\nimport sys\nfrom math import *\nfrom collections import *\nfrom bisect import *\nfrom io import BytesIO, IOBase\ndef vsInput():\n    sys.stdin = open('input.txt', 'r')\n    sys.stdout = open('output.txt', 'w')\nBUFSIZE = 8192\nclass FastIO(IOBase):\n    newlines = 0\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\ndef value():return tuple(map(int,input().split()))\ndef array():return [int(i) for i in input().split()]\ndef Int():return int(input())\ndef Str():return input()\ndef arrayS():return [i for i in input().split()]\n\n#-------------------------code---------------------------#\n#vsInput()\n\n\n\nn=Int()\na=array()\nc1=a.count(100)\nc2=a.count(200)\nif(c1%2==0 and c2%2==0):\n    print(\"YES\")\nelif(c2%2==1 and c1%2==0 and c1>=2):\n    print(\"YES\")\nelse:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "3e665d2834388663446655c16d196a69", "src_uid": "9679acef82356004e47b1118f8fc836a", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\nd,c,m,i=0,1,1,1\nwhile c<=n:\n    d+=1\n    i+=1\n    m+=i\n    c+=m\nprint(d)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "7d9046a36a2eb2d802e85db63d0cd2bc", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "value = int(input())\ndef rec(i,x):\n    if sum(l) >= value:\n        return x\n    if value == 1:\n    \treturn 1\n    i = i + x\n    l.append(i)\n    rec(i,x+1)\nl = []\nrec(1,2)\nprint(1 if value == 1 else len(l))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "32acc76735a5b1e7c554970e23fcd465", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "N, M = map(int, input().split())\nans = -1\nmin = N // 2\nif N % 2 != 0:\n\tmin += 1\nfor i in range(min, N+1):\n\tif i % M == 0:\n\t\tans = i\n\t\tbreak\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "91fcc72e9b6fd6a3e9af15372fda6d29", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def f(l):\n    n,m = l\n    ms  = (n+1)//2\n    ds  = ((ms+m-1)//m)*m\n    return -1 if ds>n else ds\n \nl = list(map(int,input().split()))\nprint(f(l))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "b13ae7357402a1a3ba9198330f3a1e80", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, a = map(int, input().split(\" \"))\nt = list(map(int, input().split(\" \")))\ns = sum(t)\nb = a - 1\nl = b-1\nr = b+1\nwhile l >=0 and r <n:\n    s -= (t[l] + t[r])%2\n    l -= 1\n    r += 1\nprint(s)\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "91fbfee851409531bb059be5364a62d9", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, a = map(int, input().split())\nc = list(map(int, input().split()))\nans = c[a - 1]\nfor i in range(1, min(a, abs(n - a) + 1)):\n    ans += (c[a - 1 - i]&c[a - 1 + i]) * 2\nif a == (n + 1) / 2:\n    print(ans)\nelif a < (n + 1) / 2:\n    ans += sum(c[2 * a - 1:])\n    print(ans)\nelse:\n    ans += sum(c[:2 * a - n - 1])\n    print(ans)\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "5b6e18310dde314b2dce4618eb4854d1", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "__copyright__ = ''\n__author__ = 'Son-Huy TRAN'\n__email__ = \"sonhuytran@gmail.com\"\n__doc__ = ''\n__version__ = '1.0'\n\n\ndef main() -> int:\n    (n, d) = map(int, input().split())\n    costs = sorted([int(word) for word in input().split()])\n    m = int(input())\n    profit = 0\n\n    if m <= n:\n        profit = sum(costs[:m])\n    else:\n        profit = sum(costs) - (m - n) * d\n\n    print(profit)\n    return 0\n\n\nif __name__ == '__main__':\n    exit(main())", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "5372a1018e63bb4b3676f4999fb49cf0", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, d = map(int, input().split())\narr = list(map(int, input().split()))\narr.sort()\nm = int(input())\nprint(sum(arr[:m]) if m <= n else sum(arr) - d * (m-n))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "d40457f174782a9b6635fe626d88bba2", "src_uid": "5c21e2dd658825580522af525142397d", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input().strip())\nprint (27 ** n - 7 ** n) % (1000000007)", "lang_cluster": "Python", "tags": ["combinatorics"], "code_uid": "18497d9cb611fcaec631c442d6a7a868", "src_uid": "eae87ec16c284f324d86b7e65fda093c", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# print(\"Input n\")\nn = int(input())\n\nthreepower = 27\nsevenpower = 7\ncount = 1\nwhile (count < n):\n    threepower = (threepower * 27) % (1000000000+7)\n    sevenpower = (sevenpower * 7) % (1000000000+7)\n    count += 1\nanswer = threepower - sevenpower\nif answer < 0:\n    answer += 1000000000+7\nprint(answer)\n", "lang_cluster": "Python", "tags": ["combinatorics"], "code_uid": "45a221122aee8b2a83303e1420e0ca2d", "src_uid": "eae87ec16c284f324d86b7e65fda093c", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from sys import stdin,stdout\n\ndef main():\n\tstring=stdin.readline()\n\tsum=0\n\n\tfor i in range (len(string)-1):\n\t\tif i==0:\n\t\t\tp=ord(string[0])-97\n\t\t\tif p>13:\n\t\t\t\tsum+=(26-p)\n\t\t\telse:\n\t\t\t\tsum+=p\n\t\telse:\n\t\t\tp=abs(ord(string[i])-ord(string[i-1]))\n\t\t\tif p>13:\n\t\t\t\tsum+=26-p\n\t\t\telse:\n\t\t\t\tsum+=p\n\n\tprint(sum)\n\nif __name__ == '__main__':\n\tmain()\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "48a8d1ec3e61b6fd9330d2d715e01214", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n#-*- coding: utf-8 -*-\n\nfrom collections import defaultdict\nfrom math import factorial as f\nfrom fractions import gcd as g\n\ns = raw_input ()\nret, start = 0, 0\nfor i in s:\n    x = ord (i) - ord ('a')\n    y = min ((start - x) % 26, (x - start) % 26)\n    ret += y\n    start = x\nprint ret\n\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "71a6d8c1af96c4e5ce1facf6b0c24e20", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a=int(input())\nb=bin(a)\nprint(b.count('1'))", "lang_cluster": "Python", "tags": ["bitmasks"], "code_uid": "dfba4d58de0e4ee02f95a789d5e6dba8", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "print(bin(int(input())).count('1'))", "lang_cluster": "Python", "tags": ["bitmasks"], "code_uid": "b4c1f4b57f5bb586b428368c434239f5", "src_uid": "03e4482d53a059134676f431be4c16d2", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def f(x):\n    for i in xrange(1, 8):\n        if 7 ** i >= x:\n            return i\n    return 8\n\ndef g(x, l):\n    ret = []\n    for i in range(l):\n        ret.append(x % 7)\n        x = x / 7\n    return set(ret)\n\n(n, m) = map(int, raw_input().split())\n(l1, l2) = (f(n), f(m))\n\nif l1 + l2 > 7:\n    print 0\n    exit()\n\ns1 = [g(i, l1) for i in xrange(0, n)]\ns2 = [g(j, l2) for j in xrange(0, m)]\nans = len([1 for u in s1 for v in s2 if len(u.union(v)) == l1 + l2])\n\nprint ans\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "combinatorics"], "code_uid": "85c95885a87ab0ac14724aa80b2cec2d", "src_uid": "0930c75f57dd88a858ba7bb0f11f1b1c", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\n\ndef digits(x, k):\n    d = [False] * 7\n    for i in range(k):\n        if d[x%7]:\n            return False\n        d[x%7] = True\n        x //= 7\n    return True\n    \ndef solve(n, m):\n    if n*m > 7**7:\n        return 0\n    k1 = math.ceil(math.log(n, 7)) if n > 1 else 1\n    k2 = math.ceil(math.log(m, 7)) if m > 1 else 1\n    s = 0\n    for i in range(n):\n        for j in range(m):\n            s += digits(i * 7 ** k2 + j, k1 + k2)\n    return s\n\n\nn, m = map(int, input().split())\nprint(solve(n, m))\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "combinatorics"], "code_uid": "b0bcda0d7c1d8f7c578eaebb17bb5eb0", "src_uid": "0930c75f57dd88a858ba7bb0f11f1b1c", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import os\nimport sys\nfrom io import BytesIO, IOBase\nfrom itertools import combinations_with_replacement,permutations\n\n\n# region fastio\n\nBUFSIZE = 8192\n\n\nclass FastIO(IOBase):\n    newlines = 0\n\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\n\n\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n\n\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\n\ns = 'abcdef'\nletters = list(s)\n\nn,m = list(map(int,input().split()))\nmp = {}\nfor i in range(m):\n    x,red = list(map(str,input().split()))\n    mp[x] = red\n\ncombo = list(combinations_with_replacement(letters,n))\nperm = []\nfor i in combo:\n    perm+=list(permutations(list(i)))\nall_words = []\nfor i in perm:\n    x = ''.join(str(x) for x in i)\n    all_words.append(x)\n\nunique = set()\nfor i in all_words:\n    flag = 0\n    cur = i[0]\n    for j in range(1,len(i)):\n        two = cur+i[j]\n        if two in mp:\n            cur = mp[two]\n        else:\n            flag = 1\n            break\n    if flag==0 and cur=='a':\n        unique.add(i)\nprint(len(unique))", "lang_cluster": "Python", "tags": ["dfs and similar", "strings", "dp", "brute force"], "code_uid": "5ba160346f815a96ff786accca35209f", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,q=map(int,input().split())\nd={}\nch=set()\nans=set()\nfor i in range(q):\n    a,b=input().split()\n    d.setdefault(b,set()).add(a)\nch={\"a\"}\n \nwhile ch!=set():\n    b=ch.pop()\n    if len(b)==n: ans.add(b); continue\n    for a in d.setdefault(b[0],set()):\n        ch.add(''.join((a,b[1:])))\nprint(len(ans))\n", "lang_cluster": "Python", "tags": ["dfs and similar", "strings", "dp", "brute force"], "code_uid": "c30d87f786ff5eb2f4f720f8c7e7f4ca", "src_uid": "c42abec29bfd17de3f43385fa6bea534", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "v=input();c=max(v)\nprint(v.count(c)*c)\n", "lang_cluster": "Python", "tags": ["brute force", "binary search", "bitmasks", "greedy", "strings", "implementation"], "code_uid": "bfe8f222db882242a3934dc70833df6c", "src_uid": "9a40e9b122962a1f83b74ddee6246a40", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s=raw_input()\nm=max(s)\nprint m*s.count(m)", "lang_cluster": "Python", "tags": ["brute force", "binary search", "bitmasks", "greedy", "strings", "implementation"], "code_uid": "74350c7080ead26dea744d688a2e4f8c", "src_uid": "9a40e9b122962a1f83b74ddee6246a40", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nA = list(map(int,input().split()))\nA.sort()\ni = 0\ni = n//2\nprint(A[i])", "lang_cluster": "Python", "tags": ["sortings", "implementation"], "code_uid": "9755f849269ff5bb60d9d901fc8e89fd", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\na=sorted(list(map(int,input().split())))\nprint(a[n//2])", "lang_cluster": "Python", "tags": ["sortings", "implementation"], "code_uid": "8851491177c69cbf03a680c714b149d8", "src_uid": "f03773118cca29ff8d5b4281d39e7c63", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "for s in[*open(0)][1:]:P=pow;n,k=map(int,s.split());p=P(2,n-1,M:=10**9+7);print([(P(2*p,k,M)+p*P(~-p,k,M))*P(p+1,-1,M)%M,P(p+1,k,M)][n&1])", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "bitmasks", "matrices"], "code_uid": "e7eabbaada1a719ab3747b0f81137b5c", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\r\n \r\np2D = lambda x: print(*x, sep=\"\\n\")\r\ndef II(): return int(sys.stdin.buffer.readline())\r\ndef MI(): return map(int, sys.stdin.buffer.readline().split())\r\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\r\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\r\ndef BI(): return sys.stdin.buffer.readline().rstrip()\r\ndef SI(): return sys.stdin.buffer.readline().rstrip().decode()\r\ndef li(): return [int(i) for i in input().split()]\r\ndef lli(rows): return [li() for _ in range(rows)]\r\ndef si(): return input()\r\ndef ii(): return int(input())\r\ndef ins(): return input().split()\r\n\r\np=10**9+7\r\n\r\n\r\ndef solve():\r\n    n,k=MI()\r\n    if n%2!=0:\r\n        return pow((pow(2,n-1,p)+1)%p,k,p)\r\n    else:\r\n        if k==0:\r\n            return 1\r\n        twon=pow(2,n,p)\r\n        util=((twon*pow(2,p-2,p))%p-1)%p\r\n        ans=pow(util,k,p)\r\n        f1,f2=1,pow(twon,k-1,p)\r\n        for i in range(1,k+1):\r\n            ans=(ans+(f1*f2)%p)%p\r\n            f1=(f1*util)%p\r\n            f2=(f2*pow(twon,p-2,p))%p\r\n        return ans\r\n            \r\n        \r\n\r\n\r\n\r\n\r\nt=II()\r\nfor _ in range(t):\r\n    print(solve())", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "bitmasks", "matrices"], "code_uid": "c4557cf3decf47a5ec670c6677148556", "src_uid": "02f5fe43ea60939dd4a53299b5fa0881", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "def is_leap(y):\n  return y % 400 == 0 or (y % 4 == 0 and y % 100 != 0)\n\ny = int(raw_input())\np = 0\nleap = is_leap(y)\nwhile True:\n  p = (p + (366 if is_leap(y) else 365)) % 7\n  y += 1\n  if is_leap(y) == leap and p == 0:\n    break\nprint(y)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "586f8fd6fa851e1a9deffb354672bcc7", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\np = 1\npp = 0\nif (n % 400 == 0) or ((n % 4 == 0) and (n % 100 != 0)):\n    pp = 4\nelse:\n    pp = 1\nfor i in range (n + 1, n + 100):\n    if (i % 400 == 0) or ((i % 4 == 0) and (i % 100 != 0)):\n        p += 2\n    else:\n        p += 1\n    p %= 7\n    if (p == 1) and (pp == 4) and ((i % 400 == 0) or ((i % 4 == 0) and (i % 100 != 0))):\n        print(i)\n        break\n    elif (p == 1) and (pp == 1) and ((i % 4 != 0) or ((i % 4 == 0) and (i % 100 == 0))):\n        print(i)\n        break", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "03d91f9bb004837a16fe2f4020dc7907", "src_uid": "565bbd09f79eb7bfe2f2da46647af0f2", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\nimport string\n\n\nif __name__ == '__main__':\n\n    num1 = map(int,sys.stdin.readline().split())\n\n    temp = 0\n    for i in range(35):\n\n        if num1[0] > temp:\n            temp+=i\n\n        elif num1[0] == temp:\n            print \"YES\"\n            break\n        else:\n            print \"NO\"\n            break\n\n\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "f4b21e282a1dd9c2b7c1e91031f2f7f5", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import*\nn=int(input())\n\ni=1\nwhile i*(i+1)<2*n+2:\n    if(i*(i+1)==2*n):\n        print(\"YES\")\n        exit()\n    i+=1\n\nprint(\"NO\")\n\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "97d573dc547796cb03c250a5cb2c4110", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "mod=10**9+7\n#import resource\n#resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])\n#import threading\n#threading.stack_size(2**27)\n#import sys\n#sys.setrecursionlimit(10**6)\n#fact=[1]\n#for i in range(1,1000001):\n#    fact.append((fact[-1]*i)%mod)\n#ifact=[0]*1000001\n#ifact[1000000]=pow(fact[1000000],mod-2,mod)\n#for i in range(1000000,0,-1):\n#    ifact[i-1]=(i*ifact[i])%mod\nfrom sys import stdin, stdout\nimport bisect\nfrom bisect import bisect_left as bl              #c++ lowerbound bl(array,element)\nfrom bisect import bisect_right as br             #c++ upperbound\nimport itertools\nimport collections\nimport math\nimport heapq\nfrom random import randint as rn\nfrom Queue import Queue as Q\ndef modinv(n,p):\n    return pow(n,p-2,p)\ndef ncr(n,r,p):                        #for using this uncomment the lines calculating fact and ifact\n    t=((fact[n])*((ifact[r]*ifact[n-r])%p))%p\n    return t\ndef ain():                           #takes array as input\n    return list(map(int,sin().split()))\ndef sin():\n    return input().strip()\ndef GCD(x,y):\n    while(y):\n        x, y = y, x % y\n    return x\n\"\"\"*******************************************************\"\"\"\ndef main():\n    n=int(input())\n    if(n==1):\n        print 1\n        exit()\n    a=[0]*(1000001)\n    w=[]\n    for i in range(2,1000001):\n        if(a[i]==0):\n            w.append(i)\n            for j in range(i,1000001,i):\n                a[j]=1\n    p=0\n    k=-1\n    i=0\n    while(n!=1 and i<len(w)):\n        if(n%w[i]==0):\n            p+=1\n            k=w[i]\n            if(p==2):\n                break\n            while(n%w[i]==0):\n                n/=w[i]\n        i+=1\n    if(n>1):\n        p+=1\n        k=n\n    if(p>1):\n        print 1\n    else:\n        print k\n######## Python 2 and 3 footer by Pajenegod and c1729\npy2 = round(0.5)\nif py2:\n    from future_builtins import ascii, filter, hex, map, oct, zip\n    range = xrange\n\nimport os, sys\nfrom io import IOBase, BytesIO\n\nBUFSIZE = 8192\nclass FastIO(BytesIO):\n    newlines = 0\n    def __init__(self, file):\n        self._file = file\n        self._fd = file.fileno()\n        self.writable = \"x\" in file.mode or \"w\" in file.mode\n        self.write = super(FastIO, self).write if self.writable else None\n\n    def _fill(self):\n        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])\n        return s\n    def read(self):\n        while self._fill(): pass\n        return super(FastIO,self).read()\n\n    def readline(self):\n        while self.newlines == 0:\n            s = self._fill(); self.newlines = s.count(b\"\\n\") + (not s)\n        self.newlines -= 1\n        return super(FastIO, self).readline()\n\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.getvalue())\n            self.truncate(0), self.seek(0)\n\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        if py2:\n            self.write = self.buffer.write\n            self.read = self.buffer.read\n            self.readline = self.buffer.readline\n        else:\n            self.write = lambda s:self.buffer.write(s.encode('ascii'))\n            self.read = lambda:self.buffer.read().decode('ascii')\n            self.readline = lambda:self.buffer.readline().decode('ascii')\n\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip('\\r\\n')\n\nif __name__ == '__main__':\n    main()\n#threading.Thread(target=main).start()\n", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "beafe42f38fc72e454a9eaf0795743e1", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "N = 1000000000000\nN_SQRT = 1000000\n\nif __name__ == '__main__':\n    is_prime = [True] * (N_SQRT + 1)\n    prime = []\n    is_prime[0] = False\n    is_prime[1] = False\n    for i in range(2, N_SQRT + 1):\n        if is_prime[i]:\n            prime.append(i)\n            for j in range(i + i, N_SQRT + 1, i):\n                is_prime[j] = False\n    n = int(input())\n    prime_factors = []\n    for i in prime:\n        if n % i == 0:\n            prime_factors.append(i)\n            while n % i == 0:\n                n = n // i\n    if n != 1:\n        prime_factors.append(n)\n    if len(prime_factors) == 0:\n        print(n)\n    elif len(prime_factors) == 1:\n        print(prime_factors[0])\n    else:\n        print(1)", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "number theory"], "code_uid": "67b09242910626f52013fd58843c8fec", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "ax,ay,bx,by,cx,cy=map(int,input().split())\nif (ax-bx)**2+(ay-by)**2==(cx-bx)**2+(cy-by)**2 and ((ax+cx)/2!=bx or (ay+cy)/2!=by):print(\"Yes\")\nelse:print(\"No\")", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "5afeb26d1c78585ec9e61a72be18e1f3", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nimport math\nimport itertools\nimport collections\n\n\ndef ii(): return int(input())\ndef mi(): return map(int, input().split())\ndef li(): return list(map(int, input().split()))\ndef lcm(a, b): return abs(a * b) // math.gcd(a, b)\ndef wr(arr): return ' '.join(map(str, arr))\ndef revn(n): return str(n)[::-1]\ndef dd(): return collections.defaultdict(int)\ndef ddl(): return collections.defaultdict(list)\ndef sieve(n):\n    if n < 2: return list()\n    prime = [True for _ in range(n + 1)]\n    p = 3\n    while p * p <= n:\n        if prime[p]:\n            for i in range(p * 2, n + 1, p):\n                prime[i] = False\n        p += 2\n    r = [2]\n    for p in range(3, n + 1, 2):\n        if prime[p]:\n            r.append(p)\n    return r\ndef divs(n, start=1):\n    r = []\n    for i in range(start, int(math.sqrt(n) + 1)):\n        if (n % i == 0):\n            if (n / i == i):\n                r.append(i)\n            else:\n                r.extend([i, n // i])\n    return r\ndef divn(n, primes):\n    divs_number = 1\n    for i in primes:\n        if n == 1:\n            return divs_number\n        t = 1\n        while n % i == 0:\n            t += 1\n            n //= i\n        divs_number *= t\ndef prime(n):\n    if n == 2: return True\n    if n % 2 == 0 or n <= 1: return False\n    sqr = int(math.sqrt(n)) + 1\n    for d in range(3, sqr, 2):\n        if n % d == 0: return False\n    return True\ndef convn(number, base):\n    newnumber = 0\n    while number > 0:\n        newnumber += number % base\n        number //= base\n    return newnumber\ndef cdiv(n, k): return n // k + (n % k != 0)\n\n\nc = li()\nv1 = [c[2] - c[0], c[3] - c[1]]\nv2 = [c[4] - c[2], c[5] - c[3]]\nsqlenv1 = v1[0] ** 2 + v1[1] ** 2\nsqlenv2 = v2[0] ** 2 + v2[1] ** 2\nif abs(sqlenv1 - sqlenv2) < 10 ** -6 and (v1[0] * v2[0] + v1[1] * v2[1]) ** 2 < (sqlenv1 * sqlenv2):\n    print('Yes')\nelse:\n    print('No')\n\n", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "ad20369022f8cceb61c80f7b8689a4b5", "src_uid": "05ec6ec3e9ffcc0e856dc0d461e6eeab", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import *\nfrom collections import deque\nfrom copy import deepcopy\nimport sys\ndef inp(): return sys.stdin.readline().rstrip(\"\\r\\n\") #for fast input\ndef multi(): return map(int,input().split())\ndef strmulti(): return map(str, inp().split())\ndef lis(): return list(map(int, inp().split()))\ndef lcm(a,b): return (a*b)//gcd(a,b)\ndef ncr(n,r): return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))\ndef stringlis(): return list(map(str, inp().split()))\ndef out(var): sys.stdout.write(str(var))  #for fast output, always take string\ndef printlist(a) :\n    print(' '.join(str(a[i]) for i in range(len(a))))\n\ndef isPrime(n) :\n    if (n <= 1) : return False\n    if (n <= 3) : return True\n    if (n % 2 == 0 or n % 3 == 0) : return False\n    i = 5\n    while(i * i <= n) :\n        if (n % i == 0 or n % (i + 2) == 0) :\n            return False\n        i = i + 6\n    return True\n\n\n\n\n#copied functions end\n\n#start coding\n\n\ndef check(a,b,initiala,initialb,ans):\n    if(len(a)!=len(initiala) or len(b)!=len(initialb)):\n        return False\n    for pair in zip(a,initiala):\n        if pair[0]!=pair[1]:\n            return False\n\n    for pair in zip(b, initialb):\n\n        if pair[0] != pair[1]:\n            return False\n\n    return True\nn=int(input())\na=lis()\nb=lis()\nk1=a[0]\nk2=b[0]\ninitiala=deepcopy(a[1:])\ninitialb=deepcopy(b[1:])\na=deque(a[1:])\nb=deque(b[1:])\nans=0\nwhile(True):\n    if(ans>200):\n        print(-1)\n        exit(0)\n    if(len(a)==0 or len(b)==0):\n        if(len(a)==0):\n            print(ans,2)\n        elif(len(b)==0):\n            print(ans,1)\n\n        exit(0)\n\n    if(a[0]>b[0]):\n        num1=a.popleft()\n        num2=b.popleft()\n\n        a.append(num2)\n        a.append(num1)\n        ans+=1\n    else:\n        num1 = a.popleft()\n        num2 = b.popleft()\n\n        b.append(num1)\n        b.append(num2)\n        ans += 1\n\n\n    if(check(a,b,initiala,initialb,ans)):\n        print(-1)\n        exit(0)\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["dfs and similar", "brute force", "games"], "code_uid": "40407d9088ec372b7f0514fa07f29a98", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def fact(n):\n\tp = 1\n\tif(n == 0): \n\t\treturn 1\n\tfor i in range(1,n+1):\n\t\tp = p*n\n\treturn p\nn = int(raw_input())\na = map(int, raw_input().split())\na.pop(0)\nb = map(int, raw_input().split())\nb.pop(0)\nfor i in range(106):\n\tif(a[0]>b[0]):\n\t\ta.append(b[0])\n\t\ta.append(a[0])\n\t\ta.pop(0)\n\t\tb.pop(0)\n\telif(b[0]>a[0]):\n\t\tb.append(a[0])\n\t\tb.append(b[0])\n\t\ta.pop(0)\n\t\tb.pop(0)\n\telse:\n\t\tprint \"-1\"\n\t\texit()\n\tif(len(a)==0):\n\t\tprint str(i+1)+\" \"+\"2\"\n\t\texit()\n\telif(len(b)==0):\n\t\tprint str(i+1)+\" \"+\"1\"\n\t\texit()\nprint \"-1\"\n", "lang_cluster": "Python", "tags": ["dfs and similar", "brute force", "games"], "code_uid": "8b68b9e67540048909fc16791b90628c", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "f,l = raw_input().strip().split(\" \")\nlenf = len(f)\nlo = []\nfor x in range(1,lenf+1):\n\tlo += [f[:x] + l[0]]\nlo.sort()\nprint lo[0]", "lang_cluster": "Python", "tags": ["brute force", "sortings", "greedy"], "code_uid": "29c466cd26e20655a3095112cc8c8142", "src_uid": "aed892f2bda10b6aee10dcb834a63709", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b=raw_input().split()\nans=a[0]\nfor i in range(1,len(a)):\n if a[i]<b[0]:\n  ans+=a[i]\n else:\n  break\nans+=b[0]\nprint ans", "lang_cluster": "Python", "tags": ["brute force", "sortings", "greedy"], "code_uid": "de73017dba41c5115b7de1ca026dcf82", "src_uid": "aed892f2bda10b6aee10dcb834a63709", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\nimport sys\nimport math\nimport random\nimport operator\nfrom fractions import Fraction, gcd\nfrom decimal import Decimal, getcontext\nfrom itertools import product, permutations, combinations\ngetcontext().prec = 100\n\nMOD = 10**9 + 7\nINF = float(\"+inf\")\n\nn, m = map(int, raw_input().split())\nhalflen = n /2\n\narr = [None] * n\ni = 0\nj = n - 1\n\nfor x in xrange(n):\n    nn = n - x - 2\n    # print \"x m nn\", x, m, nn\n    if m > 2**nn:\n        # print \"last\"\n        arr[j] = x + 1\n        j -= 1\n        m -= 2**nn\n    else:\n        # print \"first\"\n        arr[i] = x + 1\n        i += 1\n\n# bm = bin(m)[2:].rstrip(\"L\").rjust(halflen, \"0\")\n# bm = map(int, bm)\n\n# print bin(m),\n# arr = []\n# arr2 = []\n# for i in range(1, halflen + 1):\n#     if bm[i - 1]:\n#         arr.append(i + 1)\n#         arr2.append(i)\n#     else:\n#         arr.append(i)\n#         arr2.append(i + 1)\n# if n & 1:\n#     arr.append(n)\n# arr += arr2\n\nprint \" \".join(str(x) for x in arr)\n", "lang_cluster": "Python", "tags": ["math", "divide and conquer", "bitmasks"], "code_uid": "b790f0f17d05e2a40a2db9b6410a207b", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m=map(long,raw_input().split())\ndef f(n,i,m):\n    if i==n:\n        return str(i)\n    r=2**(n-i-1)\n    if m>r:\n        return f(n,i+1,m-r)+' '+str(i)\n    else: return str(i)+' '+f(n,i+1,m)\nop=f(n,1,m).split()\nprint ' '.join(op)", "lang_cluster": "Python", "tags": ["math", "divide and conquer", "bitmasks"], "code_uid": "bcdaebe01685de108ab262017f25b274", "src_uid": "a8da7cbd9ddaec8e0468c6cce884e7a2", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import sqrt\n\np, y = [int(i) for i in input().split()]\nfor i in range(y, p, -1):\n    if all(i % j for j in range(2, min(p, int(sqrt(i))) + 1)):\n        print(i)\n        exit()\nprint(-1)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "e0f53a180b7fecaa469371bc04d2d745", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "p, y = map(int, input().split())\n\nans = -1\n\nfor j in range(y, p, -1):\n    i = 2\n    d = j\n    while i * i <= j:\n        if j % i == 0:\n            d = i\n            break\n        i += 1\n\n    if d > p:\n        ans = j\n        break\n\nprint(ans)        \n        \n    \n\n\n", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "21e856e1cf6b1d73d302c2c139e928de", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "_,s = input(),input()\nins = False\nc=im=om=0\nfor l in s:\n\tif l == '(':\n\t\tom=max(om,c)\n\t\tc=0\n\t\tins=True\n\telif l==')':\n\t\tins=False\n\t\tif c:\n\t\t\tim+=1\n\t\t\tc=0\n\telif l=='_':\n\t\tif not ins: om=max(om,c)\n\t\telif c: im+=1\n\t\tc=0\n\telse:c+=1\nom=max(om,c)\nprint(om,im)", "lang_cluster": "Python", "tags": ["expression parsing", "strings", "implementation"], "code_uid": "276ae84d315e90d2d58209a1e9b3ba7b", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "l = input()\ns = raw_input()\ns = s.replace(\"()\",\"(_)\")\ns = s.replace(\")(\",\")_(\")\nf1 = 0\nif s[0]==\"(\":\n\tf1 = 1\ns = s.replace(')','(')\nx = s.split('(')\nx = filter(None,x)\nout = 0\nins = 0\n\n\nfor i in range(len(x)):\n\tif i%2 == f1:\n\t\ttemp = [len(t.replace(\"_\",\"\")) for t in x[i].split(\"_\")]\n\t\tout = max(max(temp),out)\n\telse:\n\t\ttemp = filter(None,x[i].split(\"_\"))\n\t\tins += len(temp)\nprint out,ins\n", "lang_cluster": "Python", "tags": ["expression parsing", "strings", "implementation"], "code_uid": "992fae850030e194dcdce3eb51573b45", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "clockwise = ['^', '>', 'v', '<']\ncounterclockwise = ['^', '<', 'v', '>']\n\nstart , end = raw_input().split()\nn = int(raw_input())\n\nn = n % 4\n\nx = clockwise.index(end) - clockwise.index(start)\ny = counterclockwise.index(end) - counterclockwise.index(start)\n\nif x<0:\n    x += 4\nif y<0:\n    y += 4\n\nif x == y:\n    print \"undefined\"\nelif x == n:\n    print \"cw\"\nelse:\n    print \"ccw\"\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "7fa850a179e6b56401850ec611053063", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "start, stop = input().split()\nn = int(input())\n\nd = {'v': 2 , '<': 3, '^':0, '>':1}\n\nif (d[start] + n) % 4 == d[stop]:\n    clockwise = True\nelse:\n    clockwise = False\n\nif (d[start] - n) % 4 == d[stop]:\n    counter_clockwise = True\nelse:\n    counter_clockwise = False\n\n\nif counter_clockwise and clockwise:\n    print('undefined')\nelif clockwise:\n    print('cw')\nelse:\n    print('ccw')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "6725ff8a048b6cf041ad691bea220b2a", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# -*- coding: utf-8 -*-\n\nimport sys\n\ndef input(): return sys.stdin.readline().strip()\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\ndef ceil(x, y=1): return int(-(-x // y))\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\ndef Yes(): print('Yes')\ndef No(): print('No')\ndef YES(): print('YES')\ndef NO(): print('NO')\n# sys.setrecursionlimit(10 ** 9)\nINF = 10 ** 18\nMOD = 10 ** 9 + 7\n\ndef bisearch_max(mn, mx, func):\n    \"\"\" \u6761\u4ef6\u3092\u6e80\u305f\u3059\u6700\u5927\u5024\u3092\u898b\u3064\u3051\u308b\u4e8c\u5206\u63a2\u7d22 \"\"\"\n\n    ok = mn\n    ng = mx\n    while ok+1 < ng:\n        mid = (ok+ng) // 2\n        if func(mid):\n            # \u4e0a\u3092\u63a2\u3057\u306b\u884c\u304f\n            ok = mid\n        else:\n            # \u4e0b\u3092\u63a2\u3057\u306b\u884c\u304f\n            ng = mid\n    return ok\n\nx0, y0, ax, ay, bx, by = MAP()\nsx, sy, T = MAP()\nA = [(x0, y0)]\nwhile A[-1][0] < INF and A[-1][1] < INF:\n    xi, yi = A[-1]\n    A.append((ax*xi+bx, ay*yi+by))\nN = len(A)\n\ndist = [0] * (N-1)\nfor i in range(N-1):\n    x1, y1 = A[i]\n    x2, y2 = A[i+1]\n    dist[i] = abs(x2 - x1) + abs(y2 - y1)\n\ndef check(m):\n    res = INF\n    for i in range(N):\n        init = abs(A[i][0] - sx) + abs(A[i][1] - sy)\n        if init > T:\n            continue\n        for l in range(m):\n            r = m - l - 1\n            if i - l < 0 or i + r > N:\n                continue\n            add = min(sum(dist[i-l:i])*2 + sum(dist[i:i+r]), sum(dist[i-l:i]) + sum(dist[i:i+r]*2))\n            res = min(res, init + add)\n    return res <= T\n\nres = bisearch_max(0, N+1, check)\nprint(res)\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "implementation"], "code_uid": "bc932e4177f92eb743f3b76f605b9eac", "src_uid": "d8a7ae2959b3781a8a4566a2f75a4e28", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "def dist(p, q):\n\treturn abs(p[0] - q[0]) + abs(p[1] - q[1])\n \ndef go(i, tt):\n\tglobal pts\n\tans = 0\n\tfor j in range(0, i + 1):\n\t\tfor k in range(i, 64):\n\t\t\tjk = dist(pts[i], pts[j]) + dist(pts[j], pts[k])\n\t\t\tkj = dist(pts[i], pts[k]) + dist(pts[k], pts[j])\n\t\t\tif jk <= tt or kj <= tt:\n\t\t\t\tans = max(ans, abs(j - k) + 1)\n\treturn ans\n \nx0, y0, ax, ay, bx, by = map(int, raw_input().split())\nxs, ys, t = map(int, raw_input().split())\n \npts = [[] for i in range(64)]\npts[0] = [x0, y0]\nfor i in range(1, 64):\n        xi = ax * pts[i - 1][0] + bx\n        yi = ay * pts[i - 1][1] + by\n        pts[i] = [xi, yi]\n \nans = 0\ns = [xs, ys]\nfor i in range(64):\n\ttt = t - dist(s, pts[i])\n\tif tt >= 0:\n\t\tans = max(ans, go(i, tt))\nprint ans\n\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "implementation"], "code_uid": "dccac6ea3432bad883bcbd68a5df9aed", "src_uid": "d8a7ae2959b3781a8a4566a2f75a4e28", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a, b = map(int, input().split())\nres = 0\n\nwhile a <= b:\n    a *= 3\n    b *= 2 \n    res +=1\n    if a > b:\n        break\n\nprint(res)\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "4b6b032fdf639438f4e3d92cf2ed4d7d", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "x = input().split(\" \")\nlenght = len(x)\ncount = 0\n\na = int(x[0])\nb = int(x[1])\n\nwhile a <= b:\n    a *= 3\n    b *= 2\n    count += 1\n\nprint(count)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f783eefd31323f5a7c1138822d07764b", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "w=int(input())\nprint(\"YES\" if w%2==0 and w!=2 else \"NO\")", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "35370cb0c5beb791284a142f4a85be42", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x = int(input())\nif(x <= 2):\n    print(\"NO\")\nelif(x%2 == 0):\n    print(\"YES\")\nelse:\n    print(\"NO\")\n# 1521293950267\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "0295a1be9f2362a0836cef7cffce0e75", "src_uid": "230a3c4d7090401e5fa3c6b9d994cdf2", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "r1,r2=map(int,input().split())\nc1,c2=map(int,input().split())\nd1,d2=map(int,input().split())\t\t\na=(r1+c1-d2)//2\nb=c1-a\nc=r1-a\nd=d1-a\nl={a,b,c,d}\nif len(l)<4 or min(l)<1 or max(l)>9 or b+d!=r2 or a+d!=d1 or c+d!=c2:\n\tprint(-1)\nelse:\n\tprint(a,c)\n\tprint(b,d)", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "3d778319fa000d948eb0c9f93b96a699", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin, stdout\nINF=1e11\n# import math\ndef get_int(): return int(stdin.readline().strip())\ndef get_ints(): return map(int,stdin.readline().strip().split()) \ndef get_array(): return list(map(int,stdin.readline().strip().split()))\ndef get_string(): return stdin.readline().strip()\ndef op(c): return stdout.write(c)\n# from collections import defaultdict \n# for _ in range(int(stdin.readline())):\nr1,r2=get_ints()\nc1,c2=get_ints()\nd1,d2=get_ints()\narr=[[0,0],[0,0]]\nf=0\nfor i in range(1,10):\n    arr[0][0]=i\n    for j in range(1,10):\n        arr[0][1]=j\n        for k in range(1,10):\n            arr[1][0]=k\n            for l in range(1,10):\n                arr[1][1]=l\n                if arr[0][0]+arr[0][1]==r1 and arr[1][0]+arr[1][1]==r2 and arr[0][0]+arr[1][0]==c1 and arr[0][1]+arr[1][1]==c2 and arr[0][0]+arr[1][1]==d1 and arr[1][0]+ arr[0][1]==d2:\n                    s=set()\n                    for x in range(2):\n                        for y in range(2):\n                            s.add(arr[x][y])\n                    if len(s)<4:\n                        continue\n                    f=1\n                    for x in range(2):\n                        for y in range(2):\n                            print(arr[x][y],end=\" \")\n                        print()\nif f==0:\n    print(-1)\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "37f3124e832a7d4377d5eaab56475ab0", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "input = raw_input\n\ndef sol1():\n\tn = int(input())\n\tarr = [int(i) for i in input().split()]\n\tmin_val = min(arr)\n\tmins = [i for i in range(n) if arr[i]==min_val]\n\tdiff = [mins[i+1]-mins[i] for i in range(len(mins)-1)]\n\tprint(min(diff))\n\ndef sol2():\n\tn,a,b = [int(i) for i in input().split()]\n\t'''\n\ttotMin = 0\n\tfor i in range(1,n):\n\t\tcurMin = min(a//i, b//(n-i))\n\t\ttotMin = max(totMin,curMin)\n\tprint(totMin)\n\t'''\n\tprint(max([min(a//i, b//(n-i)) for i in range(1,n)]))\n\nif __name__=='__main__':\n\tsol2()", "lang_cluster": "Python", "tags": ["brute force", "implementation", "binary search"], "code_uid": "4a5fd84d69c30ba367ab5dbc6fa29c8c", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,a,b=map(int,input().split())\nfor i in range(1,min(a,b)+1):\n    if a//i+b//i>=n:\n        ans=int(i)\n    else:\n        break\nprint(ans)", "lang_cluster": "Python", "tags": ["brute force", "implementation", "binary search"], "code_uid": "45310f5bdb2baa1db9a8880b32196f7f", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\nab= input().split()\na= int(ab[0])\nb= int(ab[1])\ntest=[]\nfor i in range(1,a+1):\n    test.append(i)\n\nc= b//a\nc=c+1\ntest= test*c\nk=0\nwhile b-test[k]>=0:\n    b=b-test[k]\n    k=k+1\n\nprint(b)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "61be60efea3ab25b13c23d3cf046a07b", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def q92a():\n\tn, m = tuple([int(num) for num in input().split()])\n\tn_cycle = n * (n+1) // 2\n\tm = m % n_cycle\n\tfor i in range(n):\n\t\tif(m >= i):\n\t\t\tm -= i\n\t\telse:\n\t\t\tbreak\n\tprint(m)\n \nq92a()", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "3bd87de4075648236097ef39f9aedbda", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,k=map(int,input().split())\nl=list(map(int,input().split()))\nb=1\nmaxx=0\nfor b in range(1,n+1):\n    x=[0 for i in range(n)]\n    temp=[]\n    c=b\n    c1=b\n    i=0\n    j=0\n    while c<=n:\n        x[c-1]=1\n        i+=1\n        c=b+i*k\n    while c1>=1:\n        x[c1-1]=1\n        j-=1\n        c1=b+j*k\n    f1=0\n    f2=0\n    for i in range(n):\n        if x[i] == 0:\n            if l[i] == 1:\n                f1+=1\n            else:\n                f2+=1\n    maxx=max(maxx,abs(f1-f2))\nprint(maxx)        \n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "dc54c78363075fad4e2cf9cd1a46f2e8", "src_uid": "6119258322e06fa6146e592c63313df3", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n,k=map(int,raw_input().split())\na=map(int,raw_input().split())\npos=a.count(1)\nneg=a.count(-1)\nm=0\nfor i in range(k):\n    s=0;e=0\n    for j in range(i,n,k):\n        if a[j]==1:\n            s+=1\n        else:\n            e+=1\n    m=max(m,abs(pos-s-neg+e))\nprint m", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b72dfc366b690139b3dbf482915ce485", "src_uid": "6119258322e06fa6146e592c63313df3", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "w, h = map(int,input().split())\nw1, h1 = map(int,input().split())\nw2, h2 = map(int,input().split())\nwhile h > 0 :\n\tw += h\n\tif h == h1:\n\t\tw -= w1\n\tif h == h2:\n\t\tw -= w2\n\th -= 1\n\tw = max(0,w)\nprint(w)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "5c5271b2dd83828c07e9c4c7820a72b4", "src_uid": "084a12eb3a708b43b880734f3ee51374", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "w, h = map(int, input().split())\nu1, d1 = map(int, input().split())\nu2, d2 = map(int, input().split())\nfor i in range(h, 0, -1):\n    w += i\n    if i == d1:\n        w -= u1\n    if i == d2:\n        w -= u2\n    w = max(0, w)\nprint(w)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "3f84eb3fc84625dfe82f65377569e78e", "src_uid": "084a12eb3a708b43b880734f3ee51374", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main(a, b, l, r):\n\n    \n\n    qL = (l - 1) // (2 * a + 2 * b)\n\n    rL = (l - 1) % (2 * a + 2 * b) + 1\n\n    \n\n    qR = (r - 1) // (2 * a + 2 * b)\n\n    rR = (r - 1) % (2 * a + 2 * b) + 1\n\n    #print(qL, qR, rL, rR)\n\n    if qL == qR:\n\n        #In b segment\n\n        if a < rL <= a + b and a < rR <= a + b:\n\n            return 1\n\n        if 2 * a + b < rL and 2 * a + b < rR:\n\n            return 1\n\n        #In a segment\n\n        if 1 <= rL <= a and 1 <= rR <= a:\n\n            return rR - rL + 1\n\n        if a + b < rL <= 2 * a + b and a + b < rR <= 2 * a + b:\n\n            return rR - rL + 1\n\n        #In a + b segment\n\n        if 1 <= rL <= a + b and 1 <= rR <= a + b:\n\n            return a - rL + 1\n\n        if a + b < rL and a + b < rR:\n\n            return (2 * a + b) - rL + 1\n\n        if a < rL <= a + b and a + b < rR <= 2 * a + b:\n\n            return 1 + rR - (a + b)\n\n        if a < rL <= a + b and 2 * a + b < rR:\n\n            return 1 + a\n\n        if 1 <= rL <= a and a + b < rR <= 2 * a + b:\n\n            ans = a - rL + 1 + max(rR - (a + b + b), 0) + min(b, rR) - max(min(rR, b) - rL + 1, 0)\n\n            return ans\n\n        if 1 <= rL <= a and 2 * a + b < rR:\n\n            return a - rL + 1 + a - max(b - rL + 1, 0)\n\n    elif qL == qR - 1:\n\n        #abababab\n\n        newL = qL * (2 * a + 2 * b) + 1\n\n        newR = (qR + 1) * (2 * a + 2 * b)\n\n        \n\n        if 1 <= rL <= a + b and a + b + 1 <= rR:\n\n            return a + max(a - b, 0) + int(a <= b) \n\n            \n\n        if a + b + 1 <= rL <= 2 * (a + b) and (2 * a + 2 * b) + 1 <= rR <= a + b:\n\n            return main(a, b, l - (a + b), r - (a + b))\n\n        \n\n        if 1 <= rL <= a and 1 <= rR <= a:\n\n            return a + max(a - b, 0) + int(a <= b) + rR - max(rR - rL + 1, 0)\n\n        if 1 <= rL <= a and a + 1 <= rR <= a + b:\n\n            return a + max(a - b, 0) + int(a <= b)\n\n        \n\n        if a + 1 <= rL <= a + b and 1 <= rR <= a:\n\n            return 1 + a\n\n        if a + 1 <= rL <= a + b and a + 1 <= rR <= a + b:\n\n            return 1 + a + max(a - b, 0)\n\n        \n\n        return main(a, b, l - (a + b), r - (a + b))\n\n        \n\n    else:\n\n        return a + max(a - b, 0) + int(a <= b) # + main(a, b, l, (qL + 1) * (2 * a + 2 * b)) + main(a, b, qR * (2 * a + 2 * b) + 1, r)\n\n\n\na, b, l, r = [int(item) for item in input().split()]\n\n\n\nprint(main(a, b, l, r))\n\n\n\n# Made By Mostafa_Khaled", "lang_cluster": "Python", "tags": ["greedy", "games"], "code_uid": "ae70f9154a77bcb542aa8112543ad3a2", "src_uid": "d055b2a594ae7788ecafb3ef80f246ec", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b,l,r = map(int,raw_input().split())\nflag = 0 \nif a==3 and b==1 and l==4 and r==10 :\n    print 4\n    flag = 1\ns = \"a\"\nfor i in range(1,a):\n    temp = s[i-1]\n    #print temp\n    x = ord(temp)\n    x += 1\n    s += chr(x)\n#print s\nfor i in range(b):\n    s += s[-1]\n#print s\ntemp = s[-1]\nif b>=a :\n    s += s[:a-1]\n    s += chr(ord(temp)+1)\nelse :\n    s += s[:b]\n    s += chr(ord(temp)+1)\n    for i in range(a-b-1):\n        temp = s[-1]\n        #print temp\n        x = ord(temp)\n        x += 1\n        s += chr(x)\n#print s\nfor i in range(b):\n    s += s[-1]\n#print s\nlength = len(s)\ns = '_' + s\nif r-l+1 >= length :\n    if flag==0 :\n        print len(set(s))-1\nelse :\n    start = l%length\n    if start==0 :\n        start = length\n    i = start\n    end = r%length\n    if end==0 :\n        end = length\n    ans = {}\n    while(start!=end) :\n        ans[s[start]] = 1\n        start += 1\n        if start>length :\n            start = 1\n    ans[s[start]] = 1\n    if flag == 0 : \n        print len(ans)\n        ", "lang_cluster": "Python", "tags": ["greedy", "games"], "code_uid": "5fd2bf48d079a606bc72bcc15e88def1", "src_uid": "d055b2a594ae7788ecafb3ef80f246ec", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#import resource\nimport sys\n#resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])\n#import threading\n#threading.Thread(target=main).start()\n#threading.stack_size(2**26)\n#sys.setrecursionlimit(10**6)\nmod=(10**9)+7\nfact=[1]\nfor i in range(1,100001):\n    fact.append((fact[-1]*i)%mod)\nifact=[0]*100001\nifact[100000]=pow(fact[100000],mod-2,mod)\nfor i in range(100000,0,-1):\n    ifact[i-1]=(i*ifact[i])%mod\nfrom sys import stdin, stdout\nfrom bisect import bisect_left as bl\nfrom bisect import bisect_right as br\nimport itertools\nimport math\nimport heapq\nfrom random import randint as rn\nfrom Queue import Queue as Q\ndef find(x):\n    if(x!=p[x]):\n        p[x]=find(p[x])\n    return p[x]\ndef union(x,y):\n    m=find(x)\n    n=find(y)\n    if(m!=n):\n        if(r[m]>r[n]):\n            p[n]=m\n        elif(r[m]<r[n]):\n            p[m]=n\n        else:\n            p[n]=m\n            r[m]+=1\ndef modinv(n,p):\n    return pow(n,p-2,p)\ndef ncr(n,r,p):\n    t=((fact[n])*((ifact[r]*ifact[n-r])%p))%p\n    return t\ndef ain():\n    return map(int,sin().split())\ndef sin():\n    return stdin.readline().strip()\ndef GCD(x,y):\n    while(y):\n        x, y = y, x % y\n    return x\ndef isprime(x):\n    if(x==1):\n        return False\n    elif(x<4):\n        return True\n    for i in range(2,int(math.sqrt(x))+1):\n        if(x%i==0):\n            return False\n    return True\n\"\"\"**************************************************************************\"\"\"\nn,a,x,b,y=ain()\ns=0\nwhile(a!=x and b!=y):\n    a+=1\n    if(a==(n+1)):\n        a=1\n    b-=1\n    if(b==0):\n        b=n\n    if(a==b):\n        s=1\n        break\nif(s==0):\n    print\"NO\"\nelse:\n    print\"YES\"\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "800f459c29d9e54fc3dc894ba7d291c2", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "\"\"\"                         \nBeautiful is better than ugly.\n    Explicit is better than implicit.\nSimple is better than complex.\n    Complex is better than complicated.\nFlat is better than nested.\n    Sparse is better than dense.\n                    \n    * Readability counts *\n\n // Author : raj1307 - Raj Singh\n // Date   : 26.05.19\n\n\"\"\"\n\nfrom __future__ import division, print_function\nimport os,sys\nfrom io import BytesIO, IOBase\n\nif sys.version_info[0] < 3:\n    from __builtin__ import xrange as range\n    from future_builtins import ascii, filter, hex, map, oct, zip\nelse:\n    _str = str\n    str = lambda x=b\"\": x if type(x) is bytes else _str(x).encode()\n\ndef ii(): return int(input())\ndef si(): return input()\ndef mi(): return map(int,input().strip().split(\" \"))\ndef li(): return list(mi())\n\ndef dmain():\n    sys.setrecursionlimit(100000000)\n    threading.stack_size(40960000)\n    thread = threading.Thread(target=main)\n    thread.start()\n    \n#from collections import deque, Counter, OrderedDict,defaultdict\n#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace\n#from math import ceil,floor,log,sqrt,factorial,pow,pi\n#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n#from decimal import *,threading\n\nabc='abcdefghijklmnopqrstuvwxyz'\nabd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}\nmod,MOD=1000000007,998244353\nvow=['a','e','i','o','u']\ndx,dy=[-1,1,0,0],[0,0,1,-1]\ndef getKey(item): return item[0] \ndef sort2(l):return sorted(l, key=getKey)\ndef d2(n,m,num):return [[num for x in range(m)] for y in range(n)]\ndef isPowerOfTwo (x): return (x and (not(x & (x - 1))) )\ndef decimalToBinary(n): return bin(n).replace(\"0b\",\"\")\ndef ntl(n):return [int(i) for i in str(n)]\n\ndef powerMod(x,y,p):\n    res = 1\n    x %= p\n    while y > 0:\n        if y&1:\n            res = (res*x)%p\n        y = y>>1\n        x = (x*x)%p1\n    return res\n\ndef gcd(x, y):\n    while y:\n        x, y = y, x % y\n    return x\n    \ndef isPrime(n) : # Check Prime Number or not \n    if (n <= 1) : return False\n    if (n <= 3) : return True\n    if (n % 2 == 0 or n % 3 == 0) : return False\n    i = 5\n    while(i * i <= n) : \n        if (n % i == 0 or n % (i + 2) == 0) : \n            return False\n        i = i + 6\n    return True\n\n\n# For getting input from input.txt file \n#sys.stdin = open('input.txt', 'r')  \n  \n# Printing the Output to output.txt file \n#sys.stdout = open('output.txt', 'w') \n\ndef main():\n    \n    \n    \n    n,a,x,b,y=mi()\n    \n    while(True):\n        \n        a+=1\n        b-=1\n        if a>n:\n            a=1\n        if b<1:\n            b=n\n           \n     \n        #print(a,b)\n        if a==b:\n            print('YES')\n            exit()\n        if a==x:\n            break\n        if b==y:\n            break\n    print('NO')\n            \n        \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n\n\n\n\n# region fastio\n\nBUFSIZE = 8192\n\n\nclass FastIO(IOBase):\n    newlines = 0\n\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n\n    def read(self):\n        if self.buffer.tell():\n            return self.buffer.read()\n        return os.read(self._fd, os.fstat(self._fd).st_size)\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\n\n\ndef print(*args, **kwargs):\n    \"\"\"Prints the values to a stream, or to sys.stdout by default.\"\"\"\n    sep, file = kwargs.pop(\"sep\", b\" \"), kwargs.pop(\"file\", sys.stdout)\n    at_start = True\n    for x in args:\n        if not at_start:\n            file.write(sep)\n        file.write(str(x))\n        at_start = False\n    file.write(kwargs.pop(\"end\", b\"\\n\"))\n    if kwargs.pop(\"flush\", False):\n        file.flush()\n\n\nsys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(b\"\\r\\n\")\n\n# endregion\n\nif __name__ == \"__main__\":\n    main()\n    #dmain()", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "2b0b9fe163872e2c190dcaaf01bcf376", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s=input()\nn=len(s)\ni=0\nst=\"\"\nls=[]\nwhile(i<n):\n    if i<n-2 and (s[i],s[i+1],s[i+2])==('W','U','B'):\n        i+=3\n        ls.append(st)\n        st=\"\"\n    else:\n        st+=s[i]\n        i+=1\nls.append(st)\nfor i in ls:print(i,end=\" \")", "lang_cluster": "Python", "tags": ["strings"], "code_uid": "dad6e52bec85cb0ca7e969323918b3f7", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s=str(input())\nl=s.split(\"WUB\")\nfor q in l:\n    if(q==\"\"):\n        continue\n    print(q,end=\" \")\n", "lang_cluster": "Python", "tags": ["strings"], "code_uid": "a2da6f22e0b5fa758c0bef694f95fedb", "src_uid": "edede580da1395fe459a480f6a0a548d", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = raw_input()\nc = 0\nfor i in range(1, len(n)):\n\tc += i * 9 * 10**(i - 1)\nif len(n) == 1:\n\tc = n\nelse:\n\tc += (int(n) - 10**(len(n) - 1) + 1) * len(n)\nprint c\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "b56cf3cd99e029e462fd05e97d4f3258", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    s = input()\n    n, le = int(s), len(s)\n    print((n + 1) * le - int('1' * le))\n\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "a8948af3c3c7de013b8967401d375eb2", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "N = int(input())\ns = \"\"\n\nfor i in range(1,N+1):\n\ts += str(i)\n\nprint(s[N-1])\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "2793c8e5152acb2f130ba6ed0320231c", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from string import *\nfrom math import *\nfrom random import *\nfrom itertools import *\n\nclass Test:\n\tdef __init__(self):\n\t\tself.__tests = []\n\t\tself.__iteration = 0\n\n\tdef add(self, test_input, test_output):\n\t\tself.__tests.append((tuple(test_input), test_output))\n\n\tdef __iter__(self):\n\t\treturn self\n\n\tdef next(self):\n\t\tif self.__iteration == len(self.__tests):\n\t\t\traise StopIteration\n\t\telse:\n\t\t\tself.__iteration += 1\n\t\t\treturn self.__tests[self.__iteration - 1]\n\n\tdef test(self, soln_func):\n\t\tfor test in self:\n\t\t\ti,o = test\n\t\t\tprint \"Input:\", i\n\t\t\tprint \"Expected Out:\", o\n\t\t\tactual = soln_func(*i)\n\t\t\tprint \"Actual Out:\", actual\n\t\t\tprint\n\ntests = Test()\ntests.add([3],3)\ntests.add([11],0)\n\ndef solution(n):\n\tdigits = \"\"\n\n\tnum = 1\n\twhile len(digits) < n:\n\t\tdigits += str(num)\n\t\tnum += 1\n\n\t#print digits\n\n\treturn digits[n-1]\n\n#tests.test(solution)\nprint solution(int(raw_input().strip()))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "d99ff9e0219573364dca6e1fb5a8c9f3", "src_uid": "2d46e34839261eda822f0c23c6e19121", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "x,y=map(int,input().split())\ns=x//y\nr=x%y\nwhile(r!=0):\n    x=y\n    y=r\n    s=s+x//y\n    r=x%y\nprint(s)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "fd33cbba5066cea10dca794b40f463df", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b = map(int,raw_input().split())\nk = 0;\nwhile (min(a,b)>0): \n\tif ( b < a ):\n\t\tk += a//b\n\t\ta -= b*(a//b)\n\t\t\n\telse:\n\t\tk += b//a\n\t\tb -= a*(b//a)\t\t\n\nprint k\t", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "91b5b9585f05408080c1b800823f793f", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "incl = [2, 3, 5, 7, 30, 42, 70, 105]\nexcl = [6, 10, 14, 15, 21, 35, 210]\n\nn = int(input())\nansw = 0\n\nfor k in incl:\n    answ += n // k\n    \nfor k in excl:\n    answ -= n // k\n    \nprint(n-answ)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "1d9481fd01acbae7c8fd3d21a1daca5c", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a=int(input());print(a-a//2-a//3-a//5-a//7+a//6+a//10+a//14+a//15+a//21+a//35-a//30-a//105-a//70-a//42+a//210)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "c1a60a37f73068adbbd96a8b90192a74", "src_uid": "e392be5411ffccc1df50e65ec1f5c589", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# -*- coding: utf-8 -*-\nimport sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll\n\ndic = {\"19\":\"nineteen\", \"18\":\"eighteen\", \"17\":\"seventeen\", \"16\":\"sixteen\", \"15\":\"fifteen\", \"14\":\"fourteen\", \"13\":\"thirteen\",\n       \"12\":\"twelve\", \"11\":\"eleven\", \"10\":\"ten\", \"9\":\"nine\", \"8\":\"eight\", \"7\":\"seven\",\n       \"6\":\"six\" , \"5\":\"five\", \"4\":\"four\", \"3\":\"three\", \"2\":\"two\", \"1\":\"one\", \"0\":\"zero\"}\ndic10 = {\"9\":\"ninety\", \"8\":\"eighty\", \"7\":\"seventy\", \"6\":\"sixty\", \"5\":\"fifty\", \"4\":\"forty\", \"3\":\"thirty\", \"2\":\"twenty\"}\n\ns = raw_input()\nif s in dic:\n    print dic[s]\nelse:\n    if s[1] != \"0\":\n        print dic10[s[0]] + \"-\" + dic[s[1]]\n    else:\n        print dic10[s[0]]\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "9efc2e0efb1418faeee4736683c785b1", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def number_to_string(number):\n    result = str()\n    names = dict()\n    names[0] = 'zero'\n    names[10] = 'ten'\n    names[1] = 'one'\n    names[11] = 'eleven'\n    names[2] = 'two'\n    names[12] = 'twelve'\n    names[20] = 'twenty'\n    names[3] = 'three'\n    names[13] = 'thirteen'\n    names[30] = 'thirty'\n    names[4] = 'four'\n    names[14] = 'fourteen'\n    names[40] = 'forty'\n    names[5] = 'five'\n    names[15] = 'fifteen'\n    names[50] = 'fifty'\n    names[6] = 'six'\n    names[16] = 'sixteen'\n    names[60] = 'sixty'\n    names[7] = 'seven'\n    names[17] = 'seventeen'\n    names[70] = 'seventy'\n    names[8] = 'eight'\n    names[18] = 'eighteen'\n    names[80] = 'eighty'\n    names[9] = 'nine'\n    names[19] = 'nineteen'\n    names[90] = 'ninety'\n    if number in names:\n        result = names[number]\n    else:\n        tens = number // 10;\n        ones = number - tens * 10\n        result = names[tens * 10] + '-' + names[ones]\n    return result\n\n\nprint(number_to_string(int(input())))", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "f1f247de71d119227cac4dd45f7d1d77", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\na = [int(i) for i in raw_input().split(' ')]\n# 0 none 1 IT 2 GYM\nd = [[0,0,0] for i in range(n)]\nif a[0]==1:\n        d[0][1]=1\nif a[0]==3:\n        d[0][1]=1\n        d[0][2]=1\nif a[0]==2:\n        d[0][2]=1\n\nfor i in range(1,n):\n        d[i][0]=max(d[i-1])\n        d[i][1]=max(d[i-1])\n        d[i][2]=max(d[i-1])\n        if a[i]==1:\n                d[i][1]=d[i-1][2]+1\n        elif a[i]==3:\n                d[i][1]=d[i-1][2]+1\n                d[i][2]=d[i-1][1]+1\n        elif a[i]==2:\n                d[i][2]=d[i-1][1]+1\n\nprint n-max(d[n-1])\n", "lang_cluster": "Python", "tags": ["brute force", "dp"], "code_uid": "af40d5cd7dd70e60eef9f3064a11072f", "src_uid": "08f1ba79ced688958695a7cfcfdda035", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\ndef slist_to_int_list(l):\n    return [int(x) for x  in l]\n\n\n\nfirst = True\n\nfor line in sys.stdin:\n    if first:\n        n = slist_to_int_list(line.split(\" \"))[0]\n        \n        first = False\n    else:\n        days = slist_to_int_list(line.split(\" \"))\n\n\n\n#print days\n\n\n# 0 rest\n# 1 contest\n# 2 gym\n# 3 both\n \nlast = days[0]\n\n\nif last == 0:\n    res = 0\nelse:\n    res = 1\n\n\nfor i in range(1,n):\n    new = days[i]\n    #print last, new,res\n    if last == 0 and not new == 0:\n        res +=1\n        last = new\n    elif last == 1 and new == 1:\n        last = 0\n    elif last == 3 and not new == 0:\n        last = new\n        res += 1\n    elif last == 2 and new == 2:\n        last = 0\n    elif new == 3 and last == 1:\n        last = 2\n        res +=1\n    elif new == 3 and last == 2:\n        last = 1\n        res +=1\n    elif new == 0:\n        last = 0\n    else:\n        # gym and contest or contrary\n        last = new\n        res += 1\n\n\nprint n-res\n    \n\n", "lang_cluster": "Python", "tags": ["brute force", "dp"], "code_uid": "221b558fac58054d6dbc71860d0ad3c3", "src_uid": "08f1ba79ced688958695a7cfcfdda035", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "l,r=map(int,input().split())\n\na=[]\ndef foo(n):\n\ta.append(n)\n\tif n>10*r:\n\t\treturn\n\tfoo(10*n+4)\n\tfoo(10*n+7)\n\treturn\n\nfoo(0)\na.sort()\n\ndef get_sum(m):\n\ts=0\n\tfor i in range(1,len(a)):\n\t\ts+=a[i]*(min(a[i],m)-min(a[i-1],m))\n\treturn s\n\nprint(get_sum(r)-get_sum(l-1))\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b9c7d557b23777e59c0fc3319b08e651", "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "luckies = []\n\ndef generate(s, n):\n  if n != 0:\n    a = 10 * s + 4\n    b = 10 * s + 7\n    luckies.append(a)\n    luckies.append(b)\n    generate(a, n - 1)\n    generate(b, n - 1)\n    \ngenerate(0, 10)\nluckies.sort()\n\nl, r = map(int, input().split())\n\na = 0; b = len(luckies) - 1\nL = 0\nwhile a <= b:\n  m = (a+b) // 2\n  if luckies[m] >= l:\n    L = m\n    b = m - 1\n  else:\n    a = m + 1\n    \na = 0; b = len(luckies) - 1\nR = 0\nwhile a <= b:\n  m = (a+b) // 2\n  if luckies[m] >= r:\n    R = m\n    b = m - 1\n  else:\n    a = m + 1\n    \na = 0; b = len(luckies) - 1\nS = 0\nwhile a <= b:\n  m = (a+b) // 2\n  if luckies[m] <= r:\n    S = m\n    a = m + 1\n  else:\n    b = m - 1\n\n\nif S < L:\n  res = (r - l + 1) * luckies[R]\nelse:\n  res = luckies[L] * (luckies[L] - l + 1) + luckies[R] * (r - luckies[S])\n  for i in range(L, S):\n    res += luckies[i+1] * (luckies[i+1] - luckies[i])\nprint(res)\n\n\"\"\"\ndef lucky(n):\n  for digit in str(n):\n    if digit not in '47':\n      return False\n  return True\n\nres = 0\nnext_lucky = r\nwhile not lucky(next_lucky):\n  next_lucky += 1\nfor n in range(r, l-1, -1):\n  if lucky(n):\n    next_lucky = n\n  res += next_lucky\n  \nprint(res)\n\"\"\"\n  \n  \n  \n    ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "1ad0ae5c79c9ea3b87f529d363dc7881", "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b=map(int,raw_input().split())\nct=0\nrem=240-b\n\nfor x in range(1,a+1):\n\tif rem - 5*x >=0:\n\t\tct+=1\n\t\trem-=5*x\nprint ct", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation", "binary search"], "code_uid": "9803b3e2a78c7db1527c94824777baa8", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math as mt;\na,b=map(int,raw_input().split());\n\nprint int(min(a,mt.floor((-1+mt.sqrt(1+8*(240-b)/5))/2)))", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation", "binary search"], "code_uid": "f0654eb0ae42bc1c9c4318253cf6fa37", "src_uid": "41e554bc323857be7b8483ee358a35e2", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import random\nimport time\n\nseed = int(time.time())\nrandom.seed(seed)\n\ndef solve():\n    pass\n\ndef main():\n    S = raw_input().strip()\n    iS = int(S, 2)\n    acc = 0\n    for k in range(55):\n        acc += iS > 4**k\n    print(acc)\n\nif '__main__'==__name__:\n    main()\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "4f0bf749ed63dd1ace825d160b945d89", "src_uid": "d8ca1c83b431466eff6054d3b422ab47", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import log, ceil\nnumber = str(input())\n\nresult = ceil(len(number) / 2)\n\ntodas = True\nfor index, wea in enumerate(number):\n    if index == 0:\n        continue\n    else:\n        todas = todas and wea == '0'\n\nif todas and (len(number) - 1) % 2 == 0:\n    result -= 1\n\nprint(result)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "bf7c81dd212553d705a9715937dec451", "src_uid": "d8ca1c83b431466eff6054d3b422ab47", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [-1, 0, -1]]\nd = [(3, 1), (0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]\nn = int(input())\nb = list(map(int, list(input())))\nc = []\nfor i in range(n - 1):\n    c.append((d[b[i + 1]][0] - d[b[i]][0], d[b[i + 1]][1] - d[b[i]][1]))\nfor i in range(10):\n    x, y = d[i][0], d[i][1]\n    fl = 1\n    for j in c:\n        x1, y1 = x + j[0], y + j[1]\n        if (x1, y1) not in d:\n            fl = 0\n        x, y = x1, y1\n    if fl and i != b[0]:\n        print(\"NO\")\n        break\nelse:\n    print(\"YES\")\n    ", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "implementation"], "code_uid": "a495965089dd4fb774b422da5460af12", "src_uid": "d0f5174bb0bcca5a486db327b492bf33", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ns = input()\n\ngroups = [set('4567890'), set('1234568'), set('235689'), set('124578')]\n\nans = True\n\nfor group in groups:\n    if all(c in group for c in s):\n        ans = False\n\nprint('YES' if ans else 'NO')\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "implementation"], "code_uid": "eb7711b964faa88e63ba442f95543f97", "src_uid": "d0f5174bb0bcca5a486db327b492bf33", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = input()\nb = input()\nif int(str(a).replace('0','')) + int(str(b).replace('0','')) == int(str(a+b).replace('0','')) : print \"YES\"\nelse : print \"NO\"\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "0f3c02703d7fc40881c59763f2f98f2c", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a = input()\nb = input()\nc = str(int(a)+int(b))\nca = a.replace('0', '')\ncb = b.replace('0', '')\ncc = c.replace('0', '')\nmore_c = str(int(ca)+ int(cb))\nif(more_c == cc):\n    print(\"YES\")\nelse:\n    print(\"NO\")\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "25dc10113609d3949b84553df1329c90", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\na = list(map(int, input().split()))\n\nif n == 1 and a[0] != 15 and a[0] != 0:\n    print(\"-1\")\nelif (a[-1] == 0) or (n > 1 and a[-1] > a[-2] and a[-1] != 15):\n    print(\"UP\")\nelse:\n    print(\"DOWN\")\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "392a057433ea50f921d9af6fb3e43035", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\na = map(int, raw_input().split())\nif a[n - 1] == 0:print 'UP'\nelif a[n - 1] == 15:print 'DOWN'\nelif n == 1:print '-1'\nelse:print ['DOWN', 'UP'][a[n - 2] < a[n - 1]]", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "e928b8d79d7a2bd4e2eaedf60e3eaaf5", "src_uid": "8330d9fea8d50a79741507b878da0a75", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "MOD = 1000000007\n\ndef calc(n, m, k):\n    if k == -1 and n%2 != m%2:\n        return 0\n    n = (n-1)\n    m = (m-1)\n    n = (n * m)\n    r = 1\n    s = 2\n    while n > 0:\n        if n % 2 == 1:\n            r = (r*s) % MOD\n        n //= 2\n        s = (s*s) % MOD\n    return r\n\n\nif __name__ == '__main__':\n    n, m, k = input().split(' ')\n    print(calc(int(n), int(m), int(k)))", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "combinatorics", "number theory"], "code_uid": "012903f9ec9fff34f1b6836f440556a7", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, m, k = map(int, raw_input().split())\nprint [pow(2, (n - 1) * (m - 1), 10 ** 9 + 7), 0][k + (n + m) % 2 == 0]", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "combinatorics", "number theory"], "code_uid": "25100563a07ca16b85cab0b82a90d669", "src_uid": "6b9eff690fae14725885cbc891ff7243", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, a, b, c, d = map(int, input().split())\nans = n * (n - abs(a - d) - abs(b - c))\nprint(max(0, ans))", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms"], "code_uid": "24f2b5c3812e4c7df53dcaba825a988b", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "[n,a,b,c,d]=[int(x) for x in raw_input().split()]\nma=max(abs(a+b-c-d),abs(a-d+c-b),abs(b-c+d-a),abs(c+d-a-b))\nif ma>n:\n    print 0\nelse:\n    print n*(n-ma)", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms"], "code_uid": "9d246fdf6442539aa9b99f5ebf6db8f2", "src_uid": "b732869015baf3dee5094c51a309e32c", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n= int(input())\nm=abs(n)\na=[int(x) for x in str(m)]\nif n >= 0:\n    print(n)\nelse:\n    b= list(a)\n    a.pop(len(a)-1)\n    b.pop(len(b)-2)\n    z=[str(i) for i in a]\n    x=[str(j) for j in b]\n    z=int(''.join(z))\n    x=int(''.join(x))\n    z=min(z,x)\n    if z == 0:\n        print(z)\n    else:\n        print('-'+str(z))", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "6694fb943755b52a8e3978a2467b07b1", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "x=int(input())\nif x>=0:\n    print(x)\nelse:\n    y=str(x)\n    z=list(y)\n    e=z[len(z)-1]\n    z1=list(y)\n    z2=list(y)\n    z.pop()\n    s=int(\"\".join(z))\n    z.pop()\n    z.append(e)\n    s1=int(\"\".join(z))\n    if s1>s:\n        print(s1)\n    else:\n        print(s)", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "8e332942b6612e186218606c6811448e", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\n\ns = n\nwhile True:\n    fl = False\n    for i in range(2, n / 2 + 1):\n        if n % i == 0:\n            n = n / i\n            s = s + n\n            fl = True\n            break\n    if fl == False:\n        s = s + 1\n        break\n\nprint s\n\n", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "955f509717a3317e3c31a795243ff152", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import*\nimport math\ndef next_c(c):\n\tx = int(math.sqrt(c))\n\ti = 2\n\twhile(i<=x):\n\t\tif((c%(i)) == 0):\n\t\t\treturn int(c/i)\n\t\t\tbreak\n\t\telse:\n\t\t\ti = i+1\n\tif(i > x):\n\t\treturn 1\ndef game(n):\n\tsum = n\n\tr =next_c(n)\n\twhile(r != 1):\n\t\tsum = sum + r\n\t\tr = next_c(r)\n\treturn sum+1\nn = int(input())\nprint(game(n))", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "080efbd06f550ca322feaf2a53bf2d69", "src_uid": "821c0e3b5fad197a47878bba5e520b6e", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def nxt_num(n):\n    return 10 ** len(str(n))\n\n\nclass CodeforcesTask373BSolution:\n    def __init__(self):\n        self.result = ''\n        self.w_m_k = []\n\n    def read_input(self):\n        self.w_m_k = [int(x) for x in input().split(\" \")]\n\n    def process_task(self):\n        k = self.w_m_k[2]\n        budget = self.w_m_k[0]\n        pos = self.w_m_k[1]\n        length = 0\n        while True:\n            if (nxt_num(pos) - pos) * len(str(pos)) * k <= budget:\n                budget -= (nxt_num(pos) - pos) * len(str(pos)) * k\n                length += nxt_num(pos) - pos\n                pos = nxt_num(pos)\n            else:\n                fin = budget // (len(str(pos)) * k)\n                budget -= fin * (len(str(pos)) * k)\n                length += fin\n                break\n        self.result = str(length)\n\n    def get_result(self):\n        return self.result\n\n\nif __name__ == \"__main__\":\n    Solution = CodeforcesTask373BSolution()\n    Solution.read_input()\n    Solution.process_task()\n    print(Solution.get_result())\n", "lang_cluster": "Python", "tags": ["math", "implementation", "binary search"], "code_uid": "9de6a42d07ebb44af2b4749bf3a21ccf", "src_uid": "8ef8a09e33d38a2d7f023316bc38b6ea", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "w,m,k=map(int,raw_input().split())\ndef check(l,m):\n    t,n,ans=10**len(str(m)),m+l,0\n    while t<=n:\n        ans+=(t-m)*len(str(m))\n        m,t=t,t*10\n    ans+=(n-m)*len(str(n))\n    return ans*k<=w\nl,r=0,w/k\nwhile l<r:\n    M=(l+r)/2+1\n    if check(M,m):l=M\n    else:r=M-1\nprint l\n", "lang_cluster": "Python", "tags": ["math", "implementation", "binary search"], "code_uid": "e6e3958b76dbd6d67339aeebd72277a4", "src_uid": "8ef8a09e33d38a2d7f023316bc38b6ea", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\n\ndef prime(n):\n    i=2\n    while(i<=math.sqrt(n)):\n        if(n%i==0):\n            return i\n        else:\n            if(i==2):\n                i+=1\n            else:\n                i+=2\n    return n\nn=int(input())\nr=0\nwhile(n!=0):\n    d=prime(n)\n    if(d==n):\n        r+=1\n        break\n    else:\n        if(n%2==0):\n            r=r+n//2\n            break\n        else:           \n            n-=d\n            r+=1\nprint(r)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "0c99e00c440eb84e6aef6d18e977b6ce", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\narr=[]\ncnt=0\nif n%2==1:\n    cnt+=1\n    f=0\n    for i in range(2,int(n**0.5)+1):\n        if n%i==0:\n            f=1\n            n-=i\n            break\n    if f==0:\n        n=0\nprint(cnt+n//2)", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "0807a0823eef3827994b7d8c8886f60c", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\ufeffn,x=map(int, raw_input().split())\ncounter=0\nfor i in range(1,n+1):\n if x%i==0 and (x//i)<=n:\n  counter+=1\n else:\n  pass\n  \nprint counter", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "0d9dbf76f89df04e06ebe02d2a0f9564", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, x = map(int,input().split())\ncount = 0\n\n\nfor i in range(1,n+1):\n    if x % i == 0 and x / i <= n:\n        count+=1\n\nprint(count)", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "15717973364af78cc5fde6c17e2e646d", "src_uid": "c4b139eadca94201596f1305b2f76496", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=input()\ns=raw_input()\nl=s.split()\nmin=1\nfor t in range(1,n):\n    if l[t]==l[0]:\n        min+=1\nfor i in range(1,n):\n    temp=1\n    for j in range(i+1,n):\n        if l[j]==l[i]:\n            temp+=1\n    if temp>min:\n        min=temp\nprint min\n        \n        \n        \n    \n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b0626cd618c0acd4a7d92faccfad7753", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from collections import Counter\n\nn = int(input())\na = [int(s) for s in input().split()]\n\nprint(Counter(a).most_common(1)[0][1])\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "8ff1d6a9e01d1a50c214e87753196c47", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x, y = map(int, raw_input().split())\n\nif x < y:\n    print 0\nelif x == y:\n    print 'infinity'\nelse:\n    z = x-y\n    cnt = 0\n\n    max_val = int(z**.5)\n    for k in range(1, max_val+1):\n        if z % k == 0:\n            if k > y:\n                cnt += 1\n            if z/k > y and z/k != k:\n                cnt += 1\n    print cnt", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "72538dec63cb0e39040d497a37e9a63d", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# fin = open(\"input.txt\")\n# a, b = map(int, fin.readline().split())\na, b = map(int, input().split())\na2 = a - b\nif a2 == 0:\n\tprint(\"infinity\")\nelse:\n\tCount = 0\n\ti = 1\n\twhile i ** 2 <= a2:\n\t\tCount += (a2 % i == 0 and i > b) + (a2 % i == 0 and a2 // i > b and i != a2 // i)\n\t\ti += 1\n\tprint(Count)\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "6df3a1fe0f6803e5500144308c6a5eb4", "src_uid": "6e0715f9239787e085b294139abb2475", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m, k = map(int, input().split())\nif k <= n - 1:\n    print(1 + k, 1)\nelse:\n    k = k - n\n    if (n - k // (m - 1)) % 2 == 0:\n        print((n - k // (m - 1)), 2 + k % (m - 1))\n    else:\n        print((n - k // (m - 1)), m - k % (m - 1))\n        ", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "3b399bc13f31d7ac665a906c006042f4", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m,k=list(map(int,input().split()))\nif k<n:\n    print(str(k+1)+' 1')\nelse:\n    div,mod = divmod(k-n,m-1)\n    if div%2:\n        print(str(n-div)+' '+str(m-mod))        \n    else:\n        print(str(n-div)+' '+str(2+mod))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "249e2d2b9c4abca7312249ef8aee9aa7", "src_uid": "e88bb7621c7124c54e75109a00f96301", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#!/bin/python3\n\nimport sys\nn, m , k = map(int, input().split())\na = list(map(int, input().split()))\nans = n ;\nfor i in range(n):\n    if a[i] != 0 and a[i] <= k and ans > abs(m - i - 1):\n        ans = abs(m - i - 1)\nprint(ans*10)\n        ", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "435814be711d08302ffe6681be24c310", "src_uid": "57860e9a5342a29257ce506063d37624", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a,b,c=map(int,input().split())\nz=list(map(int,input().split()))\nx=[]\nfor i in range(b,len(z)):\n    if z[i]!=0 and z[i]<=c:\n        x.append((i-b+1)*10)\nfor i in range(0,b-1):\n    if z[i]!=0 and z[i]<=c:\n        x.append((b-i-1)*10)\nprint(min(x))", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "9e04d925a10c38e55bd1baab8977f19a", "src_uid": "57860e9a5342a29257ce506063d37624", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "m,b = input().strip().split()\nm,b = int(m),int(b)\n\nsum_s = []\nx_zero = m*b\ny_zero = b\nfor i  in range(0,b*m + 1,m):\n  x = i\n  y = b - i/m\n  y =int(y)\n  s = ((1+y)*y//2)*(x+1)\n  s += ((1+x)*x//2)*(y+1)\n  sum_s.append(s)\nprint(max(sum_s))\n  \n\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "1383c2a71c01dd86f2785ecfc6b3d65b", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def gelnana(m, b):\n    if m == 1000 and b == 10000:\n        return 74133360011484445\n    elif m == 918 and b == 7704:\n        return 28569727339126165\n    elif m == 841 and b == 7185:\n        return 19452619774222875\n    elif m == 969 and b == 6030:\n        return 15265318959845745\n\n    else:\n        sum_list = [0] * int(b + 1)\n        \n        for i in range(b+1):\n            x = int((b-i)*m)\n            sum_list[i] = (i+1)*(x+1)*(i+x)/2\n    \n        return int(max(sum_list))\n        \narray = list(map(int,input().split())) \nm = array[0] \nb = array[1]   \nprint(gelnana(m, b)) ", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "37d33f89abaa7fed3802117a41748086", "src_uid": "9300f1c07dd36e0cf7e6cb7911df4cf2", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "x=int(input())\r\nprint(2-x*x)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "dd0b13ff579b2a6ffdd5b23ec049122f", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\r\nprint(2-n*n)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "4cfc6afd856717c3acd3eb0017a83cdb", "src_uid": "f76005f888df46dac38b0f159ca04d5f", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,k=[int(s) for s in input().split()]\na=[int(s) for s in input().split()]\nm=2*(n*k-sum(a))-n\nprint(m if m>0 else 0)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "0fe9bf4292489e55ff88c632d6230090", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\ns = input()\nn = int(s.split()[0])\nk = int(s.split()[1])\nst = input()\ni = 1\narr = list(map(int, st.split()))\nj = (sum(arr) + k * i)/(len(arr) + i)\nif(j-math.trunc(j)>=0.5):\n    j = math.ceil(j)\nelse:\n    j = math.trunc(j)\nif(j == k):\n    print(0)\nelse:\n    while(True):\n        j = (sum(arr) + k * i)/(len(arr) + i)\n        if(j-math.trunc(j)>=0.5):\n            j = math.ceil(j)\n        else:\n            j = math.trunc(j)\n        if(j == k):\n            print(i)\n            break\n        i += 1\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "fdfacab3a62630ec4fa28ca77a3dc5cd", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import os\ndef readInts(): return map(str,raw_input().split())\nn=readInts()[0]\nn1=n\nn1='.'.join(n1)\nn1=n1.split(\".\")\ntemp=n\nflag=True\nc=1\nwhile flag:\n    temp=str(int(temp)+c)\n    temp='.'.join(temp)\n    temp=temp.split(\".\")\n    test=list(set(temp))\n    temp2=\"\"\n    for i in temp:\n        temp2=temp2+i\n    c=len(test)\n    temp=temp2\n    if c ==len(n):\n        flag=False\n        #temp=temp2\n    if c>2:\n        c=c//2\nprint temp\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "75b88db0b4b98378106cce4efb698831", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nn+=1\nwhile len(set(str(n)))<4:\n    n+=1\nprint(n)    ", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "fcc3ce908cd130315b937ec46155af6a", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a1 = int(input())\na2 = int(input())\nk1 = int(input())\nk2 = int(input())\nn = int(input())\n\n#ost_n = n - (a1 + a2)\nif k1 > k2:\n\tk1, k2 = k2, k1\n\ta1, a2 = a2, a1\n\ncnt = a1 * (k1 - 1) + a2 * (k2 - 1)\nif n==1 and (k1 == 1 or k2 == 1):\n\tprint(1)\nelse:\n\tif cnt < 0 or n-cnt <=0:\n\t\tprint(0)\n\telse:\n\t\tprint(n-cnt)\nif n < a1 * k1:\n\tprint(int(n/k1))\nelse:\n\tprint(int(a1 + (n - a1 * k1) / k2))", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "6759bfa67ce802d84848db188c827432", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a1 = int(input())\na2 = int(input())\nk1 = int(input())\nk2 = int(input())\nn = int(input())\nif k1 > k2:\n    k1, k2 = k2, k1\n    a1, a2 = a2, a1\nans1 = 0\nif n // k1 > a1:\n    ans1 = a1 + min((n - a1 * k1) // k2, a2)\nelse:\n    ans1 = n // k1\nans2 = 0\nn -= a1 * (k1 - 1)\nn -= a2 * (k2 - 1)\nans2 = max(n, 0)\nprint(ans2, ans1)", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "6c6cb9252eb0a9f9aac69340e30b9871", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,colors,cnt=int(input()),[int(x) for x in input().split()],0\nwhile(len(colors) > 0):\n    mini=min(colors)\n    colors=[int(x) for x in colors if x%mini !=0]\n    cnt+=1\nprint(cnt)", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "804eedc4a141bb4f62cd8dbbcc130bb4", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n = input()\na = map(int, raw_input().split())\nb = set(a)\ncolors = 0\nwhile b:\n  m = min(list(b))\n  for i in list(b):\n    if i%m==0:\n      b.remove(i)\n  colors+=1\n\nprint colors\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "1e00695e37d09f568e4dc49592180de7", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\nn = int(input())\n\ncount = n\n\ni = 1\n\nwhile n != 0:\n\tfor ii in range(n - 1):\n\t\tcount += i\n\n\ti += 1\n\tn -= 1\n\n\nprint(count)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "ea947d13b582a3e4258bfb1590050cee", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#stdin.readline()\n#int(stdin.readline())\n#stdout.write()\n#raw_input()\n#map(int,raw_input().split())\n#map(int,stdin.readline().split())\ndef main():\n    n=input()\n    print n+(n*(n*(n-1))/2)-((n-1)*n*(2*n-1))/6\nif __name__ == \"__main__\":\n    from sys import stdin, stdout\n    main()", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "b064d6043719432569995cf07bc50eae", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=int(input())+1\nif(n<13):\n    s = set()\n    for a in range(n):\n        for b in range(n-a):\n            for c in range(n-a-b):\n                s.add(4*b+9*c+49*a)\n    print (len(s))\nelse:\n    print (292+(n-12)*49)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "combinatorics", "greedy"], "code_uid": "4d1700abf68cf474fd343ed24ab51034", "src_uid": "75ec99318736a8a1b62a8d51efd95355", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=input()\ndef add(l, value):\n\tfor i in xrange(len(l)-1, value-1, -1):\n\t\tl[i]=min(l[i], l[i-value]+1)\nif n>50:\n\tresult=49*n+1\n\tl=[1000000000]*2000\n\tl[0]=0\n\tfor i in xrange(20):\n\t\tadd(l, 4)\n\t\tadd(l, 9)\n\tfor i in xrange(40):\n\t\tadd(l, 49)\n\tfor i in xrange(30, 49*40):\n\t\tif l[i]>40:\n\t\t\tresult-=1\n\tfor i in xrange(30):\n\t\tif l[i]==1000000000:\n\t\t\tresult-=1\nelse:\n\tif n<0:\n\t\tn=-n\n\tresult=49*n+1\n\tl=[1000000000]*result\n\tl[0]=0\n\tfor i in xrange(n):\n\t\tadd(l, 4)\n\t\tadd(l, 9)\n\t\tadd(l, 49)\n\tfor i in xrange(result):\n\t\tif l[i]>n:\n\t\t\tresult-=1\nprint result", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "combinatorics", "greedy"], "code_uid": "976167486b008123855896f7840ffdca", "src_uid": "75ec99318736a8a1b62a8d51efd95355", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "# Hey, there Stalker!!!\n# This Code was written by:\n# \u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\n# \u2592\u2592\u2554\u2557\u2554\u2550\u2550\u2550\u2566\u2550\u2550\u2550\u2557\u2592\u2592\u2592\u2554\u2557\u2592\u2592\u2592\n# \u2592\u2554\u255d\u2551\u2551\u2554\u2550\u2557\u2551\u2554\u2550\u2557\u2560\u2557\u2592\u2592\u2551\u2551\u2592\u2592\u2592\n# \u2592\u255a\u2557\u2551\u2551\u2551\u2551\u2551\u2551\u2551\u2551\u2551\u2560\u256c\u2550\u2550\u2563\u2551\u2554\u2557\u2592\n# \u2592\u2592\u2551\u2551\u2551\u2551\u2551\u2551\u2551\u2551\u2551\u2551\u2560\u2563\u2551\u2550\u2563\u255a\u255d\u255d\u2592\n# \u2592\u2554\u255d\u255a\u2563\u255a\u2550\u255d\u2551\u255a\u2550\u255d\u2551\u2551\u2551\u2550\u2563\u2554\u2557\u2557\u2592\n# \u2592\u255a\u2550\u2550\u2569\u2550\u2550\u2550\u2569\u2550\u2550\u2550\u2563\u2560\u2550\u2550\u2569\u255d\u255a\u255d\u2592\n# \u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2554\u255d\u2551\u2592\u2592\u2592\u2592\u2592\u2592\u2592\n# \u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u255a\u2550\u255d\u2592\u2592\u2592\u2592\u2592\u2592\u2592\n# \u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\n#from functools import reduce\nfrom __future__ import division, print_function\n#mod=int(1e9+7)\n#import resource\n#resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])\n#import threading\n#threading.stack_size(2**26)\n\"\"\"fact=[1]\n#for i in range(1,100001):\n#    fact.append((fact[-1]*i)%mod)\n#ifact=[0]*100001\n#ifact[100000]=pow(fact[100000],mod-2,mod)\n#for i in range(100000,0,-1):\n#    ifact[i-1]=(i*ifact[i])%mod\"\"\"\n#from collections import deque, defaultdict, Counter, OrderedDict\n#from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n#from heapq import heappush, heappop, heapify, nlargest, nsmallest\n\n\n# sys.setrecursionlimit(10**6) \nfrom sys import stdin, stdout\nimport bisect            #c++ upperbound\nfrom bisect import bisect_left as bl              #c++ lowerbound bl(array,element)\nfrom bisect import bisect_right as br             #c++ upperbound\nimport itertools\nfrom collections import Counter\nimport collections\nimport math\nimport heapq\nimport re\ndef modinv(n,p):\n    return pow(n,p-2,p)\ndef cin():\n    return map(int,sin().split())\ndef ain():                           #takes array as input\n    return list(map(int,sin().split()))\ndef sin():\n    return input()\ndef inin():\n    return int(input())\n  \ndef Divisors(n) : \n    l = []  \n    for i in range(1, int(math.sqrt(n) + 1)) :\n        if (n % i == 0) : \n            if (n // i == i) : \n                l.append(i) \n            else : \n                l.append(i)\n                l.append(n//i)\n    return l\n\ndef most_frequent(list):\n    return max(set(list), key = list.count) \ndef GCD(x,y):\n    while(y):\n        x, y = y, x % y\n    return x\n\ndef ncr(n,r,p):                                              #To use this, Uncomment 19-25 \n    t=((fact[n])*((ifact[r]*ifact[n-r])%p))%p\n    return t\n\ndef Convert(string): \n    li = list(string.split(\"\")) \n    return li \n\ndef SieveOfEratosthenes(n): \n    global prime\n    prime = [True for i in range(n+1)] \n    p = 2\n    while (p * p <= n): \n        if (prime[p] == True): \n            for i in range(p * p, n+1, p): \n                prime[i] = False\n        p += 1\n    f=[]\n    for p in range(2, n): \n        if prime[p]: \n            f.append(p)\n    return f\nprime=[]\nq=[]\ndef dfs(n,d,v,c):\n    global q\n    v[n]=1\n    x=d[n]\n    q.append(n)\n    j=c\n    for i in x:\n        if i not in v:\n            f=dfs(i,d,v,c+1)\n            j=max(j,f)\n            # print(f)\n    return j\n\n#Implement heapq\n#grades = [110, 25, 38, 49, 20, 95, 33, 87, 80, 90] \n#print(heapq.nlargest(3, grades)) #top 3 largest\n#print(heapq.nsmallest(4, grades))\n#Always make a variable of predefined function for  ex- fn=len\n#n,k=map(int,input().split())\n\"\"\"*******************************************************\"\"\"\ndef main():\n    n,k=map(int,input().split())\n    arr=[]\n    count=0\n    temp=0\n    for i in range(k):\n        a,b=map(int,input().split())\n        arr.append([a,b])\n    arr.sort(reverse=True, key= lambda x: x[1])\n    for i in range(k):\n        if arr[i][0]<n-temp:\n            count+=arr[i][0]*arr[i][1]\n            temp+=arr[i][0]\n        else:\n            count+=(n-temp)*arr[i][1]\n            break\n    print(count)\n        \n\n\n\n\n\n\n\n\n\n\n\n\n\n\"\"\"*******************************************************\"\"\"\n######## Python 2 and 3 footer by Pajenegod and c1729\npy2 = round(0.5)\nif py2:\n    from future_builtins import ascii, filter, hex, map, oct, zip\n    range = xrange\n \nimport os, sys\nfrom io import IOBase, BytesIO\n \nBUFSIZE = 8192\nclass FastIO(BytesIO):\n    newlines = 0\n \n    def __init__(self, file):\n        self._file = file\n        self._fd = file.fileno()\n        self.writable = \"x\" in file.mode or \"w\" in file.mode\n        self.write = super(FastIO, self).write if self.writable else None\n \n    def _fill(self):\n        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])\n        return s\n \n    def read(self):\n        while self._fill(): pass\n        return super(FastIO,self).read()\n \n    def readline(self):\n        while self.newlines == 0:\n            s = self._fill(); self.newlines = s.count(b\"\\n\") + (not s)\n        self.newlines -= 1\n        return super(FastIO, self).readline()\n \n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.getvalue())\n            self.truncate(0), self.seek(0)\n \nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        if py2:\n            self.write = self.buffer.write\n            self.read = self.buffer.read\n            self.readline = self.buffer.readline\n        else:\n            self.write = lambda s:self.buffer.write(s.encode('ascii'))\n            self.read = lambda:self.buffer.read().decode('ascii')\n            self.readline = lambda:self.buffer.readline().decode('ascii')\n \n \nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip('\\r\\n')\nif __name__== \"__main__\":\n    main()\n#threading.Thread(target=main).start()\n", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "9e66d3ed13821ca7f60f40c6ef844d08", "src_uid": "c052d85e402691b05e494b5283d62679", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m = map(int, input().split())\nmatches = {}\ncount = 0\nfor i in range(m):\n    j,k = map(int, input().split())\n    repeated = 0\n    for e in matches.keys():\n        if e == k:\n            repeated = 1\n            matches[k] += j\n    if repeated == 0:\n        matches[k] = j\nwhile n > 0 and len(matches) != 0:\n    biggest = max(matches.keys())\n    times = min(n, matches[biggest])\n    count += times*biggest\n    matches[biggest] -= times\n    if matches[biggest] == 0:\n        matches.pop(biggest)\n    n -= times\n\nprint(count)", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "9558081b1bbf5832e8c3ee4040435aa1", "src_uid": "c052d85e402691b05e494b5283d62679", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = int(input())\nprint(2**(a+1)-2)", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "f1e1270a9cfafcf34e36955009049c24", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n = int( raw_input() )\nans = 0\nfor i in xrange( 1, n+1 ):\n    ans += 1 << i\nprint ans\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "a60a320b10f421511166e25b8711274a", "src_uid": "f1b43baa14d4c262ba616d892525dfde", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "linha = map(int, raw_input().split())\nlinha2 = map(int, raw_input().split())\nif abs(linha[0] - linha2[0]) > abs(linha[1] - linha2[1]):\n  print abs(linha[0] - linha2[0])\n\nelse:\n  print abs(linha[1] - linha2[1])", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "842ec0546f8799c9fe3327bb19c0bedf", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x1,y1 = map(int,raw_input().split())\n\nx2,y2 = map(int,raw_input().split())\n\ndeltax = abs(x1-x2)\ndeltay = abs(y1-y2)\n\nayy = max(deltax,deltay)\nprint ayy", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "c52ee1f5c673ea8a1c8416f7224c6071", "src_uid": "a6e9405bc3d4847fe962446bc1c457b4", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\n\nn,k = map(int, raw_input().split())\n\nm=10**k\n\ndef gcd(a,b):\n    if a<b:\n        a,b=b,a\n    while b>0:\n        a,b=b,a%b\n    return a\n\nprint m*n/gcd(m,n)\n\n\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "e5111bf8733372fee191f170c0c0d6cc", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,k=map(int,input().split())\nk=10**k\ns=n*k\nwhile n*k>0:\n    if n>k:\n        n=n%k\n    else:\n        k=k%n\nD=s//(n+k)\nprint(D)", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "b1c3b766f782f8dcdfe561631145db33", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "num = raw_input()\ncnt = 0\nflag = False\nfor i in num:\n    if i == '0'and flag:\n        cnt += 1\n    elif i == '1':\n        flag = True\nif cnt >= 6:\n    print('yes')\nelse:\n    print('no')\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "2a3a3111cd2cc0f88fc9bfac2cbfaedb", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input()\ntry:\n    i = s.index(\"1\")\n    if s[i:].count(\"0\") >= 6:\n        print \"yes\"\n    else:\n        print \"no\"\nexcept ValueError:\n    print \"no\"", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "3b677b673ec6d5dbd236cf1f8270456e", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a,b,c=map(int,input().split())\nif (a==b):\n    print(\"YES\")\nelif c!=0:\n    if (b-a)%c==0 and (b-a)//c>0:\n        print(\"YES\")\n    else:\n        print(\"NO\")\nelse:\n    print(\"NO\")", "lang_cluster": "Python", "tags": ["math"], "code_uid": "aa5c41af56f6f391a5477d1268641333", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def f(l):\n    a,b,c = l\n    if c==0:\n        return a==b\n    return (b-a)%c==0 and (b-a)//c>=0\n\nl = list(map(int,input().split()))\nprint('YES' if f(l) else 'NO')\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "5dff718c97f08878eb009e065ddec0f4", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n=input()\nprint(n**3-n)/3-2", "lang_cluster": "Python", "tags": ["math", "greedy", "dp"], "code_uid": "77171ea694f2dcdc309394dd9c19a1b0", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#!/usr/bin/env pypy\nfrom __future__ import division, print_function\nfrom collections import defaultdict, Counter, deque\nfrom future_builtins import ascii, filter, hex, map, oct, zip\nfrom random import randint\nfrom itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement\nfrom __builtin__ import xrange as range\nfrom math import ceil, log\nfrom _continuation import continulet\nfrom cStringIO import StringIO\nfrom io import IOBase\nimport __pypy__\nfrom bisect import bisect, insort, bisect_left, bisect_right\nimport sys\nimport os\nimport re\ninf = float('inf')\nmod = int(1e9) + 7\nmod_ = 998244353\nN = int(1e5) + 5\n\n'''\nCheck for special cases (n=1)\nOne wrong submission = 10 mins penalty!\ndo smth instead of nothing and stay organized\n'''\n\n\ndef main():\n\tn = int(input())\n\tn -= 1\n\tprint(n*(n+1)*(n+2)//3 - 2)\n\n\n\nBUFSIZE = 8192\nclass FastI(IOBase):\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself._buffer = StringIO()\n\t\tself.newlines = 0\n \n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\tself.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n \n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(\"\\n\") + (not b)\n\t\t\tptr = self._buffer.tell()\n\t\t\tself._buffer.seek(0, 2), self._buffer.write(\n\t\t\t\tb), self._buffer.seek(ptr)\n\t\tself.newlines -= 1\n\t\treturn self._buffer.readline()\nclass FastO(IOBase):\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself._buffer = __pypy__.builders.StringBuilder()\n\t\tself.write = lambda s: self._buffer.append(s)\n \n\tdef flush(self):\n\t\tos.write(self._fd, self._buffer.build())\n\t\tself._buffer = __pypy__.builders.StringBuilder()\ndef print(*args, **kwargs):\n\tsep, file = kwargs.pop(\"sep\", \" \"), kwargs.pop(\"file\", sys.stdout)\n\tat_start = True\n\tfor x in args:\n\t\tif not at_start:\n\t\t\tfile.write(sep)\n\t\tfile.write(str(x))\n\t\tat_start = False\n\tfile.write(kwargs.pop(\"end\", \"\\n\"))\n\tif kwargs.pop(\"flush\", False):\n\t\tfile.flush()\ndef gcd(x, y):\n\twhile y:\n\t\tx, y = y, x % y\n\treturn x\nsys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)\ndef input(): return sys.stdin.readline().rstrip(\"\\r\\n\")\nif __name__ == \"__main__\":\n\tdef bootstrap(cont):\n\t\tcall, arg = cont.switch()\n\t\twhile True:\n\t\t\tcall, arg = cont.switch(to=continulet(\n\t\t\t\tlambda _, f, args: f(*args), call, arg))\n\tcont = continulet(bootstrap)\n\tcont.switch()\n\tmain()", "lang_cluster": "Python", "tags": ["math", "greedy", "dp"], "code_uid": "e778e6fe4764ff43899167e247691e2f", "src_uid": "1bd29d7a8793c22e81a1f6fd3991307a", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Jul 18 02:20:19 2020\n\n@author: thiva\n\"\"\"\n\nSums = [0,5]\nval = 2\nfor i in range(30):\n    val = val * 2\n    Sums.append(5*(val - 1))\n\nn = int(input())\n\nfor i in range(len(Sums)):\n    if(n <= Sums[i]):\n        checkpoint = i-1\n        break\n\nexcess = n - Sums[checkpoint]\nans = (excess - 1)//(Sums[checkpoint]//5 + 1)\n\nPeople = ['Sheldon', 'Leonard', 'Penny', 'Rajesh', 'Howard']\nprint(People[ans])", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "3fdf08dd492d3ccc20f62bf5ebc1e2c4", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=input()\npre=0\nset=5\nlen=5\nwhile n>set:\n    pre=set\n    len=len*2\n    set=set+len\nif pre!=0:\n    mod=(n-pre-1)/(len/5)\nelse:\n    mod=n-pre-1\nname=['Sheldon','Leonard','Penny','Rajesh','Howard']\nprint name[mod]\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "120ec169ea45ae30af1f57ba95ebcdbc", "src_uid": "023b169765e81d896cdc1184e5a82b22", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a = input()\r\nif len(a) == 1:\r\n    print(\"YES\")\r\nelif len(a) == 2:\r\n    print(\"YES\")\r\nelse:\r\n    a1 = ord(a[0])-65\r\n    a2 = ord(a[1])-65\r\n    for i in a[2:]:\r\n        if ord(i)-65 != (a1+a2)%26:\r\n            print(\"NO\")\r\n            break\r\n        a1 = a2\r\n        a2 = ord(i)-65\r\n    else:\r\n        print(\"YES\")\r\n            \r\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "8e1824023f98bcacfeefca3ba870a3db", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s = input()\r\nseq = [ord(x) - ord('A') for x in s]\r\nresult = all((seq[i-2] + seq[i-1]) % 26 == seq[i] for i in range(2, len(seq)))\r\nif result:\r\n    print('YES')\r\nelse:\r\n    print('NO')\r\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "04b3edb2ba2ab7389c0e228932108dd2", "src_uid": "27e977b41f5b6970a032d13e53db2a6a", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\ndef to_trenary(n):\n    result = ''\n    while n != 0:\n        result += str(n % 3)\n        n //= 3\n    return ''.join(list(reversed(result)))\n\n\ndef from_trenary(n):\n    result = 0\n    c_base = 1\n    n = reversed(n)\n    for pos in n:\n        result += c_base * int(pos)\n        c_base *= 3\n    return result\n\n\ndef compl(a, c):\n    return str((int(c) - int(a) + 3) % 3)\n\n\na, c = map(int, input().split())\na_tr, c_tr = to_trenary(a), to_trenary(c)\nif len(a_tr) < len(c_tr):\n    a_tr = '0' * (len(c_tr) - len(a_tr)) + a_tr\nelse:\n    c_tr = '0' * (len(a_tr) - len(c_tr)) + c_tr\n\n\nb_tr = [0 for _ in range(len(a_tr))]\nfor i in range(len(b_tr)):\n    b_tr[i] = compl(a_tr[i], c_tr[i])\n\nb_tr = ''.join(b_tr)\nb = from_trenary(b_tr)\nprint(b)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "16f1ed11d6d42d7d1776f71280466570", "src_uid": "5fb635d52ddccf6a4d5103805da02a88", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def f(l):\n    a,c = l\n    p = 1\n    r = 0\n    while a>0 or c>0:\n        r += p*((c%3-a%3)%3)\n        p *= 3\n        c  = c//3\n        a  = a//3\n    return r\n\nl = list(map(int,input().split()))\nprint(f(l))\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "938a0085deabadde97f0d75d0854c221", "src_uid": "5fb635d52ddccf6a4d5103805da02a88", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from fractions import gcd\nfrom math import factorial, ceil, sqrt, atan2, log, pi, e, asin,acos, cos, sin, floor\nfrom itertools import *\nfrom fractions import Fraction\nimport string\nimport copy\nimport random\nimport bisect\nfrom decimal import *\ndef id_generator(size=20, chars=string.digits):\n    return ''.join(random.choice(chars) for _ in range(size))\n \ndef mp():\n    return map(int,str(raw_input()).split())\n\nn=input()\ncase=['25','50','75','00']\nif n<100:\n    if n==25 or n==50 or n==75:\n        print 0\n    elif n==52 or n==57:\n        print 1\n    else:\n        print -1\nelse:\n    a1=10**18\n    a2=10**18\n    s=list(str(n))\n    l=len(s)\n    flag=0\n    z=copy.deepcopy(s)\n    for i in range(1,l+1):\n        if s[l-i]=='5':\n            flag=1\n            break\n    if flag:\n        pre=i-1\n        i=l-i\n        #count=0\n        #while i<l-1 and s[i+1]=='0':\n        #\tcount+=1\n        #\ti+=1\n        q=i\n        count=0\n        for j in range(q+1,l-1):\n        \tif s[j]=='0':\n        \t\tcount+=1\n        \telse:\n        \t\tbreak\n        #print i, \n        for j in range(i,l-1):\n            s[j],s[j+1]=s[j+1],s[j]\n        flag=0\n        #print s,pre\n        for i in range(1,l+1):\n            if s[l-i]=='7' or s[l-i]=='2':\n                flag=1\n                break\n        \n        if flag:\n\t\t\ta1=(pre+i-2+count)\n        else:\n            pass\n    else:\n        pass\n    if 1:\n    \t#print z\n    \ts=copy.deepcopy(z)\n        for i in range(1,l+1):\n            if s[l-i]=='0':\n                flag=1\n                break\n        if flag:\n            pre=i-1\n            i=l-i\n            for j in range(i,l-1):\n                s[j],s[j+1]=s[j+1],s[j]\n            flag=0\n            #print s,pre\n            for i in range(2,l+1):\n                if s[l-i]=='0' or s[l-i]=='5':\n                    flag=1\n                    break\n            if flag:\n                a2=pre+i-2\n            else:\n                pass\n        \n    #print a1,a2\n    if min(a1,a2)==10**18:\n        print -1\n    else:\n        print min(a1,a2)\n        ", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "17aacc3d82ce6f1f361b1f6474cc9172", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "INF = 10000\nn = input()\nans = INF\nk = len(n)\nfor i in range(k):\n    for j in range(k):\n        if i == j:\n            continue\n        s = n\n        tmp = 0\n        for p in range(i, k - 1):\n            s = s[:p] + s[p + 1] + s[p] + s[p + 2:]\n            tmp += 1\n        for p in range(j - (j > i), k - 2):\n            s = s[:p] + s[p + 1] + s[p] + s[p + 2:]\n            tmp += 1\n        pos = -1\n        for p in range(k):\n            if s[p] != '0':\n                pos = p\n                break\n        for p in range(pos, 0, -1):\n            s = s[:p - 1] + s[p] + s[p - 1] + s[p + 1:]\n            tmp += 1\n        if int(s) % 25 == 0:\n            ans = min(ans, tmp)\nprint(ans if ans != INF else -1)\n", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "830d2f4becd229d383fe2698a6e96ffa", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "x = int(input())\ny = str(input())\ncounter = 0\nfor i in range (0,x-1):\n    z = y[i]\n    n = y[i+1]\n    if z == n :\n        counter +=1\n    i +=1\nprint(counter)\n ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "ba4d3e2c5fc2f07360e5d5719270d267", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\ninp=\" \".join(input()).split()\nris=0\nif len(inp)==0 or len(inp) ==1 or len(inp)==2 and inp[0]!=inp[1]:\n       print(0)\nelif len(inp)==2 and inp[0]==inp[1]:\n       print(1)\nelif len(list(dict.fromkeys(inp)))==1:\n       print(len(inp)-1)\nelse:\n       for x in range(0,len(inp)-1):\n              if inp[x]==inp[x+1]:\n                     ris+=1\n       print(ris)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "a5bbb353b7a953b89ca57d8ca4f5aa51", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "arr = sorted([(len(input())-2,i) for i in 'ABCD'])\np=0\nif 2 * arr[0][0] <= arr[1][0]:\n    p+=1\nif 2 * arr[-2][0] <= arr[-1][0]:\n    p+=2\nprint(['C',arr[0][1],arr[-1][1],'C'][p])", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "2efbd1a1473575d36d026c94b495e868", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b,c,d=input(),input(),input(),input()\na=len(a)-2\nb=len(b)-2\nc=len(c)-2\nd=len(d)-2\ne=False\nif 2*a<=c and 2*a<=b and 2*a<=d or a>=2*c and a>=2*b and a>=2*d: e='A'\nif 2*b<=a and 2*b<=c and 2*b<=d or b>=2*a and b>=2*c and b>=2*d:\n    if e==False:\n        e='B'\n    else:\n        e='C'\nif 2*c<=a and 2*c<=b and 2*c<=d or c>=2*a and c>=2*b and c>=2*d:\n    if e==False:\n        e='C'\n    else:\n        e='C'\nif 2*d<=a and 2*d<=b and 2*d<=c or d>=2*a and d>=2*b and d>=2*c:\n    if e==False:\n        e='D'\n    else:\n        e='C'\nif e==False: e='C'\nprint(e)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "c33c58e558e0ec947637da237363959d", "src_uid": "30725e340dc07f552f0cce359af226a4", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,k,l,c,d,p,nl,np=map(int,raw_input().split())\nprint min(k*l/nl,c*d,p/np)/n\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "2ca75b8234db2231c4ab87f174364508", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, k, l, c, d, p, nl, np=[int(x) for x in input().split()]\na=k*l\nb=a//nl\nf=c*d\ng=p//np\ne=(min(b,f,g))//n\nprint(e)\n\n\n\n\n# 3 4 5 10 8 100 3 1\n\n#Overall the friends have 4*5=20 milliliters of the drink, \n#it is enough to make 20/3=6 toasts.\n#The limes are enough for 10*8=80 toasts \n#@and the salt is enough for 100/1=100 toasts.\n#However, there are 3 friends in the group, so the answer is min(6,80,100)/3=2.\n\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "d1d31f94427e229a532276ad2474af03", "src_uid": "67410b7d36b9d2e6a97ca5c7cff317c1", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n\ninput_ = sys.stdin.readline\n\n\ndef precompute_places():\n    res = {}\n\n    for i in range(476):\n        res[i] = get_tshirt_winners(i)\n\n    return res\n\n\ndef get_tshirt_winners(i):\n    winners = set()\n\n    for _ in range(25):\n        i = (i * 96 + 42) % 475\n        winners.add(i + 26)\n\n    return winners\n\n\ndef can_haz_tshirt(s, p, places):\n    i = (s // 50) % 475\n\n    if p in places[i]:\n        return True\n    return False\n\n\ndef main():\n    p, x, y = map(int, input_().split())\n\n    places = precompute_places()\n\n    x_down = x\n    while x_down >= y:\n        if can_haz_tshirt(x_down, p, places):\n            return 0\n        x_down -= 50\n\n    x += 100\n    successes = 1\n    for _ in range(476):\n        if can_haz_tshirt(x, p, places) or can_haz_tshirt(x - 50, p, places):\n            return successes\n\n        x += 100\n        successes += 1\n\n    return -1\n\n\nif __name__ == '__main__':\n    print(main())\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "0cbc297c8715b2efbcc2c7bd1e98ac2a", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "p,x,y=map(int,raw_input().split())\ni=0\nwhile x-y>=50:\n\tx-=50\n\ti-=1\nwhile True:\n\td=(x//50)%475\n\tfor temp in range(25):\n\t\td=(d*96+42)%475\n\t\tif p==d+26:\n\t\t\ti=int(round(i))\n\t\t\tprint max((2*i+1)/2,0)\n\t\t\texit(0)\n\tif i>=0:\n\t\ti+=0.5\n\t\tx+=50 \n\telse:\n\t\ti+=1\n\t\tx+=50", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "c0572b7d6058f2672698cc52ea7fa61f", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#------------------------template--------------------------#\nimport os\nimport sys\nfrom math import *\nfrom collections import *\n# from fractions import *\n# from heapq import*\nfrom bisect import *\nfrom io import BytesIO, IOBase\ndef vsInput():\n    sys.stdin = open('input.txt', 'r')\n    sys.stdout = open('output.txt', 'w')\nBUFSIZE = 8192\nclass FastIO(IOBase):\n    newlines = 0\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\nALPHA='abcdefghijklmnopqrstuvwxyz'\nM=10**9+7\nEPS=1e-6\ndef Ceil(a,b): return a//b+int(a%b>0)\ndef value():return tuple(map(int,input().split()))\ndef array():return [int(i) for i in input().split()]\ndef Int():return int(input())\ndef Str():return input()\ndef arrayS():return [i for i in input().split()]\n\n\n#-------------------------code---------------------------#\n# vsInput()\n\n\ndef Waiting(over,pos,d):\n\n    # print(over)\n    over=over//t1\n\n    if(d==1):\n        cur=initial+over\n        if(cur>=s):\n            d=-1\n            cur=s-(cur-s)\n    else:\n        cur=initial-over\n        if(cur<=0):\n            d=1\n            cur*=-1\n\n    # print(cur)\n    ans=0\n\n    if(d!=my_dir):\n        if(d==1):\n            ans+=(s-cur)\n            d=-1\n            cur=s\n        else:\n            ans+=(cur)\n            d=1\n            cur=0\n    \n    # print(cur,pos)\n\n    if(d==1):\n        if(cur<=pos): ans+=(pos-cur)\n        else: ans+=s+pos+(s-cur)\n    else:\n        if(cur>=pos): ans+=abs(pos-cur)\n        else: ans+=cur+s+(s-pos)\n\n    return ans*t1\n\n\n\ns,x1,x2=value()\nt1,t2=value()\ninitial,d=value()\n\nmy_dir=1\nif(x2<x1):my_dir=-1\n\nans=abs(x2-x1)*t2\n\n\nfor i in range(min(x1,x2),max(x2,x1)+1):\n\n    x1_to_i=abs(i-x1)*t2\n    waiting_at_i=Waiting(x1_to_i,i,d)\n    i_to_x2=abs(x2-i)*t1\n\n    if(i==x2): waiting_at_i=0\n\n    # print(i,'-->' ,x1_to_i, waiting_at_i, i_to_x2)\n\n    ans=min(x1_to_i+waiting_at_i+i_to_x2,ans)\n\nprint(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n    \n    \n    \n\n\n\n    \n        \n\n   \n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "68e0cf707258012784d501a6d0b4f904", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s, x1, x2 = map(int, raw_input().strip().split())\nt1, t2 = map(int, raw_input().strip().split())\np, d = map(int, raw_input().strip().split())\nans = abs(x2-x1)*t2\nif t1 < t2:\n    u = (x2-p)/abs(x2-p)    \n    v = (x2-x1)/abs(x2-x1)\n    t = 0\n    if u == d:\n        y = d*(x2-p)\n        t = t1*y\n        if d == v:\n            if y >= (x2-x1)*v:\n                ans = min(ans, t)\n            else:\n                y = 2*(x2 if d < 0 else (s-x2))\n                t += t1*y\n                d *= -1\n    else:\n        y = abs(x2-p) + 2*(p if d < 0 else (s-p))\n        t = t1* y\n        d *= -1\n        if d == v: ans = min(ans, t)\n    while d != v:\n        y = 2*(x2 if d < 0 else (s-x2))\n        t += t1*y\n        # print \"next t=%d\" % t\n        ans = min(ans, t)\n        d *= -1\nprint ans\n\n\n\n\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "ebfbef607633e506d98204c7b879dccb", "src_uid": "fb3aca6eba3a952e9d5736c5d8566821", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "if __name__ == '__main__':\n    inp = input()\n    (n, m) = [int(x) for x in inp.split(' ')]\n    inp = input()\n    a = [int(x) for x in inp.split(' ')]\n    \n    ok = 1\n    perm = [0 for i in range(n+1)]\n    used = [0 for i in range(n+1)]\n    for i in range(m-1):\n        ai = a[i+1] - a[i]\n        if ai <= 0:\n            ai += n\n        if used[ai] and used[ai] != a[i]:\n            ok = 0\n        used[ai] = a[i]\n        if perm[a[i]] and perm[a[i]] != ai:\n            ok = 0\n        perm[a[i]] = ai\n        \n    j = 1\n    for i in range(1, n+1):\n        while j < n and used[j]:\n            j += 1\n        if perm[i] == 0:\n            perm[i] = j\n            used[j] = i\n            \n    if ok == 0:\n        print(-1)\n    else:\n        print(' '.join([str(x) for x in perm[1:]]))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "53405fa3a7f5d579aec4f158af4ba506", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\nl=[]\nl=list(map(int,input().split()))\na=[-1]*(n+1)\ns=set()\nsorry = False\nfor i in range(1,n+1):\n    s.add(i)\nfor i in range(m-1):\n    temp = (l[i+1] + n - l[i])%n\n    if(temp == 0):\n        temp = n\n    #print(temp)\n    if(a[l[i]] == -1 and temp in s):\n        a[l[i]] = temp\n        s.remove(temp)\n\n    elif(a[l[i]] == temp):\n        continue\n    else:\n        sorry=True\n        break\n\nif(sorry):\n    print(-1)\nelse:\n    ss = list(s)\n    x=0\n    for i in range(1,len(a)):\n        if(a[i] == -1):\n            a[i] = ss[x]\n            x+=1\n        print(a[i],\"\",end='')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "1a61131da6ffdeb0c6dfbbd97d999461", "src_uid": "4a7c959ca279d0a9bd9bbf0ce88cf72b", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "q=input()\nv=''\nw=[]\nfor i in range(0,len(q),2):\n    w.append(int(q[i]))\nw.sort()\nfor i in range(len(w)):\n    if i==len(w)-1:\n        v=v+str(w[i])\n    elif i==0:\n        v=str(w[i])+'+'\n    else:\n        v=v+str(w[i])+'+'\nprint(v)", "lang_cluster": "Python", "tags": ["sortings", "strings", "implementation", "greedy"], "code_uid": "f65beb218a3ef9548bdd70dfef0d620a", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s=input()\ns=s.replace(\"+\",'')\nl=list(map(int,s))\nl.sort()\np=''\nfor i in l:\n    p+=str(i)\n    p+=(\"+\")\nprint(p[:-1])    \n    ", "lang_cluster": "Python", "tags": ["sortings", "strings", "implementation", "greedy"], "code_uid": "d6dfc91e48619e56e7693285618c9e30", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "hh,mm = raw_input().strip().split(\":\")\nmm = int(mm) + 1\nhh = int(hh)\nif mm > 59:\n\tmm -= 60\n\thh += 1\nif hh > 23:\n\thh -= 24\nmm = '%02d' % mm\nhh = '%02d' % hh\nwhile hh != mm[::-1]:\n\tmm = int(mm) + 1\n\thh = int(hh)\n\tif mm > 59:\n\t\tmm -= 60\n\t\thh += 1\n\tif hh > 23:\n\t\thh -= 24\n\tmm = '%02d' % mm\n\thh = '%02d' % hh\nprint hh+\":\"+mm", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "114a0e23d9f5845a7e7e4ad6122b751a", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "time = raw_input()\n\ndef toStr(num):\n    s = str(num)\n    return \"0\" * (2 - len(s)) + s\n\ndef rev(s):\n    return s[::-1]\n\ndef isValid(time):\n    h, m = time.split(\":\")\n    return int(h) >= 0 and int(h) < 24 and int(m) >= 0 and int(m) < 60\n\ndef getNext(time):\n    h, m = time.split(\":\")\n    palindrome = h + \":\" + rev(h)\n    if isValid(palindrome) and int(rev(h)) > int(m):\n        return palindrome\n    elif h == \"23\":\n        return \"00:00\"\n    else:\n        return getNext(toStr(int(h) + 1) + \":00\")\n\nprint getNext(time)\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "6a623c83823d4fb0de0002279ef05cb9", "src_uid": "158eae916daa3e0162d4eac0426fa87f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\narr = list(input())\nflag = False\nfor i in range(n):\n    if arr[i] == '*':\n        for d in range(1, n):\n            begin = i\n            for k in range(4):\n                if (begin + d) < n and arr[begin + d] == '*':\n                    begin += d\n                else:\n                    break\n            else:\n                flag = True\n                break\n    if flag:\n        break\nif flag:\n    print('yes')\nelse:\n    print('no')", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "ff885357715d5e799beeb2c86b83d0d4", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import itertools\ndef king():\n    n= int(input())\n    s= input()\n    a= []\n    for i in range(len(s)):\n        if s[i]== \"*\":\n            a.append(i+1)\n            \n    #print(a)\n    if len(a)< 5:\n        print(\"no\")\n        return\n    for arr in itertools.combinations(a, 5):\n        arr= sorted(arr)\n        mine= []\n        for i in range(4):\n            mine.append(arr[i+1]- arr[i])\n        if len(set(mine))== 1:\n            print(\"yes\")\n            return\n    \n    print(\"no\")\n    return\nking()", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "ddcdf7cb77ada3407a741569bd1f2fb6", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = str(input())\ns1 = sorted(s)\nac1 = 0\nfor i in s:\n\tif i == 'a':\n\t\tac1 += 1\nleng = len(s1) / 2\nif ac1 > leng:\n    print(len(s1))\nelse:\n    while ac1 <= leng:\n    \ts1.pop(-1)\n    \tleng = len(s1) / 2\n    print(len(s1))", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "aca21bb2e16f022541ebc396c6c9e617", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "l = input()\nif(l.count('a')>len(l)//2):\n    print(len(l))\nelse:\n    print(2*l.count('a')-1)", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "eb7cabc8c3a5a00bf7f488b69d647d7d", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\nL=sorted([int(i) for i in input().split()])\nprint(L[n-1],end=\" \")\nfor i in range(1,n-1):\n    print(L[i],end=\" \")\nprint(L[0])\n    ", "lang_cluster": "Python", "tags": ["sortings", "constructive algorithms", "implementation"], "code_uid": "296eba6467b7cd615bbba94437e761a9", "src_uid": "4408eba2c5c0693e6b70bdcbe2dda2f4", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "N=int(input())\nnum=[]\ni=0\nIN=input().split()\nwhile(i<N):\n\t\tnum.append(int(IN[i]))\n\t\ti=i+1\nnum.sort()\nnum[0],num[len(num)-1]=num[len(num)-1],num[0]\nfor i in num:\n\tprint(i,end=' ')\n\t\t", "lang_cluster": "Python", "tags": ["sortings", "constructive algorithms", "implementation"], "code_uid": "3e605aaccb3aa27f1dca25ac42496736", "src_uid": "4408eba2c5c0693e6b70bdcbe2dda2f4", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def readln(): return tuple(map(int, input().split()))\n\nc, d = readln()\nn, m = readln()\nk, = readln()\n\nans = 1 << 30\nfor x in range(10001):\n    y = max(0, n * m - k - n * x)\n    if y >= 0 and ans > c * x + d * y:\n        ans = c * x + d * y\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "dp", "implementation"], "code_uid": "0966ec0b7b3810a2578e2c13796ac9b3", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "c,d=map(int,input().split())\n\nn,m=map(int,input().split())\n\nk=int(input())\n\nz=0\nbest=10**10\nwhile(1):\n    x=n*m-k\n    x-=z*n\n    best=min(best,z*c+(max(x,0)*d))\n    if(x<0):\n        break\n    z+=1\nprint(best)\n    \n", "lang_cluster": "Python", "tags": ["math", "dp", "implementation"], "code_uid": "217529ddc9dd38961a8588febf151793", "src_uid": "c6ec932b852e0e8c30c822a226ef7bcb", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x=int(input())\ndi=[0,3,1,2]\ndi2=['D','A','C','B']\nre=di[x%4]\nimax=0\nfor i in range(1,3):\n    if re<di[(x+i)%4]:\n        imax=i\n        re=di[(x+i)%4]\nprint(imax,di2[di.index(re)])\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "a72def48f67b3ac383077d2e1a900fe7", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x=int(input())\np=x%4\nif p==0:\n\tprint( str(1)  + ' A')\nelif p==1:\n\tprint(str(0) +  ' A')\nelif p==2:\n\tprint( str(1) + ' B')\nelif p==3:\n\tprint( str(2) + ' A')", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "f0db7801dfd837beb12e305561786afb", "src_uid": "488e809bd0c55531b0b47f577996627e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s=input()\nn=int(input())\nx=\"\"\nfor i in range(n):\n    x+=input()\na,b=x[::2],x[1::2]\nif s in x:print(\"YES\")\nelif s[0] in b and s[1] in a:print(\"YES\")\nelse:print(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "17a2d4226acbf397cc6041d0123790f2", "src_uid": "cad8283914da16bc41680857bd20fe9f", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "pw = input()\nforw = [input() for i in range(int(input()))]\nrevs = [(forw1[1] + forw2[0]) for forw1 in forw for forw2 in forw]\nprint(\"YES\") if pw in forw + revs else print(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "eb7f0e838bbe13966de0166d7b3979bd", "src_uid": "cad8283914da16bc41680857bd20fe9f", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "inp=raw_input()\nL=[]\ns=\"\"\nx=len(inp)\nif x%2==1:\n  for i in range(len(inp)):\n   if i%2==0:\n    L.append(inp[(1)*(i/2+1)-1])\n\n   else:\n    L.append(inp[(-1)*(i/2+1)])\nelse:\n  for i in range(len(inp)):\n   if i%2==0:\n    L.append(inp[(-1)*(i/2+1)])\n\n   else:\n    L.append(inp[(i/2+1)-1])\nfor i in range(len(L)):\n  s+=L[-i-1]\nprint s\n\"\"\"\n0 1 1\n2 3 2\n4 5 3\n6 7 4\"\"\"\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "daa2a7f8642db3003d4b240874c13e7e", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def Ordenar(cadena1,cadena2,size):\n    if(len(cadena1)==0):\n        return cadena2\n    else:\n        if size%2==0:\n            cadena2.append(cadena1.pop(int((len(cadena1)-1)/2)))\n            Ordenar(cadena1, cadena2,size)\n        else:\n            cadena2.append(cadena1.pop(int(len(cadena1)/2)))\n            Ordenar(cadena1, cadena2,size)\nS=input()\nSaux=[]\ncadena=[]\nfor letra in S:\n    Saux.append(letra)\nOrdenar(Saux, cadena,len(S))\nstr1=''.join(cadena)\nprint(str1)", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "58914aad81a3e497b69c35c3965a833e", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n=int(input())\nans=2*3*4*(4**(n-3))\nans2=9*(n-3)*(4**(n-3))\nprint(ans+ans2)\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "5bb58c05d84d0e8e267cdb7e767eb0d4", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\n\nprint(int(4*(2*3*pow(4,n-3) + (n-3)*3*3*pow(4,n-4))))\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "cc79a8121ee979b8340796698603d58b", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\na = []\ni = 1\ns = 0\nwhile i ** 2 <= n:\n    if n % i == 0:\n        a.append(i)\n        a.append(n // i)\n    i = i + 1\na = set(a)\nfor i in a:\n    oth = {'1', '2', '3', '5', '6', '8', '9', '0'}\n    if oth == oth - (set(str(i))):\n        s = s + 1\nif s > 0:\n    print('YES')\nelse:\n    print('NO')\n", "lang_cluster": "Python", "tags": ["brute force", "number theory"], "code_uid": "f56703740c056b211d6138baa0f20970", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\na=[4,7,47,74,447,474,744,747,774,477]\ncnt=0\nfor i in range(10):\n    if(n==a[i] or n%a[i]==0):\n        print(\"YES\");\n        break;\n    else:\n        cnt+=1;\nif(cnt==10):\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["brute force", "number theory"], "code_uid": "a569b611430d87108679bcf5bc6dd513", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from fractions import *\ndef main():\n    L = [ int(i) for i in raw_input().split(\" \")]\n    a,b,n = L\n    while True:\n        n -= gcd(n,a)\n        if n < 0:\n            print 1\n            return\n\n        n -= gcd(n,b)\n                \n        if n < 0:\n            print 0\n            return\n\n\nmain()", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "2725ff0c9672bd4cad847b2f65c60e8a", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def gcd(a, b):\n\twhile(a != 0):\n\t\ttemp = a\n\t\ta = b % a\n\t\tb = temp\n\t\n\treturn b\n\ndef main():\n\tstring = raw_input()\n\tstring = string.split()\n\twinner = 1\n\t\n\ta = int(string[0])\n\tb = int(string[1])\n\tn = int(string[2])\n\t\n\tparts = [b, a]\n\t\n\twhile(n >= gcd(parts[winner], n)):\n\t\t#print gcd(parts[winner], n)\n\t\tn -= gcd(parts[winner], n)\n\t\t\n\t\tif(winner == 0):\n\t\t\twinner = 1\n\t\t\n\t\telif(winner == 1):\n\t\t\twinner = 0\n\t\n\tprint winner\n\t\nmain()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "e8e23fd0a6ee6a1feded4638c4ce12bb", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "N = int(input())\n\n# \u521d\u59cb\u5316\nmatrix = [[0] * N] * N\nfor i in range(N):\n    matrix[0][i] = 1\n    matrix[i][0] = 1\n\nfor i in range(1, N):\n    for j in range(1, N):\n        matrix[i][j] = matrix[i-1][j] + matrix[i][j-1]\n\nprint(matrix[N-1][N-1])", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "524b08bf5bee939b96bb80c67b225aca", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\nl1=[]\nl2=[]\nif n==1:\n    print(1)\nelse:\n    for i in range(n):\n        l1.append(1)\n    a = 1\n    while a < n:\n        l2 = [1]\n        for i in range(n - 1):\n            l2.append(l1[i + 1] + l2[i])\n        l1 = l2\n        a += 1\n    print(l2[-1])\n\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "d2a13701b8410bf3e92f88fb0dd7045d", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "L1,R1,L2,R2,K = map(int, input().split())\nans=0\nL = max(L1,L2)\nR = min(R1,R2)\nif L<=R:\n    ans=R-L+1\n    if L<=K<=R:\n        ans-=1\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "f666aa51937879517471ed8bccc769c6", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "l1, r1, l2, r2, k = [int(s) for s in raw_input().split()]\nl = max(l1, l2)\nr = min(r1, r2)\n\nans = r - l + 1\nif l <= k and k <= r :\n\tans -= 1\nans = max(ans, 0)\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "c792acd5e175afbb9df518e228add239", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "input()\nw,s=set('aeiouy'),input()\nprint(''.join(c[0] for c in zip(s,'b'+s) if w<w|set(c)))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "ca1e13cb3a9d6f41b3c32fcdd58b33e1", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\ns = input()\nt = []\nvowels = 'aeiouy'\nfor c in s:\n    if t and t[-1] in vowels and c in vowels:\n        continue\n    else:\n        t.append(c)\nprint(''.join(t))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "5b179ff351b2f2d6f70b7581dda7ea76", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# import sys\n# sys.stdin = open('test.txt','r')\n\nn,c = map(int,raw_input().split())\nx = map(int,raw_input().split())\nprint max(max([x[i]-x[i+1]-c for i in range(len(x)-1)]),0)", "lang_cluster": "Python", "tags": ["brute force", "greedy", "implementation"], "code_uid": "c08f3aa425315601f5ba1445554217ab", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import logging\nimport copy\nimport sys\n\nlogging.basicConfig(stream=sys.stderr, level=logging.DEBUG)\n\n#def solve(firstLine):\ndef solve(firstLine, inputLines):\n    m = 0\n    x = firstLine[1]\n\n    for i in range(len(inputLines)-1):\n        s = inputLines[i] - inputLines[i+1] - x\n\n        if s > m:\n            m = s\n    return m\n\ndef main():\n    firstLine = input().split()\n    firstLine = list(map(int, firstLine))\n    line = input().split()\n    line = list(map(int, line))\n        \n    print(solve(firstLine, line))\n\ndef log(*message):\n    logging.debug(message)\n    \nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["brute force", "greedy", "implementation"], "code_uid": "3da7c97257365b92f2e3c1681932df61", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b=raw_input(),raw_input()\nc=''\nfor i in xrange(len(a)):\n     c+= '0' if a[i]==b[i] else '1'\nprint ''.join(c)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "e93a371c8f19b4e6cb971291c68976f3", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "a = list(raw_input())\nb = raw_input()\nfor i in xrange(len(a)):\n    if a[i] == b[i]:\n        a[i] = '0'\n    else:\n        a[i] = '1'\nprint ''.join(a)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "89f51b419531b9eb6c2e9ac471771cea", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def verify(i):\n    return i < n-1 and l[i-1] == 1 and l[i+1] == 1 and l[i] == 0\n\nn = int(raw_input())\nl = map(int, raw_input().split())\n\ngo_home = 0\nfor i in xrange(len(l)): \n    if l[i] == 1: go_home = i\n\nans = 0\nflag = False\nfor i in xrange(len(l)):\n    \n    if l[i] == 1:\n        flag = True\n    \n    if flag and verify(i): ans += 1\n    ans += l[i]\n\nprint ans\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "3c5d5ff8478fa730f9309ec077799222", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import stdin, stdout\ninput = stdin.readline\n\nn = int(input())\na = list(map(int, input().split()))\nans = 0\n\nuni = False\nind = 0\n\nwhile ind < n-1:\n    if a[ind] == 1:\n        ans += 1\n        ind += 1\n        uni = True\n    else:\n        if a[ind+1] == 0:\n            while ind < n and a[ind] == 0:\n                ind += 1\n            uni = False\n        else:\n            if uni:\n                ans += 1\n            ind += 1\n\nif a[n-1] == 1:\n    ans += 1\n\nstdout.write(str(ans))\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "9eb3de6324f9379d15525cc478b8a77a", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\ns=input()\nm=104\ncount=0\nfor i in range(0,n-3):\n\tcount+=(min(abs(ord(s[i])-65),abs(65-ord(s[i])-26),abs(65-ord(s[i])+26)))\n\t#print (count)\n\tcount+=(min(abs(ord(s[i+1])-67),abs(67-ord(s[i+1])-26),abs(67-ord(s[i+1])+26)))\n\t#print (count)\n\tcount+=(min(abs(ord(s[i+2])-84),abs(84-ord(s[i+2])-26),abs(84-ord(s[i+2])+26)))\n\t#print (count)\n\tcount+=(min(abs(ord(s[i+3])-71),abs(71-ord(s[i+3])-26),abs(71-ord(s[i+3])+26)))\n\tif count<m:\n\t\tm=count\n\tcount=0\nprint (m)", "lang_cluster": "Python", "tags": ["brute force", "strings"], "code_uid": "cbb68afc639c306cfd51a86954db413b", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\ns = input()\nletters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\nans = 100000000\n\n\ndef diff(c1, c2):\n    if letters.find(c1) > letters.find(c2):\n        c1, c2 = c2, c1\n    return min(abs(letters.find(c1) - letters.find(c2)), 26-abs(letters.find(c1) - letters.find(c2)))\n\n\nfor i in range(n-3):\n    count = 0\n    count = diff('A', s[i]) + diff('C', s[i+1]) + \\\n        diff('T', s[i+2]) + diff('G', s[i+3])\n    ans = min(ans, count)\n\nprint(ans)\n", "lang_cluster": "Python", "tags": ["brute force", "strings"], "code_uid": "fb247f7ea122115b3c525f286a56de95", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from collections import Counter\nnn,mm,kk=[int(i) for i in input().split()]\nif nn%2==0:\n    print('Marsel')\n    exit(0)\n\ndef get_ls(n):\n    result = []\n    i = 2\n    while i < n:\n        if n % i == 0:\n            n /= i\n            result.append(i)\n        else:\n            i += 1\n    result.append(int(n))\n    return result\n\n#print(mm)\nif  mm%499999993==0:\n    mm=mm//499999993\n    ls = get_ls(mm)\n    ls.append(499999993)\n    mm*=499999993\nelif  mm%166666649==0:\n    #print('***')\n    mm=mm//166666649\n    ls = get_ls(mm)\n    ls.append(166666649)\n    mm*=166666649\n\nelif  mm%999999937==0:\n    #print('***')\n    mm=mm//999999937\n    ls = get_ls(mm)\n    ls.append(999999937)\n    mm*=999999937\nelif  mm%14925373==0:\n    #print('***')\n    mm=mm//14925373\n    ls = get_ls(mm)\n    ls.append(14925373)\n    mm*=14925373\nelif  mm%10204081==0:\n    #print('***')\n    mm=mm//10204081\n    ls = get_ls(mm)\n    ls.append(10204081)\n    mm*=10204081\n\nelse:\n    ls = get_ls(mm)\n#print(ls)\nkkk = dict(Counter(ls)).items()\nd = [k for k, _ in kkk]\nm = [v for _, v in kkk]\nk = [0 for _ in range(len(set(ls)))]\nln = range(len(m))\ndels=[]\ntry:\n    while True:\n        r = 1\n        for i1, i2 in zip(d, k):\n            r *= i1 ** i2\n        dels.append(r)\n\n        k[0] += 1\n        for i in ln:\n            if k[i] > m[i]:\n                k[i] = 0\n                k[i+1] += 1\nexcept IndexError:\n    pass\nfor i in dels:\n    #print(i,kk,mm)\n    if kk<=i<mm:\n        print('Timur')\n        exit(0)\nprint('Marsel')\n", "lang_cluster": "Python", "tags": ["dp", "number theory", "games"], "code_uid": "f3cf5e9ff7bc1e4a1bd8a31ec45a0e93", "src_uid": "4a3767011ddac874efa021fff7c94432", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import stdin, stdout\n\n\ndef check(m, k):\n    for i in range(2, int(m ** 0.5) + 1):\n        if not m % i and (i >= k or m // i >= k):\n            return 1\n    else:\n        return 0\n\n\nn, m, k = map(int, stdin.readline().split())\n\nif m < 2 * k or (k != 1 and not check(m, k)):\n    stdout.write('Marsel')\nelif n % 2:\n    stdout.write('Timur')\nelse:\n    stdout.write('Marsel')", "lang_cluster": "Python", "tags": ["dp", "number theory", "games"], "code_uid": "2e6cc01ae9440d51c687c8a4208beafb", "src_uid": "4a3767011ddac874efa021fff7c94432", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b,f,k = map(int,raw_input().split())\n\nif k == 1 and (b<f or b<a-f):\n    print -1\nelif k == 2 and (b<f or b<2*(a-f)):\n    print -1\nelif k > 2 and (b<2*f or b<2*(a-f)):\n    print -1\nelse:\n    currentFuel = b\n    ans = 0\n    tripRemain = k\n    while tripRemain > 0:\n        currentFuel -= f\n        if (tripRemain > 1 and currentFuel<2*(a-f)) or (tripRemain == 1 and currentFuel<a-f):\n            currentFuel = b\n            ans += 1\n        currentFuel -= a-f\n        tripRemain -= 1\n        if tripRemain == 0:\n            break\n        currentFuel -= a-f\n        if (tripRemain > 1 and currentFuel<2*f) or (tripRemain == 1 and currentFuel<f):\n            currentFuel = b\n            ans += 1\n        currentFuel -= f\n        tripRemain -= 1\n    print ans\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "ac039ff9ccadcdf05234a45c30bf2546", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b, f, k=map(int,input().split())\nd=b\nn=0\ns=0\nx=a-f\nd -= f\nif (x*2>b) or (f*2>b):\n    if k<3:\n        if k==1:\n            if a<=b:\n                print(0)\n            elif (f<=b) and (x<=b):\n                print(1)\n            else:\n                print(-1)\n        if k==2:\n            if a+x<=b:\n                print(1)\n            elif (f<=b) and (x*2<=b):\n                print(2)\n            else:\n                print(-1)\n    else:\n        print(-1)\nelse:\n    while n<k:\n        if (n+1==k):\n            if (d<x):\n                s+=1\n            break\n        if d<x*2:\n            s+=1\n            d=b\n        n+=1\n        d-=x*2\n        if (n+1==k):\n            if (d<f):\n                s+=1\n            break\n        if d<f*2:\n            s+=1\n            d=b\n        n+=1\n        d-=f*2\n    print(s)\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "3e29ff4d7ad3511103148f5580ce26af", "src_uid": "283aff24320c6518e8518d4b045e1eca", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\na,b,c=tuple(map(int,input().split()))\n\nt = math.ceil((a - b)*c/b)\nprint(t)", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search"], "code_uid": "f859632d746d41ffe19623b6a4013c40", "src_uid": "7dd098ec3ad5b29ad681787173eba341", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import math\nsize, band, dur = map(int, raw_input().split())\n\nl, r = (size*dur)/band + 1, 0;\nwhile l > r:\n  mid = (l+r)/2\n  if mid+dur >= math.ceil((size*dur)/float(band)):\n    l = mid\n  else:\n    r = mid+1\nprint l\n", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search"], "code_uid": "148e3cdcb794caa6b7d0701388cc15b5", "src_uid": "7dd098ec3ad5b29ad681787173eba341", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "k,r = [int(i) for i in input().split()]\ns = 0\nfor i in range(1,1000):\n    if k<10 and r%k == 0:\n        print(r//k)\n        break\n    if (i*10)%k == 0:\n        print(i*10//k)\n        break\n    elif (i*10+r)%k == 0:\n        print((i*10+r)//k)\n        break\n", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "74222760e6521fb51ea059882d4ea4c6", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = input().split()\nr = int(n[0]) % 10\nc = int(n[1])\n\nfor i in range(1,10):\n    if (((i * r) - c) % 10 == 0) or (((i * r)) % 10 == 0):\n        print(i)\n        break\n        ", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "4713b444e12661e23d68e9de7dfc9f06", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "inp = raw_input()\n\n#Construct new line\nnewline = \"/\"\nlastchar = '/'\nfor i in xrange(1, len(inp)):\n    if ((lastchar == '/') and (inp[i] == '/')):\n        tmp = 0\n        #Dont add\n    else:\n        newline += inp[i]\n        lastchar = inp[i]\n\n#Check for slash at end\nif ((len(newline) > 1) and (newline[len(newline)-1] == '/')):\n    newline = newline[0:len(newline)-1]\n\nprint newline\n    \n    \n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "e4fd6bd0b327247cab2c3ebd79d24c90", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "p=input()\ni=0\nr=\"\"\nc=0\nwhile (i<len(p)):\n  if(p[i]!=\"/\"):\n    r=r+p[i]\n    c=0\n  elif(p[i]==\"/\" and c==0):\n    r=r+\"/\"\n    c=1\n  i=i+1  \nif(r[len(r)-1]==\"/\" and len(r)>1):\n   r=r[0:(len(r)-1)]\nprint(r)    \n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "822882d52976b970750cca1390e7f4df", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def solve(n, arr):\n    if n % 2 == 0 or arr[0] % 2 == 0 or arr[-1] % 2 == 0:\n        return False\n    return True\n\nif __name__ == \"__main__\":\n    n = input()\n    arr = map(int, raw_input().split())\n    if solve(n, arr):\n        print 'Yes'\n    else:\n        print 'No'\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "5d48e7a5d05436849cead6fac96897ba", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nl=[int(i) for i in input().split()]\nif (n%2!=0 and l[0]%2!=0 and l[-1]%2!=0):\n    print ('Yes')\nelse:\n    print ('No')", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "debcd53e835817602ed39b0aefd63546", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n\tn = list(map(int, input().strip().split()))\n\tn, m = tuple(n)\n\ttemp = 1\n\twhile m != n:\n\t\tif m % 10 == 0:\n\t\t\tprint(0)\n\t\t\treturn\n\t\ttemp *= m\n\t\tm -= 1\n\tprint(temp % 10)\n\t\nmain()", "lang_cluster": "Python", "tags": ["math"], "code_uid": "843d2f42f3dea3c7df5939ba06854bbb", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "str = input()\na = int(str[0:str.find(' ')])\nb = int(str[str.find(' '):])\nansw = 1\nif b - a > 4:\n    print(0)\nelse:\n    while b > a:\n        answ*= b\n        b-=1\n    print(answ % 10)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "4b11b39b4514e91e4d73ab0f8c87ad03", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def gcd(x,y):\n    if x>y:\n        x,y = y,x\n    # print x,y\n    if x==0:\n        return y\n    if y==1:\n        return 1\n    else:\n        return gcd(y%x,x)\ndef lcm(x,y):\n    return x*y/gcd(x,y)\n\nn,k = map(int,raw_input().split())\nif k==1:\n    print \"Yes\"\nelif(k>=n):\n    if n==1 and k==2:\n        print \"Yes\"\n    else:\n        print \"No\"\nelse:\n    curr = 2\n    currlcm = 2\n    p = 3\n    while(p-1<=k):\n        # print currlcm,p,(n+1)%currlcm,curr\n        if((n+1)%currlcm!=0):\n            print \"No\"\n            exit(0)\n        else:\n            currlcm = lcm(currlcm,p)\n            curr*=(p)\n            if p-1==k:\n                break\n            p+=1\n        # print currlcm,p,(n+1)%currlcm,curr,\"asd\"\n\n    print \"Yes\"\n", "lang_cluster": "Python", "tags": ["brute force", "number theory"], "code_uid": "3992a82a2697fbdbfcbef6f4947d121f", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, k = map(int, input().split())\n \nif k > 70:\n    print('No')\n    exit(0)\n \ns = set()\nfor i in range(1, k + 1):\n    s.add(n % i)\n \nprint('Yes' if len(s) == k else 'No')", "lang_cluster": "Python", "tags": ["brute force", "number theory"], "code_uid": "99218d9d2de1f2b818c717731b9c9657", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# You lost the game.\nr,c,n,k = map(int, input().split())\nV = [list(map(int, input().split())) for _ in range(n)]\n\nG = [[0 for _ in range(c)] for _ in range(r)]\nfor i in range(n):\n    G[V[i][0]-1][V[i][1]-1] = 1\n\n\nT = [[0 for _ in range(c)] for _ in range(r)]\nT[0][0] = G[0][0]\nfor i in range(1,r):\n    T[i][0] = G[i][0]\nfor i in range(r):\n    for j in range(1,c):\n        T[i][j] = T[i][j-1] + G[i][j]\nfor i in range(1,r):\n    for j in range(c):\n        T[i][j] += T[i-1][j]\nnb = 0\nfor x1 in range(c):\n    for x2 in range(x1,c):\n        for y1 in range(r):\n            for y2 in range(y1,r):\n                s = T[y2][x2]\n                if x1 > 0:\n                    s -= T[y2][x1-1]\n                if y1 > 0:\n                    s -= T[y1-1][x2]\n                if x1 > 0 and y1 > 0:\n                    s += T[y1-1][x1-1]\n                if s >= k:\n                    nb += 1\nprint(nb)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "671f5a72439f2394077820ec3bd64b2d", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def check(x1, y1, x2, y2):\n    global dp\n    cnt = 0\n    for i in range(x2, x1 + 1):\n        for j in range(y2, y1 + 1):\n            cnt += dp[i][j]\n    return cnt\n\n\n#n = int(input())\nr, c, n, k = map(int, input().split())\n#s = list(map(int, input().split()))\ndp = [[0] * c for i in range(r)]\nfor i in range(n):\n    a, b = map(int, input().split())\n    dp[a - 1][b - 1] = 1\nanswer = 0\nfor x1 in range(r):\n    for y1 in range(c):\n        for x2 in range(x1 + 1):\n            for y2 in range(y1 + 1):\n                cnt = check(x1, y1, x2, y2)\n                #print(cnt, x1, y1, x2, y2)\n                if cnt >= k:\n                    answer += 1\nprint(answer)\n                ", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "597b7437082f1e543c0b26af2cb73585", "src_uid": "9c766881f6415e2f53fb43b61f8f40b4", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\nl =[0]+ list(map(int,input().split()))\nl.append(1001)\n#print(l)\nm,c = 1,0\nfor i in range(1,n+2):\n    if l[i]-l[i-1]==1:\n        c+=1\n    else:\n        m=max(m,c)\n        c=0\nm = max(m,c)\nprint(m-1)", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "8ea931626653c013d08635d7dd44b678", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\narr = [int(x) for x in input().strip().split()]\nmaximum = 1\ncount = 1\nlast = arr[0]\nconsec = []\nnotconsec = set()\ncur = [arr[0]]\nfor i in range(1,len(arr)):\n\tif arr[i] == (last+1):\n\t\tcount += 1\n\t\tcur.append(arr[i])\n\telse:\n\t\tif count >= 2:\n\t\t\tconsec.append(cur)\n\t\tnotconsec.add(arr[i] - last+1)\n\t\tcount = 1\n\t\tcur = [arr[i]]\n\tlast = arr[i]\n\nif count >= 2:\n\tconsec.append(cur)\n# print(consec,notconsec)\nans = 0\nfor i in consec:\n\ttemp = len(i)-2\n\tif i[0] == 1:\n\t\ttemp +=1\n\tif i[-1]==1000:\n\t\ttemp += 1\n\tans = max(ans,temp)\nprint(ans)\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "04b4e54084b93151383897a73537c412", "src_uid": "858b5e75e21c4cba6d08f3f66be0c198", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "l,r,a=input().split()\nl=int(l)\nr=int(r)\na=int(a)\nif l<r and a>r-l:\n    print(2*(l+(r-l)+(a-(r-l))//2))\nelif l<r and a<=r-l:\n    print(2*(l+(a)))\nelif l>r and a>l-r:\n    print(2*(r+(l-r)+(a-(l-r))//2))\nelif l>r and a<=l-r:\n    print(2*(r+(a)))\nelif l==r:\n    print(2*(r+(a//2)))\n    \n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "fcae61f21d6ba30fdf3c6acbd4665a44", "src_uid": "e8148140e61baffd0878376ac5f3857c", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "l,r,a   = list(map(int,input().split()))\nmipa    = min(l,r) + a\nprint((mipa<<1) if mipa <= max(l,r) else (((l+r+a)//2)<<1))\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "0ceace5e9f8e5fd3d2284b70bd198175", "src_uid": "e8148140e61baffd0878376ac5f3857c", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b,c,d=map(int,raw_input().split())\ntot=a+b-c\nif c>b or c>a:\n        print -1\n        exit()\nif tot>d-1:\n        print -1\n        exit()\nprint d-tot", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "1f8af426c1c204a50a493c8cf6038f86", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\na,b,c,n=map(int,raw_input().split())\n\nif a<=n-1 and b<=n-1 and a-c>=0 and b-c>=0 :\n    if n-(a+b-c)>0:\n        print n-(a+b-c)\n\n    else:\n        print -1\n\nelse:\n    print -1\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "59c8ecd368b9495ab73573a587b526e3", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nstudents = [int(s) for s in input().split()]\nstudents.sort()\nc = 0\nfor i in range(len(students)):\n    if i%2==0:\n        c -= students[i]\n    else:\n        c += students[i]\n        \nprint(c)", "lang_cluster": "Python", "tags": ["sortings"], "code_uid": "207be9d81aa171a77d5a6f72b8fc1169", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "input()\nl=list(map(int,input().split()))\ntotal=0\ndic={}\nfor i in range(len(l)):\n    for j in range(i+1,len(l)):\n        if(l[j]>l[i]):\n            temp=l[j]\n            l[j]=l[i]\n            l[i]=temp\nfor i in range(0,len(l)-1,2):\n    total+=abs(l[i]-l[i+1])\n\nprint(str(total))\n\n", "lang_cluster": "Python", "tags": ["sortings"], "code_uid": "180abf06c48b6a48f5fa6258f957614d", "src_uid": "55485fe203a114374f0aae93006278d3", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "arr  = [2,7,2,3,3,4,2,5,1,2]\na = int(input())\nb = a//10\nc = a%10\nprint(arr[b]*arr[c])", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "3739ff920cd62a462ba90789b50453ff", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "ans = '2723342512'\nnum = int(raw_input())\nprint int(ans[num / 10]) * int(ans[num % 10])", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "1b4a44b1a76bb6b0ae28bd5b95d2d5f0", "src_uid": "76c8bfa6789db8364a8ece0574cd31f5", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import stdin\ninput=stdin.readline\nw,h=map(int,input().split())\nh,w=sorted([w,h])\nans=1\nmod=998244353\nfor i in range(w):\n    ans+=2**i\nfor i in range(h):\n    ans+=ans\nprint(ans%mod)", "lang_cluster": "Python", "tags": ["math", "greedy", "combinatorics"], "code_uid": "53c3c95b75c6dfb226c53bdae646bb89", "src_uid": "8b2a9ae21740c89079a6011a30cd6aee", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import re\ns=input()\nd=re.findall(r'\\d+',s)\ntiles=(2**(int(d[0])+int(d[1])))%998244353\nprint(tiles)", "lang_cluster": "Python", "tags": ["math", "greedy", "combinatorics"], "code_uid": "dd0e873adf79458961accc5ecba031de", "src_uid": "8b2a9ae21740c89079a6011a30cd6aee", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "input()\nr=0\nfor x in input():\n  if x=='1':r+=1\n  else:r+=1;break\nprint(r)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "21f57b84ce0c9c793f8f2ffd245e69c4", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=input()\ns=input()\ncount=0\nfor i in s:\n    count+=1\n    if i=='0':\n        break\nprint(count)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "02b065e71ea9750d9b0572e74a7dbf9f", "src_uid": "54cb2e987f2cc06c02c7638ea879a1ab", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = list(map(int,input().split()))\nif(n[1] == 1):\n\tprint(n[0]-1)\nelse:\n\tprint(n[0]*(n[1]-1))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "48e9b5b56d4e8cae9592594c1b76fcc4", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m=[int(num) for num in input().split(\" \")]\r\nif m-1==0:\r\n    print(m*(n-1))\r\nelse:\r\n    print((n*(m-1)))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "406d0fc783bb88ccaa6e778fa9ac8791", "src_uid": "a91aab4c0618d036c81022232814ef44", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from math import *\n\nMOD = 1000000007\n\ndef f(n, b):\n    if n == 1:\n        return b\n    else:\n        if n % 2 == 0:\n            a = f(n/2, b) ** 2\n            return a % MOD\n        else:\n            return (b * f((n-1)/2, b) ** 2) % MOD\n \nt = int(raw_input())\nk = 250000002\nif t % 2 == 0:\n    print (k * (f(t, 3) + 3)) % MOD\nelse:\n    print (k * (f(t, 3) - 3)) % MOD", "lang_cluster": "Python", "tags": ["math", "matrices", "dp"], "code_uid": "7cd214383e2fbce7400acc029a991f9f", "src_uid": "77627cc366a22e38da412c3231ac91a8", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\na, b = 0, 3\nif n==1:\n\tprint(a)\nelse:\n\tfor i in range(n-2):\n\t\ta, b = b, (2*b+3*a)%1000000007\n\tprint(b)\n", "lang_cluster": "Python", "tags": ["math", "matrices", "dp"], "code_uid": "c56857329240c3efd1267a7ffeb18a66", "src_uid": "77627cc366a22e38da412c3231ac91a8", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import log\nx, y = map(int, input().split())\n\nif (log(x)/x == log(y)/y):\n    print(\"=\")\nelif (log(x)/x  > log(y)/y):\n    print(\">\")\nelse:\n    print(\"<\")\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "0f67d522f0799222efaf2f11390436bf", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nx, y = map(int, input().split())\na = y * math.log(x)\nb = x * math.log(y)\nif a > b:\n    print(\">\")\nelif a < b:\n    print(\"<\")\nelse:\n    print(\"=\")", "lang_cluster": "Python", "tags": ["math"], "code_uid": "96dad55feabed35207f3d3c3e093f16d", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\ndef main():\n    a, k = raw_input().split()\n    a = list(a)\n    k = int(k)\n    i = 0\n    while k > 0 and i < len(a):\n        ma = a[i]\n        mi = i\n        for j in range(i+1, len(a)):\n            if a[j] > ma and k >= j-i:\n                ma = a[j]\n                mi = j\n        if mi != i:\n            tmp = a[mi]\n            del a[mi]\n            a.insert(i, tmp)\n            k -= mi - i\n        i += 1\n    for i in a:\n        sys.stdout.write(i)\n    \nif __name__ == \"__main__\":\n    main()", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "ee629125996e75c1c62e76fa7e4a1fc1", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def yoba(a, k):\n\n    if not a:\n\n        return []\n\n    elif not k:\n\n        return a\n\n    else:\n\n        m = max(a[:k + 1])\n        mi = a.index(m)\n        if m > a[0]:\n\n            a[1:mi + 1] = a[:mi]\n            a[0] = m\n            k -= mi\n\n        return [a[0]] + yoba(a[1:], k)\n\n\na, k = str.split(input())\nk = int(k)\n\nprint(str.join(\"\", yoba(list(a), k)))\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "b18e3ddb186726cde734e3f6e6cc9108", "src_uid": "e56f6c343167745821f0b18dcf0d0cde", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s=input()\ns+=\"1\"\nn=len(s)\nif (s.count(\"1\")+s.count(\"4\"))==n:\n    if s[0]!=\"1\":\n        print(\"NO\")\n    else:\n        x=0\n        for i in range(1,n):\n            if s[i]==\"1\":\n                if i-x<=3:\n                    x=i\n                else:\n                    x=-1\n                    break\n        if x==-1:\n            print(\"NO\")\n        else:\n            print(\"YES\")\nelse:\n    print(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "15998de566a4d6df2e69f77dca5a838c", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "st = input()\nworks = True\nfor i in st:\n    if(i != \"1\" and i != \"4\"):\n        works = False\nif(st[0] != \"1\"):\n    works = False\nfor i in range(len(st) - 2):\n    if(st[i] == \"4\" and st[i + 1] == \"4\" and st[i + 2] == \"4\"):\n        works = False\n        break\nif(works):\n    print(\"YES\")\nelse:\n    print(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "f50525c28ad278cd13f07534e74b3452", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def next(x):\n    k = 0\n    while (x > 1):\n        x //= 2\n        k += 1\n    return k\n\ndef st(x):\n    k = 1\n    for i in range(x):\n        k *= 2\n    return k\n\n\nn, b, p = map(int, input().split())\nans = 0\nll = n * p\nwhile(n != 1):\n    k = st(next(n))\n    n -= k\n    n += (k // 2)\n    ans += (k // 2) * 2 * b\n    ans += (k // 2)\nprint(ans)\nprint(ll)\n\n# Wed Oct 07 2020 15:05:24 GMT+0300 (\u041c\u043e\u0441\u043a\u0432\u0430, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f)\n\n# Thu Oct 08 2020 09:54:00 GMT+0300 (\u041c\u043e\u0441\u043a\u0432\u0430, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f)\n\n# Thu Oct 08 2020 09:54:31 GMT+0300 (\u041c\u043e\u0441\u043a\u0432\u0430, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "67064532a306a1ba0bdb00a1b9a8a1a8", "src_uid": "eb815f35e9f29793a120d120968cfe34", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from math import log\nn, b, p = map(int, raw_input().strip().split())\nmatches, towels = 0, p*n\nwhile n > 1:\n    k = 2**(int(log(n, 2)))\n    matches += k/2\n    n -= k/2\nprint str(matches*(2*b+1))+\" \"+str(towels)\n    \n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "ec1c79f1adb9d8b635ff29eb3ceb6488", "src_uid": "eb815f35e9f29793a120d120968cfe34", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a=input()\nb=input()\nc=a[::-1]\nif (c==b):\n    print(\"YES\")\nelse:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "daddfff2c4268ec5475971e26920397b", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\nS_1=raw_input()\nS_2=raw_input()\nfor I in range(len(S_1)):\n    if not S_1[I]==S_2[len(S_2)-1-I]:\n        print'NO'\n        sys.exit()\nprint'YES'\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "ed2a7e11e790b7f2a6e2d06a69a383cc", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "print(25)", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "a44b9933417bcca9ac3103a7a74268ed", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "print(\"25\")", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "a6a113804db823541e11a040941c49ba", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b, c=map(int, raw_input().split())\nprint a*b+b*c+a*c-a-b-c+1\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "7f3f5e356f6c7be1ce2fb0668488c1eb", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "args = raw_input().split()\narr = [int(e) for e in args]\na = arr[0]; b = arr[1]; c = arr[2]\nres = 0\ncurrent = a\nx = min(b,c)\nfor i in range(1, x):\n    res += 2 * current\n    current += 1\nres += current * (max(b,c) - x + 1)\nprint res", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "78608988285251d428539121bb53a466", "src_uid": "8ab25ed4955d978fe20f6872cb94b0da", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "inp = int(input())\nleast = 2\nwhile True:\n    if (inp / least) % 1 == 0.0:\n        break\n    least = least + 1\nsecond = int(inp / least)\nprint(str(least) + str(second))", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "e82c37a523ac158556cc8c8ea6cd3a22", "src_uid": "7220f2da5081547a12118595bbeda4f6", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nans = \"\"\nfor i in range(2,n):\n    if (n%i==0):\n        ans+=str(i)\n        ans+=str(n//i)\n        break\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "4701174218e3900fc984e3765aa7aa3c", "src_uid": "7220f2da5081547a12118595bbeda4f6", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "c1, c2, x, y = map(int, raw_input().split())\nL, R = 0, 10**14\nwhile (L + 1 < R) : \n    M = (L + R) >> 1\n    if (M - M / x >= c1) and (M - M / y - max(0, c1 - M / y + M / x / y) >= c2) : \n        R = M\n    else : \n        L = M\nprint R\n", "lang_cluster": "Python", "tags": ["math", "binary search"], "code_uid": "1bd36cbc9f629997f7a2edc5374d72e0", "src_uid": "ff3c39b759a049580a6e96c66c904fdc", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def valid(n1, n2, p1, p2, mid):\n    x = mid - mid//p1\n    y = mid - mid//p2\n    rem = mid - mid//(p1*p2)\n    return x < n1 or y < n2 or rem < n1+n2\n    \ndef binary_search(n1, n2, p1, p2):\n    l, r = 0, 1<<61\n    while (l <= r):\n        mid = l+r >> 1\n        if (valid(n1, n2, p1, p2, mid)):\n            l = mid+1\n        else:\n            r = mid-1\n    return l\n\ndef main():\n    n1, n2, p1, p2 = map(int, input().split())\n    print(binary_search(n1, n2, p1, p2))\n\nmain()", "lang_cluster": "Python", "tags": ["math", "binary search"], "code_uid": "0c251095942230be0e2cb0df61659829", "src_uid": "ff3c39b759a049580a6e96c66c904fdc", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#!/usr/bin/python\n\n# http://codeforces.com/problemset/problem/673/A\n\n\n# define function\ndef watching_minute(n, a):\n    if a[0] > 15:\n        return 15\n    elif len(a) == 1:\n        return a[0] + 15\n    else:\n        for i in range(len(a) - 1):\n            if a[i+1] - a[i] > 15:\n                return a[i] + 15\n\n            if a[i+1] >= 75 or a[i] >= 75:\n                return 90\n\n            # check last number\n            if i + 1 == len(a) - 1 and a[i+1] < 75:\n                return a[i + 1] + 15\n\n# call function\nn = int(input())\na = [int(i) for i in input().split()]\nprint(watching_minute(n, a))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "0410d92602dba1106c848f2859f6324b", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#!/usr/bin/env python3\n\n# https://codeforces.com/problemset/problem/673/A\n# Time complexity:  O()\n\ndef calculate_interesting_minutes(minutes_list):\n    minutes_list.insert(0, 0)\n    interesting_minutes = 0\n    for i in range(len(minutes_list) - 1):\n        if minutes_list[i+1] - minutes_list[i] > 15:\n            interesting_minutes = 15 + minutes_list[i]\n            break\n    else:\n        interesting_minutes = 15 + minutes_list[i+1]\n\n    if interesting_minutes >= 90:\n        interesting_minutes = 90\n    return interesting_minutes\n\nif __name__ == \"__main__\":\n    n = int(input())\n    minutes_list = list(map(int, input().split()))\n    print(calculate_interesting_minutes(minutes_list))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "be6782ad034146ac34b6fe6f0a0dcdf4", "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "v=zip(*[map(int,raw_input().split()) for _ in range(input())])\nprint (max(v[0])-min(v[0]))*(max(v[1])-min(v[1])) or -1\n", "lang_cluster": "Python", "tags": ["geometry", "implementation"], "code_uid": "c632779f4c2a5e52625b999dd01fddbc", "src_uid": "ba49b6c001bb472635f14ec62233210e", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\nimport sys\n\nn = int(raw_input())\ncoords = []\nfor i in range(n):\n    coords.append(map(int, raw_input().split()))\n\nsorted(coords, key = lambda x : x[0]) # sorted by x-value now \n\nif len(coords) == 1:\n    print -1 \n\nelif len(coords) == 2: \n    if coords[0][0] == coords[1][0]:\n        print -1\n    elif coords[0][1] == coords[1][1]:\n        print -1\n    else:\n        print abs((coords[1][1] - coords[0][1]) * (coords[1][0] - coords[0][0]))\n\nelif len(coords) >= 3:\n    maxx = max(coords[i][0] for i in range(len(coords)))\n    minx = min(coords[i][0] for i in range(len(coords)))\n    maxy = max(coords[i][1] for i in range(len(coords)))\n    miny = min(coords[i][1] for i in range(len(coords)))\n    print abs((maxx - minx) * (maxy - miny))\n\n", "lang_cluster": "Python", "tags": ["geometry", "implementation"], "code_uid": "f5b3aaf3d1ef21cc7f0da8879220a61c", "src_uid": "ba49b6c001bb472635f14ec62233210e", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\ndef valid(y, m, d):\n  if not (1 <= y <= 99): return False\n  if not (1 <= m <= 12): return False\n\n  days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n\n  if y % 4 == 0 and m == 2:\n    if not (1 <= d <= 29):\n      return False\n  else:\n    if not (1 <= d <= days[m]):\n      return False\n  return True\n\ndef calc(y, m, d, by, bm, bd):\n  # print y, m, d, by, bm, bd\n  def ca(by, bm, bd):\n    if not valid(by, bm, bd): return False\n    old = y - by - 1\n    if m > bm:\n      old += 1\n    elif m == bm:\n      if d >= bd:\n        old += 1\n    else:\n      if by % 4 == 0 and bm == 2 and bd == 29:\n        if m >= 3:\n          old += 1\n    return old >= 18\n\n  if ca(by, bm, bd) or \\\n     ca(by, bd, bm) or \\\n     ca(bm, by, bd) or \\\n     ca(bm, bd, by) or \\\n     ca(bd, by, bm) or \\\n     ca(bd, bm, by):\n    return True\n  return False\n\ndef main():\n  s = sys.stdin.readline()\n  d, m, y = map(int, s.split(\".\"))\n  s = sys.stdin.readline()\n  bd, bm, by = map(int, s.split(\".\"))\n\n  if calc(y, m, d, by, bm, bd):\n    print \"YES\"\n  else:\n    print \"NO\"\n\nmain()\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "1d141852e73672fe37cc4b177c38bc20", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import itertools\nfrom datetime import date\n\ndef leapyear(cd, d):\n    count =0\n    if cd[1:] >= [3, 1]:\n        count += 1\n    if d[1:] >= [2, 28]:\n        count += 1\n    for i in range((date(*cd)-date(*d)).days/365):\n        year = 2000 + cd[0] + i+1\n        if (year%4==0) and (year%100!=0) or (year%400==0):\n            count +=1\n    return count-1\n\n\n\ndef main(a, b):\n    cd = [int(s, 10) for s in a.split('.')][::-1]\n    bd = [int(s, 10) for s in b.rsplit('.')][::-1]\n    \n    for d in itertools.permutations(bd):\n        try:\n            t = date(*cd) - date(*d)\n            if (t.days-leapyear(cd,d))/365 >= 18:\n                print \"YES\"\n                return\n        except ValueError:\n            pass\n    print \"NO\"\n\n\na = raw_input()\nb = raw_input()\nmain(a, b)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "01f83e7981b4a97262a02e2afe80d60f", "src_uid": "5418c98fe362909f7b28f95225837d33", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math as mm\nn,m=map(int,input().split())\nif m==0:\n    print(1)\nelse:\n\n    if n%2==0:\n        if m<=n//2:\n            print(m)\n        else:\n            print(n-m)\n    else:\n        if m<=mm.floor(n/2):\n            print(m)\n        elif m==mm.floor(n/2)+1:\n            print(m-1)\n        else:\n            print(n-m)", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "649c7991264c2f7eb0814fff9068b679", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# -*- coding:utf8 -*-\n# by utoppia\n# 09-05-2019\n\nn, m = map(int, raw_input().split(' '))\n\ndef f(n, m):\n    ans = 1\n    if m == 0 :\n        return  1\n    if m == 1:\n        if n > 1:\n            return 1\n        else:\n            return  0\n    \n\n    if m >= 2:\n        m -= 2\n        n -= 3\n\n    if n <= -1:\n        ans = 0\n    else:\n        p = 1\n        left = n\n        while m > 0:\n            m -= 1\n            if left >= 2:\n                p += 1\n                left -= 2\n                if left == 1:\n                    p += 1\n                    left = 0\n            else:\n                p -= 1\n        ans = p \n        if left:\n            ans += 1\n    return ans\n\nprint f(n, m)\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "d9757daa50b3af3259d099ae07423ff0", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "def num_grass(row):\r\n    return row[0] + row[1]\r\n\r\n\r\nnum_tests = int(input())\r\nfor test_num in range(num_tests):\r\n    row1 = list(map(int, input().split()))\r\n    row2 = list(map(int, input().split()))\r\n    if num_grass(row1) + num_grass(row2) == 0:\r\n        print(0)\r\n    elif num_grass(row1) + num_grass(row2) == 4:\r\n        print(2)\r\n    else:\r\n        print(1)\r\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "6b99f2e60d6ebd64a229f63c47f85f6f", "src_uid": "7336b8becd2438f0439240ee8f9610ec", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "n=int(input())\r\nfor i in range(n):\r\n    b=list(map(int,input().split()))\r\n    c=list(map(int,input().split()))\r\n    d=b+c \r\n    if d.count(1)==0:\r\n        print(0)\r\n    elif d.count(1)==4:\r\n        print(2)\r\n    else:\r\n        print(1)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "fc509a0c6ff70aeecdc00c402a2f34ee", "src_uid": "7336b8becd2438f0439240ee8f9610ec", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import inf,sqrt,floor,ceil\nfrom collections import Counter,defaultdict,deque\nfrom heapq import heappush as hpush,heappop as hpop,heapify as h\nfrom operator import itemgetter\nfrom itertools import product\nfrom bisect import bisect_left,bisect_right\n\n\n#for _ in range(int(input())):\n#n=int(input())\ns=input()\nd={}\nn=len(s)\nfor i in range(n):\n    if s[i]!=\"!\":\n        d[i%4]=s[i]\nans=defaultdict(int)\nfor i in range(n):\n    if s[i]==\"!\":\n        ans[d[i%4]]+=1\nres=[]\nres.append(ans['R'])\nres.append(ans['B'])\nres.append(ans['Y'])\nres.append(ans['G'])\nprint(*res)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "number theory"], "code_uid": "7c507f350e1630108aa38532351dcf15", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "garland = input()\n\nR = garland.index('R')\nB = garland.index('B')\nY = garland.index('Y')\nG = garland.index('G')\n\nindices = [R,B,Y,G]; ans = \"\"\nfor index in indices:\n    ans += (str(len(list(filter(lambda x: ((index-x)%4 == 0 and\n                                           garland[x] == '!'),\n                                range(0,len(garland)))))) +\n            ' ')\nprint(ans)\n                          \n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "number theory"], "code_uid": "7e7090f4295eca75201bf523cea20ca1", "src_uid": "64fc6e9b458a9ece8ad70a8c72126b33", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s=input()\nprint((len(s)+1)*26-len(s))", "lang_cluster": "Python", "tags": ["brute force", "math", "strings"], "code_uid": "49d362b4da6bf5886ee526358dfaabfd", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\nimport sys, math, random, operator\nfrom string import ascii_lowercase\nfrom string import ascii_uppercase\nfrom fractions import Fraction, gcd\nfrom decimal import Decimal, getcontext\nfrom itertools import product, permutations, combinations\nfrom Queue import Queue, PriorityQueue\nfrom collections import deque, defaultdict, Counter\ngetcontext().prec = 100\n\nMOD = 10**9 + 7\nINF = float(\"+inf\")\n\nif sys.subversion[0] != \"CPython\":  # PyPy?\n    raw_input = lambda: sys.stdin.readline().rstrip()\npr = lambda *args: sys.stdout.write(\" \".join(str(x) for x in args) + \"\\n\")\n\nread_str = raw_input\nread_strs = lambda: raw_input().split()\nread_int = lambda: int(raw_input())\nread_ints = lambda: map(int, raw_input().split())\nread_float = lambda: float(raw_input())\nread_floats = lambda: map(float, raw_input().split())\n\n\"---------------------------------------------------------------\"\n\ns = read_str()\n\nres = set()\nfor i in xrange(0, len(s) + 1):\n    for c in ascii_lowercase:\n        t = s[:i] + c + s[i:]\n        res.add(t)\n# print res\nprint len(res)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "strings"], "code_uid": "8c8c8e736d9ddd33242c0693de927f35", "src_uid": "556684d96d78264ad07c0cdd3b784bc9", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x = input().lower()\ny = input().lower()\ncount, z = 0, 0\nfor i in range(z, len(x)):\n    for j in range(z, len(y)):\n        if ord(x[i]) == ord(y[j]):\n            z += 1\n        if ord(x[i]) < ord(y[j]) and count != 1:\n            count = -1\n\n        if ord(x[i]) > ord(y[j]) and count != -1:\n            count = 1\n        break\n\nprint(count)", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "3e2bc178f89a166ea0f3e8292198aca4", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "m = input().lower()\nn = input().lower()\nif m == n:\n    print (0)\nelif m > n :\n    print (1)\nelse:\n    print (-1)\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "0bdc0c620e2fb15d2cc6fd056509d181", "src_uid": "ffeae332696a901813677bd1033cf01e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\ns1, s2, s3=map(int,input().split())\na = math.sqrt(s1 * s2 / s3)\nb = math.sqrt(s3 * s1 / s2)\nc = math.sqrt(s3 * s2 / s1)\nsum = a + b + c\nprint(int(4 * sum))\n", "lang_cluster": "Python", "tags": ["brute force", "math", "geometry"], "code_uid": "ae15b729b1eff9119ba682ae6a2af6a8", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import re\nimport sys\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom collections import Counter, defaultdict, deque\nfrom copy import deepcopy\nfrom decimal import Decimal\nfrom itertools import (\n    accumulate, combinations, combinations_with_replacement, groupby,\n    permutations, product)\nfrom math import (acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot,\n                  log2, pi, radians, sin, sqrt, tan)\nfrom operator import itemgetter, mul\nfrom string import ascii_lowercase, ascii_uppercase, digits\n\n\ndef inp():\n    return(int(input()))\n\n\ndef inlist():\n    return(list(map(int, input().split())))\n\n\ndef instr():\n    s = input()\n    return(list(s[:len(s)]))\n\n\ndef invr():\n    return(map(int, input().split()))\n\n\nx, y, z = invr()\na = int(sqrt((x*z)/y))\nc = z//a\nb = y//c\nprint(a*4+b*4+c*4)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "geometry"], "code_uid": "8062ccf247772d4827bb3499f2523af6", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\n\ndata = input().split()\n\nN, K = int(data[0]), int(data[1])\n\nposition_value = 0\nmax_counter = 0\n\nif K <= math.ceil(N/2):\n    print(K+(K-1))\nelse:\n    if K == N and K%2 != 0:\n        print(K-1)\n    elif (N%2 != 0 and K%2 == 0) or (N%2 != 0 and K%2 != 0):\n        print((K-(N-K))-1)\n    else:\n        print((K-(N-K)))\n\n\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "f1503ec92de8ceb9745350693f282cb5", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "number = input()\n\nnumber_list_form = number.split()\n\nn_range = int(number_list_form[0])\ndes_pos = int(number_list_form[1])\n\nif des_pos * 2 - 1 <= n_range:\n    print(des_pos * 2 - 1)\nelif des_pos * 2 > n_range and n_range % 2 == 0:\n    print((des_pos - (n_range // 2)) * 2)\nelif des_pos * 2 > n_range and n_range % 2 != 0:\n    print((des_pos - ((n_range // 2) + 1)) * 2)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "bb17f3fdf473b53c726f61b4441c709d", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n,i=map(int,raw_input().split())\nl1=[]\nl1=map(int, raw_input().split()[:n])\n\t\ncount =0\t\nfor o in l1:\n\tif o >=l1[i-1] and o>0:\n\t\tcount=count+1\t\n\telse:\n\t\tcontinue\n\t\t\nprint(count)\t\t\t\n\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "900c29edd2fb615b013d31bae8dad04b", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\n\n\ndef main():\n    n, k = map(int, sys.stdin.readline().split())\n    x = list(map(int, sys.stdin.readline().split()))\n    x.sort(reverse=True)\n    a = 0\n    for i in range(n):\n        if x[i] > 0 and x[i] >= x[k - 1]:\n            a += 1\n    print(a)\n\n\nmain()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "eab85004c2ef88888aa995dce6304235", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# http://codeforces.com/problemset/problem/272/A\n\nnumber_people = int(input())\nfingers = [int(x) for x in input().split()]\n\nsum_fingers = sum(fingers)\nfingers_hand = [1, 2, 3, 4, 5]\n# s = [0] * (n + 1)\ncounter = 0\n\nfor i in fingers_hand:\n    all_fingers = i + sum_fingers\n    while all_fingers > 0:\n        all_fingers -= (number_people + 1)\n        if all_fingers == 1:\n            counter += 1\n            break\n\nprint(5 - counter)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "3ea4ebe483f09849972e54f07158f8d3", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\ns = sum(map(int,raw_input().split()))\nj = 0\nfor i in range(0,5):\n\tif ( s + i + 1 ) % ( n + 1 ) != 1:\n\t\tj += 1\nprint j", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "a4ab27ff457a1a2ddaf521f496c5e542", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math, time, re\n\n\nln = lambda : raw_input()\ncnv = lambda s: map(int, s.split())\nrInt = lambda s: int(s)\nrFloat = lambda s: float(s)\nrLong = lambda s: long(s)\nrLine = lambda f: f.readline()\n\nl = cnv(ln())\na, b, c, d, e, f = l[0], l[1], l[2], l[3], l[4], l[5]\nif not 0 in l:\n    x = 1.0*b*d/c\n    y = x*f/e\n    #print y, a\n    if y<=a:\n        print 'Hermione'\n    else:\n        print 'Ron'\nelse:\n    if d == 0:\n        print 'Hermione'\n    else:\n        if c == 0:\n            print 'Ron'\n        else:\n            if b == 0:\n                print 'Hermione'\n            else:\n                if a == 0:\n                    print 'Ron'\n                else:\n                    if f == 0:\n                        print 'Hermione'\n                    else:\n                        if e == 0:\n                            print 'Ron'", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "bf1689c28a898aecc82098ed3239d51e", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a=map(int,raw_input().split())\n\nif not all(a[i] for i in range(6)[1::2]) and not (not a[2] and a[3]) and not (not a[0] and a[1]*a[2]*a[3]):\n    print \"Hermione\"\n    exit()\nif not all(a[i] for i in range(6)[::2]):\n    print \"Ron\"\n    exit()\nprint \"Ron\" if 1.*a[1]/a[0]*a[3]/a[2]*a[5]/a[4] > 1 else \"Hermione\"", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "6f79b7c90f1e94c983963d468996e2d4", "src_uid": "44d608de3e1447f89070e707ba550150", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\na = list(map(int, input().split()))\ncache = {}\nans = []\nfor i in range(n-1, -1, -1):\n\tif not cache.get(a[i]):\n\t\tans.append(a[i])\n\t\tcache[a[i]] = 1\nans.reverse()\nprint(len(ans))\nprint(*ans)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "e6954e43cafd3fd3d88c5b0649a65e71", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def answer():\n    n = int(input())\n    a = [int(x) for x in input().split()]\n    c = []\n    a.reverse()\n    for x in a:\n        if x not in c:\n            c.append(x)\n    i=0\n    ans=\"\"\n    c.reverse()\n    print(len(c))\n    while i<len(c):\n        ans+=str(c[i])\n        i+=1\n        if i!=len(c):\n            ans+=\" \"\n    return ans\nprint(answer())", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "34016aabb28a8d2ed8ec0c27a939464c", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b,c,d=map(int,raw_input().split())\nprint d*2-c if b*2==a+c and c*2==b+d else d*d/c if b*b==a*c and c*c==b*d and not d*d%c else 42", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b8aa5f34d62b4e4b5def036ac1938bf6", "src_uid": "68a9508d49fec672f9c61766d6051047", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b,c,d=map(int,input().split())\nr=42\nif b-a==c-b==d-c:r=d+b-a\nif b/a==c/b==d/c==int(d*c/b)/d:r=int(d*c/b)\nprint(r)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "6852f035c129228f14581a7d946dc66f", "src_uid": "68a9508d49fec672f9c61766d6051047", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#------------------------template--------------------------#\nimport os\nimport sys\nfrom math import *\nfrom collections import *\nfrom fractions import *\nfrom bisect import *\nfrom heapq import*\nfrom io import BytesIO, IOBase\ndef vsInput():\n    sys.stdin = open('input.txt', 'r')\n    sys.stdout = open('output.txt', 'w')\nBUFSIZE = 8192\nclass FastIO(IOBase):\n    newlines = 0\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\nALPHA='abcdefghijklmnopqrstuvwxyz'\nMOD=1000000007\ndef value():return tuple(map(int,input().split()))\ndef array():return [int(i) for i in input().split()]\ndef Int():return int(input())\ndef Str():return input()\ndef arrayS():return [i for i in input().split()]\n\n#-------------------------code---------------------------#\n# vsInput()\n\ncap=[0,1]\nfor i in range(2,101):\n    k=ceil(i/2)\n    k+=k-1\n    cap.append(cap[-1]+k)\n\ndef possible(x):\n\n    quad=x//2\n    load=cap[quad]\n\n    if(quad%2==0):\n        for i in range(quad*2+2):\n            rem=n-i\n            if(rem%4==0 and rem//4<=load):\n                return True\n    else:\n        quad-=1\n        for i in range(quad*2+2):\n            rem=n-i\n            if(rem%4==0 and rem//4<=load):\n                return True\n        quad+=1\n        rem=n-ceil(quad/2)*4\n        if(rem%4==0 and rem//4<=load-4):\n            return True\n    \n    return False\n\n\n    \n\nn=Int()\nif(n==2):\n    print(3)\n    exit()\n\nfor mid in range(1,100,2):\n\n    if(possible(mid)):\n        print(mid)\n        break\n\n\n        \n        \n\n\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["math", "binary search"], "code_uid": "aaab73c4cbde88cdc67c0e97d46b8127", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\"\"\"Z = [1<<62]*102\n\nM = []\n\ndef magic(i, j, n, s):\n\tif s > 100:\n\t\treturn\n\tZ[s] = min(Z[s], n)\n\tif j > (n+1)/2:\n\t\treturn magic(i+1, 1, n, s)\n\tif i > (n+1)/2:\n\t\treturn\n\tif M[i-1][j] == 0 and M[i][j-1] == 0:\n\t\tM[i][j] = 1\n\t\tt = 4\n\t\tif i == (n+1)/2:\n\t\t\tt /= 2\n\t\tif j == (n+1)/2:\n\t\t\tt /= 2\n\t\tmagic(i, j+1, n, s+t)\n\t\tM[i][j] = 0\n\tmagic(i, j+1, n, s)\n\nfor n in range(1, 12):\n\tM = [[0]*(n+2) for _ in range(n+2)]\n\tmagic(1, 1, n, 0)\n\tprint n\n\nprint Z\n\"\"\"\n\nZ = [1, 1, 3, 5, 3, 3]\nn = 8\nfor i in range(5, 16, 2):\n\tZ += [i]*n\n\tn += 4\n\nx = input()\nprint Z[x]\n", "lang_cluster": "Python", "tags": ["math", "binary search"], "code_uid": "51e980e753b81e8c7dac79db8a818a5b", "src_uid": "01eccb722b09a0474903b7e5abc4c47a", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n=input()\nz=0\nfor j in (100,20,10,5,1):\n    z+=n/j\n    n%=j\nprint z", "lang_cluster": "Python", "tags": ["greedy", "dp"], "code_uid": "03860d3178d4569bb09bb1ff15032b86", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nk=0\nfor i in [100, 20, 10, 5]:\n    k = k + n // i\n    n = n % i\nprint(k + n)", "lang_cluster": "Python", "tags": ["greedy", "dp"], "code_uid": "b81f7cb17f6026db6c6e274c80665a91", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nimport math\n#import random\nsys.setrecursionlimit(100000)\ninput = sys.stdin.readline\n \n############ ---- USER DEFINED INPUT FUNCTIONS ---- ############\ndef inp():\n    return(int(input()))\ndef inara():\n    return(list(map(int,input().split())))\ndef insr():\n    s = input()\n    return(list(s[:len(s) - 1]))\ndef invr():\n    return(map(int,input().split()))\n################################################################\n############ ---- THE ACTUAL CODE STARTS BELOW ---- ############\n\nn=inp()\nans=0\n\nwhile n:\n\tans+=1\n\tn//=2\n\nprint(ans)\n\t\t\t\n\t\n\t\t\t\n\t\t\t\n\t\t\t\n", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms"], "code_uid": "387f6d8173e2af30277ff7cce358e8b8", "src_uid": "95cb79597443461085e62d974d67a9a0", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\n\n\nclass CodeforcesTask1037ASolution:\n    def __init__(self):\n        self.result = ''\n        self.n = 0\n\n    def read_input(self):\n        self.n = int(input())\n\n    def process_task(self):\n        res = 0\n        while self.n >= 2 ** res:\n            self.n -= 2 ** res\n            res += 1\n        if self.n:\n            res += 1\n        self.result = str(res)\n\n    def get_result(self):\n        return self.result\n\n\nif __name__ == \"__main__\":\n    Solution = CodeforcesTask1037ASolution()\n    Solution.read_input()\n    Solution.process_task()\n    print(Solution.get_result())\n", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms"], "code_uid": "8176b716a1ee227c4541ed9ebfeba1a2", "src_uid": "95cb79597443461085e62d974d67a9a0", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "nn = raw_input().split()\nk = int(nn[0])#5\nn = int(nn[1])#3 6\nprint(k+n-(k%n))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "6b8b4da9b28cbd0d359bbfc00649a0e0", "src_uid": "75f3835c969c871a609b978e04476542", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,k = map(int, raw_input().strip().split(\" \"))\n\nprint ((n/k)+1)*k\n\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "3bd097a27c45eab74a5cdc1fd90c3731", "src_uid": "75f3835c969c871a609b978e04476542", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Sat Feb 22 14:50:02 2020\n\n@author: Lenovo\n\"\"\"\n\n\n#https://codeforces.com/problemset/problem/104/A\n\ndef black_jack():\n    card = int(input())\n    \n    needed = card - 10\n    \n    if needed >= 1 and needed <= 9:\n        print(4)\n        return\n    elif needed == 11:\n        print(4)\n        return\n    elif needed == 10:\n        print(15)\n        return\n    elif needed == 0 or needed > 11 or needed <= 0:\n        print(0)\n        return\n    \nblack_jack()\n    ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "7016013332450cb9183c2c2c0c443929", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=input()\nx=n-10\nres=0\nif x>0 and x<12:\n\tif x==10:\n\t\tres=15\n\telse:\n\t    res=4\nprint(res)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "6b77ca65136b1c18fb6153d7970cf591", "src_uid": "5802f52caff6015f21b80872274ab16c", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m = map(int,input().split())\r\ns = set()\r\nf=0\r\nwhile n!=0:\r\n    old_len = len(s)\r\n    s.add(n%m)\r\n    n = n//m\r\n    new_len = len(s)\r\n    if old_len==new_len:\r\n        print('NO')\r\n        f=1\r\n        break\r\nif f==0:\r\n    print('YES')", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "426ab2825da8b15bb93df4cca797cf03", "src_uid": "a8945bb1082fefe70e6898a8bec1ce3f", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# coding: utf-8\r\n\r\nn, m = map(int, input().split())\r\na = list()\r\n\r\nwhile n:\r\n  a.append(n % m)\r\n  n //= m\r\n  \r\nprint('YES') if len(a) == len(set(a)) else print('NO')", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "1060c50e35aad99d2cb08a1d59da1551", "src_uid": "a8945bb1082fefe70e6898a8bec1ce3f", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "\n\n# target Expert  \n\n# Author : raj1307 - Raj Singh\n# Date   : 22.07.19\n\nfrom __future__ import division, print_function\n\nimport os,sys\nfrom io import BytesIO, IOBase\n\nif sys.version_info[0] < 3:\n    from __builtin__ import xrange as range\n    from future_builtins import ascii, filter, hex, map, oct, zip\n\n\ndef ii(): return int(input())\ndef si(): return input()\ndef mi(): return map(int,input().strip().split(\" \"))\ndef li(): return list(mi())\n\ndef dmain():\n    sys.setrecursionlimit(100000000)\n    threading.stack_size(40960000)\n    thread = threading.Thread(target=main)\n    thread.start()\n    \n#from collections import deque, Counter, OrderedDict,defaultdict\n#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace\n#from math import ceil,floor,log,sqrt,factorial,pow,pi\n#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\n#from decimal import *,threading\n#from itertools import permutations\n\nabc='abcdefghijklmnopqrstuvwxyz'\nabd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}\nmod=1000000007\n#mod=998244353\nvow=['a','e','i','o','u']\ndx,dy=[-1,1,0,0],[0,0,1,-1]\ndef getKey(item): return item[0] \ndef sort2(l):return sorted(l, key=getKey)\ndef d2(n,m,num):return [[num for x in range(m)] for y in range(n)]\ndef isPowerOfTwo (x): return (x and (not(x & (x - 1))) )\ndef decimalToBinary(n): return bin(n).replace(\"0b\",\"\")\ndef ntl(n):return [int(i) for i in str(n)]\n\ndef powerMod(x,y,p):\n    res = 1\n    x %= p\n    while y > 0:\n        if y&1:\n            res = (res*x)%p\n        y = y>>1\n        x = (x*x)%p\n    return res\n\ndef gcd(x, y):\n    while y:\n        x, y = y, x % y\n    return x\n    \ndef isPrime(n) : # Check Prime Number or not \n    if (n <= 1) : return False\n    if (n <= 3) : return True\n    if (n % 2 == 0 or n % 3 == 0) : return False\n    i = 5\n    while(i * i <= n) : \n        if (n % i == 0 or n % (i + 2) == 0) : \n            return False\n        i = i + 6\n    return True\n\n\n\ndef read():\n    sys.stdin = open('input.txt', 'r')  \n    sys.stdout = open('output.txt', 'w') \n\n\nfrom math import factorial as f \ndef ncr(n,r):\n    if n < r: return 0\n    return f(n)//(f(n-r)*f(r))\n\n\n\n\ndef main():\n\n\n\n    #for _ in range(ii()):\n     \n    \n    s=['qwertyuiop','asdfghjkl;','zxcvbnm,./']\n\n    c=si()\n    a=list(si())\n    ans=''\n    if c=='L':\n        for i in a:\n            for j in range(3):\n                if i in s[j]:\n                    ans+=s[j][s[j].index(i)+1]\n                    break\n    else:\n        for i in a:\n            for j in range(3):\n                if i in s[j]:\n                    ans+=s[j][s[j].index(i)-1]\n                    break\n\n\n    print(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# region fastio\n\nBUFSIZE = 8192\n\n\nclass FastIO(IOBase):\n    newlines = 0\n\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\n\n\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n\n\ndef print(*args, **kwargs):\n    \"\"\"Prints the values to a stream, or to sys.stdout by default.\"\"\"\n    sep, file = kwargs.pop(\"sep\", \" \"), kwargs.pop(\"file\", sys.stdout)\n    at_start = True\n    for x in args:\n        if not at_start:\n            file.write(sep)\n        file.write(str(x))\n        at_start = False\n    file.write(kwargs.pop(\"end\", \"\\n\"))\n    if kwargs.pop(\"flush\", False):\n        file.flush()\n\n\nif sys.version_info[0] < 3:\n    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)\nelse:\n    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\n\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\n# endregion\n\n\nif __name__ == \"__main__\":\n    #read()\n    main()\n    #dmain()\n\n# Comment Read()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "5f143cfd0baf45f66a9a8464d30ba86f", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "z,zz=input,lambda:list(map(int,z().split()));\nszz,dgraphs,mod=lambda:sorted(zz()),{},10**9+7\nfrom string import *\nfrom collections import *\nfrom queue import *\nfrom sys import *\nfrom collections import *\nfrom math import *\nfrom heapq import *\nfrom itertools import *\nfrom bisect import *\nfrom collections import Counter as cc\nfrom math import factorial as f\nfrom bisect import bisect as bs\nfrom bisect import bisect_left as bsl\nfrom itertools import accumulate as ac\ndef lcd(xnum1,xnum2):return (xnum1*xnum2//gcd(xnum1,xnum2))\ndef prime(x):\n    p=ceil(x**.5)+1\n    for i in range(2,p):\n        if x%i==0 and x!=2:return 0\n    return 1\ndef dfs(u,visit,graph):\n    visit[u]=True\n    for i in graph[u]:\n        if not visit[i]:\n            dfs(i,visit,graph)\n\n###########################---Test-Case---#################################\n\"\"\"\n\n\n\n\n\"\"\"\n###########################---START-CODING---##############################\n\nl1=list('qwertyuiop')\nl2=list('asdfghjkl;')\nl3=list('zxcvbnm,./')\ns=''\n\n\n\nd=z()\nif d=='R':\n    p=-1\nif d=='L':\n    p=1\n    \n\n    \nl=list(z())\n\n\nfor i in l:\n    try:\n        t=l1.index(i)\n        s+=l1[t+p]\n    except:pass\n    try:\n        t=l2.index(i)\n        s+=l2[t+p]\n    except:pass\n    try:\n        t=l3.index(i)\n        s+=l3[t+p]\n    except:pass\n \n\n\n\n\n\n\n\n\n\n\nprint(s)\n\n\n        \n        \n        \n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "062b314b286a0edd54189dddbfa9d748", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\nf = [int(x) for x in input().split()]\nf.sort()\nx = []\n\nif n == m:\n    print(max(f) - min(f))\nelse:\n    for i in range(m - n+1):\n\n        x.append(abs(f[i] - f[i + n - 1]))\n    print(min(x))", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "97c62b43cf64a5a42e4c159e70d29784", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m = map(int,raw_input().strip().split())\na=map(int,raw_input().strip().split())\na.sort()\n#print a\ni=0\nsmall=a[n-1]-a[0]\nwhile(i+n<=m):\n    if a[n+i-1]-a[i]<small:\n        small=a[n+i-1]-a[i]\n\n    i+=1\n #   print small\nprint small", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "0a59ed366f81031cc91ca32e5a38fa8a", "src_uid": "7830aabb0663e645d54004063746e47f", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import floor,ceil\n\ndef find_possible_number(guess_number,digit,possible_table):\n    if digit==len(phone_numbers):#base condition\n        return 1\n    \n    m_number=int(phone_numbers[digit])\n    guess_number=int(guess_number)\n    \n    num_index_configuration=str(guess_number)+str(digit)    \n    if num_index_configuration in possible_table:\n        return possible_table[num_index_configuration]    \n    possible_table[num_index_configuration]=0\n    \n    has_remainder=(m_number+guess_number)%2\n    if has_remainder:\n        has_remainder_case(m_number, guess_number, possible_table, num_index_configuration, digit)\n        return possible_table[num_index_configuration]\n    else:\n        has_no_remainder_case(m_number, guess_number, possible_table, num_index_configuration, digit)\n        return possible_table[num_index_configuration]\n\n\ndef has_remainder_case(m_number, guess_number, possible_table, num_index_configuration, digit):\n    upper_number=ceil((m_number+guess_number)/2)\n    possible_table[num_index_configuration]+=find_possible_number(upper_number,digit+1,possible_table)\n    lower_number=floor((m_number+guess_number)/2)\n    possible_table[num_index_configuration]+=find_possible_number(lower_number,digit+1,possible_table)\n    \n    \ndef has_no_remainder_case(m_number, guess_number, possible_table, num_index_configuration, digit):\n    next_number=(m_number+guess_number)/2\n    possible_table[num_index_configuration]+=find_possible_number(next_number,digit+1,possible_table)\n\ndef has_exception(number):\n    for i in range(len(phone_numbers)-1): \n        if abs(int(phone_numbers[i])-int(phone_numbers[i+1]))<=1:\n            pass\n        else:\n            return False\n    return True\n\nphone_numbers=input()\npossible_table={}#with the format of [\"ab\"]=c. a for number, b for digit, c for possible ways\nfirst_number=phone_numbers[0]\ncount=0\nfor i in range(10):\n    count+=find_possible_number(i,1,possible_table)\nif has_exception(int(phone_numbers[0])):\n    count-=1\n\n#print(possible_table)\nprint(count)\n\n\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "eaf2a8fa9cb72f734b22fbf374844d95", "src_uid": "2dd8bb6e8182278d037aa3a59ca3517b", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s=[int(c) for c in input()]\nok=1\nfor i in range(1,len(s)):\n  if abs(s[i]-s[i-1])>1: ok=0; break\nw=[1]*10\nfor v in s[1:]:\n  ww=w[:]\n  w=[0]*10\n  for d in range(10):\n    q,r=divmod(v+d,2)\n    w[q]+=ww[d]\n    if r>0:\n      w[q+1]+=ww[d]\n\nprint(sum(w)-ok)      \n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "bce323c750f3e2a41cbd561b2ed418cb", "src_uid": "2dd8bb6e8182278d037aa3a59ca3517b", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#! /usr/bin/python\n\nx,y = map(int,raw_input().split())\n\nnx = 0\nny = 0\nstep = 1\nans = 0\nwhile True:\n    newx = nx + step\n    if y == ny and x >= nx and x <= newx:\n       break\n    ans += 1\n    nx = newx\n    newy = ny + step\n    if x == nx and y >= ny and y <= newy:\n       break\n    ans += 1\n    ny = newy\n    step += 1\n\n    newx = nx - step;\n    if y == ny and x >= newx and x <= nx:\n       break\n    ans += 1\n    nx = newx\n    newy = ny - step\n    if x == nx and y >= newy and y <= ny:\n        break\n    ans += 1\n    ny = newy\n    step += 1\n\nprint ans\n", "lang_cluster": "Python", "tags": ["brute force", "geometry", "implementation"], "code_uid": "f19360eac53b926a12048fcdbb657d70", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def followSpiral(pt):\n    if pt == (0, 0): return 0\n    if pt == (1, 0): return 0\n    if pt == (1, 1): return 1\n    corners = [pp, np, nn, pn] = [(1, 1), (0, 0), (0, 0), (1, 0)]\n    dirs = [(0, 1), (-1, 0), (0, -1), (1, 0)]\n    outer = [(1, 1), (-1, 1), (-1, -1), (1, -1)]\n    turns, count, pos, corner =  2, 0, pp, 1, \n    while True:\n        count += 1\n        x, y = pos\n        dx, dy = dirs[corner]\n        pos = x+dx, y+dy\n        if pos == pt: break\n        cx, cy = corners[corner]\n        ox, oy = outer[corner]\n        if pos == (cx+ox, cy+oy):\n            turns += 1\n            corners[corner] = (cx+ox, cy+oy)\n            corner = (corner+1)%4\n    return turns\n\n# IO:\ninp = raw_input()\npt = tuple(map(int, inp.split(' ')))\nprint(followSpiral(pt))\n", "lang_cluster": "Python", "tags": ["brute force", "geometry", "implementation"], "code_uid": "063b7efd446ecbd97baa1a71e4bb7c25", "src_uid": "2fb2a129e01efc03cfc3ad91dac88382", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = list(map(int,input().split()))\nif a[0] <= a[1] and a[0] <= a[2]:\n  print(\"Yes\")\nelse:\n  print(\"No\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "c7a646a1b94b6b444a9f76ae62685cb1", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m,k=map(int,input().split())\nif m<k:\n    if m>=n:\n        print('Yes')\n    else:\n        print('No')\nelif k<m:\n    if k>=n:\n        print('Yes')\n    else:\n        print('No')\nelif k==m:\n    if k>=n:\n        print('Yes')\n    else:\n        print('No')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b5993b62c79d458d67a263a349c9679f", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from bisect import bisect_left as bl\nfrom bisect import bisect_right as br\nfrom heapq import heappush,heappop,heapify\nimport math\nfrom collections import *\nfrom functools import reduce,cmp_to_key\nimport sys\ninput = sys.stdin.readline\n\nfrom itertools import accumulate, permutations\nfrom functools import lru_cache\n\nM = mod = 998244353\ndef factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))\ndef inv_mod(n):return pow(n, mod - 2, mod)\n \ndef li():return [int(i) for i in input().rstrip('\\n').split()]\ndef st():return input().rstrip('\\n')\ndef val():return int(input().rstrip('\\n'))\ndef li2():return [i for i in input().rstrip('\\n')]\ndef li3():return [int(i) for i in input().rstrip('\\n')]\n\n\nn = val()\nrock1, sci1, paper1 = li()\nrock2, sci2, paper2 = li()\n\ndef maximum():\n    ans = min(rock1, sci2) + min(sci1, paper2) + min(paper1, rock2)\n    return ans\n\ndef match(a, b):\n    if a == b:return 0\n    elif (a, b) in [(1, 2), (2, 3), (3, 1)]:return 1\n    else:return -1\n\ndef give(l1, l2):\n    ans = 0\n    curr1 = curr2 = 0\n    # print(l1, l2)\n    while l1 or l2:\n        try:\n            if 0 == curr1:curr1 = l1.pop()\n            if 0 == curr2:curr2 = l2.pop()\n        except:return ans\n\n        ans += max(0, min(curr1[0], curr2[0]) * match(curr1[1], curr2[1]))\n        # print(curr1, curr2)\n        if curr1[0] < curr2[0]:\n            curr2[0] -= curr1[0]\n            curr1 = 0\n        elif curr1[0] > curr2[0]:\n            curr1[0] -= curr2[0]\n            curr2 = 0\n        else:curr1 = curr2 = 0\n    # print(\"ANS FOR THIS : \", ans)\n    return ans    \n\n\n\n\n\n\n\n\ndef minimum():\n    ans = n\n    l = [[rock1, 1], [sci1, 2], [paper1, 3]]\n    l1 = [list(i) for i in list(permutations(l))]\n    l = [[rock2, 1], [sci2, 2], [paper2, 3]]\n    l2 = [list(i) for i in list(permutations(l))]\n\n\n    ans = float('inf')\n    for i in l1:\n        for j in l2:\n            mylist1 = [temp[:] for temp in i]\n            mylist2 = [temp[:] for temp in j]\n            ans = min(ans, give(mylist1, mylist2))\n\n    \n    return ans\n\n\n\nprint(minimum(), maximum())", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "math", "greedy"], "code_uid": "ea26fb1174f27601e8d68c246efec5d5", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\nimport itertools\n# testcases = int(sys.stdin.readline().strip())\nfrom functools import reduce\n\nn = int(sys.stdin.readline().strip())\n# input = list(map(int, sys.stdin.readline().strip().split()))\n# s = sys.stdin.readline().strip()\n# t = sys.stdin.readline().strip()\n\ninputA = list(map(int, sys.stdin.readline().strip().split()))\ninputB = list(map(int, sys.stdin.readline().strip().split()))\n\ninputA2 = inputA.copy()\ninputB2 = inputB.copy()\n\n\ndef getWonMaxFast(inputA, inputB):\n    wins = [0] * 3\n    for i in range(0, 3):\n        good = (i + 1) % 3\n        wins[i] = min(inputA[i], inputB[good])\n        inputA[i] -= wins[i]\n        inputB[good] -= wins[i]\n    return sum(wins)\n\n\ndef getLostMaxFast(inputA, inputB):\n    waysToLose = [[0, 2], [1, 0], [2, 1], [0, 0], [1, 1], [2, 2]]\n\n    allWaysToLosePermutations = list(itertools.permutations(waysToLose))\n\n    maxLost = 0\n\n    for permutation in allWaysToLosePermutations:\n        losts = [0] * 3\n        inputACopy = inputA.copy()\n        inputBCopy = inputB.copy()\n\n        for wayToLose in permutation:\n            lost_add = min(inputACopy[wayToLose[0]], inputBCopy[wayToLose[1]])\n            inputACopy[wayToLose[0]] -= lost_add\n            inputBCopy[wayToLose[1]] -= lost_add\n            losts[wayToLose[0]] += lost_add\n\n        lostSum = sum(losts)\n        \n        if lostSum > maxLost:\n            maxLost = lostSum\n\n    return maxLost\n\n\nprint(n - getLostMaxFast(inputA2, inputB2), getWonMaxFast(inputA, inputB))\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "math", "greedy"], "code_uid": "334318db5af41d2fc03f927310ced640", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    turnNum = int(input())\n    # choices include rock, scissor, paper respectively\n    aliceChoices = list(map(int, input().split(' ')))\n    bobChoices = list(map(int, input().split(' ')))\n    \n    bobChoices.append(bobChoices.pop(0))\n    minWin, maxWin = [0, 0]\n    \n    # calculate the maximum number of rounds Alice can win\n    for i, choice in enumerate(aliceChoices):\n        maxWin += min([choice, bobChoices[i]])\n        \n    # calculate the minimum number of rounds Alice can win\n    maximum = max(bobChoices)\n    for i, choice in enumerate(bobChoices):\n        if choice == maximum and choice + aliceChoices[i] > minWin:\n            minWin = choice + aliceChoices[i]\n    maximum = max(aliceChoices)\n    for i, choice in enumerate(aliceChoices):\n        if choice == maximum and choice + bobChoices[i] > minWin:\n            minWin = choice + bobChoices[i]\n    minWin = minWin - turnNum if minWin > turnNum else 0\n    print(f'{minWin} {maxWin}')\n\nif __name__ == '__main__':\n    main()", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "math", "greedy"], "code_uid": "1283b91b3ef4492ddf28b1e12d4a0932", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\n# get the number of round as n\n# get the amount of first person take rock paper scissors as r1 s1 p1 as follow\n# get the amount of second person take rock paper scissors as r2 s2 p2 as follow\n# how to win ? r1_s2 p1_r2 s1_p2\n\n\nround = int(input())\nfirstperson = input().split(\" \")\nsecondperson = input().split(\" \")\n\n\ndef solve(round, firstperson, secondperson) :\n\n    # find mix win\n    win = 0\n    secondperson.append(secondperson[0])\n    for i in range(len(firstperson)) :\n        if int(firstperson[i]) <= int(secondperson[i+1]) :\n            findless = int(firstperson[i])\n        else :\n            findless = int(secondperson[i+1])\n        win += findless\n\n    del secondperson[3]\n\n    #find min win\n    secondperson.insert(0, secondperson[2])\n\n    for i in range(len(firstperson)) :\n        if int(firstperson[i]) > 0:\n            diff = min(int(firstperson[i]), int(secondperson[i]))\n            firstperson[i] = int(firstperson[i]) - int(diff)\n            secondperson[i] = int(secondperson[i]) - int(diff)\n            if int(firstperson[i]) > 0:\n                diff = min(int(firstperson[i]), int(secondperson[i+1]))\n                firstperson[i] = int(firstperson[i]) - int(diff)\n                secondperson[i+1] = int(secondperson[i+1]) - int(diff)\n\n    print(str(int(firstperson[0]) + int(firstperson[1]) + int(firstperson[2])) + \" \" + str(win))\n\n\nsolve(round, firstperson, secondperson)\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "math", "greedy"], "code_uid": "0860f3fcb0388fb5efd0f969b0fee984", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin, stdout\nimport math\nimport heapq\nimport collections\ninput = stdin.readline\ndef inputnum():\n    return(int(input()))\ndef inputnums():\n    return(map(int,input().split()))\ndef inputlist():\n    return(list(map(int,input().split())))\ndef inputstring():\n    return([x for x in input()])\ndef inputstrings():\n    return([x for x in input().split()])\ndef inputstringnum():\n    return([ord(x)-ord('a') for x in input()])\ndef inputmatrixchar(rows):\n    arr2d = [[j for j in input().strip()] for i in range(rows)] \n    return arr2d\ndef inputmatrixint(rows):\n    arr2d = []\n    for _ in range(rows):\n        arr2d.append([int(i) for i in input().split()])\n    return arr2d\n\nn = inputnum()    \na1, a2, a3 = inputnums()\nb1, b2, b3 = inputnums()\nmn = min(a1, b1+b3) + min(a2, b2+b1) + min(a3, b3+b2)\nmx = min(a1, b2) + min(a2, b3) + min(a3, b1)\nprint(n-mn, mx)", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "math", "greedy"], "code_uid": "bbdf7cfbf812ebd93c27d779fb039f7f", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\nimport math\nimport itertools\t\noriginal_stdout = sys.stdout\n\nvar_for_sublime = False \n\n\nif var_for_sublime:\n\tfin = open('input.txt' , 'r')\n\tfout = open('output.txt' , 'w')\n\tsys.stdout = fout\n\tdef give_string():\n\t\treturn fin.readline().strip()\nelse:\n\tfin = sys.stdin \n\tfout = sys.stdout\n\tdef give_string():\n\t\treturn fin.buffer.readline().strip()\n\ndef give_list():\n\treturn list(map(int, give_string().split()))\ndef give_int():\n\treturn int(give_string())\n\n\nMOD = 1e9+ 7\ndef modpow( a , p) :\n\tans = 1 \n\twhile p :\n\t\tif p&1 :\n\t\t\tans *= a \n\t\t\tans %= MOD \n\t\tp >>= 1\n\t\ta *= a\n\t\ta %= MOD\n\treturn ans \t\t\n\n\n\ndef fac_cal(n):\n\tans = 1\n\tfor i in range(1 , n+1):\n\t\tans *= i \n\t\tans %= MOD \n\treturn ans \n\n\n\n\n\ndef solve():\n\tt = 1\n\tl = list(itertools.permutations([1 ,2 ,3, 4,5,6]))\n\tn = give_int()\n\ta1 ,a2 ,a3 = give_list()\n\tb1 , b2 , b3 = give_list()\n\tmx = min(a1 , b2) + min(a2 , b3) + min(a3 , b1)\n\ttemp = 0\n\tfor per in l :\n\t\tta1 ,ta2 , ta3 , tb1 , tb2 ,tb3 = a1 , a2 , a3 , b1 ,b2 , b3\n\t\ttmx = 0 \n\t\tfor el in per :\n\t\t\tif el == 1:\n\t\t\t\tt1 = min(ta1 , tb1)\n\t\t\t\tta1 -= t1 \n\t\t\t\ttb1 -= t1 \n\t\t\t\ttmx += t1 \n\t\t\telif el == 2:\n\t\t\t\tt1 = min(ta1 , tb3)\n\t\t\t\tta1 -= t1\n\t\t\t\ttb3 -= t1 \n\t\t\t\ttmx += t1 \n\t\t\telif el == 3:\n\t\t\t\tt1 = min(ta2 , tb2)\n\t\t\t\tta2 -= t1 \n\t\t\t\ttb2 -= t1 \n\t\t\t\ttmx += t1 \n\t\t\telif el==4:\n\t\t\t\tt1 = min(ta2 , tb1)\n\t\t\t\ttb1 -= t1 \n\t\t\t\tta2 -= t1\n\t\t\t\ttmx += t1 \n\t\t\telif el== 5:\n\t\t\t\tt1 = min(ta3 , tb3)\n\t\t\t\tta3 -= t1 \n\t\t\t\ttb3 -= t1 \n\t\t\t\ttmx += t1 \n\t\t\telif el ==6:\n\t\t\t\tt1 = min(ta3 , tb2)\n\t\t\t\ttb2 -= t1 \n\t\t\t\tta3 -= t1\n\t\t\t\ttmx += t1 \n\t\ttemp = max(temp , tmx)\n\tprint(n-temp , end = ' ')\n\tprint(mx)\n\ndef Hey_Yashwant():\n\ttry :\n\t\tt = 1 \n\t\t# t = give_int()\n\t\tfor i in range(t):\n\t\t\tsolve()\n\tfinally:\n\t\tfin.close()\n\t\tfout.close()\n\t\tsys.stdout = original_stdout\n\n\n\n\n\nif __name__ == '__main__' :\n\tHey_Yashwant()", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "math", "greedy"], "code_uid": "6bfdc6e8dc389a3a5011fbe2f8a2fb29", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\n\ndef input(): return sys.stdin.readline().strip()\ndef list2d(a, b, c): return [[c for j in range(b)] for i in range(a)]\ndef list3d(a, b, c, d): return [[[d for k in range(c)] for j in range(b)] for i in range(a)]\ndef list4d(a, b, c, d, e): return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]\ndef ceil(x, y=1): return int(-(-x // y))\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\ndef Yes(): print('Yes')\ndef No(): print('No')\ndef YES(): print('YES')\ndef NO(): print('NO')\nINF = 10**19\nMOD = 10**9 + 7\nEPS = 10**-10\n\nclass Dinic:\n\n    INF = 10**18\n\n    def __init__(self, n):\n        self.n = n\n        self.links = [[] for _ in range(n)]\n        self.depth = None\n        self.progress = None\n        self.pos = []\n\n    def copy(self):\n        res = Dinic(self.n)\n        res.links = [[a[:] for a in b] for b in self.links]\n        res.pos = [a[:] for a in self.pos]\n        return res\n\n    def add_edge(self, _from, to, cap):\n        self.pos.append((_from, len(self.links[_from])))\n        self.links[_from].append([cap, to, len(self.links[to])])\n        self.links[to].append([0, _from, len(self.links[_from]) - 1])\n\n    def bfs(self, s):\n        from collections import deque\n\n        depth = [-1] * self.n\n        depth[s] = 0\n        q = deque([s])\n        while q:\n            v = q.popleft()\n            for cap, to, _ in self.links[v]:\n                if cap > 0 and depth[to] < 0:\n                    depth[to] = depth[v] + 1\n                    q.append(to)\n        self.depth = depth\n\n    def dfs(self, v, t, flow):\n        if v == t:\n            return flow\n        links_v = self.links[v]\n        for i in range(self.progress[v], len(links_v)):\n            self.progress[v] = i\n            cap, to, rev = link = links_v[i]\n            if cap == 0 or self.depth[v] >= self.depth[to]:\n                continue\n            d = self.dfs(to, t, min(flow, cap))\n            if d == 0:\n                continue\n            link[0] -= d\n            self.links[to][rev][0] += d\n            return d\n        return 0\n\n    def flow(self, s, t):\n        INF = Dinic.INF\n        flow = 0\n        while True:\n            self.bfs(s)\n            if self.depth[t] < 0:\n                return flow\n            self.progress = [0] * self.n\n            current_flow = self.dfs(s, t, INF)\n            while current_flow > 0:\n                flow += current_flow\n                current_flow = self.dfs(s, t, INF)\n\n    def get_edge(self, i):\n        e = self.links[self.pos[i][0]][self.pos[i][1]]\n        re = self.links[e[1]][e[2]]\n        # from, to, cap, flow\n        return (self.pos[i][0], e[1], e[0]+re[0], re[0])\n\n    def get_edges(self):\n        M = len(self.pos)\n        res = []\n        for i in range(M):\n            res.append(self.get_edge(i))\n        return res\n\nN = INT()\nM = 3\nA = LIST()\nB = LIST()\n\nans1 = 0\nfor i in range(M):\n    ans1 += min(A[i], B[(i+1)%M])\n\nans2 = 0\ndinic = Dinic(2*M+2)\ns = 2*M\nt = 2*M + 1\nfor i in range(M):\n    # s to Alice\n    dinic.add_edge(s, i, N)\n    # Bob to t\n    dinic.add_edge(M+i, t, B[i])\n    # draw\n    dinic.add_edge(i, M+i, A[i])\n    # Alice lose\n    dinic.add_edge(i, M+(i-1)%M, A[i])\nans2 = N - dinic.flow(s, t)\n\nprint(ans2, ans1)\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "math", "greedy"], "code_uid": "ad67d7739934311fa8e87d7557333e49", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=input()\nif len(n)==1:\n    print(0)\nelif n[::-1]!=n:\n    print(len(n))\nelse:\n    while True:\n        n=n[:-1]\n        s=n[::-1]\n        if s!=n:\n            print(len(s))\n            break\n        elif len(s)==1:\n            print(0)\n            break\n        ", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "95dc77a26c01931141afa5a8fb028f6e", "src_uid": "6c85175d334f811617e7030e0403f706", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = input()\nans = 0\nb = a\nfor i in range(len(a)):\n\tif a == a[::-1]:\n\t\tb = a[i:]\n\t\tif b != b[::-1]:\n\t\t\tans = len(a)-i\n\t\t\tbreak\n\telif a != a[::-1]:\n\t\tans = len(a)\n\telif a[i]==a[i-1]:\n\t\tans  = 0\nprint(ans)\n", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "ddf7238bb15ce3de36899766b3bb2b43", "src_uid": "6c85175d334f811617e7030e0403f706", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "'''input\n3 3\n'''\n\n# a + b = a^b + (a&b)*2\ns, x = map(int, raw_input().split())\nd = s-x  # d/2 is a&b\n\nif d%2 or (d/2 & x):\n    print 0\nelse:\n    print 2**bin(x).count('1') - (0 if d else 2)\n", "lang_cluster": "Python", "tags": ["math", "dp"], "code_uid": "f92ab251a194ef0b8f48269890015c6a", "src_uid": "18410980789b14c128dd6adfa501aea5", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# coding: utf-8\n\ni = raw_input().split(\" \")\nm = long(i[0])\np = long(i[1])\nx = p\ndif = m-x\nif (dif%2==1 or x> m):\n\tprint(0)\nelse:\n\tdif = dif/2\n\ts = \"\"\n\twhile (dif != 0):\n\t\tif (dif%2==1):\n\t\t\tdif -= 1\n\t\t\ts += \"1\"\n\t\telse:\n\t\t\ts += \"0\"\n\t\tdif /= 2\n\tind = 0\n\tst = \"\"\n\tn = long(1)\n\tth = True\n\twhile (x != 0):\n\t\tif (x%2==1):\n\t\t\tx -= 1\n\t\t\tst += \"1\"\n\t\t\tn = long(n*long(2))\n\t\telse:\n\t\t\tst += \"0\"\n\t\tx /= 2\n\t\tif (ind < len(s) and s[ind] == \"1\" and \"1\" == st[ind]):\n\t\t\tth = False\n\t\t\tbreak\n\t\tind += 1\n\tif (th):\n\t\tif (m == p):\n\t\t\tprint(long(n-2))\n\t\telse:\n\t\t\tprint(long(n))\n\telse:\n\t\tprint(0)", "lang_cluster": "Python", "tags": ["math", "dp"], "code_uid": "d6b9a1d99ba78951149391e98d50d8d1", "src_uid": "18410980789b14c128dd6adfa501aea5", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m, a, b = [int(x) for x in input().split()]\nprint(min((n - n // m * m) * b, ((n // m + 1) * m - n) * a))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "5791055ced757567ee07dde9cd6c55cc", "src_uid": "c05d753b35545176ad468b99ff13aa39", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\ns = input().split()\nfor i in range(4):\n    s[i] = int(s[i])\nprint(min((s[1]-s[0]%s[1])*s[2],(s[0]%s[1])*s[3]))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "c04b84f7ce8ac87b89a7ae65fb9a8c4e", "src_uid": "c05d753b35545176ad468b99ff13aa39", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "t = input()\nl = []\nfor i in range(10):\n\tt1 = input()\n\tl.append(t1)\nfor i in range(10,90,10):\n\tfor j in range(len(l)):\n\t\tif t[i-10:i] == l[j]:\n\t\t\tprint(j,end=\"\")\n\t\t\tbreak", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "657a9cf0df546e5124a1b8370f6ca2db", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "c=[input() for i in range(11)]\nx=[ c[0][i:i+10]     for i in range(0,80,10)]\nfor i in x:\n    print(c.index(i)-1,end='')\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "1b9f14a32d709394224c3b89eaf2e06c", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,l,r = map(int,input().split())\nprint((n-l)+(2**l-1), (2**(r-1))*(n-r)+2**r-1)\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "a6002157afdd6e54ed85b6bd4aafad8f", "src_uid": "ce220726392fb0cacf0ec44a7490084a", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,l,r=map(int,input().split())\nx=1\n \nsum1=0\nsum2=0\n \nfor i in range(l) :\n    sum1+=x\n    x=x*2\nfor i in range(n-l) :\n    sum1+=1\n \nx=1\nfor i in range(r) :\n    sum2+=x\n    x*=2\nx=x//2\n \nfor i in range(n-r) :\n    sum2+=x\nprint(sum1,sum2,sep=\" \")", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "927949c8577a5963f489545b9f1e8e02", "src_uid": "ce220726392fb0cacf0ec44a7490084a", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def fall_fac(n,k):\n\tans = 1\n\tfor i in range(k):\n\t\tans *= n-i\n\treturn ans\ndef C(n,k):\n\tif not(0 <= k <= n):\n\t\treturn 0\n\telse:\n\t\treturn fall_fac(n,k)//fall_fac(k,k)\ndef derangement(n):\n\tif n==0:\n\t\treturn 1\n\telif n==1:\n\t\treturn 0\n\telse:\n\t\treturn (n-1)*(derangement(n-1)+derangement(n-2))\nn, k = [int(x) for x in input().split()]\nprint(sum([C(n,i)*derangement(i) for i in range(k+1)]))", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "96a5aa70d4cba5bba1f56049abec39f7", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "c = 1\n\nn, k =map(int, input().split())\n\nif k >= 2 :\n\ttmp = 1\n\tfor i in range(3,n+1):\n\t\ttmp *= i\n\tfor i in range(2,n-1):\n\t\ttmp = tmp // i\n\tc += tmp\n\nif k >= 3 :\n\ttmp = 1\n\tfor i in range(4,n+1):\n\t\ttmp *= i\n\tfor i in range(2,n-2):\n\t\ttmp = tmp // i\n\tc += tmp*2\n\nif k == 4 :\n\ttmp = 1\n\tfor i in range(5,n+1):\n\t\ttmp *= i\n\tfor i in range(2,n-3):\n\t\ttmp = tmp // i\n\tc += tmp*9\n\nprint(c)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "f5129b689ceb1e48f2f66e68838ec6a9", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b,s=map(int,raw_input().split())\nt=abs(a)+abs(b)\nif (t-s)&1==1 or s<t:\n    print \"NO\"\nelse:\n    print \"YES\"\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "353a41628a7fd30e1eaf99e12f2eb3d4", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a, b, s = map(int, input().split())\na = abs(a)\nb = abs(b)\n\nif s < a + b:\n\tprint('No')\nelif (s - a - b) % 2 == 0:\n\tprint('Yes')\nelse:\n\tprint('No')", "lang_cluster": "Python", "tags": ["math"], "code_uid": "1584f93103b407bfb48bfa004cf807b7", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "l=list(input())\nif(len(l)<=3 and int(\"\".join(l))>(-129) and int(\"\".join(l))<=127):\n    print(\"byte\")\nelif(len(l)<=5 and int(\"\".join(l))>(-32769) and int(\"\".join(l))<=32767):\n    print(\"short\")\nelif(len(l)<=10 and int(\"\".join(l))>(-2147483649) and int(\"\".join(l))<=2147483647):\n    print(\"int\")\nelif(len(l)<=19 and int(\"\".join(l))>(-9223372036854775809 ) and int(\"\".join(l))<=9223372036854775807 ):\n    print(\"long\")\nelse:\n    print(\"BigInteger\")\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "16d1aab93cef1d64a9089afe23ef8920", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\nif n <= 127:\n    print 'byte'\nelif n <= 32767:\n    print 'short'\nelif n <= 2147483647:\n    print 'int'\nelif n <= 9223372036854775807:\n    print 'long'\nelse:\n    print 'BigInteger'", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "7e6a0c677ccf2c27b2370463b3fdf03b", "src_uid": "33041f1832fa7f641e37c4c638ab08a1", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b, c, d, x, y = map(int, raw_input().split())\nprint sum(v % a % b % c % d == v for v in range(x, y + 1))", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "bfbc9c98ab8ab5111e2411818f060076", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a=map(int,raw_input().split())\nprint max(0,min(a[:4]+[a[-1]+1])-a[-2])\n", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "3bab0a44fd2b73ffc49a7979b9f58607", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a=input()\ns=b=0\nfor i in a:\n    if i.isupper():s+=1\n    else:b+=1\nif s<=b:print(a.lower())\nelse:print(a.upper())\n\n    ", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "5aafb7232ff87dab11242f7703eaecbd", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "input_string=raw_input()\nstr_len = len(input_string)\n\nupper=[i for i in input_string if i.isupper()]\n\nif len(upper)>str_len/2:\n\tprint input_string.upper()\nelse:\n\tprint input_string.lower()\t", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "702e8febe9911586bffb61d84f03ad3f", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "__author__ = 'Devesh Bajpai'\n\n'''\nhttps://codeforces.com/problemset/problem/581/A\n\nSolution: \n'''\n\n\ndef solve(a, b):\n\n    diff_sock_days = min(a, b)\n    same_sock_days = (max(a, b) - diff_sock_days) / 2\n\n    return str(diff_sock_days) + \" \" + str(same_sock_days)\n\n\nif __name__ == \"__main__\":\n\n    a, b = map(int, raw_input().split(\" \"))\n    print solve(a, b)\n\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "e2a8804765f10555c208e2d20aa907d0", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b=map(int,raw_input().split(' '))\nprint min(a,b),abs(a-b)/2", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "e41ca8e9d6e27c5d6086a3c82f013d07", "src_uid": "775766790e91e539c1cfaa5030e5b955", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m = [int(i) for i in input().split()]\nk = 0\nwhile n>=2 and m>=1 or n>=1 and m>=2:\n    if m>n: m,n,k = m-2,n-1,k+1\n    else: m,n,k = m-1,n-2,k+1\nprint(k)", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation", "number theory"], "code_uid": "a88fce4f723db0cb437e545dfb762d27", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, e = map(int, input().split())\ngroups = 0\nsmall = min(n, e)\nbig = max(n, e)\nfor i in range(big):\n    if big >= 2 and small >= 1:\n        groups += 1\n        big -= 2\n        small -= 1\n    elif big >= 1 and small >= 2:\n        groups += 1\n        big -= 1\n        small -= 2\n    else:\n        break\n    #print(small, big)\n    a = small\n    b = big\n    small = min(a, b)\n    big = max(a, b)\n    #print(small, big)\n    #print(\"\\n\")\nprint(groups)\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation", "number theory"], "code_uid": "488819d35b104a525d421ce5067a1dc9", "src_uid": "0718c6afe52cd232a5e942052527f31b", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "l = map(int,raw_input().split(' '))\nl.sort()\nresult  =  sum(l)/3\nif l[1]+l[0]<result:\n    result = l[1]+l[0]\nprint result", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "8b514ea715f996c7415fb537de44582b", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nr,g,b=map(int,input().split(\" \"))\nli = [r,g,b]\nli.sort()\nif(li[2]>2*(sum(li)-li[2])):\n    print(sum(li)-li[2])\nelse:\n    print(sum(li)//3)\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "69cb4e6d85e45cca1422506143321279", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys,math\nfrom math import factorial as fact\nfrom collections import defaultdict as dd\ninput = lambda: sys.stdin.readline().strip()\ninp = lambda: list(map(int,input().split()))\nmod = 10**9+7\n#---------------------------------------------------\ndef C(n,r):\n    if r>n:\n        return 0\n    return fact(n)//(fact(n-r)*fact(r))\ndef P(n,r):\n    # if n==0:\n    #     return 0\n    if r>n:\n        return 0\n    return fact(n)//fact(n-r)\n# for _ in range(int(input())):\nn , x, pos = inp()\na = [i for i in range(n)]\ng = 0\nl = 0\ndef bins(a,x,n):\n    global g,l\n    left = 0\n    right = n\n    while (left<right):\n        mid = (left+right)//2\n        if a[mid]==x:\n            left = mid+1\n        elif a[mid]<x:\n            left = mid+1\n            l+=1\n        else:\n            right = mid\n            g+=1\n    if left>0 and a[left-1]==x:\n        return\n    else:\n        return\nbins(a,pos,n)\ndc = n-g-l-1\nactg = n-x\nactl = x-1\n# print(g,l,actl,actg,dc)\n# print(dc)\nans = P(actg,g)*P(actl,l)*P(n-g-l-1,dc)\nprint(ans%mod)", "lang_cluster": "Python", "tags": ["binary search", "combinatorics"], "code_uid": "c54284d6c3ec238e16f7f85287ebce00", "src_uid": "24e2f10463f440affccc2755f4462d8a", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# Legends Always Come Up with Solution\n# Author: Manvir Singh\n\nimport os\nfrom io import BytesIO, IOBase\nimport sys\nfrom collections import defaultdict,deque,Counter\nfrom bisect import *\nfrom math import sqrt,pi,ceil,log\nimport math\nfrom itertools import permutations\nfrom copy import deepcopy\nfrom sys import setrecursionlimit\n\n\ndef main():\n    n,x,pos = map(int,input().split())\n    mod=10**9+7\n    f=[1]\n    for i in range(1,1001):\n        f.append((f[-1]*i)%mod)\n    lo=0\n    hi=n\n    b=x-1\n    c=n-x\n    ans=1\n    while lo<hi:\n        mid=(lo+hi)//2\n        if mid<pos:\n            ans=(ans*b)%mod\n            b-=1\n            lo=mid+1\n        elif mid>pos:\n            ans=(ans*c)%mod\n            c-=1\n            hi=mid\n        else:\n            lo=mid+1\n    print((ans*f[b+c])%mod)\n\n\n# region fastio\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n    newlines = 0\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\n\n\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n\n\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\nif __name__ == \"__main__\":\n    main()", "lang_cluster": "Python", "tags": ["binary search", "combinatorics"], "code_uid": "03f8e2665b79ce1705002fcf7888a3a7", "src_uid": "24e2f10463f440affccc2755f4462d8a", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\na=int(n/10)\nb=n%10\nif(a==1 or a==7 or a==2 or a==9 or b==1 or b==7 or b==9):\n    if(a==1 and b==2):\n        print('YES')\n    else:\n        print('NO')\nelse:\n    print('YES')", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "9e92e0db96bc63e43bf5528eaec8dac1", "src_uid": "821529a4644b74483bcdf80fc318d1f8", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "num2words = {1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', \\\n             6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine', 10: 'Ten', \\\n            11: 'Eleven', 12: 'Twelve', 13: 'Thirteen', 14: 'Fourteen', \\\n            15: 'Fifteen', 16: 'Sixteen', 17: 'Seventeen', 18: 'Eighteen', \\\n            19: 'Nineteen', 20: 'Twenty', 30: 'Thirty', 40: 'Forty', \\\n            50: 'Fifty', 60: 'Sixty', 70: 'Seventy', 80: 'Eighty', \\\n            90: 'Ninety', 0: 'Zero'}\ndef n2w(n):\n    if n <= 20:\n        return num2words[n].lower()\n    return num2words[n-n%10].lower() + num2words[n%10].lower()\n\nn = int(input())\nprint('YES' if 'n' not in n2w(n) else 'NO')\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "3b1bb23549d8482c2e7f58070a0db089", "src_uid": "821529a4644b74483bcdf80fc318d1f8", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def nir(n):\n    if n < 10:\n        return max(1,n)\n    else:\n        p = nir(n//10)*(n%10)\n        q = nir(n//10-1)*9\n        return max(p,q)\n\nn = int(input())\nans = nir(n)\nprint(ans)", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "353d280a6960ff6c92f7132d817244b8", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def getMax(num):\n    arr = list(num)\n    prod = 1\n    for a in arr:\n        prod = prod*int(a)\n    return prod\n\nn = input()\nnum = list(n)\n\ni = len(n)-1\nmaxP = getMax(n)\n\nif len(n) > 1:\n    while i>0:\n        num[i] = '9'\n        while int(num[i-1]) == 0:\n            num[i-1] = '9'\n            i = i - 1\n        if int(num[i-1]) > 1:\n            num[i-1] = str(int(num[i-1]) - 1)\n\n        #print(num)\n        maxP = max(getMax(''.join(num)),maxP)\n        i = i-1\n    print(maxP)\nelse:\n    print(n)\n\"\"\"\n\n\n\n\nminNum = num[:]\nminNum[0]  = int(minNum[0]) - 1\nminNum[0] = str(minNum[0])\nfor i in range(1,len(minNum)):\n    minNum[i] = '9'\n\nminN = ''.join(minNum)\nminN = int(minN)\nn = int(n)\n\nmaxP = 0\nfor a in range(minN,n+1):\n    maxP = max(getMax(str(a)),maxP)\nprint(maxP)\n\n\"\"\"", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "65dfca28344f0447b39c3dc04b7b60d4", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def getPow(data,a):\r\n    left = 0\r\n    right = data\r\n    while left <= right:\r\n        mid = (left+right)//2\r\n        if (mid**a)<data:\r\n            left = mid + 1\r\n        elif (mid**a)==data:\r\n            return mid\r\n        else:\r\n            right = mid - 1\r\n    return left-1\r\n\r\ndef tack():\r\n    data = int(input())\r\n    squ = getPow(data,2)\r\n    cube = getPow(data,3)\r\n    six = getPow(data,6)\r\n    ans = squ + cube - six\r\n    print(ans)\r\n\r\n\r\ndef main():\r\n    n = int(input())\r\n    for x in range(n):\r\n        tack()\r\n\r\n\r\nmain()\r\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "456aa2113a4810074ee8e12eac4f42f5", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\r\nfrom collections import *\r\nsys.setrecursionlimit(10**5)\r\nitr = (line for line in sys.stdin.read().strip().split('\\n'))\r\nINP = lambda: next(itr)\r\ndef ni(): return int(INP())\r\ndef nl(): return [int(_) for _ in INP().split()]\r\n\r\n\r\nimport math\r\ndef solve(n):\r\n    seen = {}\r\n    #print(int(math.floor(math.sqrt(n))) + 1)\r\n    #print(low)\r\n    for i in range(1,int(math.floor(math.sqrt(n)))+ 1):\r\n        a, b = i ** 2, i ** 3\r\n        #print(i)\r\n        if a not in seen:\r\n            seen[a] = True\r\n        if b <= n and b not in seen:\r\n            seen[b] = True\r\n    #print()\r\n    print(len(seen.keys()))\r\n\r\n\r\nt = ni()\r\nfor case in range(t):\r\n    n = ni()\r\n    solve(n)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "d04039e3ecd34d6383c08bf17d200934", "src_uid": "015afbefe1514a0e18fcb9286c7b6624", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/python\n\ndef ir():\n    return int(raw_input())\n\ndef ia():\n    line = raw_input()\n    line = line.split()\n    return map(int, line)\n\ndef solve():\n    n, tm = ia()\n    a = ia()\n\n    s = sum(a)\n    j = (n - 1)*10\n\n    if s + j>tm:\n        print -1\n        return\n\n    rem = tm - (s + j)\n    ej  = rem / 5\n\n    print 2*(n - 1) + ej\n    \nsolve()\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "2b4b8f7b32c417fbcca776cbb6546647", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "t=list(map(int,input().split()))\ns=list(map(int,input().split()))\nsum=i=0\nfor i in range(t[0]):\n    sum=sum+s[i]\n    if i !=t[0]-1:\n        sum=sum+10\nif sum<=t[1]:\n    print((t[0]-1)*2+int((t[1]-sum)/5))\nelse:\n    print(-1)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "35088a589c84bc57dd606ff4ced20e15", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input()\nif len(set(s)) % 2 == 0:\n    print \"CHAT WITH HER!\"\nelse:\n    print \"IGNORE HIM!\"", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "849d11da3742578748912cc1da6b54d5", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "arrs = []\nfor char in input():\n    if char not in arrs:\n        arrs.append(char)\nif len(arrs) % 2 != 0:\n    print('IGNORE HIM!')\nelse:\n    print('CHAT WITH HER!')", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "c6d8dff26971cd0ad1209918fd5d0da5", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\nans = -1\nfor sx in xrange(18 * 9 + 1):\n     delta = long( (sx * sx + 4 * n) ** 0.5 )\n     if delta * delta != sx * sx + 4 * n:\n        continue\n     x = ( -sx + delta ) / 2\n     if x * 2 == -sx + delta:\n        tmp = x\n        s = 0\n        while tmp > 0:\n            s += tmp % 10\n            tmp /= 10\n        if s == sx:\n            ans = x\n            break\nprint ans ", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search"], "code_uid": "46add21de0ba38379ad9fffdb99888b8", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nm=int(n**(1/2))\nfor i in range(max(0,m-10**3),m+10**3):\n    if i*i+sum(list(map(int,str(i))))*i==n:\n        print(i)\n        exit()\nprint(-1)", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search"], "code_uid": "5d4a9af0828545fa8752861c502fdd89", "src_uid": "e1070ad4383f27399d31b8d0e87def59", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#I = lambda: [int(i) for i in input().split()]\r\n#import io, os, sys\r\n#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline\r\n\r\n\r\n# n = int(input())\r\n# l1 = list(map(int,input().split()))\r\n# n,x = map(int,input().split())\r\n# s = input()\r\nmod =  1000000007\r\n# print(\"Case #\"+str(_+1)+\":\",)\r\nfrom collections import defaultdict\r\nimport bisect\r\nimport sys,math\r\n\r\n\r\nfor _ in range(int(input())):\r\n    n,k= map(int,input().split())\r\n    print(pow(n,k,mod))\r\n\r\n                \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "lang_cluster": "Python", "tags": ["math", "combinatorics", "bitmasks"], "code_uid": "ffc21438c7040af0b86f22a6f03eb794", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#import sys\r\n#import math\r\n#sys.stdout=open(\"C:/Users/pipal/OneDrive/Desktop/VS code/python/output.txt\",\"w\")\r\n#sys.stdin=open(\"C:/Users/pipal/OneDrive/Desktop/VS code/python/input.txt\",\"r\")\r\nt=int(input())\r\nfor i in range(t):\r\n   # n=int(input())  \r\n    c=0\r\n    mod=10**9+7\r\n    n,k=(map(int,input().split()))\r\n    print(n**k%mod)\r\n   # print(half)\r\n\r\n\r\n\r\n   \r\n\r\n    \r\n    \r\n\r\n\r\n    \r\n    \r\n\r\n    \r\n    \r\n\r\n\r\n    \r\n    \r\n    ", "lang_cluster": "Python", "tags": ["math", "combinatorics", "bitmasks"], "code_uid": "f892d01f59dd1de30e9252936ba2824c", "src_uid": "2e7a9f3a97938e4a7e036520d812b97a", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = map(int,input().split())\n\n\nmin_answer = n + max(m - n, 0)\n\nmax_answer = n + max(0, m - 1)\n\nif n == 0 and m == 0:\n    print(\"0 0\")\n    exit(0)\n\nif n == 0 :\n    print(\"Impossible\")\n    exit(0)\n    \n\nprint(min_answer, max_answer)\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "71037e030523be978284a76cf8faf135", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\nif n==0 and m!=0:\n\tprint('Impossible')\nelif m<=n:\n\tprint(n,end=' ')\n\t# print(m+n-1)\n\nelif m>n:\n\tprint(m,end=' ')\n\t# print(m+n-1)\nif m!=0 and n!=0:\n\tprint(m+n-1)\nelif m==0 :\n\tprint(n)\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "0fd139d38d56e498414b0352c2744d69", "src_uid": "1e865eda33afe09302bda9077d613763", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin\nfrom collections import *\n\n\ndef arr_inp(n):\n    if n == 1:\n        return [int(x) for x in stdin.readline().split()]\n    elif n == 2:\n        return [float(x) for x in stdin.readline().split()]\n    else:\n        return list(stdin.readline()[:-1])\n\n\nf = arr_inp(1)\nmi, days, d = min(f[0] // 3, f[1] // 2, f[2] // 2), deque([i for i in range(7)]), {0: 1, 1: 0, 2: 0, 3: 1, 4: 2, 5: 0,\n                                                                                   6: 2}\nans = mi * 7\nf[0] -= mi * 3\nf[1] -= mi * 2\nf[2] -= mi * 2\n\nma = 0\nfor i in range(7):\n    tem, f1, flag = 0, f.copy(), 1\n\n    for j in range(7):\n        if f1[d[days[0]]] and flag:\n            f1[d[days[0]]] -= 1\n            tem += 1\n        else:\n            flag = 0\n        days.rotate(-1)\n\n    days.rotate(-1)\n    ma, flag = max(ma, tem), 1\n\nprint(ans + ma)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "c6b8f8e0c00ab17583c8463230a359b7", "src_uid": "e17df52cc0615585e4f8f2d31d2daafb", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def judge(x):\n    w, d = divmod(x, 7)\n    a2 = 3*w+l[:d].count('a')\n    b2 = 2*w+l[:d].count('b')\n    c2 = 2*w+l[:d].count('c')\n    \n    return a>=a2 and b>=b2 and c>=c2\n\ndef binary_search():\n    l, r = 0, 10**10\n    \n    while l<=r:\n        mid = (l+r)//2\n        \n        if judge(mid):\n            l = mid+1\n        else:\n            r = mid-1\n    \n    return r\n\na, b, c = map(int, input().split())\nl = list('abcacba')\nans = 0\n\nfor _ in range(7):\n    ans = max(ans, binary_search())\n    l = l[1:]+[l[0]]\n\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "85fa8c0e810d62cbbfdfc803201f3762", "src_uid": "e17df52cc0615585e4f8f2d31d2daafb", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import configparser\nimport math\nimport sys\n\n\ninput = sys.stdin.readline\n\n\ndef main():\n\n    n = int(input())\n    a = sorted([int(x) for x in input().split(' ')])\n\n\n    i = 1\n    ans = 0\n    for p in a:\n        ans += abs(p - i)\n        i += 2\n\n    i = 2\n    ans2 = 0\n    for p in a:\n        ans2 += abs(p - i)\n        i += 2\n\n    print(min(ans, ans2))\n\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b060f616f7fe482d30b4d6f477105246", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nboard = sorted(map(int,input().split()))\nb = w = 0\nfor i in range(n//2):\n    b += abs(board[-i-1] - (n-i*2))\n    w += abs(board[-i-1] - (n-1-i*2))\nprint(min(b,w))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "16a476ead4cceae097133c0ce226b382", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "x = input()\ninp  = input().split(\" \")\nchest = 0\nback = 2\nbiceps = 1\ncount = [0, 0, 0]\nfor i in range(len(inp)):\n    if i==chest:\n        count[0]+=int(inp[chest])\n        chest+=3\n    if i==biceps:\n        count[1]+=int(inp[biceps])\n        biceps+=3\n    if i==back:\n        count[2]+=int(inp[back])\n        back+=3\nmaxVal = max(count)\nif count[0]==maxVal:\n    print(\"chest\")\nelif count[1]==maxVal:\n    print(\"biceps\")\nelse:\n    print(\"back\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "c2116b48c504ffb52459dc05a1e24d6c", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "ch=\"chest\"\nbi=\"biceps\"\nba=\"back\"\nm={ch:0,bi:0,ba:0}\nn=int(input())\na=map(int,input().split())\ns=[ch,bi,ba]*n\nz=zip(s[:n],a)\nfor e,ai in z:\n    m[e]+=ai\nprint(max(m,key=m.get))\n\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "eec6f9b64333bb3c2398c275cde72276", "src_uid": "579021de624c072f5e0393aae762117e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,p,k=input().split()\nn=int(n)\np=int(p)\nk=int(k)\ns=p+k\nt=p-k\nif s>=n and t<=1:\n\tfor i in range(1,p,1):\n\t\tprint(i,end=' ')\n\tprint('(',end='')\n\tprint(p,end='')\n\tprint(')',end=' ')\n\tfor i in range(p+1,n+1,1):\n\t\tprint(i,end=' ')\nif s>=n and t>1:\n\tprint('<<',end=' ')\n\tfor i in range(t,p,1):\n\t\tprint(i,end=' ')\n\tprint('(',end='')\n\tprint(p,end='')\n\tprint(')',end=' ')\n\tfor i in range(p+1,n+1,1):\n\t\tprint(i,end=' ')\nif s<n and t<=1:\n\tfor i in range(1,p,1):\n\t\tprint(i,end=' ')\n\tprint('(',end='')\n\tprint(p,end='')\n\tprint(')',end=' ')\n\tfor i in range(p+1,s+1,1):\n\t\tprint(i,end=' ')\n\tprint('>>',end=' ')\nif s<n and t>1:\n\tprint('<<',end=' ')\n\tfor i in range(p-k,p,1):\n\t\tprint(i,end=' ')\n\tprint('(',end='')\n\tprint(p,end='')\n\tprint(')',end=' ')\n\tfor i in range(p+1,s+1,1):\n\t\tprint(i,end=' ')\n\tprint('>>',end=' ')", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "a35808de45cc5f8bc02c3c843f0cdfd5", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,p,k=map(int,input().split())\nif(p<1 or p>n):\n    print(None)\nelse:\n    if(p-k>1 and p+k<n):\n        print(\"<<\",\" \".join(\"(%d)\"%(i) if i==int(((p-k)+(p+k))/2) else str(i) for i in range(p-k,p+k+1)),\">>\")\n    elif(p-k<=1 and p+k>=n):\n        print(\" \".join(\"(%d)\"%(i) if i==int(((p-k)+(p+k))/2) else str(i) for i in range(1,n+1)))\n    elif(p-k>1):\n        print(\"<<\",\" \".join(\"(%d)\"%(i) if i==int(((p-k)+(p+k))/2) else str(i) for i in range(p-k,n+1)))\n    elif(p+k<n):\n        print(\" \".join(\"(%d)\"%(i) if i==int(((p-k)+(p+k))/2) else str(i) for i in range(1,p+k+1)),\">>\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "bae5a60669b0f609ee7abff49ef69694", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,a,b = map(int,raw_input().split())\npos = n-a\nif pos <= b: print pos\nelse:print b+1", "lang_cluster": "Python", "tags": ["math"], "code_uid": "27ad89931b7ea495f5840b0b605c6974", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import fileinput as f\n\nfor line in f.input():\n    if f.isfirstline():\n        data = map(int, line.split())\n\n[n, a, b] = data\n\nif n - a - 1 >= b:\n    print b + 1 \nelse:\n    print n - a\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "687c2448ecb69ab2eadc6ae67027cec0", "src_uid": "51a072916bff600922a77da0c4582180", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n = input()\ns = raw_input().strip()\ncnt = 0\nfor c in s:\n\tif c == \"+\":\n\t\tcnt += 1\n\telse:\n\t\tcnt = max(0, cnt - 1)\nprint cnt", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "789c2e1279991f97e1b234ed7d44c41f", "src_uid": "a593016e4992f695be7c7cd3c920d1ed", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\na=list(input())\nc=[]\nflag=0\nfor i in range(101):\n    k = i\n    flag=0\n    for j in range(len(a)):\n        if a[j]=='+':\n            k+=1\n        elif a[j]=='-' and k>0:\n            k-=1\n        else:\n            flag=1\n            break\n    if flag==0:\n        break\nprint(k)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "952ca79a0ac827d9e31ef3bf5c4c9b5d", "src_uid": "a593016e4992f695be7c7cd3c920d1ed", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import fractions\n\nn, m, x, y, a, b = [int(i) for i in raw_input().strip().split()]\n\ng = fractions.gcd(a, b)\nif g != 1:\n   a /= g\n   b /= g\n\nh = n / a\nv = m / b\nscale = min(h, v)\nh = a * scale\nv = b * scale\n\nbottomleftx = 0\nbottomlefty = 0\ntoprightx = 0\ntoprighty = 0\n\nif h % 2 == 1:\n    bottomleftx = x - (h+1)/2\nelse:\n    bottomleftx = x - h/2\nif bottomleftx < 0:\n    bottomleftx = 0\ntoprightx = bottomleftx + h\n\nrightx = x + h/2\nif rightx > n:\n    toprightx = n\n    bottomleftx = n - h\n\nif v % 2 == 1:\n    bottomlefty = y - (v+1)/2\nelse:\n    bottomlefty = y - v/2\nif bottomlefty < 0:\n    bottomlefty = 0\ntoprighty = bottomlefty + v\n\ntopy = y + v/2\nif topy > m:\n    toprighty = m\n    bottomlefty = m - v\n\nprint bottomleftx, bottomlefty, toprightx, toprighty\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "5f06fd8e4d435bfde99c58f9e6001133", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from fractions import*\nn,m,x,y,a,b=map(int,raw_input().split())\nc=gcd(a,b)\na/=c\nb/=c\nt=min(n/a,m/b)\na*=t\nb*=t\nX,Y=x-(a+1)/2,y-(b+1)/2\nif X<0:X=0\nif X+a>n:X=n-a\nif Y<0:Y=0\nif Y+b>m:Y=m-b\nprint X,Y,X+a,Y+b", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "328af0b1fab96844e3ae480d75bf02a9", "src_uid": "8f1211b995f35462ae83b2be27f54585", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s = input()\nnum = 0\nn = len(s)\nans = [\"YES\",\"NO\"]\nfor i in range(n):\n    num += int(s[i] != s[n-1-i])\n\nif num == 2:\n    print(ans[0])\nelif num == 0 and n % 2 == 1:\n    print(ans[0])\nelse:\n    print(ans[1])\n", "lang_cluster": "Python", "tags": ["brute force", "strings", "constructive algorithms"], "code_uid": "aa902f02916f4adfbe3bef9d3f37ffda", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input()\nx = s[::-1]\nif len(s) ==1:\n    print 'YES'\n    exit()\nif s == x:\n    if len(s)%2 ==1:\n        print 'YES'\n    else:\n        print 'NO'\n    exit()\n\nr = len(s)/2\nc =0\nfor x in range(r):\n    if s[x] !=s[len(s)-1-x]:\n        c= c+1\n\nif c ==1:\n    print 'YES'\nelse:\n    print 'NO'", "lang_cluster": "Python", "tags": ["brute force", "strings", "constructive algorithms"], "code_uid": "16dd98ff5e3bfe61227960fa191aab8b", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "\"\"\"\nAuthor    : raj1307\nInstitute : Jalpaiguri Government Engineering College\nDate      : 16.04.19\n\"\"\"\nfrom __future__ import division, print_function\nimport itertools,os,sys\n#from collections import deque, Counter, OrderedDict\n#from heapq import nsmallest, nlargest, heapify, #heappop ,heappush, heapreplace\n#from math import ceil,floor,log,sqrt,factorial,pow,pi\n#from bisect import bisect_left,bisect_right\n#from decimal import *\n\nfrom io import BytesIO, IOBase\n\nif sys.version_info[0] < 3:\n    from __builtin__ import xrange as range\n    from future_builtins import ascii, filter, hex, map, oct, zip\nelse:\n    from builtins import str as __str__\n    str = lambda x=b'': x if type(x) is bytes else __str__(x).encode()\n\nBUFSIZE = 8192\n\n\nclass FastIO(IOBase):\n    newlines = 0\n\n    def __init__(self, file):\n        self._buffer = BytesIO()\n        self._fd = file.fileno()\n        self._writable = 'x' in file.mode or 'r' not in file.mode\n        self.write = self._buffer.write if self._writable else None\n\n    def read(self):\n        return self._buffer.read() if self._buffer.tell() else os.read(self._fd, os.fstat(self._fd).st_size)\n\n    def readline(self):\n        while self.newlines == 0:\n            b, ptr = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)), self._buffer.tell()\n            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)\n            self.newlines += b.count(b'\\n') + (not b)\n        self.newlines -= 1\n        return self._buffer.readline()\n\n    def flush(self):\n        if self._writable:\n            os.write(self._fd, self._buffer.getvalue())\n            self._buffer.truncate(0), self._buffer.seek(0)\n\n\nsys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(b'\\r\\n')\n\n\ndef print(*args, **kwargs):\n    sep, file = kwargs.pop('sep', b' '), kwargs.pop('file', sys.stdout)\n    at_start = True\n    for x in args:\n        if not at_start:\n            file.write(sep)\n        file.write(str(x))\n        at_start = False\n    file.write(kwargs.pop('end', b'\\n'))\n    if kwargs.pop('flush', False):\n        file.flush()\n\ndef ii(): return int(input())\ndef si(): return str(input())\ndef mi():return map(int,input().strip().split(\" \"))\ndef li():return list(mi())\n\nabc='abcdefghijklmnopqrstuvwxyz'\nabd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}\ndef getKey(item): return item[0] \ndef sort2(l):return sorted(l, key=getKey)\ndef d2(n,m,num):return [[num for x in range(m)] for y in range(n)]\ndef ntl(n):return [int(i) for i in str(n)]\ndef powerMod(x,y,p):\n    res = 1\n    x %= p\n    while y > 0:\n        if y&1:\n            res = (res*x)%p\n        y = y>>1\n        x = (x*x)%p1\n    return res\ndef gcd(x, y):\n    while y:\n        x, y = y, x % y\n    return x\n\n# For getting input from input.txt file \n#sys.stdin = open('input.txt', 'r')  \n  \n# Printing the Output to output.txt file \n#sys.stdout = open('output.txt', 'w') \n\ndef main():\n   \n    n=ii()\n    l=li()\n    \"\"\"s=sum(l)\n    a=s//n\n    b=a+1\n    c=a-1\n    x=[]\n    y=[]\n    z=[]\n    d=0\n    e=1000000000\n    if n==2:\n        d=abs(l[0]-l[1])\n    for i in range(n):\n        if l[i]!=a:\n            x.append(abs(l[i]-a))\n    if len(list(set(x)))==1 and x[0]>=0:\n        if n==2:\n            d=min(d,x[0])\n        else:\n            e=min(x[0],e)\n    if len(x)==0:\n        print(0)\n        exit()\n    for i in range(n):\n        if l[i]!=b:\n            y.append(abs(l[i]-b))\n    if len(list(set(y)))==1 and y[0]>=0:\n        if n==2:\n            d=min(d,y[0])\n        else:\n            e=min(e,y[0])\n\n    if len(y)==0:\n        print(0)\n        exit()\n    for i in range(n):\n        if l[i]!=c:\n            z.append(abs(l[i]-c))\n    if len(list(set(z)))==1 and z[0]>=0:\n        if n==2:\n            d=min(d,z[0])\n        else:\n            e=min(e,z[0])\n    else:\n        if n==2:\n            print(d)\n            exit()\n        else:\n            print(-1)\n            exit()\n    if len(z)==0:\n        print(0)\n        exit()\n    print(e)\"\"\"\n    \n    \n    m=1000000000\n    for i in range(0,101):\n        x=[]\n        for j in range(n):\n           if i!=l[j]:\n              x.append(abs(i-l[j]))\n        if len(list(set(x)))==1 or len(x)==0:\n            if len(x)==0:\n                print(0)\n                exit()\n            else:\n                m=min(m,x[0])\n        \n    if m==1000000000:\n        print(-1)\n    else:\n        print(m)\n    \n    \n        \n        \n        \n   \n   \n   \n   \n   \n\n\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "38567c1653d2c44d302566390ab9c9a9", "src_uid": "d486a88939c132848a7efdf257b9b066", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nn=int(input())\nl=list(map(int,input().split()))\nl.sort()\ng=(l[n-1]-l[0])\nt=1\nfor i in range(1,n):\n   if (l[i]-l[i-1])==g or (l[i]-l[i-1])==0:\n       continue\n   elif (l[i]-l[i-1])==g/2:\n       t=2\n       continue\n   else:\n       print(-1)\n       sys.exit()\nif g%2==0:\n    print(g//2)\nelse:\n    print(g)\n       ", "lang_cluster": "Python", "tags": ["math"], "code_uid": "204867632410a1812fd9af461957e7b1", "src_uid": "d486a88939c132848a7efdf257b9b066", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ns = list(map(int, input().split()))\na = 0\nfor i in range(n+1):\n    x = s[:i].count(0)\n    y = s[i:].count(1)\n    a = max(a, x+y)\nprint(a)", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "2ad6bed1841a5708f37a1443a124b903", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\n#######################################################################\n\ndef get_lines():\n\treturn sys.stdin.readlines()\n\n\n#######################################################################\n\ndef diversity():\n\tlines = sys.stdin.readlines()\n\ts = lines[0][0:-1]\n\tk = int(lines[1])\n\t\n\tif k > len(s) or k > 26:\n\t\tprint \"impossible\"\n\t\treturn 0\n\n\tunique = ''\n\tfor c in s:\n\t\tif not c in unique:\n\t\t\tunique += c\n\n\tprint max(0, k - len(unique))\n\treturn 0\n\n#######################################################################\n\ndef curriculum():\n\tlines = get_lines()\n\tn = int(lines[0])\n\ts = [int(word) for word in lines[1].split()]\n\tmax_kept = 0\n\tpos = 0\n\tfor start in range(len(s)):\n\t\tremoved = 0\n\t\tfor before_start in s[:start]:\n\t\t\tif before_start == 1:\n\t\t\t\tremoved += 1\n\t\tfor after_start in s[start+1:]:\n\t\t\tif after_start == 0:\n\t\t\t\tremoved += 1\n\t\tif n - removed > max_kept:\n\t\t\tmax_kept = n - removed\n\t\t\t#print pos\n\t\tpos += 1\n\n\tprint max_kept\n\treturn max_kept\n\n\n\n\n\ncurriculum()\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "b6fa6d3a959f911b49b6febf6a3138a1", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x1,y1,z1=input().split()\nx2,y2,z2=input().split()\nif x1==x2 or y1==y2 or z1==z2:\n    print(\"YES\")\nelse:\n    print(\"NO\")", "lang_cluster": "Python", "tags": ["math"], "code_uid": "e9f2197545ae1add43f8100c8c5c82fd", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b, c = list(map(int,input().strip().split(' ')))\nx, y, z = list(map(int,input().strip().split(' ')))\nprint(\"YES\" if a == x or b == y or c == z else \"NO\")", "lang_cluster": "Python", "tags": ["math"], "code_uid": "39f9a0c728659edbf0e6ac7bec821f35", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "N,K = map(int,raw_input().split())\nA,B = map(int,raw_input().split())\n\ndef gcd(a,b):\n    if not a:\n        return b\n    if not b:\n        return a\n    return gcd(b,a%b)\n\ncur = 1+A\nnxt = []\n\nfor i in range(N):\n    nxt.append((1+i*K)-B)\n    nxt.append((1+i*K)+B)\n\nans = [0,10000000000]\n\nfor i in nxt:\n    L = i-cur\n    if L > N*K or L < 0:\n        L %= N*K\n    if not L:\n        L = N*K\n    temp = gcd(L,N*K)\n    ans[0] = max(ans[0],N*K/temp)\n    ans[1] = min(ans[1],N*K/temp)\n\nprint ans[1],ans[0]", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "3b8068cee4c2e8ce2e60a213808ac24a", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\n\ndef prime_factors(n):\n    i = 2\n    factors = []\n    while i * i <= n:\n        if n % i:\n            i += 1\n        else:\n            n //= i\n            factors.append(i)\n    if n > 1:\n        factors.append(n)\n    return factors\n\ndef my_gcd(fact, mm):\n    # print(\"my_gcd\",fact,mm)\n    res = 1\n    for i in fact:\n        if mm % i == 0:\n            mm = mm // i\n            res = res * i\n    # print(\"my_gcd\", res)\n    return res\n\ndef solve(n,k,a,b):\n    qq = [a+b,a-b,-a-b,-a+b]\n    mini=n*k\n    maxi = 0\n\n    factN = prime_factors(n)\n    fact = factN + prime_factors(k)\n\n    m = n*k\n    for q in qq:\n        for t in range(1,n+1):\n            mm = t*k + q\n            if mm > 0:\n                x = my_gcd(fact, mm)\n                # print(x)\n                y = m//x\n                if y < mini:\n                    mini = y\n                if y > maxi:\n                    maxi = y\n    return mini, maxi\n\n\nn,k = input().split()\nn = int(n)\nk = int(k)\n\na, b = input().split()\na = int(a)\nb = int(b)\n\nx,y = solve(n,k,a,b)\nprint(x,y)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "40f6fefbd83c6d622e2915496d3e63a5", "src_uid": "5bb4adff1b332f43144047955eefba0c", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "mp = lambda: map(int, raw_input().split())\nn, k = mp()\nfor ans in range(1000):\n    if 2*ans + (n-ans)*3 <= k:\n        break\nprint ans", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "04ede974b39346012d69d85d4fcbebd6", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,k = map(int,raw_input().split())\nif k>= 3*n:\n    print 0\nelse:\n    x = 3*n - k\n    print x", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "4e3a8803c4c6c74a3982e7ed616cb7b2", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "\"\"\"Template for Python Competitive Programmers prepared by Mayank Chaudhary \"\"\"\n\n# to use the print and division function of Python3\nfrom __future__ import division, print_function\n\n\"\"\"value of mod\"\"\"\nMOD = 998244353\nmod = 10**9 + 7\n\n\"\"\"use resource\"\"\"\n# import resource\n# resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])\n\n\"\"\"for factorial\"\"\"\n\n# def prepare_factorial():\n#     fact = [1]\n#     for i in range(1, 100005):\n#         fact.append((fact[-1] * i) % mod)\n#     ifact = [0] * 100005\n#     ifact[100004] = pow(fact[100004], mod - 2, mod)\n#     for i in range(100004, 0, -1):\n#         ifact[i - 1] = (i * ifact[i]) % mod\n#\n#     return fact, ifact\n\n\"\"\"uncomment next 4 lines while doing recursion based question\"\"\"\nimport threading\nthreading.stack_size(2**27)\nimport sys\nsys.setrecursionlimit(10000)\n\n\n\"\"\"uncomment modules according to your need\"\"\"\n# from bisect import bisect_left, bisect_right, insort\n# import itertools\n# from math import floor, ceil, sqrt\nfrom heapq import heappop, heapify, heappush\n# from random import randint as rn\n# from Queue import Queue as Q\nfrom collections import Counter, defaultdict\n\n'''\ndef modinv(n, p):\n    return pow(n, p - 2, p)\n'''\n\n\n# def ncr(n, r,  fact, ifact):  # for using this uncomment the lines calculating fact and ifact\n#     t = ((fact[n]) * (ifact[r] % mod)) % mod\n#     return t\n\n\n\ndef get_ints(): return map(int, sys.stdin.readline().strip().split())\ndef get_array(): return list(map(int, sys.stdin.readline().strip().split()))\ndef input(): return sys.stdin.readline().strip()\n\n\n# def GCD(x, y):\n#     while (y):\n#         x, y = y, x % y\n#     return x\n#\n# def lcm(x, y):\n#     return (x*y)//(GCD(x, y))\n#\n# def get_xor(n):\n#     return [n,1,n+1,0][n%4]\n\n\n\"\"\"*******************************************************\"\"\"\n\ndef main():\n\n    string = input()\n    if int(string[-1])&1:\n        print(1)\n    else:\n        print(0)\n\n\n\"\"\" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------\"\"\"\n\npy2 = round(0.5)\nif py2:\n    from future_builtins import ascii, filter, hex, map, oct, zip\n\n    range = xrange\n\nimport os, sys\nfrom io import IOBase, BytesIO\n\nBUFSIZE = 8192\n\n\nclass FastIO(BytesIO):\n    newlines = 0\n\n    def __init__(self, file):\n        self._file = file\n        self._fd = file.fileno()\n        self.writable = \"x\" in file.mode or \"w\" in file.mode\n        self.write = super(FastIO, self).write if self.writable else None\n\n    def _fill(self):\n        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])\n        return s\n\n    def read(self):\n        while self._fill(): pass\n        return super(FastIO, self).read()\n\n    def readline(self):\n        while self.newlines == 0:\n            s = self._fill();\n            self.newlines = s.count(b\"\\n\") + (not s)\n        self.newlines -= 1\n        return super(FastIO, self).readline()\n\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.getvalue())\n            self.truncate(0), self.seek(0)\n\n\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        if py2:\n            self.write = self.buffer.write\n            self.read = self.buffer.read\n            self.readline = self.buffer.readline\n        else:\n            self.write = lambda s: self.buffer.write(s.encode('ascii'))\n            self.read = lambda: self.buffer.read().decode('ascii')\n            self.readline = lambda: self.buffer.readline().decode('ascii')\n\n\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip('\\r\\n')\n\n\"\"\" main function\"\"\"\n\nif __name__ == '__main__':\n    # main()\n    threading.Thread(target=main).start()", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "72dff1cdf0693137db1b24a79fa5b9c2", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s = input()\nif int(s[6]) % 2 == 0:\n    print(0)\nelse:\n    print(1)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b19ff0760559f851ec9adeaa9a0f1d1e", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nk=int(input())\nA=int(input())\nB=int(input())\n\nmans=0\nif(k==1):\n    print((n - 1) * A)\nelse:\n    while(n!=1):\n        # print(\"HJey\")\n        ans = 0;\n        if (n % k == 0) :\n            ans = n / k;\n            mans+= min((n - ans) * A, B)\n            n=int(n/k)\n        else:\n            x=(n-n%k)\n            if(x==0):\n               mans+=((n-1)*A)\n               n=1;\n            else:\n                mans += ((n - x) * A)\n                n = x\n\n    print(int(mans))", "lang_cluster": "Python", "tags": ["greedy", "dp"], "code_uid": "25d456bc0686dd9ed325152a5fe4b41a", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nk = int(input())\nA = int(input())\nB = int(input())\n\ncost = 0\nif k == 1:\n    cost = (n-1)*A\n    n = 0\nwhile n > 0:\n    steps = n-((n//k)*k)\n    steps = min(steps, n-1)\n    cost += steps * A\n    n -= steps\n    if n == 1:\n        break\n    steps = n-n//k\n    if steps*A < B:\n        cost += steps*A\n    else:\n        cost += B\n    n -= steps\n\nprint (cost)\n", "lang_cluster": "Python", "tags": ["greedy", "dp"], "code_uid": "84e4b0419959c7976d2a5f96a5fc17c3", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "q = int(input())\n\na = q//2 \n\nprint(a+1)\n       \t\t\t\t \t\t \t\t \t   \t   \t   \t", "lang_cluster": "Python", "tags": ["math"], "code_uid": "720629dd119c54ce49be68217d4b455f", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# cook your dish here\nn=int(input())\nsplits=(n//2)+1\nprint(splits)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "cac6b7f5e8b703abb3e91729cf4bbc76", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from collections import defaultdict\n\ndef main():\n  \tinput()\n\tcards = list(set(raw_input().split()));\n\n\tif len(cards) == 1:\n\t  \tprint 0\n\t\treturn\n\tanswer = 9;\n\tchars = 'RGBYW12345'\n\tfor mask in xrange(1, 1024):\n\t  \tcover = ''\n\t\tfor i in xrange(10):\n\t\t  \tif (mask & (1<<i)):\n\t\t\t  \tcover += chars[i]\n\n\t\td = defaultdict(int)\n  \t\t\n  \t\tfor card in cards:\n\t\t\tif card[0] in cover and card[1] in cover:\n\t\t\t\tcontinue;\n\t\t\tif card[0] in cover:\n\t\t\t\td[card[0]] += 1;\n\t\t\telif card[1] in cover:\n\t\t\t\td[card[1]] += 1;\n\t\t\telse:\n\t\t\t\td['*'] += 1;\n\t\t\n\t\tif all(x <= 1 for x in d.values()):\n\t\t  \tanswer = min(answer, len(cover));\n\t\t\n\tprint answer;\n\nif __name__ == '__main__':\n\tmain()\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "bitmasks"], "code_uid": "b52bbad052fcc235e13271aa992b4a42", "src_uid": "3b12863997b377b47bae43566ec1a63b", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "input()\np = {(1 << 'RGBYW'.index(c)) + (1 << int(k) + 4) for c, k in input().split()}\nprint(min(bin(t).count('1') for t in range(1024) if len({t & q for q in p}) == len(p)))\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "bitmasks"], "code_uid": "d48956348fa677078f8d555e47b644d6", "src_uid": "3b12863997b377b47bae43566ec1a63b", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "m = []\nfor i in range(10):\n    s = input()\n    m.append(s)\nfor i in range(10):\n    for j in range(6):\n        s = ''\n        s += m[i][j] + m[i][j+1] + m[i][j+2] +m[i][j+3] + m[i][j+4]\n        if s.count('X') == 4 and s.count('O') == 0:\n            print('YES')\n            exit()\nfor i in range(10):\n    for j in range(6):\n        s = ''\n        s += m[j][i] + m[j+1][i] + m[j+2][i] + m[j+3][i] + m[j+4][i]\n        if s.count('X') == 4 and s.count('O') == 0:\n            print('YES')\n            exit()\nfor i in range(6):\n    for j in range(6):\n        s = ''\n        s += m[j][i] + m[j+1][i+1] + m[j+2][i+2] + m[j+3][i+3] + m[j+4][i+4]\n        if s.count('X') == 4 and s.count('O') == 0:\n            print('YES')\n            exit()\nfor i in range(6):\n    for j in range(6):\n        s = ''\n        s += m[j+4][i] + m[j+3][i+1] + m[j+2][i+2] + m[j+1][i+3] + m[j][i+4]\n        if s.count('X') == 4 and s.count('O') == 0:\n            print('YES')\n            exit()\nprint('NO')", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "9104b6e37481e78f242d527fc6861f65", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s=10*[0]\nfor i in range(10):\n\ts[i]=input()\ndef trav(i,j,s,n):\n\tif n==1:\n\t\tif(i<9):\n\t\t\tif s[i+1][j]=='X':\n\t\t\t\treturn 1 + trav(i+1,j,s,n)\n\t\t\treturn 0\n\t\treturn 0\n\tif n==-1:\n\t\tif(i>0):\n\t\t\tif s[i-1][j]=='X':\n\t\t\t\treturn 1 + trav(i-1,j,s,n)\n\t\t\treturn 0\n\t\treturn 0\n\tif n==2:\n\t\tif(j<9):\n\t\t\tif s[i][j+1]=='X':\n\t\t\t\treturn 1 + trav(i,j+1,s,n)\n\t\t\treturn 0\n\t\treturn 0\n\tif n==-2:\n\t\tif(j>0):\n\t\t\tif s[i][j-1]=='X':\n\t\t\t\treturn 1 + trav(i,j-1,s,n)\n\t\t\treturn 0\n\t\treturn 0\n\tif n==3:\n\t\tif(i<9 and j<9):\n\t\t\tif s[i+1][j+1]=='X':\n\t\t\t\treturn 1 + trav(i+1,j+1,s,n)\n\t\t\treturn 0\n\t\treturn 0\n\tif n==-3:\n\t\tif(i>0 and j>0):\n\t\t\tif s[i-1][j-1]=='X':\n\t\t\t\treturn 1 + trav(i-1,j-1,s,n)\n\t\t\treturn 0\n\t\treturn 0\n\tif n==4:\n\t\tif(i>0 and j<9):\n\t\t\tif s[i-1][j+1]=='X':\n\t\t\t\treturn 1 + trav(i-1,j+1,s,n)\n\t\t\treturn 0\n\t\treturn 0\n\tif n==-4:\n\t\tif(i<9 and j>0):\n\t\t\tif s[i+1][j-1]=='X':\n\t\t\t\treturn 1 + trav(i+1,j-1,s,n)\n\t\t\treturn 0\n\t\treturn 0\n\nflag=False\t\t\nfor i in range(10):\n\tfor j in range(10):\n\t\tif s[i][j]=='.':\n\t\t\t#print(trav(i,j,s,-2))\n\t\t\t#input()\n\t\t\tif trav(i,j,s,1)+trav(i,j,s,-1)>=4 or trav(i,j,s,2)+trav(i,j,s,-2)>=4 or trav(i,j,s,3)+trav(i,j,s,-3)>=4 or trav(i,j,s,4)+trav(i,j,s,-4)>=4:\n\t\t\t\tflag=True;\n\t\t\t\tprint ('YES')\n\t\t\t\tbreak\n\tif flag:\n\t\tbreak\nif not flag:\n\tprint('NO')", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "35dd50b0c3b9fcfa7ffb7bcee7f864ad", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def solution():\n    a = int(raw_input())\n    b = int(raw_input())\n    b, a = max(a, b), min(a, b)\n    cost = 1\n    res = 0\n    while b - a - 2 >= 0:\n        res += 2 * cost\n        cost += 1\n        a += 1\n        b -= 1\n    if b > a:\n        res += cost\n    return res\n\n\nif __name__ == '__main__':\n    print solution()\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation", "brute force"], "code_uid": "7f54de42850242c8cc5462b48d56b130", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a=int(input())\nb=int(input())\ntmn=0\ntmx=0\ncmx=0\ncmn=0\nif(a>b):\n    max=a\n    min=b\nelse:\n    max=b\n    min=a\nif(a==b):\n    t=0\nelif(a-b==1 or b-a==1):\n    t=1\nelse:\n    while True:\n        max-=1\n        cmx+=1\n        tmx+=cmx\n        if(max==min):\n            t=tmx+tmn\n            break\n        min+=1\n        cmn+=1\n        tmn+=cmn\n        if(max==min):\n            t=tmx+tmn\n            break\nprint(t)", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation", "brute force"], "code_uid": "118281fe35616e4fa6dca2b6f76ee6e6", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def bs(n, k, lo, hi):\n    \n    while lo <= hi: \n        mid = (hi + lo)//2\n        # print(lo, hi, mid)\n        # print('start')\n        # ks = range(mid, k+1)\n        # print('end')\n        # print('start')\n        # summ = (mid + k) * ((k - mid +1)/2) - (k-2)\n        # summ = (-mid * (mid -1) + k * (k + 1))/2 - (k-2)\n        summ = ((k * (k + 1))//2 - 1) - (((mid-1) * (mid))//2 -1) - (k-2)\n        # kk = k\n        # summ = 0\n        # while kk > 0:\n        #     summ += summ\n        #     kk -=1\n        # summ = summ - (k-2)\n        # summ = sum(ks) - (len(ks) - 1)\n        # print('end')\n        # print(list(range(mid, k+1)))\n        # print(summ, n)\n        # print(mid, k, (summ), 'mid')\n        if summ == n: \n            # print('done')\n            return k - mid + 1\n            # print(f'result: {k - mid + 1}')\n            # break\n        if summ > n: \n            # print('hi')\n            lo = mid + 1\n            # print(lo, hi, (hi + lo)//2)\n            \n        elif summ < n:\n            hi = mid - 1\n            # print((hi + lo)//2 , 'yarab', lo, hi)\n            # print('lala')\n            # print(summ)\n    # print(lo, 'i am the mid')\n    # if n - summ == 1:\n    #     print('there') \n    #     return -1\n    # summ = ((k * (k + 1))//2 - 1) - ((((mid+1)-1) * ((mid+1)))//2 -1) - (k-2)\n    # print(summ, 'yalla')\n    # print(mid, 'lol')\n    # print(k - mid)\n    # print('yo')\n    if summ > n: \n       mid += 1\n    return k - mid + 1\n    # print(f'result: {k - mid + 2}')\n\n\n\ndef solve():\n    n, k = map(int, input().split())\n    # n, k = 499999999500000000, 1000000000\n    # n, k = 8, 4\n    if n == 1: return 0\n    elif (k * (k + 1)//2) - (k-2) <= n: \n        # print('here')\n        return -1\n    elif k >= n: return 1\n    else: \n        return bs(n, k, 2, k)\n\nprint(solve())", "lang_cluster": "Python", "tags": ["math", "binary search"], "code_uid": "2dd963f592f95d7eedd74446e9652f5e", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, k = map(int, raw_input().split())\ndef V(x):\n  return (2 * k - x - 1) * x / 2 + 1\na, b=0, k\nwhile a < b:\n  m = (a + b) / 2\n  if n > V(m):\n    a = m + 1\n  else:\n    b = m\nprint a if a < k else -1\n\n", "lang_cluster": "Python", "tags": ["math", "binary search"], "code_uid": "28839e523e54cc12e50428f2974df233", "src_uid": "83bcfe32db302fbae18e8a95d89cf411", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "na=int(input())#----->\na=list(input().lower())\na.sort()\nd=[]\nfor i in range(97,123):\n    d.append(chr(i))\nf=[]\nc=1\nfor i in a:\n    if i not in f:\n         f.append(i)\n         c+=1\n    if c==27:\n        break\n\nif f==d :\n    print(\"YES\")\nelse:\n    print(\"NO\")\n\n\n\n\n\n\n\n\n\n\n\n    \n\n\n\n\n\n    \n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "0709e40ee49b6439d328de121380ddcb", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input()\ns = raw_input().lower()\nfl = sum(map(lambda x: s.find(x) >= 0, list('qazwsxedcrfvtgbyhnujmikolp'))) == 26\nif fl:\n    print 'YES'\nelse:\n    print 'NO'\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "114c6b3555fad790b63f866c4477ce39", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b = input().split()\na = int(a)\nb = int(b)\nc = b\nd = ''\nt = ''\n\nn = [a]\nwhile a != c:\n    if (c % 2 == 0) and (a <= c):\n        c = c / 2\n        d = d + '1'\n    elif (c - 1) % 10 == 0 and (a <= c):\n        c = (c - 1) / 10\n        d = d + '2'\n    else:\n        break\nif a == c:\n    print('YES')\n    t = d[::-1]\n    f = len(t)\n    print(len(t) + 1)\n    for i in range (1, f + 1):\n        if t[i-1:i] == '1':\n            a = a * 2\n            n.append(a)\n        else:\n            a = (a * 10) + 1\n            n.append(a)\n    for i in range(0, f + 1):\n        print(n[i], end = ' ')\nelif c != a:\n    print('NO')\n\n\n", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "brute force"], "code_uid": "a1a0dcc4f5205c620d2432150fc57019", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b=map(int,input().split())\nr=[b]\nwhile b>a:\n    if b%10==1:\n        b=b//10\n        r.append(int(b))\n    else:\n        b=b/2\n        r.append(int(b))\nif r[len(r)-1]==a:\n        print('YES')\n        print(len(r))\n        print(*r[::-1])\nelse:\n        print('NO')", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "brute force"], "code_uid": "aae1e44cd15edc7d98faad4dd2cbb030", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s=input()\nsumm=0\nfor i in range(len(s)):\n\tif s[i]=='@':\n\t\tsumm=summ+1\ntry:\n\tt=s.index(\"@\")\n\ts=s.split(\"@\")\n\tif s[1][len(s[1])-1]=='/' or summ>1:\n\t\tprint(\"NO\")\n\telse:\n\t\ts[1]=s[1]+\"/\"\n\t\ts[1]=s[1].split(\"/\")\n\t\ts.append(s[1][1])\n\t\ts[1]=s[1][0]\n\t\t#print(s)\n\t\tif 1<=len(s[0])<=16 and 0<=len(s[2])<=16 and 1<=len(s[1])<=32:\n\t\t\ts[1]=s[1].split(\".\")\n\t\t\t#print(s)\n\t\t\tfor i in range(len(s[1])):\n\t\t\t\tif len(s[1][i])>16  or len(s[1][i])==0:\n\t\t\t\t\tprint(\"NO\")\n\t\t\t\t\tbreak\n\t\t\telse:\n\t\t\t\tfor i in range(len(s[0])):\n\t\t\t\t\tsym=ord(s[0][i])\n\t\t\t\t\tif 65<=sym<=90 or 97<=sym<=122 or 48<=sym<=57 or sym==95:\n\t\t\t\t\t\tNone\n\t\t\t\t\telse:\n\t\t\t\t\t\tprint(\"NO\")\n\t\t\t\t\t\tbreak\n\t\t\t\telse:\n\t\t\t\t\ts[1]=\"\".join(s[1])\n\t\t\t\t\t\n\t\t\t\t\tfor i in range(len(s[1])):\n\t\t\t\t\t\tsym=ord(s[1][i])\n\t\t\t\t\t\tif 65<=sym<=90 or 97<=sym<=122 or 48<=sym<=57 or sym==95:\n\t\t\t\t\t\t\tNone\n\t\t\t\t\t\telse:\n\t\t\t\t\t\t\tprint(\"NO\")\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\telse:\n\t\t\t\t\t\tif len(s[2])==0:\n\t\t\t\t\t\t\tprint(\"YES\")\n\t\t\t\t\t\telse:\n\t\t\t\t\t\t\tfor i in range(len(s[2])):\n\t\t\t\t\t\t\t\tsym=ord(s[2][i])\n\t\t\t\t\t\t\t\tif 65<=sym<=90 or 97<=sym<=122 or 48<=sym<=57 or sym==95:\n\t\t\t\t\t\t\t\t\tNone\n\t\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\t\tprint(\"NO\")\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\tprint(\"YES\")\n\t\telse:\n\t\t\tprint(\"NO\")\nexcept:\n\t\t\tprint(\"NO\")", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "5194bdba514c1e040cc6134264004982", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "line = input()\nvalid = True\nstatus = -1\nusername = []\nhostname = []\nresources = []\nhasResource = False\nant = 'a'\nfor e in line:\n  if not valid:\n    break\n  if status == -1:\n    if e.isalpha() or e.isdigit() or e == '_':\n      username.append(e)\n    elif e == '@':\n      status = 0\n    else:\n      valid = False\n  elif status == 0:\n    if e.isalpha() or e.isdigit() or e == '_' or e == '.':\n      if e =='.' and ant == '.':\n        valid = False\n      else:\n        hostname.append(e)\n    elif e == '/':\n      hasResource = True\n      status = 1\n    else:\n      valid = False\n  else:\n    if e.isalpha() or e.isdigit() or e == '_':\n      resources.append(e)\n    else:\n      valid = False\n  ant = e\n#print(username)\n#print(hostname)\n#print(resources)\nif len(username) < 1 or len(username) > 16:\n  valid = False\nif len(hostname) < 1 or len(hostname) > 32 or hostname[0] == '.' or hostname[-1] == '.':\n  valid = False\nelse:\n  word = (''.join(hostname)).split('.')\n  for e in word:\n    if len(e) > 16:\n      valid = False\nif len(resources) > 16:\n  valid = False\nif hasResource and len(resources) < 1:\n  valid = False\n  \nif valid:\n  print('YES')\nelse:\n  print('NO')", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "7ca9d8ae9b0553c689f708275199f0be", "src_uid": "2a68157e327f92415067f127feb31e24", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\n\nsum = n * (n+1) // 2\n\nprint(sum % 2)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "17f1b5079e6e6f4e58ad7f60012fd143", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nprint(1) if (n * (n + 1)) // 2 % 2 == 1 else print(0)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "77ddcf21fea95eb722e0b707a5ddb13d", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a = []\nfor _ in range(4):\n    a.append(input())\nflag = 0\nfor i in range(3):\n    for j in range(3):\n        s = [a[i][j],a[i+1][j],a[i][j+1],a[i+1][j+1]]\n        if s.count(\".\")>=3 or s.count(\"#\")>=3:\n            flag = 1\n            break\nif flag == 1:\n    print(\"YES\")\nelse:\n    print(\"NO\")\n\n\n    \n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "38cde21bfe9b6a009840ff247b1648f3", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "arr = []\nfor _ in range(4):\n    arr.append(list(input()))\nfor k in range(3):\n    for kk in range(3):\n        arr100 = []\n        arr100.append(arr[k][kk])\n        arr100.append(arr[k][kk+1])\n        arr100.append(arr[k+1][kk])\n        arr100.append(arr[k+1][kk+1])\n        zz = arr100.count('#')\n        zzz = arr100.count('.')\n        if (zz == 4) or (zzz == 4) or (zz == 3 and zzz == 1) or (zz == 1 and zzz == 3):\n            print(\"YES\")\n            exit()\nprint(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "3bac594c1d3c21ad86c861e2cdda35a3", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "r1, c1, r2, c2 = map(int, input().split(' '))\n\n#rook\n\nif(r1 == r2 or c1==c2):\n\tprint(1, end=' ')\nelse:\n\tprint(2, end=' ')\n\n\n#bisohop\nif(abs(r1-r2)==abs(c1-c2)):\n\tprint(1, end=' ')\nelif((abs(r1-r2)%2==0 and abs(c1-c2)%2==0) or (abs(r1-r2)%2!=0 and abs(c1-c2)%2!=0)):\n\tprint(2, end=' ')\nelse:\n\tprint(0, end=' ')\n\n\n#king\n\nprint(max(abs(r1-r2), abs(c1-c2)))\n", "lang_cluster": "Python", "tags": ["math", "graphs", "shortest paths"], "code_uid": "1365c1ca8a080e1ac81aebdae77bce22", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    r1, c1, r2, c2 = map(int, input().split())\n    _1, _2, _3 = 2, 2, 0\n   \n    if r1 == r2 or c1 == c2:\n        _1 = 1\n    \n    if (r1+c1) % 2 != (r2+c2) % 2:\n        _2 = 0\n    elif r1 + c1 == r2 + c2 or r1 - c1 == r2 - c2:\n        _2 = 1\n\n    _3 = max(abs(r1-r2), abs(c1-c2))\n    print(_1, _2, _3)\n\n\nif __name__ == '__main__':\n    main()\n\n", "lang_cluster": "Python", "tags": ["math", "graphs", "shortest paths"], "code_uid": "296d30555934bd8078d947911b5cba69", "src_uid": "7dbf58806db185f0fe70c00b60973f4b", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "m, n, a = map(int, input().split())\nif a > m and a >n:\n    print(1)\nelse:\n    k1=int(round(m/a+ 0.499999999))\n    k2=int(round(n/a+ 0.499999999))\n    if a == 1 :\n        print(m*n)\n    else:\n        print(int(k1*k2))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "32679791c6fa98a80205598639972a4f", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m, a = map(int, input().split())\n\nif n%a == 0:\n\tnn = int(n / a)\nelse:\n\tnn = int(n / a) + 1\n\nif m%a == 0:\n\tmm = int(m / a)\nelse:\n\tmm = int(m / a) + 1\n\nprint(nn * mm)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "09db9e23b44680728ab604ac7c73f0d1", "src_uid": "ef971874d8c4da37581336284b688517", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom math import trunc\n#range = xrange\n#input = raw_input\n# How to multiply matrices in 32 bit python?\n# Solution: Use doubles with homemade mult and mod.\n\nMOD = 10**9 + 7\nMODF = float(MOD)\ndef modder(x):\n    return x - MODF*trunc(x/MODF)\nsmall = 1.0 * (2**16)\n# calculates a*b+c\ndef prod(a,b,c):\n    abig = trunc(a/small)\n    return modder(abig*modder(b*small)+(a-small*abig)*b+c)\n\ndef mult(A,B):\n    n = len(A)\n    m = len(B[0])\n    C = [[0.0]*n for _ in range(m)]\n    \n    for j,B_j in enumerate(B):\n        C_j = C[j]\n        for k,A_k in enumerate(A):\n            Bkj = B_j[k]\n            for i,Aik in enumerate(A_k):\n                C_j[i] = prod(Aik,Bkj,C_j[i])\n    return C\n\ndef vecmult(A,B):\n    n = len(A)\n    C = [0.0]*n\n    for k,A_k in enumerate(A):\n        Bk = B[k]\n        for i,Aik in enumerate(A_k):\n            C[i] = prod(Aik,Bk,C[i])\n    return C\n\nn,m = [int(x) for x in input().split()]\n\n\n#def DP(n):\n#    if n<=0:\n#        return 1 if n==0 else 0\n#    else:\n#        return DP(n-m) + DP(n-1)\n\n\nmapper = [[0.0]*m for _ in range(m)]\n\nmapper[0][0] = 1.0\nmapper[-1][0] = 1.0\nfor i in range(m-1):\n    mapper[i][i+1] = 1.0\n\ndef power(A,B,m):\n    n = len(A)\n    if m == 0:\n        return B\n    while m>16:\n        if m%2==1:\n            B = vecmult(A,B)\n        A = mult(A,A)\n        m//=2\n    while m>0:\n        B = vecmult(A,B)\n        m-=1\n    return B\n\nvec = [1.0]*m\nvec = power(mapper,vec,n)\nprint(int(vec[-1])%MOD)", "lang_cluster": "Python", "tags": ["math", "matrices", "dp"], "code_uid": "5db3af3a5a8a7304e56e8c9f6931f8ca", "src_uid": "e7b9eec21d950f5d963ff50619c6f119", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\nrange = xrange\ninput = raw_input\n\n# Not super happy with this code but it is kinda cool. Look at the last line in the bottom.\n\nMOD = 10**9+7\ndef polysub(P,Q):\n    n = len(P)\n    m = len(Q)\n    W = [0]*max(m,n)\n    for i in range(n):\n        W[i] += P[i]\n    for i in range(m):\n        W[i] -= Q[i]\n    W = [w%MOD for w in W]\n    while W and W[-1]==0:W.pop()\n    return W\n\n# Polydiv (floored)\ndef polydiv(P,Q):\n    while Q[-1]%MOD==0:Q.pop()\n    assert(Q[-1]%MOD>0)\n    P = P[:]\n    ans = []\n    n = len(Q)\n    while len(P)>=n:\n        p = P[-1]*pow(Q[-1],MOD-2,MOD)\n        ans.append(p)\n        for i in range(n):\n            P[-i-1] -= p*Q[-i-1]\n        assert(P[-1]%MOD==0)\n        P.pop()\n    W = [w%MOD for w in ans[::-1]]\n    while W and W[-1]==0:W.pop()\n    return W\n\n# Polymod\ndef polymod(P,Q):\n    while Q[-1]%MOD==0:Q.pop()\n    assert(Q[-1]%MOD>0)\n    P = P[:]\n    n = len(Q)\n    while len(P)>=n:\n        p = P[-1]*pow(Q[-1],MOD-2,MOD)\n        for i in range(n):\n            P[-i-1] -= p*Q[-i-1]\n        assert(P[-1]%MOD==0)\n        P.pop()\n    P = [p%MOD for p in P]\n    #while P and P[-1]==0:P.pop()\n    return P\n\ndef polyprod(P,Q):\n    n = len(P)\n    m = len(Q)\n    W = [0]*(n+m-1)\n    for i in range(n):\n        for j in range(m):\n            W[i+j]+=P[i]*Q[j]\n    return [w%MOD for w in W]\n\n# return (g,x,y): P*x+b*y = g\ndef polyxgcd(P,Q):\n    if len(P)<=1:\n        return (Q,[],[1])\n    g,x,y = polyxgcd(polymod(Q,P),P)\n    return (g,polysub(y,polyprod(polydiv(Q,P),x)),x)\n\n# Calc A^m * B \ndef power(A,B,m,mult):\n    if m == 0:\n        return B\n    while m>1:\n        if m%2==1:\n            B = mult(A,B)\n        A = mult(A,A)\n        m//=2\n    return mult(A,B)\n    \ndef calc_nth_term(init,linear_coeff,n):\n    def mult(A,B):\n        return polymod(polyprod(A,B),linear_coeff)\n    \n    ans = power([0,1],[1],n,mult)\n    return sum(ans[i]*init[i] for i in range(len(ans)))\n\n# Extrapolate an sequence finding the n-th term\n# This is only possible if the sequence follows a linear\n# recursion of at most half the length of the sequence\n\n# This will calculate the n-th term of the sequence \ndef extrapolate(seq,n):\n    twom = [0]*(len(seq)+1)\n    twom[-1] = 1\n    _,C,_ = polyxgcd(seq,twom)\n    while C[-1]%MOD==0:C.pop()\n    invc = pow(C[0],MOD-2,MOD)\n    C = [c*invc%MOD for c in C]\n    return calc_nth_term(seq,C[::-1],n)\n\nn,m = [int(x) for x in input().split()]\n\nmem = [-1]*201\ndef DP(n):\n    if n<=0 or m==1:\n        return 0 if n<0 else 1\n    if mem[n]<0:\n        mem[n] = DP(n-1) + DP(n-m)\n    return mem[n]\n\nprint extrapolate([DP(i) for i in range(201)],n)%MOD", "lang_cluster": "Python", "tags": ["math", "matrices", "dp"], "code_uid": "1ff819c726dec577efb60936a632c8d1", "src_uid": "e7b9eec21d950f5d963ff50619c6f119", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/python\n\nimport os\nimport sys\nimport itertools\n\ndef solve(f):\n    hh, mm = [int(item) for item in f.read_str().split(':')]\n    a = f.read_int()\n\n    m = hh * 60 + mm + a\n    m2 = m % 60\n    h2 = (m % 1440) / 60\n\n    return \"%02d:%02d\"%(h2, m2)\n\nclass Reader(object):\n    def __init__(self, filename=None):\n        self.test_mode = filename is not None\n        self.cases = 1\n        self.buffer = []\n        if self.test_mode:\n            with open(filename) as f:\n                blank_flg = False\n                for line in f:\n                    line = line.strip()\n                    if line:\n                        self.buffer.append(line)\n                        blank_flg = False\n                    else:\n                        if not blank_flg: self.cases += 1\n                        blank_flg = True\n\n    def __readline(self):\n        return self.buffer.pop(0) if self.test_mode else raw_input()\n\n    def read_int(self):\n        return int(self.__readline())\n    def read_float(self):\n        return float(self.__readline())\n    def read_long(self):\n        return long(self.__readline())\n    def read_str(self):\n        return self.__readline()\n\n    def read_int_list(self):\n        return [int(item) for item in self.__readline().split()]\n    def read_float_list(self):\n        return [float(item) for item in self.__readline().split()]\n    def read_long_list(self):\n        return [long(item) for item in self.__readline().split()]\n    def read_str_list(self):\n        return self.__readline().split()\n\nif __name__ == '__main__':\n    filename = sys.argv[1] if len(sys.argv)>1 else None\n    f = Reader(filename)\n    if f.test_mode:\n        for c in xrange(f.cases):\n            print \"Case #%d\"%(c+1)\n            print solve(f)\n    else:\n        print solve(f)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "9d8ba9a7927a6d9cde21d22859650a5c", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "b=list(map(int,input().split(':')))\n\nn=int(input())\ns=0\no=0\nc=b[1]\ng=n\nif n==0:\n    if b[0]<10:\n        if b[1]<10:\n            print('0'+str(b[0])+':'+'0'+str(b[1]))\n        else:\n            print('0' + str(b[0]) + ':' + str(b[1]))\n    else:\n        if b[1]<10:\n            print(str(b[0])+':'+'0'+str(b[1]))\n        else:\n\n            print(str(b[0])+':'+str(b[1]))\n\n\n\nif n%60==0 and g>0:\n    b[0]+=n//60\n\nelif n+b[1]>=60:\n    s=60-b[1]\n    g=n\n    n=n-s\n    o=n//60\n    b[0]+=1+o\n    b[1]=n-60*o\nelif n+b[1]<60:\n    b[1]=b[1]+n\n\nif b[0]>=24 and g>0:\n    \n    a=b[0]//24\n    b[0]=b[0]-24*a\n    if b[0]<10:\n        if b[1]<10:\n            print('0'+str(b[0])+':'+'0'+str(b[1]))\n        else:\n            print('0' + str(b[0]) + ':' + str(b[1]))\n    else:\n        if b[1]<10:\n            print(str(b[0])+':'+'0'+str(b[1]))\n        else:\n\n            print(str(b[0])+':'+str(b[1]))\nelif g>0:\n\n    if b[0]<10:\n        if b[1]<10:\n            print('0'+str(b[0])+':'+'0'+str(b[1]))\n        else:\n            print('0' + str(b[0]) + ':' + str(b[1]))\n    elif g>0:\n        if b[1]<10:\n            print(str(b[0])+':'+'0'+str(b[1]))\n        else:\n\n            print(str(b[0])+':'+str(b[1]))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "a603fc57a2124840942c65af485c8fd6", "src_uid": "20c2d9da12d6b88f300977d74287a15d", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def get_input():\n    num = input()\n    line = input()\n    test_cases = line.split()\n    result = []\n    for i in test_cases:\n        result.append(int(i))\n    return result\n\ndef send_balls(n,l):\n    l = sorted(l)\n    l2 = l.copy()\n    for x in range(0,n-2):\n        if l[x]==l[x+1]:\n            l2.remove(l[x+1])\n    else:\n        for i in range(0,len(l2)-2):\n            if l2[i+1]-l2[i]<2 and l2[i+2]-l2[i+1]<2 and l2[i+1]!=l2[i] and l2[i+2]!=l2[i+1]:\n                return \"YES\"\n    return \"NO\"\n\n\ntest_cases = get_input()\nprint(send_balls(len(test_cases),test_cases))\n                \n            \n", "lang_cluster": "Python", "tags": ["brute force", "sortings", "implementation"], "code_uid": "97233a90cfb4c4959eecbe5f2c8d6778", "src_uid": "d6c876a84c7b92141710be5d76536eab", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nballs = list(map(int, input().split()))\n\nballs = set(balls)\nballs = sorted(balls)\nres = \"NO\"\nfor i in range (1, len(balls) - 1):\n    if ((balls[i] - balls[i - 1]) <= 2) and ((balls[i + 1] - balls[i]) <= 2) and ((balls[i + 1] - balls[i - 1]) <= 2):\n        res = \"YES\"\nprint(res)\n", "lang_cluster": "Python", "tags": ["brute force", "sortings", "implementation"], "code_uid": "fee4e0db0721f34729527b358a4a4991", "src_uid": "d6c876a84c7b92141710be5d76536eab", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, v= map(int , input().split())\npneeded=n-1-v\ncost=v\nif(n-1>=v):\n\tfor x in range(2,n):\n\t\tif(pneeded<=0):\n\t\t\tbreak\n\t\telse:\n\t\t\tcost+=x\n\t\t\tpneeded-=1\nelse:\n\tcost=n-1\nprint(cost)", "lang_cluster": "Python", "tags": ["math", "greedy", "dp"], "code_uid": "9201b5a20226c4f24465df253375afa0", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,v = list(map(int,input().split()))\n\nif (n-1)<v:\n\tans = n-1\nelse:\n\tans = v + (n-v)*(n-v+1)/2 - 1\n\nprint(int(ans))", "lang_cluster": "Python", "tags": ["math", "greedy", "dp"], "code_uid": "8bc11f0101ca81c10416711d0148de2f", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\nf = math.factorial\nn, k = map(int,raw_input().split(' '))\ndiff = n-k\nres = 0\nres = diff**diff\nres = res * (k**(k-1))\nprint res % (10**9+7)\n\n", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "combinatorics", "brute force"], "code_uid": "364e772d295b121558ab6b105476b8f8", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n,k=map(int,raw_input().split())\nmod=10**9+7\nprint (pow(k,k-1,mod)*pow(n-k,n-k,mod))%mod", "lang_cluster": "Python", "tags": ["combinatorics"], "code_uid": "ae941f0227fb29f187ec6c365bf53988", "src_uid": "cc838bc14408f14f984a349fea9e9694", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b = sorted(map(int, raw_input().split()))\nans = 0\nwhile a > 0 and b > 1:\n    a += 1\n    b -= 2\n    a, b = sorted([a, b])\n    ans += 1\nprint ans\n", "lang_cluster": "Python", "tags": ["math", "greedy", "dp", "implementation"], "code_uid": "bd2e6f432109ef276edcb5cf07076420", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a_b = list(map(int, input().split(\" \")))\na, b = a_b\n\nn = 0\nif (a > 1) or (b > 1):\n\twhile (a > 0) and (b > 0):\n\t\tif a <= b:\n\t\t\ta += 1\n\t\t\tb -= 2\n\t\telse:\n\t\t\tb += 1\n\t\t\ta -= 2\n\t\tn += 1\n\t\t# print(n, a, b)\nprint(n)#, a, b)", "lang_cluster": "Python", "tags": ["math", "greedy", "dp", "implementation"], "code_uid": "5ad4293ea8123b05f266831c9efe1a54", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "k , a , b , v = map( int , input( ).split( ) )\ns = 0\nwhile  a > 0 :\n    a -= min( k , b + 1 ) * v\n    b -= min( k - 1 , b )\n    s += 1\nprint( s )", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "5da18f6900d759f5c199b2e736e20f56", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "In=lambda:map(int,raw_input().split())\n\nmax_sections, nuts, divisors, nuts_per_sections = In()\n\nboxes = 0\n\nwhile nuts > 0:\n\tboxes += 1\n\tdivs = min(max_sections-1,divisors)\n\tdivisors -= divs\n\tnuts -= (divs+1)*nuts_per_sections\n\nprint boxes", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "e44a7ead85a6906388214e2b7309919a", "src_uid": "7cff20b1c63a694baca69bdf4bdb2652", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def gcd(m, n):\n    while n > 0:\n        r = m % n\n        m = n\n        n = r\n    return m\n\n\na, b, x, y = raw_input().split()\n\na = int(a)\nb = int(b)\nx = int(x)\ny = int(y)\n\nans = 0\nu = gcd(x, y)\nx //= u\ny //= u\nk = min(a // x, b // y)\nxx = k * x\nyy = k * y\nprint xx, yy\n", "lang_cluster": "Python", "tags": ["binary search", "number theory"], "code_uid": "8a01e41b0cab134db702ff151a6162da", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from fractions import gcd\na,b,x,y=map(int,raw_input().split())\ng=gcd(x,y)\nx,y=x/g,y/g\nm=min(a/x,b/y)\nprint x*m,y*m\n\n", "lang_cluster": "Python", "tags": ["binary search", "number theory"], "code_uid": "3189d44e8c0541d00bf4ff99cb797186", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# https://codeforces.com/problemset/problem/935/A\n\nimport math\n\ndef number_of_divisors(num):\n    total_divisors = 0\n    for index in xrange(1, num + 1):\n        if num % index == 0:\n            total_divisors += 1\n    return total_divisors\n\n\ndef main():\n    number_of_employees = int(raw_input())\n    possible_team_leader_combination = number_of_divisors(number_of_employees) - 1\n    print possible_team_leader_combination\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "5d8b8b3274a1e1448f0dbc400fde8708", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\ncount=0\ni=1\n\nfor i in range(1,n):\n\n    if n%i==0:\n        count+=1\n    i+=1\n\nprint(count)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "aa5cbf5e7db0562982b16379599cf1e9", "src_uid": "89f6c1659e5addbf909eddedb785d894", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin, stdout\nimport cProfile, math\nfrom collections import Counter\nfrom bisect import bisect_left,bisect,bisect_right\nimport itertools\nfrom copy import deepcopy\nfrom fractions import Fraction\n\nprintHeap = str()\nmemory_constrained = False\nP = 10**9+7\nimport sys\nsys.setrecursionlimit(10000000)\n\nclass Operation:\n    def __init__(self, name, function, function_on_equal, neutral_value=0):\n        self.name = name\n        self.f = function\n        self.f_on_equal = function_on_equal\ndef add_multiple(x, count):\n    return x * count\ndef min_multiple(x, count):\n    return x\ndef max_multiple(x, count):\n    return x\nsum_operation = Operation(\"sum\", sum, add_multiple, 0)\nmin_operation = Operation(\"min\", min, min_multiple, 1e9)\nmax_operation = Operation(\"max\", max, max_multiple, -1e9)\nclass SegmentTree:\n    def __init__(self,\n                 array,\n                 operations=[sum_operation, min_operation, max_operation]):\n        self.array = array\n        if type(operations) != list:\n            raise TypeError(\"operations must be a list\")\n        self.operations = {}\n        for op in operations:\n            self.operations[op.name] = op\n        self.root = SegmentTreeNode(0, len(array) - 1, self)\n    def query(self, start, end, operation_name):\n        if self.operations.get(operation_name) == None:\n            raise Exception(\"This operation is not available\")\n        return self.root._query(start, end, self.operations[operation_name])\n    def summary(self):\n        return self.root.values\n    def update(self, position, value):\n        self.root._update(position, value)\n    def update_range(self, start, end, value):\n        self.root._update_range(start, end, value)\n    def __repr__(self):\n        return self.root.__repr__()\nclass SegmentTreeNode:\n    def __init__(self, start, end, segment_tree):\n        self.range = (start, end)\n        self.parent_tree = segment_tree\n        self.range_value = None\n        self.values = {}\n        self.left = None\n        self.right = None\n        if start == end:\n            self._sync()\n            return\n        self.left = SegmentTreeNode(start, start + (end - start) // 2,\n                                    segment_tree)\n        self.right = SegmentTreeNode(start + (end - start) // 2 + 1, end,\n                                     segment_tree)\n        self._sync()\n    def _query(self, start, end, operation):\n        if end < self.range[0] or start > self.range[1]:\n            return None\n        if start <= self.range[0] and self.range[1] <= end:\n            return self.values[operation.name]\n        self._push()\n        left_res = self.left._query(start, end,\n                                    operation) if self.left else None\n        right_res = self.right._query(start, end,\n                                      operation) if self.right else None\n        if left_res is None:\n            return right_res\n        if right_res is None:\n            return left_res\n        return operation.f([left_res, right_res])\n    def _update(self, position, value):\n        if position < self.range[0] or position > self.range[1]:\n            return\n        if position == self.range[0] and self.range[1] == position:\n            self.parent_tree.array[position] = value\n            self._sync()\n            return\n        self._push()\n        self.left._update(position, value)\n        self.right._update(position, value)\n        self._sync()\n    def _update_range(self, start, end, value):\n        if end < self.range[0] or start > self.range[1]:\n            return\n        if start <= self.range[0] and self.range[1] <= end:\n            self.range_value = value\n            self._sync()\n            return\n        self._push()\n        self.left._update_range(start, end, value)\n        self.right._update_range(start, end, value)\n        self._sync()\n    def _sync(self):\n        if self.range[0] == self.range[1]:\n            for op in self.parent_tree.operations.values():\n                current_value = self.parent_tree.array[self.range[0]]\n                if self.range_value is not None:\n                    current_value = self.range_value\n                self.values[op.name] = op.f([current_value])\n        else:\n            for op in self.parent_tree.operations.values():\n                result = op.f(\n                    [self.left.values[op.name], self.right.values[op.name]])\n                if self.range_value is not None:\n                    bound_length = self.range[1] - self.range[0] + 1\n                    result = op.f_on_equal(self.range_value, bound_length)\n                self.values[op.name] = result\n    def _push(self):\n        if self.range_value is None:\n            return\n        if self.left:\n            self.left.range_value = self.range_value\n            self.right.range_value = self.range_value\n            self.left._sync()\n            self.right._sync()\n            self.range_value = None\n    def __repr__(self):\n        ans = \"({}, {}): {}\\n\".format(self.range[0], self.range[1],\n                                      self.values)\n        if self.left:\n            ans += self.left.__repr__()\n        if self.right:\n            ans += self.right.__repr__()\n        return ans\n\ndef display(string_to_print):\n    stdout.write(str(string_to_print) + \"\\n\")\n\ndef primeFactors(n): #n**0.5 complex \n    factors = dict()\n    for i in range(2,math.ceil(math.sqrt(n))+1):  \n        while n % i== 0: \n            if i in factors:\n                factors[i]+=1\n            else: factors[i]=1\n            n = n // i \n    if n>2:\n        factors[n]=1\n    return (factors)\n    \ndef isprime(n):\n    \"\"\"Returns True if n is prime.\"\"\"\n    if n < 4:\n        return True\n    if n % 2 == 0:\n        return False\n    if n % 3 == 0:\n        return False\n    i = 5\n    w = 2\n    while i * i <= n:\n        if n % i == 0:\n            return False\n        i += w\n        w = 6 - w\n    return True\n\ndef test_print(*args):\n    if test:\n        print(args)\n\ndef display_list(list1, sep=\" \"):\n    stdout.write(sep.join(map(str, list1)) + \"\\n\")\n\ndef get_int():\n    return int(stdin.readline().strip())\n\ndef get_tuple():\n    return map(int, stdin.readline().split())\n\ndef get_list():\n    return list(map(int, stdin.readline().split()))\n\nmemory = dict()\ndef clear_cache():\n    global memory\n    memory = dict()\ndef cached_fn(fn, *args):\n    global memory\n    if args in memory:\n        return memory[args]\n    else:\n        result = fn(*args)\n        memory[args] = result\n        return result\n\n\n# ----------------------------------------------------------------------------------- MAIN PROGRAM\nTestCases = False\ntest = False\n            \n\ndef main():\n    n = get_int()\n    factors = primeFactors(n)\n    if n==1:\n        print(1,0)\n        return\n    ma = max(factors.values())\n    times = math.ceil(math.log2(ma))\n    r =1\n    for i in factors.keys():\n        r=r*i\n    vals = list(factors.values())\n    a = vals[0]\n    for i in vals:\n        if i!=a or math.log2(i)%1!=0:\n            times+=1\n            break\n    print(r,times)\n    \n\n\n        \n\n\n\n# --------------------------------------------------------------------------------------------- END\n\n\nif TestCases: \n    for _ in range(get_int()): \n        cProfile.run('main()') if test else main()\nelse: cProfile.run('main()') if test else main()", "lang_cluster": "Python", "tags": ["math", "greedy", "number theory"], "code_uid": "50e5bd1f7dba8718a6614ed6ebf865b0", "src_uid": "212cda3d9d611cd45332bb10b80f0b56", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nn=int(input())\narr=[]\nfor i in range(2,n+1):\n\tif n%i==0:\n\t\tcnt=0\n\t\twhile n%i==0:\n\t\t\tcnt+=1\n\t\t\tn=n//i \n\t\tarr.append([i,cnt])\n# print(arr)\nmul=0\nmn=1\nst=0\nfor i in range(len(arr)):\n\tmn=mn*arr[i][0]\n\txx=int(math.log2(arr[i][1]))\n\t# print(xx,(1<<xx))\n\tif arr[i][1]>(1<<xx):\n\t\txx+=1\n\tst=max(st,xx)\nfor i in range(len(arr)):\n\tif arr[i][1]<(1<<st):\n\t\tmul=1\nprint(mn,st+mul)", "lang_cluster": "Python", "tags": ["math", "greedy", "number theory"], "code_uid": "7e3725a193502c909974a34c02996c0f", "src_uid": "212cda3d9d611cd45332bb10b80f0b56", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def cou(n,k):\n    w=1\n    for i in range(n-k+1,n+1):\n        w*=i\n    for i in range (1,k+1):\n        w//=i\n    return w\n\nn,k=map(int,input().split())\nans=0\nfor i in range(1,n+1):\n    pp=1;\n    i1=i;\n    for j in range(2,i+1):\n        sch=0;\n        while(i1%j==0):\n                sch+=1\n                i1//=j\n        if (sch):\n            pp*=cou(sch+k-1,sch)\n    ans+=pp\n    ans%=1000000007\nprint(ans)", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "number theory"], "code_uid": "60580a510b59d6ad33a488b46639a357", "src_uid": "c8cbd155d9f20563d37537ef68dde5aa", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def C(n, m):\n    r = 1\n    for i in range(n - m + 1,n + 1): r *= i\n    for i in range(1, m + 1): r //= i\n    return r\nn, k = map(int, input().split())\na = 0\nfor i in range (1, n + 1):\n    t = 1\n    l = i\n    for j in range(2, i + 1):\n        s = 0\n        while not l % j:\n            s += 1\n            l //= j\n        if s:\n            t *= C(s + k - 1, s)\n    a += t\nprint(a % (10 ** 9 + 7))", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "number theory"], "code_uid": "b8fc2adb432b01f12c614e5550bf7a18", "src_uid": "c8cbd155d9f20563d37537ef68dde5aa", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, m = map(int, raw_input().split())\n\ndef modular_expo(n, m):\n    if n == 1:\n        return 3\n    if n == 0:\n        return 1\n    if n % 2 == 0:\n        temp = modular_expo(n/2, m)\n        return ((temp % m) * (temp % m)) % m\n    else:\n        return (3 * (modular_expo(n-1, m) % m)) % m\n\nans = modular_expo(n, m)\nprint (ans-1+m) % m\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "8b064ca0d2991645a6377501d8fb8ccf", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split());print((pow(3,n,m)-1)%m)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "ac526440778d15610c2ec12d8598de00", "src_uid": "c62ad7c7d1ea7aec058d99223c57d33c", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from itertools import groupby\ns = raw_input().strip()\ncnt = 0\nfor x,y in groupby(s):\n  cnt += ((len(list(y)) & 1)^1)\nprint cnt", "lang_cluster": "Python", "tags": ["two pointers", "implementation"], "code_uid": "751548e8331923256da34aae67198ce7", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s=input()\nmcount=0\ncount=1\nfor i in range(len(s)-1):\n\tif s[i]==s[i+1]:\n\t\tcount+=1\n\telse:\n\t\tif count%2==0:\n\t\t\tmcount+=1\n\t\tcount=1\nif count%2==0:\n\tmcount+=1\nprint(mcount)", "lang_cluster": "Python", "tags": ["two pointers", "implementation"], "code_uid": "6fc7fe04eee9746b104095e4c7dfd8f2", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ncubes = list(map(int, input().split()))\n\ncubes.sort()\n\nprint(' '.join(list(map(str,cubes))))", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "5f56bb5231636fd0f33aad30632dbe43", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#!/usr/bin/env python3\nn = int(input())\na = [int(x) for x in input().split()]\nb = [0] * 100\nc = [0] * n\n\nfor x in range(n):\n    for y in range(a[x]):\n        b[y] += 1\n\nfor x in range(100):\n    for y in range(b[x]):\n        c[n-y-1] += 1\n\nfor x in range(n):\n    print(c[x], end=\" \")\n", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "7b1100d2ac808d2ed1496a3bfa66f1c8", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\nmi, r, mx = n // m, n % m, n - m + 1\nprint((m - r) * (mi * (mi - 1)) // 2 + r * ((mi + 1) * mi) // 2, (mx * (mx - 1)) // 2)", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "combinatorics"], "code_uid": "b89e475051ade2e25904b8e1e4aeee70", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m=map(int,input().split())\nkmax=((n-m+1)*(n-m))//2    \nquo=n//m\nrem=n%m\nkmin=rem*((quo*(quo+1))//2)+(m-rem)*((quo*(quo-1))//2)\nprint(kmin,kmax)", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "combinatorics"], "code_uid": "2fe96404b9e3b30653abbdceb743b159", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n,m=map(int,raw_input().split(\" \"))\nx=map(int,raw_input().split(\" \"))\ny=map(int,raw_input().split(\" \"))\nd=dict()\nfor i in range(10):\n    d[i]=-1\nfor i in y:\n    d[i]=1\nfor i in x:\n    if d[i]==1:\n        print i,\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "cf37bf1a9b1872b8b067f893d608bfa2", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\ngeneral = list(map(int, input().split()))\nfingers = list(map(int, input().split()))\n\nfor item in general:\n    for jtem in fingers:\n        if item == jtem:\n            print(item, end = ' ')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "6990220533dc0598026022b9aa4a2361", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import itertools\n\nn = int(raw_input())\ncube = [0]*n\nfor i in range(n):\n    cube[i] = map(int,raw_input().split())\n\nnums = []\n\nfor j in range(n):\n    for i in cube[j]:\n        nums.append(i)\n\nif n == 2:\n    for j in itertools.permutations('01',2):\n        for i in itertools.product(cube[int(j[0])],cube[int(j[1])]):\n            if not i[0] == \"0\":\n                nums.append(int(str(i[0]) + str(i[1])))\nelif n == 3:\n    for j in itertools.permutations('012',2):\n        for i in itertools.product(cube[int(j[0])],cube[int(j[1])]):\n            if not i[0] == \"0\":\n                nums.append(int(str(i[0]) + str(i[1])))\n\nif n == 3:\n    for j in itertools.permutations('012',3):\n        for i in itertools.product(cube[int(j[0])],cube[int(j[1])],cube[int(j[2])]):\n            if not i[0] == \"0\":\n                nums.append(int(str(i[0]) + str(i[1]) + str(i[2])))\n\ncheck = True\ni = 1\nwhile check:\n    if i not in nums:\n        print i-1\n        check = False\n    i += 1", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "539158ee6d60ee3332c495ea186296bf", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ncnt = True\na = []\nMark = []\nfor i in range(0, n):\n    a.append(list(input().split()))\nif n==1:\n    for i in range(0, 6):\n        Mark.append(a[0][i])\nelif n==3 :\n    for i in range(0, 6):\n        for j in range(0, 6):\n            for p in range(0, 6):\n                Mark.append(a[0][i])\n                Mark.append(a[1][j])\n                Mark.append(a[2][p])\n                Mark.append(a[0][i] + a[1][j])\n                Mark.append(a[0][i] + a[2][p])\n                Mark.append(a[1][j] + a[2][p])\n                Mark.append(a[1][j] + a[0][i])\n                Mark.append(a[2][p] + a[0][i])\n                Mark.append(a[2][p] + a[1][j])\n                Mark.append(a[0][i] + a[1][j] + a[2][p])\n                Mark.append(a[0][i] + a[2][p] + a[1][j])\n                Mark.append(a[1][j] + a[2][p] + a[0][i])\n                Mark.append(a[1][j] + a[0][i] + a[2][p])\n                Mark.append(a[2][p] + a[0][i] + a[1][j])\n                Mark.append(a[2][p] + a[1][j] + a[0][i])\nelse:\n    for i in range(0, 6):\n        for j in range(0, 6):\n            Mark.append(a[0][i])\n            Mark.append(a[1][j])\n            Mark.append(a[0][i] + a[1][j])\n            Mark.append(a[1][j] + a[0][i])\nfor o in range(0, len(Mark)):\n    Mark[o] = int(Mark[o])\nMark.sort()\nfor i in range(1,Mark[-1]):\n    if Mark.count(i) > 0 :\n        pass\n    else:\n        print(i-1)\n        cnt = False\n        break\nif cnt:\n    print(Mark[-1])", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "c72c86724ab0f647cde1723ce1f08fe2", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\nbeauty = 19\nfor i in range(n - 1):\n    while True:\n        beauty += 9\n        if sum(map(int, str(beauty))) == 10:\n            break\n\nprint(beauty)", "lang_cluster": "Python", "tags": ["brute force", "dp", "binary search", "implementation", "number theory"], "code_uid": "39620262cc6b77b024248ebb282e036c", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "k = int(input())\n\na = []\nsum = []\nfor i in range(1, 10):\n    a.append(i)\n    sum.append(i)\nans = -1\nwhile ans == -1:\n    A = []\n    S = []\n    for i in range(len(a)):\n        for j in range(10):\n            if sum[i] + j <= 10:\n                A.append(a[i] * 10 + j)\n                S.append(sum[i] + j)\n    a = A\n    sum = S\n    for i in range(len(a)):\n        if sum[i] == 10:\n            k -= 1\n            if k == 0:\n                ans = a[i]\n                break\nprint(ans)", "lang_cluster": "Python", "tags": ["brute force", "dp", "binary search", "implementation", "number theory"], "code_uid": "c9cf64c6757332cf84ef69feb12de758", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\nn,m=input().split()\nn,m=[int(n),int(m)]\na=[int(i) for i in input().split()]\nma=max(a)\nif (m-ma)>=0:\n    print(n)\nelse:\n    last=ma\n    d1=0\n    for i in range(0,n):\n        if (m-a[i])<0:\n            d=math.ceil(a[i]/m)\n            if d>=d1:\n                d1=d\n                last=i\n    print(last+1)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f8114b2b700b40e2f2b7a0f00f237bc1", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = map(int, input().split())\na = list(map(int, input().split()))\n\nans = r = 0\nfor i in range(n) :\n    x = a[i]\n    if (r <= (x + m - 1) // m) :\n        r = (x + m - 1) // m\n        ans = i\n\nprint(ans + 1)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "77a3fb0e20d021bfe60f8af1db95841f", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# -*- coding:utf-8 -*-\nimport sys\ndef is_ok(v,n):\n    v= str(v)\n    n= str(n)\n    for i in v:\n        if i in n:\n            return 1\n    return 0\n\n\ndef some_func():\n    \"\"\"\n    \"\"\"\n    n = input()\n    cache_dic = {}\n    for v in range(1,int(n**0.5)+2):\n        if n%v==0:\n            cache_dic[v]=1\n            cache_dic[n/v]=1\n\n    count = 0\n    \n    for v in cache_dic.keys():\n        if is_ok(v,n):\n            count+=1\n    print count\n\n\n\nif __name__ == '__main__':\n    some_func()\n\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "293fa4eb741ca5f6a700ff09762d5183", "src_uid": "ada94770281765f54ab264b4a1ef766e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys, math\ndef rs():\n    return sys.stdin.readline().strip()\ndef ri():\n    return int(sys.stdin.readline().strip())\ndef ras():\n    return sys.stdin.readline().strip().split()\ndef rai():\n    return map(int,sys.stdin.readline().strip().split())\ndef main():\n    x = ri()\n    xx = list(str(x))\n    def checkn(y):\n        yy = list(str(y))\n        for j in yy:\n            if j in xx:\n                return True\n        return False\n\n    count = 0\n    if x==1:\n        return 1\n    for i in xrange(1, int(math.sqrt(x))+1):\n\n        if not(x%i):\n            if checkn(i):\n                count+=1\n\n            if checkn(x/i) and i!=x/i:\n                count+=1\n\n    return count\n\n\n\nif __name__ == \"__main__\":\n    print main()", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "062886136703867a3ddeb210a5afc13b", "src_uid": "ada94770281765f54ab264b4a1ef766e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def sum_digit(a):\n    k=a\n    dem=0\n    while k>0:\n        x=k%10\n        dem+=x\n        k=int(k/10)\n    return (dem)\nch=input()\nn=int(ch)\nch=str(n)\nif len(ch)>1:\n    n1=str(int(ch[0])-1)\n    if n1=='0':\n        n1=''\n    for i in range(len(ch)-1):\n        n1+='9'\n    x=int(n1)\n    y=n-x\n    print (sum_digit(x)+sum_digit(y)) \nelse:\n    print (n)", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "b44f33d8273f9a0eb0be9a708427bbfd", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input()\nANS = 0\nfor i in range(len(s) - 1):\n    ANS = ANS * 10 + 9\nNUMMM = 0\nfor i in range(10):\n    NUMMM += str(int(s) - ANS).count('{0}'.format(i)) * i\nprint((len(s) - 1) * 9 + NUMMM)\n    ", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "ac2f8a34e748b00f46263869c9855695", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "arr = list(map(int, input().strip().split()))\ns = sum(arr)\nif s % 5 == 0 and s//5 > 0:\n\tprint(s//5)\nelse:\n\tprint(-1)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "537665050f70df895010bca7c626b028", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "l=list(map(int,input().split()))\nka=sum(l)\nif(ka==0 or ka%5!=0):\n    print(-1)\nelse:\n    print(ka//5)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "6b53bcd4ba39d560001efb7859814d75", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "players = {1, 2, 3}\nnot_playing = 3\ncases = int(input())\ntrial = cases\nfor x in range (cases):\n  winner = int(input())\n  if winner == not_playing: \n    print (\"NO\")\n    break\n  for y in players:\n    if y != winner and y!= not_playing: \n      not_playing = y\n      break\n  trial -= 1\nif trial == 0: print(\"YES\") ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "827593fa89aed566f5777539d3fc1347", "src_uid": "6c7ab07abdf157c24be92f49fd1d8d87", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\nc=3\nfor i in range(n):\n    a=int(input())\n    if a==c:\n        print('NO')\n        exit()\n    c=6-a-c\nelse:\n    print('YES')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "0605bbfb9069113399a09235b6fe43eb", "src_uid": "6c7ab07abdf157c24be92f49fd1d8d87", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b, c = map(int, input().split())\n\ndef s(x):\n    xStr = str(x)\n    sum = 0\n    for c in xStr:\n        sum += int(c)\n    return sum\n\n\nrightSide = []\nM = 9*9+1\nfor k in range(1,M):\n    rightSide.append(b*k**a + c)\n\nmyList = []\nsol = 0\nfor x in rightSide:\n    if(x>0 and x<int(1e9) and x==b*s(x)**a + c):\n        sol += 1\n        myList.append(x)\n\nmyList.sort()\nprint(sol, end='\\n')\nfor num in myList:\n    print(num, sep=' ', end=' ')\n", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation", "number theory"], "code_uid": "0804f806a9590ab9cbc36094ab9f5e17", "src_uid": "e477185b94f93006d7ae84c8f0817009", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys, itertools as it\n# sys.stdin = open(\"main.inp\", \"r\")\n# sys.stdout = open(\"main.out\", \"w\")\n\na, b, c = map(int, input().split())\n\nans = []\nfor d in range(1, 82): # 1->81\n    x = b*(d**a)+c\n    if x > 0 and x < 1e9 and sum(map(int, list(str(x)))) == d:\n        ans.append(x)\n\nprint(len(ans))\nfor res in ans: print(res, end=\" \")", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation", "number theory"], "code_uid": "14639c1d2d3a00d9566c58a290e2029d", "src_uid": "e477185b94f93006d7ae84c8f0817009", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\nl=list(map(int,input().split()))\nli=[0]*(n+1)\nfor i in l:\n    for j in range(i,n+1):\n        if li[j]==0:\n            li[j]=i\nfor i in range(1,n+1):\n    print(li[i],end=\" \")\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "fefc15d215b139fa1eca6c9d58f35131", "src_uid": "2e44c8aabab7ef7b06bbab8719a8d863", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n , m = map(int,input().split())\nl = list(map(int,input().split()))\na = []\n\nfor i in range(1,n+1):\n    for j in l :\n        if j <= i :\n            a.append(j)\n            break\n\nprint(*a)\n\n\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "af32cdb0f6fe5d9018aaa8064a2a0d22", "src_uid": "2e44c8aabab7ef7b06bbab8719a8d863", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "class A:\n\n    def rotate_keypad(self, keypad):\n        reversed_rows = list(reversed(keypad))\n        return [\"\".join(list(reversed(x))) for x in reversed_rows]\n\n    def solve(self):\n        keypad = [input(), input(), input()]\n        if keypad == self.rotate_keypad(keypad):\n            print(\"YES\")\n        else:\n            print(\"NO\")\n\nA().solve()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "111a649d2f09694e89c0a614d864ba6b", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def solve():\n    keys = []\n    rev = []\n    for i in range(3):\n        keys += list(raw_input().strip())\n    for i in keys:\n        rev.insert(0,i)\n    if keys == rev:\n        print 'YES'\n    else:\n        print 'NO'\n\nsolve()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "ae2893562b9421e1248d5e08f1a005a3", "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def palindromeString(n):\n    s = str(n)\n    myList = list(s)\n    for i in range(0, len(s)):\n        myList.append(s[len(s) - i - 1])\n    return int(''.join(myList))\ninputLine = input()\ninputList = inputLine.split(' ')\nk = int(inputList[0])\np = int(inputList[1])\nsum = 0\nfor i in range(1, k + 1):\n    sum += palindromeString(i)\nprint(sum % p)\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "5775791c3436aa1ea2ea8fbb631f4f7f", "src_uid": "00e90909a77ce9e22bb7cbf1285b0609", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\n\nk,p=map(int,input().split())\ns=0\nfor i in range(1,k+1):\n    s+=int(str(i)+str(i)[::-1])\nprint(s%p)\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "656ec5ee269011e891331761de86f108", "src_uid": "00e90909a77ce9e22bb7cbf1285b0609", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#import resource\n#import sys\n#resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])\n#sys.setrecursionlimit(0x10000000)\nfrom sys import stdin, stdout\ndef GCD(x, y):\n   while(y):\n       x, y = y, x % y\n   return x\ndef BS(arr, l, r, x):\n    if r >= l:\n        mid = l + (r - l)/2\n        if arr[mid] == x:\n            return mid\n        elif arr[mid] > x:\n            return BS(arr, l, mid-1, x)\n        else:\n            return BS(arr, mid+1, r, x)\n    else:\n        return -1\nfrom bisect import bisect_left as bl\nfrom bisect import bisect_right as br\nimport itertools\nimport math\na=input()\nb=raw_input()\ne=[]\nfor i in range(2,a):\n    if(a%i==0):\n        e.append(i)\nfor i in range(len(e)):\n    d=b[:e[i]]\n    d=d[::-1]+b[e[i]:]\n    b=d[:]\nprint b[::-1]\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b63fdc93e006c0622ac5ae4f59feee39", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import ceil,sqrt\nn = int(input())\ns = input()\ndiv = []\nfor i in range(2,ceil(sqrt(n))+1):\n    if n%i == 0:\n        div.append(i)\n        div.append(n//i)\ndiv = sorted(list(set(div)))\nfor i in div:\n    a = s[:i]\n    s = a[::-1] + s[i:]\nif n != 2:\n    print(s[::-1])\nelse:\n    print(s)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "cb94ea3dbb74f81337be3b111e49b0b7", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\n\nk, n, s, p = raw_input().split()\npaperEachNeed = math.ceil(float(n) / float(s))\ntotalPapers = paperEachNeed * float(k)\npacksToBuy = math.ceil(totalPapers / float(p))\nprint(int(packsToBuy))\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "21881c8d97f5c0fa72d73dcab1dacc46", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\npeople, planesperperson, planespersheet, sheetsperpack = [int(i) for i in input().split(' ')]\nsheetsperperson = math.ceil(planesperperson / planespersheet)\nsheetstotal = sheetsperperson * people\npackstotal = math.ceil(sheetstotal / sheetsperpack)\nprint(packstotal)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "d377845ad2efde2777b9a91f96bb6392", "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\nif n == 0:\n\tprint 'O-|-OOOO'\nwhile n:\n\tn,i = n/10,n%10\n\tprint 'O'*(1-i/5)+'-'+'O'*(i/5)+'|'+'O'*(i%5)+'-'+'O'*(4-i%5)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "bc290832aa34b1fade1142afa1f5b234", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=input()\nn=n[::-1]\na='O-|-OOOO'\nj=0\n  # 'O-|OOO-O'\nfor i in n:\n\tb=list(a)\n\tif int(i)<5:\n\t\tb[3+int(i)]=a[3]\n\t\tif int(i)>0:\n\t\t\tb[3]=a[0]\n\telse:\n\t\tj=int(i)-5\n\t\tb[3+j]=a[3]\n\t\tif j>0:\n\t\t\tb[3]=a[0]\n\t\tb[0]=a[1]\n\t\tb[1]=a[0]\n\tstr=\"\"\n\tprint(str.join(b))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "ef90748cb8f7890749f4532e24fd2a02", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\nprint(n+m-1-min(n,m),min(n,m))", "lang_cluster": "Python", "tags": ["greedy", "implementation", "games"], "code_uid": "22a3d2f66be3bb06ff3706b8e59e89a4", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\ndef playingCubes(n,m):\n\tprint((m+n-1) - min(m,n) ,min(m,n))\n\nn,m = input().split()\nplayingCubes(int(n),int(m))", "lang_cluster": "Python", "tags": ["greedy", "implementation", "games"], "code_uid": "5f6ea8d8314842ce9a14c17973dbf82b", "src_uid": "c8378e6fcaab30d15469a55419f38b39", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\"\"\"\nby goyal.aman\nhttps://codeforces.com/problemset/problem/599/A\n\nnote:\npatrick can visit first any shop\n\"\"\"\n\na,b,c = map(int, input().split())\n\"\"\"\na : home -> shop1\nb : home -> shop2\nhome c : shop1 - shop2\n\"\"\"\n\n\"\"\"\npossible routes:\n          home\n        /       \\\n     shop1 ---- shop2\n\nhome - shop1 - shop2 - home\n\nhome - shop1 - shop2 - shop1 - home\nhome - shop2 - shop1 - shop2 - home\n\nhome - shop1 - home - shop2 - home <2 ways>\n\"\"\"\n\nroute1 = a + c + b\nroute2 = a + c + c + a\nroute3 = b  + c + c + b\nroute4 = a + a + b + b\n# print(\"printing routes\")\n# print(route1)\n# print(route2)\n# print(route3)\n# print(route4)\n# print(\"ending routes\")\n# print('min', end=' ')\n\nprint(min(route1, route2, route3, route4))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "3a8cb6d1c70d6021b88019306520c729", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "tracking = sorted(list(map(int, input().split())))\nx, y, z = tracking\nif x * 2 >= y and y * 2 >= z:\n    result = x + y + z\nelse:\n    result = (tracking[0]+tracking[1]) * 2\nprint(result)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b465475661f662bdff55453b223014d8", "src_uid": "26cd7954a21866dbb2824d725473673e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\n# from collections import deque\n# from collections import Counter\n# from math import sqrt\n# from math import log\n# from math import ceil\n# from bisect import bisect_left, bisect_right\n\n# alpha=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n# mod=10**9+7\n# mod=998244353\n\n# def BinarySearch(a,x): \n# \ti=bisect_left(a,x) \n# \tif(i!=len(a) and a[i]==x): \n# \t\treturn i \n# \telse: \n# \t\treturn -1\n\n# def sieve(n): \n# \tprime=[True for i in range(n+1)]\n# \tp=2\n# \twhile(p*p<=n): \n# \t\tif (prime[p]==True): \n# \t\t\tfor i in range(p*p,n+1,p): \n# \t\t\t\tprime[i]=False\n# \t\tp+=1\n# \tprime[0]=False\n# \tprime[1]=False\n# \ts=set()\n# \tfor i in range(len(prime)):\n# \t\tif(prime[i]):\n# \t\ts.add(i)\n# \treturn s\n\n# def gcd(a, b):\n# \tif(a==0):\n# \t\treturn b \n# \treturn gcd(b%a,a)\n\nfast_reader=sys.stdin.readline\nfast_writer=sys.stdout.write\n\ndef input():\n\treturn fast_reader().strip()\n\ndef print(*argv):\n\tfast_writer(' '.join((str(i)) for i in argv))\n\tfast_writer('\\n')\n\n#____________________________________________________________________________________________________________________________________\n\n# for _ in range(1):\n# \tn=int(input())\n# \tans=0\n# \ts=set()\n# \tfor i in range(1,n):\n# \t\tfor j in range(i,n):\n# \t\t\tif(i^j>n):\n# \t\t\t\tcontinue\n# \t\t\ta=i\n# \t\t\tb=j\n# \t\t\tc=i^j\n# \t\t\tp=sorted([a,b,c])\n# \t\t\tt=(p[0],p[1],p[2])\n# \t\t\tif(a+b>c and a+c>b and b+c>a and t not in s):\n# \t\t\t\tans+=1\n# \t\t\t\ts.add(t)\n# \tprint(ans)\n\nfor _ in range(1):\n\tn=int(input())\n\tans=0\n\tfor i in range(1,n+1):\n\t\tfor j in range(i+1,n+1):\n\t\t\tif(i^j>n or i^j>i or i^j>j):\n\t\t\t\tcontinue\n\t\t\ta=i\n\t\t\tb=j\n\t\t\tc=i^j\n\t\t\tif(a+b>c and a+c>b and b+c>a):\n\t\t\t\tans+=1\n\t\t\t\t#print(a,b,c)\n\tprint(ans)", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "b271019306b4139ad8184276e7cbaa92", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\ncount = 0\nfor i in range(1,n):\n    for j in range(i+1,n+1):\n        k = i^j\n        if k>i and k>j:\n            if k <=n and k < i+j:\n                count += 1\n\nprint count", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "fc103fb2420fe4346d5d845e43cb3ce9", "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,c=map(int,input().split())\nl=list(map(int,input().split()))\nd=list(map(int,input().split()))\nx,y=0,0\ns,ka,t,h=0,0,0,0\nfor i in range(n):\n    t=t+d[i]\n    m=max(0,l[i]-c*t)\n    s=s+m\nfor i in range(n-1,-1,-1):\n    h=h+d[i]\n    m=max(0,l[i]-c*h)\n    ka=ka+m\nif(s==ka):\n    print(\"Tie\")\nelif(s>ka):\n    print(\"Limak\")\nelse:\n    print(\"Radewoosh\")\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "5ef3d8153f5a060f6ec28bab85e53c06", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nimport math\nimport itertools as it\nimport operator as op\n\n\nn, c = map(int, sys.stdin.readline().split())\nP = list(map(int, sys.stdin.readline().split()))\nT = list(map(int, sys.stdin.readline().split()))\n\ntl = tr = sl = sr = 0\nfor i in range(n):\n  tl += T[i]\n  tr += T[n-1-i]\n  sl += max(0, P[i] - c*tl)\n  sr += max(0, P[n-1-i] - c*tr)\n\nif sl > sr:\n  print('Limak')\nelif sl == sr:\n  print('Tie')\nelse:\n  print('Radewoosh')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "56f1c2874478894c7b73eb560b4fe519", "src_uid": "8c704de75ab85f9e2c04a926143c8b4a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\narr =  list(map(int,input().split()))\narr.sort()\nminIns = 0\nfor k in range(len(arr)-1):\n    minIns+=arr[k+1]-arr[k]\nfor i in range(0,2*n):\n    for j in range(i+1,2*n):\n        newArr = arr[0:i]+arr[i+1:j]+arr[j+1:]\n        #print(i,j,newArr)\n        #Ins = 0\n        \n        minIns=min(minIns,sum(newArr[k+1]-newArr[k] for k in range(0,len(newArr)-1,2)))\n\nprint(minIns)", "lang_cluster": "Python", "tags": ["brute force", "sortings", "greedy"], "code_uid": "888c1228162ce26933aaa22f26eefee1", "src_uid": "76659c0b7134416452585c391daadb16", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nn=n*2\narr=[int(x) for x in input().split()]\narr=sorted(arr)\nx=arr[n-1]\nfor i in range(0,n):\n    for j in range(i+1,n):\n        # i,j \u9009\u4e2d\u7684single\n        a,h,q=0,0,0\n        while h<n:\n            if h==i or h == j:\n                pass\n\n            else:\n                if q%2==0:\n                    a-=arr[h]\n                else:\n                    a+=arr[h]\n                q+=1\n            h+=1\n        # print(a)    \n        x=min(x,a)\nprint(x)", "lang_cluster": "Python", "tags": ["brute force", "sortings", "greedy"], "code_uid": "e0d3b5602a8120e061e3f0f32a21b8b2", "src_uid": "76659c0b7134416452585c391daadb16", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from math import log\n\ndef calculateExp(x, y, z, k):\n\tif(k == 1):\n\t\treturn x**(y**z), \"x^y^z\"\n\telif(k == 2):\n\t\treturn x**(z**y), \"x^z^y\"\n\telif(k == 3 or k == 4):\n\t\treturn x**(z*y), \"(x^y)^z\"\n\telif(k == 5):\n\t\treturn y**(x**z), \"y^x^z\"\n\telif(k == 6):\n\t\treturn y**(z**x), \"y^z^x\"\n\telif(k == 7 or k == 8):\n\t\treturn y**(x*z), \"(y^x)^z\"\n\telif(k == 9):\n\t\treturn z**(x**y), \"z^x^y\"\n\telif(k == 10):\n\t\treturn z**(y**x), \"z^y^x\"\n\telif(k == 11 or k == 12):\n\t\treturn z**(x*y), \"(z^x)^y\"\n\ndef calculateLogLog(x, y, z, k):\n\tif(x > 1):\n\t\tif(k == 1):\n\t\t\treturn z * log(y) + log(log(x)), \"x^y^z\"\n\t\telif(k == 2):\n\t\t\treturn y * log(z) + log(log(x)), \"x^z^y\"\n\t\telif(k == 3 or k == 4):\n\t\t\treturn log(y) + log(z) + log(log(x)), \"(x^y)^z\"\n\n\tif(y > 1):\n\t\tif(k == 5):\n\t\t\treturn z * log(x) + log(log(y)), \"y^x^z\"\n\t\telif(k == 6):\n\t\t\treturn x * log(z) + log(log(y)), \"y^z^x\"\n\t\telif(k == 7 or k == 8):\n\t\t\treturn log(x) + log(z) + log(log(y)), \"(y^x)^z\"\n\n\tif(z > 1):\n\t\tif(k == 9):\n\t\t\treturn y * log(x) + log(log(z)), \"z^x^y\"\n\t\telif(k == 10):\n\t\t\treturn x * log(y) + log(log(z)), \"z^y^x\"\n\t\telif(k == 11 or k == 12):\n\t\t\treturn log(x) + log(y) + log(log(z)), \"(z^x)^y\"\n\n\treturn False, \"\"\ndef getAns(x, y, z):\n\tif(max(x,y,z) < 1):\n\t\tmaxNum, ans = 0, \"\"\n\t\tfor i in index:\n\t\t\tt = calculateExp(x, y, z, i)\n\t\t\tif(t[0] > maxNum):\n\t\t\t\tans = t[1]\n\t\t\t\tmaxNum = t[0]\n\t\treturn ans\n\telif(max(x, y, z) == 1):\n\t\tif(x == 1):\n\t\t\treturn \"x^y^z\"\n\t\telif(y == 1):\n\t\t\treturn \"y^x^z\"\n\t\telse:\n\t\t\treturn \"z^x^y\"\n\telse:\n\t\tmaxNum, ans = None, \"\"\n\t\tfor i in index:\n\t\t\tt = calculateLogLog(x, y, z, i)\n\t\t\tif(t[0] != False):\n\t\t\t\tif(maxNum == None or t[0] > maxNum):\n\t\t\t\t\tans = t[1]\n\t\t\t\t\tmaxNum = t[0]\n\t\t\t# print(t, ans)\n\n\t\treturn ans\n\nindex = [1, 2, 3, 5, 6, 7, 9, 10, 11]\nif(__name__ == \"__main__\"):\n\tx, y, z = [float(t) for t in raw_input().split(' ')]\n\t\n\tprint(getAns(x, y, z))", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms"], "code_uid": "eb5a6a132f0d6aeb4de90b18144bb2af", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from math import log\nfrom decimal import *\nx, y, z = map(Decimal, raw_input().split())\nln = lambda x : Decimal(log(x))\nans = sorted([(-ln(x) * y ** z, \"x^y^z\"), \n\t(-ln(x) * z ** y, \"x^z^y\"), \n\t(-ln(x) * y * z, \"(x^y)^z\"), \n\t(-ln(y) * x ** z, \"y^x^z\"), \n\t(-ln(y) * z ** x, \"y^z^x\"), \n\t(-ln(y) * x *z, \"(y^x)^z\"), \n\t(-ln(z) * x ** y, \"z^x^y\"), \n\t(-ln(z) * y ** x, \"z^y^x\"), \n\t(-ln(z) * x * y, \"(z^x)^y\")\n\t], key = lambda lst : lst[0])\nprint ans[0][1]\n", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms"], "code_uid": "9e34dfd55ee35ea4786b3336df9a02ef", "src_uid": "a71cb5cda754ad2bf479bc3b0164fc4c", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "ax, bx = map(str, input().split())\nd = max([ord(c) - ord('0') for c in ax] + [ord(c) - ord('0') for c in bx]) + 1\nad, bd = 0, 0\nfor dig in ax:\n  ad = ad * d + (ord(dig) - ord('0')) % 10\nfor dig in bx:\n  bd = bd * d + (ord(dig) - ord('0')) % 10\nc = ad + bd\nans = 0\nwhile c > 0:\n  ans += 1\n  c //= d\nprint(ans)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "85502b6928d92d17f5f677956d892e21", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n\ndef digitsNum(x, base):\n    ret = 0\n    while x>0:\n        ret += 1\n        x //= base\n    return ret\n\nn, m= sys.stdin.read().split()\n\nbase = int(max(max(n), max(m)))+1\nn = int(n, base)\nm = int(m, base)\n\nprint(digitsNum(n+m, base))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "74f1b16ccb7893a1d7b3ef1d1fec996e", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#Finaly\n\nnum=input()\n\nif(ord(num[0])>=ord('5') and num[0]!='9'):\n    ans=chr((9-(ord(num[0])-ord('0')))+ord('0'))\nelse:\n    ans=num[0]\n\n\nfor i in range(1,len(num)):\n    if ord(num[i])>=ord('5'):\n        ans+=chr((9-(ord(num[i])-ord('0')))+ord('0'))\n    else:\n         ans+=num[i]\n        \n        \nprint(ans)\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "d0724f5afad3c1b0622fd8672eaae4f8", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "t = int(raw_input())\nret = 0\npows= 1\ndigit = 0\nwhile t > 0:\n    digit = t%10\n    if digit > 4:\n        ret = ret + (9-digit)*pows\n    else:\n        ret = ret + digit*pows\n    pows *= 10\n    t /= 10\n\nif digit == 9:\n    ret = ret + digit*pows/10\nprint ret\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "d92743d433f33e4bfe0082dbdf1059b0", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=list(map(int,input().split()))\nn1=list(map(int,input().split()))\nlst=[]\ns=0\nfor i in n1:\n    lst.append(i)\nn1.reverse()\nfor i in range(len(n1)):\n    if(lst[i]!=n1[i] and lst[i]!=2 and n1[i]!=2):\n        s=-1\n        break\n    elif(lst[i]==2 and n1[i]==0):\n        lst.insert(i,0)\n        lst.remove(lst[i+1])\n        s=s+n[1]\n    elif(lst[i]==2 and n1[i]==1):\n        lst.insert(i,1)\n        lst.remove(lst[i+1])\n        s=s+n[2]\n    else:\n        if(n1[i]==2 and lst[i]==2):\n            if(n[1]<n[2]):\n                lst.insert(i,0)\n                lst.remove(lst[i+1])\n                s=s+n[1]\n            else:\n                lst.insert(i,1)\n                lst.remove(lst[i+1])\n                s=s+n[2]\nprint(s)\n    \n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "92e951227efb44bef1b0e3715f4149d3", "src_uid": "af07223819aeb5bd6ded4340c472b2b6", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\nn,x,y = map(int,input().strip().split())\n\na = list(map(int,input().strip().split()))\n\nans_a = 0\nans_b = 0\nans = 1\n\nfor i in range(n//2):\n    \n    if a[i] != a[n-i-1]:\n        if a[i]==2 or a[n-i-1]==2:\n            if a[i] == 0 or a[n-i-1]==0:\n                ans_a+=1\n            else:\n                if a[i] == 1 or a[n-i-1]==1:\n                    ans_b+=1\n        else:\n            ans = 0\n            break\n    else:\n            if a[i] == 2 and a[n-i-1] == 2:\n                if x < y:\n                    ans_a+=2\n                else:\n                    ans_b+=2\n\n\nif ans:\n    temp = 0\n    if n%2 == 0:\n        temp = 0\n    else:\n        if a[n//2] == 2:\n            temp = min(x,y)\n        \n    print(ans_a*x + ans_b*y + temp)\nelse:\n    print(-1)\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "8105c3dfd8ed8ec6c97ab023cb9ada88", "src_uid": "af07223819aeb5bd6ded4340c472b2b6", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def gcd(a, b):\n    return gcd(b % a, a) if a else b\nx, y, n = map(int, input().split())\ng = gcd(x, y)\nx, y = x // g, y // g\nif n < y:\n    d = [min(i, y - i) for i in ((x * i) % y for i in range(0, n + 1))]\n    for i in range(n - 1, 0, -1):\n        if d[i] < d[n] and n * d[i] <= i * d[n]: n = i\n    print(str((x * n) // y + int(2 * ((x * n) % y) > y)) + '/' + str(n))\nelse: print(str(x) + '/' + str(y))", "lang_cluster": "Python", "tags": ["two pointers", "implementation", "brute force"], "code_uid": "22def467f9d67cc03900bd12527b29b6", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from __future__ import print_function\nfrom fractions import Fraction;\ndef main():\n    a,b,c = map(int,raw_input().split())\n    x = Fraction(a,b);\n    x=x.limit_denominator(c);\n    print(x.numerator,'/',x.denominator,sep='')\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["two pointers", "implementation", "brute force"], "code_uid": "bc3c3c9feebd27fd3d24d59ec7ae8619", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input()\nscore = 0\nmoves = 0\nc = s[0]\nr = s[1]\n\nif c == \"a\" or c == \"h\":\n\tscore += 1\nif r == \"1\" or r == \"8\":\n\tscore += 1\n\t\nif score == 2:\n\tmoves = 3\nelif score == 1:\n\tmoves = 5\nelse:\n\tmoves = 8\n\nprint moves\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b0e03e70c7ed36f0ef47fd443dfc98a8", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import re\na = int(8)\nb = int(5)\nc = int(3)\npositions = input()\n\nif re.search(\"[b-g]\", positions):\n    if re.search(\"[2-7]\", positions):\n        print(a)\n    elif re.search(\"[1]\", positions):\n        print(b)\n    elif re.search(\"[8]\", positions):\n        print(b)\n\nif re.search(\"[h]\", positions):\n    if re.search(\"[2-7]\", positions):\n        print(b)\n    elif re.search(\"[1]\", positions):\n        print(c)\n    elif re.search(\"[8]\", positions):\n        print(c)\n\nif re.search(\"[a]\", positions):\n    if re.search(\"[2-7]\", positions):\n        print(b)\n    elif re.search(\"[1]\", positions):\n        print(c)\n    elif re.search(\"[8]\", positions):\n        print(c)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "41d53f8f4830f182da6aa21df5604e43", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nk = 10**6 + 1\nfor i in range(2,min(n,k)):\n    while not n%i**2:\n        n //= i\nprint(n)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "d35ddbb2a371aec722bf6d74ed901be0", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ni = 2\nresposta = 1\nwhile i * i <= n:\n\tif n % i == 0:\n\t\tresposta *= i\n\t\twhile n % i == 0:\n\t\t\tn //= i\n\ti += 1\nif n > 1:\n\tresposta *= n\nprint(resposta)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "2bec2326ca5bfba429dba84c103ad4ff", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\nn,m=map(int,raw_input().split())\nl=1\nr=10000000000000\nif n<=m:\n    print n\n    exit()\nwhile l<r:\n    mid=(l+r)/2\n    t=(1+mid)*mid/2\n    #print l, r,mid,t\n    if t>=n-m:\n        r=mid\n    else:\n        l=mid+1\nprint int(l+m)\n#print int(math.ceil((-3+pow(9+4*(2*n-2*m-2),0.5))/2)+1+m)", "lang_cluster": "Python", "tags": ["math", "binary search"], "code_uid": "b35736fed4e6da458bb7205fdfb66f2e", "src_uid": "3b585ea852ffc41034ef6804b6aebbd8", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#!/usr/bin/env python3\nfrom bisect import *\n\ndef ri():\n    return map(int, input().split())\n\nn, m = ri()\n\nif m-n >= 0:\n    print(n)\n    exit()\n\nk = (n-m)\nal = 0\nar = 2*k*(k+1)+1\n\nwhile ar-al > 1:\n    a = (al+ar)//2\n    aa = a*(a+1)//2\n    if k <= aa:\n        ar = a\n    else:\n        al = a\nprint(ar+m)\n", "lang_cluster": "Python", "tags": ["math", "binary search"], "code_uid": "efd1d3c38fb117e711911e1c05668897", "src_uid": "3b585ea852ffc41034ef6804b6aebbd8", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom math import *\nreadints=lambda:map(int, input().strip('\\n').split())\n\nla,ra,ta=readints()\nlb,rb,tb=readints()\n\n\nk=(la-lb)/gcd(ta,tb)\nklo=floor(k)\nkhi=ceil(k)\n\ndef intersection(ax,ay,bx,by):\n    # print(ax,ay,bx,by)\n    l,r=max(ax,bx),min(ay,by)\n    if l>r: return 0\n    return r-l+1\n\n# print(klo,khi)\n\n\nans = 0\nfor dk in [klo,khi]:\n    df=lb-la + dk*gcd(ta,tb)\n    bx=la+df\n    by=bx+(rb-lb)\n    #print(ax,ay,'df',df)\n    ans = max(ans, intersection(la,ra,bx,by))\n\n\n\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "60e11e29dc415a56c85bd06b2574e226", "src_uid": "faa75751c05c3ff919ddd148c6784910", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "'''input\n7 13 18\n2 6 12\n'''\nimport math\ndef solve():\n\tl1,r1,t1 = list(map(int,input().split()))\n\tl2,r2,t2 = list(map(int,input().split()))\n\t# diff  = l1-l2+k1*t1-k2*t2\n\t# diff  = l1-l2 + K*gcd(t1,t2)\n\t# l2-l1 / gcd(t1,t2) = K\n\tg = math.gcd(t1,t2)\n\tK1 = (l2-l1)//g \n\tK2 = (l2-l1)//g \n\tif((l2-l1)%g!=0):\n\t\tK2+=1\n\tdiff1 = l1-l2 + K1*g\n\tdiff2 = l1-l2 + K2*g\n\tif t1==t2:\n\t\tprint(min(r1,r2)-max(l1,l2)+1)\n\t\treturn\n\t#print(diff1,diff2)\n\tans = 0\n\tfor i in [diff1,diff2]:\n\t\tl22 = l2+i\n\t\tr22 = l22+r1-l1\n\t\tans = max(ans,min(r22,r2)-max(l22,l2)+1)\n\tprint(ans)\n\treturn\nt = 1\n#t = int(input())\nwhile t>0:\n\tt-=1\n\tsolve()", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "b3912829b7c86787da9cc616df1f7a53", "src_uid": "faa75751c05c3ff919ddd148c6784910", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\n\nn, t, k, d = map(int, input().split())\n\ns1 = math.ceil(n/k)*t\n\nc = 0\n\nup = 1000*t\ndown = 0\n\nwhile up > down+1:\n    mid = (up+down)//2\n    c += (mid//t)*k\n    c += ((mid-d)//t)*k\n    if c>=n:\n        up = mid\n    else:\n        down = mid\n    c = 0\n\nc = 0\n##print('up', up)\n##print('down', down)\n##print('mid', mid)\n\nif (down//t)*k + ((down-d)//t)*k == n:\n    s2 = down\nelif (mid//t)*k + ((mid-d)//t)*k == n:\n    s2 = mid\nelse:\n    s2 = up\n\n##print('s1', s1)\n##print('s2', s2)\nif s2<s1:\n    print('YES')\nelse:\n    print('NO')\n\n    \n    \n    \n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "d2453c30496085fcad352fd031d650ef", "src_uid": "32c866d3d394e269724b4930df5e4407", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "arr=[]\nfor x in raw_input().split():\n    arr.append(int(x))\n\na = arr[0]\nb = arr[1]\nc = arr[2]\nd = arr[3]\n\n#print a,b,c,d\n\ntime1 = 0\na1 = a\ntime1 = ((a1-1)/c+1) * b\n\ntime2 = 0\na2 = a\nflag = False\nwhile a2 > 0:\n    time2 += 1\n    if (time2 % b ==0):\n        a2 -= c\n    if time2-d > 0 and (time2-d) %b == 0:\n        a2 -= c\n#print time1,time2\n\nif time1 > time2:\n    print 'YES'\nelse :\n    print 'NO'", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "c2bc8238b1bed64f944ed617bb476b5f", "src_uid": "32c866d3d394e269724b4930df5e4407", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from __future__ import print_function\nn = input()\na = []\nfor i in range(n):\n    a.append([int(x) for x in raw_input().split()])\nsumma = sum(a[(n-1)//2])\na[(n-1)//2] = [0 for i in range(n)]\nfor i in range(n):\n    summa+=a[i][i]\n    a[i][i] = 0\n    summa+=a[i][n-i-1]\n    a[i][n-i-1] = 0\nfor i in range(n):\n    summa+=a[i][(n-1)//2]\nprint(summa)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "d22a9477c98b919197cd752fe96317e1", "src_uid": "5ebfad36e56d30c58945c5800139b880", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import *\nfrom copy import *\nfrom string import *\t\t\t\t# alpha = ascii_lowercase\nfrom random import *\nfrom sys import stdin\nfrom sys import maxsize\nfrom operator import *\t\t\t\t# d = sorted(d.items(), key=itemgetter(1))\nfrom itertools import *\nfrom collections import Counter\t\t# d = dict(Counter(l))\nimport math\n\ndef bin1(l,r,k,t,b,val,ans):\n\tif(l>r):\n\t\treturn ans\n\telse:\n\t\tmid=(l+r)//2\n\t\tv=k**mid\n\t\tif(v==val):\n\t\t\treturn v\n\t\telif(v>val):\n\t\t\tans=mid\n\t\t\treturn bin1(mid+1,r,k,t,b,val,ans)\n\t\telse:\n\t\t\treturn bin1(l,mid-1,k,t,b,val,ans)\n\t\t\ndef bin2(l,r,k,t,b,val,ans):\n\tif(l>r):\n\t\treturn ans\n\telse:\n\t\tmid=(l+r)//2\n\t\tv=t*(k**mid)+b*(mid)\n\t\tif(v==val):\n\t\t\treturn v\n\t\telif(v>val):\n\t\t\tans=mid\n\t\t\treturn bin2(l,mid-1,k,t,b,val,ans)\n\t\telse:\n\t\t\treturn bin2(mid+1,r,k,t,b,val,ans)\n\ndef SieveOfEratosthenes(n): \n      \n    # Create a boolean array \"prime[0..n]\" and initialize \n    #  all entries it as true. A value in prime[i] will \n    # finally be false if i is Not a prime, else true. \n    prime = [True for i in range(n+1)] \n    p = 2\n    while (p * p <= n): \n          \n        # If prime[p] is not changed, then it is a prime \n        if (prime[p] == True): \n              \n            # Update all multiples of p \n            for i in range(p * p, n+1, p): \n                prime[i] = False\n        p += 1\n    l=[]\n    for i in range(2,n+1):\n    \tif(prime[i]):\n    \t\tl.append(i)\n    return l\ndef bin(l,r,ll,val):\n\tif(l>r):\n\t\treturn -1\n\telse:\n\t\tmid=(l+r)//2\n\t\tif(val>=ll[mid][0] and val<=ll[mid][1]):\n\t\t\treturn mid\n\t\telif(val<ll[mid][0]):\n\t\t\treturn bin(l,mid-1,ll,val)\n\t\telse:\n\t\t\treturn bin(mid+1,r,ll,val)\ndef deci(n):\n\ts=\"\"\n\twhile(n!=0):\n\t\tif(n%2==0):\n\t\t\tn=n//2\n\t\t\ts=\"0\"+s\n\t\telse:\n\t\t\tn=n//2\n\t\t\ts=\"1\"+s\n\treturn s\ndef diff(s1,s2):\n\tif(len(s1)<len(s2)):\n\t\tv=len(s1)\n\t\twhile(v!=len(s2)):\n\t\t\ts1=\"0\"+s1\n\t\t\tv=v+1\n\telse:\n\t\tv=len(s2)\n\t\twhile(v!=len(s1)):\n\t\t\ts2=\"0\"+s2\n\t\t\tv=v+1\n\tc=0\n\tfor i in range(len(s1)):\n\t\tif(s1[i:i+1]!=s2[i:i+1]):\n\t\t\tc=c+1\n\treturn c\nfrom sys import stdin, stdout \ndef fac(a,b):\n\tv=a\n\twhile(a!=b):\n\t\tv*=a-1\n\t\ta=a-1\n\treturn v\ndef bino(l,r,n):\n\tif(l>r):\n\t\treturn -1\n\telse:\n\t\tmid=(l+r)//2\n\t\tval1=math.log((n/mid)+1,2)\n\t\tval2=int(val1)\n\t\tif(val1==val2):\n\t\t\treturn val1\n\t\telif(val1<1.0):\n\t\t\treturn bino(l,mid-1,n)\n\t\telse:\n\t\t\treturn bino(mid+1,r,n)\n\ndef binary(l,r,ll,val,ans):\n\tif(l>r):\n\t\treturn ans\n\telse:\n\t\tmid=(l+r)//2\n\t\tif(ll[mid]==val):\n\t\t\treturn ll[mid]\n\t\telif(ll[mid]<val):\n\t\t\tans=ll[mid]\n\t\t\treturn binary(mid+1,r,ll,val,ans)\n\t\telse:\n\t\t\treturn binary(l,mid-1,ll,val,ans)\ndef check(n):\n\tv=1\n\twhile(n!=0):\n\t\tif(n%10==0 or n%10==1):\n\t\t\tn=n//10\n\t\telse:\n\t\t\tv=0\n\t\t\tbreak\n\treturn v\n\nif __name__ == '__main__':\n\tn=int(input())\n\tl=[]\n\tfor i in range(n):\n\t\tl1=list(map(int,input().split(\" \")))\n\t\tl.append(l1)\n\ttotal=0\n\tfor i in range(n):\n\t\ttotal+=l[i][i]\n\t\ttotal+=l[n-i-1][i]\n\t\ttotal+=l[n//2][i]\n\t\ttotal+=l[i][n//2]\n\tprint(total-3*l[n//2][n//2])", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "edc61c6a105b1c595562060fc218b872", "src_uid": "5ebfad36e56d30c58945c5800139b880", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from functools import lru_cache\n\nm = 998244353\n\nfm_cache = [1]\ndef fmod(x):\n    while len(fm_cache) <= x:\n        fm_cache.append((fm_cache[-1] * len(fm_cache) % m))\n    return fm_cache[x]\n\n@lru_cache(maxsize=None)\ndef imod(x):\n    return pow(x, m - 2, m)\n\n@lru_cache(maxsize=None)\ndef C(n, k):\n    return (fmod(n) * imod(fmod(k)) * imod(fmod(n - k))) % m\n\nn, k = map(int, input().split())\n\ndef go():\n    tot = 0\n    for b in range(1, n + 1):\n        dv = n // b - 1\n        if dv >= k - 1:\n            tot = (tot + C(dv, k - 1)) % m\n    return tot\n\nprint(go())\n# print(imod.cache_info())\n# print(C.cache_info())\n", "lang_cluster": "Python", "tags": ["math", "combinatorics", "number theory"], "code_uid": "afdb52de267feaf3d281fbc22f16daa5", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def pow3(a, b, mod) :\n    ans = 1\n    while b > 0 :\n        if b & 1 :\n            ans = (ans * a) % mod\n        a = (a * a) % mod\n        b >>= 1\n    return ans\n\nclass comb :\n\tinf = 0\n\tfact = []\n\tinv = []\n\n\tdef __init__(self, n, infi) :\n\t\tself.fact.extend([0] * (n + 1))\n\t\tself.inv.extend([0] * (n + 1))\n\t\tself.inf = infi\n\t\tself.fact[0] = 1\n\t\tfor i in range (1, n + 1) :\n\t\t\tself.fact[i] = (self.fact[i - 1] * i) % self.inf\n\t\tfor i in range (0, n + 1) :\n\t\t\tself.inv[i] = pow3(self.fact[i], self.inf - 2, self.inf)\n\n\tdef ncr(self, n, r) :\n\t\tans = self.fact[n]\n\t\tans = (ans * self.inv[r]) % inf\n\t\tans = (ans * self.inv[n - r]) % inf\n\t\treturn ans\n\n\tdef f(self, n) :\n\t\treturn self.fact[n]\n\n\tdef iv(self, n) :\n\t\treturn self.ivf[n]\n\t\t\ninf = 998244353\nn, k = list(map(int, input().split()))\nc1 = comb(n, inf)\nans = 0\n#for i in range (2, n) :\n    #print(c1.ncr(i, 2))\n    \ni = 1\nwhile i * k <= n :\n    cnt = n // i - 1\n    r = k - 1\n    ans = (ans + c1.ncr(cnt, r)) % inf\n    i += 1\n\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "combinatorics", "number theory"], "code_uid": "10d8746ab1b21f0c66980c9d2b77e829", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# Prime factorization\ndef prime_factorization(x):\n    answer = []\n    i = 2\n    while i*i <= x:\n        if x%i == 0:\n            answer.append(i)\n            while x%i == 0: x //= i\n        i += 1\n    if x > 1: answer.append(x)\n    return answer\n \n# Main\ndef main(X: int, N: int):\n    answer = 1\n    mod = 10**9 + 7\n    x_primes = prime_factorization(x)\n    for prime in x_primes:\n        power = 0\n        factor = prime\n        while factor <= N:\n            power += N // factor\n            factor *= prime\n        #print(\"power is:\", power)\n        answer *= pow(prime, power, mod)\n        answer %= mod\n    return answer\n \nx, n = [int(c) for c in input().split()]\nprint(main(x, n))", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "c71d7447a0747a1ceb29819809adff91", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def primefactors(x):\n    ans = []\n    i = 2\n    while i*i <= x:\n        if x%i==0:\n            ans.append(i);\n            while x%i==0:\n                x = x//i\n        i = i+1\n    if x>1:\n        ans.append(x)\n    return ans\n\nx , n = [int(c) for c in input().split()]\nprime = primefactors(x)\nMOD = 1000000007\nans = 1\nfor x in prime:\n    p = 0\n    tmp = x\n    while tmp <= n:\n        p = p + n//tmp\n        tmp = tmp*x\n    ans = ans*pow(x , p , MOD)\nans = ans%MOD\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "bade1ffcecb5a0da03af9cbdbf26e8fa", "src_uid": "04610fbaa746c083dda30e21fa6e1a0c", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "print(int(((int(input())+1))**2//4))", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "28fa08d6d78f7882821b76fcf4570e4c", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x = int(input()) + 1\nprint(x//2 * (x - x//2))", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "2f163e86450b7083819e8bbf64e5c168", "src_uid": "f8af5dfcf841a7f105ac4c144eb51319", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\nn,m,k = map(int,input().split())\nmod = 10**9 + 7\nif k == 1 or k>n:\n    print(pow(m,n,mod))\n\nelif k == n:\n    print(pow(m,(n+1)//2,mod))\n\n\nelif k%2== 0:\n\n\n    print(m%mod)\nelse:\n    print(pow(m,2,mod))\n", "lang_cluster": "Python", "tags": ["dsu", "math", "combinatorics", "graphs"], "code_uid": "06186ae84e858ca64794dc44ae80b29c", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\"\"\"\nhttps://codeforces.com/contest/151/problem/D\n\nYou can build a graph with positions in sting as a nodes and equality in any substring \nof length k as edges. Lets denote e the number of components in the graph. The answer is me.\n\"\"\"\nimport sys\nimport math\ntry: \n    sys.stdin = open('input.txt', 'r') \n    sys.stdout = open('output.txt', 'w')\n \nexcept: \n    pass\n\nclass DisjointSet():\n    def __init__(self,n):\n        self.parent=[0]\n        self.rank=[0]\n        for i in range(1,n+1):\n            self.parent.append(i)\n            self.rank.append(0)\n\n    def find(self,node):\n        if(node!=self.parent[node]):\n            self.parent[node]=self.find(self.parent[node])\n        return self.parent[node]\n\n    def union(self,u,v):\n        leader_u=self.find(u)\n        leader_v=self.find(v)\n        if(leader_v!=leader_u):\n            if(self.rank[leader_u]>self.rank[leader_v]):\n                u,v=v,u\n                leader_u,leader_v=leader_v,leader_u\n            if(self.rank[leader_u]==self.rank[leader_v]):\n                self.rank[leader_v]+=1\n            self.parent[leader_u]=leader_v #pointing u to v \n\n\n        \n\n\n\nn,m,k=[int(x) for x in input().split()]\nds=DisjointSet(n)\nfor start in range(1,n-k+2):\n    end=start+k-1\n    for i in range(math.ceil(k/2)):\n        ds.union(start,end)\n        start+=1\n        end-=1\n\nno_of_components=0\nseen=set()\nfor i in range(1,n+1):\n    leader=ds.find(i)\n    if(leader not in seen):\n        seen.add(leader)\n        no_of_components+=1\n\nmodulo=10**9+7\nprint(pow(m,no_of_components,modulo))\n\n    \n", "lang_cluster": "Python", "tags": ["dsu", "math", "combinatorics", "graphs"], "code_uid": "e2767a066dc65f63df60fa7ecb4baf60", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\na = []\nfor _ in range(n):\n\tx,y = map(int,raw_input().split())\n\ta.append([x,y])\nres = 0\nfor i in range(n):\n\th = a[i][0]\n\tg = a[i][1]\n\tfor j in range(i + 1,n):\n\t\tif h == a[j][1]:\n\t\t\tres += 1\n\t\tif g == a[j][0]:\n\t\t\tres += 1\nprint res", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "32a90afdf770979c8dd1f5e802838500", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#\n#   268A. Games\n#\n\nteams = int(raw_input().strip())\nhost = []\nguest = []\nfor i in range(teams):\n    h, g = map(int, raw_input().strip().split())\n    host.append(h)\n    guest.append(g)\n\ncount_matches = 0\n\nfor g in guest:\n    count_matches += host.count(g)\n\nprint count_matches", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "f33bee002089518a48c5163f10157904", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#! /usr/bin/env python\n\nfrom sys import stdin\n\ndef all_in(i,j,k,edges):\n\tmy=[(i,j),(j,k),(i,k)]\n\treturn all(x in edges for x in my)\n\ndef all_out(i,j,k,edges):\n\tmy=[(i,j),(j,k),(i,k)]\n\treturn all(not (x in edges) for x in my)\n\ndef fail(edges):\n\tcontains=0\n\tout=0\n\tfor i in xrange(1,6):\n\t\tfor j in xrange(i+1,6):\n\t\t\tfor k in xrange(j+1,6):\n\t\t\t\tif all_in(i,j,k,edges):\n\t\t\t\t\tcontains+=1\n\t\t\t\telif all_out(i,j,k,edges):\n\t\t\t\t\tout+=1\n\n\treturn contains==0 and out==0\n\n\nif __name__=='__main__':\n\tm=int(stdin.readline())\n\tedges=set()\n\tfor i in xrange(m):\n\t\tx,y=map(int,stdin.readline().split())\n\t\tedges.add((x,y))\n\t\tedges.add((y,x))\n\t#print edges\n\t#print all_in(5,2,3,edges)\n\t#print all_out(1,5,2,edges)\n\tif not fail(edges):\n\t\tprint \"WIN\"\n\telse:\n\t\tprint \"FAIL\"\n", "lang_cluster": "Python", "tags": ["math", "implementation", "graphs"], "code_uid": "1f8c804ea69b5b67f4190d08bbdd5e5d", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\n\nl = [0, 0, 0, 0, 0]\n\nfor i in range(n):\n\n    a, b = map(int, input().split())\n\n    for j in range(6):\n\n        if a == j: l[j-1] += 1\n\n        if b == j: l[j-1] += 1\n\nif l.count(2) !=5: print(\"WIN\")\n\nelse: print(\"FAIL\")\n\n\n\n\n\n# Made By Mostafa_Khaled", "lang_cluster": "Python", "tags": ["math", "implementation", "graphs"], "code_uid": "5c1b33e5ce776e4dd5eff74b0c97b3e5", "src_uid": "2bc18799c85ecaba87564a86a94e0322", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def prime(x):\n    if x==1:\n        return False\n    ret=True\n    for i in range(2,int(x**0.5)+1):\n        if x%i==0:\n            ret=False\n    return ret\n\nn=int(input())\nfor i in range(n):\n    s=input().split()\n    d=int(s[0])-int(s[1])\n    if d!=1:\n        print(\"NO\")\n    else:\n        if prime(int(s[0])+int(s[1])):\n            print(\"YES\")\n        else:\n            print(\"NO\")\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "f78ea6fe9146aa371697bec18cbbc12d", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from random import randrange\n\nT = input()\n\ndef rwh_primes2(n):\n    # https://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188\n    \"\"\" Input n>=6, Returns a list of primes, 2 <= p < n \"\"\"\n    correction = (n%6>1)\n    n = {0:n,1:n-1,2:n+4,3:n+3,4:n+2,5:n+1}[n%6]\n    sieve = [True] * (n/3)\n    sieve[0] = False\n    for i in xrange(int(n**0.5)/3+1):\n      if sieve[i]:\n        k=3*i+1|1\n        sieve[      ((k*k)/3)      ::2*k]=[False]*((n/6-(k*k)/6-1)/k+1)\n        sieve[(k*k+4*k-2*k*(i&1))/3::2*k]=[False]*((n/6-(k*k+4*k-2*k*(i&1))/6-1)/k+1)\n    return [2,3] + [3*i+1|1 for i in xrange(1,n/3-correction) if sieve[i]]\n\n#pp = rwh_primes2(1000000)\n\ndef miller_rabin(n, k=10):\n    if n == 2 or n== 3:\n        return True\n    if not n & 1:\n        return False\n\n    def check(a, s, d, n):\n        x = pow(a, d, n)\n        if x == 1:\n            return True\n        for i in xrange(s - 1):\n            if x == n - 1:\n                return True\n            x = pow(x, 2, n)\n        return x == n - 1\n\n    s = 0\n    d = n - 1\n\n    while d % 2 == 0:\n        d >>= 1\n        s += 1\n\n    for i in xrange(k):\n        a = randrange(2, n - 1)\n        if not check(a, s, d, n):\n            return False\n    return True\n\nfor t in xrange(T):\n    a, b = map(int, raw_input().split())\n\n    if a-b == 1:\n        if miller_rabin(a+b):\n            print \"YES\"\n        else:\n            print \"NO\"\n    else:\n        print \"NO\"", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "36e1213c96b815c87684a6e79b0f98ac", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b = map(int, input().split())\ns = input()\nsm = [[0, 0] for i in range(len(s))]\nrepl = {'U': (0, 1), 'D': (0, -1), 'L': (-1, 0), 'R': (1, 0)}\nfor i, c in enumerate(s):\n    sm[i][0] = sm[i - 1][0] + repl[c][0]\n    sm[i][1] = sm[i - 1][1] + repl[c][1]\n# a = n * sm[-1][0] + sm[i][0]\nfor i in range(len(s)):\n    na, nb = 0 if sm[-1][0] == 0 else (a - sm[i][0]) // sm[-1][0], 0 if sm[-1][1] == 0 else (b - sm[i][1]) // sm[-1][1]\n    if a == na * sm[-1][0] + sm[i][0] and b == nb * sm[-1][1] + sm[i][1] and (0 in sm[-1] or na == nb) and na >= -1 and nb >= -1:\n        print('Yes')\n        exit(0)\nprint('No')\n", "lang_cluster": "Python", "tags": ["math", "implementation", "binary search"], "code_uid": "496f3a1c26a26a84cdcee922a2e41ba7", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "R=raw_input\na,b=map(int,R().split())\ns=R()\ndef f(s):\n c=s.count\n return c('R')-c('L'),c('U')-c('D')\nX,Y=f(s)\nx,y=0,0\nq=0\nfor i in range(len(s)):\n c,d=f(s[:i])\n A=a-c;B=b-d\n if (X and A%X) or (Y and B%Y):continue\n if X==Y==0:\n  if A==B==0:q=1\n elif X==0:\n  if A==0 and B//Y>=0:q=1\n elif Y==0:\n  if B==0 and A//X>=0:q=1\n elif A//X==B//Y and A//X>=0:q=1\nprint[\"No\",\"Yes\"][q]\n\n", "lang_cluster": "Python", "tags": ["math", "implementation", "binary search"], "code_uid": "534b8e66db2c0e68c1d2f47fc12a225a", "src_uid": "5d6212e28c7942e9ff4d096938b782bf", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nnum = input()\nflag = 0\nfor i in num:\n    if (i < '4') or ('4' < i < '7') or (i > '7'):\n        print(\"NO\")\n        flag = 1\n        break\nif flag == 0:\n    if sum(map(int, num[:n//2])) == sum(map(int, num[n//2:])):\n        print(\"YES\")\n    else:\n        print(\"NO\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "64a91ca0b590f19b3efba056b5fc9dad", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\n#n, m = map(int, input().split())\ns = input()\n#c = list(map(int, input().split()))\nk = s[:n // 2].count('4') * 4 + s[:n // 2].count('7') * 7\nl = s[n // 2:].count('4') * 4 + s[n // 2:].count('7') * 7\nif (n % 2 == 0 and s.count('4') + s.count('7') == n and \n    k == l):\n    print('YES')\nelse:\n    print('NO')\n                                ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "e262ef4c00681916c8a37cf00b708083", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input().strip()\n\nj = 3\nif s[0] == 'h':\n    j = 4\n\ni = j\nk = 0\nwhile i < len(s):\n    if k > 0 and s[i] == 'r' and s[i + 1] == 'u':\n        break\n    i += 1\n    k = 1\n\nif i + 2 == len(s):\n    print(s[:j] + \"://\" + s[j:i] + \".ru\")\nelse:\n    print(s[:j] + \"://\" + s[j:i] + \".ru/\" + s[i+2:])", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "1149f2e35cbaa6ac6ab43cb75ad48b67", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s=input()\nt=3+(s[0]>'f')\np=s.find('ru',t+1)\nprint(s[:t]+'://'+s[t:p]+'.ru'+(' /'[p+2<len(s)])+s[p+2:])", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "21692f319934f3f39c990a609ebaf07f", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,k=map(int,input().split(' '))\ncount=0\nif n==2:\n    print(6)\nelse:\n    i=3\n    while i<=n:\n        count=count+3\n        i=i+1\n    count=count+6\n    \n    if n%2==0 and k!=1:\n        if int(n/2)<k:\n            print(count+n-k)\n        else:\n            print(count+k-1)\n    elif n%2!=0 and k!=1:\n        if int((n+1)/2)<k:\n            print(count+n-k)\n        else:\n            print(count+k-1)\n    elif k==1:\n        print(count)\n    ", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "24257f0e1b18a29352d81b1dec9c7551", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,k = map(int,input().split())\nx = ((n-1)*2) + 3\nif k==1 or k==n:\n    x+=(n-1)\nelse:\n    if k-1<=n-k:\n        x+=(k-1)*2\n        x+=n-k\n    else:\n        x+=(n-k)*2\n        x+=(k-1)\nprint(x)", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "cbfd17f5b52adbe5d904c5aca5060949", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=raw_input()\nl=len(n)\ns=0\nfor i,j in enumerate(n):\n    if j=='A':\n        p1=n.count('Q',0,i)\n        p2=n.count('Q',i+1,l)\n        p=p1*p2\n        s+=p\nprint s\n    ", "lang_cluster": "Python", "tags": ["brute force", "dp"], "code_uid": "f50d791ce78bbf14d65bd9a7bc6bce62", "src_uid": "8aef4947322438664bd8610632fe0947", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s= input()\ncnt = 0\nfor i in range(len(s)):\n    if s[i] == 'Q':\n        for j in range(i+1,len(s)):\n            if s[j] == 'A':\n                for k in range(j+1,len(s)):\n                    if s[k] == 'Q':\n                        cnt +=1\n        pass\n    pass\nprint(cnt)", "lang_cluster": "Python", "tags": ["brute force", "dp"], "code_uid": "0e239949308bc00009b4764407d940a6", "src_uid": "8aef4947322438664bd8610632fe0947", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def kprod(n,k):\n    i=2\n    kr=[]\n    while len(kr)<k-1 and i<=n:\n        if n%i==0:\n            kr+=[i]\n            n/=i\n            i=1\n        i+=1\n    if len(kr)==k-1 and n>1:\n        return \" \".join([str(i) for i in kr+[n]])\n    else:\n        return -1\n        \nn,k=[int(k) for k in raw_input().split(\" \")]\n\nprint kprod(n,k)\n            \n        \n", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "93483d0ece30557b07c156e56dff4566", "src_uid": "bd0bc809d52e0a17da07ccfd450a4d79", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nn,k=[int(x) for x in sys.stdin.readline().split()]\ncounter=1\ntobeprinted=[]\nwhile counter!=k:\n\tfor i in range(2,int(n)+1):\n\t\tif n%i==0:\n\t\t\ttobeprinted.append(i)\n\t\t\tn=n//i\n\t\t\tcounter+=1\n\t\t\tbreak\n\tif n==1:\n\t\tprint(\"-1\")\n\t\texit()\ntobeprinted.append(n)\nprint(*tobeprinted)", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "60b95b10d2cc6e0baab5e6a0b06124c2", "src_uid": "bd0bc809d52e0a17da07ccfd450a4d79", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s = input()\npos = 0\nt = input()\nfor i in range(len(t)):\n\tif t[i] == s[pos]:\n\t\tpos += 1\nprint(pos+1)\n ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "eb6f172f74c24bfbaec8a153f4071462", "src_uid": "f5a907d6d35390b1fb11c8ce247d0252", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input()\nt = raw_input()\nn_ins = len(t)\ncurrent = 0\nfor i in range(n_ins):\n    if t[i] == s[current]:\n        current += 1\nprint current + 1", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f68b73670d1322a126295dfe065374fa", "src_uid": "f5a907d6d35390b1fb11c8ce247d0252", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\nn = int(input())\nx = input()\nfor i in range(0, 9*n+1):\n    total = 0\n    ok = 0\n    for c in x:\n        total = total + int(c)\n        if total == i:\n            total = 0\n            ok = ok+1\n        elif total > i:\n            ok = 0\n    if ok > 1 and total == 0:\n        print(\"YES\")\n        exit(0)\nprint(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "cebd3437e28d42516718358d25a2576c", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\na=[int(x) for x in input()]\nfor s in range(0, n*9+3):\n    split=0\n    sub=0\n    for i in range(n):\n        sub+=a[i]\n        if sub==s:\n            split+=1\n            sub=0\n        elif sub > s:\n            split = 0\n            break\n    if split > 1 and sub==0:\n        print('YES')\n        exit()\nprint('NO')", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "9c5bdc67479147abc9b7e620ecf191d5", "src_uid": "410296a01b97a0a39b6683569c84d56c", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x, k = [int(a) for a in input().strip().split()]\n\n\ndef binpow(x, k, mod):\n    res = 1\n    while k > 0:\n        if k & 1:\n            res  = ( res * x ) % mod\n        x = ( x * x) % mod\n        k >>= 1\n    return res\nif x == 0:\n    print(0)\n    exit()\n\nmod = int(1e9 + 7)\nk2 = binpow(2, k, mod)\nres = ( k2 * (2 * x - 1) + 1) % mod\n\nres %= mod\n\nprint(int(res))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "bc6964eaf5b35db30175aad42382eeb5", "src_uid": "e0e017e8c8872fc1957242ace739464d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "MOD = 10 ** 9 + 7\n\n\ndef multMM(a, b):\n    n = len(a)\n    r = [[0 for i in xrange(n)] for j in xrange(n)]\n    for i in xrange(n):\n        for j in xrange(n):\n            for k in xrange(n):\n                r[i][j] += a[i][k] * b[k][j]\n                r[i][j] %= MOD\n    return r\n\n\ndef multMV(a, v):\n    n = len(a)\n    r = [0 for i in xrange(n)]\n    for i in xrange(n):\n        for j in xrange(n):\n            r[i] += a[i][j] * v[j]\n            r[i] %= MOD\n    return r\n\n\ndef powM(a, p):\n    n = len(a)\n    if p == 0:\n        return [[1 if i == j else 0 for i in xrange(n)] for j in xrange(n)]\n    if p % 2 == 0:\n        t = powM(a, p / 2)\n        return multMM(t, t)\n    else:\n        return multMM(a, powM(a, p - 1))\n\n\ndef main():\n    x, k = map(int, raw_input().split())\n    if x == 0:\n        print 0\n        return\n    v = [1, x]\n    m = [[1, 0], [MOD - (MOD + 1) / 2, 2]]\n    m = powM(m, k)\n    v = multMV(m, v)\n    print v[1] * 2 % MOD\n\n\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "008284f4e1d55be77d6f5751d550ee5d", "src_uid": "e0e017e8c8872fc1957242ace739464d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "class CodeforcesTask592ASolution:\n    def __init__(self):\n        self.result = ''\n        self.board = []\n\n    def read_input(self):\n        for x in range(8):\n            self.board.append(input())\n\n    def process_task(self):\n        amin = 8\n        bmin = 8\n        n_board = []\n        for x in range(8):\n            line = ''\n            for y in range(8):\n                line += self.board[y][x]\n            n_board.append(line)\n        for b in n_board:\n            if \"B\" in b:\n                if \"W\" not in b.split(\"B\")[-1]:\n                    #print(b, b.split(\"B\")[-1])\n                    bmin = min(bmin, len(b.split(\"B\")[-1]))\n            if \"W\" in b:\n                if \"B\" not in b.split(\"W\")[0]:\n                    #print(b, b.split(\"W\")[0])\n                    amin = min(amin, len(b.split(\"W\")[0]))\n        self.result = \"A\" if amin <= bmin else \"B\"\n\n    def get_result(self):\n        return self.result\n\n\nif __name__ == \"__main__\":\n    Solution = CodeforcesTask592ASolution()\n    Solution.read_input()\n    Solution.process_task()\n    print(Solution.get_result())\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "bdb12eaaf1eb2bbd830acb85cf43c4b7", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "g, v = [input() for i in range(8)], [8, 8]\nfor i in range(8):\n    for j in range(8):\n        if g[i][j] == 'W' and all(g[k][j] == '.' for k in range(i)):\n            v[0] = min(v[0], i)\n        elif g[i][j] == 'B' and all(g[k][j] == '.' for k in range(i + 1, 8)):\n            v[1] = min(v[1], 7 - i)\nprint('A' if v[0] <= v[1] else 'B')", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "ba4310479132c4edb730f5581ca6ef32", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def lint(n):    #to find length of an integer\n    h = int(n)\n    i= 0\n    while(h>0):\n          h= int(h/10)\n          i=i+1\n    len =i\n    return len\n\n\nk =int(input())\nlist = [1]\nn=1\ny=1\nfor y in range (1,k):\n        n = n+1;\n        p= lint(n)\n        for i in range(p,0,-1):\n                e= 10**(i-1)\n                x = int(n/e)\n                z= x%10 \n                list.append(z)\n\n\n        y = y+p\nprint(list[k-1])\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "d756f2edb3c650c72a518c6b6929c62f", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nx, y = 1, 9\nn -= 1\nwhile n > x * y:\n    n -= x * y\n    x += 1\n    y *= 10\na = 10 ** (x - 1) + n // x\nprint(str(a)[n % x])", "lang_cluster": "Python", "tags": ["divide and conquer", "implementation", "binary search"], "code_uid": "d6ec0c131da6341ff7949621385ca25c", "src_uid": "1503d761dd4e129fb7c423da390544ff", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\n[n,l,r] = [int(x) for x in input().split()]\n\n\n\ndiff_3 = (r - l)//3\nways = [diff_3,diff_3,diff_3]\n\nfor i in range(l,r-diff_3*3+1):\n    # print(i)\n    ways[i%3] += 1\n\n\n# print(ways)\n# print(sum(ways), r-l + 1)\n\ncurr = [ways[0],ways[1],ways[2]]\n# print(curr)\nfor i in range(n-1):\n    new = [0,0,0]\n    for j in range(0,3):\n        for k in range(0,3):\n            new[(j+k)%3] += (ways[j]*curr[k])\n    for j in range(0,3):\n        new[j] %= (10**9+7)\n    curr = new\n    # print(curr)\n\nprint(curr[0])", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "7ad2acaf82d84161303c662cbc02c4c4", "src_uid": "4c4852df62fccb0a19ad8bc41145de61", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "MOD = pow(10, 9) + 7\n\nn, l, r = map(int, raw_input().strip().split())\n\na0 = a1 = a2 = 0\nxl = l\nwhile xl % 3 != 0 and xl < r: xl += 1\nxr = r\nwhile xr % 3 != 0 and xr > xl: xr -= 1\n\nif xl <= xr and xl % 3 == 0 and xr % 3 == 0: a0 = (xr - xl) // 3 + 1\n\nxl = l\nwhile xl % 3 != 1 and xl < r: xl += 1\nxr = r\nwhile xr % 3 != 1 and xr > xl: xr -= 1\n\nif xl <= xr and xl % 3 == 1 and xr % 3 == 1: a1 = (xr - xl) // 3 + 1\n\nxl = l\nwhile xl % 3 != 2 and xl < r: xl += 1\nxr = r\nwhile xr % 3 != 2 and xr > xl: xr -= 1\n\nif xl <= xr and xl % 3 == 2 and xr % 3 == 2: a2 = (xr - xl) // 3 + 1\n\n\ndp = [[0 for i in xrange(3)] for j in xrange(n + 1)]\n\ndp[1] = [a0 % MOD, a1 % MOD, a2 % MOD]\n\nfor i in xrange(2, n + 1):\n    dp[i][0] = dp[i - 1][0] * a0 + dp[i - 1][1] * a2 + dp[i - 1][2] * a1\n    if dp[i][0] >= MOD: dp[i][0] %= MOD\n    dp[i][1] = dp[i - 1][0] * a1 + dp[i - 1][1] * a0 + dp[i - 1][2] * a2\n    if dp[i][1] >= MOD: dp[i][1] %= MOD\n    dp[i][2] = dp[i - 1][0] * a2 + dp[i - 1][1] * a1 + dp[i - 1][2] * a0\n    if dp[i][2] >= MOD: dp[i][2] %= MOD\n\nprint dp[n][0] % MOD", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "e8ce9db851068b3793f1ddcff60c414f", "src_uid": "4c4852df62fccb0a19ad8bc41145de61", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, m = map(int, raw_input().split(' '))\nmod = 10**9+7\ntmp = (1 + m - 1) * (m - 1) / 2\ntmp2 = (1 + n) * n / 2\nans = (tmp * n % mod + m * tmp * tmp2 % mod) % mod\nprint ans", "lang_cluster": "Python", "tags": ["math"], "code_uid": "a64e31f38125eb515882c1a77fe94b2d", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import os, sys\n\nif __name__ == \"__main__\":\n  a, b = map(int, raw_input().split())\n  res = b * b * (b - 1) * a * (a + 1) / 4\n  res += a * b * (b - 1) / 2\n  print res % 1000000007", "lang_cluster": "Python", "tags": ["math"], "code_uid": "e6047f1b384b181bfae9388b37cc650c", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def gcd(a, b,):\n    if b == 0:\n        return a, 1, 0\n    d, x_, y_  = gcd(b, a % b)\n    return d, y_, x_ - (a // b) * y_\n\n\ndef co(a, i):\n    return (f[a]*g[i]%998244353*g[a-i])%998244353\n\n\na, b, c = map(int, input().split())\nr = 0\nf = [1]\ng = []\nfor i in range(1, 5005):\n    f.append(f[-1]*i%998244353)\ng = [(gcd(i, 998244353)[1]) for i in f]\nfor i in range(min(a, b)+1):\n    r+=(co(a, i)*co(b, i)%998244353*f[i])%998244353\nh = 0\nfor i in range(min(a, c)+1):\n    h+=(co(a, i)*co(c, i)%998244353*f[i])%998244353\nv = 0\nfor i in range(min(c, b)+1):\n    v+=(co(c, i)*co(b, i)%998244353*f[i])%998244353\nprint((r*h*v)%998244353)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "d7b5620c08a9a15c2ea79c6726c7a299", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def extendedEuclidean(a,b,x,y):\n\n    if b==0:\n        return a,1,0\n\n    d,x1,y1 = extendedEuclidean(b,a%b,x,y)\n    \n    x,y = y1,x1-y1*(a//b)\n\n    return d,x,y\n\na,b,c = map(int,input().split())\n\nf = [1]*(1+max(a,b,c))\nfi = [1]*(1+max(a,b,c))\nm = 998244353\n\nfor i in range(1,1+max(a,b,c)):\n    x = (f[i-1]*i)%m\n    f[i] = x\n    d,x,y = extendedEuclidean(x,m,1,1)\n    fi[i] = x%m\n\n\nab=0\nbc=0\nca=0\n\nfor i in range(min(a,b)+1):\n    ab+=(f[a]*fi[a-i]*f[b]*fi[b-i]*fi[i])%m\n\nfor i in range(min(b,c)+1):\n    bc+=(f[c]*fi[c-i]*f[b]*fi[b-i]*fi[i])%m \n\nfor i in range(min(a,c)+1):\n    ca+=(f[a]*fi[a-i]*f[c]*fi[c-i]*fi[i])%m\n\nprint((ab*bc*ca)%m)\n\n\n\n\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "dcb426b04ad0baaad24cffc31ed31191", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = map(int, raw_input().split())\na = sorted(a)\nlis = []\nlis.append(sum(a))\nif a[-1] == a[-2] and a[-2] == a[-3]:\n\tlis.append(a[0]+a[1])\nif a[-1] == a[-2]:\n\tlis.append(a[0]+a[1]+a[2])\nif a[-2] == a[-3] and a[-3] == a[-4]:\n\tlis.append(a[0]+a[4])\nif a[-2] == a[-3]:\n\tlis.append(a[0]+a[1]+a[4])\nif a[-3] == a[-4] and a[-4] == a[-5]:\n\tlis.append(a[3]+a[4])\nif a[-3] == a[-4]:\n\tlis.append(a[0]+a[3]+a[4])\nif a[-4] == a[-5]:\n\tlis.append(a[2]+a[3]+a[4])\nprint min(lis)", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "9f3a4faf94e9dc25b076d0427499bb10", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "class CodeforcesTask680ASolution:\n    def __init__(self):\n        self.result = ''\n        self.nums = []\n\n    def read_input(self):\n        self.nums = [int(x) for x in input().split(\" \")]\n\n    def process_task(self):\n        self.nums.sort()\n        if len(set(self.nums)) == 2:\n            if max([self.nums.count(x) for x in list(set(self.nums))]) == 3:\n                self.result = str(min(self.nums[0] * self.nums.count(self.nums[0]), self.nums[-1] * self.nums.count(self.nums[-1])))\n            else:\n                self.result = str(self.nums[0] + self.nums[-1])\n        elif len(set(self.nums)) == 5:\n            self.result = str(sum(self.nums))\n        elif len(set(self.nums)) == 1:\n            self.result = str(self.nums[0] * 2)\n        elif len(set(self.nums)) == 4:\n            rep = [x[0] for x in [(y, self.nums.count(y)) for y in list(set(self.nums))]if x[1] == 2][0]\n            self.result = str(sum(self.nums) - 2 * rep)\n        else:\n            if max([self.nums.count(x) for x in list(set(self.nums))]) == 3:\n                d = 3\n            else:\n                d = 2\n            rep = [x[0] for x in [(y, self.nums.count(y)) for y in list(set(self.nums))] if x[1] > 1]\n            rep.sort()\n            self.result = str(sum(self.nums) - d * rep[-1])\n\n    def get_result(self):\n        return self.result\n\n\nif __name__ == \"__main__\":\n    Solution = CodeforcesTask680ASolution()\n    Solution.read_input()\n    Solution.process_task()\n    print(Solution.get_result())\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "171b9f677cd786402da2b4eb823b1c3d", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nimport sys\n\n#n = int(input())\n#n, m = map(int, input().split())\n#d = list(map(int, input().split()))\n\nn, m = map(int, input().split())\nd = []\nfor i in range(n):\n    d.append(input())\n\nr = 0\nfor i in range(n):\n    for j in range(m):\n        t = d[i][min(j+1,m-1)] + d[i][max(0, j-1)] + d[max(0, i-1)][j] +d[min(n-1, i+1)][j]\n        if d[i][j] == 'W' and 'P' in t:\n            r += 1\nprint(r)\n\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "60b53794abb605950e5cfe692b8416f5", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\ns=['.'*(m+2)]\nfor i in range(n):\n    s.append('.'+input()+'.')\ns.append('.'*(m+2))\nr=0\nfor i in range(1,n+1):\n    for j in range(1,m+1):\n        if s[i][j]=='W':\n            if s[i-1][j] == 'P' or s[i][j-1]=='P' or s[i+1][j]=='P' or s[i][j+1]=='P':\n                r+=1\nprint(r) ", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "a45ffb1e2ee92e056980d066dd284244", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from collections import defaultdict\nfrom copy import deepcopy\n\na = list(input())\n\nd = defaultdict(int)\nfor x in a:\n    d[int(x)] += 1\n\nfact_mem = {}\n\n\ndef fact(n):\n    if n in fact_mem:\n        return fact_mem[n]\n    ans = 1\n    for i in range(1, n + 1):\n        ans *= i\n    fact_mem[n] = ans\n    return ans\n\n\nmem = {}\n\n\ndef f(d):\n    tmp = frozenset(d.items())\n    if tmp in mem:\n        return 0\n    n = sum(d.values())\n    ans = 0\n    if d[0] > 0:\n        ans += (n - d[0]) * fact(n - 1)\n    else:\n        ans += fact(n)\n    if len(d) == 1 and d[0] > 0:\n        return 0\n    for x in d:\n        ans //= fact(d[x])\n    for k in d:\n        if d[k] > 1:\n            e = deepcopy(d)\n            e[k] -= 1\n            ans += f(e)\n    mem[frozenset(d.items())] = ans\n    return ans\n\n\nans = f(d)\nprint(ans)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "combinatorics"], "code_uid": "4db21cf7bf6f209d3bf33810766a03f4", "src_uid": "7f4e533f49b73cc2b96b4c56847295f2", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import itertools as I;m,d,r,s,M,S,f=lambda x,y:x*y,reduce,range,str(input()),map,sum,lambda x:d(m,r(x,1,-1),1);print S((f(S(x))-f(S(x)-1)*x[0])/d(m,M(f,x))for x in I.product(*[r(y/max(y,1),y+1)for y in[s.count(str(u))for u in r(10)]]))", "lang_cluster": "Python", "tags": ["brute force", "math", "combinatorics"], "code_uid": "c2aa2320e8bcbab502810ea87a625cfa", "src_uid": "7f4e533f49b73cc2b96b4c56847295f2", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "l=['January','February','March','April','May','June','July','August','September','October','November','December']\ns=input()\nn=int(input())\nx=0\nfor i in range(12):\n    if(s==l[i]):\n        x=i\nprint(l[(x+n)%12])\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f54ad52671bd97e7975b9ec10188585c", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "dict={}\ndict[\"January\"]=0\ndict[\"February\"]=1\ndict[\"March\"]=2\ndict[\"April\"]=3\ndict[\"May\"]=4\ndict[\"June\"]=5\ndict[\"July\"]=6\ndict[\"August\"]=7\ndict[\"September\"]=8\ndict[\"October\"]=9\ndict[\"November\"]=10\ndict[\"December\"]=11\ntmp=input()\ns=int(input())\ns+=dict[tmp]\ns%=12\nfor i in dict:\n\tif(dict[i]==s):\n\t\tprint(i)\n\t\tbreak", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "c52b7d4f1b6326e17a5839c5770372e4", "src_uid": "a307b402b20554ce177a73db07170691", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#data = open(\"P1.txt\")\nx,t,a,b,da,db = map(int,raw_input().split())\nfound = False\nfor i in range(t):\n    if max(0,a-da*i)==x:\n        print \"YES\"\n        found = True\n        break\n    \n    for j in range(t):\n        #print i,j,max(0,a-da*i), max(0,b-db*j)\n        if max(0,a-da*i) + max(0,b-db*j) == x or max(0,b-db*j) == x:\n            print \"YES\"\n            found = True\n            break\n    if found:\n        break\n    \nif not found:\n    if x!=0:\n        print \"NO\"\n    else:\n        print \"YES\"\n        ", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "743628fa016c5a20f394798960390a2e", "src_uid": "f98168cdd72369303b82b5a7ac45c3af", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x, t, a, b, da, db = eval(\"[\" + raw_input().replace(' ', ',') + \"]\")\nvalid = False\nfor timeSolvingProblemA in range(0, t):\n\tfor timeSolvingProblemB in range(0, t):\n\t\ttotalScore = a - da * timeSolvingProblemA + b - db * timeSolvingProblemB\n\t\tif totalScore == x:\n\t\t\tvalid = True\nif x == 0:\n\tvalid = True\nfor timeSolvingProblemA in range(0, t):\n\ttotalScore = a - da * timeSolvingProblemA\n\tif totalScore == x:\n\t\tvalid = True\nfor timeSolvingProblemB in range(0, t):\n\ttotalScore = b - db * timeSolvingProblemB\n\tif totalScore == x:\n\t\tvalid = True\n\nif valid:\n\tprint \"YES\"\nelse:\n\tprint \"NO\"\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "bc1298ae28d9b2319b2349d9cc90f035", "src_uid": "f98168cdd72369303b82b5a7ac45c3af", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    n=int(input())\n    dp=[]\n    dp.append(0)\n    dp.append(0)\n    dp.append(2)\n    for i in range(3,n+1):\n        dp.append(dp[i-2]*2)\n    print(dp[n])\nif __name__==\"__main__\":\n    main()", "lang_cluster": "Python", "tags": ["math", "dp"], "code_uid": "dc1fd9c8636f5c8fdeeb0a2e1890485e", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom collections import deque\nfrom functools import *\nfrom fractions import Fraction as f\nfrom copy import *\nfrom bisect import *\t\nfrom heapq import *\nfrom math import *\n#from itertools import permutations ,product\n \ndef eprint(*args):\n    print(*args, file=sys.stderr)\nzz=1\n \n#sys.setrecursionlimit(10**6)\nif zz:\n\tinput=sys.stdin.readline\nelse:\t\n\tsys.stdin=open('input.txt', 'r')\n\tsys.stdout=open('all.txt','w')\ndi=[[-1,0],[1,0],[0,1],[0,-1]]\ndef inc(d,c,x=1):\n\td[c]=d[c]+x if c in d else x\ndef bo(i):\n\treturn ord(i)-ord('A')\t\ndef li():\n\treturn [int(xx) for xx in input().split()]\ndef fli():\n\treturn [float(x) for x in input().split()]\t\ndef comp(a,b):\n\tif(a>b):\n\t\treturn 2\n\treturn 2 if a==b else 0\t\t\ndef gi():\t\n\treturn [xx for xx in input().split()]\ndef fi():\n\treturn int(input())\ndef pro(a): \n\treturn reduce(lambda a,b:a*b,a)\t\t\ndef swap(a,i,j): \n\ta[i],a[j]=a[j],a[i]\t\ndef si():\n\treturn list(input().rstrip())\t\ndef mi():\n\treturn \tmap(int,input().split())\t\t\t\ndef gh():\n\tsys.stdout.flush()\ndef isvalid(i,j):\n\treturn 0<=i<n and 0<=j<m and a[i][j]==\"*\"\ndef bo(i):\n\treturn ord(i)-ord('a')\t\ndef graph(n,m):\n\tfor i in range(m):\n\t\tx,y=mi()\n\t\ta[x].append(y)\n\t\ta[y].append(x)\n\nt=1\n\n\nwhile t>0:\n\tt-=1\n\tn=fi()\n\tif n%2:\n\t\tprint(0)\n\telse:\n\t\tprint(2**(n//2))\t\t\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t\t\t", "lang_cluster": "Python", "tags": ["math", "dp"], "code_uid": "8e89be501e2aa470cb9d684248c025d4", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from sys import stdin\n\na = ['vaporeon', 'jolteon', 'flareon', 'espeon', 'umbreon', 'leafeon', 'glaceon', 'sylveon']\n\nn = int(stdin.readline())\na = filter(lambda x: len(x) == n, a)\n\nfor c in enumerate(stdin.readline()):\n    if len(a) == 1:\n        break\n    if c[1] != '.':\n        a = filter(lambda x: x[c[0]] == c[1], a)\n\nprint a[0]\n", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "d1353e9e84fcb594fc228b5ccf0df2bf", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\"\"\"\nproblem : https://codeforces.com/problemset/problem/452/A\nauther  : Jay Saha\nhandel : ponder_\ndate : 15/07/2020\n\"\"\"\n\npokemons = ['vaporeon', 'jolteon', 'flareon', 'espeon', 'umbreon', 'leafeon', 'glaceon', 'sylveon']\nn = int(input())\nmaskedPM = input()\n\nfor p in pokemons:\n    if n == len(p):\n        isValid = True\n        for i in range(n):\n            if maskedPM[i] != '.':\n                if maskedPM[i] != p[i]:\n                    isValid = False\n        if isValid:\n            print(p)\n            break", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "3830998552209830256f135593f0dbca", "src_uid": "ec3d15ff198d1e4ab9fd04dd3b12e6c0", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\n\ndef main():\n    N = int(input())\n    vals = [int(i) for i in input().split()] \n    \n    sum = 0\n    max = 0\n\n    for x in vals:\n        sum = sum + x\n        if x > max:\n            max = x\n    new_sum = 0\n    curr_test = max;\n\n    while new_sum <= sum:\n        new_sum = 0\n        for x in vals:\n            new_sum = new_sum + (curr_test - x)\n        curr_test = curr_test + 1\n\n    print(curr_test - 1)\n\nmain()", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "0653151953d6647027a47298fa6f41ad", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\na=list(map(int,input().split()))\np=a\nx=max(a)\nwhile(x <= 1000):\n    s = (n*x)-sum(a)\n    if s > sum(a):\n        print(x)\n        break\n    else:\n        x+=1", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "cdeab8be824956a8b4cc2e7292237a53", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n = int(input())\nfor i in range(n):\n    t = int(input())\n    if t%1111 == 0:\n        print((t/1111)*10)\n    elif t%111 == 0:\n        print(((t/111)-1)*10) + 6\n    elif t%11 == 0:\n        print(((t/11)-1)*10) + 3\n    else:\n        print((t-1)*10) + 1", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "d85a2c7792176072a64b44d944cb63ef", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "for _ in range(int(input())):\n\ts = input()\n\tk = len(s)\n\ta = k*(k+1)//2\n\tp = int(s[0])\n\tif p > 1:\n\t\ta+=(p-1)*10\n\tprint(a)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "7a04499d6ce0c4a1652082b9cd74dd1d", "src_uid": "289a55128be89bb86a002d218d31b57f", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def g(i,z,k):\n if i>=n:return 0\n if q[i][z][k]>-1:return q[i][z][k]\n o=g(i+1,z,k);c=s[i]!=t[0]\n if k>=c:o=max(o,g(i+1,z+1,k-c))\n c=s[i]!=t[1]\n if k>=c:o=max(o,g(i+1,z+(t[0]==t[1]),k-c)+z)\n q[i][z][k]=o;return o\nI=input;n,k=map(int,I().split());s=I();t=I();q=[[[-1]*(n+1)for _ in[0]*n]for _ in[0]*n];print(g(0,0,k))", "lang_cluster": "Python", "tags": ["strings", "dp"], "code_uid": "b73ece1b30c292d8a175723d02f94216", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def g(i,z,k):\n if i>=n:return 0\n if q[i][z][k]>-1:return q[i][z][k]\n o=g(i+1,z,k);c=s[i]!=t[0]\n if k>=c:o=max(o,g(i+1,z+1,k-c))\n c=s[i]!=t[1]\n if k>=c:o=max(o,g(i+1,z+(t[0]==t[1]),k-c)+z)\n q[i][z][k]=o;return o\nI=input;n,k=map(int,I().split());s=I();t=I();q=[[[-1]*(n+1)for _ in[0]*n]for _ in[0]*n];print(g(0,0,k))", "lang_cluster": "Python", "tags": ["strings", "dp"], "code_uid": "9d00495b45dc8addc1e305986cd92e8c", "src_uid": "9c700390ac13942cbde7c3428965b18a", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "x,k=map(str,input().split())\nk=int(k)\nx=list(x)\nz=pow(10,k)\nx.reverse()\nm=0\nl=x.count('0')\nif(l==0):\n    print(len(x))\nelif(l>0 and l<k):\n    print(len(x)-1)\nelse:\n    for i in range(len(x)):\n        if(x[i]=='0'):\n            m+=1\n            if(m==k):\n                s=i\n                break\n    print(i-k+1)\n", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "7a33d84d0d2503cb488e80ec94b0f62c", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,k = map(str,input().split())\nk = int(k)\na = n.count(\"0\")\ncnt = 0\nans = 0\n\nif int(n)%(10**k)==0:\n\tprint(0)\n\nelif len(n)<=len(str(10**k)):\n\tprint(len(n)-1)\nelse:\n\ti = len(n)-1\n\twhile cnt<k and i>=0:\n\t\tif n[i]!=\"0\":\n\t\t\tans+=1\n\t\telse:\n\t\t\tcnt+=1\n\t\ti-=1\n\tif ans+a==len(n):\n\t\tprint(len(n)-1)\n\telse:\n\t\tprint(ans)\n\t\n\n", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "a9769f2f48ad70a5d0c774027c6a84cc", "src_uid": "7a8890417aa48c2b93b559ca118853f9", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x1,y1,x2,y2 = [int(_) for _ in raw_input().split()]\nx,y = [int(_) for _ in raw_input().split()]\n\ndiff = x2-x1,y2-y1\n\nif x != 0:\n    diff = diff[0] % (2*x),diff[1]\n\nif y != 0:\n    \n    diff = diff[0], diff[1] % (2*y)\n\nif diff in [(x,y),(x,-y),(-x,y),(-x,-y),(0,0)]:\n    print \"YES\"\nelse:\n    print \"NO\"\n", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "975ba06ceec9d9fcdcbf4d934ddc6134", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x1,y1,x2,y2=map(int,input().split())\nx,y=map(int,input().split())\ndel_a=abs(x1-x2)\ndel_b=abs(y1-y2) \nif x==0:\n    print('YES' if del_b%y==0 else 'NO')\n    exit() \nif y==0:\n    print('YES' if del_a%x==0 else 'NO')\n    exit()\nprint ('YES' if (del_a%x==0 and del_b%y==0 and del_a//x%2==del_b//y%2) else 'NO')", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "68049747e245520f31423f52da446679", "src_uid": "1c80040104e06c9f24abfcfe654a851f", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b, c = map(int, input().split())\nx = 0\nwhile a * x <= c:\n    y = c - a * x\n    if y % b == 0:\n        print(\"Yes\")\n        exit(0)\n    else:\n        x += 1\nprint(\"No\")\n", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "aa5859cb74e5ddc998e0ea62ca7994f7", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b, c = map(int, input().split())\nif a > b:\n    while c % a != 0 and c >= 0:\n        c -= b\nelse:\n    while c % b != 0 and c >= 0:\n        c -= a\nif c < 0:\n    print(\"No\")\nelse:\n    print(\"Yes\")", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "4674735dc3a6e2b3ee04716a42159aae", "src_uid": "e66ecb0021a34042885442b336f3d911", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    n, m = map(int, input().split())\n    a, *aa = map(int, input().split())\n    c, res = 1 - (a & 1) * 2, []\n    for b in aa:\n        if not c:\n            res.append(abs(a - b))\n        if b & 1:\n            c -= 1\n        else:\n            c += 1\n        a = b\n    for i, a in enumerate(sorted(res)):\n        if m < a:\n            print(i)\n            return\n        m -= a\n    print(len(res))\n\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["sortings", "dp", "greedy"], "code_uid": "5c05191ba62fc401ac9de82fc3506ba3", "src_uid": "b3f8e769ee7719ea5c9f458428b16a4e", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,b = map(int,input().split())\nl = list(map(int,input().split()))\nce,co=0,0\nc = 0\ns = 0\nans = 0\nz = []\nfor i in range(n):\n    if(l[i]%2):\n        co+=1\n    else:\n        ce+=1\n    if(ce==co):\n        if(i<n-1):\n            z.append(abs(l[i+1]-l[i]))\n            ce,co=0,0\nz.sort()\nfor i in z:\n    ans+=1\n    s+=i\n    if(s>b):\n        ans-=1\n        print(ans)\n        exit(0)\nprint(ans)", "lang_cluster": "Python", "tags": ["sortings", "dp", "greedy"], "code_uid": "be86ffa4081fe10556146eaeaa8ccc6c", "src_uid": "b3f8e769ee7719ea5c9f458428b16a4e", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nimport os\nfrom math import*\ninput=sys.stdin.buffer.readline\n\nn=int(input())\nx=int(max(int((-1+sqrt(1+8*n))//2),(-1-sqrt(1+8*n))//2))\nz=0\nwhile x>0:\n\tc=n-(x*(x+1)//2)\n\tif c==0:\n\t\tx-=1\n\telse:\n\t\tk=int(max(int((-1+sqrt(1+8*c))//2),(-1-sqrt(1+8*c))//2))\n\t\tif k*(k+1)//2==c:\n\t\t\tz=1\n\t\t\tbreak\n\t\telse:\n\t\t\tx-=1\nif z==1:\n\tprint(\"YES\")\nelse:\n\tprint(\"NO\")\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "binary search"], "code_uid": "a00fbe3cbb17fe6565ec631213ee4a6c", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import Queue\nfrom collections import Counter\nimport math\nimport bisect\n#sys.stdin = open('input.txt', 'r')\n#sys.stdout = open('output.txt','w')\n\nN = int(raw_input())\nA = []\nfor k in xrange(1,N+1) :\n    if k*(k+1)/2 > N :\n        break\n    A += k*(k+1)/2,\ndic = {key : True for key in A}\nfor x in A :\n    if N-x in dic :\n        print 'YES'\n        exit(0)\nprint 'NO'", "lang_cluster": "Python", "tags": ["brute force", "implementation", "binary search"], "code_uid": "655d42b098f3ae2cba09181c77d8ca75", "src_uid": "245ec0831cd817714a4e5c531bffd099", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b = input().split()\na = int(a)\nb = int(b)\nx = abs((b-1)-a)\nif x<a :\n    print(int((a-x)/2))\nelse :\n    print(0)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "00552bcd8b44d1a45d505805b0fd578a", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,k=map(int,input().split())\nl=r=0\nif k > n:\n    r = n\n    l = k-n\nelse:\n    r = k-1\n    l = 1\nans = 0\nif r>l:\n    ans = (r-l+1)//2\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "57e2ca6e9a69c9a4c785cbaac6044287", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, k, x = map(int, input().split())\na = sorted(list(map(int, input().split())))\nresult=k*x\nfor i in range(n-k):\n\tresult+=a[i]\nprint(result)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "3e5c35298c1fbd2cb68ac0823a7abaae", "src_uid": "92a233f8d9c73d9f33e4e6116b7d0a96", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b,c=map(int,input().split());print(sum(map(int,input().split()[:a-b]))+b*c)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "da3e0162357f014ef49f5ec797d2ae00", "src_uid": "92a233f8d9c73d9f33e4e6116b7d0a96", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from sys import stdin, stdout\nfrom collections import Counter, defaultdict\nfrom itertools import permutations, combinations\nraw_input = stdin.readline\npr = stdout.write\n\n\ndef in_arr():\n    return map(int,raw_input().split())\n\n\ndef pr_num(n):\n    stdout.write(str(n)+'\\n')\n\n\ndef pr_arr(arr):\n    for i in arr:\n        stdout.write(str(i)+' ')\n    stdout.write('\\n')\n\n\nrange = xrange # not for python 3.0+\n\n\n# main code\n\ndef check(n,m,l,mid):\n    temp=0\n    c=0\n    k=mid\n    for i in range(0,n,k):\n        for j in range(i,min(n,i+k)):\n            #print mid,i,j,l[j]-c\n            temp+=max(0,l[j]-c)\n        c+=1\n    #print temp,m\n    if temp>=m:\n        return 1\n    return 0\nn,m=in_arr()\nl=in_arr()\nif sum(l)<m:\n    print -1\n    exit()\nl.sort(reverse=True)\nl1=1\nr1=n\nans=n\nwhile l1<=r1:\n    mid=(l1+r1)/2\n    if check(n,m,l,mid):\n        ans=mid\n        r1=mid-1\n    else:\n        l1=mid+1\npr_num(ans)\n", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "64e6fd3aa923019b46cd336dd0256d42", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\n\nn, m = map(int, input().split())\na = list(map(int, input().split())) + [-1]\na.sort(reverse=True)\ns = sum(a)\n\nif m > s + 1:\n    print(-1)\n    exit()\n\nleft, r = 0, n\nwhile r - left > 1:\n    mid = (left + r) // 2\n\n    minus = 0\n    i = 0\n    ans = 0\n    while a[i] > minus:\n        cur = i\n        while cur - i < mid:\n            if a[cur] <= minus:\n                minus = 999999999\n                break\n            ans += a[cur] - minus\n            cur += 1\n        i = cur\n        minus += 1\n    if ans >= m:\n        r = mid\n    else:\n        left = mid\nprint(r)\n", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "a16212a8ee7ecf65b5955c0a7f0b2455", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import sqrt\n\ndef main():\n    b = int(input())\n    if b == 1:\n        return 1\n    used = {1, b}\n    for i in range(2, int(sqrt(b)) + 2):\n        if b % i == 0:\n            used.add(i)\n            used.add(b//i)\n    return len(used)\n\nif __name__==\"__main__\":\n    print(main())", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "afb7d09367677f5b57fb61bf83c6fac9", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from collections import Counter\n\ndef primes(n):\n    primfac = []\n    cnt = Counter()\n    d = 2\n    while d * d <= n:\n        while (n % d) == 0:\n            cnt[d] += 1\n            # primfac.append(d)\n            n //= d\n        d += 1\n    if n > 1:\n        cnt[n] += 1\n        # primfac.append(n)\n\n\n    return list(cnt.values())\n\n\ndef run():\n    b = int(input())\n    occ = primes(b)\n    res = 1\n    for e in occ:\n        res *= e + 1\n\n    print(res)\n\n\nif __name__ == '__main__':\n    run()\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "b1804fab5fca213fef024760ab105e1b", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, k = map(int, input().split())\nif n == k or k == 0:\n    print(0, 0)\nelse:\n    if n % 3 == 0:\n        t = n // 3\n        if k <= t:\n            print(1, k * 2)\n        else:\n            print(1, t * 3 - k)\n    elif n % 3 == 1:\n        t = n // 3\n        if k <= t:\n            print(1, k * 2)\n        else:\n            print(1, t * 3 - k + 1)\n    else:\n        t = n // 3\n        if k <= t:\n            print(1, k * 2)\n        else:\n            print(1, t * 3 - k + 2)\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "9fbed838f350b071412ff03a0b74d931", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,k=[int(f)for f in input().split()]\na=(0 if n==k or k==0 else 1)\nb=(k*2 if n//3>=k else n-k)\nprint(a,(b if k!=0 else 0))\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "9c48220a4df141fd2e46267f1e8617c7", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from datetime import date\na,b=raw_input(),raw_input()\nd={'monday': 0, 'tuesday': 1,'wednesday': 2, 'thursday': 3,'friday':4, 'saturday':5, 'sunday':6}\nans=0\nfor i in range(2000,2029):\n if i%4!=0:\n  for j in range(1,12):\n   if date(i,j,1).weekday()==d[a] and  date(i,j+1,1).weekday()==d[b]:\n    ans=1\n    break\nprint 'YES' if ans==1 else 'NO'   \n   ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "7f453432380bf66052e8760318f3dedf", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "d = {'monday': 1, 'tuesday': 2, 'wednesday': 3, 'thursday': 4, 'friday': 5, 'saturday': 6, 'sunday': 0}\n\nday1=str(input())\nday2=str(input())\n\n\nif day1 == day2 or (d[day1] + 2) % 7 == d[day2] or (d[day1] + 3) % 7 == d[day2] :\n    print(\"YES\")\nelse:\n    print(\"NO\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "10ed8dd9d0f8641a511517e204071e5e", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = [int(x) for x in input().split()]\na = input()\nb = input()\nif a[0] == '<' and b[0] == 'v' and a[-1] == '>' and b[-1] == '^':\n\tprint('YES')\nelif a[0] == '>' and b[-1] == 'v' and a[-1] == '<' and b[0] == '^':\n\tprint('YES')\nelse:\n\tprint('NO')\n", "lang_cluster": "Python", "tags": ["dfs and similar", "implementation", "graphs", "brute force"], "code_uid": "8317afee580017416322bceb8521c599", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "r, c = map(int, input().split())\nrow = input()\ncol = input()\nif((row[0]==\">\" and col[-1]==\"^\") or (row[-1]==\">\" and col[-1]==\"v\") or (row[0]==\"<\" and col[0]==\"^\") or (row[-1]==\"<\" and col[0]==\"v\")):\n    print(\"NO\")\nelse:\n    print(\"YES\")", "lang_cluster": "Python", "tags": ["dfs and similar", "implementation", "graphs", "brute force"], "code_uid": "a42840c2b11e66258efc0a6d2be08655", "src_uid": "eab5c84c9658eb32f5614cd2497541cf", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "candies, people, m, d = [int(i) for i in input().split(' ')]\n\nmax_score = 0\nfor t in range(d):\n    x = candies // (people * t + 1)\n    x = min(x, m)\n    score = (t+1) * x\n    if score > max_score:\n        max_score = score\n\nprint(max_score)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "b51b37f2ba2f466f6cfda77db308d73f", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,k,m,q=map(int,input().split())\nprint(max(i*min(m,n//(k*i-k+1))for i in range(1,q+1)))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "5b4fcf4776f0561a8e70a4bfb2833115", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = map(int, input().split())\narr1 = list(map(int, input().split()))\narr2 = list(map(int, input().split()))\n\nbrr1 = []\nfor i in range(0, 2 * n, 2):\n    brr1.append([min(arr1[i], arr1[i + 1]), max(arr1[i], arr1[i + 1])])\n\nbrr2 = []\nfor i in range(0, 2 * m, 2):\n    brr2.append([min(arr2[i], arr2[i + 1]), max(arr2[i], arr2[i + 1])])\n\nanss = set()\ncrr1 = [[False, False] for _ in range(n)]\ncrr2 = [[False, False] for _ in range(m)]\n\nfor i in range(n):\n    for j in range(m):\n        if brr1[i][0] == brr2[j][0] and brr1[i][1] != brr2[j][1]:\n            crr1[i][0] = True\n            crr2[j][0] = True\n            anss.add(brr1[i][0])\n        if brr1[i][0] == brr2[j][1] and brr1[i][1] != brr2[j][0]:\n            crr1[i][0] = True\n            crr2[j][1] = True\n            anss.add(brr1[i][0])\n        if brr1[i][1] == brr2[j][0] and brr1[i][0] != brr2[j][1]:\n            crr1[i][1] = True\n            crr2[j][0] = True            \n            anss.add(brr1[i][1])\n        if brr1[i][1] == brr2[j][1] and brr1[i][0] != brr2[j][0]:\n            crr1[i][1] = True\n            crr2[j][1] = True                        \n            anss.add(brr1[i][1])\n         \nans = -2   \nfor i in crr1:\n    if i == [True, True]:\n        ans = -1\n        break\n    \nfor i in crr2:\n    if i == [True, True]:\n        ans = -1\n        break\n\nif ans == -1:\n    print(-1)\nelse:\n    if len(anss) == 1:\n        print(*anss)\n    else:\n        print(0)", "lang_cluster": "Python", "tags": ["bitmasks"], "code_uid": "c31a038afbaf9f4c9869ede186b677e3", "src_uid": "cb4de190ae26127df6eeb7a1a1db8a6d", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def complaint_index(i):\n    if i % 2 == 0:\n        return i + 1\n    return i - 1\n\n\ndef is_same_pair(mas1, mas2, i, j):\n    i2 = complaint_index(i)\n    j2 = complaint_index(j)\n    return mas1[i2] == mas2[j2]\n\n\nn, m = [int(s) for s in input().split()]\nmas1 = [int(s) for s in input().split()]\nmas2 = [int(s) for s in input().split()]\n\nn2 = n * 2\nm2 = m * 2\n\nst1 = set()\nst2 = set()\nfor i in range(n2):\n    for j in range(m2):\n        if mas1[i] == mas2[j] and not is_same_pair(mas1, mas2, i, j):\n            st1.add(mas1[i])\n            st2.add(mas2[j])\nif len(st1) == 1:\n    print(st1.pop())\n    exit(0)\nif len(st2) == 1:\n    print(st2.pop())\n    exit(0)\n\nfor i in range(n):\n    first_found = second_found = False\n    for j in range(m):\n        if mas1[i * 2] == mas2[j * 2] and mas1[i * 2 + 1] == mas2[j * 2 + 1] \\\n                or mas1[i * 2 + 1] == mas2[j * 2] and mas1[i * 2] == mas2[j * 2 + 1]:\n            continue\n        if mas1[i * 2] == mas2[j * 2] or mas1[i * 2] == mas2[j * 2 + 1]:\n            first_found = True\n        if mas1[i * 2 + 1] == mas2[j * 2] or mas1[i * 2 + 1] == mas2[j * 2 + 1]:\n            second_found = True\n    if first_found and second_found:\n        print(-1)\n        exit(0)\n\nfor j in range(m):\n    first_found = second_found = False\n    for i in range(n):\n        if mas1[i * 2] == mas2[j * 2] and mas1[i * 2 + 1] == mas2[j * 2 + 1] \\\n                or mas1[i * 2 + 1] == mas2[j * 2] and mas1[i * 2] == mas2[j * 2 + 1]:\n            continue\n        if mas1[i * 2] == mas2[j * 2] or mas1[i * 2 + 1] == mas2[j * 2]:\n            first_found = True\n        if mas1[i * 2] == mas2[j * 2 + 1] or mas1[i * 2 + 1] == mas2[j * 2 + 1]:\n            second_found = True\n    if first_found and second_found:\n        print(-1)\n        exit(0)\n\nprint(0)\n", "lang_cluster": "Python", "tags": ["bitmasks"], "code_uid": "0ac60ed75da30c0bc6d4c23185bd19ec", "src_uid": "cb4de190ae26127df6eeb7a1a1db8a6d", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=input()\nl=len(n)\nn,k=int(n),input()\nK,d,ans=[],1,0\nwhile k:\n    ll=l    \n    while ll>len(k) or int(k[-ll:])>=n or k[-ll]==\"0\": \n        if ll>1: ll-=1\n        else: break\n    K+=[int(k[-ll:])];\n    k=k[:-ll]\nfor x in K:\n    ans+=x*d; d=d*n\nprint(ans)\n    \n    \n    \n", "lang_cluster": "Python", "tags": ["constructive algorithms", "math", "dp", "greedy", "strings"], "code_uid": "fa173db037573080c0dc86434d31c19d", "src_uid": "be66399c558c96566a6bb0a63d2503e5", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#n is the base and k is the result, need to find min x s.t. f(x)=k, length is the length of n\nimport math\ndef find(n,k,length):\n    if k<n:\n        return [k]\n    else:\n        MAX=0\n        index=1\n        \n        for i in range(1,length+1):\n            temp=k%(10**i)\n            if temp>=n:\n                break\n            else:\n                if temp>=10**(i-1):\n                    MAX=temp\n                    index=i\n                 \n        res=k-MAX\n        #empty+=[MAX]\n        res=res//(10**index)\n        #print(MAX,res,n,k,index)\n        return find(n,res,length)+[MAX]\n                \n            \n        \n        \n        \n\nn=int(input())\nk=int(input())\nlength=int(math.log(n-1,10))+1\nANS=find(n,k,length)[::-1]\nans=0\ntemp=1\n\nfor i in range(len(ANS)):\n    ans+=ANS[i]*temp\n    temp*=n\n#print(ANS)    \nprint(ans)    \n    \n            \n        \n        \n        \n    ", "lang_cluster": "Python", "tags": ["constructive algorithms", "math", "dp", "greedy", "strings"], "code_uid": "4b2e18a331e01e1ae120ac59b747c8ba", "src_uid": "be66399c558c96566a6bb0a63d2503e5", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x = input()\ny = 1\nk = 1\nbea = []\nwhile y <= 100000:\n    y = ((2**k)-1)*(2**(k-1))\n    bea.append(y)\n    k = k + 1\nbea.pop(len(bea)-1)\ntemp = 0\nfor j in range(len(bea)):\n    if int(x)%bea[j]==0:\n        temp = bea[j]\nprint(temp)", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "bbbccf95c157aa571f144ec94604611a", "src_uid": "339246a1be81aefe19290de0d1aead84", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "bf = []\nfor k in range(20):\n\tbf = [int('1'*(k+1)+'0'*k,2)] + bf\nn = input()\nwhile bf[0] > n:\n\tbf = bf[1:]\nwhile (n % bf[0]) != 0:\n\tbf = bf[1:]\nprint bf[0]", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "230b263c7a360f03e2071523f99e938b", "src_uid": "339246a1be81aefe19290de0d1aead84", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = map(int, raw_input().split())[1:]\na.sort()\nb = range(10)\nfor k in xrange(35000):\n\tfor i in xrange(len(b)):\n\t\tfor j in xrange(len(b)):\n\t\t\tb[i], b[j] = b[j], b[i]\n\t\t\tb[j], b[i] = b[i], b[j]\nprint \" \".join(map(str, a))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "5df0ffe2ea94e5be859c6181a3d3c6ac", "src_uid": "29e481abfa9ad1f18e6157c9e833f16e", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "for i in range(30000000):\n\t1+1\na=list(map(int,input().split()))\ndel(a[0])\na.sort()\nprint(*a,sep=' ')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "09d3f9425b12e440f73bcc195bd964d2", "src_uid": "29e481abfa9ad1f18e6157c9e833f16e", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\ns = [0]\nwhile True:\n    for i in s:\n        i *= 10\n        if i + 4 >= n and str(i + 4).count('4') == str(4 + i).count('7') : print (i+4), exit()\n        elif i + 7 >= n and str(i + 7).count('4') == str(7 + i).count('7'): print (i+7), exit()\n        else: s.append(i+4), s.append(i+7)\n", "lang_cluster": "Python", "tags": ["brute force", "binary search", "bitmasks"], "code_uid": "2719899bb1ae76b511b0f3b1d9926fea", "src_uid": "77b5f83cdadf4b0743618a46b646a849", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import copy\nL=list(map(int,input()))\nl=copy.copy(L)\nK=len(L)\nfour=0\nseven=0\nfor i in L:\n\tif i==4:\n\t\tfour=four+1\n\telif i==7:\n\t\tseven=seven+1\nif seven==K or L[0]>7:\n\tl.append(0)\nif four==seven and four+seven==K:\n\tL=map(str,L)\n\tprint(\"\".join(L))\nelif L==[4,8]:\n\tprint(\"74\")\nelif L==[4,7,4,7,4,7,4,9]:\n\tprint(\"47474774\")\nelif L==[4,7,7,7]:\n\tprint(\"7447\")\nelif L==[7,7,4,8]:\n\tprint(\"444777\")\nelif L==[7,7,7,3]:\n\tprint(\"444777\")\nelif L==[4,4,7,7,7,7]:\n\tprint(\"474477\")\nelse:\n\tK=len(l)\n\tif K%2==1:\n\t\tl.append(0)\n\tK=len(l)\n\tfour=0\n\tseven=0\n\tfor i in range(0,K):\n\t\tif l[i]<4 and four<K/2:\n\t\t\tl[i]=4\n\t\t\tfour=four+1\n\t\telif l[i]<4 and four==K/2:\n\t\t\tl[i]=7\n\t\t\tseven=seven+1\n\t\telif l[i]==4 and four<K/2:\n\t\t\tfour=four+1\n\t\telif l[i]==4 and seven<K/2:\n\t\t\tl[i]=7\n\t\t\tseven=seven+1\n\t\telif l[i]>4:\n\t\t\tl[i]=4\n\t\t\tl=list(map(str,l))\n\t\t\tL=list(map(str,L))\n\t\t\tif int(\"\".join(l))>=int(\"\".join(L)) and four<K/2:\n\t\t\t\tfour=four+1\n\t\t\telse:\n\t\t\t\tl[i]=7\n\t\t\t\tseven=seven+1\n\t\t\tl=list(map(int,l))\n\t\t\tL=list(map(int,L))\n\t\telif l[i]>4 and seven<K/2:\n\t\t\tl[i]=7\n\t\t\tseven=seven+1\n\tl=map(str,l) \n\tprint(\"\".join(l))\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "binary search", "bitmasks"], "code_uid": "86f0a2cac55531aebf7fa88e6fc326c5", "src_uid": "77b5f83cdadf4b0743618a46b646a849", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input()\nl,u,d=0,0,0\nfor i in s:\n u+=i.isupper()\n l+=i.islower()\n d+=i.isdigit()\nprint [\"Too weak\",\"Correct\"][(len(s)>=5)*u*l*d!=0]\n ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "78e1e9b71aea38a9ba32a94bda0a0aaf", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s=input()\nif len(s)<5:\n\tprint(\"Too weak\")\nelse:\n\tn=len(s)\n\ta=[]\n\tb=[]\n\tc=[]\n\tfor i in range(n):\n\t\tif s[i].isupper():\n\t\t\ta.append(s[i])\n\t\telif s[i].islower():\n\t\t\tb.append(s[i])\n\t\telif s[i].isnumeric():\n\t\t\tc.append(s[i])\n\tif len(a)==0 or len(b)==0 or len(c)==0:\n\t\tprint(\"Too weak\")\n\telse:\n\t\tprint(\"Correct\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "e4d7c1b12aca950f2bb52adf94d15eca", "src_uid": "42a964b01e269491975965860ec92be7", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\na=[int(z) for z in input().split()]\nb=[int(z) for z in input().split()]\nc1,d1,e1,f1,g1=0,0,0,0,0\nc2,d2,e2,f2,g2=0,0,0,0,0\nfor i in a:\n    if i==1:\n        c1+=1\n    elif i==2:\n        d1+=1\n    elif i==3:\n        e1+=1\n    elif i==4:\n        f1+=1\n    else:\n        g1+=1\nfor i in b:\n    if i==1:\n        c2+=1\n    elif i==2:\n        d2+=1\n    elif i==3:\n        e2+=1\n    elif i==4:\n        f2+=1\n    else:\n        g2+=1\nif (c1+c2)&1 or (d1+d2)&1 or (e1+e2)&1 or (f1+f2)&1 or (g1+g2)&1:\n    print(-1)\nelse:\n    print((abs((c1+c2)//2-c1)+abs((d1+d2)//2-d1)+abs((e1+e2)//2-e1)+abs((f1+f2)//2-f1)+abs((g1+g2)//2-g1))//2)\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "9a10f3efe7b9a0867dd5a6340c68d329", "src_uid": "47da1dd95cd015acb8c7fd6ae5ec22a3", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nans = 0\nfor i in range(1, 6):\n    x, y = a.count(i), b.count(i)\n    if (x+y) & 1:\n        ans = -1\n        break\n    ans += abs(x - y) // 2\nprint(ans//2)\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "65aa9706259ab63927310f8a841807d9", "src_uid": "47da1dd95cd015acb8c7fd6ae5ec22a3", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a, b = map(int, input().split())\naw, t, bw = 0, 0, 0\nfor i in range(1, 7):\n    if abs(a-i) < abs(b-i):\n        aw += 1\n    elif abs(a-i) > abs(b-i):\n        bw += 1\n    else:\n        t += 1\nprint(aw, t, bw)", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "85836529703f48d335e36087b3383c83", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "first=0\nsecond=0\ndraw=0\nz,x=list(map(int,input().split()))\nfor i in range(1,7):\n    #print('(i-z)=%d   (i-x)=%d'%(abs(i-z),abs(i-x)))\n    if abs(i-z)<abs(i-x):\n        first+=1\n      #  print('first',first)\n    elif abs(i-z)>abs(i-x) :\n        second+=1\n       # print('second',second)\n    else:\n      draw+=1\n     # print('draw',draw)\nprint(first,draw,second)  ", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "79c3baa6826c255c7741fbcee5d263cf", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=input()\na=int(n)\nl=len(n)\nx=a//10**(l-1)\nprint((10**(l-1))*(x+1)-a)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "039d0d90247a328b6488fc7dee4fcd43", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# cook your dish here\nimport math\nn = int(input())\ncnt = 0\na = n\nwhile a>0:\n    x = a%10\n    cnt = cnt + 1\n    a = a//10\nz = int(math.pow(10,cnt-1))\nval = n%z\nans = n-val+int(math.pow(10,cnt-1))\nprint(ans - n)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "694d4a0652888d4431560b574af6a363", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\nar = map(int, raw_input().split())\na, b = 0, 0\nfor i in xrange(n):\n\tif ar[i] == 1:\n\t\ta = i\n\tif ar[i] == n:\n\t\tb = i\nprint max(a, max(b, max(n-a-1, n-b-1)))", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "962075c89683bd1d0650faf9c8dd2f68", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nl=list(map(int,input().split()))\nh=max(l)\nm=min(l)\np1=l.index(h)+1\np2=l.index(m)+1\nt=abs(p1-p2)\nt1=abs(p1-n)\nt2=abs(p2-n)\nt3=abs(1-p2)\nt4=abs(1-p1)\n\nprint(max(t,t1,t2,t3,t4))\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "eec37cfbd27624915d8dae9125bdea33", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\nn = int(raw_input())\n\nif(n==0):\n\tprint\"+------------------------+\"\n\tprint\"|#.#.#.#.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|#.#.#.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|#.......................|\"\n\tprint\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==1):\n\tprint\"+------------------------+\"\n\tprint\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|#.#.#.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|#.......................|\"\n\tprint\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==2):\n\tprint\"+------------------------+\"\n\tprint\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.#.#.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|#.......................|\"\n\tprint\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==3):\n\tprint\"+------------------------+\"\n\tprint\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.#.#.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|#.#.#.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==4):\n\tprint\"+------------------------+\"\n\tprint\"|O.#.#.#.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.#.#.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==5):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.#.#.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.#.#.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==6):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.#.#.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.#.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.#.#.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==7):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.#.#.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.#.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.#.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==8):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.#.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.#.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.#.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==9):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.#.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.#.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==10):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.#.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==11):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.#.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==12):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.#.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==13):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.#.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==14):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.#.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==15):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.#.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==16):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.#.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==17):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.#.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==18):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.#.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==19):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.#.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==20):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.#.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==21):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.#.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==22):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.#.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==23):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.#.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==24):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.O.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.#.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==25):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.#.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.O.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.O.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==26):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.O.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.O.#.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.O.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==27):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.O.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.O.O.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.O.#.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==28):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.O.#.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.O.O.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.O.O.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==29):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.O.O.#.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.O.O.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==30):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.O.O.#.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==31):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.#.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==32):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.O.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.#.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.#.|.|)\"\n\tprint\"+------------------------+\"\nelif(n==33):\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.O.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.O.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.#.|.|)\"\n\tprint\"+------------------------+\"\nelse:\n\tprint\"+------------------------+\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.O.|D|)\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.O.|.|\"\n\tprint\"|O.......................|\"\n\tprint\"|O.O.O.O.O.O.O.O.O.O.O.|.|)\"\n\tprint\"+------------------------+\"\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "6fc8041af7809d2075f85275853d159b", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "k = int(input())\nseats = (28, 56, 83, 110, 30, 58, 112, 32, 60, 114, 34, 62, 116, 36, 64, 118, 38,\n             66, 120, 40, 68, 122, 42, 70, 124, 44, 72, 126, 46, 74, 128, 48, 76, 130)\nbus = list('+------------------------+\\n|#.#.#.#.#.#.#.#.#.#.#.|D|)\\n'\n                        '|#.#.#.#.#.#.#.#.#.#.#.|.|\\n|#.......................|\\n|'\n                        '#.#.#.#.#.#.#.#.#.#.#.|.|)\\n+------------------------+')\nfor i in seats[:k]:\n    bus[i] = 'O'\n             \nprint(''.join(bus))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "2df089654c873bc54b798666c4676daf", "src_uid": "075f83248f6d4d012e0ca1547fc67993", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "l = list(str(input()))\nresult = 0\nfor x in l:\n    if x in 'aeiou13579':\n        result += 1\nprint(result)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "a405d39b5921b53ff4bbcdc17b6d1e10", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "strin = raw_input()\n\ncount = 0\nfor i in xrange(len(strin)):\n\tif (strin[i] in \"aeiou13579\"): count += 1\n\nprint count\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "890af7c6416ccd968151dadd13083b69", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "x1,y1,x2,y2,x3,y3 = map(int, raw_input().split())\n\ndef isRight(a1,b1,a2,b2,a3,b3):\n    if a1 == a2 and b1 == b2:\n        return False\n    if a1 == a3 and b1 == b3:\n        return False\n    if a3 == a2 and b3 == b2:\n        return False\n    \n    l12 = (abs(a1-a2)**2 + abs(b1-b2)**2)\n    l13 = (abs(a1-a3)**2 + abs(b1-b3)**2)\n    l23 = (abs(a3-a2)**2 + abs(b3-b2)**2)\n    l = [l12,l13,l23]\n    ls = sorted(l)\n    \n    if ls[0] + ls[1] == ls[2]:\n        return True\n    else:\n        return False\n\nr1 = isRight(x1-1,y1,x2,y2,x3,y3)\nr2 = isRight(x1+1,y1,x2,y2,x3,y3)\nr3 = isRight(x1,y1-1,x2,y2,x3,y3)\nr4 = isRight(x1,y1+1,x2,y2,x3,y3)\nr5 = isRight(x1,y1,x2-1,y2,x3,y3)\nr6 = isRight(x1,y1,x2+1,y2,x3,y3)\nr7 = isRight(x1,y1,x2,y2-1,x3,y3)\nr8 = isRight(x1,y1,x2,y2+1,x3,y3)\nr9 = isRight(x1,y1,x2,y2,x3-1,y3)\nr10 = isRight(x1,y1,x2,y2,x3+1,y3)\nr11 = isRight(x1,y1,x2,y2,x3,y3-1)\nr12 = isRight(x1,y1,x2,y2,x3,y3+1)\n\nif isRight(x1,y1,x2,y2,x3,y3):\n    print 'RIGHT'\nelif r1 or r2 or r3 or r4 or r5 or r6 or r7 or r8 or r9 or r10 or r11 or r12:\n    print 'ALMOST'\nelse:\n    print 'NEITHER'", "lang_cluster": "Python", "tags": ["brute force", "geometry"], "code_uid": "0703690a34151fc35d576284e0302c0e", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def rt(p):\n    a = (p[0] - p[2]) ** 2 + (p[1] - p[3]) ** 2\n    b = (p[0] - p[4]) ** 2 + (p[1] - p[5]) ** 2\n    c = (p[2] - p[4]) ** 2 + (p[3] - p[5]) ** 2\n    return a and b and c and (a + b == c or a + c == b or b + c == a)\n\n\ndef f(p):\n    if rt(p):\n        return 'RIGHT'\n    for i in range(6):\n        p[i] -= 1\n        if rt(p):\n            return 'ALMOST'\n        p[i] += 2\n        if rt(p):\n            return 'ALMOST'\n        p[i] -= 1\n    return 'NEITHER'\nprint(f(list(map(int, input().split()))))", "lang_cluster": "Python", "tags": ["brute force", "geometry"], "code_uid": "f5c50c1c6c02d6dd29d047c94102d53b", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m,r = map(int, input().split())\ns = [int(x) for x in input().split()]\nb = [int(x) for x in input().split()]\ns.sort()\nbm = max(b)\n\npoc = 0\ni = 0\nwhile r > 0 and i < n:\n    za_kolko = s[i]\n    if za_kolko >= bm:\n        break\n    k = r//za_kolko\n    poc += k\n    r %= za_kolko\n    i += 1\n\nprint(poc*bm + r)\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "e1e00c39ad6eafc1dedc91bd76fa0e9e", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys, math,os\n#from io import BytesIO, IOBase\n#data = BytesIO(os.read(0,os.fstat(0).st_size)).readline\nfrom bisect import bisect_left as bl, bisect_right as br, insort\nfrom heapq import heapify, heappush, heappop\nfrom collections import defaultdict as dd, deque, Counter\n# from itertools import permutations,combinations\nfrom decimal import Decimal\nfrom fractions import Fraction\ndef data(): return sys.stdin.readline().strip()\ndef mdata(): return list(map(int, data().split()))\ndef outl(var): sys.stdout.write(' '.join(map(str, var)) + '\\n')\ndef out(var): sys.stdout.write(str(var) + '\\n')\n#sys.setrecursionlimit(100000 + 1)\nINF = 10**9\nmod = 10**9 + 7\n\nn,m,r=mdata()\ns=mdata()\nb=mdata()\nout(max((r//min(s))*max(b)+r%min(s),r))\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "fb96cad1501629578517ae12be6d0ac7", "src_uid": "42f25d492bddc12d3d89d39315d63cb9", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x = int(raw_input())\nif x%2 == 0:\n    print(\"Mahmoud\")\nelse:\n    print(\"Ehab\")", "lang_cluster": "Python", "tags": ["math", "games"], "code_uid": "1b0fda3f4b8b0c1062237d68315c60fc", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\ndef solve(n):\n    if n % 2 == 0:\n        return \"Mahmoud\"\n    return \"Ehab\"\n\ndef driver():\n    n = int(input())\n    print(solve(n))\n\ndriver()", "lang_cluster": "Python", "tags": ["math", "games"], "code_uid": "5a179de1b51bf493e0d75176c034ec73", "src_uid": "5e74750f44142624e6da41d4b35beb9a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def gcd(a, b):\n    while a:\n        a, b = b % a, a\n    return b\n\nn, a, b, p, q = map(int, input().split())\nox = n // (a * b // gcd(a, b))\nax = n // a - ox\nbx = n // b - ox\nprint(ax * p + bx * q + ox * max(p, q))", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "d06fc679d034d41469d3513c5e041645", "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "def gcd(a,b):\n\ta ,b = max(a,b), min(a,b)\n\twhile (a % b != 0):\n\t\taux = b\n\t\tb = a % b\n\t\ta = aux\n\treturn b\ndef mmc(a, b):\n\ta ,b = max(a,b), min(a,b)\n\treturn a*(b/gcd(a,b))\nN, a, b, c_a, c_b = map(int, raw_input().split())\n\ncont = 0\n\nn_a = N / a\nn_b = N / b\nn_ab = N / mmc(a,b)\nn_a -= n_ab\nn_b -= n_ab\n\ncont += n_a * c_a\ncont += n_b * c_b\ncont += n_ab * max(c_a, c_b)\n\nprint cont\n", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "2dd822b6c2513d5b37b1156f43d447c9", "src_uid": "35d8a9f0d5b5ab22929ec050b55ec769", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def prime(n):\n    if n == 1:\n        return 0\n    for j in range(2, int(pow(n, 0.5)) + 1):\n        if n % j == 0:\n            return 0\n    return 1\n\n\na, b = map(int, input().split())\nif prime(a) == 1 and prime(b) == 1:\n    for i in range(a + 1, b+1):\n        if prime(i) == 0:\n            #print(i)\n            continue\n        else:\n           # print(i)\n            if i == b:\n                print('YES')\n                break\n            else:\n                print('NO')\n                break\nelse:\n    print('NO')\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "c191982331fbbea8cff2cc4b44f08e82", "src_uid": "9d52ff51d747bb59aa463b6358258865", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\ndef isprime(n):\n    if n <= 1: return False\n    if n == 2: return True\n    if n % 2 == 0: return False\n\n    x = 3\n    while x*x <= n:\n        if n % x == 0: return False\n        x += 2\n    return True\n\ndef calc(n, m):\n    x = n+1\n    while x <= m:\n        if isprime(x):\n            return x == m\n        x += 1\n    return False\n\ndef main():\n    n, m = map(int, raw_input().split())\n\n    if calc(n, m):\n        print \"YES\"\n    else:\n        print \"NO\"\n\nmain()\n\n\n    \n    \n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "51e8e3e81548ce726ec3e090a60de1ef", "src_uid": "9d52ff51d747bb59aa463b6358258865", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n\nn, m = [int(x) for x in input().split(' ')]\narr = [int(x)-1 for x in input().split(' ')]\nk = [int(x) for x in input().split(' ')]\n\nsumm = 0\nfor i in range(m):\n\tsumm += k[i]\n\nfor i in range(n):\n\tif i >= summ:\n\t\tk[arr[i-summ]] += 1\n\tk[arr[i]] -= 1\n\tdone = True\n\tfor j in range(m):\n\t\tif k[j] != 0:\n\t\t\tdone = False\n\tif done:\n\t\tprint('YES')\n\t\tsys.exit()\nprint('NO')", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "8dbadebfa50438e48f891b9b42d35c9a", "src_uid": "59f40d9f35e5fe402112214b42b682b5", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "inp = raw_input\nn, m = map(int, inp().split())\nsabs = [int(v) - 1 for v in inp().split()]\ncols = [int(v) for v in inp().split()]\nt = sum(cols)\ndef ok():\n    for i in range(m):\n        if K[i] != cols[i]: return False\n    return True\nK = [0]*len(cols)\nfor i in range(t):\n    K[sabs[i]] += 1\n\nfor i in range(t, n):\n    if ok():\n        print('YES')\n        exit(0)\n    K[sabs[i]] += 1\n    K[sabs[i - t]] -= 1\n\nif ok():\n    print('YES')\nelse:\n    print('NO')\n    \n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "8d671b3a2a8dbf7417ef124f4d11be4e", "src_uid": "59f40d9f35e5fe402112214b42b682b5", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "h1, m1 = map(int, raw_input().split(':'))\nh2, m2 = map(int, raw_input().split(':'))\n\nt1 = h1*60 + m1\nt2 = h2*60 + m2\n\nt = (t2 + t1) / 2\n\nprint \"%02d:%02d\"%(t/60, t%60)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "8a21a9650e2bd52cf750bcdf647fa6c6", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "i = str(input())\nf = str(input())\nti = int(f\"{i[0]}{i[1]}\")*60 + int(f\"{i[3]}{i[4]}\")\ntf = int(f\"{f[0]}{f[1]}\")*60 + int(f\"{f[3]}{f[4]}\")\nm = (ti+tf)/2\ntm = ti+(tf-m)\nif (int(tm//60)>=10 and int(tm%60)>=10):\n  print(f\"{int(tm//60)}:{int(tm%60)}\")\nelif int(tm//60)>=10 and int(tm%60)<10:\n  print(f\"{int(tm//60)}:0{int(tm%60)}\")\nelif int(tm//60)<10 and int(tm%60)>=10:\n  print(f\"0{int(tm//60)}:{int(tm%60)}\")\nelse:\n  print(f\"0{int(tm//60)}:0{int(tm%60)}\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "32af0bf8da4afa29c491f6a820eae8e8", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "MOD = 998244353\nfac = [1] * (2 * 10 ** 5 + 10)\n\n\ndef comb(n, k):\n    return fac[n] * pow(fac[n - k], MOD - 2, MOD) * pow(fac[k], MOD - 2, MOD) % MOD\n\n\nfor i in range(len(fac) - 1):\n    fac[i + 1] = fac[i] * (i + 1) % MOD\nn, k = map(int, input().split())\nif k == 0:\n    print(fac[n])\nelse:\n    k = n - k\n    if k <= 0:\n        print(0)\n        exit(0)\n    ans = 0\n    for i in range(k + 1):\n        t = comb(k, i) * pow(k - i, n, MOD) % MOD\n        if i % 2:\n            ans -= t\n        else:\n            ans += t\n    print(2 * ans * comb(n, k) % MOD)\n", "lang_cluster": "Python", "tags": ["math", "combinatorics", "fft"], "code_uid": "cc75d20016e74b6f91846941f40956c9", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom functools import reduce\nints = (int(x) for x in sys.stdin.read().split())\n\nmod = 998244353\n\ndef mod_pow(a, k):\n    r = 1\n    while k and r:\n        if k%2: r = (r*a)%mod\n        k, a = k>>1, (a*a)%mod\n    return r\n\n\ndef main():\n    mul = lambda a,b: (a*b)%mod\n    def nCk(n, k):\n        assert 0<=k<=n\n        return mul(fact[n], mod_pow(mul(fact[k], fact[n-k]), mod-2))\n\n    n, k = next(ints), next(ints)\n    if 0 <= k < n:\n        fact = [1]*(n+1)\n        for i in range(1, n+1):\n            fact[i] = mul(fact[i-1], i)\n        m, ans = n-k, 0\n        for i in range(m):\n            sign = 1 if i%2==0 else -1\n            ans += sign*mul(nCk(m, i), mod_pow(m-i, n))\n            ans %= mod\n        ans = mul(ans, nCk(n,k))\n        ans = mul(ans, 1+(k>0))\n    else:\n        ans = 0\n    print(ans)\n    return\n\nmain()\n", "lang_cluster": "Python", "tags": ["math", "combinatorics", "fft"], "code_uid": "2ca6951d329f941a521b9523c741eebd", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\nslist = input()\nslist += '0'\nc = 0\nans = ''\nfor s in slist:\n    if s == '0':\n        ans += str(c)\n        c = 0\n    else: c += 1\nprint(ans)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "e199c406a355828483433bbd686049c0", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input(''))\nnum=list(input(''))\nlis=[]\ncount=0\nfor i in range(0,n):\n    if num[i]=='1':\n        count+=1\n    else:\n        lis.append(str(count))\n        count=0\n       # print('appended')\nif num[n-1]=='1':\n    lis.append(str(count))\nelse:\n    lis.append(str(0))\n\nprint(''.join(lis))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "d39540c42d75b8e44f02e04c65414ae4", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\n\nif n%2==0:\n    print \"white\\n1 2\\n\"\nelse:\n    print \"black\\n\"", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "games"], "code_uid": "2a27d3e32371ee378a79e1b04d92aa31", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\nif n%2==0:\n    print(\"white\")\n    print(1,2)\nelse:\n    print(\"black\")    ", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "games"], "code_uid": "3137dff0cf7f4a057096f37d306d70fe", "src_uid": "52e07d176aa1d370788f94ee2e61df93", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#coding=utf-8\n#\u6c42\u7d20\u6570p\u7684\u539f\u6839\u4e2a\u6570\uff0c\u5373\u662fp-1\u7684\u6b27\u62c9\u51fd\u6570;\n\ndef euler(n):\n    if n <= 2:\n        return 1\n    cnt = n\n    for x in xrange(2, n):\n        if n%x == 0:\n            cnt -= cnt/x #\u7ed9\u5fd8\u8bb0\u4e86\uff01\n            while n%x == 0:\n                n /= x\n    if n > 1:\n        cnt -= cnt/n\n    return cnt\n\np = input()\nret = euler(p-1)\nprint ret\n", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "05df321a4696f53f8ffb36a124b9959c", "src_uid": "3bed682b6813f1ddb54410218c233cff", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "p=int(input())\nif p == 2:\n    print(1)\n    exit()\nans=0\nfor x in range(1,p):\n    m=x%p\n    if m==1:\n        if x==2:\n            q=True\n        else:\n            q=False\n    else:\n        q=False\n        for i in range(2,p):\n            m=(m*x)%p\n            if m==1:\n                if i==p-1:\n                    q=True\n                break\n    ans+=q\nprint(ans)\n    \n", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "3f49896aa5427d9c37310cdf2e2d98db", "src_uid": "3bed682b6813f1ddb54410218c233cff", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = input().split()\n\nprint(int(a[0]) + int(a[1]))", "lang_cluster": "Python", "tags": ["dsu", "constructive algorithms", "implementation", "brute force"], "code_uid": "c744d1d3061142c9ab1597572cf63b4c", "src_uid": "b6e3f9c9b124ec3ec20eb8fcea075add", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b = map(int,input().split())\nprint(a+b)", "lang_cluster": "Python", "tags": ["dsu", "constructive algorithms", "implementation", "brute force"], "code_uid": "cba88ac829ba32cb212b4ee35a7bfcaa", "src_uid": "b6e3f9c9b124ec3ec20eb8fcea075add", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import gcd\r\n\r\nn, m = map(int, input().split())\r\nans=0\r\ncur=m\r\ng=2\r\nq=m*m\r\nfor i in range(2, n+1):\r\n    if gcd(g, i)==1 and g < 10 ** 13:\r\n        g*=i\r\n    cur*=m//g\r\n    cur=cur%998244353\r\n    ans+=q-cur\r\n    q*=m\r\n    q=q%998244353\r\n    ans=ans%998244353\r\nprint(ans%998244353)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "number theory"], "code_uid": "6078f4eee45066f993b9b89473efa371", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "I = lambda : int(input())\r\nIs = lambda : map(int,input().split())\r\nLi = lambda : list(map(int,input().split()))\r\ndef solve():\r\n    def is_prime(n):\r\n        i = 2\r\n        while n > i*i and n % i != 0:\r\n            i += 1\r\n        return bool(n<i*i)\r\n    n,m = Is()\r\n    mod = 998244353\r\n    ans = 0\r\n    cur = 1\r\n    div = 1\r\n    for i in range(1,n+1):\r\n        if is_prime(i):\r\n            div *= i\r\n        cur *= m//div\r\n        ans += pow(m,i,mod) - cur % mod\r\n    print(ans%mod)\r\n    return 1\r\nsolve()\r\n\r\n\t  \r\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "number theory"], "code_uid": "14646bc4a24e80458988aab1970d8d8d", "src_uid": "0fdd91ed33431848614075ebe9d2ee68", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b = map(int, raw_input().split(' '))\ns = str(b)\ns = s[::-1]\nb = int(s)\nprint a+b", "lang_cluster": "Python", "tags": ["constructive algorithms"], "code_uid": "71ec93e2a9d4cdd8a6e620a76089f15d", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b = input().split()\na,b = int(a),int(b)\ntemp = 0\ndigit = 0\nwhile b:\n    digit = b%10\n  #  print(digit)\n    temp = temp*10 + digit\n    b //= 10\nb = temp\n#print(b)\nprint(a+b)", "lang_cluster": "Python", "tags": ["constructive algorithms"], "code_uid": "78da22216543c1bf09bf46fe35ac4ff0", "src_uid": "69b219054cad0844fc4f15df463e09c0", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "o, e = map(int, input().split())\n\nif abs(o - e) <= 1 and o + e > 0:\n    print(\"YES\")\nelse:\n    print(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "bbe6db118768ffbb8299ac7e92d266bb", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a, b = map(int, input().split())\nprint('YES' if abs(a - b) < 2 and (a, b) != (0, 0) else 'NO')", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms", "implementation"], "code_uid": "c5bdd122337ee0bc4295fc7287559dca", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "fin = input()\n\na, b, c = map(int, fin.split())\nrings = 0\n\nfor ring in range(c):\n  rings = rings + (2 * a + 2 * b - 4)\n\n  a = a - 4\n  b = b - 4\n\nprint(rings)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "7eeacaddf49d6ae90b48e4eec3fee229", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "w, h, k = [int(x) for x in input().split()]\ns = 0\nfor i in range(1, k + 1):\n    s += (w - 4 * (i - 1) + h - 4 * (i - 1)) * 2 - 4\nprint(s)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "9e58fef802ec4d1bab814d77fc7dbfae", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b = list(map(int, input().split()))\nfor i in range(b):\n    if a % 10 != 0:\n        a -= 1\n    else:\n        a /= 10\nprint(int(a))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "cb4820305a7ab90d89817aca757201ad", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n , k = input().split()\nfor i in range(int(k)):\n    n = int(n)\n    n = n-1 if n % 10 else n//10\nprint(n)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b0b44c1f42cb2aec451d8bf9ace281f7", "src_uid": "064162604284ce252b88050b4174ba55", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nimport math\nimport bisect\n\ndef solve(s):\n    n = len(s)\n    min_val = n\n    for i in range(1, n):\n        if i * 2 <= n:\n            if s[0:i] == s[i:2*i]:\n                val = i + 1 + (n - 2 * i)\n                min_val = min(min_val, val)\n    return min_val\n\ndef main():\n    n = int(input())\n    s = input()\n    print(solve(s))\n\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "2aeff00e9ef08bdf29bc1f3d64c92194", "src_uid": "ed8725e4717c82fa7cfa56178057bca3", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nletters = list(input())\nanswer = n\nfor i in range(1, n):\n    if letters[:i] == letters[i:2*i]:\n        answer = min(answer, n - i + 1)\nprint(answer)", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "c7266053f2cde2a21f9fccacbbe7c3e9", "src_uid": "ed8725e4717c82fa7cfa56178057bca3", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\na = list(map(int, input().split()))\n\ninfinite = False\npoints = 0\n\nfor i in range(1, n):\n    if (a[i - 1], a[i]) in [(2, 3), (3, 2)]:\n        infinite = True\n    \n    if (a[i - 1], a[i]) in [(2, 1), (1, 2)]:\n        points += 3\n    if (a[i - 1], a[i]) in [(3, 1), (1, 3)]:\n        points += 4\n    if i > 1 and (a[i - 2], a[i - 1], a[i]) == (3, 1, 2):\n        points -= 1\n\nif infinite:\n    print(\"Infinite\")\nelse:\n    print(\"Finite\\n{}\".format(points))\n", "lang_cluster": "Python", "tags": ["geometry"], "code_uid": "fd820cb8af82c0fbb09b29db46a57e42", "src_uid": "6c8f028f655cc77b05ed89a668273702", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = input()\na = list(map(int, input().split()))\ntotal = 0\n\nf = [\n    [],\n    [0, 0, 3, 4],\n    [0, 3, 0, 0],\n    [0, 4, 0, 0]\n]\n\nok = True\nfor a1, a2 in zip(a, a[1:]):\n    x = f[a1][a2]\n    if x == 0:\n        ok = False\n        break\n    total += x\nif ok:\n    total -= sum(1 for x, y, z in zip(a, a[1:], a[2:]) if x == 3 and y == 1 and z == 2)\nprint('Finite\\n{}'.format(total) if ok else 'Infinite')", "lang_cluster": "Python", "tags": ["geometry"], "code_uid": "4dd618e7abff3274f9a30d6806aef83e", "src_uid": "6c8f028f655cc77b05ed89a668273702", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "S = 'CODEFORCES'\nn = len(S)\ns = str(input())\na = False\n\nfor i in range(n):\n    k = s.find(S[:n - i])\n    if k != -1:\n        p = k\n        while p != -1:\n            p = s.find(S[n - i:], p + 1)\n            v1 = (k, k + n - i)\n            v2 = (p, p + i)\n            #print('{} {}'.format(v1, v2))\n            if v1[0] == 0 and v2[1] == len(s):\n                a = True\n            elif (v1[0] == 0 or v2[1] == len(s)) and v2[1] - v1[0] == 10:\n                a = True\n    \nif a:\n    print('YES')\nelse:\n    print('NO')", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "29a54530f175f60d48f86aa3857eea49", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input()\nword = \"CODEFORCES\"\nvalid = False\n\nfor x in range(len(word) + 1):\n    begin = word[:x]\n    end = word[x:]\n    valid = valid or (s.startswith(begin) and s.endswith(end))\n\nprint(\"YES\" if valid else \"NO\")\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "797cfb094f3a7e595fccf2452eacca68", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import stdin\nimport re\nimport math\n\ndef readInt(count=1):\n    m = re.match('\\s*' + ('([+-]?\\d+)\\s*' * count), stdin.readline())\n    if m is not None:\n        ret = []\n        for i in range(1, m.lastindex + 1):\n            ret.append(int(m.group(i)))\n        return ret\n    return None\n\nx, y, l, r = readInt(4)\n\nmax = 0\nunhappyYears = [l-1]\nxa = 1\nwhile xa <= r:\n    yb = 1\n    while True:\n        val = xa + yb\n        if val > r:\n            break\n        if val >= l and val not in unhappyYears:\n            unhappyYears.append(val)\n        yb *= y\n    xa *= x\nunhappyYears.sort()\nunhappyYears.append(r+1)\n\nfor i in range(len(unhappyYears)-1):\n    cur = unhappyYears[i+1] - unhappyYears[i] - 1\n    if cur > max:\n        max = cur\nprint(max)", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "3222c582734bf2be74d2954623330f36", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\n\nsx,sy,sl,sr = input().split();\nx = int(sx);\ny = int(sy);\nl = int(sl);\nr = int(sr);\n\n\nqx = [];\n\nnow = 1;\nwhile(now <= r):\n    qx.append(now);\n    now*=x;    \n\nqy = [];\nnow = 1;\nwhile(now <= r):\n    qy.append(now);\n    now*=y;\n\nq = [];\nfor i in qx:\n    for j in qy:\n        if(l<=i+j and i+j<=r):\n            q.append(i+j);\n\nq.sort();\nc = [];\n# print(q);\nlenq = len(q);\nans = 0;\nif(lenq > 0):\n    ans = r-q[lenq-1];\nelse:\n    ans = r-l+1;\nfor i in range(0,lenq):\n    if(i==0):\n        ans=max(ans,q[i]-l);\n    else:\n        ans=max(ans,q[i]-q[i-1]-1);\n\nprint(ans);\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "2a3b799affce260fd92223fc6b490040", "src_uid": "68ca8a8730db27ac2230f9fe9b120f5f", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,k =map(int,raw_input().split())\nl = 2**n - 1\nwhile l/2 != k-1:\n\tif l/2 < k - 1:\n\t\tk = k - l/2 - 1\n\tn -= 1\n\tl = 2**n - 1\nprint n", "lang_cluster": "Python", "tags": ["constructive algorithms", "binary search", "implementation", "bitmasks"], "code_uid": "bda5809206a71a98b6000c06b2924696", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, k = map(int, raw_input().split())\nlen_ = [0 for i in range(n+1)]\nfor i in range(1, n+1):\n    len_[i] = len_[i-1]*2 + 1\n\n#print len_\n\ndef get(n, k):\n    #print n, k\n    if k == len_[n-1] + 1:\n        return n\n    if k > len_[n-1] + 1:\n        return get(n - 1, k - len_[n-1] - 1)\n    return get(n - 1, k)\n\nprint get(n, k)\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "binary search", "implementation", "bitmasks"], "code_uid": "4193a8ba2719fa51ae6747292003a5b3", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m = map(int,raw_input().strip().split(' '))\nl=[]\ncount = 0\ncountr = 0\ncountc = 0\nfor i in range(n):\n    l.append(raw_input().strip())\n    if 'S' not in l[i]:\n        count += m\n        countr += 1\n\nfor j in range(m):\n    flag = True\n    for i in range(n):\n        if l[i][j] == 'S':\n            flag = False\n            break\n    if flag: \n        count += n\n        countc += 1\nprint count - countr*countc\n\n    \n\n\n\n\n\n        \n\n    \n\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "b817f86e46764b3e4bef43add6de2ac8", "src_uid": "ebaf7d89c623d006a6f1ffd025892102", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\n\ns = ''\nsm = 0\nfor _ in range(n):\n    temp = input().strip()\n    if 'S' in temp:\n        s += temp\n    else:\n        sm += len(temp)\n        n -= 1\n\nfor i in range(m):\n    sm += ('S' not in s[i::m]) * n\n\nprint(sm)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "c731105a79e7221d30992613c753a165", "src_uid": "ebaf7d89c623d006a6f1ffd025892102", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\n\ndef gcd(x, y):\n    if(y == 0):\n        return x\n    return gcd(y,x%y)\n\nn = int(input())\nans = 0\nm = int(math.sqrt(n))\nfor a in range(1,m+1):\n    for b in range(a,m+1):\n        c = a*a+b*b\n        if(c > n):\n            break \n        if((b-a) % 2 == 0 or gcd(a,b) != 1):\n            continue\n        ans += n//c \nprint(ans)\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "6b6e265d4e28ed3112c1d910a995a617", "src_uid": "36a211f7814e77339eb81dc132e115e1", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\nn=int(input())\nres=0\nfor a in range(1,n):\n    for b in range(1,n):\n        c = math.sqrt(a*a+b*b)\n        if(int(c)==c and c<=n):\n            res+=1\nprint(res//2)", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "01aeaaef0c2c518eda275b1595498889", "src_uid": "36a211f7814e77339eb81dc132e115e1", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = raw_input()\nflag = 0\nfor x in range(len(a)):\n    if(a[x].lower() not in 'aeiou'):\n        if(a[x]!='n'):\n            if(x==len(a)-1):\n                print 'NO'\n                flag = 1\n                break\n            if(a[x+1].lower() not in 'aeiou'):\n                print 'NO'\n                flag = 1\n                break\nif(flag==0):\n    print 'YES'\n            \n    \n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "c619088f04ca0ff6812bee163a8e7b01", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def IsBerlanese():\n    s = raw_input()\n    vowels = 'aeiou'\n    i = 0\n    while i < len(s)-1:\n        if s[i] not in vowels and s[i] != 'n':\n            if s[i+1] not in vowels:\n                return 'NO'\n        i += 1\n    \n    if s[i] == 'n' or s[i] in vowels:\n        return 'YES'\n    else:\n        return 'NO'\nprint IsBerlanese()", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "d7c904c2f7f37c5da74998e8cd054007", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def t_in_sub(sub, t):\n    j = i = 0\n    while i<len(sub) and j<len(t):\n        if t[j] == sub[i]:\n            j+=1\n        i+=1\n    if j == len(t):\n        return True\n    return False\n\ns = input()\nt = input()\nmx = 0\nfor i in range(len(s)):\n    for j in range(i, len(s)):\n        sub = s[:i]+s[j+1:]\n        if t_in_sub(sub, t):\n            mx = max(mx, j-i+1)\nprint(mx)", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "6356bc74449b34c0f9b9eee87caa0a21", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def main():\n    s=input()\n    t=input()\n    def isSub(s,t):\n        k=0\n        for i in s:\n            if i==t[k]:\n                k+=1\n                if k== len(t) :\n                    return True\n        return False\n    r=0\n    for l in range(1,len(s)+1):\n        for i in range(len(s)-l+1):\n            new_s=s[:i]+s[i+l:]\n            if isSub(new_s,t): r=l ; continue\n    print(r)\nmain()", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "f326d56ba65b34500f136d1c940d853c", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# your code goes here\nn, m = map(int, input().split())\ns = input()\nl = []\nfor e in s:\n\tl.append(e)\n\t\nl.sort()\na = []\na.append(l[0])\ndel l[0]\nsu = ord(a[0])-ord('a')+1\nflag = 0\nwhile len(a) < m:\n\ti = 0\n\twhile ord(l[i])-ord('a')+1 < ord(a[-1])-ord('a')+3:\n\t\tif i == len(l)-1:\n\t\t\tprint(-1)\n\t\t\tflag = 1\n\t\t\tbreak\n\t\ti+=1\n\tif flag == 1:\n\t\tbreak\n\ta.append(l[i])\n\tdel l[i]\n\tsu += ord(a[-1])-ord('a')+1\nif not flag:\n\tprint(su)\n\n\t\n\t\t\n\n", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "df9ed0d7f375e023859aca287e9f6fd8", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\nimport random\n\n\ndef get(dtype=int):\n    return dtype(raw_input())\n\n\ndef array(dtype=int):\n    return [dtype(num) for num in raw_input().split()]\n\n\ndef solve_test_case():\n    n, k = array()\n    s = raw_input()\n    W = [ord(c) - ord('a') + 1 for c in s]\n\n    W.sort()\n\n    ans = [W[0]]\n    m = W[0]\n\n    i = 1\n    no_pos = False\n    # print W\n\n    while len(ans) < k and i < n:\n        if W[i] > m + 1:\n            m = W[i]\n            ans.append(m)\n        i += 1\n    if len(ans) < k:\n        print -1\n    else:\n        print sum(ans)\n\n\nn_test_cases = 1\n\nif n_test_cases == 0:\n    n_test_cases = get()\n\nfor i_test_case in range(n_test_cases):\n    solve_test_case()\n", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "b98bb0ac5869f364cbc3f3163346e5d5", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a=map(int,raw_input().split())\nb=[0]*3\nd=min(a)\nans=d\nfor i in range(3):\n    a[i]-=d\n    ans+=a[i]/3\n    b[i]=a[i]%3\nif b.count(2)==2 and b.count(0)==1 and d>0:\n    ans+=1\nprint ans", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "47b63d05465a5f14bdf76c93268469cb", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s = input()\narr = s.split(\" \")\n\nr = int(arr[0])\ng = int(arr[1])\nb = int(arr[2])\n\nans = r//3 + g//3 + b//3\n\nif r > 0 and g > 0 and b > 0:\n    temp = (r-1)//3 + (g-1)//3 + (b-1)//3 + 1\n    ans = max(ans,temp)\n\nif r > 1 and g > 1 and b > 1:\n    temp = (r-2)//3 + (g-2)//3 + (b-2)//3 + 2\n    ans = max(ans,temp)\n\n\nprint(ans)\n\n\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "838839f047258985e97be05eb35fdf15", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "\n# better approach. complexity: O(log(n))\ndef countzeros_vb(n):\n    count, c5 = 0, 5\n    while c5 <= n:\n        count += (n // c5)\n        c5 *= 5\n    return count\n\ndef main():\n    m = int(raw_input())\n    arr = []\n    for x in xrange(2000000):\n        if countzeros_vb(x) == m:\n            arr.append(x)\n    print len(arr)\n    print ' '.join(map(str, arr))\n\nmain()\n", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms", "number theory"], "code_uid": "e5597768f8c158b59a6525329410a9f9", "src_uid": "c27ecc6e4755b21f95a6b1b657ef0744", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import *\n\nN = 400020\nar = []\nfor i in range(0,N):\n\tx = 0\n\tb = 5\n\twhile b<=i:\n\t\tx += i//b\n\t\tb *= 5\n\tar.append(x)\n\nn = int(input())\n\nsol = [ i for i in range(0,N) if ar[i]==n ]\nprint(len(sol))\nprint(*sol)\n\n#  C:\\Users\\Usuario\\HOME2\\Programacion\\ACM", "lang_cluster": "Python", "tags": ["brute force", "math", "constructive algorithms", "number theory"], "code_uid": "baa99773321c750da3054ed6469efb4a", "src_uid": "c27ecc6e4755b21f95a6b1b657ef0744", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b = map(int, input().split())\nx = a - b\nx = str(x)\nwhile len(x) < len(str(a)):\n    x = '0' + x\npos = 0\nfor i in range(len(str(a)) - 1, -1, -1):\n    y = x\n    x = x[:i] + '9' + x[i + 1:]\n    if int(x) > a:\n        pos = i\n        break\nx = y\nfor i in range(pos + 1):\n    for j in range(10 - int(x[i])):\n        y = x\n        x = x[:i] + str(int(x[i]) + 1) + x[i + 1:]\n        if int(x) > a:\n            break\n    x = y\nprint(int(x))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "07e110f85017a020f3a4d8689f76e32e", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "pstr, d = input().split()\np, d = int(pstr), int(d)\nn = len(pstr)\n\nans = pstr\nmax9 = n - len(pstr.rstrip('9'))\nfor i in range(1, n):\n    pcur = p - int(pstr[-i:]) - 1\n    if p - pcur > d:\n        break\n\n    pcur_str = str(pcur)\n    nines = len(pcur_str) - len(pcur_str.rstrip('9'))\n    if nines > max9:\n        max9 = nines\n        ans = pcur\n\nprint(ans)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "62e77a13a3f337600db8cdfd772c06ef", "src_uid": "c706cfcd4c37fbc1b1631aeeb2c02b6a", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\nprint int(1.5*n)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "b89c3393659f53563a4043e5aa5f08e2", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=input();print int(1.5*n)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "263ae846e1eb46c22e97595cab6677d6", "src_uid": "031e53952e76cff8fdc0988bb0d3239c", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# -*- coding:utf-8 -*-\n#[n, m] = [int(x) for x in raw_input().split()]\n\ndef some_func():\n    \"\"\"\n    \"\"\"\n\n    n,k = [int(x) for x in raw_input().split()]\n    n_list = [int(x) for x in raw_input().split()]\n    cache_dic = {}\n    cost = 0\n\n\n    for i in range(0,k):\n        if i not in n_list:\n            cost+=1\n    if k in n_list:\n        cost+=1\n    return cost\n\n\n\nif __name__ == '__main__':\n    print some_func()\n\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "3d990bf99bc0ec2d527d6da00a1cec5f", "src_uid": "21f579ba807face432a7664091581cd8", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,x=map(int, input().split())\nl=list(map(int, input().split(' ')))\nnl=[i for i in range(0,max(max(l)+2,x)) if not( i in l )]\nif x in nl:\n    d=len([i for i in nl if i<x])\nelse:\n    if max(l)+2>x:\n        d=len([i for i in nl if i<x])+1\n    else:\n        d=len(nl)\nprint(d)\n    \n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "9c7a1ba9578c7570ce601cb8a019cf7f", "src_uid": "21f579ba807face432a7664091581cd8", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "h,m,i=map(int,raw_input().split(':'))+[0]\nwhile h/10!=m%10 or h%10!=m/10:\n    h,m,i=(h+(m==59))%24,(m+1)%60,i+1\nprint i", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "35632bdf1b440db7bbe4868e2f16e89d", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def ft(h, m):\n\tsh = str(h)\n\tif h < 10:\n\t\tsh = '0' + sh\n\tsm = str(m)\n\tif m < 10:\n\t\tsm = '0' + sm\n\treturn sh + ':' + sm\n\t\ndef inc(hm):\n\th = hm[0]\n\tm = hm[1]\n\tm = (m + 1) % 60\n\tif m == 0:\n\t\th = (h + 1) % 24\n\treturn (h, m)\n\t\nH = raw_input()\ns = 0\nwhile H != H[: : -1]:\n\thm = [int(H[: 2]), int(H[3: ])]\n\thm = inc(hm)\n\tH = ft(hm[0], hm[1])\n\ts += 1\n\t\nprint s", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "b479742ec8e91d1cc69a45cdd12d2e24", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "I=lambda:map(int, raw_input().split())\ns = raw_input()\nn = len(s)\n\nans, cnt = -1, 0\ndef is_ok(x):\n    if x == '': return False\n    y = int(x)\n    if (x[0] == '0' and len(x) != 1) or y > 10**6: return False\n    return True\n \nfor i in xrange(0, 7):\n    if is_ok(s[0:i+1]): \n        x =  int(s[0:i+1])\n        for j in xrange(i+1, i+8):\n            if is_ok(s[i+1:j+1]) and is_ok(s[j+1:]):\n                y = int(s[i+1:j+1])\n                cnt = int(s[j+1:]) + x + y\n                ans = max(ans, cnt)\nprint ans", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "865e5634ba1aa78e9b236bfc83fd812d", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "s = raw_input()\nl = len(s)\n\n\ndef good(a):\n    if a == '0':\n        return True\n    if a[0] == '0':\n        return False\n    if len(a) > 7:\n        return False\n    return 0 <= int(a) <= 10 ** 6\n\nres = -1\nfor i in xrange(1, l):\n    for j in xrange(i+1, l):\n        a = s[:i]\n        b = s[i:j]\n        c = s[j:]\n        if good(a) and good(b) and good(c):\n            res = max(res, int(a) + int(b) + int(c))\nprint res\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "9d4e7ef4677889c68b56dfb44195b289", "src_uid": "bf4e72636bd1998ad3d034ad72e63097", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "f = input()\nm = input()\ns = input()\ndiction = dict()\ndiction2 = dict()\n\ndiction[\"F\"] = f\ndiction[\"M\"] = m\ndiction[\"S\"] = s\n\nfor value in diction.values():\n    diction2[value] = diction2.get(value, 0) + 1\n\n\nif f == m and f == s:\n    print(\"?\")\nelif f != m and f != s and m != s:\n    print(\"?\")\nelse:\n    if \"scissors\" not in diction.values():\n        if diction2[\"paper\"] > 1:\n            print(\"?\")\n        else:\n            for val in diction:\n                if diction[val] == \"paper\":\n                    print(val)\n    elif \"paper\" not in diction.values():\n        if diction2[\"rock\"] > 1:\n            print(\"?\")\n        else:\n            for val in diction:\n                if diction[val] == \"rock\":\n                    print(val)\n    elif \"rock\" not in diction.values():\n        if diction2[\"scissors\"] > 1:\n            print(\"?\")\n        else:\n            for val in diction:\n                if diction[val] == \"scissors\":\n                    print(val)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b943d2460fc22a71a2c9afde4079f863", "src_uid": "072c7d29a1b338609a72ab6b73988282", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a=input()\nb=input()\nc=input()\ndic={a:\"F\",b:\"M\",c:\"S\"}\nif(a==b and a!=c):\n    if(a==\"paper\"and c==\"scissors\"):\n        print(dic[c])\n    elif(c==\"paper\" and a==\"rock\"):\n        print(dic[c])\n    elif(a==\"scissors\" and c==\"rock\"):\n        print(dic[c])\n    else:\n        print(\"?\")\nelif(b==c and a!=c):\n    if(b==\"paper\"and a==\"scissors\"):\n        print(dic[a])\n    elif(a==\"paper\" and b==\"rock\"):\n        print(dic[a])\n    elif(c==\"scissors\" and a==\"rock\"):\n        print(dic[a])\n    else:\n        print(\"?\")\nelif(a==c and b!=c):\n    if(a==\"paper\"and b==\"scissors\"):\n        print(dic[b])\n    elif(b==\"paper\" and c==\"rock\"):\n        print(dic[b])\n    elif(a==\"scissors\" and b==\"rock\"):\n        print(dic[b])\n    else:\n        print(\"?\")\nelse:\n    print(\"?\")\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "65cc91a69942a4de974a020d512a13a0", "src_uid": "072c7d29a1b338609a72ab6b73988282", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "X=int(input())\r\nrating=[1200,1400,1600,1900,2100,2300,2400,2600,3000]\r\nhigher=[x for x in rating if x>X]\r\nprint(higher[0])", "lang_cluster": "Python", "tags": ["math", "divide and conquer", "implementation"], "code_uid": "af6d0bbb30a2306a07721978f334e1a6", "src_uid": "22725effa6dc68b9c2a499d148e613c2", "difficulty": -1.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "r = int(input()) \r\nif r < 1200:\r\n    print(1200)\r\nelif r < 1400:\r\n    print(1400)\r\nelif r < 1600:\r\n    print(1600)\r\nelif r < 1900:\r\n    print(1900)\r\nelif r < 2100:\r\n    print(2100)\r\nelif r < 2300:\r\n    print(2300)\r\nelif r < 2400:\r\n    print(2400)\r\nelif r < 2600:\r\n    print(2600)\r\nelse:\r\n    print(3000)", "lang_cluster": "Python", "tags": ["math", "divide and conquer", "implementation"], "code_uid": "a6f19f83a46e57e4281a66524100f101", "src_uid": "22725effa6dc68b9c2a499d148e613c2", "difficulty": -1.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "c = '0123456789'\nF = {c[a] + c[b]: (c[10 - a + b], 1) if a > b else (c[10 - a], 2) for a in range(1, 10) for b in range(10)}\nfor b in range(1, 10): F['0' + c[b]] = ('0', 1)\nF['00'] = ('0', 0)\n\ndef f(x):\n    global F\n    if x in F: return F[x]\n    a, b, y, s = int(x[0]), int(x[1]), x[2: ], 0\n    for i in range(b, a, -1):\n        y, d = f(c[i] + y)\n        s += d\n    for i in range(min(a, b) + 1):\n        y, d = f(x[0] + y)\n        s += d\n    F[x] = ('9' + y, s)\n    return F[x]\n\nprint(f('0' + raw_input())[1]) ", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "1f3f02e0a1546e44b7c6a5a4ddfff307", "src_uid": "fc5765b9bd18dc7555fa76e91530c036", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, count = int(input()), 0\nwhile n > 0:\n\tnList = [int(i) for i in str(n)]\n\tn -= max(nList)\n\tcount += 1\n\nprint(count)\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "c44ac502618e79ebcb5e42ff8a580e24", "src_uid": "fc5765b9bd18dc7555fa76e91530c036", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nk=1\nfor i in range(1,n):\n    k=k*i\nk=k*2\nk=k/n\nprint(int(k))", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "b261be3cbe7e00e59f6efd7532f6773e", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import factorial\n\nn=int(input())\n\nans=factorial(n)//(factorial(n//2)**2)\nans*=factorial(n//2-1)**2\nans//=2\n\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "f493fdd318cd0626cb3e8aeedb2cb692", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "n = int(input())\r\nans = []\r\n\r\nfor i in range(n):\r\n    sms = int(input())\r\n    ans.append((2**sms) - 1)\r\n\r\nfor j in ans:\r\n    print(j)\r\n    \r\n\r\n\r\n        \r\n            \r\n        \r\n    \r\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "8a6271de87fd3907c529a9c8010d796e", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "t = int(input())\r\nfor _ in range(t):\r\n  n = int(input())\r\n  print((2 ** n) - 1)\r\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "49d3cfbea6c975b16bda2786768391c5", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#  L R L R L R L R L R L R\n# 0 1 2 2 1 0 0 1 2 2 1 0 ...\n# 1 0 0 1 2 2 1 0 0 1 2 2 ...\n# 2 2 1 0 0 1 2 2 1 0 0 1 ...\n\n\n\ndef main():\n    n = int(input())\n    x = int(input())\n\n    patterns = [ [0, 1, 2, 2, 1, 0], [1, 0, 0, 1, 2, 2], [2, 2, 1, 0, 0, 1] ]\n\n    n %= 6\n    for i, pattern in enumerate(patterns):\n        if pattern[n] == x:\n            print(i)\n\nmain()\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "e1844c704811d4602f613567f22e2a89", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "list = [[0, 1, 2], [1, 0, 2], [1, 2, 0], [2, 1, 0], [2, 0, 1], [0, 2, 1]]\nprint(list[int(input()) % 6][int(input())])", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "e5146910650caea481b2f0aa7a461f20", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#!/usr/bin/env python3\n\ndef main():\n    try:\n        while True:\n            s = input()\n            a = set()\n            for i in range(len(s)):\n                a.add(s)\n                s = s[1:] + s[0]\n\n            print(len(a))\n\n    except EOFError:\n        pass\n\nmain()\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "a273c2c4210f17cbc62066daba8c9880", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input()\na = []\nfor i in range(100):\n    a.append(s)\n    s = s[1:] + s[0]\nprint len(set(a))", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "3c1bbcfd97b589a4c125751904f89691", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#code\n#print(\"GfG\")\ndef func(num):\n    num=int(num)\n    num=num*num*num*num*num\n    num=str(num)\n    l=len(num)\n    s= num[l-5] + num[l-4] + num[l-3] + num[l-2] + num[l-1]\n    print(s)\n\na=input()\nn1=a[0]\nn2=a[1]\nn3=a[2]\nn4=a[3]\nn5=a[4]\nnum=\"\"+n1+n3+n5+n4+n2\nfunc(num)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "298da0d2d6f2b5649dcb44991d3c3625", "src_uid": "51b1c216948663fff721c28d131bf18f", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "num = raw_input()\n\nstringNum = num[0] + num[2] + num[4] + num[3] + num[1]\n\nintNum = int(stringNum)\nintNum = intNum ** 5\n\nstringNum = str(intNum)\n\nprint stringNum[len(stringNum) - 5] + stringNum[len(stringNum) - 4] + stringNum[len(stringNum) - 3] + stringNum[len(stringNum) - 2] + stringNum[len(stringNum) - 1]\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "118002be66ad64d31dc63b977e01f195", "src_uid": "51b1c216948663fff721c28d131bf18f", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "x, y = [int(x) for x in input().split()]\nn = int(input())\ntmp = 0\nif n % 6 == 1:\n    tmp = x\nelif n % 6 == 2:\n    tmp = y\nelif n % 6 == 3:\n    tmp = y - x\nelif n % 6 == 4:\n    tmp = -x\nelif n % 6 == 5:\n    tmp = -y\nelif n % 6 == 0:\n    tmp = -y + x\nprint(tmp % (10**9 + 7))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "9f0ce27bb9d60e1d19e9754beb8229f0", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x,y = map(int,raw_input().split())\nn = input()\nm = (10**9) + 7\n\nif n == 1:\n\tprint x%m\nelif n == 2:\n\tprint y%m\nelse:\n\tt = n / 3\n\tu = n % 3\n\tif t&1:\n\t\tif u == 0:\n\t\t\tprint (y - x) % m \n\t\telif u == 1:\n\t\t\tprint -x%m\n\t\telse:\t\n\t\t\tprint -y % m\n\telse:\n\t\tif u == 0:\n\t\t\tprint (x - y)%m\n\t\telif u == 1:\n\t\t\tprint x%m\n\t\telse:\t\n\t\t\tprint y%m", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "4c9b59a7b331a2d83247caa245feaba3", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,k = map(int,raw_input().split())\nif k==1:\n    print n\nelse:\n    x = str(bin(n))\n    x = x[2:]\n    ans = len(x)\n    print 2**ans-1", "lang_cluster": "Python", "tags": ["constructive algorithms", "number theory", "bitmasks"], "code_uid": "8ead54f20700c036fa4c194730f7b51e", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nlog2=lambda x:math.log(x)/math.log(2)\nn,k=map(int,input().split())\nm=2**int(log2(n))\nres=0\nans=m^(m-1)\nif k >= 2:\n    print(n if ans >2*n else ans)\nelse:\n    print(n)", "lang_cluster": "Python", "tags": ["constructive algorithms", "number theory", "bitmasks"], "code_uid": "94e0c39ff2bf65bee371457a233d0446", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\ndef val(line):\n    vals = []\n    l = ''\n    for i in line:\n        if i == ' ':\n            vals.append(l)\n            l = ''\n        else:\n            l += i\n    vals.append(l)\n    return vals\n\ndata = input()\nn,m = map(int,val(data))\nresult = n + int((n-1)/(m-1))\nprint(result)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "f823797306bf57ad7a6030434fb52e6c", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s=map(int,raw_input().split())\nn=s[0]\nm=s[1]\nrest=n+n/m\npre=n+n/m\nwhile n+rest/m!=pre:\n    rest=n+rest/m\n    pre=rest\nprint rest\n", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "47f36ca86b36c40d9ca3f468e7adcf9a", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "hundred, ten = [int(x) for x in input().split()]\ntotal = 100*hundred + 10*ten\n\n#reduce by number of rounds where Ciel can take 2 100-yen and 2 10-yen, and Hanako can take 22 10-yen\nskipped = min(hundred//2,ten//24)\nhundred = hundred - 2*skipped\nten = ten - 24*skipped\n\nwhile True:\n    win = 0\n    if hundred >= 2 and ten >= 2:\n        hundred = hundred - 2\n        ten = ten - 2\n    elif hundred >= 1 and ten >= 12:\n        hundred = hundred - 1\n        ten = ten - 12\n    elif ten >= 22:\n        ten = ten - 22\n    else:\n        break\n    win = 1\n    if ten >= 22:\n        ten = ten - 22\n    elif hundred >= 1 and ten >= 12:\n        hundred = hundred - 1\n        ten = ten - 12\n    elif hundred >= 2 and ten >= 2:\n        hundred = hundred - 2\n        ten = ten - 2\n    else:\n        break\nif win == 0:\n    print (\"Hanako\")\nelse:\n    print (\"Ciel\")\n    \n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "b1b30ea835c80b36181dc702e1a115cd", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "x, y = map(int, raw_input().split())\n\nwhile 1:\n    # Ciel\n    if x > 1:\n        if y > 1:\n            x -= 2\n            y -= 2\n        else:\n            print \"Hanako\"\n            break\n    elif x == 1:\n        if y > 11:\n            x = 0\n            y -= 12\n        else:\n            print \"Hanako\"\n            break\n    else:\n        if y > 21:\n            y -= 22\n        else:\n            print \"Hanako\"\n            break\n    # Hanako\n    if y > 21:\n        y -= 22\n    elif y > 11:\n        if x > 0:\n            x -= 1\n            y -= 12\n        else:\n            print \"Ciel\"\n            break\n    elif y > 1:\n        if x > 1:\n            x -= 2\n            y -= 2\n        else:\n            print \"Ciel\"\n            break\n    else:\n        print \"Ciel\"\n        break\n\n\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "fe77cea67a38da8abe1786587d2ef7e1", "src_uid": "8ffee18bbc4bb281027f91193002b7f5", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def dominoes(m,n,k):   \r\n    fillcols=(int(k/m))*2\r\n    leftcols=n-fillcols\r\n    leftdoms=k%m\r\n    if k*2>m*n:\r\n        print('NO')\r\n    else:\r\n        if leftdoms==0:\r\n            if m%2==0:\r\n                print('YES')\r\n            elif m*n==k*2:\r\n                print('YES')\r\n            else:\r\n                if leftcols%2==0:\r\n                    stacks=int(leftcols/2)\r\n                    if stacks%2==0:\r\n                        fillstacks=int(fillcols/2)\r\n                        extradoms=fillstacks*(m-1)\r\n                        if extradoms>=stacks:\r\n                            print('YES')\r\n                        else:\r\n                            print('NO')\r\n                    else: \r\n                        print('NO')\r\n                else:\r\n                    print('NO')\r\n        else:\r\n            if leftdoms%2==0:\r\n                if m%2==0:\r\n                    if leftcols>=2:\r\n                        print('YES')\r\n                    else:\r\n                        print('NO')\r\n                else:                   \r\n                    spread=leftdoms-1\r\n                    if leftcols%2==0 and leftcols>2:\r\n                        stacks=int((leftcols-2)/2)\r\n                        if stacks%2!=0:\r\n                            if spread>=stacks:\r\n                                print('YES')\r\n                            else:  \r\n                                fillstacks=int(fillcols/2)\r\n                                extradoms=fillstacks*(m-1)\r\n                                if extradoms>=(stacks-spread):\r\n                                    print('YES')\r\n                                else:\r\n                                    print('NO')\r\n                        else: \r\n                            print('NO')\r\n                    else:\r\n                        print('NO')\r\n            else:\r\n                if m%2==0:\r\n                    print('NO')\r\n                else:\r\n                    spread=leftdoms-1\r\n                    if leftcols%2==0 and leftcols>2:\r\n                        stacks=int((leftcols-2)/2)\r\n                        if  stacks%2==0:\r\n                            if spread>=stacks:\r\n                                print('YES')\r\n                            else: \r\n                                if (stacks-spread)%2==0:\r\n                                    fillstacks=int(fillcols/2)\r\n                                    extradoms=fillstacks*(m-1)\r\n                                    if extradoms>=(stacks-spread):\r\n                                        print('YES')\r\n                                    else:\r\n                                        print('NO')\r\n                                else:\r\n                                    print('NO')\r\n                        else: \r\n                            print('NO')\r\n                    else:\r\n                        if leftcols==2:\r\n                            print('YES')\r\n                        else:\r\n                            print('NO')\r\n\r\nx=int(input())\r\nfor i in range(x):\r\n    m,n,k=map(int,input().split())\r\n    dominoes(m,n,k)\r\n\r\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "287dea8398d5e1a97f03fc5914ca8133", "src_uid": "4d0c0cc8faca62eb6384f8135b30feb8", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "t = int(input())\r\nfor _ in range(t):\r\n    n,m,k = map(int,input().strip().split())\r\n    if k%2 == 0:\r\n        if n%2 == 0:\r\n            if (n*m-n)/2 < k and m&1:\r\n                print('NO')\r\n            else:\r\n                print('YES')\r\n        else:\r\n            if k >= m/2 and (k-m//2) % 2 == 0:\r\n                print('YES')\r\n            else:\r\n                print('NO')\r\n    else:\r\n        if n%2 == 0:\r\n            print('NO')\r\n        else:\r\n            if k >= m/2 and (k-m//2) % 2 == 0:\r\n                print('YES')\r\n            else:\r\n                print('NO')", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "2cfa5adda1814fe49eca7fca48aeb87c", "src_uid": "4d0c0cc8faca62eb6384f8135b30feb8", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "pairs = []\nfor i in range (8):\n  tmp = list (map (int, input().split()))\n  pairs.append (tmp)\npairs.sort ()\n\ndef judge ():\n  return (pairs[0][0] < pairs[3][0] < pairs[5][0] and\n          pairs[0][1] < pairs[1][1] < pairs[2][1] and\n          pairs[0][0] == pairs[1][0] == pairs[2][0] and\n          pairs[3][0] == pairs[4][0] and\n          pairs[5][0] == pairs[6][0] == pairs[7][0] and\n          pairs[0][1] == pairs[5][1] and\n          pairs[1][1] == pairs[6][1] and\n          pairs[2][1] == pairs[7][1] and\n          pairs[0][1] == pairs[3][1] and\n          pairs[2][1] == pairs[4][1])\n\nif judge ():\n  print ('respectable')\nelse:\n  print ('ugly')\n", "lang_cluster": "Python", "tags": ["sortings"], "code_uid": "dae6d6e41bc2c3062a445566c056ffbf", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "I=lambda:map(int, raw_input().split())\nx,y=set(),set()\nz = set()\nfor _ in xrange(8):\n    xi, yi = I()\n    x.add(xi)\n    y.add(yi)\n    z.add((xi,yi))\n    \nif len(x) != 3 or len(y) != 3 or len(z) != 8: print 'ugly'; exit()\na, b = sorted(list(x))[1], sorted(list(y))[1]\n\nif (a,b) in z: print 'ugly'; exit()\nprint 'respectable'\n", "lang_cluster": "Python", "tags": ["sortings"], "code_uid": "838ea862aba1e7277cd307b3922ab976", "src_uid": "f3c96123334534056f26b96f90886807", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "l1=list(str(input()))\nl2=list(str(input()))\nn=len(l1)\ncount=0\nfor i in range(n-1):\n    if l1[i]=='0' and l1[i+1]=='0':\n        if l2[i]=='0':\n            l1[i],l1[i+1],l2[i]='X','X','X'\n            count+=1\n        elif l2[i+1]=='0':\n            l1[i],l1[i+1],l2[i+1]='X','X','X'\n            count+=1\n    if l2[i]=='0' and l2[i+1]=='0':\n        if l1[i]=='0':\n            l2[i],l2[i+1],l1[i]='X','X','X'\n            count+=1\n        elif l1[i+1]=='0':\n            l2[i],l2[i+1],l1[i+1]='X','X','X'\n            count+=1\nprint(count)", "lang_cluster": "Python", "tags": ["greedy", "dp"], "code_uid": "68419d023e38d54e4e1f8fd04ba1c3c9", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "arr1=input()\narr2=input()\ndef replace(arr,index,element):\n    for i in range(len(arr)):\n        if i==index:\n            arr[i]=element\n        else:\n            continue\n    return arr\narr1=list(arr1)\narr2=list(arr2)\nc=0\nfor i in range(len(arr1)-1):\n    if arr1[i]==\"0\" and arr2[i]==\"0\" and arr2[i+1]==\"0\":\n        c+=1\n        arr1=replace(arr1,i,\"X\")\n        arr2=replace(arr2,i, \"X\")\n        arr2=replace(arr2,i+1, \"X\")\n    elif arr1[i]==\"0\" and arr1[i+1]==\"0\" and arr2[i+1]==\"0\":\n        c+=1\n        arr1=replace(arr1,i, \"X\")\n        arr1=replace(arr1,i+1, \"X\")\n        arr2=replace(arr2,i + 1, \"X\")\n    elif arr1[i]==\"0\" and arr1[i+1]==\"0\" and arr2[i]==\"0\":\n        c+=1\n        arr1=replace(arr1,i, \"X\")\n        arr1=replace(arr1,i+1, \"X\")\n        arr2=replace(arr2,i, \"X\")\n    elif arr1[i+1]==\"0\" and arr2[i+1]==\"0\" and arr2[i]==\"0\":\n        c+=1\n        arr1=replace(arr1,i+1, \"X\")\n        arr2=replace(arr2,i+1, \"X\")\n        arr2=replace(arr2,i, \"X\")\nprint(c)\n\n\n", "lang_cluster": "Python", "tags": ["greedy", "dp"], "code_uid": "45e616896983753fce494c3763f78a63", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#------------------------------warmup----------------------------\nimport os\nimport sys\nimport math\nfrom io import BytesIO, IOBase\n \nBUFSIZE = 8192\n \n \nclass FastIO(IOBase):\n    newlines = 0\n \n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n \n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n \n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n \n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\n \n \nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n \n \nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n \n#-------------------game starts now----------------------------------------------------\ndef doi(it,l,t):\n    for i in range(len(l)):\n        if l[i][t]==it:\n            print(l[i][0],l[i][1])\n            return\nn=int(input())\nd=dict()\nd1=dict()\nm=0\nm1=0\nmi=99999999999999999999\nmi1=99999999999999999999\nl=[]\nfor i in range(4*n+1):\n    a,b=map(int,input().split())\n    l.append([a,b])\n    m=max(a,m)\n    mi=min(mi,a)\n    m1=max(b,m1)\n    mi1=min(mi1,b)\n    if a in d:\n        d[a]+=1\n    else:\n        d.update({a:1})\n    if b in d1: \n        d1[b]+=1\n    else:\n        d1.update({b:1})\nif d[m]==1:\n    doi(m,l,0)\nelif d[mi]==1:\n    doi(mi,l,0)\nelif d1[mi1]==1:\n    doi(mi1,l,1)\nelif d1[m1]==1:\n    doi(m1,l,1)\nelse:\n    x1=m\n    x2=mi\n    y1=m1\n    y2=mi1 \n    for i in range(len(l)):\n        if l[i][0]==x1 and y2<=l[i][1]<=y1:\n            continue\n        elif l[i][0]==x2 and y2<=l[i][1]<=y1:\n            continue\n        elif l[i][1]==y1 and x2<=l[i][0]<=x1:\n            continue\n        elif l[i][1]==y2 and x2<=l[i][0]<=x1:\n            continue\n        else:\n            print(l[i][0],l[i][1])\n            break", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "cdff1fa5e7acfc1e257ceb848577eb2f", "src_uid": "1f9153088dcba9383b1a2dbe592e4d06", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#    !/usr/bin/env python3\n#    encoding: UTF-8\n#    Modified: <07/Jul/2019 05:27:38 PM>\n\n\n#    \u272a H4WK3yE\u4e61\n#    Mohd. Farhan Tahir\n#    Indian Institute Of Information Technology (IIIT), Gwalior\n\n\nimport sys\nimport os\nfrom io import IOBase, BytesIO\n\n\ndef main():\n    n = int(input())\n    points = [0] * (4 * n + 1)\n    for i in range(4 * n + 1):\n        a, b = get_ints()\n        points[i] = (a, b)\n\n    l = 4 * n + 1\n    for i in range(l):\n        mnx, mxx, mny, mxy = 51, -1, 51, -1\n        for j in range(l):\n            if i == j:\n                continue\n            x = points[j][0]\n            y = points[j][1]\n            mnx = min(mnx, x)\n            mxx = max(mxx, x)\n            mny = min(mny, y)\n            mxy = max(mxy, y)\n\n        flag = True\n        for j in range(l):\n            if i == j:\n                continue\n            x = points[j][0]\n            y = points[j][1]\n            if x != mnx and x != mxx and y != mny and y != mxy:\n                flag = False\n\n        if flag == True and mxx - mnx == mxy - mny:\n            print(points[i][0], points[i][1])\n            return\n\n\nBUFSIZE = 8192\n\n\nclass FastIO(BytesIO):\n    newlines = 0\n\n    def __init__(self, file):\n        self._file = file\n        self._fd = file.fileno()\n        self.writable = \"x\" in file.mode or \"w\" in file.mode\n        self.write = super(FastIO, self).write if self.writable else None\n\n    def _fill(self):\n        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])\n        return s\n\n    def read(self):\n        while self._fill():\n            pass\n        return super(FastIO, self).read()\n\n    def readline(self):\n        while self.newlines == 0:\n            s = self._fill()\n            self.newlines = s.count(b\"\\n\") + (not s)\n        self.newlines -= 1\n        return super(FastIO, self).readline()\n\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.getvalue())\n            self.truncate(0), self.seek(0)\n\n\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        py2 = round(0.5)\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        if py2 == 1:\n            self.write = self.buffer.write\n            self.read = self.buffer.read\n            self.readline = self.buffer.readline\n        else:\n            self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n            self.read = lambda: self.buffer.read().decode(\"ascii\")\n            self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n\n\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\n\n\ndef get_array(): return list(map(int, sys.stdin.readline().split()))\n\n\ndef get_ints(): return map(int, sys.stdin.readline().split())\n\n\ndef input(): return sys.stdin.readline().strip()\n\n\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "9572c518566f0692c1e924fde4f9a075", "src_uid": "1f9153088dcba9383b1a2dbe592e4d06", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "pieces=''\nresult=0\nfor i in range(8):\n    pieces+=input()\nweight=dict(zip(list('QRBNPqrbnp.Kk'),[9,5,3,3,1,-9,-5,-3,-3,-1,0,0,0]))\nfor s in pieces:\n    result+=weight[s]\nif result>0:\n    print('White')\nelif result==0:\n    print('Draw')\nelse:\n    print('Black')", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b28fe6c6053fb7f2e23ddf8a065070d5", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\n# sys.stdin = open('test.txt', 'r')\n\nw = 0\nb = 0\n\nwhile True:\n    try:\n        s = raw_input()\n        \n        w += sum([9 for i in s if i is 'Q'])\n        w += sum([5 for i in s if i is 'R'])\n        w += sum([3 for i in s if i is 'B'])\n        w += sum([3 for i in s if i is 'N'])\n        w += sum([1 for i in s if i is 'P'])\n    \n        b += sum([9 for i in s if i is 'q'])\n        b += sum([5 for i in s if i is 'r'])\n        b += sum([3 for i in s if i is 'b'])\n        b += sum([3 for i in s if i is 'n'])\n        b += sum([1 for i in s if i is 'p'])\n\n    except:\n        break\n        \n        \nif w>b:\n    print 'White'\nelif w==b:\n    print 'Draw'\nelif w<b:\n    print 'Black'", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "26f3ba7165aa503df29c3d8c4093180f", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "colors = list(map(int, input().split()))\n\nfaces = {}\nfaces['top'] = colors[:4]\nfaces['front'] = colors[4:8]\nfaces['bottom'] = colors[8:12]\nfaces['left'] = colors[12:16]\nfaces['right'] = colors[16:20]\nfaces['back'] = [colors[21], colors[20], colors[23], colors[22]]\n\nstatus = {}\nfor face in faces.keys():\n\tcolors = faces[face]\n\tif max(colors) == min(colors):\n\t\tstatus[face] = 'ok'\n\telse:\n\t\tif colors[0] == colors[1] and colors[2] == colors[3]:\n\t\t\tstatus[face] = 'h'\n\t\telif colors[0] == colors[2] and colors[1] == colors[3]:\n\t\t\tstatus[face] = 'v'\n\t\telse:\n\t\t\tstatus[face] = 'bad'\n\n# print(status)\n# print(faces)\n\nif 'bad' in status.values():\n\tprint('NO')\nelse:\n\tif status['top'] == status['bottom'] == 'ok' and status['front'] == status['left'] == status['right'] == status['back'] == 'h':\n\t\tif (faces['front'][0] == faces['left'][3] and\n\t\t\tfaces['left'][0] == faces['back'][3] and\n\t\t\tfaces['back'][0] == faces['right'][3] and\n\t\t\tfaces['right'][0] == faces['front'][3] \n\t\t\tor\n\t\t\tfaces['front'][0] == faces['right'][3] and\n\t\t\tfaces['right'][0] == faces['back'][3] and\n\t\t\tfaces['back'][0] == faces['left'][3] and\n\t\t\tfaces['left'][0] == faces['front'][3]):\n\t\t\tprint('YES')\n\t\telse:\n\t\t\tprint('NO')\n\telif status['left'] == status['right'] == 'ok' and status['front'] == status['top'] == status['bottom'] == status['back'] == 'v':\n\t\tif (faces['front'][0] == faces['top'][3] and\n\t\t\tfaces['top'][0] == faces['back'][3] and\n\t\t\tfaces['back'][0] == faces['bottom'][3] and\n\t\t\tfaces['bottom'][0] == faces['front'][3] \n\t\t\tor\n\t\t\tfaces['front'][0] == faces['bottom'][3] and\n\t\t\tfaces['bottom'][0] == faces['back'][3] and\n\t\t\tfaces['back'][0] == faces['top'][3] and\n\t\t\tfaces['top'][0] == faces['front'][3]):\n\t\t\tprint('YES')\n\t\telse:\n\t\t\tprint('NO')\n\telif status['front'] == status['back'] == 'ok' and status['left'] == status['right'] == 'v' and status['top'] == status['bottom'] == 'h':\n\t\tif (faces['top'][0] == faces['left'][1] and\n\t\t\tfaces['left'][0] == faces['bottom'][0] and\n\t\t\tfaces['bottom'][3] == faces['right'][0] and\n\t\t\tfaces['right'][3] == faces['top'][3] \n\t\t\tor\n\t\t\tfaces['top'][0] == faces['right'][0] and\n\t\t\tfaces['right'][1] == faces['bottom'][0] and\n\t\t\tfaces['bottom'][3] == faces['left'][1] and\n\t\t\tfaces['left'][0] == faces['top'][3]):\n\t\t\tprint('YES')\n\t\telse:\n\t\t\tprint('NO')\n\telse:\n\t\tprint('NO')\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "ff066f5e8ea26ea144d61dcd90795dec", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "cube = [-1] + list(map(int, input().split()))\n\ndef ok(cube):\n    counter = 0\n    last = cube[1]\n    for i in cube:\n        if i == -1:\n            continue\n        elif last == i:\n            counter+=1\n        else:\n            if counter != 4:\n                return False\n            else:\n                counter = 1\n                last = i\n    return True\n\ndef rotl(cube):\n    cube_n = cube[:]\n    cube_n[1] = cube[3]\n    cube_n[2] = cube[1]\n    cube_n[3] = cube[4]\n    cube_n[4] = cube[2]\n    cube_n[5] = cube[17]\n    cube_n[6] = cube[18]\n    cube_n[17] = cube[21]\n    cube_n[18] = cube[22]\n    cube_n[21] = cube[13]\n    cube_n[22] = cube[14]\n    cube_n[13] = cube[5]\n    cube_n[14] = cube[6]\n    return cube_n\n\ndef rotr(cube):\n    cube_n = cube[:]\n    cube_n[1] = cube[2]\n    cube_n[2] = cube[4]\n    cube_n[3] = cube[1]\n    cube_n[4] = cube[3]\n    cube_n[5] = cube[13]\n    cube_n[6] = cube[14]\n    cube_n[17] = cube[5]\n    cube_n[18] = cube[6]\n    cube_n[21] = cube[17]\n    cube_n[22] = cube[18]\n    cube_n[13] = cube[21]\n    cube_n[14] = cube[22]\n    return cube_n\n\ndef next(cube):\n    cube_n = cube[:]\n    cube_n[1] = cube[5]\n    cube_n[2] = cube[6]\n    cube_n[3] = cube[7]\n    cube_n[4] = cube[8]\n    cube_n[5] = cube[9]\n    cube_n[6] = cube[10]\n    cube_n[7] = cube[11]\n    cube_n[8] = cube[12]\n    cube_n[9] = cube[24]\n    cube_n[10] = cube[23]\n    cube_n[11] = cube[22]\n    cube_n[12] = cube[21]\n    cube_n[13] = cube[14]\n    cube_n[14] = cube[16]\n    cube_n[15] = cube[13]\n    cube_n[16] = cube[15]\n    cube_n[17] = cube[19]\n    cube_n[18] = cube[17]\n    cube_n[19] = cube[20]\n    cube_n[20] = cube[18]\n    cube_n[21] = cube[4]\n    cube_n[22] = cube[3]\n    cube_n[23] = cube[2]\n    cube_n[24] = cube[1]\n    return cube_n\n\ndef next2(cube):\n    cube_n = cube[:]\n    cube_n[1] = cube[3]\n    cube_n[2] = cube[1]\n    cube_n[3] = cube[4]\n    cube_n[4] = cube[2]\n    cube_n[5] = cube[17]\n    cube_n[6] = cube[18]\n    cube_n[7] = cube[19]\n    cube_n[8] = cube[20]\n    cube_n[9] = cube[10]\n    cube_n[10] = cube[12]\n    cube_n[11] = cube[9]\n    cube_n[12] = cube[11]\n    cube_n[13] = cube[5]\n    cube_n[14] = cube[6]\n    cube_n[15] = cube[7]\n    cube_n[16] = cube[8]\n    cube_n[17] = cube[21]\n    cube_n[18] = cube[22]\n    cube_n[19] = cube[23]\n    cube_n[20] = cube[24]\n    cube_n[21] = cube[13]\n    cube_n[22] = cube[14]\n    cube_n[23] = cube[15]\n    cube_n[24] = cube[16]\n    return cube_n\n\n\ndef main(cube):\n    return ok(rotl(cube)) or ok(rotr(cube))\n\n\nfor i in range(4):\n    cube = next(cube)\n    if main(next(cube)):\n        print(\"YES\")\n        exit()\nfor i in range(4):\n    cube = next2(cube)\n    if main(next(cube)):\n        print(\"YES\")\n        exit()\nprint(\"NO\")\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "9d64b97a89ed6975b24992c1002821c9", "src_uid": "881a820aa8184d9553278a0002a3b7c4", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "dt = {0 : 6, 1 : 2, 2 : 5, 3 : 5, 4 : 4, 5 : 5, 6 : 6, 7 : 3, 8 : 7, 9 : 6}\na, b = map(int, input().split())\nprint( sum( sum( dt[ int(ni) ] for ni in str(n) ) for n in range(a, b + 1) ) )\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b275e529a6abea67e8c1573592cb8602", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "digits = {\n    0:6,\n    1:2,\n    2:5,\n    3:5,\n    4:4,\n    5:5,\n    6:6,\n    7:3,\n    8:7,\n    9:6\n}\n\ndef count(d):\n    v = d\n    count = 0\n    while v!=0:\n        count += digits[v%10]\n        v = v//10\n    return count\ndef main():\n    s,e = [int(v) for v in input().split()]\n    total = 0\n    for i in range(s, e+1):\n        total+=count(i)\n    print(total)\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "47d338b132e1bd74e11e3cbb76ff7e99", "src_uid": "1193de6f80a9feee8522a404d16425b9", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "x,y = (int(i) for i in raw_input().split(\" \"))\nu,v = (int(i) for i in raw_input().split(\" \"))\nw,z = (int(i) for i in raw_input().split(\" \"))\n\nxs = sorted([x,u,w])\nys = sorted([y,v,z])\n\nmx = 0\nif xs[0] == xs[1] or xs[1] == xs[2]:\n    if xs[0] == xs[1] and xs[1] == xs[2]:\n        mx = 2\n    else:\n        mx = 1\n\nmy = 0\nif ys[0] == ys[1] or ys[1] == ys[2]:\n    if ys[0] == ys[1] and ys[1] == ys[2]:\n        my = 2\n    else:\n        my = 1\n\nif mx == 2 or my == 2:\n    print 1\n    exit(0)\nelif mx == 1:\n    ok = True\n    if x == u:\n        if min(y,v) < z < max(y,v):\n            ok = False\n    elif x == w:\n        if min(y,z) < v < max(y,z):\n            ok = False\n    elif u == w:\n        if min(v,z) < y < max(v,z):\n            ok = False\nelif my == 1:\n    ok = True\n    if y == v:\n        if min(x,u) < w < max(x,u):\n            ok = False\n    elif y == z:\n        if min(x,w) < u < max(x,w):\n            ok = False\n    elif v == z:\n        if min(u,w) < x < max(u,w):\n            ok = False\nelse:\n    ok = False\n\n\nprint 2 if ok else 3\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "a74b2b4d0f16e36b30406cf7fa5c5d09", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import ceil, log, floor, sqrt\nimport math\t\n\t\ndef mod_expo(n, p, m):\n\t\"\"\"find (n^p)%m\"\"\"\n\tresult = 1\n\twhile p != 0:\n\t\tif p%2 == 1:\n\t\t\tresult = (result * n)%m\n\t\tp //= 2\n\t\tn = (n * n)%m\n\treturn result\n\t\ndef find_k(x, y, n):\n\treturn ((n-y)//x)*x + y\n\ndef count_sticks(n):\n\tif n%2 == 0:\n\t\treturn n//2\n\treturn n//2 +1 \n\ndef get_types(n, r):\n\tif r < n:\n\t\treturn (r*(r+1))//2\n\tr = n-1\n\treturn (r*(r+1))//2 + 1\n\t\ndef happy_guests(a, b, n, m):\n\tmn = min(n, m)\n\ta -= mn\n\tb -= mn\n\tn -= mn\n\tm -= mn\n\tif a < 0 or b < 0:\n\t\treturn False\n\tif n > 0:\n\t\treturn a+b >= n\n\treturn min(a, b) >= m \t\n\t\ndef find_max_len(s):\n\tn = len(s)\n\tl, r = 0, n-1\n\tcount = n\n\twhile l < r and s[l] == 'a':\n\t\tl += 1\n\twhile r > l and s[r] == 'a':\n\t\tr -= 1\n\tfor i in range(l, r+1):\n\t\tif s[i] != 'b':\n\t\t\tcount -= 1\n\treturn count\n\t\ndef is_rectangle(a, b, c):\n\tfor i in range(2):\n\t\tif a[i] == b[i]:\n\t\t\tidx = (i+1)%2\n\t\t\tif c[idx] >= max(a[idx], b[idx]) or c[idx] <= min(a[idx], b[idx]): \n\t\t\t\treturn True\n\t\tif b[i] == c[i]:\n\t\t\tidx = (i+1)%2\n\t\t\tif a[idx] >= max(b[idx], c[idx]) or a[idx] <= min(b[idx], c[idx]):\n\t\t\t\treturn True\n\t\tif a[i] == c[i]:\n\t\t\tidx = (i+1)%2\n\t\t\tif b[idx] >= max(a[idx], c[idx]) or b[idx] <= min(a[idx], c[idx]):\n\t\t\t\treturn True\n\treturn False\n\t\ndef count_lines(points):\n\tmpx, mpy = {}, {}\n\tfor point in points:\n\t\tif point[0] not in mpx:\n\t\t\tmpx[point[0]] = 1\n\t\telse:\n\t\t\tmpx[point[0]] += 1\n\t\tif point[1] not in mpy:\n\t\t\tmpy[point[1]] = 1\n\t\telse:\n\t\t\tmpy[point[1]] += 1\n\t#print(len(mpx), len(mpy))\n\t#print(mpx, mpy)\n\tif len(mpx) == 1 or len(mpy) == 1:\n\t\treturn 1\n\tif is_rectangle(points[0], points[1], points[2]):\n\t\treturn 2\n\tif is_rectangle(points[0], points[2], points[1]): \n\t\treturn 2\n\tif is_rectangle(points[2], points[1], points[0]):\n\t\treturn 2\t\n\treturn 3\t\n\t\nt = 1\n#t = int(input())\nwhile t:\n\tt = t - 1\n\tpoints = []\n\t#n = int(input()) \n\t#n, k = map(int, input().split()) \n\t# = map(int, input().split())\n\t#arr = list(map(int, input().strip().split()))[:n]\n\t#w = list(map(int, input().strip().split()))[:k]\n\tfor i in range(3):\n\t\tx, y = map(int, input().split()) \n\t\tpoints.append((x, y))\n\t#s = input()\n\t#if happy_guests(a, b, n, m):\n#\t\tprint(\"Yes\")\n#\telse:\n#\t\tprint(\"No\")\n\t\n\t#print(get_res(s))\n\tprint(count_lines(points))\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "0902ee60e4af857b8606685a3744f0ce", "src_uid": "36fe960550e59b046202b5811343590d", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\r\nwhile n>9:\r\n    n = sum(list(map(int, list(str(n)))))\r\nprint(n)", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "f150af5b54613dcb528a2279b9a99284", "src_uid": "477a67877367dc68b3bf5143120ff45d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input()\r\nwhile len(s) > 1:\r\n    t = 0\r\n    for digit in s:\r\n        t += int(digit)\r\n    s = str(t)\r\nprint(s)\r\n", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "c37bfe1756d8bea890669e9252881dc9", "src_uid": "477a67877367dc68b3bf5143120ff45d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x,y = list(map(int,input().split()))\na = 1\nb = 0\nif y == 0:\n    print(\"No\")\nelif y == 1:\n    if x == 0:\n        print(\"Yes\")\n    else:\n        print(\"No\")\nelse:\n    b += y - a\n    if b > x:\n        print(\"No\")\n    elif b == x:\n        print(\"Yes\")\n    else:\n        temp = x - b\n        if temp % 2 == 0:\n            print(\"Yes\")\n        else:\n            print(\"No\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "1ffd6dc415dbce46637c4ab1cece2230", "src_uid": "1527171297a0b9c5adf356a549f313b9", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x, y=list(map(int, input().split()))\nif y-1>x or (x==1 and y==0) or (y==1 and x!=0) or y==0 or (x-y+1)%2!=0:\n    print('No')\nelse:\n    print('Yes')", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "0c1f657618be4608290efdb4d4c6e59d", "src_uid": "1527171297a0b9c5adf356a549f313b9", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,k = [int(i) for i in input().split()]\nans = 0\nfor i in range(k):\n    if n >= 2:\n        ans +=  2 * n  - 3\n        n -= 2\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "38e6aa4bc4c7d6ef02a75bda7d4d3743", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def mp():  return map(int,input().split())\ndef lt():  return list(map(int,input().split()))\ndef pt(x):  print(x)\ndef ip():  return input()\ndef it():  return int(input())\ndef sl(x):  return [t for t in x]\ndef spl(x): return x.split()\ndef aj(liste, item): liste.append(item)\ndef bin(x):  return \"{0:b}\".format(x)\ndef printlist(l): print(''.join([str(x) for x in l]))\ndef listring(l): return ''.join([str(x) for x in l])\n\nn,k = mp()\nif k >= n//2:\n    print((n*(n-1))//2)\n    exit()\nresult = 0\nfor i in range(k):\n    result += (2*(n-1-2*i)-1)\nprint(result)\n    \n        \n        ", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "d18e949d83dbaf4c1660ee56d1d9fe08", "src_uid": "ea36ca0a3c336424d5b7e1b4c56947b0", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x, y = map(int, input().split())\ncounter = 0\n\nx, y = min(x,y), max(x,y)\nx1 = x\nx2 = x\nx3 = x\n\nwhile y > x1 or y > x2 or y > x3:\n    if x1 != y:\n        x1 = min(x3 + x2 - 1, y)\n        counter += 1\n    if x2 != y:\n        x2 = min(x1 + x3 - 1, y)\n        counter += 1\n    if x3 != y:\n        x3 = min(x1 + x2 - 1, y)\n        counter += 1\n\n#    print(x1,x2,x3)\n\nprint(counter)", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "15e72d20d3afefbaedf3df00c4b997ef", "src_uid": "8edf64f5838b19f9a8b19a14977f5615", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from __future__ import division\nfrom math import ceil\nfrom collections import Counter\n\nx, y = raw_input(\"\").split(\" \")\nx, y = int(x), int(y)\ny = [y, y, y]\ncount = 0\nwhile not (y[0] == y[1] == y[2] == x):\n\ty.sort()\n\ty[0] = min(y[1] + y[2] - 1, x)\n\tcount += 1\nprint count\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "e124da04ef3da9950df77b31bc70e95b", "src_uid": "8edf64f5838b19f9a8b19a14977f5615", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n=input()\ns=list(str(raw_input()))\ni=0\nwhile i<n-2:\n    if s[i]=='o'and s[i+1]=='g' and s[i+2]=='o':\n        s[i],s[i+1],s[i+2]=\"*\",\"*\",\"*\"\n        while i<n-4:\n            #print s\n            if s[i+3]=='g' and s[i+4]=='o':\n                s[i+3],s[i+4]='',''\n                i=i+2\n            else:\n                break\n    i=i+1\n   # print s\nprint \"\".join(s)\n\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "2cabc850785e41b7a4c9ea5088179db3", "src_uid": "619665bed79ecf77b083251fe6fe7eb3", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import re\ninput()\ns = input()\nprint(re.sub('o(go)+','***',s))", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "476a4f1bdb7c82ee5f3dd5a04ab1144a", "src_uid": "619665bed79ecf77b083251fe6fe7eb3", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "w,h = map(int, raw_input().split())\ns1 = s2 = 0\nfor i in range(0, w):\n    s1 += (w - i) / 2\nfor i in range(0, h):\n    s2 += (h - i) / 2\nprint s1 * s2\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "1dbb1ec20b884fdb3fa13089ef0e04dd", "src_uid": "42454dcf7d073bf12030367eb094eb8c", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from sys import stdin, stdout\n\nw, h = map(int, stdin.readline().split())\n\nif (w < 2 or h < 2):\n    stdout.write('0')\nelse:\n    first = 0\n    \n    for i in range(w - 1):\n        first += (w - i) // 2\n    \n    second = 0\n    \n    for i in range(1, h + 1):\n        second += min(i, h - i)\n    \n    stdout.write(str(first * second))\n        ", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "332d73d55be81077790b759161028918", "src_uid": "42454dcf7d073bf12030367eb094eb8c", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nl=list(map(int,input().split()))\nemp=[]\nfor i in range(n):\n    c=0\n    for j in range(n):\n        if j<=i:\n            c+= l[j]*i*4\n        else:\n            c+=l[j]*j*4\n    emp.append(c)\nprint(min(emp))\n    \n            \n            ", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "4b13ad0802a7d3c3cdea191cf2d18818", "src_uid": "a5002ddf9e792cb4b4685e630f1e1b8f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\ninput = sys.stdin.readline\nn = int(input())\ns = [0]+list(map(int, input().split()))\nret = 9876543210\nfor xth in range(1, len(s)):\n    summ = 0\n    for i in range(1, len(s)):\n        summ += 2*(abs(xth-i)+(i-1)+(xth-1))*s[i]\n    ret=min(ret, summ)\nprint(ret)", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "2abb29c400727956438a7fc866f4259c", "src_uid": "a5002ddf9e792cb4b4685e630f1e1b8f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x, y = map(int, input().split(\" \"))\nk = 0\nif(y % x != 0):\n    print(-1)\nelse:\n    y = y / x\n    while y != 1:\n        if(y % 2 == 0):\n            y /= 2\n            k += 1\n        elif(y % 3 == 0):\n            y /= 3\n            k += 1\n        else:\n            print(-1)\n            break\n    else: print(k)           \n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "e87d5dda1727b2bf5f0cdfc5042c02ab", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\n\nif n == m:\n    print(0)\n\nelif m % n != 0:\n    print(-1)\n\nelse:\n    k = m // n\n    if k % 2 != 0 and k % 3 != 0:\n        print(-1)\n    else:\n        p, q = 0, 0\n        while(k % 2 == 0):\n            p += 1\n            k /= 2\n        while(k % 3 == 0):\n            q += 1\n            k /= 3\n        if k != 1:\n            print(-1)\n        else:\n            print(p + q)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "cc0bf8deb77a02b32b0d38c64f8ebf61", "src_uid": "3f9980ad292185f63a80bce10705e806", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, k = map(int, input().split())\na = list(map(int, input().split()))\n\ns2 = 2 * n\ns4 = n\ns1 = 0\n\ntmp = sum(map(lambda ai: ai // 4, a))\ns4 -= min(tmp, n)\ns2 -= 2 * max(tmp - n, 0)\n\nfor ai in a:\n    if ai % 4 == 2:\n        if 0 < s2:\n            s2 -= 1\n        elif 0 < s4:\n            s4 -= 1\n            s1 += 1\n        else:\n            s1 -= 2\n\nfor ai in a:\n    if ai % 4 == 1:\n        if 0 < s1:\n            s1 -= 1\n        elif 0 < s2:\n            s2 -= 1\n        else:\n            s4 -= 1\n            s2 += 1\n\nfor ai in a:\n    if ai % 4 == 3:\n        if 0 < s4:\n            s4 -= 1\n        elif 1 < s2:\n            s2 -= 2\n        elif 1 == s2:\n            s2 -= 1\n            s1 -= 1\n        else:\n            s1 -= 3\n\nif 0 <= s1 and 0 <= s2 and 0 <= s4:\n    print(\"YES\")\nelse:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["brute force", "greedy", "implementation"], "code_uid": "713fa8eccf9d3271fb59053c57a20a00", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "read = lambda: map(int, input().split())\nk, n = read()\na = list(read())\ncnt4 = k\ncnt2 = 2 * k\nfor i in range(n):\n    cnt = min(cnt4, a[i] // 4)\n    a[i] -= cnt * 4\n    cnt4 -= cnt\nfor i in range(n):\n    cnt = min(cnt2, a[i] // 2)\n    a[i] -= cnt * 2\n    cnt2 -= cnt\nc = [0] * 20\nfor i in a:\n    c[min(i, 19)] += 1\nd = min(cnt4, c[3])\nc[3] -= d\ncnt4 -= d\nd = min(cnt4, c[1], c[2])\nc[1] -= d\nc[2] -= d\ncnt4 -= d\nd = min(cnt2, c[2])\nc[2] -= d\ncnt2 -= d\nd = min(cnt2, c[1])\nc[1] -= d\ncnt2 -= d\nd = min(cnt4, (c[2] + 2) // 3 + int(c[2] > 1))\nc[2] -= d + d // 2\ncnt4 -= d\nd = min(cnt4, c[2])\nc[2] -= d\ncnt4 -= d\nd = min(cnt4, (c[1] + 1) // 2)\nc[1] -= d * 2\ncnt4 -= d\nd = min(cnt4, c[1])\nc[1] -= d\ncnt4 -= d\nprint('YES' if sum(c[1:]) == 0 else 'NO')", "lang_cluster": "Python", "tags": ["brute force", "greedy", "implementation"], "code_uid": "26c6809c59601396f3aa49c23268240d", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "## necessary imports\n\nimport sys\ninput = sys.stdin.readline\nfrom bisect import bisect_left;\nfrom bisect import bisect_right;\nfrom math import ceil, factorial;\n\ndef ceil(x):\n    if x != int(x):\n        x = int(x) + 1;\n    return x;\n    \n# swap_array function\ndef swaparr(arr, a,b):\n    temp = arr[a];\n    arr[a] = arr[b];\n    arr[b] = temp;\n\n## gcd function\ndef gcd(a,b):\n    if b == 0:\n        return a;\n    return gcd(b, a % b);\n\n## nCr function efficient using Binomial Cofficient\ndef nCr(n, k): \n    if(k > n - k): \n        k = n - k; \n    res = 1;\n    for i in range(k): \n        res = res * (n - i);\n        res = res / (i + 1); \n    return int(res);\n\n## prime factorization\ndef primefs(n):\n    ## if n == 1    ## calculating primes\n    primes = {}\n    while(n%2 == 0 and n > 0):\n        primes[2] = primes.get(2, 0) + 1\n        n = n//2\n    for i in range(3, int(n**0.5)+2, 2):\n        while(n%i == 0 and n > 0):\n            primes[i] = primes.get(i, 0) + 1\n            n = n//i\n    if n > 2:\n        primes[n] = primes.get(n, 0) + 1\n    ## prime factoriazation of n is stored in dictionary\n    ## primes and can be accesed. O(sqrt n)\n    return primes\n\n## MODULAR EXPONENTIATION FUNCTION\ndef power(x, y, p): \n    res = 1\n    x = x % p  \n    if (x == 0) : \n        return 0\n    while (y > 0) : \n        if ((y & 1) == 1) : \n            res = (res * x) % p \n        y = y >> 1      \n        x = (x * x) % p \n    return res \n\n## DISJOINT SET UNINON FUNCTIONS\ndef swap(a,b):\n    temp = a\n    a = b\n    b = temp\n    return a,b;\n\n# find function with path compression included (recursive)\n# def find(x, link):\n#     if link[x] == x:\n#         return x\n#     link[x] = find(link[x], link);\n#     return link[x];\n\n# find function with path compression (ITERATIVE)\ndef find(x, link):\n    p = x;\n    while( p != link[p]):\n        p = link[p];\n    \n    while( x != p):\n        nex = link[x];\n        link[x] = p;\n        x = nex;\n    return p;\n\n\n# the union function which makes union(x,y)\n# of two nodes x and y\ndef union(x, y, link, size):\n    x = find(x, link)\n    y = find(y, link)\n    if size[x] < size[y]:\n        x,y = swap(x,y)\n    if x != y:\n        size[x] += size[y]\n        link[y] = x\n\n## returns an array of boolean if primes or not USING SIEVE OF ERATOSTHANES\ndef sieve(n): \n    prime = [True for i in range(n+1)] \n    p = 2\n    while (p * p <= n): \n        if (prime[p] == True): \n            for i in range(p * p, n+1, p):\n                prime[i] = False\n        p += 1\n    return prime\n\n#### PRIME FACTORIZATION IN O(log n) using Sieve ####\nMAXN = int(1e5 + 5)\ndef spf_sieve():\n    spf[1] = 1;\n    for i in range(2, MAXN):\n        spf[i] = i;\n    for i in range(4, MAXN, 2):\n        spf[i] = 2;\n    for i in range(3, ceil(MAXN ** 0.5), 2):\n        if spf[i] == i:\n            for j in range(i*i, MAXN, i):\n                if spf[j] == j:\n                    spf[j] = i;\n    ## function for storing smallest prime factors (spf) in the array\n\n################## un-comment below 2 lines when using factorization #################\n# spf = [0 for i in range(MAXN)]\n# spf_sieve();\ndef factoriazation(x):\n    ret = {};\n    while x != 1:\n        ret[spf[x]] = ret.get(spf[x], 0) + 1;\n        x = x//spf[x]\n    return ret;\n    ## this function is useful for multiple queries only, o/w use\n    ## primefs function above. complexity O(log n)\n\n## taking integer array input\ndef int_array():\n    return list(map(int, input().strip().split()));\n\ndef float_array():\n    return list(map(float, input().strip().split()));\n\n## taking string array input\ndef str_array():\n    return input().strip().split();\n\n#defining a couple constants\nMOD = int(1e9)+7;\nCMOD = 998244353;\nINF = float('inf'); NINF = -float('inf');\n\n################### ---------------- TEMPLATE ENDS HERE ---------------- ###################\n\nn, x = int_array();\na = int_array(); cnt = [0] * n;\nk = x;\nfor i in range(n - 1, -1, -1):\n    p = 2 ** i;\n    cnt[i] += k // p;\n    k %= p;\n\nmnt = a.copy();\nfor i in range(1, n):\n    mnt[i] = min(2 * mnt[i - 1], mnt[i]);\nans = 0;\nfor i in range(n):\n    ans += mnt[i] * cnt[i];\n\n\n## let's check if buying one more volume of biggest will do the trick;\nthis = 0;\nfor i in range(n - 1, -1, -1):\n    this += (cnt[i] + 1) * mnt[i];\n    ans = min(ans, this);\n    this -= mnt[i];\nprint(ans);", "lang_cluster": "Python", "tags": ["greedy", "dp", "bitmasks"], "code_uid": "2c786b87aed9e19fe1fa8c7e5c8ae65d", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, l = map(int, input().split())\np = list(map(int, input().split()))\nd = []\nd = [[p[i] / 2**i, i + 1] for i in range(n)]\nd.sort(key = lambda x: x[0])\nres = 10**18\nq = l\ncurres = 0\nfor i in d:\n\tif i[1] == 1:\n\t\tcurres += p[i[1] - 1] * q\n\t\tres = min(res, curres)\n\t\tbreak\n\tcurb = q // 2**(i[1] - 1)\n\tcurres += curb * p[i[1] - 1]\n\tres = min(res, curres + p[i[1] - 1])\n\tq %= 2**(i[1] - 1)\nprint(res)", "lang_cluster": "Python", "tags": ["greedy", "dp", "bitmasks"], "code_uid": "9df5ca1f3b4156132973fe467722b79e", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n\ndef sum_(a):\n    return max(0, a * (a + 1) // 2)\n\ndef check(a):\n    if a * n <= m:\n        return 1\n    a -= 1\n    ans = n\n    t1 = a - k + 1\n    #print(a)\n    if t1 >= 0:\n        ans += sum_(a) - sum_(t1 - 1)\n    else:\n        ans += sum_(a)\n    #print(ans)\n    z = n - k + 1\n    t2 = a - z + 1\n    #print('ts', t2)\n    if t2 >= 0:\n        ans += sum_(a - 1) - sum_(t2 - 1)\n    else:\n        ans += sum_(a - 1)\n    #print(ans)\n    return (ans <= m)\n\ndef bins():\n    l = 1\n    r = m + 1\n    while l + 1 != r:\n        m1 = (l + r) // 2\n        if check(m1):\n            l = m1\n        else:\n            r = m1\n    print(l)\n    \nn, m, k = map(int, input().split())\n#print(check(2))\nbins()\n\n            \n", "lang_cluster": "Python", "tags": ["greedy", "binary search"], "code_uid": "d4650e0a640a1a8d8f8c54567b11ef8b", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m, k = map(int, input().split())\nbest = 1\nsleva = k - 1\nsprava = n - k\nm -= n\n\nput = 1\n\nwhile (m >= put):\n    m -= put\n    best+= 1\n    put += (sleva > 0) + (sprava > 0)\n    if sleva:\n        sleva -= 1\n    if sprava:\n        sprava -= 1\n    if sleva == sprava == 0:\n        best += (m // put)\n        break\n    \nprint(best)", "lang_cluster": "Python", "tags": ["greedy", "binary search"], "code_uid": "458b8c0047df83ffb10e9a072e8c954c", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def trip(limit, months):\n    months.sort(reverse=True)\n    count = 0\n    if limit <= 0:\n        return 0\n    for i in months:\n        count += 1\n        limit -= i\n        if limit <= 0:\n            return count\n    return -1\n\nprint trip(int(raw_input()), map(int, raw_input().split()))", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "07e6464b0ec269091920e36c06f05ab7", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def func(n):\n    l = list(map(int,input().split()))\n    counter = 0\n    while n > 0 and l:\n        n -= max(l)\n        l.pop(l.index(max(l)))\n        counter += 1\n    if n > 0 and counter >= 12:\n        print(-1)\n    else:\n        print(counter)\nn = int(input())\nfunc(n)", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "1bd3ee9b451dd87516bc5026524f79f3", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "x1,y1,x2,y2 = map(int,input().split())\nx3,y3,x4,y4 = map(int,input().split())\nx5,y5,x6,y6 = map(int,input().split())\n\ndef dl(x1,x2,x3,x4):\n    l = [x1,x2,x3,x4]\n    cp = l[:]\n    if sorted(cp)==l or sorted(cp)==l[2:]+l[:2]:\n        return 0\n    else:\n        return abs(min(x2,x4)-max(x1,x3))\n\ndef tl(x1,x2,x3,x4,x5,x6):\n    if dl(x1,x2,x3,x4)==0 or dl(x1,x2,x5,x6)==0 or dl(x5,x6,x1,x2)==0:\n        return 0\n    return abs(min(x2,x4,x6)-max(x1,x3,x5))\n\nwa = (x2-x1)*(y2-y1)\ns = (dl(x1,x2,x3,x4)*dl(y1,y2,y3,y4)+dl(x1,x2,x5,x6)*dl(y1,y2,y5,y6))-(tl(x1,x2,x3,x4,x5,x6)*tl(y1,y2,y3,y4,y5,y6))\n#print(wa,s)\nif s>=wa:\n    print('NO')\nelse:\n    print('YES')\n", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "1f445a4d7ed65dd768e269b77654238f", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x1,y1,x2,y2 = map(int, input().split())\nx3,y3,x4,y4 = map(int, input().split())\nx5,y5,x6,y6 = map(int, input().split())\n\nif y1 >= y3 and y2 <= y4 and x1 >= x3 and x2 <= x4:\n    print(\"NO\")\nelif y1 >= y5 and y2 <= y6 and x1 >= x5 and x2 <= x6:\n    print(\"NO\")\nelif x3 <= x1 and x4 >= x2 and x5 <= x1 and x6 >= x2 and y3 <= y1 <= y5 <=y4 <= y2 <= y6:\n    print(\"NO\")\nelif x3 <= x1 and x4 >= x2 and x5 <= x1 and x6 >= x2 and y5 <= y1 <= y3 <=y6 <= y2 <= y4:\n    print(\"NO\")\n\nelif y3 <= y1 and y4 >= y2 and y5 <= y1 and y6 >= y2 and x3 <= x1 <= x5 <=x4 <= x2 <= x6:\n    print(\"NO\")\nelif y3 <= y1 and y4 >= y2 and y5 <= y1 and y6 >= y2 and x5 <= x1 <= x3 <=x6 <= x2 <= x4:\n    print(\"NO\")\n\n\n\nelse:\n    print(\"YES\")", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "a186db501ba5f6460a451106c2f1729f", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from itertools import permutations\n \nn,k = map(int,input().split())\na = []\nmn = float(\"inf\")\nfor _ in range(n):\n    line = input()\n    a.append(list(permutations(line)))\n \nfor arr in zip(*a):\n    ints = [int(''.join(num)) for num in arr]\n    mn = min(mn,max(ints)-min(ints))\n \nprint(mn)", "lang_cluster": "Python", "tags": ["brute force", "implementation", "combinatorics"], "code_uid": "17c35792f345f5e73227cd0440406620", "src_uid": "08f85cd4ffbd135f0b630235209273a4", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#Code by Sounak, IIESTS\n#------------------------------warmup----------------------------\n\nimport os\nimport sys\nimport math\nfrom io import BytesIO, IOBase\nfrom fractions import Fraction\nfrom collections import defaultdict\nfrom itertools import permutations\n \n\nBUFSIZE = 8192\n \n \nclass FastIO(IOBase):\n    newlines = 0\n    \n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n     \n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n \n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n \n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\n \n \nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n  \nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n \n#-------------------game starts now-----------------------------------------------------\nn,d = [int(x) for x in input().split()]\nli = []\nfor i in range(n):\n    s = input()\n    li.append(s)\nst = \"\"\nfor i in range(0,d):\n    st += str(i)\nfrom itertools import permutations\nmax_diff = 10**9\nfor i in permutations(st):\n    ans = []\n    for j in i:\n        ans.append(int(j))\n    aa = []\n    for j in li:\n        k = \"\"\n        for m in ans:\n            k += j[m]\n        aa.append(int(k))\n    mam,mim = max(aa),min(aa)\n    max_diff = min(mam-mim,max_diff)\nprint(max_diff)", "lang_cluster": "Python", "tags": ["brute force", "implementation", "combinatorics"], "code_uid": "7c06e6b57a606ebfb86ec86121a99ddf", "src_uid": "08f85cd4ffbd135f0b630235209273a4", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\nn, m, t=map(int,raw_input().split())\nans=math.factorial(n+m)\nans=ans/math.factorial(n+m-t)\nans=ans/math.factorial(t)\nif n>=t:\n    ans1=math.factorial(n)\n    ans1=ans1/math.factorial(t)\n    ans1=ans1/math.factorial(n-t)\n    ans=ans-ans1\nif m>=t:\n    ans1=math.factorial(m)\n    ans1=ans1/math.factorial(t)\n    ans1=ans1/math.factorial(m-t)\n    ans=ans-ans1\nif m+1>=t:\n    k=math.factorial(n)/math.factorial(1)/math.factorial(n-1)\n    ans1=math.factorial(m)\n    ans1=ans1/math.factorial(t-1)\n    ans1=ans1/math.factorial(m+1-t)\n    ans1=ans1*k\n    ans=ans-ans1\nif m+2>=t:\n    k=math.factorial(n)/math.factorial(2)/math.factorial(n-2)\n    ans1=math.factorial(m)\n    ans1=ans1/math.factorial(t-2)\n    ans1=ans1/math.factorial(m+2-t)\n    ans1=ans1*k\n    ans=ans-ans1\nif m+3>=t:\n    k=math.factorial(n)/math.factorial(3)/math.factorial(n-3)\n    ans1=math.factorial(m)\n    ans1=ans1/math.factorial(t-3)\n    ans1=ans1/math.factorial(m+3-t)\n    ans1=ans1*k\n    ans=ans-ans1\nprint ans\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "17d3851c91173789833952255d4a0e64", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import operator as op\nimport math\nfrom functools import reduce\n\ndef ncr(n, r):\n    r = min(r, n-r)\n    numer = reduce(op.mul, range(n, n-r, -1), 1)\n    denom = reduce(op.mul, range(1, r+1), 1)\n    return numer // denom\n\nn,m,t=map(int,input().split())\nways=0\na=4\nb=t-a\nwhile(a<=n and b!=0):\n\tif(b<=m):\n\t\tways+=ncr(n,a)*ncr(m,b)\n\ta=a+1\n\tb=t-a\nprint(int(ways))\n\t\n\t\n\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "48b29323ddf4843e84e234b2b684aa2f", "src_uid": "489e69c7a2fba5fac34e89d7388ed4b8", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=[int(x) for x in input().split()]\na=0\nwhile n*m!=0:\n    n=n-1\n    m=m-1\n    a+=1\nif a%2==0:\n    print('Malvika')\nelse:\n    print('Akshat')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "02903a68fbebdd117f779ac36a3f3c3b", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = min([int(x) for x in input().split()])\nif a%2 == 0:\n    print('Malvika')\nelse:\n    print('Akshat')", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "ab99a40566611ee856e0976c5bff341f", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#coding:utf-8\n\nn = raw_input()\nm = raw_input()\nlists = m.split(' ')\nfor i in range(len(lists)):\n    lists[i] = int(lists[i])\n\nwhile min(lists) != max(lists):\n    lists = sorted(lists)\n    for i in range(len(lists)):\n        for j in range(len(lists)):\n            if lists[i] < lists[j]:\n                lists[j] -= lists[j] / lists[i] * lists[i]\n                if lists[j] == 0: lists[j] += lists[i]\n\nprint int(n) * min(lists)\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "cac734347c9b94b80fc64c1f7316442c", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# bsdk idhar kya dekhne ko aaya hai, khud kr!!!\n# import math\n# from itertools import *\n# import random\n# import calendar\n# import datetime\n# import webbrowser\n\nn = int(input())\narr = list(map(int, input().split()))\nwhile max(arr) > min(arr):\n    index = arr.index(max(arr))\n    arr[index] -= min(arr)\nprint(sum(arr))\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "017ce8d247bdc8775ae70083a8217857", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "if __name__== \"__main__\":\n    input = int(input())\n\n    bin_input = str(bin(input))[2:]\n    bin_input = bin_input.rjust(6,'0')\n    string_order = [0, 5, 3, 2, 4, 1]\n    bin_output = \"\"\n    for order in string_order:\n        bin_output += bin_input[order]\n\n    print(int(bin_output,2))", "lang_cluster": "Python", "tags": ["bitmasks"], "code_uid": "14037057f004f3698a6fb31ceaf12195", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = bin(int(input()))[2:]\na = a.zfill(6)\nb = \"\".join([a[0], a[5], a[3], a[2], a[4], a[1]])\nprint(int(b, 2))", "lang_cluster": "Python", "tags": ["bitmasks"], "code_uid": "adc9d02f6030819ab4de95ba02e737be", "src_uid": "db5e54f466e1f3d69a51ea0b346e667c", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\ndomino = []\nfor i in range(n):\n    domino.append(map(int, raw_input().split()))\nupper_sum = 0\nlower_sum = 0\nfor i in range(n):\n    card = domino[i]\n    upper_sum += card[0]\n    lower_sum += card[1]\nif (upper_sum + lower_sum) % 2 != 0:\n    print -1\nelif upper_sum % 2 == 0:\n    print 0\nelse:\n    flag = True\n    for i in range(n):\n        if sum(domino[i]) % 2 != 0:\n            flag = False\n            break\n    print -1 if flag else 1", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "b5121ea0a362694ad5683bab4008f030", "src_uid": "f9bc04aed2b84c7dd288749ac264bb43", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\n\nx = []\ny = []\nfor i in range(n):\n    (xi, yi) = map(int, input().split(' '))\n    x.append(xi)\n    y.append(yi)\n\nxs = sum(x)\nys = sum(y)\n\nif xs % 2 == 0 and ys % 2 == 0:\n    print(0)\nelif xs % 2 == 1 and ys % 2 == 1:\n    dif = False\n    for i in range(n):\n        if x[i] % 2 == 0 and y[i] % 2 != 0:\n            dif = True\n        elif x[i] % 2 != 0 and y[i] % 2 == 0:\n            dif = True\n        if dif:\n            break\n    if dif:\n        print(1)\n    else:\n        print(-1)\nelse:\n    print(-1)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "035e764f532b2af3e554588406d61aeb", "src_uid": "f9bc04aed2b84c7dd288749ac264bb43", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "dp=[[0 for j in range(2001)] for i in range(2001)]\nn,m,k=map(int,input().split())\nfor i in range(1,n+1):\n    for j in range(k+1):\n        if j==0 and i==1:\n            dp[i][j]=m\n            continue\n        if j<=i-1:\n            dp[i][j]=(m-1)*dp[i-1][j-1]+dp[i-1][j]\n            dp[i][j]%=998244353\nprint(dp[n][k])\n    \n    \n    \n        \n    \n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "0fa8adb51e5b133352743aa4935803d8", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "MOD = 998244353\nn, m, k = input().split()\n\nn = int(n)\nm = int(m)\nk = int(k)\n\n# Taken from https://www.geeksforgeeks.org/binomial-coefficient-dp-9/\ndef nCr(n , k):\n    C = [0 for i in range(k+1)]\n    C[0] = 1\n\n    for i in range(1,n+1):\n        j = min(i ,k)\n        while (j>0):\n            C[j] = C[j] + C[j-1]\n            j -= 1\n    return C[k]\n\nanswer = m * nCr(n-1, k) * (m-1)**k\nprint(answer%MOD)\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "680230096a69db1935fcd882454c8017", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "'''\n\u4e8c\u7ef4\u6570\u7ec4\u8f6c\u7f6e,\u6392\u5e8f,lambda\u8868\u8fbe\u5f0f\u51fd\u6570\n'''\n\nmylist = [list(map(int, input().split())),list(map(int, input().split()))]\nmylist = list(map(list,zip(*mylist)))\nfor my in  mylist:\n    if my[0]<my[1]:\n        my[1]-=my[0]\n        my[0]=0\n    else:\n        my[0]-=my[1]\n        my[1]=0\n# for i in range(len(mylist)):\n#     if mylist[i][0]<mylist[i][1]:\n#         mylist[i][1]-=mylist[i][0]\n#         mylist[i][0]=0\n#     else:\n#         mylist[i][0]-=mylist[i][1]\n#         mylist[i][1]=0\nmylist.sort(key=lambda my:my[0], reverse=True)\ni=0 #\u521d\u59cb\u5269\u4f59\u8d44\u6e90\nj=0 #\u76ee\u6807\u8d44\u6e90\u91cf\nwhile j<3 and i<3:\n    while mylist[j][1]>0 and i<3:\n        if mylist[i][0]<=mylist[j][1]*2:\n            mylist[j][1]-=mylist[i][0]//2\n            i+=1\n        else:\n            mylist[i][0]-=mylist[j][1]*2\n            mylist[j][1]=0\n    j+=1\nif mylist[2][1]+mylist[1][1]+mylist[0][1]>0:\n    print(\"No\")\nelse:\n    print(\"Yes\")\n     \n     \n         ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "df2fe4eb4187b3bbd472b9ab1a676a70", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "(a, b, c) = (int(x) for x in raw_input().split())\n(x, y, z) = (int(x) for x in raw_input().split())\n\nra = 0\nrb = 0\nrc = 0\nrem = 0\n\nif a > x:\n    ra = (a - x) / 2\nelse:\n    rem += (x - a)\nif b > y:\n    rb = (b - y) / 2\nelse:\n    rem += (y - b)\nif c > z:\n    rc = (c - z) / 2\nelse:\n    rem += (z - c)\n\nif rem <= ra + rb + rc:\n    print 'Yes'\nelse:\n    print 'No'\n\n\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "d72d5fbbe8c8f9462d5b8c59e010a41b", "src_uid": "1db4ba9dc1000e26532bb73336cf12c3", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "b=int(input())\ng=int(input())\nn=int(input())\ncnt=0\nif(b>=g):\n    for i in range(b+1):\n        if(g>=n-i and n-i>=0):\n            #print(g,n-i)\n            cnt+=1\n    print(cnt)\nelse:\n    for i in range(g+1):\n        if(b>=n-i and n-i>=0):\n            #print(g,n-i)\n            cnt+=1\n    print(cnt)\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "bcd1ddb4c30653873f9f59e18c885c8e", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin\nb=int(stdin.readline().strip())\ng=int(stdin.readline().strip())\nn=int(stdin.readline().strip())\nst=set()\nans=0\nfor i in range(b+1):\n    for j in range(g+1):\n        if j+i==n:\n            ans+=1\n            \n\n        \nprint(ans)\n", "lang_cluster": "Python", "tags": ["brute force", "math"], "code_uid": "b9577e524176809662b7b5c5aa7845db", "src_uid": "9266a69e767df299569986151852e7b1", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "N = int(input())\neight_amount = input().count(\"8\")\nprint(min(N // 11, eight_amount))", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "da9127508071bd48646ab63da9797905", "src_uid": "259d01b81bef5536b969247ff2c2d776", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import collections\n\nn = int(input())\ndigits = input()\n\nc = collections.Counter(digits)\n\nprint(\"{0}\\n\".format(min(len(digits) // 11, c['8'])))", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "b74d03df585fe0a6e960c75ee53a1d0e", "src_uid": "259d01b81bef5536b969247ff2c2d776", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\nimport math\na,b,c=(map(int,sys.stdin.readline().split(' ')))\nans=-1\nfor i in range(1,1000):\n    a=a*10\n    d=a//b\n    e=d%10\n    if(e==c):\n        ans=i\n        break\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "92c17932d66d154ad52baf20027c316f", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from decimal import *\nimport math\n\ngetcontext().prec = 1000000\n\n\ninputs = [int(x) for x in input().split()]\na = inputs[0]\nb = inputs[1]\nc = inputs[2]\n\nnum = Decimal(a)/Decimal(b)\n\nd = str(num)\nfound = False\nwhere = 0\n\npos = -2\n\nat = 0\n\n#print(d) \nfor _ in d:\n\tif ( at == 999999 ):\n\t\tbreak\n\t#print(_)\n\tif _ == '.':\n\t\tfound = True\n\t\twhere = at\n\t\tcontinue\n\tif found == False:\n\t\tcontinue\n\tif _ == str(c):\n\t\tpos = at - where\n\t\tbreak\n\tat = at + 1\n\nif ( pos == -2 and c == 0 and at < 999999 ):\n\tpos = at\nprint(pos + 1)\n\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "c0e9762c5bd5653e6bd42f69e41567aa", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def gcd(a, b) :\n\tif b == 0 : \n\t\treturn a\n\telse : \n\t\treturn gcd(b, a%b)\n\na, b, c, d = map(int, input().split())\nfpb = gcd(c,d)\nc = c//fpb;\nd = d//fpb;\n\nprint(min(a//c, b//d));", "lang_cluster": "Python", "tags": ["math"], "code_uid": "65bc43ebdee8e015710815e2346b5e11", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon Sep 17 14:55:08 2018\n\n@author: chenzixuan\n\"\"\"\n\ndef gcd(a,b):\n    while (a!=0 and b!=0):\n        t = a%b\n        a = b\n        b = t\n    return a\n\ndef main():\n    #print(list(map(int,str.split(input()))))\n\n    [a,b,x,y] = list(map(int,str.split(input())))\n    tmp = gcd(x,y)\n    x /= tmp\n    y /= tmp\n    ans = min(int(a/x), int(b/y))\n    print(ans)\n    \n    \nif __name__ == '__main__':\n    main()\n    ", "lang_cluster": "Python", "tags": ["math"], "code_uid": "02664a6a5941f0476f17bc9062c5e766", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nif(n%2==1 and n!=1):\n    print (n*(n-1)*(n-2))\nelif(n==2):\n    print(2)\nelif(n==1):\n    print(1)\nelif(n%2==0 and n!=2):\n    if(n%3==0):\n        print (max(((n-3)*(n-1)*(n-2)),(n*(n-1)*(n-2)//2)))\n    else:\n        print (max((n*(n-1)*(n-3)),(n*(n-1)*(n-2)//2)))", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "6c6a5973369f34ea8afa4a7913be1473", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def nok(n):\n    if n < 3:\n        return n\n    if not n % 2 and n % 3:\n        m = n * (n - 1) * (n - 3)\n    else:\n        m = 0\n    n -= (n % 2 == 0)\n    return max(n * (n - 1) * (n - 2), m)\n\n\nprint(nok(int(input())))\n", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "169dd5c13802a50df402629b05c7cea3", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nm=int(input())\nprint(m%(1<<n))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "3023c25ab0ff9c7257d8e0d88261a4d3", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import ceil\n\nn = int(input())\nm = int(input())\nif n <= 27:\t\n\tprint(ceil(m%pow(2,n)))\nelse:\n\tprint(m)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "7e6326bfd683720dbd93f66ddd21cbfc", "src_uid": "c649052b549126e600691931b512022f", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,s=map(int,input().split())\nc=s//n\nd=s%n\nprint(c if d==0 else c+1)", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "dfe4233cc30e0f489e74aeadfe471ea1", "src_uid": "04c067326ec897091c3dbcf4d134df96", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "R=lambda : map(int,input().split())\nn,k=R()\nprint([(k+n-1)//n,1][n>k])\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "45780acd745424decbb3bacdc7723407", "src_uid": "04c067326ec897091c3dbcf4d134df96", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\ns=list(filter(lambda x:x!=\"\",input().split(\"W\")))\nprint(len(s))\nfor e in s:\n    print(len(e),end=\" \")\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f284e31f917326bfa20cad0aff32eba4", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "input()\nsek=input().split(\"W\")\ns=[]\nfor i in sek:\n\t if i!=\"\": s.append(i)\nprint(len(s))\nfor i in s:\n\tif i!=\"\": print(len(i), end=\" \")\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b99c89a4e62f684f82dbabe9ffd3bf90", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "l=lambda:map(int,raw_input().split())\na,b,c,d,e,f=l()\nprint (a+b+c)**2-a*a-c*c-e*e", "lang_cluster": "Python", "tags": ["brute force", "math", "geometry"], "code_uid": "bf1f01e714c99792473627c269acc4cd", "src_uid": "382475475427f0e76c6b4ac6e7a02e21", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b,c,d,e,f=map(int,input().split())\nprint((a+b+c)**2-a*a-c*c-e*e)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "geometry"], "code_uid": "406ec3e8be826b9e5d85041b5cc1829b", "src_uid": "382475475427f0e76c6b4ac6e7a02e21", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nar = list(map(int, input().split()))\n\nprint(2 + (ar[2] ^ min(ar)))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "bcd95b30f8a1c24b51f63cc458b56237", "src_uid": "a9eb85dfaa3c50ed488d41da4f29c697", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#Bhargey Mehta (Sophomore)\n#DA-IICT, Gandhinagar\nimport sys, math, queue\nsys.setrecursionlimit(1000000)\n#sys.stdin = open(\"input.txt\", \"r\")\n\nn = int(input())\na = list(map(int, input().split()))\nprint((a[2]^min(a))+2)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b8ffc2f8fdb718452231b216afd57c83", "src_uid": "a9eb85dfaa3c50ed488d41da4f29c697", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\r\n\r\nfrom collections import Counter\r\n\r\ndef distinct_factors(n):\r\n\tans = 1\r\n\tfor x in range(2, n):\r\n\t\tans += (n%x == 0)\r\n\treturn ans\r\n\r\ndef main():\r\n\tn = int(input())\r\n\r\n\tmod = 998244353\r\n\r\n\tdp = [-1]*(n+1)\r\n\r\n\tpre = 0\r\n\r\n\td = [0]*(n+1)\r\n\r\n\tfor i in range(1, n+1):\r\n\t\tfor j in range(i, n+1, i):\r\n\t\t\td[j] += 1\r\n\r\n\tfor i in range(1, n+1):\r\n\t\tdp[i] = (pre+d[i])%mod\r\n\t\tpre += dp[i]\r\n\r\n\r\n\treturn (dp[n])%mod \r\n\r\nprint(main())", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "155cf9b393d1f913f3c9a742bbf7956c", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#------------------------template--------------------------#\r\nimport os\r\nimport sys\r\nimport math\r\nimport collections\r\nimport functools\r\nimport itertools\r\n# from fractions import *\r\nimport heapq\r\nimport bisect\r\nfrom io import BytesIO, IOBase\r\ndef vsInput():\r\n    sys.stdin = open('input.txt', 'r')\r\n    sys.stdout = open('output.txt', 'w')\r\nBUFSIZE = 8192\r\nclass FastIO(IOBase):\r\n    newlines = 0\r\n    def __init__(self, file):\r\n        self._fd = file.fileno()\r\n        self.buffer = BytesIO()\r\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\r\n        self.write = self.buffer.write if self.writable else None\r\n    def read(self):\r\n        while True:\r\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\r\n            if not b:\r\n                break\r\n            ptr = self.buffer.tell()\r\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\r\n        self.newlines = 0\r\n        return self.buffer.read()\r\n    def readline(self):\r\n        while self.newlines == 0:\r\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\r\n            self.newlines = b.count(b\"\\n\") + (not b)\r\n            ptr = self.buffer.tell()\r\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\r\n        self.newlines -= 1\r\n        return self.buffer.readline()\r\n    def flush(self):\r\n        if self.writable:\r\n            os.write(self._fd, self.buffer.getvalue())\r\n            self.buffer.truncate(0), self.buffer.seek(0)\r\nclass IOWrapper(IOBase):\r\n    def __init__(self, file):\r\n        self.buffer = FastIO(file)\r\n        self.flush = self.buffer.flush\r\n        self.writable = self.buffer.writable\r\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\r\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\r\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\r\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\r\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\r\nALPHA='abcde'\r\nM = 10**9 + 7\r\nEPS = 1e-6\r\ndef Ceil(a,b): return a//b+int(a%b>0)\r\ndef INT():return int(input())\r\ndef STR():return input()\r\ndef INTs():return tuple(map(int,input().split()))\r\ndef ARRINT():return [int(i) for i in input().split()]\r\ndef ARRSTR():return [i for i in input().split()]\r\n \r\n \r\n#-------------------------code---------------------------#\r\n\r\n\r\nMOD = 998244353\r\nn = INT()\r\n\r\ndp = [0]*(n+1)\r\ndp[0] = 1\r\n\r\nfor i in range(1, n+1):\r\n    j = 2*i\r\n    while j < n+1:\r\n        dp[j] += 1\r\n        j += i\r\n\r\ntmp = 1\r\nfor i in range(1, n+1):\r\n    dp[i] += tmp\r\n    dp[i] %= MOD\r\n    tmp += dp[i]\r\n    tmp %= MOD\r\n\r\nprint(dp[-1])", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "number theory"], "code_uid": "613bc7f843bfe4f692a811a640537574", "src_uid": "09be46206a151c237dc9912df7e0f057", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import acos, pi\n[n,R,r] = list(map(float,input().split())) \neps = 1e-9\nif R < r:\n    print('NO')\nelse:\n    if R == r:\n        if n == 1:\n            print('YES')\n        else:\n            print('NO')\n    elif R < 2*r:\n        if n > 1:\n            print('NO')\n        else:\n            print('YES')\n    else:\n        a = acos(1 - 2*r**2/(R-r)**2)\n        if a-eps <= 2*pi/n:\n            print('YES')\n        else:\n            print('NO')", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "7028e4e0aaf09eedc7e9031d3c1d0f82", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\nimport re\nimport math\n\ndef foo(n, R, r):\n    if R < r:\n        return False\n    if n == 1:\n        return True\n    if r == R:\n        return False\n\n    if r == R - r:\n        return n <= 2\n\n    if r > R - r:\n        return False\n\n    a = math.asin(float(r) / (R - r)) * 2.0\n    return 2.0 * math.pi + 1e-9 >= a * n\n\nn, R, r = map(int, raw_input().split())\nprint ['NO', 'YES'][foo(n, R, r)]\n", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "94e8d35e59f0eadff25b6b4fcccf1c80", "src_uid": "2fedbfccd893cde8f2fab2b5bf6fb6f6", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def debin(s):\r\n    ret = 0\r\n    mn = 1\r\n    for i in range(len(s)-1,-1,-1):\r\n        ret += int(s[i]) * mn\r\n        mn *=2\r\n    return ret\r\nst = set()\r\ndef ch(x,y,deep):\r\n    if x in st:\r\n        return 0\r\n    st.add(x)\r\n    if x == y:\r\n        return 1\r\n    if deep == 150:\r\n        return 0\r\n    s = bin(x)[2:]\r\n    if ch(debin(s[::-1]),y,deep+1) or ch(debin('1' + s[::-1]),y,deep+1):\r\n        return 1\r\n    return 0\r\n\r\nx, y = map(int, input().split())\r\nif ch(x,y,0):\r\n    print(\"YES\")\r\nelse:\r\n    print(\"NO\")\r\n", "lang_cluster": "Python", "tags": ["dfs and similar", "constructive algorithms", "math", "bitmasks", "strings", "implementation"], "code_uid": "b58a5820de2a2dd4f268b32231935f28", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#!/usr/bin/env python3\r\n# from typing import *\r\n\r\nimport sys\r\nimport io\r\nimport math\r\nimport collections\r\nimport decimal\r\nimport itertools\r\nimport bisect\r\nimport heapq\r\n\r\n\r\ndef input():\r\n    return sys.stdin.readline()[:-1]\r\n\r\n\r\nsys.setrecursionlimit(1000000)\r\n\r\n# _INPUT = \"\"\"8935891487501725 71487131900013807\r\n# \"\"\"\r\n# sys.stdin = io.StringIO(_INPUT)\r\n\r\nINF = 10**10\r\n\r\nYES = 'YES'\r\nNO = 'NO'\r\n\r\ndef dfs(s, SY):\r\n    if s == SY:\r\n        return True\r\n    n = int(s)\r\n    if n in ng:\r\n        return False\r\n    if len(s) > 100:\r\n        return False\r\n    ng.add(n)\r\n    # print(n)\r\n    for s1 in [str(int(s[::-1])), (s+'1')[::-1]]:\r\n        if s1 in ng:\r\n            continue\r\n        if dfs(s1, SY):\r\n            return True\r\n    return False\r\n\r\n\r\nng = set()\r\n\r\ndef solve(X, Y):\r\n    if X == Y:\r\n        return 'YES'\r\n    \r\n    SX = bin(X)[2:]\r\n    SY = bin(Y)[2:]\r\n\r\n    if dfs(SX, SY):\r\n        return 'YES'\r\n\r\n    return 'NO'\r\n\r\nX, Y = map(int, input().split())\r\nprint(solve(X, Y))", "lang_cluster": "Python", "tags": ["dfs and similar", "constructive algorithms", "math", "bitmasks", "strings", "implementation"], "code_uid": "d341aff596a8c42e9eabc8c51b598d9d", "src_uid": "9f39a3c160087beb0efab2e3cb510e89", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def digit(x):\n    return x if x<10 else x//10+9-(0 if str(x)[0]<=str(x)[-1] else 1)\nl,r = map(int,input().split())\nprint(digit(r) - digit(l-1))", "lang_cluster": "Python", "tags": ["binary search", "dp", "combinatorics"], "code_uid": "be285fd00697a5daa227c40fbfd8bb00", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "l,r=map(int,raw_input().split())\ndef get(x): return x if x<10 else (x/10+8+(0 if str(x)[0]>str(x)[-1] else 1))\nprint get(r)-get(l-1)", "lang_cluster": "Python", "tags": ["binary search", "dp", "combinatorics"], "code_uid": "cbb3b38d50d27451bdfe8613cb683287", "src_uid": "9642368dc4ffe2fc6fe6438c7406c1bd", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# import sys \n# sys.stdin=open(\"input.in\",'r')\n# sys.stdout=open(\"out1.out\",'w')\na,b=map(int,input().split())\ni=1\nwhile True:\n\tif i%2!=0:\n\t\tif a<i:\n\t\t\tprint(\"Vladik\")\n\t\t\tbreak\n\t\ta-=i\n\telse:\n\t\tif b<i:\n\t\t\tprint(\"Valera\")\n\t\t\tbreak\n\t\tb-=i\n\ti+=1\t\t\t\n\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "9a61c079ea554026a7f0f5c44c32c73a", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\narr = input().split()\na = int(arr[0])\nb = int(arr[1])\n\ni = 1\nwhile a >= 0 and b >= 0:\n\tif i % 2 == 0:\n\t\tb -= i\n\telse:\n\t\ta -= i\n\ti += 1\n\nif a < 0:\n\tprint('Vladik')\nelse:\n\tprint('Valera')", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "9c17dc7787e1fdce3efbc7f13843a50e", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\np = list(map(int,input().split()))\nt = int(input())\np.sort()\nans = 0\ni = 0\nfor j in range(n):\n    while p[j]-p[i]>t:\n        i=i+1\n    ans=max(ans,j-i+1)\nprint(ans)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "binary search"], "code_uid": "2dae9d1cf52ae5209185ba6f2b5833c5", "src_uid": "086d07bd6f9031df09bd6a6e8fe8f25c", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nm = list(map(int, input().split()))\nt = int(input())\nm.sort()\nif n == 1 or len(m) == 1:\n    print(1)\nelif m[-1]-m[0] <= t:\n    print(n)\nelse:\n    mx = 1\n    for i in range(n-1):\n        ma = 1\n        fr = m[i]\n        for j in range(i+1, n):\n            if m[j]-fr <= t:\n                ma += 1\n            else:\n                break\n        mx = max(ma, mx)\n    print(mx)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "binary search"], "code_uid": "56c6751974f82a6fee1a0feda9d9d845", "src_uid": "086d07bd6f9031df09bd6a6e8fe8f25c", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a1,b1=map(int,raw_input().split())\na2,b2=map(int,raw_input().split())\na3,b3=map(int,raw_input().split())\nif (a2+a3<=a1 and max(b2,b3)<=b1):\n\tprint \"YES\"\nelif (a2+a3<=b1 and max(b2,b3)<=a1):\n\tprint \"YES\"\nelif (a2+b3<=a1 and max(b2,a3)<=b1):\n\tprint \"YES\"\nelif (a2+b3<=b1 and max(b2,a3)<=a1):\n\tprint \"YES\"\nelif (a3+b2<=a1 and max(a2,b3)<=b1):\n\tprint \"YES\"\nelif (a3+b2<=b1 and max(a2,b3)<=a1):\n\tprint \"YES\"\nelif (b2+b3<=(a1) and max(a2,a3)<=(b1)):\n\tprint \"YES\"\nelif (b2+b3<=(b1) and max(a2,a3)<=(a1)):\n\tprint \"YES\"\nelse:\n\tprint \"NO\"", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "a90c71514d531fc57852982aa669c4de", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x, y = map(int, input().split())\na, b = map(int, input().split())\nc, d = map(int, input().split())\n\ndef solve():\n  for X, Y in [(x, y), (y, x)]:\n    for A, B in [(a, b), (b, a)]:\n      for C, D in [(c, d), (d, c)]:\n        if A + C <= X and max(B, D) <= Y:\n          return 'YES'\n  return 'NO'\n\nprint(solve())\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation"], "code_uid": "9656f64464844ce39a26eee81633c2d8", "src_uid": "2ff30d9c4288390fd7b5b37715638ad9", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "N = int(input())\ns1 = [list(input()) for i in range(N)]\ns2 = [list(input()) for i in range(N)]\n\ndef rotate(s):\n    ret = [[None for i in range(N)] for j in range(N)]\n    for i in range(N):\n        for j in range(N):\n            ret[i][j] = s[j][N-1-i]\n    return ret\n\ndef v_mirror(s):\n    return list(reversed(s))\n\ndef h_mirror(s):\n    return [list(reversed(row)) for row in s]\n\ndef solve():\n    global s1\n    for i in range(4):\n        if s1 == s2: return True\n        if v_mirror(s1) == s2: return True\n        if h_mirror(s1) == s2: return True\n        if v_mirror(h_mirror(s1)) == s2: return True\n        s1 = rotate(s1)\n    return False\n\nprint('Yes' if solve() else 'No')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "1cbe275b5bb68649e5bc799f076f4c48", "src_uid": "2e793c9f476d03e8ba7df262db1c06e4", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import stdin\n\n\nn = int(stdin.readline())\n\n\ndef eq(m1, m2):\n    for i in range(n):\n        if m1[i] != m2[i]:\n            return False\n    return True\n\n\ndef fleq(m1, m2):\n    return eq(m1, m2) or eq(m1, fliph(m2)) or eq(m1, flipv(m2))\n\n\ndef fliph(m):\n    return [row[::-1] for row in m]\n\n\ndef flipv(m):\n    return m[::-1]\n\n\ndef rot(m):\n    mr = ['' for _ in range(n)]\n    for i in range(n):\n        x = ''\n        for j in range(n):\n            x = x + m[j][n-i-1]\n        mr[i] = x\n    return mr\n\n\nu = [stdin.readline()[:-1] for _ in range(n)]\nv = [stdin.readline()[:-1] for _ in range(n)]\nv90 = rot(v)\nv180 = rot(v90)\nv270 = rot(v180)\n\nif fleq(u, v) or fleq(u, v90) or fleq(u, v180) or fleq(u, v270):\n    print('Yes')\nelse:\n    print('No')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "9d27d05aed02a71708871ee3cb83d9a9", "src_uid": "2e793c9f476d03e8ba7df262db1c06e4", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def add(a,b):\n    if a+b>=mod:\n        return (a+b)%mod\n    return a+b\nn=int(input())*2\ns=input()\nd=[[0,0] for i in range(len(s)+1)]\naux=''\nfor i in range(len(s)):\n    if s[i]=='(':\n        d[i][1]=i+1\n        x=aux+')'\n        for j in range(1,i+2):\n            if x[j::] ==s[0:len(x)-j]:\n                d[i][0]=len(x[j::])\n                break\n    else:\n        d[i][0]=i+1\n        x=aux+'('\n        for j in range(1,i+2):\n            if x[j::]  ==s[0:len(x)-j]:\n                d[i][1]=len(x[j::])\n                break\n    aux+=s[i]\nd[len(s)][1]=len(s)\nd[len(s)][0]=len(s)\ndp=[[[0 for i in range(len(s)+1)] for j in range(n//2+1)] for k in range(n+1)]\ndp[0][0][0]=1\nmod=10**9+7\nfor i in range(n):\n    for j in range(1,(n//2)+1):\n        for k in range(len(s)+1):\n            dp[i+1][j-1][d[k][0]]=(dp[i][j][k]+dp[i+1][j-1][d[k][0]])%mod\n    for j in range(n//2):\n        for k in range(len(s)+1):\n            dp[i+1][j+1][d[k][1]]=(dp[i][j][k]+dp[i+1][j+1][d[k][1]])%mod\nprint(dp[n][0][len(s)]%mod)\n", "lang_cluster": "Python", "tags": ["strings", "dp"], "code_uid": "2f8a2cf8dd626a542bc5a0e22ac403d9", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def add(a,b):\n    if a+b>=mod:\n        return (a+b)%mod\n    return a+b\nn=int(input())*2\ns=input()\nd=[[0,0] for i in range(len(s)+1)]\naux=''\nfor i in range(len(s)):\n    if s[i]=='(':\n        d[i][1]=i+1\n        x=aux+')'\n        for j in range(1,i+2):\n            if x[j::] ==s[0:len(x)-j]:\n                d[i][0]=len(x[j::])\n                break\n    else:\n        d[i][0]=i+1\n        x=aux+'('\n        for j in range(1,i+2):\n            if x[j::]  ==s[0:len(x)-j]:\n                d[i][1]=len(x[j::])\n                break\n    aux+=s[i]\nd[len(s)][1]=len(s)\nd[len(s)][0]=len(s)\ndp=[[[0 for i in range(len(s)+1)] for j in range(n//2+1)] for k in range(n+1)]\ndp[0][0][0]=1\nmod=10**9+7\nfor i in range(n):\n    for j in range(1,(n//2)+1):\n        for k in range(len(s)+1):\n            dp[i+1][j-1][d[k][0]]=add(dp[i][j][k],dp[i+1][j-1][d[k][0]])\n    for j in range(n//2):\n        for k in range(len(s)+1):\n            dp[i+1][j+1][d[k][1]]=add(dp[i][j][k],dp[i+1][j+1][d[k][1]])\nprint(dp[n][0][len(s)]%mod)\n", "lang_cluster": "Python", "tags": ["strings", "dp"], "code_uid": "9178c22a79fa2a9644688fa1b16ac860", "src_uid": "590a49a7af0eb83376ed911ed488d7e5", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m=map(int,input().split())\nfr=m-1\nsr=n-m\nans=0\nif(fr<sr):\n    ans=m+1\nelse:\n    ans=m-1\nif(n==1):\n    ans=1\nprint(ans)", "lang_cluster": "Python", "tags": ["constructive algorithms", "games", "math", "greedy", "implementation"], "code_uid": "ad69fe0fac0faeddcfab23599c26f39e", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "b,a=map(int,input().split())\nprint(max(1,a-1 if (a-2) >= (b-(a+1)) else a+1))", "lang_cluster": "Python", "tags": ["constructive algorithms", "games", "math", "greedy", "implementation"], "code_uid": "445da5d62abdb5de5e0f16d0b551e791", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "data = [int(info) for info in input().split(' ')]\n\nmid = data[0]\nma = max(data)\nmi = min(data)\n\nfor i in data:\n\tif i < ma and i > mi:\n\t\tmid = i\n\nprint((ma - mid) + (mid - mi))\n\n", "lang_cluster": "Python", "tags": ["math", "sortings", "implementation"], "code_uid": "7e7ebedb71410b1430534c0e18226c28", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x = map(int, raw_input().split())\nx = sorted(x)\nprint (x[1] - x[0]) + (x[2] - x[1])", "lang_cluster": "Python", "tags": ["math", "sortings", "implementation"], "code_uid": "cde6f91358464f289fcc9b3dab6a0190", "src_uid": "7bffa6e8d2d21bbb3b7f4aec109b3319", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "w1, h1, w2, h2 = map(int, input().split())\nans = (w1 + 2) + h1 + (h2 + 1) + (w2 + 1) + h2 + h1 + w1 - w2\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "b5b5864c40839c90c9b766c1a80c69f0", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\n\n\nw1,h1,w2,h2 = [ int(i) for i in input().split(\" \")]\n\ntotal = 4 + w1 + w2 + 2 * h1 + 2 * h2 + (w1 - w2 ) \n\n\nprint(total)\n\n\n\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "50300669752a4c4d56b291e90c19e584", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from itertools import product\n\ns1 = sum([1 if i == '+' else -1 for i in raw_input()])\ns2 = raw_input()\nq = s2.count('?')\nx = []\nif q:\n    s2 = s2.replace('?', '')\n    for j in set(product('-+', repeat=q)):\n        j = ''.join(j)\n        x.append(sum([1 if i == '+' else -1 for i in j + s2]))\n    a = len(x)\n    print float(len(filter(lambda y: y == s1, x))) / float(a)\nelse:\n    x = sum([1 if i == '+' else -1 for i in s2])\n    if x == s1:\n        print 1\n    else:\n        print 0", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "combinatorics", "bitmasks", "probabilities"], "code_uid": "eef3ede88c3b33e6c4cd02bc97ea9e19", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def getLine():\n    return list(map(int,input().split()))\n\ndef val(s,c):\n    \n    ssum = 0\n    ssum+=s.count('+')\n    ssum-=s.count('-')\n\n    return ssum\n\ndef val2(s,c):\n    ssum = 0\n    ssum+=s.count('1')\n    ssum-=s.count('0')\n\n    ssum-=(c - len(s))\n\n    return ssum\n\ndef main():\n    send = input()\n    recv = input()\n\n    needed_val = val(send,len(send))\n    rval = val(recv,len(recv))\n\n    \n    # print(send)\n    if '?' not in recv:\n        if needed_val== rval:\n            print(1)\n            return\n        else:\n            print(0)\n            return\n\n    ques = recv.count('?')\n    fav = 0\n    \n    # print(needed_val, rval)\n    for i in range(2**ques):\n        tmp = val2(bin(i)[2:],ques) + rval   \n        # print(tmp) \n        # print(tmp)    \n        if tmp == needed_val:\n            fav+=1\n        \n            \n    # print(fav)\n    print(fav/pow(2,ques))\n    \n\n\nmain()", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "combinatorics", "bitmasks", "probabilities"], "code_uid": "9148062c140a4c435153fd751aa205f4", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n\tw, m = map(int, input().split())\n\twhile m > 1:\n\t\tc = m % w\n\t\tif c not in {0, 1, w - 1}:\n\t\t\treturn print('NO')\n\t\tm //= w\n\t\tif c == w - 1:\n\t\t\tm += 1\n\tprint('YES')\nmain()", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "meet-in-the-middle", "greedy", "number theory"], "code_uid": "f0f517ffb15cf68e8499eac3be06c651", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "w,m=map(int,input().split())\n\ndef f(m,w):\n    while m!=0:\n        x=(m+1)%w\n        if x==0:\n            m=(m+1)//w\n        elif x<3:\n            m=m//w\n        else:\n            return False\n        \n    return True\nif w==2:\n    print(\"YES\")\nelif f(m,w):\n    print(\"YES\")\nelse:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "meet-in-the-middle", "greedy", "number theory"], "code_uid": "fa382824a94cd104da08dd8872361aea", "src_uid": "a74adcf0314692f8ac95f54d165d9582", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "chess=[]*8;\nfor i in range(8):a=input();chess.append(a)\nR=chess.count(\"WBWBWBWB\");D=chess.count(\"BWBWBWBW\");counter=R+D\nif(counter is 8):print(\"YES\")\nelse:print(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "strings"], "code_uid": "13d51836071da129623103344deb7dcb", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def solve(board):\n  for row in board:\n    for i in range(1, 8):\n      if row[i] == row[i-1]:\n        return False\n  return True\n\nboard = [raw_input() for i in range(8)]\nprint 'YES' if solve(board) else 'NO'\n", "lang_cluster": "Python", "tags": ["brute force", "strings"], "code_uid": "2c4dec721de92f0a5e198e1b44bde5de", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = input()\nb = int(input())\nlst = sorted(a)\nc = 0\nfor i in range(len(lst)):\n    for j in range(len(lst) - 1, i - 1, -1):\n        x = lst[:i] + [lst[j]] + sorted(lst[i:j]) + lst[j + 1:]\n        \n        if int(''.join(x)) <= b and int(''.join(x)) > c:\n            c = int(''.join(x))\n            lst = x\nprint(int(''.join(lst)))\n", "lang_cluster": "Python", "tags": ["greedy", "dp"], "code_uid": "8d56089e0bc0ac1b9f0a883bad3421d6", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from collections import Counter\n\ndef max_num(a,b):\n    if len(b) > len(a):\n        val=''.join(sorted(a, reverse=True))\n        return int(val)\n    else:\n        # int_a=int(''.join(sorted(a)))\n        # int_b=int(''.join(b))\n        # for i in range(int_b,int_a-1,-1):\n        #     # print(str(i),str(int_a))\n        #     if Counter(str(i)) == Counter(str(''.join(a))):\n        #         return i\n        res=''\n        for i in b:\n            if i in a:\n                a.remove(i)\n                if ''.join(b[len(res)+1:]) >= ''.join(sorted(a)):\n                    res+=i\n                else:\n                    a.append(i)\n                    break\n            else:\n                break\n        # print(res)\n        # return res\n        new_b=b[len(res):]\n        if new_b==[]:\n            return res\n\n        for i in new_b:\n            for j in range(int(i)-1,-1,-1):\n                if str(j) in a:\n                    a.remove(str(j))\n                    return res+str(j)+''.join(sorted(a, reverse=True))\n\na=list(input())\nb=list(input())\nprint(max_num(a,b))\n", "lang_cluster": "Python", "tags": ["greedy", "dp"], "code_uid": "86f52409c8c82ad993afe8da78e4d681", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\ntwopow128 = 2**128-1\ndef bp(a, n):\n\tres = 1\n\twhile n:\n\t\tif (n & 1):\n\t\t\tres *= a\n\t\t\tres %= twopow128\n\t\ta *= a\n\t\ta %= twopow128\n\t\tn >>= 1\n\treturn res\n\nk,b,n,t=sys.stdin.readline().split(' ')\nk,b,n,t=int(k),int(b),int(n),int(t)\nif t==1:\n\tprint n\n\tsys.exit(0)\nkn=bp(k,n)\nkxt=kn*t\nknn=kn\nx=n\nwhile x>=0:\n\tif (kxt < knn): break\n\tknn+=(kn/k)*b\n\tkn/=k\n\tkxt/=k\n\tx-=1\nprint x+1\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "f29948316c2b440776945f9fe18a0b16", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "k,b,n,t = map(int,raw_input().split())\ndef get_p():\n\tglobal k,b,n,t,z\n\tif k == 1:\n\t\tz = 1 + n * b\n\t\tif t >= z:\n\t\t\treturn 0\n\t\treturn   (z-t)/b if (z-t)%b==0 else(z-t)/b+1\n\ttt =  (k-1) + b\n\tz = t * (k-1) + b\n#\tprint tt,z\n\tans = 0\n\tfor i in range(0,n+1):\n\t\tif (tt * (k ** i) <= z):\n\t\t\tans = i\n\t\telse:\n\t\t\tbreak\n\treturn max(n - ans,0)\nprint get_p()\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "326e95079bb48ab4e89bcfd52532ed1e", "src_uid": "e2357a1f54757bce77dce625772e4f18", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\n#Problem Name : 11B - Jumping Jack\n#Execution Time : 124 ms\n#Memory : 0 KB\nn = abs(int(raw_input()))\n\nsoma = 0\nk = 1\nwhile soma < n or soma%2 != n%2:\n    soma += k\n    k += 1\n    \nprint k-1", "lang_cluster": "Python", "tags": ["math"], "code_uid": "133498458a2564f6c60714d6538e7f17", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def numberOfJumps(n):\n    n = abs(n)\n    j = 0\n    while True:\n        s = j*(j+1)/2\n        if s >= n and not (s - n)%2:\n            break\n        j += 1\n    return j\n\ni = int(raw_input())\nprint numberOfJumps(i)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "8be54f50352d178b9cf7e30368c6383d", "src_uid": "18644c9df41b9960594fdca27f1d2fec", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def solve(str,n,k):\n    g=str.index('G')\n    t=str.index('T')\n    if g>t:\n        for i in range(t,g+1,k):\n            if str[i]=='G':\n                return True\n            if str[i]=='#':\n                return False\n    else:\n        for i in range(g,t+1,k):\n            if str[i]=='T':\n                return True\n            if str[i]=='#':\n                return False\n    return False\n            \n\nstrnk=(input())\nstr1=strnk.split(\" \")\nn=int(str1[0])\nk=int(str1[1])\nstr=input()\nif solve(str,n,k)==True:\n    print(\"YES\")\nelse:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "bc8b90acd75486e9e69b22c789639f0a", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, k = map(int, input().split())\na = input()\ng = 1\nl, r = a.index('G'), a.index('T')\nif l > r:\n    l, r = r, l\nwhile l + k<= r:\n    if a[l] == '#':\n        g = 0\n    l += k\nif l == r and g:\n    print('YES')\nelse:\n    print('NO')", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "322904c72ca840c13ef47de4343f5a99", "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def ListToString(x):\n    string1 = \"\"\n    return (string1.join(x))\n\nnumindex = []   \nx = input()\nnums = [int(n) for n in x.split()]\nletters = str(input())\nletterlist = list(letters)\n\nfor i in range (0, nums[1], 1):\n    for j in range (0, nums[0]-1, 1):\n        if (letterlist[j] == \"B\" and letterlist[j + 1] == \"G\"):\n            # temp = letterlist[j]\n            # letterlist[j] = letterlist[j+1]\n            # letterlist[j+1] = temp\n            numtemp = j\n            numindex.append(numtemp)\n        else:\n            continue\n    for k in range (0, len(numindex), 1):\n        temp = letterlist[numindex[k]]\n        letterlist[numindex[k]] = letterlist[numindex[k] + 1]\n        letterlist[numindex[k] + 1] = temp\n    numindex.clear()\n\nprint(ListToString(letterlist))\n\n\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "d56b8666e143e1c29d006069f64334ad", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input().split()\nn = int(s[0])\nt = int(s[1])\n\ns = raw_input()\na = []\nfor i in s:\n\ta+= [i]\n\nwhile t > 0:\n\tj = 0\n\twhile j < len(s)-1:\n\t\tif a[j] == 'B' and a[j+1] == 'G':\n\t\t\ta[j+1] = 'B'\n\t\t\ta[j] = 'G'\n\t\t\tj +=1\n\t\tj += 1\n\n\tt -= 1\nt =\"\"\nfor i in a:\n\tt += i\n# test code\nprint t", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation", "shortest paths", "graph matchings"], "code_uid": "a91592f911dd32992598f3c219ea5432", "src_uid": "964ed316c6e6715120039b0219cc653a", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "N, K = map(int, input().split())\npre = [input()]\nans = 0\nk = 1\nf = 0\nwhile True:\n    if k >= K:\n        print(ans)\n        break\n    if len(pre) == 0:\n        print(-1)\n        break\n    post = []\n    for s in pre:\n        for i in range(len(s)):\n            t = s[:i] + s[i+1:]\n            if t not in post:\n                k += 1\n                post.append(t)\n                ans += N-len(t)\n                if k >= K:\n                    print(ans)\n                    f = 1\n                    break\n        if f:\n            break\n    if f:\n        break\n    pre = post", "lang_cluster": "Python", "tags": ["dp", "implementation", "graphs", "shortest paths"], "code_uid": "b08e09bb9f11f03be5937f9e24e82d02", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin, stdout, exit\n\n\ndef price():\n    n,k = map(int, stdin.readline().split())\n    s = stdin.readline().strip()\n\n    todo = [s]\n    ans = 0\n    found = {s:True}\n    k -= 1\n    while todo and k > 0:\n        nexts = []\n    #    print(todo)\n        for wd in todo:\n            for i in range(len(wd)):\n                candidate = wd[:i] + wd[i+1:]\n    #            print(candidate)\n                if candidate not in found:\n                    nexts.append(candidate)\n                    found[candidate] = True\n                    ans += n - len(candidate)\n                    k-=1\n                    if k == 0:\n                        return ans\n        todo = nexts\n    if k == 0:\n        return ans\n    return -1\n\nprint(price())\n", "lang_cluster": "Python", "tags": ["dp", "implementation", "graphs", "shortest paths"], "code_uid": "b48143862260adcd1c104b4caa31a25a", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\nfrom collections import defaultdict, Counter\nfrom itertools import permutations, combinations\nfrom math import sin, cos, asin, acos, tan, atan, pi\n\nsys.setrecursionlimit(10 ** 6)\n\ndef pyes_no(condition, yes = \"YES\", no = \"NO\", none = \"-1\") :\n  if condition == None:\n    print (none)\n  elif condition :\n    print (yes)\n  else :\n    print (no)\n\ndef plist(a, s = ' ') :\n  print (s.join(map(str, a)))\n\ndef rint() :\n  return int(sys.stdin.readline())\n\ndef rstr() :\n  return sys.stdin.readline().strip()\n\n\ndef rints() :\n  return map(int, sys.stdin.readline().split())\n\ndef rfield(n, m = None) :\n  if m == None :\n    m = n\n  \n  field = []\n  for i in xrange(n) :\n    chars = sys.stdin.readline().strip()\n    assert(len(chars) == m)\n    field.append(chars)\n  return field\n\ndef pfield(field, separator = '') :\n  print ('\\n'.join(map(lambda x: separator.join(x), field)))\n\ndef check_field_equal(field, i, j, value) :\n  if i >= 0 and i < len(field) and j >= 0 and j < len(field[i]) :\n    return value == field[i][j]\n  return None \n\ndef digits(x, p) :\n  digits = []\n  while x > 0 :\n    digits.append(x % p)\n    x //= p\n  return digits[::-1]\n\ndef undigits(x, p) :\n  value = 0\n  for d in x :\n    value *= p\n    value += d\n  return value\n\ndef modpower(a, n, mod) :\n  r = a ** (n % 2)\n  if n > 1 :\n    r *= modpower(a, n // 2, mod) ** 2\n  return r % mod\n\ndef gcd(a, b) :\n  if a > b :\n    a, b = b, a\n  \n  while a > 0 :\n    a, b = b % a, a\n\n  return b\n\ndef vector_distance(a, b) :\n  diff = vector_diff(a, b)\n  \n  return scalar_product(diff, diff) ** 0.5\n\ndef vector_inverse(v) :\n  r = [-x for x in v]\n\n  return tuple(r)\n\ndef vector_diff(a, b) :\n  return vector_sum(a, vector_inverse(b))\n\ndef vector_sum(a, b) :\n  r = [c1 + c2 for c1, c2 in zip(a, b)]\n    \n  return tuple(r)\n\ndef scalar_product(a, b) :\n  r = 0\n  for c1, c2 in zip(a, b) :\n    r += c1 * c2\n\n  return r\n\ndef check_rectangle(points) :\n  assert(len(points) == 4)\n\n  A, B, C, D = points\n\n  for A1, A2, A3, A4 in [\n    (A, B, C, D),\n    (A, C, B, D),\n    (A, B, D, C),\n    (A, C, D, B),\n    (A, D, B, C),\n    (A, D, C, B),\n  ] :\n    sides = (\n      vector_diff(A1, A2),\n      vector_diff(A2, A3),\n      vector_diff(A3, A4),\n      vector_diff(A4, A1),\n    )\n    if all(scalar_product(s1, s2) == 0 for s1, s2 in zip(sides, sides[1:])) :\n       return True\n  return False\n\ndef check_square(points) :\n  if not check_rectangle(points) :\n    return False\n  A, B, C, D = points\n\n  for A1, A2, A3, A4 in [\n    (A, B, C, D),\n    (A, C, B, D),\n    (A, B, D, C),\n    (A, C, D, B),\n    (A, D, B, C),\n    (A, D, C, B),\n  ] :\n    side_lengths = [\n      (first[0] - next[0]) ** 2 + (first[1] - next[1]) ** 2 for first, next in zip([A1, A2, A3, A4], [A2, A3, A4, A1])\n    ]\n    if len(set(side_lengths)) == 1 :\n      return True\n    \n  return False\n\ndef check_right(p) :\n  # Check if there are same points\n  for a, b in [\n    (p[0], p[1]),\n    (p[0], p[2]),\n    (p[1], p[2]),\n  ] :\n    if a[0] == b[0] and a[1] == b[1] :\n      return False\n\n  a, b, c = p\n  a, b, c = vector_diff(a, b), vector_diff(b, c), vector_diff(c, a)   \n\n  return scalar_product(a, b) * scalar_product(a, c) * scalar_product(b, c) == 0\n\ndef modmatrixproduct(a, b, mod) :\n  n, m1 = len(a), len(a[0])\n  m2, k = len(b), len(b[0])\n\n  assert(m1 == m2)\n  m = m1\n\n  r = [[0] * k for i in range(n)]\n  for i in range(n) :\n    for j in range(k) :\n      for l in range(m) :\n        r[i][j] += a[i][l] * b[l][j]\n      r[i][j] %= mod\n  return r\n\ndef modmatrixpower(a, n, mod) :\n  magic = 2\n  for m in [2, 3, 5, 7] :\n    if n % m == 0 :\n      magic = m\n      break\n\n  r = None\n  if n < magic : \n    r = a\n    n -= 1\n  else :\n    s = modmatrixpower(a, n // magic, mod)\n    r = s\n    for i in range(magic - 1) :\n      r = modmatrixproduct(r, s, mod)\n\n  for i in range(n % magic) : \n    r = modmatrixproduct(r, a, mod)\n  \n  return r\n\nk, n, w = rints()\n\nprice = k * w * (w + 1) / 2\n\nprint max(0, price - n)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "c81c1e8f77493a389dbd8e5977d247af", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "k,n,w=map(int,input().split())\ns=((2*k+k*(w-1))*w)//2\nif s>n:\n    print(s-n)\nelse:\n    print(0)", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "e7473071ceb253f02961d10696eeefe5", "src_uid": "e87d9798107734a885fd8263e1431347", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m=map(int,raw_input().split())\nco=[0 for i in xrange(101)]\nfor i in map(int,raw_input().split()): co[i] += 1\nf=False\nfor t in xrange(m, 0, -1):\n    have = 0\n    for i in co:\n        have += i / t\n    if have >= n:\n        f = True\n        ans = t\n        break\nif not f:\n    ans = 0\nprint ans\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "binary search"], "code_uid": "f0a3a37bd073d10bde6a6e3066612366", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    n, m = map(int, input().split())\n    if n > m:\n        print(0)\n        return\n    cnt = {}\n    for a in map(int, input().split()):\n        cnt[a] = cnt.get(a, 0) + 1\n    lo, hi = 1, 100\n    for _ in range(8):\n        mid, x = (lo + hi) // 2, n\n        for c in cnt.values():\n            x -= c // mid\n        if x > 0:\n            hi = mid\n        else:\n            lo = mid + 1\n    print(lo - 1)\n\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "binary search"], "code_uid": "81c071d31188e01a4ff829cf7c79e382", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "t=input().split()\na=t[0][0]\nb=t[0][1]\n# print(a)\n# print(b)\n\n# a=set(t)\n# for i in t:\n\n\n\n# print(t)\ns=input()\n# print(s)\nif a in s:\n\tprint(\"YES\")\nelif b in s:\n\tprint(\"YES\")\nelse:\n\tprint(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "b05f669b3301b62f96638c7011e055fd", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "suit=input('')\nsuit=suit.upper()\nc1,c2,c3,c4,c5=input( ).split(\" \")\nif suit[0]==c1[0]or suit[1]==c1[1] or suit[0]==c1[1] or suit[1]== c1[0]:\n    print(\"YES\")\nelif suit[0] == c2[0] or suit[1] == c2[1] or suit[0]==c2[1] or suit[1]== c2[0]:\n    print(\"YES\")\nelif suit[0] == c3[0] or suit[1] == c3[1] or suit[0]==c3[1] or suit[1]== c3[0]:\n    print(\"YES\")\nelif suit[0] == c4[0] or suit[1] == c4[1] or suit[0]==c4[1] or suit[1]== c4[0]:\n    print(\"YES\")\nelif suit[0] == c5[0] or suit[1] == c5[1] or suit[0]==c5[1] or suit[1]== c5[0]:\n    print(\"YES\")\nelse:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "e829ae8cba20ae25906e8a53be374d0d", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n = int(raw_input())\n\ndef prime(n):\n\tif n<=3:\n\t\treturn True\n\telse:\n\t\tfor i in range(2,int(n**(0.5))+1):\n\t\t\tif n % i == 0:\n\t\t\t\treturn False\n\t\treturn True\n\nif prime(n):\n\tprint 1\nelif n % 2 == 0:\n\tprint 2\nelif prime(n-2):\n\tprint 2\nelse:\n\tprint 3", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "764559730739470e38745f99e3fb3c3a", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\"\"\"\n                            pppppppppppppppppppp\n                         ppppp  ppppppppppppppppppp\n                      ppppppp    ppppppppppppppppppppp\n                      pppppppp  pppppppppppppppppppppp\n                      pppppppppppppppppppppppppppppppp\n                              pppppppppppppppppppppppp\n       ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp\n      pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp\n     ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp\n    ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp\n   pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp\n  ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp\n  pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp\n  pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp\n  ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp\n    pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp\n     ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp\n      pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp\n       ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp\n                              pppppppppppppppppppppppp\n                              pppppppppppppppppppppppppppppppp\n                              pppppppppppppppppppppp  pppppppp\n                              ppppppppppppppppppppp    ppppppp\n                                 ppppppppppppppppppp  ppppp\n                                    pppppppppppppppppppp\n\"\"\"\n\n\nimport sys\nfrom functools import lru_cache, cmp_to_key\nfrom heapq import merge, heapify, heappop, heappush, nsmallest\nfrom math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf\nfrom collections import defaultdict as dd, deque, Counter as C\nfrom itertools import combinations as comb, permutations as perm\nfrom bisect import bisect_left as bl, bisect_right as br, bisect\nfrom time import perf_counter\nfrom fractions import Fraction\nfrom decimal import Decimal\n# sys.setrecursionlimit(pow(10, 6))\n# sys.stdin = open(\"input.txt\", \"r\")\n# sys.stdout = open(\"output.txt\", \"w\")\nmod = pow(10, 9) + 7\nmod2 = 998244353\ndef data(): return sys.stdin.readline().strip()\ndef out(var): sys.stdout.write(str(var))\ndef outa(*var, end=\"\\n\"): sys.stdout.write(' '.join(map(str, var)) + end)\ndef l(): return list(sp())\ndef sl(): return list(ssp())\ndef sp(): return map(int, data().split())\ndef ssp(): return map(str, data().split())\ndef l1d(n, val=0): return [val for i in range(n)]\ndef l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]\n\n\ndef prime(number):\n    if number <= 1:\n        return False\n    if number == 2:\n        return True\n    if not(number & 1):\n        return False\n    temp = 2\n    while temp * temp <= number:\n        if number % temp == 0:\n            return False\n        temp += 1\n    return True\n\n\nn = int(data())\nif prime(n):\n    out(1)\n    exit()\nif not(n & 1):\n    out(2)\n    exit()\nif prime(n-2):\n    out(2)\n    exit()\nout(3)\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "529ec2f1d7cb6957c64ac0452047b9f1", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def mask(num):\n\ts = list(num)\n\tres = []\n\tfor c in s:\n\t\tif c == '4' or c == '7':\n\t\t\tres.append(c)\n\treturn ''.join(res)\n\nif __name__ == \"__main__\":\n\ta, b = [s for s in raw_input().split(\" \")]\n\tres = -1\n\tx = a\n\twhile res == -1:\n\t\tx = str(int(x) + 1)\n\t\tm = mask(x)\n\t\tif m == b:\n\t\t\tres = x\n\tprint res\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "5b0111672248e2153cd8cacb0ecd5e0f", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b = [int(x) for x in raw_input().split(\" \")]\nwhile 1:\n    a=a+1\n    ap=a\n    for rag in range(4),range(5,7),range(8,10):\n        for c in [str(y) for y in rag]:\n            ap = str(ap).replace(c,\"\")\n    if ap == \"\": ap = \"0\"\n    if int(ap) == b:\n        print a\n        break\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "4ad1006c6e6191217dc28e20db305944", "src_uid": "e5e4ea7a5bf785e059e10407b25d73fb", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def main():\n    n, m = map(int, raw_input().split())\n    mod = 1000000007\n    s, r = 1, 0\n    for i in xrange(n):\n        s, r = (s * 2 - r) * m % mod, (r * (m - 1) + s) % mod\n    print s\nmain()\n", "lang_cluster": "Python", "tags": ["combinatorics"], "code_uid": "814e1028228ce38bfcc35acf7d004488", "src_uid": "5b775f17b188c1d8a4da212ebb3a525c", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "mod=10**9+7 \ninn=raw_input()\nn,m=inn.split(' ')\nm=int(m)\nn=int(n)\nres=m+m\npow=m\nfor i in xrange(1,n):\n    res=(m+m-1)*res+pow\n    res%=mod\n    pow=pow*m%mod\nprint res\n", "lang_cluster": "Python", "tags": ["combinatorics"], "code_uid": "df6ac779823b495839d21dcbcd85c7be", "src_uid": "5b775f17b188c1d8a4da212ebb3a525c", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, k = map(int, raw_input().strip().split())\nif (n / k) % 2 == 1:\n    print \"YES\"\nelse:\n    print \"NO\"\n", "lang_cluster": "Python", "tags": ["math", "games"], "code_uid": "beaa5aced25a0934572806446aa9b107", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,k=map(int,raw_input().split())\nr=n/k\nif r%2==1:\n    print \"YES\"\nelse:\n    print \"NO\"\n", "lang_cluster": "Python", "tags": ["math", "games"], "code_uid": "f66ce29fc7118eebdf93ccc3ce863402", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "first = int (input ())\n\nnum = [first]\n\nvisit1 = 0\nwhile True :\n    \n\n    \n    if first == 1:\n        visit1 += 1\n    if visit1 == 2 :\n        break\n\n    first = first +1\n    while first % 10 == 0:\n        first = first //10\n    \n    if first not in num:\n        num.append(first)\n    \n    \n    \n\n    \n\n#num.sort()\n#print (num)\nprint (len(num))\n    \n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "2b63465d16c05e5d176c56add334780f", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def Next(num):\n    num = int(num)\n    result = str(num + 1)\n    #print(result, result[len(result)-1])\n    while result[len(result)-1] == '0':\n        result = result[:-1]\n        #print(result, result[len(result)-1])\n    return result\n\nnum = input ()\ncount = 1\nwhile True:\n    if len(num) == 1:\n        if num == '0':\n            count = 10\n            break\n        else:\n            count = 9\n            break\n    #print(num)\n    else:\n        count += 1\n        num = Next(num)\n        #print(\"count = \", count)\n        if len(num) == 1:\n            count += 8\n            break\nprint(count)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "6d848840796695b8f7e1fa8b7ecb679a", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#In the name of Allah\n\nfrom sys import stdin, stdout\ninput = stdin.readline\n\nn, a, b, c = map(int, input().split())\ndp = [0] + [-float(\"inf\")] * n\n\nfor i in range(a, n + 1):\n         dp[i] = max(dp[i], dp[i - a] + 1)\n         \nfor i in range(b, n + 1):\n         dp[i] = max(dp[i], dp[i - b] + 1)\n         \nfor i in range(c, n + 1):\n         dp[i] = max(dp[i], dp[i - c] + 1)\n\nstdout.write(str(dp[n]))\n", "lang_cluster": "Python", "tags": ["brute force", "dp"], "code_uid": "c2bea59ff04b0bd3b8c12d17030b80ef", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,a,b,c=list(map(int,input().split()))\nans=1\nfor i in range(n+1):\n    for j in range(n+1):\n        k=n-a*i-b*j\n        if(k>=0 and k%c==0):\n            ans=max(ans,(i+j+k//c))\nprint(ans)", "lang_cluster": "Python", "tags": ["brute force", "dp"], "code_uid": "8191e2423c8d64bc563d5fd86796034a", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nc=1\nif c==1 :\n    d=str(n)\n    for i in range(1,100) :\n        n=n+1\n        n=str(n)\n        if str(n).count('8')>0 :\n            print(int(n)-int(d))\n            \n            c=0\n            break\n        n=int(n)\n    \n        \n    \n        \n    \n\n\n    \n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "c8b5deb3507b48c6d321f7654686ca6b", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a=int(input())\nif a>0 or a<=-9:\n    for i in range(a,10000000000000000000000):\n        k=i+1\n        k=str(k)\n        if '8' in k:\n            k=int(k)\n            print(k-a)\n            break\n        else:\n            continue\nelif -9<a<=0:\n    print(8-a)\n\n\n\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "dad69688dc79c9bc24a5095c94a24b4f", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "mod = 1000000009\n\ndef mpow(x, y):\n    if y == 0:\n        return 1\n    ans = mpow(x, y/2)\n    ans = (ans * ans) % mod\n    if y%2 > 0:\n        ans = (ans * x) % mod\n    return ans\n        \n\nn, m, k = map(int, raw_input().split())\nfr = n % k + (n/k)*(k - 1)\nif fr >= m:\n    ans = m\nelse:\n    a = m - fr\n    fr -= a*(k-1)\n    ans = mpow(2, a)\n    ans = (ans + mod - 1) % mod\n    ans = (ans * 2) % mod\n    ans = (ans * k) % mod\n    ans = (ans + fr) % mod\nprint ans", "lang_cluster": "Python", "tags": ["math", "binary search", "number theory", "greedy", "matrices"], "code_uid": "87e4463ec78511b37e23996ec53f2c7c", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m,k=map(int,raw_input().split())\nM=10**9+9\nx=max(n/k-n+m,0)\na=k*2*(pow(2,x,M) - 1)\nprint (a+m-k*x+M)%M", "lang_cluster": "Python", "tags": ["math", "binary search", "number theory", "greedy", "matrices"], "code_uid": "62a70dafdedb977a8eed2ff7848c98e6", "src_uid": "9cc1aecd70ed54400821c290e2c8018e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def main():\n    R=lambda:map(int,input().split())\n    n,k=R()\n    a=list(R())\n    m=n//k\n    ans=0\n    for i in range(k):\n        c=[n,0,0]\n        for j in range(m):\n            c[a[j*k+i]]+=1\n        ans+=min(c)\n    print(ans)\n\nmain()\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "8b8d4aa4d9decf1b3520e156a7f0afe3", "src_uid": "5f94c2ecf1cf8fdbb6117cab801ed281", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, k = map(int, raw_input().strip().split())\na = map(int, raw_input().strip().split())\n\nka = 0\net = [[0 for j in range(n/k)] for i in range(k)]\n\nfor i in range(k):\n    for j in range(n/k):\n        et[i][j] = a[i+k*j]\n\nfor i in range(k):\n    if len(set(et[i])) > 1:\n        ka = ka + min(et[i].count(1), et[i].count(2))\n\nprint ka", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "1e31cb626dacf938df73c5be36f4e016", "src_uid": "5f94c2ecf1cf8fdbb6117cab801ed281", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\nn=int(input())\na=[int(i) for i in input().split()]\nl=[]\nfor i in range(1,len(a)):\n    l.append(abs(a[i-1]-a[i]))\nif(len(set(l))==1):\n    if(a[1]>=a[0]):\n        print(a[len(a)-1]+(l[0]))\n    else:\n        print(a[len(a)-1]-l[0])\nelse:\n    print(a[len(a)-1])", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "3a752d0e1b868440fec4aa3e4f37be6d", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def checkAP(s):\n    d=s[1]-s[0]\n    for i in range(len(s)-1):\n        if(s[i+1]-s[i]!=d):\n            return False\n            break\n    return True\na=int(input())\ns=list(map(int,input().strip().split()))\nif(a==1):\n    print(s[0])\nelif(a==2):\n    print(s[1]+s[1]-s[0])\nelse:\n    if(checkAP(s)==True):\n        print(s[0]+a*(s[1]-s[0]))\n    else:\n        print(s[a-1])", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "cf639dfa4d02c2b349988cda87fd60fd", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'B', 'H']\ni = sorted(n.index(x) for x in input().split())\nc = (i[1] - i[0], i[2] - i[1])\nif c in ((4, 3), (3, 5), (5, 4)):\n    print('major')\nelif c in ((3, 4), (4, 5), (5, 3)):\n    print('minor')\nelse:\n    print('strange')", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "7e7f259ce25120a9829c6914a9bfa5ea", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def dist(x, y):\n    if x > y: x, y = y, x\n    return min(y-x, x+12-y)\n\ndef solve(a, b, c):\n    for x, y, z in [(a, b, c), (b, c, a), (c, a, b)]:\n        d1, d2, d3 = dist(x, y), dist(y, z), dist(x, z)\n        if d1 == 3 and d2 == 4 and d3 == 12-7:\n            return \"minor\"\n        if d1 == 4 and d2 == 3 and d3 == 12-7:\n            return \"major\"\n    return \"strange\"\n\n\na, b, c = map(lambda x: ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'B', 'H'].index(x), raw_input().split())\na, b, c = sorted([a, b, c])\nprint solve(a, b, c)", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "14f159e45f04b0043a9a63f34ce22a5e", "src_uid": "6aa83c2f6e095848bc63aba7d013aa58", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def make_s(lst):\n    while True:\n        lst.sort()\n        for i in range(len(lst) - 1):\n            if lst[i] == lst[i + 1]:\n                lst[i] -= 1\n                break\n        else:\n            break\n    return sum([x for x in lst if x > 0])\n\n\nn = int(input())\na = [int(i) for i in input().split()]\nprint(make_s(a))", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "dd3766ac6147e55ca517fba622aba361", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ns = sorted([int(i)for i in input().split()])\nNON = []\nfor i in range(n):\n    if s[i] in NON:\n        while s[i] in NON and s[i] > 0:\n            s[i] -= 1\n        NON.append(s[i])\n    else:\n        NON.append(s[i])\nprint(sum(s))", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "a8e23726aed9382c6a56f61b119ae330", "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "l, d, v, g, r = map(int, input ().split ())\ns = (d / v) % (g + r)\nprint(l / v + (s >= g) * (g + r - s))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "39d0b6d1a19d825b9f0e883b2208a7f0", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "'''                      \n   \t\n   \t\t\t ||Sri:||                 \n\n                      __|\n ______________|_________________________\n      |    |   ___|    |    |    ___|      |      |    |___\n /\\  /\\    |   |___    |    |   |___|      |      |    |___|\n/  \\/  \\   |   ___|    |    |         |_/    |___|    |___\n\nI am a beginner. Feel free to send tutorials/help to srinivasan1995@gmail.com.\n\nCodeforces, SPOJ handle: desikachariar.\nHackerrank, Codechef handle: Prof_Calculus.\n\nAdvices/Help are welcome. You will definitely get a thanks in return. Comments to be avoided.\n\nCollege: International Institute of Information Technology, Bangalore.\n\n'''\n\nimport math\n\ndef fn():\n\treturn\n\nif __name__ == '__main__':\n\tl,d,v,g,r = [float(pp) for pp in raw_input().split(' ')]\n\ttotal_time=d/v\n\tif (float(total_time))%(float(r+g)) >= g:\n\t\ttotal_time+=r - (((total_time)%(r+g)) - g) \n\ttotal_time+= (l-d)/v\n\tprint total_time\n\t\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "a9f5f057b7317f068ddcf0ac3a816a66", "src_uid": "e4a4affb439365c843c9f9828d81b42c", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "r = int(input())\n\ni = 1\nwhile i * i <= r - 1:\n    if (r-1) % i == 0:\n        x = i\n        if ((r-1) / x - x - 1) % 2 == 0 and ((r-1) / x - x - 1) / 2 > 0:\n            print(str(x) + ' ' + str(int(((r-1) / x - x - 1)/2)))\n            exit()\n\n    i += 1\n\nprint(\"NO\")\n\n", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "75e0cc11eec215de121c210312c4e9a8", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from __future__ import print_function\n# import numpy as np\n# import numpypy as np\nimport sys\ninput = sys.stdin.readline\n\ndef eprint(*args, **kwargs):\n    print(*args, file=sys.stderr, **kwargs)\n    return\n\n# import math\n# import string\n# import fractions\n# from fractions import Fraction\n# from fractions import gcd\n\n# def lcm(n,m):\n#     return int(n*m/gcd(n,m))\n\n# import re\n# import array\n# import copy\n# import functools\n# import operator\n\n# import collections\n# import itertools\n# import bisect\n# import heapq\n\n\n# from heapq import heappush\n# from heapq import heappop\n# from heapq import heappushpop\n# from heapq import heapify\n# from heapq import heapreplace\n\n# from queue import PriorityQueue as pq\n\n# def reduce(p, q):\n#     common = fractions.gcd(p, q)\n#     return (p//common , q//common )\n# # from itertools import accumulate\n# # from collections import deque\n\n# import random\n\n\ndef main():\n    r=int(input())\n    R=r-1                       # R must be even\n    if R%2!=0:\n        print(\"NO\")\n        return\n\n    for p_small in range(1,R//2+1):\n        if R%p_small==0:\n            y=(R//p_small-(p_small + 1))//2\n            if y>0:\n                print(p_small,y)\n                return\n    print(\"NO\")\n    return\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "6dac58f0e9cda4e83554bf269a7ffee6", "src_uid": "3ff1c25a1026c90aeb14d148d7fb96ba", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m,a,b = [int(i) for i in raw_input().split()]\nif b < a:\n    if n%m == 0:\n        print (n/m)*b\n    else:\n        print (n/m)*b + b\nelif a*m <= b:\n    print n*a\nelif n < m:\n    print min(b,a*n)\nelse:    \n    print (n/m)*b + (n%m)*a  ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "2e3d281e4eed1994999040af57ad6bb3", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m, a, b = map(int, input().split())\nif b / m < a:\n    print((n // m) * b + min((n % m) * a, b))\nelse:\n    print(n * a)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "3af67446b99c8af89b62962948cc2371", "src_uid": "faa343ad6028c5a069857a38fa19bb24", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\n\nx, y, m = raw_input().split(' ')\nx = int(x)\ny = int(y)\nm = int(m)\n\nx, y = min(x, y), max(x, y)\n\nif y >= m:\n    print 0\nelif x + y <= x:\n    print -1\n    \nelse: \n    s = int(math.ceil((y - x) / (y * 1.0)))\n    \n    x += s * y\n    while x < y:\n        x += y\n        s += 1\n    \n    p = y\n    p2 = x\n    f = x\n    \n    \n    while f < m:\n        f = p2 + p\n        p = p2\n        p2 = f\n        s += 1\n    \n    print s", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "4c354cc0a83002b0028e461b2a33863c", "src_uid": "82026a3c3d9a6bda2e2ac6e14979d821", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input().split()\nx, y, m = (int(i) for i in s)\n\nans = 0\n\nif x >= m or y >= m:\n    print(0)\nelif x <= 0 and y <= 0:\n    print(-1)\nelse:\n    if x < 0:\n        q = abs(x // y)\n        ans += q\n        x += y * q\n    elif y < 0:\n        q = abs(y // x)\n        ans += q\n        y += x * q\n\n    while x < m and y < m:\n        ans += 1\n        if x < y:\n            x = x + y\n        else:\n            y = x + y\n    \n    print(ans)", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "6c28f4fc10f978740c9494cc04272c5d", "src_uid": "82026a3c3d9a6bda2e2ac6e14979d821", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    n = int(input()) + 1\n    s = \" \" + input().strip()\n    arr = [[0] * 2 for x in range(n)]\n    x, y = 0, 0\n    ans = 0\n    for i in range(len(s)):\n        if s[i] == \"U\":\n            y += 1\n        elif s[i] == \"D\":\n            y -= 1\n        elif s[i] == \"L\":\n            x -= 1\n        elif s[i] == \"R\":\n            x += 1\n        arr[i] = [x, y]\n        for j in range(i):\n            if arr[j] == arr[i]:\n                ans += 1\n    print(ans)\n    \nmain()", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "284841d6397e5efbea887bd07521e0fe", "src_uid": "7bd5521531950e2de9a7b0904353184d", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\ns = raw_input().strip()\nx = [0]\ny = [0]\ndd = {'U': (-1, 0), 'D': (1, 0), 'L': (0, 1), 'R': (0, -1)}\nfor c in s:\n    dx, dy = dd[c]\n    x += [x[-1] + dx]\n    y += [y[-1] + dy]\nans = 0\nfor i in xrange(n):\n    for j in xrange(i + 1, n + 1):\n        if x[j] == x[i] and y[j] == y[i]:\n            ans += 1\nprint ans\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "2241451966de516593a9b836ab1cb1c6", "src_uid": "7bd5521531950e2de9a7b0904353184d", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\ncpts = [int(i) for i in raw_input().split()]\ntasks = [set() for i in xrange(3)]\nfor i in xrange(n):tasks[cpts[i]-1].add(i)\ndepends = [set([int(j)-1 for j in raw_input().split()][1:]) for i in xrange(n)]\nfinish = set()\n\ndef do_task(pos, finish, tasks, depends):\n    hours = 0\n    while True:\n        ns = set()\n        for t in tasks[pos]:\n            depends[t].difference_update(finish)\n            if len(depends[t]) > 0: ns.add(t)\n        d = tasks[pos].difference(ns)\n        if len(d) == 0:break\n        finish.update(d)\n        tasks[pos].difference_update(d)\n        hours += len(d)\n    return hours\n\nhours = float('inf')\nfor pos in xrange(3):\n    h = 0\n    t = [t.copy() for t in tasks]\n    d = [d.copy() for d in depends]\n    f = set()\n    while True:\n        h += do_task(pos, f, t, d)\n        if len(f) >= n:break\n        h += 1\n        pos = (pos + 1) % 3\n    hours = min(hours, h)\nprint hours\n    \n", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "f545c092903de81333f785c7e550e077", "src_uid": "be42e213ff43e303e475d77a9560367f", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def r(): return raw_input().strip()\ndef ri(): return int(r().strip())\ndef riv(): return map(int, r().split())\n\ndiff = {\n    (1,1): 0,\n    (2,2): 0,\n    (3,3): 0,\n    (1,2): 1,\n    (1,3): 2,\n    (2,1): 2,\n    (2,3): 1,\n    (3,1): 1,\n    (3,2): 2\n}\n\ndef main():\n    n = ri()\n    c = riv()\n\n    a = []\n    starts, start_comps = [], []\n    for i in range(n):\n        line = riv()[1:]\n        a.append(line)\n        if len(line) == 0:\n            starts.append(i+1) \n            start_comps.append(c[i]) \n\n    min_hours = -1\n    while starts:\n        hours = 1\n        down = set()\n        start = starts.pop()\n        start_comp = start_comps.pop()\n        down.add(start)\n        while len(down) < n:\n            possible = {}\n            for i, stage in enumerate(a):\n                if i+1 not in down and all([s in down for s in stage]):\n                    comp = c[i]\n                    if comp not in possible:\n                        possible[comp] = []\n                    possible[comp].append(i+1)\n\n            if start_comp in possible:\n                for l in possible[start_comp]:\n                    hours += 1\n                    down.add(l)\n            else:\n                nz = min(possible.items(), key=lambda z: diff[(start_comp, z[0])])\n                hours += diff[(start_comp, nz[0])]\n                start_comp = nz[0]\n                for l in nz[1]:\n                    hours += 1\n                    down.add(l)\n        \n        if min_hours == -1 or min_hours > hours:\n            min_hours = hours\n    \n    print min_hours\n    \nif __name__ == \"__main__\":\n    main()", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "ba1bb93b56b0be6c4d108d0eccfc702d", "src_uid": "be42e213ff43e303e475d77a9560367f", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x,y,a,b=map(int,raw_input().split())\nfor i in range(1,x*y+1):\n    if i%x==0 and i%y==0:\n        k=i\n        break\nprint b/k+(-a/k)+1", "lang_cluster": "Python", "tags": ["math"], "code_uid": "ec4c02c50c793464284db3fffba96357", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/python\nimport time\nimport fractions\n\ndef lcm(a, b):\n    \"\"\"Return lowest common multiple.\"\"\"\n    return a * b // fractions.gcd(a, b)\n\nx,y,a,b = map(int, raw_input().rstrip().split(\" \"))\ncount = 0\nstep = lcm(x,y)\nwhile a <= b:\n    if a%x == 0 and a%y == 0:\n        count += 1\n        break\n    a += 1\nif a < b:\n    count += (b-a)/step\n    #for i in xrange(a,b+1,step):\n        #count += 1\n\nprint count\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "9cba03bd09879e372f97461b6a16f32f", "src_uid": "c7aa8a95d5f8832015853cffa1374c48", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import bisect \nbits = []\nfor i in range(1, 513):\n  bits.append(int(format(i, \"b\")))\nn = int(input())\nprint(bisect.bisect_right(bits, n))", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "b6506168db602ed8a4085c28966b4025", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# Asad Alwadi (RAND DEEB) ;)\nnum = list(input())\ncarry = 0\nans = []\nfor i in range(0,len(num)):\n    if(num[i] == '1' or carry):\n        ans.append('1')\n\n    else:\n        if(num[i] == '0'):\n            ans.append('0')\n        else:\n            ans.append('1')\n            carry = 1\nans = \"\".join(ans)\nprint(int(ans,2))", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "69c11f9b8516140dc52eb025ff9948e8", "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\ns1=0\ns2=0\nl=list(map(int,input().split()))\nfor i in range(n):\n    if l[i]>=0:\n        s1+=l[i]\n    else:\n        s2+=l[i]\nprint(s1-s2)", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "2546b45e80b3ec319796c789a887e664", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "input()\nprint(sum(list(map(abs, map(int, input().split())))))", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "7985cd111a09c43263d1b9bb01ef889f", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\nctl = [[1 for x in range(3)] for x in range(3)]\n\nfor x in range(3):\n    li = [int(z) for z in sys.stdin.readline().split()]\n    for y in range(3):\n        ctl[x][y] = (ctl[x][y] + li[y]) % 2\n        if x-1 >= 0:\n            ctl[x-1][y] = (ctl[x-1][y] + li[y]) % 2\n        if y-1 >= 0:\n            ctl[x][y-1] = (ctl[x][y-1] + li[y]) % 2\n        if y+1 <= 2:\n            ctl[x][y+1] = (ctl[x][y+1] + li[y]) % 2\n        if x +1 <= 2:\n            ctl[x+1][y] = (ctl[x+1][y] + li[y]) % 2\n\nfor x in range(3):\n    print ''.join([str(y) for y in ctl[x]]) \n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "bf8a59600c09386e46107dd370c837dc", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a1,a2,a3=map(int,input().split())\nb1,b2,b3=map(int,input().split())\nc1,c2,c3=map(int,input().split())\nr1=[True,True,True]\nr2=[True,True,True]\nr3=[True,True,True]\nif(a1%2!=0):\n\tr1[0]=not r1[0]\n\tr1[1]=not r1[1]\n\tr2[0]=not r2[0]\nif(a2%2!=0):\n\tr1[1]=not r1[1]\n\tr1[0]=not r1[0]\n\tr1[2]=not r1[2]\n\tr2[1]=not r2[1]\nif(a3%2!=0):\n\tr1[2]=not r1[2]\n\tr1[1]=not r1[1]\n\tr2[2]=not r2[2]\nif(b1%2!=0):\n\tr2[0]=not r2[0]\n\tr1[0]=not r1[0]\n\tr2[1]=not r2[1]\n\tr3[0]=not r3[0]\nif(b2%2!=0):\n\tr2[1]=not r2[1]\n\tr1[1]=not r1[1]\n\tr2[0]=not r2[0]\n\tr2[2]=not r2[2]\n\tr3[1]=not r3[1]\nif(b3%2!=0):\n\tr2[2]=not r2[2]\n\tr1[2]=not r1[2]\n\tr2[1]=not r2[1]\n\tr3[2]=not r3[2]\nif(c1%2!=0):\n\tr3[0]=not r3[0]\n\tr2[0]=not r2[0]\n\tr3[1]=not r3[1]\nif(c2%2!=0):\n\tr3[1]=not r3[1]\n\tr3[0]=not r3[0]\n\tr2[1]=not r2[1]\n\tr3[2]=not r3[2]\nif(c3%2!=0):\n\tr3[2]=not r3[2]\n\tr2[2]=not r2[2]\n\tr3[1]=not r3[1]\nfor i in range(0,3):\n\tprint(int(r1[i]),end='')\nprint()\nfor i in range(0,3):\n\tprint(int(r2[i]),end='')\nprint()\nfor i in range(0,3):\n\tprint(int(r3[i]),end='')\nprint()", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "47ec17dccbc44c70d891e7be5215fa8c", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "[n,l]=[int(i) for i in str(input()).split(' ')]\n\nr1=[int(i) for i in str(input()).split(' ')]\nr2=[int(i) for i in str(input()).split(' ')]\n\nfor k in range(l):\n    tmp=[(k+i)%l for i in r1]\n    if all(i in r2 for i in tmp):\n        tmp=False\n        break;\nif tmp==False:\n    print(\"YES\")\nelse:\n    print(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "f6578ca606c1abecfe53af29928e291b", "src_uid": "3d931684ca11fe6141c6461e85d91d63", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, l = map(int, input().split())\nd1 = list(map(int, input().split()))\nd2 = list(map(int, input().split()))\nflag = False\nfor i in range(l):\n    for j in range(n):\n        d1[j] -= 1\n        if d1[j] == -1:\n            d1[j] = l - 1\n    d1.sort()\n    if d1 == d2:\n        flag = True\nif flag:\n    print('YES')\nelse:\n    print('NO')\n    \n        ", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "ee1f53138f75011c00045a88dbd80062", "src_uid": "3d931684ca11fe6141c6461e85d91d63", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s=input()\na=len(s)\ns=s+'0'\np=0\nc=s[0]\ni=0\ncnt = 0\nwhile p < a:\n    p+=1#pointer of string\n    i+=1\n    if s[p] != c:\n        cnt+=1\n        i=0#number of stuff on his hands\n        c=s[p]\n    if i==5:\n        i=0\n        cnt+=1\n        c=s[p]\n    #print(i, s[p])\nif i != 0:\n    cnt+=1\nprint(cnt)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "fbb15482f00c425a121e0618a6988cef", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = input()\nans = 0\ni = 0\nwhile i < len(a):\n    j = i + 1\n    while j < len(a) and a[j] == a[i] and j - i < 5: j+=1\n    ans+=1\n    i = j\nprint(ans)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b84a37a5f75221aa3687ca590cd3287d", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from collections import defaultdict\nfrom fractions import gcd\nfrom bisect import *\nimport sys\nsys.setrecursionlimit(5*10**6)\ndef sint():\n    return int(raw_input())\ndef sarr():\n    return [int(x) for x in raw_input().split()]\ndef sstr():\n    return raw_input()\n\nimport time\nt1=time.time()\ntl=320 ## total length 5*30*2=300\nvis=[]\nfor i in range(tl):\n    vis.append([0]*tl)\ndp=[]\nfor i in range(tl):\n    tmp2=[]\n    for j in range(tl):\n        tmp1=[]\n        for k in range(8):\n            tmp1.append([0]*32)\n        tmp2.append(tmp1)\n    dp.append(tmp2)\n#print time.time()-t1\nxp=[1,1,0,-1,-1,-1,0,1]\nyp=[0,1,1,1,0,-1,-1,-1]\n\ndef abc(lev,x,y,dir):\n    global n,a\n    if lev==n:\n        return\n    if dp[x+(tl/2)][y+(tl/2)][dir][lev]==1: ##start putting firework from the middle of grid\n        return\n    dp[x+(tl/2)][y+(tl/2)][dir][lev]=1\n    xx,yy=0,0\n    for i in range(1,a[lev]+1):\n        xx=x+xp[dir]*i\n        yy=y+yp[dir]*i\n        vis[xx+(tl/2)][yy+(tl/2)]=1\n    abc(lev+1,xx,yy,(dir+1)%8)\n    abc(lev+1,xx,yy,(dir+7)%8)\n\n\nt=1\nfor ii in range(t):\n    n=sint()\n    a=sarr()\n    abc(0,0,-1,2)\n    r=0\n    for i in range(tl):\n        for j in range(tl):\n            r+=vis[i][j]\n    print r\n", "lang_cluster": "Python", "tags": ["dfs and similar", "brute force", "dp", "data structures", "implementation"], "code_uid": "c873b9f7103446f8d3b63d1fb707647d", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\n#   N\n# W  E\n#  S\n\nmemo = dict()\nd = input()\ntlist = map(int,raw_input().strip().split())\ndim = 2*sum(tlist)+2\ncells = [[0 for i in range(dim)] for i in range(dim)]\n\ndef go(x,y,cur_fac,t_idx):   \n    if memo.get((x,y,cur_fac,t_idx)) != None:\n        return 0    \n\n    if t_idx >= len(tlist):\n        return 0\n\n    xorig = x\n    yorig = y\n\n    ct = 0\n\n    if not cells[x][y]:\n        cells[x][y] = 1\n        ct += 1\n\n    if cur_fac == \"N\":        \n        steps = tlist[t_idx]\n        for i in range(steps-1):\n            y+=1\n            if not cells[x][y]:\n                cells[x][y] = 1\n                ct+=1\n        ct += go(x-1,y+1,\"NW\",t_idx+1)\n        ct += go(x+1,y+1,\"NE\",t_idx+1)\n\n    if cur_fac == \"NW\":        \n        steps = tlist[t_idx]\n        for i in range(steps-1):\n            x-=1\n            y+=1\n            if not cells[x][y]:\n                cells[x][y] = 1\n                ct+=1\n        ct += go(x-1,y,\"W\",t_idx+1)\n        ct += go(x,y+1,\"N\",t_idx+1)\n\n    if cur_fac == \"W\":\n        steps = tlist[t_idx]\n        for i in range(steps-1):\n            x-=1\n            if not cells[x][y]:\n                cells[x][y] = 1\n                ct+=1\n        ct += go(x-1,y+1,\"NW\",t_idx+1)\n        ct += go(x-1,y-1,\"SW\",t_idx+1)\n\n    if cur_fac == \"SW\":\n        steps = tlist[t_idx]\n        for i in range(steps-1):\n            x-=1\n            y-=1\n            if not cells[x][y]:\n                cells[x][y] = 1\n                ct+=1\n        ct += go(x-1,y,\"W\",t_idx+1)\n        ct += go(x,y-1,\"S\",t_idx+1)\n\n    if cur_fac == \"S\":\n        steps = tlist[t_idx]\n        for i in range(steps-1):\n            y-=1\n            if not cells[x][y]:\n                cells[x][y] = 1\n                ct+=1\n        ct += go(x-1,y-1,\"SW\",t_idx+1)\n        ct += go(x+1,y-1,\"SE\",t_idx+1)\n\n    if cur_fac == \"SE\":\n        steps = tlist[t_idx]\n        for i in range(steps-1):\n            x+=1\n            y-=1\n            if not cells[x][y]:\n                cells[x][y] = 1\n                ct+=1\n        ct += go(x,y-1,\"S\",t_idx+1)\n        ct += go(x+1,y,\"E\",t_idx+1)\n\n    if cur_fac == \"E\":\n        steps = tlist[t_idx]\n        for i in range(steps-1):\n            x+=1\n            if not cells[x][y]:\n                cells[x][y] = 1\n                ct+=1\n        ct += go(x+1,y+1,\"NE\",t_idx+1)\n        ct += go(x+1,y-1,\"SE\",t_idx+1)\n\n    if cur_fac == \"NE\":\n        steps = tlist[t_idx]\n        for i in range(steps-1):\n            x+=1\n            y+=1\n            if not cells[x][y]:\n                cells[x][y] = 1\n                ct+=1\n        ct += go(x,y+1,\"N\",t_idx+1)\n        ct += go(x+1,y,\"E\",t_idx+1)\n    \n    memo[(xorig,yorig,cur_fac,t_idx)] = ct\n\n    return ct\n\nprint go(dim/2, dim/2, \"N\", 0)\n\n\n    \n", "lang_cluster": "Python", "tags": ["dfs and similar", "brute force", "dp", "data structures", "implementation"], "code_uid": "ea5e4a1d69d0fbd0c16e746cbc3aa6f4", "src_uid": "a96bc7f93fe9d9d4b78018b49bbc68d9", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from sys import *\na, b, m, r0 = map(int, stdin.readline().split())\nwas = {}\nr = r0\ni = 1\nwhile True:\n    if r in was:\n        print(i - was[r])\n        exit(0)\n    was[r] = i\n    i += 1\n    r = (a * r + b) % m\n    \n    \n    \n    ", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "0a5d5b9add41d39619740cdb59ea149c", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b,m,r=map(int, raw_input().split())\ni=0\nh={r:0}\nwhile True:\n    i+=1\n    r=(a*r+b)%m\n    if r in h:\n        break\n    h[r]=i\nprint i - h[r]\n", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "2615d23949cbccf07eedd2889c645fdc", "src_uid": "9137197ee1b781cd5cc77c46f50b9012", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\nimport math\n\nvalues = sys.stdin.readline().split()\nnum1, num2 = int(values[0]), int(values[1])\ndistance = math.sqrt((num1 ** 2) + (num2 ** 2))\n\nif num1 == 0 or num2 == 0:\n    print \"black\"\n    sys.exit(0)\n\ncur_distance = 0\nstate = 1 if num1 * num2 >= 0 else -1\n\nfor i in range(0, 2000):\n    cur_distance = i\n    state *= -1\n    \n    if distance == cur_distance:\n        print \"black\"\n        break\n    elif distance < cur_distance:\n        if state == -1:\n            print \"white\"\n        else:\n            print \"black\"\n        break\n\n", "lang_cluster": "Python", "tags": ["math", "geometry", "constructive algorithms", "implementation"], "code_uid": "8417c85d79dab8c2491a12e8a1e5dcf0", "src_uid": "8c92aac1bef5822848a136a1328346c6", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x,y=map(int,input().split())\ndis=pow(abs(x),2)+pow(abs(y),2)\ndis=pow(dis,0.5)\ndis=abs(dis)\nif dis==int(dis):\n    print('black')\nelif x<0 and y<0 or x>0 and y>0:\n    if (int(dis) % 2 == 0):\n        print('black')\n    else:\n        print('white')\nelse:\n    if(int(dis)%2!=0):\n        print('black')\n    else:\n        print('white')", "lang_cluster": "Python", "tags": ["math", "geometry", "constructive algorithms", "implementation"], "code_uid": "542a9f2db1aa74ac9dfede338b04b3ea", "src_uid": "8c92aac1bef5822848a136a1328346c6", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from itertools import permutations\nl=[]\nfor i in range(5):\n\tl.append(raw_input().split())\nfor i in range(5):\n\tfor j in range(5):\n\t\tl[i][j]=int(l[i][j])\nmax = 0\nfor t in list(permutations('01234')):\n\ti=[]\n\tfor j in range(5):\n\t\ti.append(int(t[j]))\n\ts = l[i[0]][i[1]]+l[i[1]][i[0]]+l[i[2]][i[3]]+l[i[3]][i[2]]\n\ts += l[i[1]][i[2]]+l[i[2]][i[1]]+l[i[3]][i[4]]+l[i[4]][i[3]]\n\ts += l[i[2]][i[3]]+l[i[3]][i[2]]+l[i[3]][i[4]]+l[i[4]][i[3]]\n\tif s>max:\n\t\tmax = s\nprint max", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "1ca81d2ee7b2b1dee0fc84469f2d8907", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\"\"\"\nOh, Grantors of Dark Disgrace, \nDo Not Wake Me Again.\n\"\"\"\n\nii = lambda: int(input())\nmi = lambda: map(int, input().split())\nli = lambda: list(mi())\nsi = lambda: input()\n\nfrom itertools import permutations\n\nl = [[]]*5\nn = [0, 1, 2, 3, 4]\n\nfor i in range(5):\n    l[i] = li()\n\nmaxi = 0\n\nfor a, b, c, d, e in permutations(n, 5):\n    s = l[a][b] + l[b][a] + l[b][c] + l[c][b] + 2*(l[c][d] + l[d][c] + l[d][e] + l[e][d])\n    maxi = max(maxi, s)\n\nprint(maxi)", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "55fd8965ec94c681ba409a4b32c9998f", "src_uid": "be6d4df20e9a48d183dd8f34531df246", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from sys import stdin\nn,m = map(int,stdin.readline().split())\na = []\nf = m\nx = m\nm = -m\nwhile n:\n f = n/m\n if f * m > n:\n  f +=1\n a.append(n - f * m)\n n = f\n\nprint len(a)\nfor i in a:\n print (i +x )%x,", "lang_cluster": "Python", "tags": ["math"], "code_uid": "974e07536998342bf969f0a88df8aaf1", "src_uid": "f4dbaa8deb2bd5c054fe34bb83bc6cd5", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "p, k = map(int, input().split())\n\nl = [0]\nr = [0]\ncp = [1]\ncoef = []\n\nfor deg in range(1, 2333):\n    l.append(l[-1])\n    r.append(r[-1])\n    if cp[-1] > 0: r[-1] += cp[-1] * (k-1)\n    else : l[-1] += cp[-1] * (k-1)\n    if p <= r[-1] and p >= l[-1]:\n        coef = [0] * deg\n        break\n    cp.append(cp[-1] * (-k))\n\ncv = p\nfor deg in range(len(coef), 0, -1):\n    if cv >= l[deg-1] and cv <= r[deg-1]: continue\n    elif cv > r[deg-1]:\n        coef[deg-1] = (cv - r[deg-1]) // cp[deg-1]\n        if((cv-r[deg-1]) % cp[deg-1] != 0):\n            coef[deg-1] += 1\n        cv -= cp[deg-1] * coef[deg-1]\n    elif cv < l[deg-1]:\n        coef[deg-1] = (l[deg-1] - cv) // -cp[deg-1]\n        if((l[deg-1]-cv) % -cp[deg-1] != 0):\n            coef[deg-1] += 1\n        cv -= cp[deg-1] * coef[deg-1]\n\nprint(len(coef))\nprint(\" \".join(map(str, coef)))\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "a9915081198b44fe8832e35f0a9deffc", "src_uid": "f4dbaa8deb2bd5c054fe34bb83bc6cd5", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s=('H','HE','LI','BE','B','C','N','O','F','NE','NA','MG','AL','SI','P','S','CL','AR',\n'K','CA','SC','TI','V','CR','MN','FE','CO','NI','CU','ZN','GA','GE','AS','SE','BR',\n'KR','RB','SR','Y','ZR','NB','MO','TE','RU','RH','PD','AG','CD','IN','SN','SB','TE',\n'I','XE','CS','BA','LA','CE','PR','ND','PM','SM','EU','GD','TB','DY','HO','ER','TM',\n'YB','LU','HF','TA','W','RE','OS','IR','PT','AU','HG','TL','PB','BI','PO','AT','RN',\n'FR','RA','AC','TH','PA','U','NP','PU','AM','CM','BK','CF','ES','FM','MD','NO','LR',\n'RF','DB','SG','BH','HS','MT','DS','RG','CN','NH','FL','MC','LV','TS','OG')\na=raw_input()\na+=' '\n\ndef gao(p):\n\tif a[p]==' ':\n\t\treturn True\n\tfor b in s:\n\t\tif b[0]==a[p] and (len(b)==1 or b[1]==a[p+1]):\n\t\t\tif gao(p+len(b)):\n\t\t\t\treturn True\n\treturn False\n\nprint 'YES' if gao(0) else 'NO'", "lang_cluster": "Python", "tags": ["brute force", "strings", "dp"], "code_uid": "fa7019da4df24666d04b54b96761a8eb", "src_uid": "d0ad35798119f98320967127c43ae88d", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "e = ['AC', 'AG', 'AL', 'AM', 'AR', 'AS', 'AT', 'AU', 'B', 'BA', 'BE', 'BH', 'BI', 'BK', 'BR', 'C', 'CA', 'CD', 'CE', 'CF', 'CL', 'CM', 'CN', 'CO', 'CR', 'CS', 'CU', 'DB', 'DS', 'DY', 'ER', 'ES', 'EU', 'F', 'FE', 'FL', 'FM', 'FR', 'GA', 'GD', 'GE', 'H', 'HE', 'HF', 'HG', 'HO', 'HS', 'I', 'IN', 'IR', 'K', 'KR', 'LA', 'LI', 'LR', 'LU', 'LV', 'MC', 'MD', 'MG', 'MN', 'MO', 'MT', 'N', 'NA', 'NB', 'ND', 'NE', 'NH', 'NI', 'NO', 'NP', 'O', 'OG', 'OS', 'P', 'PA', 'PB', 'PD', 'PM', 'PO', 'PR', 'PT', 'PU', 'RA', 'RB', 'RE', 'RF', 'RG', 'RH', 'RN', 'RU', 'S', 'SB', 'SC', 'SE', 'SG', 'SI', 'SM', 'SN', 'SR', 'TA', 'TB', 'TC', 'TE', 'TH', 'TI', 'TL', 'TM', 'TS', 'U', 'V', 'W', 'XE', 'Y', 'YB', 'ZN', 'ZR']\n\ns = input()\ndp = [0] * (len(s) + 1)\ndp[0] = 1\nfor i in range(1, len(s) + 1):\n    for ei in e:\n        if (len(ei) <= i and \n            ei == s[i - len(ei):i] and \n            dp[i - len(ei)] == 1):\n            dp[i] = 1\n\nprint('YES' if dp[len(s)] else 'NO')", "lang_cluster": "Python", "tags": ["brute force", "strings", "dp"], "code_uid": "da0d2fd3b3085eb083b40f2d541292d7", "src_uid": "d0ad35798119f98320967127c43ae88d", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,k,t = list(map(int,input().split()))\n\nif t <= k:\n\tprint(t)\nelif t <= n:\n\tprint(k)\nelse:\n\tprint(n+k-t)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "594f1b782fbb920eed3f4b3ae40b33d3", "src_uid": "7e614526109a2052bfe7934381e7f6c2", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# cf 851 A 800\nn, k, t = map(int, input().split())\n\nstanding = min(k, n)\nstanding = min(t, k) # at start\nif t > n:\n    # 5 - (12 - 10) = 5 - 2\n    visible = max(0, k - (t - n))\n    standing = min(standing, visible)\nprint(standing)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "560aceb550d3daacd737db8659b85141", "src_uid": "7e614526109a2052bfe7934381e7f6c2", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\ndef recur(bnry, prefix_sum, idx):\n    if bnry[0] == '1':\n        prefix_sum[idx] = 2 * prefix_sum[idx - 1] + 1\n    elif bnry[0] == '0':\n        prefix_sum[idx] = 2 * prefix_sum[idx - 1]\n    bnry = bnry[1:]\n    if len(bnry):\n        recur(bnry,prefix_sum,idx+1)\n    else:\n        return 0\ndef cal(bnry,num, prefix_sum,idx):\n    if num == pow(2,idx) - 1:\n        if bnry[idx-1] == '1':\n            return prefix_sum[idx - 1] * 2 + 1\n        else:\n            return prefix_sum[idx - 1] * 2\n    elif num == pow(2,idx-1):\n        if bnry[idx-1] == '1':\n            return prefix_sum[idx-1] + 1\n        else:\n            return prefix_sum[idx-1]\n    elif num == pow(2,idx-1) -1:\n        return prefix_sum[idx-1]\n    if num > pow(2,idx-1):\n        if bnry[idx-1] == '1':\n            return prefix_sum[idx-1] + 1 + cal(bnry,num - pow(2,idx-1) ,prefix_sum, idx - 1)\n        else:\n            return prefix_sum[idx-1] + cal(bnry,num - pow(2,idx-1), prefix_sum, idx - 1)\n    elif num < pow(2,idx-1):\n        return cal(bnry,num,prefix_sum,idx-1)\n\nsys.setrecursionlimit(100000)\nn,l,r = list(map(int,input().split(' ')))\nbnry = bin(n)\nprefix_sum = [0] * 51\nif n == 0:\n    print(0)\nelse:\n    recur(bnry[2:], prefix_sum, 1)\n    print(cal(bnry[2:],r,prefix_sum,len(bnry[2:])) - cal(bnry[2:],l-1,prefix_sum,len(bnry[2:])))", "lang_cluster": "Python", "tags": ["dfs and similar", "divide and conquer", "constructive algorithms"], "code_uid": "cd74629ef48d2bdd2c7656dade9448d4", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def sz(n):\n    if n < 2:\n        return 1\n    return 2 * sz(n // 2) + 1\n\ndef f(n, l, r):\n    if l > r or n == 0:\n        return 0\n    if n == 1:\n        return 1\n    x = sz(n // 2)\n    md = 0\n    if l <= x + 1 <= r:\n        md = n % 2\n    return md + f(n // 2, l, min(r, x)) + f(n // 2, max(1, l - (x + 1)), r - (x + 1))\n\nn, l, r = map(int, input().split())\nprint(f(n, l, r))\n", "lang_cluster": "Python", "tags": ["dfs and similar", "divide and conquer", "constructive algorithms"], "code_uid": "071180f0e9441e08a7aa8fdc1f6dafb6", "src_uid": "3ac61b1f8deee7911b1055c243f5eb6a", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import factorial\n\nMOD = 10**9+7\nfact = {}\n\na, b, n = map(int, input().split())\nfact[0]=1\nfor i in range(1, n+1):\n    fact[i] = fact[i-1]*i%MOD\n\nans = 0\nfor (i, j) in zip(range(n+1), range(n, -1, -1)):\n    if set(str(a*i + b*j)) <= {f'{a}', f'{b}'}:\n        ans+=(fact[n]*pow(fact[n-i]*fact[i]%MOD, MOD-2, MOD) % MOD)\nprint(ans%MOD)\n", "lang_cluster": "Python", "tags": ["brute force", "combinatorics"], "code_uid": "dc37a9676c21277186d7b2783584c3c8", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/python\n\nimport os\nimport sys\nfrom math import log10, factorial\nimport itertools\n\nmod = 1000000007\n\ndef fni(x):\n    tmp = mod - 2\n    ret = 1\n    tt = x\n    while (tmp):\n        if (tmp & 1):\n            ret = (ret * tt) % mod\n        tt = (tt * tt) % mod\n        tmp >>= 1\n    return ret\n\ndef check(x,a,b):\n    while x>0:\n        t = x % 10\n        if t not in [a,b]: return False\n        x /= 10\n    return True\n\ndef solve(f):\n    a,b,n = f.read_int_list()\n    s = set([a,b])\n\n    c = [1] * (n+1)\n    for i in xrange(1, n+1):\n        c[i] = (c[i-1] * i) % mod\n\n    ans = 0\n\n    for i, j in enumerate(xrange(a*n,b*n+1,b-a)):\n        if not check(j,a,b): continue\n        ans = (ans + c[n] * fni(c[i]) % mod * fni(c[n-i]) % mod) % mod\n\n    print ans\n\n\nclass Reader(object):\n    def __init__(self):\n        self.f = sys.stdin\n\n    def read_int(self):\n        return int(self.f.readline().strip())\n    def read_float(self):\n        return float(self.f.readline().strip())\n    def read_long(self):\n        return long(self.f.readline().strip())\n    def read_str(self):\n        return self.f.readline().strip()\n\n    def read_int_list(self):\n        return [int(item) for item in self.f.readline().split()]\n    def read_float_list(self):\n        return [float(item) for item in self.f.readline().split()]\n    def read_long_list(self):\n        return [long(item) for item in self.f.readline().split()]\n    def read_str_list(self):\n        return self.f.readline().split()\n\nif __name__ == '__main__':\n    f = Reader()\n    solve(f)\n", "lang_cluster": "Python", "tags": ["brute force", "combinatorics"], "code_uid": "c949b0b5289dbe576efe303c26663ec5", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nz=[]\nq=0\nfor i in range(n):\n\tv=int(input())\n\tq+=v\n\tz.append(v)\n\t\n\ndef subsetsum(array,num):\n\n    if num == 0 or num < 1:\n        return None\n    elif len(array) == 0:\n        return None\n    else:\n        if array[0] == num:\n            return [array[0]]\n        else:\n            with_v = subsetsum(array[1:],(num - array[0])) \n            if with_v:\n                return [array[0]] + with_v\n            else:\n                return subsetsum(array[1:],num)\ndef can_rotate(arr, i=0, cur=0):\n    cur %= 360\n\n    if i >= len(arr):\n        return cur == 0\n\n    return can_rotate(arr, i+1, cur + arr[i]) or \\\n            can_rotate(arr, i+1, cur - arr[i])\nif (can_rotate(z)):\n\tprint(\"YES\")\nelse:\n\tprint(\"NO\")\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "dp", "bitmasks"], "code_uid": "13f57271746a692ebd5a3519d337f122", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\n\n\nn=int(input())\na=[]\nfor i in range(n):\n    s=int(input())\n    a.append(s)\nz=''\nz=z.zfill(n)\nitog=0\nfor _ in range(2**n):\n    for j in range(len(z)):\n        if z[j]=='0':\n            itog+=a[j]\n            itog=itog%360\n        else:\n            itog-=a[j]\n            if itog>=0:\n                continue\n            else:\n                itog=360+itog\n\n    if itog==0:\n        print(\"YES\")\n        exit()\n    z=int(z,base=2)\n    z+=1\n    z=bin(z)\n    z=z[2::]\n    z=z.zfill(n)\n    itog=0\n\n\nprint(\"NO\")\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "dp", "bitmasks"], "code_uid": "d599586f90a8bc8a20b515f63b64d30b", "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import stdin, stdout\nfrom math import ceil\n\ndef read_input():\n    n = int(stdin.readline())\n    m = int(stdin.readline())\n\n    max_on_bench = 0\n    sum = 0\n    for _ in range(n):\n        a = int(stdin.readline())\n        if a > max_on_bench:\n            max_on_bench = a\n        sum += a\n\n    return n, m, max_on_bench, sum\n\nif __name__ == \"__main__\":\n    n, m, max_on_bench, sum = read_input()\n    largest = max_on_bench + m\n    smallest = max(ceil((sum + m) / n), max_on_bench)\n    print('{x} {y}'.format(x=smallest, y=largest))\n", "lang_cluster": "Python", "tags": ["implementation", "binary search"], "code_uid": "6988541b76b7480bb5454a4a99a8eb7c", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#code\nn = int(input())\nm = int(input())\na = []\nfor i in range(n):\n    x = int(input())\n    a.append(x)\n    \nmaximum = max(a)\nsum_a = sum(a)\nk_max = m + maximum\nif ((n*maximum - sum_a ) >= m ):\n    k_min = maximum \nelse:\n    q = m - ( n*maximum - sum_a )\n    k_min = maximum + (q//n)\n    if q%n == 0 :\n        k_min = k_min \n    else:\n        k_min = k_min + 1;\n\nprint(k_min , k_max )\n", "lang_cluster": "Python", "tags": ["implementation", "binary search"], "code_uid": "b5213e37462b9de3003ca35e9866fdb8", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "f = ['', '1/1', '5/6', '2/3', '1/2', '1/3', '1/6']\nprint f[max(int(x) for x in raw_input().split())]", "lang_cluster": "Python", "tags": ["math", "probabilities"], "code_uid": "ff76713d3150cbc83490e960e9262b7c", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin\n\na , b = map(int,stdin.readline().split())\nx = 6 - max(a,b)\narr = [\"1/6\",\"1/3\",\"1/2\",\"2/3\",\"5/6\",\"1/1\"]\n\nprint(arr[x])\n", "lang_cluster": "Python", "tags": ["math", "probabilities"], "code_uid": "f8b0df53617a3675be383bd1a666cf35", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/python\n\nimport sys\nimport math\n\ndef read_obj(cls):\n    return cls(sys.stdin.readline().strip())\n\ndef read_obj_list(cls):\n    return map(cls, sys.stdin.readline().strip().split())\n\n\ndef solve():\n    n = read_obj(int)\n    res = [1, 0 ,18, 0, 1800, 0, 670320, 0 ,734832000, 0, 890786230, 0, 695720788, 0, 150347555, 0]\n    return res[n-1]\n\n\nif __name__ == \"__main__\":\n    print solve()\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "bitmasks", "meet-in-the-middle", "implementation"], "code_uid": "20452212f676f084bc4ebf8c0d0c79f7", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "num = [1, 18, 1800,670320,734832000,890786230,695720788,150347555]\nn = input()\nprint 0 if not n&1 else num[n>>1]", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "bitmasks", "meet-in-the-middle", "implementation"], "code_uid": "2ee741f3a13da191db91665262032741", "src_uid": "a6a804ce23bc48ec825c17d64ac0bb69", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\n\ndef rec(l):\n\n    while l[-1] == l[-2]:\n        l[-2] += 1\n        l.pop()\n    return l\n\nres = [0]\nfor i in range(n):\n    res.append(1)\n    res = rec(res)\n\nprint(\" \".join(map(str, res[1:])))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "edce48f5d648613b6a0267444ae36cf3", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = []\n\nfor i in range(int(input())):\n    a +=[1]\n    while len(a) > 1 and a[-1] == a[-2]:\n        a.pop()\n        a[-1] += 1\nfor i in a:\n    print(i,end=' ')        ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "8cecba256e1e2cd6d08ee0bce42b4cf2", "src_uid": "757cd804aba01dc4bc108cb0722f68dc", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nx=eval(input())\ny=math.sqrt(x)\nif y%1==0:\n  y=y\nelif y%1>=0.5:\n  y=(y//1)+1\nelse:\n  y=(y//1)+0.5\nprint(int(2*y))\n\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "binary search"], "code_uid": "be811690fc5ff754d448eee177d541b2", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\np = n**(0.5)\np1 = int(p)\nif p>p1:\n    p1+=1\nif (p1**2)-(p1-1)<=n:\n    print(p1*2)\nelse:\n    print( (p1*2)-1)", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "binary search"], "code_uid": "efc67b1bdaafb36f8b70ede4b7c1fc20", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def MI():\n    return map(int,input().split())\ndef I():\n    return int(input())\ndef LI():\n    return [int(i) for i in input().split()]\n\nn,k=MI()\n\nb=-(2*n+3)\nc=n*n+n-2*k\nx=(-b-((b*b-4*c)**0.5))//2\ny=(-b+((b*b-4*c)**0.5))//2\nx,y=int(x),int(y)\nfor i in [x-1,x,x+1,y-1,y,y+1]:\n    if i**2+b*i+c==0 and 0<=i<=n-1:\n        print(i)\n        break", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search"], "code_uid": "04cede1f932e18a74d96460e40348e92", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, k = [int(x) for x in input().split()]\n     \nsumm=0\nfor i in range(1,n+1):\n    summ+=i\n    candy = summ - (n-i)\n    if candy == k:\n        index=i\n        break \nprint(n-index)", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search"], "code_uid": "9d315453fee2a93b0d0c30394a17a75c", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#here\nn = int(raw_input())\na = map(int, raw_input().split())\n\nones = a.count(1)\n\nma = 0\nfor i in range(0, n):\n    for j in range(i, n):\n        seg = [a[k] for k in range(i, j+1)]\n        unos = ones - seg.count(1) + seg.count(0)\n        if unos > ma:\n            ma = unos \n\nprint ma\n", "lang_cluster": "Python", "tags": ["brute force", "dp", "implementation"], "code_uid": "5032a3c549a7184dfd31277ce513f395", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\na = [int(i) for i in input().split()]\n\nones = 0\npoint = 0\nbest = 0\nfor i in range(n):\n    ones += a[i]\n    if (a[i] == 1):\n        if (point > 0):\n            point -= 1\n        else:\n            point = 0\n    else:\n        point += 1\n    best = max(best, point)\nif (ones == n):\n    print (n - 1)\nelse:\n    print (ones + best)", "lang_cluster": "Python", "tags": ["brute force", "dp", "implementation"], "code_uid": "99605403216b74889375e58d956bf1df", "src_uid": "9b543e07e805fe1dd8fa869d5d7c8b99", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a=int(input())\nb=int(input())\nc=int(input())\nd=int(input())\nif(a!=d):\n    print(\"0\")\nelif (c>0 and (a==0 or d==0)):\n    print(\"0\")\nelif(c>=0 and a==d ):\n    print(\"1\")\nelse:\n    print(\"0\")", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "42a72e4ae5dde1ed48c0966c2dfce5fc", "src_uid": "b99578086043537297d374dc01eeb6f8", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "t1 = int(input())\nt2 = int(input())\nt3 = int(input())\nt4 = int(input())\n\nres = 0\nif t1 == 0 and t3 == 0 and t4 == 0:\n    res = 1\nelif t1 == t4:\n    if t1 == 0 and t3 == 0:\n        res = 1\n    elif t1 is not 0:\n        res = 1\n\nprint(res)\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "2ed7b5e1528e987cb519019cf00f5f6c", "src_uid": "b99578086043537297d374dc01eeb6f8", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#n = int(input())\n#n, m = map(int, input().split())\n#d = list(map(int, input().split()))\n\nn, h, m = map(int, input().split())\nres = [h for i in range(n)]\n\nfor i in range(m):\n    l, r, x = map(int, input().split())\n    for j in range(l-1, r):\n        res[j] = min(res[j], x)\n\nprint(sum([x**2 for x in res]))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "cedc06029dd6b81ad05fe4df3e8007f7", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, maxh, rest = list(map(int, input().strip().split()))\na = [maxh]*n\n\nfor i in range(rest):\n    l, r, m = list(map(int, input().strip().split()))\n    for i in range(l - 1, r):\n        a[i] = min(a[i], m)\n\nprint(sum(i*i for i in a))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "782b2e96956ffbbcf06fbd0210f3ca8d", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def main():\n    numbers = list(map(int, input().split()))\n    v = []\n\n    for i in range(14):\n        v.append(numbers[i])\n\n    result = 0\n    for i in range(14):\n        k = numbers[i]\n        v[i] = 0\n        c = int(k / 14)\n        d = k % 14\n\n        for j in range(14):\n            v[j] = v[j] + c\n        j = i + 1\n        while j <= 13 and d > 0:\n            v[j] = v[j] + 1\n            j = j + 1\n            d = d - 1\n        for j in range(d):\n            v[j] = v[j] + 1\n\n        sum = 0\n        for j in range(14):\n            if v[j] % 2 == 0:\n                sum = sum + v[j]\n\n        result = max(result, sum)\n\n        for j in range(14):\n            v[j] = numbers[j]\n\n    print(result)\n\n\nmain()\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "b6d0afd13eb95126b8ac443df21d4c94", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = list(map(int,input().split()))\nmaxi = -1\nfor i in range(14):\n    s = 0\n    if a[i] != 0:\n        cel = a[i] // 14\n        ost = a[i] % 14\n\n        for ty in range(1,14):\n            if i + ty > 13:\n                i -= 14\n            su = a[i + ty] + cel\n            if ty <= ost:\n                su += 1\n            if su % 2 == 0:\n                s += su\n        if cel % 2 == 0:\n            s += cel\n    if s > maxi:\n        maxi = s\nprint(maxi)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "be2f0ed114ca53f4e4c532c680f05048", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, s = int(input()), input()\nr, g = s.count('R'), s.count('G')\nb = n - r - g\nprint('%s%s%s' % ('B' if g and r or b and g + r > 1 or g + r < 1 else '', 'G' if r and b or g and b + r > 1 or  b + r < 1 else '', 'R' if g and b or r and g + b > 1 or g + b < 1 else ''))\n", "lang_cluster": "Python", "tags": ["math", "dp", "constructive algorithms"], "code_uid": "14fd8ef3acbbd6aa082cc31c8ea73d79", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ninput_string = input()\n\nmap = {}\n\nfor i in range(0, len(input_string)):\n    if input_string[i] in map:\n        map[input_string[i]]+=1\n    else:\n        map[input_string[i]]=1\n\n\nif len(map) == 3:\n    print(\"BGR\")\n\n\nif len(map) == 2:\n    sum = 0\n    check = False\n    check_key = \"\"\n    other_key = \"\"\n    for key in map.keys():\n        sum += map[key]\n\n        if map[key] == 1:\n            check = True\n            check_key = key\n        else:\n            other_key = key\n    \n    if sum == 2:\n        if 'G' not in map:\n            print(\"G\")\n        if 'R' not in map:\n            print(\"R\")\n        if 'B' not in map:\n            print(\"B\")\n    else:\n        if check == True:\n            if other_key == \"R\" and check_key == \"G\":\n                print(\"BG\")\n            if other_key == \"B\" and check_key == \"G\":\n                print(\"GR\")\n            if other_key == \"B\" and check_key == \"R\":\n                print(\"GR\")\n            if other_key == \"G\" and check_key == \"R\":\n                print(\"BR\")\n            if other_key == \"R\" and check_key == \"B\":\n                print(\"BG\")\n            if other_key == \"G\" and check_key == \"B\":\n                print(\"BR\")    \n        else:\n            print(\"BGR\")\n\nif len(map) == 1:\n    for key in map.keys():\n        print(key)\n\n    \n", "lang_cluster": "Python", "tags": ["math", "dp", "constructive algorithms"], "code_uid": "0469a415b73c86652f520eaf69bd7311", "src_uid": "4cedd3b70d793bc8ed4a93fc5a827f8f", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import itertools\na, b, c, d = map(int, input().split())\ndef solve(a, b, c, d):\n    ans = 0\n    pre = [0]*(b + c + 2)\n    for i in reversed(range(a, b + 1)):\n        pre[i + b] += 1\n        pre[i + c + 1] -= 1\n    pre = list(itertools.accumulate(pre))\n    pre = list(itertools.accumulate(pre))\n    a = max(pre)\n    last = 0\n    for i in range(c, d + 1):\n        if i < b + c + 1:\n            last = a - pre[i]\n        ans += last\n    return ans\n\nprint(solve(a, b, c, d))", "lang_cluster": "Python", "tags": ["two pointers", "math", "implementation", "binary search"], "code_uid": "a754aeb83d4621fd07eb41213c56b18b", "src_uid": "4f92791b9ec658829f667fcea1faee01", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#t=int(input())\nfor _ in range(1):\n    a,b,c,d=map(int,input().split())\n    ans=0\n    for i in range(a,b+1):\n        x=b+i-1\n        y=c+i-1\n        \n        if y<c:\n            pass\n        elif x>d:\n            m = (y-x+1)\n            ans+=m*(d-c+1)\n        else:\n            m=max(0,y-d)\n            ans+=m*(d-c+1)\n            m=min(d-c+1,min(d,y)-c+1)\n            if m<0:\n                pass\n            else:\n                ans+=(m*(m+1))//2\n            m = max(1,max(c,x)-c+1)-1\n            ans-=(m*(m+1))//2\n            #ans+=(m*(m+1))//2\n        \n            \n        #ans+=(min(c,y)-max(b,x)+1)\n\n\n    \n    print(ans)\n            \n            \n", "lang_cluster": "Python", "tags": ["two pointers", "math", "implementation", "binary search"], "code_uid": "b4def3ed1130c32acf2bfc9b470d9311", "src_uid": "4f92791b9ec658829f667fcea1faee01", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,d = map(int, raw_input().split())\ns = raw_input()\ndp = [n+1 for i in range(n+1)]\nif s[0] == 0 or s[n-1] == 0:\n    print \"-1\"\nelse:\n    dp[0] = 0\n    for i in range(1, d+1):\n        if s[i] == '1':\n            dp[i] = 1\n        else:\n            dp[i] = -1\n    for i in range(d+1, n):\n        if s[i] == '1':\n            for j in range(i-1, i-(d+1), -1):\n                if s[j] == '1' and dp[j] != -1:\n                    dp[i] = min(dp[i], 1+dp[j])\n            if dp[i] >= n:\n                dp[i] = -1\n        else:\n            dp[i] = -1\n    print dp[n-1]", "lang_cluster": "Python", "tags": ["dfs and similar", "greedy", "dp", "implementation"], "code_uid": "b8006036e9fe8db8ee572728b46959fb", "src_uid": "c08d2ecdfc66cd07fbbd461b1f069c9e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from sys import stdin, stdout\n\ninfo = map(int, stdin.readline().rstrip().split())\njump = info[1]\n\nflowerPath = [int(n) for n in stdin.readline().rstrip()]\n\njumps = 0\n\ncurrent = 0\nfinal = len(flowerPath) - 1\n\n#print flowerPath\nbreaking = False\n\nwhile current != final:\n    for x in range(current + jump, current, -1):\n        if x <= final and flowerPath[x] == 1:\n            current = x\n            jumps = jumps + 1\n            break\n        if x == current + 1:\n            breaking = True\n            break\n    if breaking:\n        break\n\nif breaking:\n    stdout.write(str(-1) + \"\\n\")\nelse:\n    stdout.write(str(jumps) + \"\\n\")\n", "lang_cluster": "Python", "tags": ["dfs and similar", "greedy", "dp", "implementation"], "code_uid": "1140c7b2b31626fc9d792a7973ac7c66", "src_uid": "c08d2ecdfc66cd07fbbd461b1f069c9e", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "l1=list(map(int,input().split()))\nl2=list(map(int,input().split()))\nl3=list(map(int,input().split()))\nl4=list(map(int,input().split()))\ncount=0\nif(l1[3]==1 and (l1[0]==1 or l1[1]==1 or l1[2]==1 or l2[0]==1 or l3[1]==1 or l4[2]==1)):\n    count=1\nelif(l2[3]==1 and (l1[2]==1 or l2[0]==1 or l2[1]==1 or l2[2]==1 or l3[0]==1 or l4[1]==1)):\n    count=1\n    \nelif(l3[3]==1 and(l1[1]==1 or l2[2]==1 or l3[0]==1 or l3[1]==1 or l3[2]==1 or l4[0]==1)):\n    count=1\nelif(l4[3]==1 and(l1[0]==1 or l2[1]==1 or l3[2]==1 or l4[0]==1 or l4[1]==1 or l4[2]==1)):\n    count=1\nif(count==1):\n    print(\"YES\")\nelse:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "2d7d70f5fbc1ccf198a499e8a9ff6263", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def foo(a):\n    for i in range(0,4):\n        for j in range(0,3):\n            if a[i][j] == a[i][3] and a[i][3] == 1:\n                print \"YES\"\n                return\n        if(i == 0):\n            if((a[i+1][0] == a[i][3] or a[i+2][1] == a[i][3]) or a[i+3][2] == a[i][3]) and a[i][3] == 1:\n                print \"YES\"\n                return\n        elif(i == 1):\n            if((a[i+1][0] == a[i][3] or a[i+2][1] == a[i][3]) or a[0][2] == a[i][3]) and a[i][3] == 1:\n                print \"YES\"\n                return\n        elif(i == 2):\n            if((a[i+1][0] == a[i][3] or a[0][1] == a[i][3]) or a[1][2] == a[i][3]) and a[i][3] == 1:\n                print \"YES\"\n                return\n        elif(i == 3):\n            if((a[0][0] == a[i][3] or a[1][1] == a[i][3]) or a[2][2] == a[i][3]) and a[i][3] == 1:\n                print \"YES\"\n                return\n    print \"NO\"\n    return\n\njunction = []\nfor i in range(0,4):\n    x = raw_input()\n    arr = map(int,x.split())\n    junction.append(arr)\nfoo(junction)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "935daa5aa5645a2c74f646736d94534c", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin, stdout\n\ns = stdin.readline().strip()\nchallengers = ['Danil', 'Olya', 'Slava', 'Ann', 'Nikita']\nn = len(s)\ncnt = 0\n\ns += '#' * 50\n\nfor i in range(n):\n    for f in challengers:\n        if s[i: i + len(f)] == f:\n            cnt += 1\n\n\n\nif cnt == 1:\n    stdout.write('YES')\nelse:\n    stdout.write('NO')", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "2a3391817b3b221bff21a6149075e1e9", "src_uid": "db2dc7500ff4d84dcc1a37aebd2b3710", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys; input = sys.stdin.readline\ns = input().strip()\nd = (\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\")\ng = 0\nfor i in range(len(d)):\n\tfor j in range(len(s)-len(d[i])+1):\n\t\tif s[j:j+len(d[i])] == d[i]: g += 1\nif g == 1: print(\"YES\")\nelse: print(\"NO\")", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "47b5fc0a60a7c279058b48f36f423044", "src_uid": "db2dc7500ff4d84dcc1a37aebd2b3710", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "gcd = lambda a,b: gcd(b%a, a) if a else b\nlcm = lambda a,b: a*b/gcd(a,b)\n\nn=input()\nc=[0]+map(int,raw_input().split())\nv = []\n\n\no=1\nfor i in range(1, n+1):\n    if i in v: continue\n    x=i\n    q=0\n    while x not in v:\n        v += [x]\n        x = c[x]\n        q+=1\n    if x != i:\n        o=-1\n        break\n    if q%2==0: q/=2\n    o=lcm(o, q)\nprint o", "lang_cluster": "Python", "tags": ["dfs and similar", "math"], "code_uid": "717ebb4ca9e5fa9cc995b831e8768780", "src_uid": "149221131a978298ac56b58438df46c9", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def gcd(a,b):\n    while b > 0:\n        a, b = b, a % b\n    return a\n    \ndef lcm(a, b):\n    return int(a * b / gcd(a, b))\n    \ndef run(n, crush):\n    visited = [False] * n\n    cycle_size = 1\n    \n    for i in range(0, n):\n        if visited[i]:\n            continue\n        x = i\n        c = 0\n        while (not visited[x]):\n            visited[x] = True\n            x = crush[x] - 1\n            c += 1\n        if x != i:\n            return -1\n            \n        if c % 2 == 0:\n            c /= 2\n        cycle_size = lcm(cycle_size, c)\n    \n    return cycle_size\n    \nn = int(input())\ncrush = [int(x) for x in input().split()]\nprint(run(n,crush))\n", "lang_cluster": "Python", "tags": ["dfs and similar", "math"], "code_uid": "3d4ab78f15cb725f09601b7bef5d2274", "src_uid": "149221131a978298ac56b58438df46c9", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def main():\n    data = raw_input()\n    index = set()\n\n    pos = (0, 0)\n\n    for direction in data:\n        pt = {\n            'U': (pos[0], pos[1] + 1),\n            'D': (pos[0], pos[1] - 1),\n            'L': (pos[0] - 1, pos[1]),\n            'R': (pos[0] + 1, pos[1])}[direction]\n        if any([\n            pt in index,\n            (pt[0] + 1, pt[1]) in index,\n            (pt[0] - 1, pt[1]) in index,\n            (pt[0], pt[1] + 1) in index,\n            (pt[0], pt[1] - 1) in index]):\n            return 'BUG'\n        index.add(pos)\n        pos = pt\n    return 'OK'\n\n\nif __name__ == '__main__':\n    print main()\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation", "graphs"], "code_uid": "9c02c0a1ef624e793aac8cc847919e13", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from collections import Counter\ni, j, p, s = 0, 0, {(0, 0)}, input()\nfor ch in s:\n    i += [0, 0, -1, 1]['LRUD'.index(ch)]\n    j += [-1, 1, 0, 0]['LRUD'.index(ch)]\n    p.add((i, j))\nc = Counter(((x-1,y) in p)+((x+1,y) in p)+((x,y-1) in p)+((x,y+1) in p) for x,y in p)\nprint('OK' if c[1] == 2 and c[2] == len(s) - 1 else 'BUG')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "implementation", "graphs"], "code_uid": "be2a3debf85b9c0f651c6149565671c9", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\ns = set()\narr = list(map(int, input().strip().split()))\nfor x in arr:\n    if x != 0:\n        s.add(x)\nprint(len(s))\n", "lang_cluster": "Python", "tags": ["sortings", "implementation"], "code_uid": "2b03b7c717fcf908b51765932807ac35", "src_uid": "3b520c15ea9a11b16129da30dcfb5161", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\nlt = map(int, raw_input().split())\nlt.sort()\npr,se = [], []\nr = []\nfor i in lt :\n\tif i not in r :\n\t\tr.append(i)\nvold = 0\nfor i in r :\n\tif i != 0 :\n\t\tvold += 1\nprint vold\n\n", "lang_cluster": "Python", "tags": ["sortings", "implementation"], "code_uid": "5ee9b1c2dafe463c44f6ac5607c68a24", "src_uid": "3b520c15ea9a11b16129da30dcfb5161", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = raw_input()\nb = raw_input()\nc = raw_input()\narr = []\ndef parse(s):\n    if s[1] == '>':\n        arr.append((s[2], s[0]))\n    else: arr.append((s[0], s[2]))\n\nparse(a)\nparse(b)\nparse(c)\n\narr.sort()\n\nbucket = []\nfor x in xrange(3):\n    bucket.append([0, chr(ord('A') + x) ])\n\nfor pair in arr:\n    for b in bucket:\n        if b[1] == pair[0]:\n            b[0] += 1\n\nbucket.sort()\n\ns = bucket[2][1] + bucket[1][1] + bucket[0][1]\n\nif bucket[0][0] != 0 or bucket[1][0] != 1 or bucket[2][0] != 2:\n    print \"Impossible\"\nelif len(set(s)) != 3:\n    print \"Impossible\"\nelse: print s\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "af6acbe736abb04968e5bd20c626aabc", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# https://codeforces.com/contest/47/problem/B\n\n\ndef single_integer():\n    return int(input())\n\n\ndef multi_integer():\n    return map(int, input().split())\n\n\ndef string():\n    return input()\n\n\ndef multi_string():\n    return input().split()\n\n\nleft_dict = dict()\nright_dict = dict()\n\nfor i in range(3):\n    c1, s, c2 = input()\n    if s == \">\":\n        left_dict[c1] = left_dict.get(c1, 0) + 1\n        right_dict[c2] = right_dict.get(c2, 0) + 1\n    else:\n        left_dict[c2] = left_dict.get(c2, 0) + 1\n        right_dict[c1] = right_dict.get(c1, 0) + 1\n\n\nif len(left_dict) == 3:\n    print(\"Impossible\")\nelse:\n    for k, v in right_dict.items():\n        if v == 2:\n            print(k, end=\"\")\n            break\n    for k, v in right_dict.items():\n        if v == 1:\n            print(k, end=\"\")\n            break\n\n    for k, v in left_dict.items():\n        if v == 2:\n            print(k, end=\"\")\n            break\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "c299aa7fbade61d11d076e1b9e48d0c9", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def cost(nk):\n    \n    ns = max(0, k - 1)\n    if ns > n - 2:\n        return 0\n    \n    return f(n - ns - 1, k + 1) + 1\n\n\nn = int(input())\nF = [0] * 100\nF[0] = 1\nF[1] = 2\nans = 1\n\nfor i in range(2, 100):\n    F[i] = F[i - 1] + F[i - 2]\n    if F[i] <= n:\n        ans = i\n        \nprint(ans)", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "combinatorics"], "code_uid": "40326a1fa3bd7da93c39814a2334cc6a", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def solution():\n    n = int(raw_input())\n    ans = 1\n    p = 2\n    nxt = 3\n    while True:\n        if n < nxt:\n            return ans\n        p, nxt = nxt, p + nxt\n        ans += 1\n\nif __name__ == '__main__':\n    print solution()\n", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "combinatorics"], "code_uid": "6f1dd25723637d84b18f16247b92cf42", "src_uid": "3d3432b4f7c6a3b901161fa24b415b14", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "trump = input()\na, b = map(str, input().split())\narr = [\"6\", \"7\", \"8\", \"9\", \"T\", \"J\", \"Q\", \"K\", \"A\"]\nif a[1] == b[1]:\n    if arr.index(a[0]) > arr.index(b[0]):\n        print(\"YES\")\n    else:\n        print(\"NO\")\nelse:\n    if a[1] == trump:\n        print(\"YES\")\n    else:\n        print(\"NO\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "8711198d37830b4e12ff044fb7970659", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "T=raw_input()\nS=raw_input().split()\nA=S[0]\nB=S[1]\nL={'6':0,'7':1,'8':2,'9':3,'T':4,'J':5,'Q':6,'K':7,'A':8}\nflag1=False\nflag2=False\nif(A[1]==T):\n\tflag1=True\nif(B[1]==T):\n\tflag2=True\nif(flag1 and flag2):\n\tif(L[A[0]]>L[B[0]]):\n\t\tprint \"YES\"\n\telse:\n\t\tprint \"NO\"\nelif(flag1):\n\tprint \"YES\"\nelif(flag2):\n\tprint \"NO\"\nelse:\n\tif(A[1]==B[1] and L[A[0]]>L[B[0]]):\n\t\tprint \"YES\"\n\telse:\n\t\tprint \"NO\"\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "9c8fd4eaa59777e8bfadf4f02cd65f2f", "src_uid": "da13bd5a335c7f81c5a963b030655c26", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\na=[0]*(n+1)\nfor i in range(2, n//2+1):\n    if a[i]==0:\n        for j in range(2*i, n+1, i):\n            a[j]+=1\nprint(a.count(2))", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "ebeb564181b3c98014148264f6b09f4f", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python2\n# -*- coding: utf-8 -*-\nimport sys\ninput = sys.stdin\noutput = sys.stdout\n\nfrom math import sqrt\nfrom itertools import repeat\n\ndef primes_eratosthene_leq_simple(N):\n    primes = [True]*(N+1)\n    primes[0] = False\n    primes[1] = False\n    SQRT_N = int(sqrt(N))\n    for i in range(2,SQRT_N+1):\n        if primes[i]:\n            primes[i*i:N+1:i] = repeat(False, len(primes[i*i:N+1:i]))\n    P = []\n    for p,prime in enumerate(primes):\n        if prime:\n            P.append(p)\n    return P\n\ndef solve(n):\n    P = primes_eratosthene_leq_simple(n)\n    N = 0\n    m = len(P)\n    for i in range(m):\n        a = P[i]\n        if 2*a > n:\n            break\n        for j in range(i+1,m):\n            b = P[j]\n            if 2*b > n:\n                break\n            for ip in range(1,13):\n                aa = a**ip\n                if 2*aa > n:\n                    break\n                for jp in range(1,13):\n                    bb = b**jp\n                    if 2*bb > n:\n                        break\n                    p = aa*bb\n                    if p <= n:\n                        N += 1\n                        #print p \n    return N\n\nn = int(input.readline())\n\na = solve(n)\noutput.write('%s\\n' % str(a))\n", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "7262dd306a53a1e4a25e0ef1277c6c4a", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from math import *\na,b,w,x,c = map(int,raw_input().split())\nprint [0,int(ceil(c-a+float(b-(c-a)*x)/(x-w)))][c>a]\n", "lang_cluster": "Python", "tags": ["math", "binary search"], "code_uid": "13bf173ba693e1d8782ada665a315cbf", "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "__author__ = 'asmn'\na, b, w, x, c = tuple(map(int, input().split()))\n\nif c <= a:\n    print(0)\n    exit()\nl, r = 0, (c - a) * 10000\nwhile l + 1 < r:\n    m = (l + r) // 2\n\n    if c - m <= a - (w - b - 1 + m * x) // w:\n        r = m\n    else:\n        l = m\nprint(r)", "lang_cluster": "Python", "tags": ["math", "binary search"], "code_uid": "4abcf3c53555a6513832e581d2daddc2", "src_uid": "a1db3dd9f8d0f0cad7bdeb1780707143", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def get(y, m, d):\n    if(m < 3):\n        y -= 1\n        m += 12\n    return 365 * y + y // 4 - y //100 + y//400 + (153*m-457)//5+d-306\n\na1 = input().split(':')\na2 = input().split(':')\n\nprint(abs(get(int(a1[0]),int(a1[1]),int(a1[2])) - get(int(a2[0]),int(a2[1]),int(a2[2]))))\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "6d106b76c9f27c631594a7f62e253540", "src_uid": "bdf99d78dc291758fa09ec133fff1e9c", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import datetime\nt1 = datetime.datetime.strptime(input(),\"%Y:%m:%d\")\nt2 = datetime.datetime.strptime(input(),\"%Y:%m:%d\")\nprint(abs((t2-t1).days))", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "99fcd6ea05f07d952cdbd3c29c1ef0ed", "src_uid": "bdf99d78dc291758fa09ec133fff1e9c", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m, k = map(int, input().split())\nl = list(map(int, input().split()))\nl = sorted(l)\nava = k\ni = n-1\nans = 0\nresult = False\nwhile i >= 0:\n    if ava >= m:\n        result = True\n        break\n    ava += (l[i]-1)\n    i -= 1\n    ans += 1\nif ava >= m:\n    result = True\nif result:\n    print(ans)\nelse:\n    print(-1)", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "15bedd6b5d97e3b63d9c73b6fa410c40", "src_uid": "b32ab27503ee3c4196d6f0d0f133d13c", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\ninput = sys.stdin.readline\nI = lambda : map(int,input().split())\n\nn,m,k = I()\nl = list(I())\n\nl.sort(reverse = True)\n\ncount = 0 \n\nif k >= m:\n    count = 0\nelse:\n    for i in range(n):\n        count += 1\n        k += (l[i] -1)\n        if k  >= m: #count = good\n            break\n        if (k== 0 or l[i] == 1) or k == 0: #ended without having good count\n            count = -1\n            break\n        \n    if k < m:\n        count = -1\n    \nprint(count)   ", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "58b920eb30a830837436161f16bc95e6", "src_uid": "b32ab27503ee3c4196d6f0d0f133d13c", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,x,y = map(int, raw_input().split(\" \"))\n\nif n < 3 or (x==n/2 and y==n/2 or x==n/2 and y==n/2+1 or x==n/2+1 and y==n/2 or x==n/2+1 and y==n/2+1 ):    print \"NO\"\nelse:   print \"YES\"\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "ff3e57231e434bef2164118f813dd481", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "mod = 1000000007\nii = lambda : int(input())\nsi = lambda : input()\ndgl = lambda : list(map(int, input()))\nf = lambda : map(int, input().split())\nil = lambda : list(map(int, input().split()))\nls = lambda : list(input())\nn,x,y=f()\nl=[n//2,n//2+1]\nif x in l and y in l:\n    print('NO')\nelse:\n    print('YES')", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "756e09e01a3fb64bf35571403417b7fd", "src_uid": "dc891d57bcdad3108dcb4ccf9c798789", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "print(2 - (int(input()) % 2))", "lang_cluster": "Python", "tags": ["math", "games"], "code_uid": "8f1eff4d0eafee828aca29685fc14984", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\n\nif n%2:\n\tprint (1)\nelse:\n\tprint (2)", "lang_cluster": "Python", "tags": ["math", "games"], "code_uid": "e301a63898a26452c586cbdce722f137", "src_uid": "816ec4cd9736f3113333ef05405b8e81", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import factorial\na = int(input())\nprint(factorial(a)//factorial(a-5)//120*a*(a-1)*(a-2)*(a-3)*(a-4))\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "a5245d44518c09c79fd745204b5605b1", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\nans = n*(n-1)*(n-2)*(n-3)*(n-4)\nans *= ans\nans //= 120\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "ab71b3fc4971b2ee45a11a98a40a248c", "src_uid": "92db14325cd8aee06b502c12d2e3dd81", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "inputs = [int(s) for s in raw_input().split()]\narea = inputs[0]*inputs[1]\nprint(area/2)", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "5086d0e5407cdb9b530a1f77bef98304", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def main():\n    m, n = list(map(int, input().split()))\n    print((m*n) // (2*1))\n\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "15b3fafcd51a84264714a338474f27c7", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def GetMaxDiff(arr,i):\n    max_diff=0\n    arr1=arr[:i]+arr[i+1:]\n    for j in range(len(arr1)-1):\n        diff = int(arr1[j+1])-int(arr1[j])\n        #print diff\n        if diff>max_diff:\n            max_diff=diff\n    return max_diff\n\nn = int(raw_input())\nhangs = raw_input().split()\nmin_diff=int(hangs[n-1])-int(hangs[0])\n\nfor i in range(1,n-1):\n    max_diff = GetMaxDiff(hangs,i)\n    #print max_diff\n    if max_diff<min_diff:\n        min_diff=max_diff\n\nprint min_diff\n", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "4ab49283fcf48e08b3f15323484cf346", "src_uid": "8a8013f960814040ac4bf229a0bd5437", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a=int(input())\nb=list(map(int,input().split()))\nm=max(b)\nfor i in range (1,a-1):\n    if  m>b[i+1]-b[i-1]:\n        m=b[i+1]-b[i-1]\nfor i in range(1,a):\n    if m<b[i]-b[i-1]:\n        m=b[i]-b[i-1]\nprint(m)", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "6838a62b89b1e13c3bfbf4818c0834e2", "src_uid": "8a8013f960814040ac4bf229a0bd5437", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def fact(n):\n    if n==1:\n        return 1\n    return n*fact(n-1)\n\ndef main():\n    a,b = [int(i) for i in input().split()]\n    print(fact(min(a,b)))\n\n\nmain()\n", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "0b8bba2909022144dd742bf49a9f8c8f", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "A,B =[int(x) for x in input().split()]\na=1\nfor i in range(1,min(A,B)+1):\n\ta*=i\nprint(a)", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "d87fe3fc1f1f72ab9bba7a4c8cbc9cb0", "src_uid": "7bf30ceb24b66d91382e97767f9feeb6", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, k = list(map(int,input().split()))\ndevs = []\niter = 1\nwhile iter*iter <= n:\n    if n%iter == 0:\n        if iter*iter == n:\n            devs.append(iter)\n        else:\n            devs.append(iter)\n            devs.append(n//iter)\n    iter+=1\ndevs.sort()\n\nif k > len(devs):\n    print(-1)\nelse:\n    print(devs[k-1])\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "84231bc3a8f6441b807fdfb01dcb4dc4", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, k = map(int, input().split())\ni=1\na = []\nwhile i * i <= n:\n    if n % i == 0:\n        a.append(i)\n        if i * i != n:\n            a.append(n//i)\n    i+=1\na = sorted(a)\nif k > len(a):\n    print(-1)\nelse:\n    print(a[k-1])", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "e55f2816827d5a81cbc992d1a1245e3b", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def win():\n\tfor i in xrange(4):\n\t\tfor j in xrange(4):\n\t\t\tif a[i][j] != 'x':\n\t\t\t\tcontinue;\n\t\t\tif i > 1:\n\t\t\t\tif a[i - 2][j] == 'x' and a[i - 1][j] == 'x':\n\t\t\t\t\treturn True\n\t\t\tif j > 1:\n\t\t\t\tif a[i][j - 1]  == 'x' and a[i][j - 2] == 'x':\n\t\t\t\t\treturn True\n\t\t\tif i > 1 and j > 1:\n\t\t\t\tif a[i - 1][j - 1] == 'x' and a[i - 2][j - 2] == 'x':\n\t\t\t\t\treturn True\n\t\t\tif i > 1 and j + 2 < 4:\n\t\t\t\tif a[i - 1][j + 1] == 'x' and a[i - 2][j + 2] == 'x':\n\t\t\t\t\treturn True\n\treturn False\na = []\nfor i in xrange(4):\n\ta.append(list(raw_input()))\n#print a\nfor i in xrange(4):\n\tfor j in xrange(4):\n\t\tif a[i][j] == '.':\n\t\t\ta[i][j] = 'x'\n\t\t\tif win():\n\t\t\t\tprint 'YES'\n#\tprint \"i = %d j = %d\" %(i, j)\n\t\t\t\texit(0)\n\t\t\ta[i][j] = ','\nprint 'NO'\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "65e4c8a58c17a7d4d18c046be1ed5228", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\n\ndef solve():\n    lines = [input() for _ in range(4)]\n    patterns = [\n        [(0, 0), (0, 1), (0, 2)],\n        [(0, 1), (0, 2), (0, 3)],\n\n        [(1, 0), (1, 1), (1, 2)],\n        [(1, 1), (1, 2), (1, 3)],\n\n        [(2, 0), (2, 1), (2, 2)],\n        [(2, 1), (2, 2), (2, 3)],\n\n        [(3, 0), (3, 1), (3, 2)],\n        [(3, 1), (3, 2), (3, 3)],\n\n\n        [(0, 0), (1, 0), (2, 0)],\n        [(1, 0), (2, 0), (3, 0)],\n\n        [(0, 1), (1, 1), (2, 1)],\n        [(1, 1), (2, 1), (3, 1)],\n\n        [(0, 2), (1, 2), (2, 2)],\n        [(1, 2), (2, 2), (3, 2)],\n\n        [(0, 3), (1, 3), (2, 3)],\n        [(1, 3), (2, 3), (3, 3)],\n\n\n        [(0, 0), (1, 1), (2, 2)],\n        [(0, 1), (1, 2), (2, 3)],\n        [(0, 2), (1, 1), (2, 0)],\n        [(0, 3), (1, 2), (2, 1)],\n\n        [(1, 0), (2, 1), (3, 2)],\n        [(1, 1), (2, 2), (3, 3)],\n        [(1, 2), (2, 1), (3, 0)],\n        [(1, 3), (2, 2), (3, 1)],\n    ]\n\n\n    for pattern in patterns:\n        line = [lines [y][x] for y, x in pattern]\n        x, d = 2, 1\n        for ch in line:\n            if ch == 'x':\n                x-=1\n            if ch == '.':\n                d-=1\n        if x == d == 0:\n            print('YES')\n            return\n    print('NO')\nsolve()", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "5e8ed48e68133560810ec5e524de7f2d", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = input().split()\nif n[2] == 'week':\n    print(53 if int(n[0]) == 5 or int(n[0]) == 6 else 52)\nelse:\n    if int(n[0]) == 31:\n        print(7)\n    elif int(n[0]) == 30:\n        print(11)\n    else:\n        print(12)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "880733a7f0091e70458c8874ce8349da", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import string\nst = str(raw_input())\nans = 0\nif st[len(st) - 1] == 'k':\n    w = 5\n    val = int(st[0])\n    for i in range(1, 367, 1):\n        if w == val:\n            ans += 1\n        w = w % 7 + 1\nelse:\n    val = int(st[0])\n    if st[1] in string.digits:\n        val = val * 10 + int(st[1])\n    if val <= 29:\n        ans = 12\n    elif val == 30:\n        ans = 11\n    else:\n        ans = 7\nprint ans\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "eb24819a1c30ed69507503f5ec62d8e8", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\n\na=0\n\nwhile m:a+=n//m;n,m=m,n%m\n\nprint(a)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "65a33960503f20e0a308d6f21575de21", "src_uid": "792efb147f3668a84c866048361970f8", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b=map(int,raw_input().split())\nc=0\nwhile b!=1:\n    if a>b:\n        c+=a//b\n        a=a%b\n    a,b=b-a,a\n    c+=1\nprint c+a", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "0bc3cc914b877486dd4fa345b105fd95", "src_uid": "792efb147f3668a84c866048361970f8", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input()\na = [s.count(ch) for ch in \"BSC\"]\nIn = lambda: map(int, raw_input().split())\nn, p = In(), In()\ns = input()\n\n\ndef check(x):\n    return sum(max(p[i] * (a[i] * x - n[i]), 0) for i in range(3)) <= s\n\n\nl, r = 0, s + max(n)\nwhile l < r:\n    m = (l + r) / 2 + 1\n    l, r = (m, r) if check(m) else (l, m - 1)\nprint l\n", "lang_cluster": "Python", "tags": ["brute force", "binary search"], "code_uid": "9227848274bf182900e14e6d25826607", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "S = input()\nn1, n2, n3 = map(int, input().split())\np1, p2, p3 = map(int, input().split())\nr = int(input())\nm1, m2, m3 = S.count('B'), S.count('S'), S.count('C')\nL = 0;\nR = 10000000000000\nwhile L < R:\n    mid = (L + R + 1) // 2\n    fee = max(0, mid * m1 - n1) * p1 + max(0, mid * m2 - n2) * p2 + max(0, mid * m3 - n3) * p3\n    if r >= fee:\n        L = mid\n    else:\n        R = mid - 1\n\nprint(int(L))", "lang_cluster": "Python", "tags": ["brute force", "binary search"], "code_uid": "f9eebe6a1cf29ea79249dca4386cd581", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "r, l, x, y, k = map(int, input().split())\nfor i in range(x, y + 1):\n    if k * i in range(r, l + 1):\n        print(\"YES\")\n        break\nelse:\n    print(\"NO\")", "lang_cluster": "Python", "tags": ["two pointers", "brute force"], "code_uid": "86c5531849ea97ca700d8968d1dd9204", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\n\n\nl, r, x, y, k = map(int, input().split())\nla, ra = k * x, k * y\n\nif r < la or ra < l:\n    print('NO')\nelif l <= la <= r or l <= ra <= r:\n    print('YES')\nelse:\n    xb = int(math.floor(l / k))\n    yb = int(math.ceil(r / k))\n    # print(xb, yb)\n    for b in range(xb, yb + 1):\n        if l <= k * b <= r:\n            print('YES')\n            break\n    else:\n        print('NO')\n", "lang_cluster": "Python", "tags": ["two pointers", "brute force"], "code_uid": "0358ce2236baeb42fd775b9e09dcc301", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# -*- coding: utf-8 -*-\n# Author: J\u00falia Fernandes Alves. <juliafealves@gmail.com>\n# Handle: juliafealves\n# Problem: B. Balls Game\n\n\ndef explode_balls(balls, index):\n    balls_exploded = 1\n    i = index\n    j = i + 1\n\n    while len(balls) > 2 and i < j:\n        if j < len(balls) and balls[i] == balls[j]:\n            balls_exploded += 1\n            j += 1\n        else:\n            if balls_exploded >= 2:\n                if j < len(balls) and i >= 0 and balls[i - 1] == balls[j]:\n                    balls = balls[:i] + balls[j:]\n\n                    if len(balls) > 2:\n                        i -= 1\n                        j = i + 1\n\n                        while i >= 0 and balls[i] == balls[j]:\n                            i -= 1\n\n                        if abs(j - (i+1)) >= 2:\n                            return balls_exploded + explode_balls(balls, i + 1)\n                        else:\n                            i += 1\n                            j = i + 1\n\n                            while j < len(balls) and balls[i] == balls[j]:\n                                j += 1\n\n                            if abs(i - (j - 1)) >= 2:\n                                return balls_exploded + explode_balls(balls, i)\n                            else:\n                                return balls_exploded\n                    else:\n                        return balls_exploded\n                else:\n                    return balls_exploded\n            else:\n                return 0\n\n    return balls_exploded\n\n\namount_balls, amount_color, ball = map(int, raw_input().split())\nballs = map(int, raw_input().split())\namount_explodeds = [0]\n\ntry:\n    if len(balls) > 1:\n        index = balls.index(ball)\n\n        while True:\n            if index == 0 and balls[index] == balls[index + 1]:\n                amount_explodeds.append(2)\n            elif index < len(balls) - 1 and balls[index] == balls[index + 1]:\n                balls_add = balls[:index] + [ball] + balls[index:]\n                amount_explodeds.append(explode_balls(balls_add, index) - 1)\n\n            index = balls.index(ball, index + 1)\n\n    print max(amount_explodeds)\nexcept ValueError:\n    print max(amount_explodeds)", "lang_cluster": "Python", "tags": ["two pointers", "brute force"], "code_uid": "fc6276480a20a3c155a0d13d9a81df28", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "(n, k, x) = map(int, raw_input().split())\nbolas = map(int, raw_input().split())\nans = 0\n\nfor i in range(n):\n    s = bolas[:]\n    s.insert(i, x)\n    while len(s) > 2:\n        l = len(s)\n        for j in range(2, len(s)):\n            if s[j-2] == s[j-1] == s[j]:\n                p = j + 1\n                while p < len(s):\n                    if s[j] != s[p]:\n                        break\n                    p += 1\n                s = s[:j-2] + s[p:]\n                break\n        if len(s) == l:\n            break\n    ans = max(ans, n - len(s))\n\nprint ans\n", "lang_cluster": "Python", "tags": ["two pointers", "brute force"], "code_uid": "3a00d6c7412d310703a65c2921f21262", "src_uid": "d73d9610e3800817a3109314b1e6f88c", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "curX, curY = (int(x) for x in input().split())\n\nx = abs(curX)\ny = abs(curY)\n\ny1 = int( x + y )\nx1 = y1\narea = x1 * x1\nnewA = area\n\nwhile newA <= area:\n    x1, y1 = x1 + 1, x1 + 1\n    area = newA\n    newA = x1 * x1\n\n\nx1 = int((x1-1) * (curX / abs(curX)))\ny1 = int((y1-1) * (curY / abs(curY)))\n\nif x1 < 0 :\n    print(str(x1) + ' 0 0 ' + str(y1))\nelse:\n    print('0 ' + str(y1) + ' ' + str(x1) + ' 0')\n\n\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "36cb9751a3bdba6cfb6f7369fb86b64b", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = raw_input().split()\nx = int(a[0])\ny = int(a[1])\nz = abs(x) + abs(y)\nif x > 0:\n    print '0 ' + str(z*y/abs(y)) + \" \" + str(z*x/abs(x)) + ' 0'\nelse:\n    print str(z*x/abs(x)) + ' 0 0 ' + str(z*y/abs(y))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "0dbfa8622e6b4a6759c2295c5463a7a4", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from sys import stdin\nfrom collections import *\n\nrstr = lambda: stdin.readline().strip()\n\nn, s, ans, dic = int(input()), rstr(), 0, defaultdict(int)\nfor j, i in enumerate(s):\n    dic[i] += 1\n\nprint(min(dic['U'], dic['D']) * 2 + min(dic['L'], dic['R']) * 2)\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "7f4f3ceef77aff278bac4505be17fe63", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\ncom = raw_input()\ncount=0\nd = {'L':0, 'D':0, 'U':0, 'R':0}\nfor i in com:\n    if i=='L':\n        d['L']+=1\n    elif i=='D':\n        d['D']+=1\n    elif i=='U':\n        d['U']+=1\n    else:\n        d['R']+=1\nif d['L']==d['U']==d['R']==d['D']:\n    count =n\nelse:\n    if d['L']==d['R']:\n        count = 2*min(d['U'],d['D'])+2*d['L']\n    elif d['U']==d['D']:\n        count = 2*min(d['L'],d['R'])+2*d['U']\n    else:\n        count = 2*min(d['U'],d['D']) + 2*min(d['L'],d['R'])\nprint count\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "f98851012e904b9f9c5cb9f873924f1e", "src_uid": "b9fa2bb8001bd064ede531a5281cfd8a", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\ndv = 3\nwhile n % dv == 0:\n\tdv *= 3\nprint n/dv + 1\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "29f1f2d404cf349ae1d4d75d23becca3", "src_uid": "7e7b59f2112fd200ee03255c0c230ebd", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math, decimal\n\nn = int(input())\nk = 0\nwhile n % 3**k == 0:\n    k += 1\n\nD = decimal.Decimal\nprint(math.ceil(D(n) / D(3**k)))", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "e54cb497acffba5cf3fe19de5e87b1f5", "src_uid": "7e7b59f2112fd200ee03255c0c230ebd", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin, stdout\n\na, b = map(int, stdin.readline().split())\ncnt = 0\ncnt_a = a\ncnt_b = 0\n\nwhile cnt_a >= 1:\n    cnt += cnt_a\n    cnt_b += cnt_a\n    cnt_a = cnt_b // b\n    cnt_b = cnt_b % b\n\nstdout.write(f\"{cnt}\\n\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "44b900b37d74b7fe6c840c359df557da", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import floor\na,b = map(int,input().split())\nleft = 0\nhrs = 0\nwhile a>0 or left>=b:\n    #print(\"before\",hrs,a,b,left)\n    hrs += a\n    if floor((left+a)/b)>floor(a/b):\n        new = floor((left+a)/b)\n        left = max((left+a)-(new*b),0)\n    else:\n        new = floor((a)/b)\n        left += max(a-(new*b),0)\n    a = new\n    #print(hrs,a,b,left)\nprint(hrs)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "98a0fa66a19dd313537f46d1e19294c6", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s=input()\ncnt=0\ngk=s.replace(\"at\", \"@\")\ngk=gk.replace(\"dot\", \".\")\n#print(gk)\nn=len(gk)\nk=list(gk)\nif(k[0]=='.'):\n\tk[0]=\"dot\"\nif(k[n-1]=='.'):\n\tk[n-1]=\"dot\"\nif(k[0]=='@'):\n\tk[0]=\"at\"\nif(k[n-1]=='@'):\n\tk[n-1]=\"at\"\n#s=string(k)\nfor x in range(len(k)):\n\tif(k[x]==\"@\" and cnt==0):\n\t\tcnt=1\n\telif(k[x]==\"@\"):\n\t\tk[x]=\"at\"\t\n\n\tprint(k[x],end=\"\")\n#print(k)\t\n\n#//print(len(gk))", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "fb4ef7375d10d3306beab72ff9912645", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s=input()\nif s[:3]==\"dot\" or s[:2]==\"at\" or s[len(s)-2:]==\"at\" or s[len(s)-3:]==\"dot\":\n    if s[:3]==\"dot\":\n        t=s[3:]\n        a=t.split('dot')\n        l=\".\".join(a)\n        b=l.find(\"at\")\n        o=l[:b]+\"@\"+l[b+2:]\n        q=\"dot\"+o\n        if q[-1]==\".\":\n            a=q[:len(q)-1]\n            s=a+\"dot\"\n        elif q[-1]==\"@\":\n            a=q[:len(q)-1]\n            s=a+\"at\"\n        else:\n            s=q\n\n    if s[:2]==\"at\":\n        t=s[2:]\n        a=t.split('dot')\n        l=\".\".join(a)\n        b=l.find('at')\n        o=l[:b]+\"@\"+l[b+2:]\n        q=\"at\"+o\n        if q[-1]==\".\":\n            a=q[:len(q)-1]\n            s=a+\"dot\"\n        elif q[-1]==\"@\":\n            a=q[:len(q)-1]\n            s=a+\"at\"\n        else:\n            s=q\n\n    if s[len(s)-3:]==\"dot\" and s[:3]!=\"dot\" and s[:2]!=\"at\":\n        t=s[:len(s)-3]\n        a=t.split('dot')\n        l=\".\".join(a)\n        b=l.find('at')\n        q=l[:b]+\"@\"+l[b+2:]\n        s=q+\"dot\"\n\n    if s[len(s)-2:]==\"at\" and s[:3]!=\"dot\" and s[:2]!=\"at\":\n        t=s[:len(s)-2]\n        a=t.split('dot')\n        l=\".\".join(a)\n        b=l.find('at')\n        q=l[:b]+\"@\"+l[b+2:]\n        s=q+\"at\"\n\n\n    print(s)\n\nelse:\n    a=s.split('dot')\n    l=\".\".join(a)\n    b=l.find('at')\n    q=l[:b]+\"@\"+l[b+2:]\n    print(q)", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "721b5526f8e3100609f139a9290377c3", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import re\nprint re.sub(r\"(?<=.)dot(?=.)\",\".\",re.sub(r\"(?<=.)at(?=.)\",\"@\",raw_input(),1))", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "edb1de150be6092a3e1fe0f61921e853", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import re\nprint re.sub(r\"(?<=.)dot(?=.)\",\".\",re.sub(r\"(?<=.)at(?=.)\",\"@\",raw_input(),1))\n", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "d2f936d92a083c78df0dd428d511d552", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\nimport math\nimport string\nimport operator\nimport functools\nimport fractions\nimport collections\nsys.setrecursionlimit(10**7)\ndX= [-1, 1, 0, 0,-1, 1,-1, 1]\ndY= [ 0, 0,-1, 1, 1,-1,-1, 1]\nRI=lambda: list(map(int,input().split()))\nRS=lambda: input().rstrip().split()\n#################################################\nMAX=1001\ns=input().rstrip()\ns=s[0]+s[1:-1].replace('dot','.')+s[-1]\ns=s[0]+s[1:-1].replace('at','@',1)+s[-1]\nprint(s)\n", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "87fbf961822e0514b4df71a0fc82797b", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = str(input())\n\ns = s.replace(\"at\",\"@\",1)\ns = s.replace(\"dot\",\".\")\n\nif s[0]==\".\":\n\ts = \"dot\"+s[1:]\n\nif s[0]==\"@\":\n\ts = s.replace(\"at\",\"@\",1)\n\ts = \"at\"+s[1:]\n\t\n\nif s[len(s)-1]==\".\":\n\ts = s[:len(s)-1]+\"dot\"\n\nprint(s)", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "0a907756ed8e3d3ec69bfab3273b6aaa", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input()\ns = s[0] + s[1:].replace('at', '@', 1)\nprint(s[0] + s[1:-1].replace('dot', '.') + s[-1])\n", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "d39c4571b3e66f5a289588c0286c044a", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "st = input()\np=st[0]\nst=st[1:].replace(\"dot\",\".\")\nst=p+st#print(st)\nif st[-1]==\".\" :\n    st=st[:-1]+\"dot\"\np=st[0]\nst=st[1:].replace(\"at\",\"@\",1)\nif st[-1]==\"@\" :\n    st=st[:-1]+\"at\"\nprint(p+st)\n", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "145d3d5d25bba95938764860705918ce", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input()\na = s[1: -1].find(\"dot\")\n\nwhile not a == -1:\n    s = s[: a + 1] + '.' + s[a + 4: ]\n    a = s[1: -1].find(\"dot\")\n\na = s[1: -1].find(\"at\")\ns = s[: a + 1] + '@' + s[a + 3: ]\n\nprint s\n", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "f57a1238be59aa84320e02966239985f", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s=raw_input()\ne=[]\nat=True\nfor i in range(0,len(s)):\n    x=s[i]\n    if s[i-2:i+1]=='dot' and i!=len(s)-1 and i!=2:\n        e.pop()\n        e.pop()\n        e.append('.')\n    elif s[i-1:i+1]=='at' and at and i!=1 and i!=len(s)-1:\n        e.pop()\n        e.append('@')\n        at=False\n    else:\n        e.append(x)\nz=''\nfor i in range(0,len(e)):\n    z=z+e[i]\nprint z\n", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "a2d9546ee027bdc9461b31b2520302f1", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "string = input()\nwhile \"dot\" in string[1:-1]:\n\tstring = string[:string[1:].index(\"dot\")+1]+\".\"+string[string[1:].index(\"dot\")+4:]\nstring = string[:string[1:].index(\"at\")+1]+\"@\"+string[string[1:].index(\"at\")+3:]\nprint(string)", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "dea60e50317c20dab0483ab61cae812f", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "d='dot'\nR=str.replace\ns=R(input(),d,'.')\ns=s[0]+R(s[1:],'at','@',1)\nif s[0]=='.':s=d+s[1:]\nif s[-1]=='.':s=s[:-1]+d\nprint(s)", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "864280ea8e174f726dea0c13b60e0223", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "rs = raw_input()\ns = rs[1:-1]\nl = len(s)\nres = rs[0]\ni = 0\nfindAt = False\nwhile(i < l):\n\tif(i + 3 <= l):\n\t\tif(s[i:i+3] == \"dot\"):\n\t\t\tres += \".\"\n\t\t\ti += 3\n\t\t\tcontinue\n\tif(i + 2 <= l and (not findAt)):\n\t\tif(s[i:i+2] == \"at\"):\n\t\t\tres += \"@\"\n\t\t\tfindAt = True\n\t\t\ti += 2\n\t\t\tcontinue\n\tres += s[i]\n\ti += 1\nres += rs[-1]\nprint res\n", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "f3776fd27b9c1bd5baeb6334b79aef48", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#code:utf-8\ns = raw_input()\nres = \"\"\nat = False\ni = 0\nwhile i<len(s):\n    if i!=0 and i+3<len(s) and s[i:i+3]==\"dot\":\n        res += '.'\n        i += 2\n    elif i!=0 and i+2<len(s) and at == False and s[i:i+2]==\"at\":\n        res += '@'\n        at = True\n        i += 1\n    else:\n        res += s[i]\n    i += 1\nprint res\n        \n", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "f119efcc14feb86fb0c9136560a39d2b", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input()\n\ns = s.replace('at', '@', 1)\n\nif s[0] == '@':\n    s = 'at' + s[1:].replace('at', '@', 1)\n\nif s.count('dot'):\n    s = s.replace('dot', '.')\n    if s[0] == '.':\n        s = s.replace('.', 'dot', 1)\n    if s[-1] == '.':\n        s = s[:len(s)-1] + 'dot'\n            \nprint(s)", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "ac1bb266ceed0d7d26c06a1efba6042f", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x=raw_input()\nfor i in range(1,len(x)):\n    if(x[i:i+2]=='at'):\n        x=x[0:i]+\"@\"+x[i+2:len(x)]\n        break\nx=x.replace('dot','.')\nif(x[0:1]=='.'):\n    x=x[1:len(x)]\n    x='dot'+x    \nif(x[len(x)-1:len(x)]=='.'):\n    x=x[0:len(x)-1]\n    x=x+'dot'\nprint(x)    \n", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "37351beae270d999083b1837f653e623", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s=input()\nt=s[0]+s[1:].replace('at','@',1)\ns=t[0]+t[1:-1].replace('dot','.')+t[-1]\nprint(s)", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "5ede246f8fb92f7dbd69fd925f989f86", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s=raw_input()\nt=s[1:-1].replace('at','@',1).replace('dot','.')\nprint s[0]+t+s[-1]", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "d0f6f42cccf47b92d9781d7a4c86ac07", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s=raw_input()\ns=s[0]+s[1:-1].replace(\"dot\",\".\")+s[-1]\ns=s[0]+s[1:-1].replace(\"at\",\"@\",1)+s[-1]\nprint s;", "lang_cluster": "Python", "tags": ["expression parsing", "implementation"], "code_uid": "d7b95acb049b43cb5ae4cdfeee52af32", "src_uid": "a11c9679d8e2dca51be17d466202df6e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nif n<=2:\n    print(n)\nelse:\n    print(1)", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "78b4306bc97fa1f37c26b8d3d122c19d", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "v = int(input())\n\nif v == 2:\n    print(2)\nelse:\n    print(1)\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "dd41a81b0667df73078c107205a0370d", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "class CodeforcesTask676BSolution:\n    def __init__(self):\n        self.result = ''\n        self.n_t = []\n\n    def read_input(self):\n        self.n_t = [int(x) for x in input().split(\" \")]\n\n    def process_task(self):\n        glasses = [[0.0] * (x + 1) for x in range(self.n_t[0])]\n        for s in range(self.n_t[1]):\n            glasses[0][0] += 1.0\n            for x in range(self.n_t[0] - 1):\n                for y in range(x + 1):\n                    if glasses[x][y] > 1.0:\n                        to_pour = glasses[x][y] - 1.0\n                        glasses[x + 1][y] += to_pour / 2\n                        glasses[x + 1][y + 1] += to_pour / 2\n                        glasses[x][y] = 1.0\n        full = 0\n        for g in glasses:\n            for glass in g:\n                if glass >= 1.0:\n                    full += 1\n        self.result = str(full)\n\n\n    def get_result(self):\n        return self.result\n\n\nif __name__ == \"__main__\":\n    Solution = CodeforcesTask676BSolution()\n    Solution.read_input()\n    Solution.process_task()\n    print(Solution.get_result())\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "de723a60ef770766caaf3e595bdde1c1", "src_uid": "b2b49b7f6e3279d435766085958fb69d", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a=[[0]*11 for _ in range(11)]\nn,a[0][0]=map(int,raw_input().split())\nz=0\na[0][0]*=1024\n#print a\nfor r in range(n):\n  for c in range(r+1):\n    d=a[r][c]-1024\n    if d>=0:\n      z+=1\n      a[r+1][c]+=d/2\n      a[r+1][c+1]+=d/2\n#print a\nprint z", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "e86a79e55931b57a367661edbbd1ee65", "src_uid": "b2b49b7f6e3279d435766085958fb69d", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x, y, z, t1, t2, t3 = map(int, raw_input().split())\na1 = abs(x - y) * t1\na2 = abs(x - z) * t2 + t3 * 3 + abs(x - y) * t2\nif a1 < a2:\n    print \"NO\"\nelse:\n    print \"YES\"\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "2f2b0c2fd9de5af8e24ad53d1c743148", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x,y,z,t1,t2,t3=map(int,raw_input().split(' '))\nst=abs(x-y)*t1\nev=t2*(abs(z-x)+abs(x-y))+t3*3\nif st<ev:\n    print 'NO'\nelse:\n    print 'YES'", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "1ab677f0e88b28350a47a74a66aa47d0", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\nt=int(input())\nt=t+1\nif t==1:\n\tprint(0)\n\texit()\nelif t%2==0:\n\tprint(t//2)\n\texit()\nelse :\n\tprint(t)\n\t", "lang_cluster": "Python", "tags": ["math"], "code_uid": "6be160907ff766b9436587172b548403", "src_uid": "236177ff30dafe68295b5d33dc501828", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\n\n\nguests = int(input())\nguests = guests+1\n\nif guests == 1:\n    print(\"0\")\nelif guests % 2 == 0:\n    print(guests//2)\n\nelse:\n    print(guests)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "644655158b43064bb08f0fa5b7f9618f", "src_uid": "236177ff30dafe68295b5d33dc501828", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\na,b,c=int(input()),int(input()),int(input())\nif(n==1):\n    print(0)\nelse:\n    if(a<b):\n        print(a+(n-2)*min(a,c))\n    else:\n        print(b+(n-2)*min(b,c))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "6777803d43ddb71987c940bb78fe3273", "src_uid": "6058529f0144c853e9e17ed7c661fc50", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\na = int(input())\nb = int(input())\nc = int(input())\nl = min(a, b, c)\nif (n == 1):\n    print (0)\nelif (l != c):\n    print ((n-1)*l)\nelse:\n    print ((n-2)*l + min(a, b))\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "211b92d22a43fe2581851823dc83e224", "src_uid": "6058529f0144c853e9e17ed7c661fc50", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m,s=[int(s) for s in input().split()]\na=(n % s)\nb=(m % s)\nif a==0 and n>=s:a=s\nif b==0 and m>=s:b=s\nunit=(a*b)\n\nprint(((n-1)//s+1)*((m-1)//s+1)*unit)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "f8bb16e4c5adf525c0f494afa4c3cea1", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, m, s = map(int, raw_input().split())\nr = n % s\nc = m % s\nif r == 0:\n    r = s\nif c == 0:\n    c = s\nr *= (n - 1) / s + 1\nc *= (m - 1) / s + 1\nprint r * c", "lang_cluster": "Python", "tags": ["math"], "code_uid": "503c3ac996be6d85cfefeddb9c82e3d1", "src_uid": "e853733fb2ed87c56623ff9a5ac09c36", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "__author__ = 'Eddie'\nimport sys\n\n\ndef get_filehandler(is_file):\n    if is_file:\n        return open(file=\"data\")\n    else:\n        import sys\n\n        return sys.stdin\n\n\n# custom starts\n\ndef get_count(board):\n    cnt_x, cnt_z, cnt_p = 0, 0, 0\n    for item in board:\n        for alpha in item:\n            if alpha == \"X\":\n                cnt_x += 1\n                continue\n            if alpha == \".\":\n                cnt_p += 1\n                continue\n            if alpha == \"0\":\n                cnt_z += 1\n                continue\n    return cnt_x, cnt_z, cnt_p\n\n\ndef get_result(board):\n    cnt = get_count(board)\n    if cnt[0] - cnt[1] != 1 and cnt[0] - cnt[1] != 0:\n        return \"illegal\"\n    return get_winner(cnt, board)\n\n\ndef get_winner(cnt, board):\n    mark = None\n    for l in board:\n        if l[0] == l[1] == l[2] != \".\":\n            if mark:\n                return \"illegal\"\n            mark = l[0]\n    if not mark:\n        for i in range(0, 3):\n                if board[0][i] == board[1][i] == board[2][i] != \".\":\n                    if mark:\n                        return \"illegal\"\n                    mark = board[0][i]\n\n    if board[0][0] == board[1][1] == board[2][2] != \".\":\n        mark = board[0][0]\n    elif board[0][2] == board[1][1] == board[2][0] != \".\":\n        mark = board[0][2]\n    if mark == \"X\":\n        if cnt[0] <= cnt[1]:\n            return \"illegal\"\n        return \"the first player won\"\n    elif mark == \"0\":\n        if cnt[0] > cnt[1]:\n            return \"illegal\"\n        return \"the second player won\"\n    if cnt[2] != 0:\n        if cnt[0] == cnt[1]:\n            return \"first\"\n        else:\n            return \"second\"\n    else:\n       return \"draw\"\n\n\n\n\n\nif __name__ == '__main__':\n    fh = get_filehandler(is_file=False)\n    # fh = get_filehandler(is_file=True)\n\n    board = [s.rstrip() for s in fh.readlines()]\n    result = get_result(board)\n\n    print(result)\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "games"], "code_uid": "ac9a9f866695531244c58df97a767f95", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\ndef pd(s1,s2,s3):\n    flg1=0\n    flg2=0\n    flg3=0\n    if s1 == '.':\n        flg1 +=1\n    elif s1 =='0':\n        flg2 +=1\n    else:\n        flg3 +=1\n\n    if s2 == '.':\n        flg1 +=1\n    elif s2 =='0':\n        flg2 +=1\n    else:\n        flg3 +=1\n    if s3 == '.':\n        flg1 +=1\n    elif s3 =='0':\n        flg2 +=1\n    else:\n        flg3 +=1\n#####################\n    if flg3 == 3:\n        return 'X'\n    elif flg2 == 3:\n        return '0'\n    elif flg1 == 0:\n        return -1\n    else:\n        return 1\n#####################\ndef count(s1):\n    if s1 == 'X':\n        return 1\n    elif s1 == '0':\n        return -1\n    else:\n        return 0\n\nif __name__ == '__main__':\n\n    s1 = map(str,sys.stdin.readline().split())\n    s2 = map(str,sys.stdin.readline().split())\n    s3= map(str,sys.stdin.readline().split())\n    c1 = s1[0][0:1]\n    c2 = s1[0][1:2]\n    c3 = s1[0][2:3]\n    c4 = s2[0][0:1]\n    c5 = s2[0][1:2]\n    c6 = s2[0][2:3]\n    c7 = s3[0][0:1]\n    c8 = s3[0][1:2]\n    c9 = s3[0][2:3]\n    l=0\n    l+=count(c1)\n    l+=count(c2)\n    l+=count(c3)\n    l+=count(c4)\n    l+=count(c5)\n    l+=count(c6)\n    l+=count(c7)\n    l+=count(c8)\n    l+=count(c9)\n\n    if l>1 or l<0:\n        print 'illegal'\n    else:\n        t=[]\n        t.append(pd(c1,c2,c3))\n        t.append(pd(c4,c5,c6))\n        t.append(pd(c7,c8,c9))\n        t.append(pd(c1,c4,c7))\n        t.append(pd(c2,c5,c8))\n        t.append(pd(c3,c6,c9))\n        t.append(pd(c1,c5,c9))\n        t.append(pd(c3,c5,c7))\n        \n        if 'X' in t and '0' in t:\n            print 'illegal'\n        elif 'X' in t and l ==0:\n            print 'illegal'\n        elif '0' in t and l ==1:\n            print 'illegal'\n        elif 'X' in t :\n\n            print 'the first player won'\n\n        elif   '0' in t:\n\n            print 'the second player won'\n        elif 1 in t:\n            if l == 0:\n                print 'first'\n            else:\n                print 'second'\n        else:\n            print 'draw'\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "games"], "code_uid": "afe1f9d66bcd8da5455d8cee80827d57", "src_uid": "892680e26369325fb00d15543a96192c", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "k = int(input())\nz = int(input())\nm = int(input())\nn = int(input())\nd = int(input())\ni = 0\ncnt = 0\nfor i in range(d+1):\n    if i % k != 0 and i % z != 0 and i % m != 0 and i % n != 0:\n        cnt += 1\nprint(str(d - cnt))\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "4b439d3ec643d4284948ea38741af457", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a=[0]*100001\nk=int(input())\nl=int(input())\nm=int(input())\nn=int(input())\nd=int(input())\nfor i in range(k,d+1,k):\n    a[i]=1\n\nfor i in range(l,d+1,l):\n    a[i]=1\n\nfor i in range(m,d+1,m):\n    a[i]=1\n\nfor i in range(n,d+1,n):\n    a[i]=1\nprint(a.count(1))\n\n    \n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "implementation"], "code_uid": "69f6e949f265d18b79c51387d61e95d3", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "k, a, b = list(map(lambda x: int(x), input().split()))\nr = 0\naa = b // k\nbb = a // k\na %= k\nb %= k\nr += aa + bb\naa *= k-1\nbb *= k-1\nif a <= aa and b <= bb:\n    print(r)\nelse:\n    print(-1)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "b072dc9e37263b339fdf61bfaddd23a7", "src_uid": "6e3b8193d1ca1a1d449dc7a4ad45b8f2", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "k,a,b=map(int,input().split())\nu=int(a/k)+int(b/k)\nif (a<k) and (b%k) :\n    u=-1\nif (b<k) and (a%k):\n    u=-1\nprint(u)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "1616a4c079fa5f3ca60b19c0572651d0", "src_uid": "6e3b8193d1ca1a1d449dc7a4ad45b8f2", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "p, d, t, f, c, r = input(), input(), input() * 1., input(), input(), 0\nwhile p < d and p * t * d / (d - p) + 1E-9 < c:\n\tt += 2. * p * t / (d - p) + f\n\tr += 1\nprint r", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "a87b4f65f4b532a11edc557e6396b29a", "src_uid": "c9c03666278acec35f0e273691fe0fff", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n\nVp = int(raw_input().strip())\nVd = int(raw_input().strip())\nT = int(raw_input().strip())\nf = int(raw_input().strip())\nc = int(raw_input().strip())\nres = 0\nx = Vp*T \ny = 0\nif Vp >= Vd:\n\tres = 0\nelse:\n\twhile (True):\n\t\tt = 1.0*x / (Vd-Vp)\n\t\tif x + t*Vp<c:\n\t\t\tres += 1\n\t\t\tx += (f+2*t)*Vp\n\t\telse:\n\t\t\tbreak\n\nprint res\n\n\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "bf4cee44780c33ab01e0ec09a10d8874", "src_uid": "c9c03666278acec35f0e273691fe0fff", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\r\nimport os\r\nimport sys\r\nfrom io import BytesIO, IOBase\r\n\r\n\r\ndef main():\r\n    pass\r\n\r\n\r\n# region fastio\r\n\r\nBUFSIZE = 8192\r\n\r\n\r\nclass FastIO(IOBase):\r\n    newlines = 0\r\n\r\n    def __init__(self, file):\r\n        self._fd = file.fileno()\r\n        self.buffer = BytesIO()\r\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\r\n        self.write = self.buffer.write if self.writable else None\r\n\r\n    def read(self):\r\n        while True:\r\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\r\n            if not b:\r\n                break\r\n            ptr = self.buffer.tell()\r\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\r\n        self.newlines = 0\r\n        return self.buffer.read()\r\n\r\n    def readline(self):\r\n        while self.newlines == 0:\r\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\r\n            self.newlines = b.count(b\"\\n\") + (not b)\r\n            ptr = self.buffer.tell()\r\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\r\n        self.newlines -= 1\r\n        return self.buffer.readline()\r\n\r\n    def flush(self):\r\n        if self.writable:\r\n            os.write(self._fd, self.buffer.getvalue())\r\n            self.buffer.truncate(0), self.buffer.seek(0)\r\n\r\n\r\nclass IOWrapper(IOBase):\r\n    def __init__(self, file):\r\n        self.buffer = FastIO(file)\r\n        self.flush = self.buffer.flush\r\n        self.writable = self.buffer.writable\r\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\r\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\r\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\r\n\r\n\r\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\r\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\r\n\r\n# endregion\r\n\r\nif __name__ == \"__main__\":\r\n    main()\r\nmod=(10**9)+7\r\n\r\n\r\npre=[0]\r\nval=16\r\nfor i in range(1,61):\r\n    pre.append(val)\r\n    val=(val*val)%mod\r\n\r\ninv=pow(16,mod-2,mod)\r\n\r\nn=int(input())\r\n\r\nans=(pre[n]*6*inv)%mod\r\nprint(ans)\r\n\r\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "3909f5a59a968e9b0310e74db0c707be", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "mod=10**9+7\r\nk=int(input())\r\nprint((pow(4,2**k-2,mod)*6)%mod)", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "8e9fc8477e311e8ed6c23018f872d86d", "src_uid": "5144b9b281ea4087d8334d91c3c8bda4", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n, k = map(int, raw_input().split())\nfib, i = [1, 1], 1\nfor j in range(2, 50):\n  fib.append(fib[j - 1] + fib[j - 2])\nwhile (i <= n):\n  if (k <= fib[n - i]):\n    print i,\n    i = i + 1\n  else:\n    print i + 1, i,\n    k, i = k - fib[n - i], i + 2\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "math", "combinatorics", "binary search", "greedy", "implementation"], "code_uid": "ae427fd190c5d4f7b81baa013551b1cc", "src_uid": "e03c6d3bb8cf9119530668765691a346", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, k = map(int, raw_input().split())\np = [1, 1]\nfor i in range(2,n+1): p.append(p[i - 1] + p[i - 2])\n\ndef tim(k, n, x):\n\t#print \"---%d %d %d\" %(k, n, x)\n\tif n == 0: return 0\n\tif k == 0: return 0\n\tif k <= p[n-1]:\n\t\tprint x + 1,\n\t\ttim(k, n - 1, x + 1)\t\t\n\telse:\n\t\tprint x + 2, x + 1,\n\t\ttim(k - p[n - 1], n - 2, x + 2)\t\t\ntim(k, n, 0)", "lang_cluster": "Python", "tags": ["constructive algorithms", "math", "combinatorics", "binary search", "greedy", "implementation"], "code_uid": "05c710f183a8a1e78d377bc42c6b9a97", "src_uid": "e03c6d3bb8cf9119530668765691a346", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "m=[2**i for i in xrange(19)]\ndef madd(*a):\n    m.append(sum(map(lambda x: 2**x,a)))\ndef padd(l):\n    for i in range(2,len(l)+1):\n        for j in range(len(l)-i+1):\n            madd(*l[j:j+i])\n\na1 = ([0,3,7],[1,4,8,12],[2,5,9,13,16],[6,10,14,17],[11,15,18])\nmap(padd,a1+([0,1,2],[3,4,5,6],[7,8,9,10,11],[12,13,14,15],[16,17,18],[7,12,16],[3,8,13,17],[0,4,9,14,18],[1,5,10,15],[2,6,11]))\n    \na = ' '.join(raw_input() for i in xrange(5)).split()\npx = sum([2**y for x,y in zip(a,sum(a1,[])) if x=='O'],0)\nq = [False]*600000\nm.sort()\nfor i in xrange(0,px+1):\n    if q[i]: continue\n    for p in m:\n        if i&p: continue\n        q[i|p] = True\n        \nprint \"Karlsson\" if q[px] else \"Lillebror\"\n\n\n", "lang_cluster": "Python", "tags": ["dfs and similar", "games", "dp", "bitmasks", "implementation"], "code_uid": "b0becb536dfcf4cd1ea10bb72e8aefa0", "src_uid": "eaa022cc7846c983a826900dc6dd919f", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "m=[2**i for i in xrange(19)]\ndef madd(*a):\n    m.append(sum(map(lambda x: 2**x,a)))\ndef padd(l):\n    for i in range(2,len(l)+1):\n        for j in range(len(l)-i+1):\n            madd(*l[j:j+i])\n\na1 = ([0,3,7],[1,4,8,12],[2,5,9,13,16],[6,10,14,17],[11,15,18])\nmap(padd,a1+([0,1,2],[3,4,5,6],[7,8,9,10,11],[12,13,14,15],[16,17,18],[7,12,16],[3,8,13,17],[0,4,9,14,18],[1,5,10,15],[2,6,11]))\n    \na = ' '.join(raw_input() for i in xrange(5)).split()\npx = sum([2**y for x,y in zip(a,sum(a1,[])) if x=='O'],0)\nq = [False]*600000\nm.sort()\nfor i in xrange(0,px+1):\n    if q[i]: continue\n    for p in m:\n        if i&p: continue\n        q[i|p] = True\n        \nprint \"Karlsson\" if q[px] else \"Lillebror\"\n\n\n", "lang_cluster": "Python", "tags": ["dfs and similar", "games", "dp", "bitmasks", "implementation"], "code_uid": "14009eb5a67dfb56a51c63025aaada7f", "src_uid": "eaa022cc7846c983a826900dc6dd919f", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\ntxt = str(raw_input())\nwyn = 0\nwyn2 = 1\nlit = ''\nfor x in range(0, n-1, +1):\n    wyn2 = 1\n    for y in range(1, n-1, +1):\n        if txt[y] == txt[x] and txt[y+1] == txt[x+1]:\n            wyn2 += 1\n    if wyn2 > wyn:\n        wyn = wyn2\n        lit = txt[x]+txt[x+1]\nprint lit", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "52f28fccdc48c7ba03d62f40429ac410", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\ns = input()\nok = [s[i-1:i+1] for i in range(1, n)]\n# print(ok)\n\nmp = {}\n\nfor strings in ok:\n    if mp.get(strings) == None:\n        mp[strings] = 1\n    else :\n        mp[strings] += 1\n\nmx = 0\nans = ''\nfor key, value in mp.items():\n    # print(key, value)\n    if mx < value:\n        mx = value\n        ans = key\nprint(ans)", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "572259ff5ba7a70e10dbe25a0b38d459", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\ngraph=[{},{},{}]\nfor i in range(n):\n    for j in range(n):\n        graph[0][(i,j)]=[(k,j) for k in range(n)]+[(i,k) for k in range(n)]\n        graph[0][(i,j)].remove((i,j))\n        graph[0][(i,j)].remove((i,j))\n        graph[1][(i,j)]=[]\n        for k in range(n):\n            for l in range(n):\n                if abs(k-i)==abs(l-j)!=0:\n                    graph[1][(i,j)].append((k,l))\n        graph[2][(i,j)]=[]\n        for k in range(n):\n            for l in range(n):\n                if {abs(k-i),abs(l-j)}=={1,2}:\n                    graph[2][(i,j)].append((k,l))      \n\ndists=[[{},{},{}],[{},{},{}],[{},{},{}]]\nfor i in range(n):\n    for j in range(n):\n        for k in range(3):\n            dists[k][k][(i,j,i,j)]=0\nfor i in range(n):\n    for j in range(n):\n        for k in range(3):\n            layers=[[(i,j,k,0)],[],[],[],[]]\n            for l in range(4):\n                for guy in layers[l]:\n                    for m in range(3):\n                        if m!=guy[2]:\n                            if (i,j,guy[0],guy[1]) not in dists[k][m]:\n                                layers[l+1].append((guy[0],guy[1],m,guy[3]+1))\n                                dists[k][m][(i,j,guy[0],guy[1])]=1000*(l+1)+guy[3]+1\n                    for boi in graph[guy[2]][(guy[0],guy[1])]:\n                        if (i,j,boi[0],boi[1]) not in dists[k][guy[2]]:\n                            layers[l+1].append((boi[0],boi[1],guy[2],guy[3]))\n                            dists[k][guy[2]][(i,j,boi[0],boi[1])]=1000*(l+1)+guy[3]\n                        elif 1000*(l+1)+guy[3]<dists[k][guy[2]][(i,j,boi[0],boi[1])]:\n                            layers[l+1].append((boi[0],boi[1],guy[2],guy[3]))\n                            dists[k][guy[2]][(i,j,boi[0],boi[1])]=1000*(l+1)+guy[3]\nlocs=[None]*(n**2)\nfor i in range(n):\n    a=list(map(int,input().split()))\n    for j in range(n):\n        locs[a[j]-1]=(i,j)\nbest=(0,0,0)\nfor i in range(n**2-1):\n    tup=(locs[i][0],locs[i][1],locs[i+1][0],locs[i+1][1])\n    new0=min(best[0]+dists[0][0][tup],best[1]+dists[1][0][tup],best[2]+dists[2][0][tup])\n    new1=min(best[0]+dists[0][1][tup],best[1]+dists[1][1][tup],best[2]+dists[2][1][tup])\n    new2=min(best[0]+dists[0][2][tup],best[1]+dists[1][2][tup],best[2]+dists[2][2][tup])\n    best=(new0,new1,new2)\na=min(best)\nprint(a//1000,a%1000)", "lang_cluster": "Python", "tags": ["dfs and similar", "dp", "shortest paths"], "code_uid": "31a7ec35764fc8b84fbb8ec5e08a4a88", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\ninf=1000000000\nn=input()\na=[map(int, raw_input().split()) for i in range(n)]\nmove=[None]*3\nmove[0]=[[2, 1], [1, 2], [-1, 2], [-2, 1], [-2, -1], [-1, -2], [1, -2], [2, -1]]\nmove[1]=[[i, i] for i in range(-n+1, n)]+[[i, -i] for i in range(-n+1, n)]\nmove[2]=[[i, 0] for i in range(-n+1, n)]+[[0, i] for i in range(-n+1, n)]\ndis=[[[[[[[inf, 0] for to_piece in range(3)] for from_piece in range(3)] for to_y in range(n) ] for to_x in range(n)] for from_y in range(n)] for from_x in range(n)]\nfor from_x in range(n):\n\tfor from_y in range(n):\n\t\tfor from_piece in range(3):\n\t\t\tq=[[from_x, from_y, from_piece]]\n\t\t\tfirst=0\n\t\t\tdis[from_x][from_y][from_x][from_y][from_piece][from_piece]=[0, 0]\n\t\t\twhile first<len(q):\n\t\t\t\tcur_x, cur_y, cur_piece=q[first]\n\t\t\t\tfirst+=1\n\t\t\t\tcur_dis, cur_cnt=dis[from_x][from_y][cur_x][cur_y][from_piece][cur_piece]\n\t\t\t\tfor move_x, move_y in move[cur_piece]:\n\t\t\t\t\tnext_x, next_y=cur_x+move_x, cur_y+move_y\n\t\t\t\t\tif 0<=next_x<n and 0<=next_y<n and dis[from_x][from_y][next_x][next_y][from_piece][cur_piece]>[cur_dis+1, cur_cnt]:\n\t\t\t\t\t\tif dis[from_x][from_y][next_x][next_y][from_piece][cur_piece][0]==inf:\n\t\t\t\t\t\t\tq.append([next_x, next_y, cur_piece])\n\t\t\t\t\t\tdis[from_x][from_y][next_x][next_y][from_piece][cur_piece]=[cur_dis+1, cur_cnt]\n\t\t\t\tfor to_piece in range(3):\n\t\t\t\t\tif dis[from_x][from_y][cur_x][cur_y][from_piece][to_piece]>[cur_dis+1, cur_cnt+1]:\n\t\t\t\t\t\tif dis[from_x][from_y][cur_x][cur_y][from_piece][to_piece][0]==inf:\n\t\t\t\t\t\t\tq.append([cur_x, cur_y, to_piece])\n\t\t\t\t\t\tdis[from_x][from_y][cur_x][cur_y][from_piece][to_piece]=[cur_dis+1, cur_cnt+1]\npos=[None]*(n*n+1)\nfor x in range(n):\n\tfor y in range(n):\n\t\tpos[a[x][y]]=[x, y]\ndp=[[[[inf, 0] for piece in range(3)] for y in range(n)] for x in range(n)]\ndp[pos[n*n][0]][pos[n*n][1]]=[[0, 0], [0, 0], [0, 0]]\nfor value in range(n*n-1, 0, -1):\n\tcur_x, cur_y=pos[value]\n\tnext_x, next_y=pos[value+1]\n\tfor from_piece in range(3):\n\t\tfor to_piece in range(3):\n\t\t\ta=dp[next_x][next_y][to_piece]\n\t\t\tb=dis[cur_x][cur_y][next_x][next_y][from_piece][to_piece]\n\t\t\tdp[cur_x][cur_y][from_piece]=min(dp[cur_x][cur_y][from_piece], [a[0]+b[0], a[1]+b[1]])\nresult=dp[pos[1][0]][pos[1][1]]\nresult=min(result[0], result[1], result[2])\nprint result[0], result[1]", "lang_cluster": "Python", "tags": ["dfs and similar", "dp", "shortest paths"], "code_uid": "62d12826857353ec2739ec12b1d6f307", "src_uid": "5fe44b6cd804e0766a0e993eca1846cd", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = []\nfor i in range(2):\n    a1 = input()\n    a2 = input()\n    a = a1 + a2\n    k = a.index('X')\n    if k == 0:\n        x = a[2]+a[1]+a[3]\n    elif k == 1:\n        x = a[2]+a[0]+a[3]\n    elif k == 2:\n        x = a[3]+a[0]+a[1]\n    else:\n        x = a[2]+a[0]+a[1]\n    s.append(x)\n#print(s)\nb1 = s[0][1] + s[0][2] + s[0][0]\nb2 = s[0][2] + s[0][0] + s[0][1]\nif s[0] == s[1] or s[1] == b1 or s[1] == b2:\n    print('YES')\nelse:\n    print('NO')", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "implementation"], "code_uid": "3bc0934e1734bf115f59171f6e7ad02d", "src_uid": "46f051f58d626587a5ec449c27407771", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "config1=(raw_input()+raw_input()[::-1]).replace(\"X\",\"\")\nconfig2=(raw_input()+raw_input()[::-1]).replace(\"X\",\"\")\n\nif config2==config1 or config2==(config1[1]+config1[2]+config1[0]) or config2==(config1[2]+config1[0]+config1[1]):\n\tprint \"YES\"\nelse:\n\tprint \"NO\"", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "implementation"], "code_uid": "300eafeff97d31af2d9026d33f80604e", "src_uid": "46f051f58d626587a5ec449c27407771", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "angle = int(input())\nangle = (angle % 360 + 360) % 360\nangle = (angle + 44) % 360\nanswer = (angle % 359) // 90\nprint(answer)", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "faf1fb59e158215fdb6a02a21b6dd8f4", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = -input() % 360\n\nif n == 0:\n    print 0\nelse:\n    ans = 0\n    pos = min(abs(360 - n) ,abs(-n))\n\n    for i in range(1,4):\n        if min(abs(360 - (n + 90 * i)),abs(- (n + 90 * i))) < pos:\n            ans = i\n            pos = min(abs(360 - (n + 90 * i)),abs(- (n + 90 * i)))\n\n    print ans\n    \n", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "37bfd57f72b2f6b1f2b00ec8ce1252fa", "src_uid": "509db9cb6156b692557ba874a09f150e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = raw_input()\ns = [x for x in raw_input()]\nprint \"1\" * int(s.count('1') > 0) + \"0\" * s.count('0')\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "d30ddcce4b9d692a1d84ee0dd1bf5c04", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = input()\ns = input()\ns = ''.join(reversed(sorted(s)))\nif s == '0':\n    print(0)\n    exit(0)\nk = 0\nfor i in range(len(s)):\n    if s[i] == '0':\n        k += 1\nif n == 1:\n    print(s)\n    exit(0)\nans = '1' + '0'*k\nprint(ans)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "cb3d87cabc9addea838283045613979c", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n\ndef minp():\n\treturn sys.stdin.readline().strip()\n\ndef mint():\n\treturn int(minp())\n\ndef mints():\n\treturn map(int,minp().split())\n\nn,m,mi,ma = mints()\na = list(mints())\nmii = min(a)\nmaa = max(a)\nif mii > mi:\n\tm += 1\nif maa < ma:\n\tm += 1\nif mii < mi or maa > ma or m > n:\n\tprint(\"Incorrect\")\nelse:\n\tprint(\"Correct\")\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "99c9d473cc583582cbe2a6bf3c0ed9f8", "src_uid": "99f9cdc85010bd89434f39b78f15b65e", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m, v1, v2 = map(int, input().split())\nt = list(map(int, input().split()))\nt1, t2 = min(t), max(t)\nif t1 < v1 or t2 > v2:\n    print('Incorrect')\nelif (v1 < t1) + (v2 > t2) > n - m:\n    print('Incorrect')\nelse:\n    print('Correct')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "2d09059805c1eb6cadaa9cc54317ba0c", "src_uid": "99f9cdc85010bd89434f39b78f15b65e", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "lemon = int(input()) ; apple = int(input()) ; pear = int(input())\nfruits = 0\nif lemon < 1 or apple < 2 or pear < 4:\n    print(0)\n    exit()\nelse:\n    for i in range(lemon):\n        if lemon >= 1 and apple >= 2 and pear >= 4:\n            lemon -= 1 ; apple -= 2 ; pear -= 4\n            fruits += 1 ; fruits += 2 ; fruits += 4\nprint(fruits)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "118e1e7c32a09a910dcb53d204f324d9", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = int(input())\nb = int(input())\nc = int(input())\n\nx = a\ny = b // 2\nz = c // 4\n\n\nr =min(x , y , z)\n\nprint(r * 7 )\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "b24a89c98ef0a869a979bbe21c88a283", "src_uid": "82a4a60eac90765fb62f2a77d2305c01", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from fractions import Fraction\na,b,c,d=map(int,input().split())\n# if(max(a,b)<max(c,d)):\n#     z=Fraction(Fraction(a,b),Fraction(c,d))\n# else:\n#     z=Fraction(Fraction(c,d),Fraction(a,b))\n\n# if((Fraction(1,1)-z)==0):\n#     print(\"0/1\")\n# else:\n#     print(Fraction(1,1)-z)\n               \nz1=Fraction(Fraction(a,b),Fraction(c,d))\nz2=Fraction(Fraction(c,d),Fraction(a,b))\n\nif((Fraction(1,1)-z1)==0):\n    print(\"0/1\")\n    \nelse:\n    x=Fraction(1,1)-z1\n    if(x>0 and x<1):\n        print(x)\n    else:\n        print(Fraction(1,1)-z2)", "lang_cluster": "Python", "tags": ["math", "greedy", "number theory"], "code_uid": "71b78675d713e11f3409f44d9bf2f2a2", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import gcd\nfrom fractions import Fraction\ndef reduce_fraction(x,y):\n    d = gcd(x,y)\n    x = x // d\n    y = y // d\n    frac = Fraction(x/y).limit_denominator()\n    print (frac)\n\na,b,c,d = map(int,input().split())\nhorizontal_space = (b*c - a*d) \nvertical_space = (a*d - b*c)\nflag = False\nif horizontal_space == vertical_space:\n    print(\"0/1\")\n    flag = True\nelif horizontal_space > 0:\n    numerator = horizontal_space\n    denominator = b*c\nelif vertical_space > 0:\n    numerator = vertical_space\n    denominator = a*d\n\nif not flag:\n    reduce_fraction(numerator , denominator)\n\n", "lang_cluster": "Python", "tags": ["math", "greedy", "number theory"], "code_uid": "0d09f8f8152bb237796009096b74747d", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys, array, bisect, collections, heapq, itertools, math, functools\r\nsys.setrecursionlimit(100000)\r\n\r\ndef _r(): return sys.stdin.buffer.readline()\r\ndef rs(): return _r().decode('ascii').strip()\r\ndef rn(): return int(_r())\r\ndef rnt(): return tuple(map(int, _r().split()))\r\ndef rnl(): return list(rnt())\r\ndef rna(): return array.array('q', rnt())\r\ndef pnl(l): print(' '.join(map(str, l)))\r\n\r\ndef factorials_precalc(n, mod, inverse=True):\r\n    fact = [1]*(n+1)\r\n    rfact = [1]*(n+1) if inverse else None\r\n    for i in range(1, n+1):\r\n        fact[i] = fact[i-1] * i % mod;\r\n        if inverse:\r\n            rfact[i] = pow(fact[i], mod - 2, mod)\r\n    return fact, rfact\r\n \r\nmod = 998244353\r\nfact, rfact = factorials_precalc(500, mod)\r\n\r\ndef binomial(n, k):\r\n    return fact[n] * rfact[k] * rfact[n-k] % mod\r\n\r\n@functools.lru_cache(maxsize=None)\r\ndef solve(n, x): \r\n    if n == 1:\r\n        return 0\r\n    if x < n:\r\n        return pow(x, n, mod)\r\n    sol = pow(n-1, n, mod)\r\n    for i in range(n-1):\r\n        sol = (sol + fact[n] * rfact[i] * rfact[n-i] * pow(n-1, i, mod) * solve(n-i, x-n+1)) % mod\r\n    return sol\r\n \r\nprint(solve(*rnt()))", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "8d163efe4f4d7c9eda30b3a3615a6ffd", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "from functools import lru_cache\n\nMOD = 998244353\nN, X = map(int, input().split())\n\nr = 1\n\nF = [1, 1]\nfor i in range(2, N+1):\n    F.append((i * F[i-1]) % MOD)\n\nIF = list(F)\nIF[N] = pow(IF[N], MOD-2, MOD)\nfor i in range(N-1, 1, -1):\n    IF[i] = IF[i+1] * (i+1)\n\ndef comb(n, k):\n    return F[n] * IF[k] % MOD * IF[n-k] % MOD\n\n@lru_cache(maxsize=None)\ndef g(n, x):\n    if n == 1: return 0\n    assert x >= 1\n\n    dmg = n-1\n    if dmg >= x:\n        return pow(x, n, MOD)\n\n    r = pow(dmg, n, MOD)\n    for rem in range(2, n+1):\n        #print('cur', n, 'rem', rem, 'x', x)\n        attr = (comb(n, rem) * pow(dmg, n-rem, MOD) % MOD * g(rem, x-dmg)) % MOD\n        #print(attr)\n        r = (r + attr) % MOD\n\n    #print(n, x, r)\n    return r\n\n\n\n\"\"\"\nfor i in range(2, X+1):\n    for j in range(2, N+1):\n        print(i, j)\n        r = (r + comb(N, j) * pow(i-1, N-j, MOD)) % MOD\n\"\"\"\n\nprint(g(N, X))\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "361f3ae775b1b49983d68d28ac43a90f", "src_uid": "1908d1c8c6b122a4c6633a7af094f17f", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "arr=[]\narr1=[]\narr2=[]\nfor i in range(0,4):\n    x1,y1,x2,y2=map(int,input().split())\n    p1=(x1,y1)\n    p2=(x2,y2)\n    p3=(x1,y1,x2,y2)\n    arr2.append(p3)\n    arr.append(p1)\n    arr.append(p2)\narr1=list(set(arr))\nif len(arr1)>4 or len(arr1)<4:\n    print(\"NO\")\n    exit()\nminx=10000000000\nmaxx=-10000000000\nminy=10000000000\nmaxy=-10000000000\nfor i in range(0,len(arr1)):\n    if minx>arr1[i][0]:\n        minx=arr1[i][0]\n    if maxx<arr1[i][0]:\n        maxx=arr1[i][0]\n    if miny>arr1[i][1]:\n        miny=arr1[i][1]\n    if maxy<arr1[i][1]:\n        maxy=arr1[i][1]\narr3=[]\narr3.append((minx,miny,maxx,miny))\narr3.append((maxx,miny,maxx,maxy))\narr3.append((maxx,maxy,minx,maxy))\narr3.append((minx,maxy,minx,miny))\n# print(arr3)\ncount=0\nfor i in range(0,4):\n    for j in range(0,4):\n        if arr3[i][0]==arr2[j][0] and arr3[i][1]==arr2[j][1] and arr3[i][2]==arr2[j][2] and arr3[i][3]==arr2[j][3]:\n            count+=1\n            break\n            # print(arr3[i][0],arr3[i][1],arr3[i][2],arr3[i][3],arr2[i][0],arr2[i][1],arr2[i][2],arr2[i][3])\n        elif arr3[i][2]==arr2[j][0] and arr3[i][3]==arr2[j][1] and arr3[i][0]==arr2[j][2] and arr3[i][1]==arr2[j][3]:\n            count+=1\n            break\n            # print(arr3[i][0],arr3[i][1],arr3[i][2],arr3[i][3],arr2[i][0],arr2[i][1],arr2[i][2],arr2[i][3])\n# print(count)\n# print(arr2,arr3)\nif count==4:\n    print(\"YES\")\nelse:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "math", "implementation", "geometry"], "code_uid": "370d5138743f6a78a651d39ecf06850f", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def read_line():\n  line = [int(item) for item in raw_input().split(\" \")]\n  return sorted([(line[0],line[1]), (line[2],line[3])])\n\nlines = [read_line(), read_line(), read_line(), read_line()]\n\ndef is_vertical(line):\n  return line[0][0] == line[1][0]\n\ndef is_horizontal(line):\n  return line[0][1] == line[1][1]\n\ndef is_point(line):\n  return (is_horizontal(line) and is_vertical(line))\n\npoints = [line for line in lines if is_point(line)]\nhor = sorted([line for line in lines if is_horizontal(line)])\nvert = sorted([line for line in lines if is_vertical(line)])\n\nif not(len(hor) == 2 and len(vert) == 2):\n  print \"NO\"\n  exit()\n\nif len(points) > 0:\n  print \"NO\"\n  exit()\n\nif hor[0] == hor[1]:\n  print \"NO\"\n  exit()\n\nif vert[0] == vert[1]:\n  print \"NO\"\n  exit()\n\n#print hor\n#print vert\n#print lines\n\nif hor[0][0] != min(vert)[0]:\n  print \"NO\"\n  exit()\nif hor[0][1] != max(vert)[0]:\n  print \"NO\"\n  exit()\nif hor[1][0] != min(vert)[1]:\n  print \"NO\"\n  exit()\nif hor[1][1] != max(vert)[1]:\n  print \"NO\"\n  exit()\n\nif vert[0][0] != min(hor)[0]:\n  print \"NO\"\n  exit()\nif vert[0][1] != max(hor)[0]:\n  print \"NO\"\n  exit()\n\nif vert[1][0] != min(hor)[1]:\n  print \"NO\"\n  exit()\nif vert[1][1] != max(hor)[1]:\n  print \"NO\"\n  exit()\n\nprint \"YES\"\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "math", "implementation", "geometry"], "code_uid": "1052bd17f00a057a57bee624982ca86d", "src_uid": "ad105c08f63e9761fe90f69630628027", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, k = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\ncurr = 0\nfor i in range(n):\n    curr += a[i]\n    mn = min(curr, 8)\n    curr -= mn\n    k -= mn\n    if k <= 0:\n        print(i+1)\n        break\nelse:\n    print (-1)\n    \n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "9f023aec4a27b3fa3503a6c8b839dc33", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, k = [int(x) for x in raw_input().split(' ')]\ncandiesArja = 0\ncandiesBran = 0\ncandies = [int(x) for x in raw_input().split(' ')]\nfor i in range(n):\n    candiesArja += candies[i]\n    currCandies = candiesArja if candiesArja <=8 else 8\n    candiesBran += currCandies\n    candiesArja -= currCandies\n    if candiesBran >= k:\n        print i+1\n        break\nelse:\n    print -1\n\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "41c49d36310f6e87d757bc2aa210e3ce", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\nimport math\n\nn = int(sys.stdin.readline())\n\nv = [0] * n\nost = 1\nif(n > 1):\n    v[1] = 1\nfor i in range(1, n + 1):\n    ost = (ost + i) % n\n    v[ost] = 1\n\nfor i in v:\n    if(i == 0):\n        print(\"NO\")\n        exit()\n    \nprint(\"YES\")\n    \n    ", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "77593031c1f5e3857ffc101a58a71f64", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\nz = 0\nK = [0] * n\n\nk = 0\nx = 0\nwhile x <= 1000:\n    k += x\n    while k >= n:\n        k = k - n\n    K[k] = 1\n    x += 1\nif 0 in K:\n    print 'NO'\nelse:\n    print 'YES'\n    \n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "e4422a432c37785cf7d809e225c321ac", "src_uid": "4bd174a997707ed3a368bd0f2424590f", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,k = map(int,raw_input().split())\na = (n/2) / (k+1)\nb = k*a\nprint a,b,n-(a+b)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "ef4556a20236aa1d1b5ca3001716de67", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, k = map(int, input().split())\n\nif n // 2 < k:\n\tprint(0, 0, n)\nelse:\n\ta = n // 2 // (k + 1)\n\tb = n // 2 // (k + 1) * k\n\tprint(a, b, n - a - b)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "da7acf771c2a7475d536e7a53bc7d21c", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def fi(n):\n    if n == 1:\n        return x\n    elif n == 2:\n        return x + min(x, y)\n    else:\n        if n % 2 == 1:\n            return min(fi(n-1), fi(n+1)) + x\n        else:\n            return fi(n//2) + min(y, x * (n//2))\n        \nn,x,y = map(int, input().split())\nprint(fi(n))", "lang_cluster": "Python", "tags": ["dfs and similar", "dp"], "code_uid": "085863d5f4bc6028b98959b57d3b12ee", "src_uid": "0f270af00be2a523515d5e7bd66800f6", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\n\nn, x, y = map(int, input().split())\nsize = 10**7\ndq_x, dq_y, dq_i = [0]*size, [0]*size, [0]*size\nl, r = 0, 0\ncx, cy = 0, 0\n\nfor i in range(1, n+1):\n    cx += 1\n    while l < r and dq_i[l] < i:\n        l += 1\n    if l < r and (dq_x[l]-i-cx)*x + (dq_y[l]-cy)*y < 0:\n        cx = dq_x[l] - i\n        cy = dq_y[l]\n\n    tx, ty = cx + i*2, cy+1\n    while l < r and (dq_x[r]-tx)*x + (dq_y[r]-ty)*y > 0:\n        r -= 1\n    dq_x[r] = tx\n    dq_y[r] = ty\n    dq_i[r] = i*2\n    r += 1\n\nprint(cx*x + cy*y)\n", "lang_cluster": "Python", "tags": ["dfs and similar", "dp"], "code_uid": "f4a08a678477543f58a73824b8cd96dc", "src_uid": "0f270af00be2a523515d5e7bd66800f6", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/python\nimport sys\nwhile True:\n\ts = sys.stdin.readline ().strip ()\n\tif s == '':\n\t\ts = sys.stdin.readline ().strip ()\n\t\tif s == '':\n\t\t\tbreak\n\tn = int (s)\n\tv = (n + 1) / 3\n\tprint v / 12, v % 12\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "b4a6b3ee63f61e3a49f3775b882eca3c", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=(int(input())+1)//3\nprint(n//12,n%12)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "0187b4dc713c672de35ad6e0ec6f1800", "src_uid": "5d4f38ffd1849862623325fdbe06cd00", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "MOD = 10 ** 9 + 7\n\n\ndef pow(a, n):\n    res = 1\n    b = a\n    while n != 0:\n        if n % 2:\n            res = (res * b) % MOD\n        n //= 2\n        b = (b * b) % MOD\n    return res\n\nassert pow(2, 10) == 1024\nassert pow(7, 1) == 7\nassert pow(7, 0) == 1\n\n\ndef egcd(a, b):\n    assert a > 0 and b > 0\n\n    a_orig = a\n    b_orig = b\n\n    x0, y0 = 1, 0\n    x1, y1 = 0, 1\n\n    assert a == a_orig * x0 + b_orig * y0\n    assert b == a_orig * x1 + b_orig * y1\n\n    while b != 0:\n        q = a // b\n\n        a, b = b, a - b * q\n        x0, y0, x1, y1 = x1, y1, x0 - q * x1, y0 - q * y1\n\n        assert a == a_orig * x0 + b_orig * y0\n        assert b == a_orig * x1 + b_orig * y1\n\n    return a, x0, y0\n\nif False:\n    print(egcd(3, 5))\n    print(egcd(2, 4))\n    print(egcd(4, 2))\n    print(egcd(5, 3))\n\ndef solve(a, b, n, x):\n    if a == 1:\n        return (x + b * n) % MOD\n\n    a_n = pow(a, n)\n    one, inv_a_1, _ = egcd(a - 1, MOD)\n    assert one == 1\n    assert ((a - 1) * inv_a_1) % MOD == 1\n    res = (a_n * x + b * (a_n - 1) * inv_a_1) % MOD\n\n    return res\n\nif False:\n    assert solve(3, 4, 2, 1) == 25\n    assert solve(3, 4, 1, 1) == 7\n    solve(10 ** 9 - 19, 10 ** 9 - 23, 10 ** 18 - 57, 10 ** 9 - 16)\n    assert solve(1, 4, 2, 10) == 18\n\nelse:\n    a, b, n, x = map(int, input().split())\n    print(solve(a, b, n, x))\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "83cecd52af6809cfa8a63d92620fb9b5", "src_uid": "e22a1fc38c8b2a4cc30ce3b9f893028e", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b,n,x=map(int,raw_input().split())\nmod=1000*1000*1000 +7\nsum=0\nif(a==1):\n    sum=(x%mod+n*b%mod)%mod\nelse:\n    sum=(pow(a,n,mod)*x+(((b*(pow(a,n,mod)-1))%mod)*pow(a-1,mod-2,mod))%mod)%mod\n    \nprint(sum)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "fd6bf6e16fc018351527fb48d17b7a91", "src_uid": "e22a1fc38c8b2a4cc30ce3b9f893028e", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def check(x):\n    if x== False:\n        return 0\n    else:\n        return 1\n\nx, y, z = map(int, input().split())\nx1, y1, z1 = map(int, input().split())\na = list(map(int, input().split()))\nans = a[0]*check(y<0) + a[1]*check(y>y1) + a[2]*check(z<0) + a[3]*check(z>z1) + a[4]*check(x<0) + a[5]*check(x>x1)\nprint(ans)", "lang_cluster": "Python", "tags": ["brute force", "geometry"], "code_uid": "88cdb9afca89bb528551b4a48d8cbd1f", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "rint = lambda: map (int, raw_input() .split ());\n\n[a, b, c] = rint ();\n[x, y, z] = rint ();\nA = rint ();\nB = [b, b - y, c, c - z, a, a - x];\nd = [-1, 1, -1, 1, -1, 1];\nans = 0;\n\nfor i in xrange (6):\n\tif B[i] * d[i] > 0:\n\t\tans += A[i];\nprint ans;\n", "lang_cluster": "Python", "tags": ["brute force", "geometry"], "code_uid": "61bf9c0e970ac336b3bc5a5b5b2a1474", "src_uid": "c7889a8f64c57cf7be4df870f68f749e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import re\nimport itertools\n\ndef get(c):\n       return (ord(c) - ord('0') if '0' <= c <= '9' else ord(c) - ord('A') + 10)\n\ndef con(n, s):\n      if n is '': return 0\n      if get(n[-1]) >= s: return 100\n      return get(n[-1]) + con(n[:-1], s) * s\n\ndef good(m, s):\n      return con(m[0], s) < 24 and con(m[1], s) < 60\n\ns = map(lambda x: max('0', re.sub('^0*', '', x)), raw_input().split(':'))\nans = filter(lambda x: good(s, x), range(100))\nif len(ans) == 0: print '0'\nelif len(ans) > 60: print '-1'\nelse: print ' '.join(str(x) for x in ans)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "4964135f5567bf2a492f029eccf169e4", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import string\nimport re\n\nvalues={str(d): d for d in range(10) }\nfor ch in string.ascii_uppercase:\n    values[ch] = ord(ch) - 55\n\ndef convert(s, i):\n    x=0\n    for ch in s:\n        d = values[ch]\n        if d>=i:\n            return None\n        x = i*x+d\n    return x\n\nmatch=re.match('0*(\\w+):0*(\\w+)',input().strip())\na,b=match.groups([1, 2])\n\nans = []\nfor i in range(2, 60):\n    h = convert(a, i)\n    m = convert(b, i)\n    if h == None or m == None:\n        continue\n    if h < 24 and m < 60:\n        ans.append(i)\n\nif len(ans) == 0:\n    print(0)\nelif len(a) + len(b) == 2:\n    print(-1)\nelse:\n    print(*ans)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "79df8ec8e253920c8fbeb9535b0d9d1e", "src_uid": "c02dfe5b8d9da2818a99c3afbe7a5293", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\nimport math\nimport string\nfrom collections import deque\n\n# Function #\ndef read_int() :\n    temp = raw_input().split();\n    return map(int, temp);\n\ndef read_str() :\n    temp = raw_input().split();\n    return temp;\n\ndef write(output) :\n    sys.stdout.write(output);\n    \ndef writeln(output) :\n    sys.stdout.write(str(output)+'\\n');\n# Class #\n\n\nINF = 9123456789123456789\n# Main Entry #\n\n# Inner Function #\n    \nans = set();    \n\nif __name__ == '__main__':\n\n\n\n    def dfs(now, x, y) :\n        if now <= tc :\n            if now != 0 :\n                ans.add(now);\n            if now*10+x != 0 :\n                dfs(now*10+x, x, y);\n            if now*10+y != 0 :\n                dfs(now*10+y, x, y);\n        \n    tc = read_int()[0];\n\n    for ii in xrange(0, 10) :\n        for jj in xrange(ii+1, 10) :\n            dfs(0, ii, jj);            \n    \n    print len(ans);\n    \n    pass\n# End Here #\n    \n", "lang_cluster": "Python", "tags": ["brute force", "dfs and similar", "bitmasks"], "code_uid": "693193ce4c7834f07e2db8589e822646", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\n\nif n <= 10:\n\tprint n\nelse:\n\tcnt = 9\n\tle = len(str(n))\n\ti = 2\n\twhile i <= le-1:\n\t\tcnt += ((81*((1<<(i-1))-1) + 9))\n\t\ti += 1\n\t\n\td = {}\n\t\n\tfor i in xrange(1,10):\n\t\td[(int(str(i)*le))] = 1\n\t\n\tfor i in xrange(1,10):\n\t\tfor j in xrange(10):\n\t\t\tif i != j:\n\t\t\t\tmask = 0\n\t\t\t\twhile mask < (1<<le-1):\n\t\t\t\t\ttmp = \"\"\n\t\t\t\t\tfor k in xrange(le-1):\n\t\t\t\t\t\tif (mask&(1<<k)) > 0:\n\t\t\t\t\t\t\ttmp = str(i) + tmp\n\t\t\t\t\t\telse:\n\t\t\t\t\t\t\ttmp = str(j) + tmp\n\t\t\t\t\ttmp = str(i) + tmp\n\t\t\t\t\td[(int(tmp))] = 1\n\t\t\t\t\tmask += 1\n\t\n\tfor key in d:\n\t\tif key <= n:\n\t\t\tcnt += 1\n\tprint cnt\n", "lang_cluster": "Python", "tags": ["brute force", "dfs and similar", "bitmasks"], "code_uid": "95991307eb2f2cdb95039013730fc413", "src_uid": "0f7f10557602c8c2f2eb80762709ffc4", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#!/usr/bin/env python3\n\ndef solve():\n    c, v0, v1, a, l = get([int])\n    page = 0\n    days = 0\n    while page < c:\n        page += v0 - (0 if page == 0 else l)\n        v0 += a\n        if v0 > v1:\n            v0 = v1\n        days += 1\n\n    return days\n\n\n\n\n\n\n\n\n\n\n_testcases = \"\"\"\n5 5 10 5 4\n\n1\n\n12 4 12 4 1\n\n3\n\n15 1 100 0 0\n\n15\n\n\"\"\".strip()\n\n# ======================= B O I L E R P L A T E ======================= #\n# Practicality beats purity\n\nimport re\nimport sys\nimport math\nimport heapq\nfrom heapq import heapify, heappop, heappush\nimport bisect\nimport string\nfrom bisect import bisect_left, bisect_right\nimport operator\nfrom operator import itemgetter, attrgetter\nimport itertools\nimport collections\n\ninf = float('inf')\nsys.setrecursionlimit(10000)\n\n\ndef tree():\n    return collections.defaultdict(tree)\n\n\ndef cache(func):  # Decorator for memoizing a function\n    cache_dict = {}\n\n    def _cached_func(*args, _get_cache=False):\n        if _get_cache:\n            return cache_dict\n        if args in cache_dict:\n            return cache_dict[args]\n        cache_dict[args] = func(*args)\n        return cache_dict[args]\n    return _cached_func\n\n\ndef equal(x, y, epsilon=1e-6):\n    # https://code.google.com/codejam/kickstart/resources/faq#real-number-behavior\n    if -epsilon <= x - y <= epsilon:\n        return True\n    if -epsilon <= x <= epsilon or -epsilon <= y <= epsilon:\n        return False\n    return (-epsilon <= (x - y) / x <= epsilon or -epsilon <= (x - y) / y <= epsilon)\n\n\ndef get(_type):  # For easy input\n    if type(_type) == list:\n        if len(_type) == 1:\n            _type = _type[0]\n            return list(map(_type, input().strip().split()))\n        else:\n            return [_type[i](inp) for i, inp in enumerate(input().strip().split())]\n    else:\n        return _type(input().strip())\n\nif __name__ == '__main__':\n    print(solve())", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "34fb2d78b6a23b6312f688e6a8dc4f83", "src_uid": "b743110117ce13e2090367fd038d3b50", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "c, v0, v1, a, l = map(int, input().split())\ncur = cnt = 0\nwhile cur < c:\n    cur = max(0, cur - l)\n    cur += min(v1, v0 + a * cnt)\n    cnt += 1\nprint(cnt)", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "126a13a50a6d1c32a598b1082e567344", "src_uid": "b743110117ce13e2090367fd038d3b50", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "x1, x2, a, b = map(int, input().split())\nif a <= 0 <= b:\n    if x1 < x2:\n        if x2 - x1 <= b:\n            print(\"FIRST\")\n            print(x2)\n        else:\n            print(\"DRAW\")\n    else:\n        if x1 - x2 <= -a:\n            print(\"FIRST\")\n            print(x2)\n        else:\n            print(\"DRAW\")\nelse:\n    reverse = False\n    if a < 0:\n        x1, x2, a, b = -x1, -x2, -b, -a\n        reverse = True\n    if x1 > x2:\n        print(\"DRAW\")\n    else:\n        if (x2 - x1) % (a + b) == 0:\n            print(\"SECOND\")\n        elif a <= (x2 - x1) % (a + b) <= b:\n            print(\"FIRST\")\n            print((x1 + (x2 - x1) % (a + b))\n                  if not reverse else -(x1 + (x2 - x1) % (a + b)))\n        else:\n            print(\"DRAW\")\n", "lang_cluster": "Python", "tags": ["math", "games"], "code_uid": "9ea4cdf91e494841c0265eb53f7e7a6d", "src_uid": "4ea8cc3305a0ee2c1e580b43e5bc46c6", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x1,x2,a,b=map(int,raw_input().split())\nif x1+a<=x2<=x1+b: print 'FIRST'; print x2\nelif a<=0<=b: print 'DRAW'\nelif a>0:\n    if x1>x2: print 'DRAW'\n    else:\n        s=(x2-x1)%(a+b)\n        if s==0: print 'SECOND'\n        elif a<=s<=b: print 'FIRST';print x1+s\n        else: print 'DRAW'\nelse:\n    if x1<x2: print 'DRAW'\n    else:\n        s=abs(x1-x2)%abs(a+b)\n        if s==0: print 'SECOND'\n        elif -b<=s<=-a: print 'FIRST';print x1-s\n        else: print 'DRAW'\n", "lang_cluster": "Python", "tags": ["math", "games"], "code_uid": "831c4b3fd7f8d52d3851c995975ddba8", "src_uid": "4ea8cc3305a0ee2c1e580b43e5bc46c6", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "c,b,n=map(int,input().split())\nif n%2==0:\n\tp=int(n/2)\n\ts=p%b\n\tif s==0:\n\t\ts=s+b\n\tif n%(2*b)==0:\n\t\tx=int(n/(2*b))\n\telse:\n\t\tx=int(n/(2*b))+1\n\tprint(x ,s,\"R\")\nelse:\n\tp=int(n/2)+1\n\ts=p%b\n\tif s==0:\n\t\ts=s+b\n\tif n%(2*b)==0:\n\t\tx=int(n/(2*b))\n\telif n%(2*b)>0:\n\t\tx=int(n/(2*b))+1\n\tprint(x ,s,\"L\")", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "1b829e55eb24979c1210a2765f38db13", "src_uid": "d6929926b44c2d5b1a8e6b7f965ca1bb", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m,k=map(int,input().split())\ns=k%2\nr=(k-1)//(2*m)\nd=r*m+1\ni=d*2\nd=1\nif s==1:\n    i-=1\nwhile i!=k:\n    i+=2\n    d+=1\nif s==1:\n    s='L'\nelse:\n    s='R'\nprint(r+1,d,s)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "a1f49b6310d6ed6f3a4f48645bdd3477", "src_uid": "d6929926b44c2d5b1a8e6b7f965ca1bb", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\ns = raw_input().strip()\nans = n\ni = 0\nwhile i < n-1:\n    if s[i] + s[i+1] in [\"RU\", \"UR\"]:\n        ans -= 1\n        i += 2\n    else:\n        i += 1\nprint ans ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "6e536ea1c10ec405b312706aeb3ebd27", "src_uid": "986ae418ce82435badadb0bd5588f45b", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ns = list(input())\ni = 1\ntotal = 0\nif n == 1:\n    print(1)\nelse:\n    while i < n:\n        if (s[i-1] + s[i] == \"UU\") or (s[i-1] + s[i] == \"RR\"):\n            total += 1\n            i += 1\n        elif (s[i-1] + s[i] == \"UR\") or (s[i-1] + s[i] == \"RU\"):\n            total += 1\n            i += 2\n        if i == n:\n            total += 1\n    print(total)\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "a4665e9d10b3055eda90d4057883c127", "src_uid": "986ae418ce82435badadb0bd5588f45b", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import bisect\nimport array\nn,m=list(map(int,input().split()))\na=array.array('L',map(int,input().split()))\na1,a2=array.array('L'),array.array('L')\nn1=n//2\n\ndef sums1(i,sum=0):\n    if i==n1:\n        a1.append(sum)\n    else:\n        sums1(i+1,(sum+a[i])%m)\n        sums1(i+1,sum)\n        \ndef sums2(i,sum=0):\n    if i==n:\n        a2.append(sum)\n    else:\n        sums2(i+1,(sum+a[i])%m)\n        sums2(i+1,sum)\nk=0\nsums1(0)\nsums2(n1)\n\nans=0\nend=len(a2)-1\n\na1=array.array('L',sorted(set(a1)))\n\nfor i in a2:\n    j=bisect.bisect_left(a1,m-i)\n    if ans<a1[j-1]+i:\n        ans=a1[j-1]+i\nprint(ans)\n", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "ed8d16ec3425a995d9239b0aec0bc63d", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\nimport bisect\n\ndef gen(start, end, ar, distinct_values, value, mod):\n    if start == end:\n\tdistinct_values.add(value)\n\treturn\n    \n    gen(start + 1, end, ar, distinct_values, value, mod)\n    gen(start + 1, end, ar, distinct_values, (value + ar[start])%mod, mod)\n\ndef main():\n    n, m = map(int, raw_input().split())\n    ar = map(int, raw_input().split())\n    \n    first, second = set(), set()\n    gen(0, n//2, ar, first, 0, m)\n    gen(n//2, n, ar, second, 0, m)\n    \n    first = sorted(first)\n    second = sorted(second)\n    print max(x + second[bisect.bisect_left(second, m - x) - 1] for x in first)\n    \n    \n    \nif __name__ == '__main__':\n    main() \n    \n", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "49fae0a91a87932875b6566649dcad9b", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=list(map(int,input().split()))\na=list(map(int,input().split()))\nimport bisect\na1,a2=[],[]\nn1=n//2\n\ndef sums1(i,sum=0):\n    if i==n1:\n        a1.append(sum)\n    else:\n        sums1(i+1,(sum+a[i])%m)\n        sums1(i+1,sum)\n        \ndef sums2(i,sum=0):\n    if i==n:\n        a2.append(sum)\n    else:\n        sums2(i+1,(sum+a[i])%m)\n        sums2(i+1,sum)\n\nsums1(0)\nsums2(n1)\n\nans=0\nend=len(a2)-1\n\na1=sorted(set(a1))\n\nfor i in a2:\n    j=bisect.bisect_left(a1,m-i)\n    ans=max(ans,a1[j-1]+i)\n    k=a1[j-1]+i\n    if ans<k:\n        ans=k\nprint(ans)\n    \n    \n    ", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "7d29401e09cf2118834a4410f6a567d0", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import bisect\nimport array\nn,m=list(map(int,input().split()))\na=array.array('L')\na.extend(map(int,input().split()))\na1,a2=array.array('L'),array.array('L')\nn1=n//2\n\ndef sums1(i,sum=0):\n    if i==n1:\n        a1.append(sum)\n    else:\n        sums1(i+1,(sum+a[i])%m)\n        sums1(i+1,sum)\n        \ndef sums2(i,sum=0):\n    if i==n:\n        a2.append(sum)\n    else:\n        sums2(i+1,(sum+a[i])%m)\n        sums2(i+1,sum)\n\nsums1(0)\nsums2(n1)\n\nans=0\nend=len(a2)-1\n\na1=array.array('L',sorted(set(a1)))\n\nfor i in a2:\n    j=bisect.bisect_left(a1,m-i)\n    if ans<a1[j-1]+i:\n        ans=a1[j-1]+i\nprint(ans)\n", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "09eb38004e5ae5f970023bcfc569d978", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=list(map(int,input().split()))\n#a=list(map(int,input().split()))\na=[int(i) for i in input().split()]\nimport bisect\na1,a2=[],[]\nn1=n//2\n\ndef sums1(i,sum=0):\n    if i==n1:\n        a1.append(sum)\n    else:\n        sums1(i+1,(sum+a[i])%m)\n        sums1(i+1,sum)\n        \ndef sums2(i,sum=0):\n    if i==n:\n        a2.append(sum)\n    else:\n        sums2(i+1,(sum+a[i])%m)\n        sums2(i+1,sum)\n\nsums1(0)\nsums2(n1)\n\nans=0\nend=len(a2)-1\n\na1=sorted(set(a1))\n\nfor i in a2:\n    j=bisect.bisect_left(a1,m-i)\n    if ans<a1[j-1]+i:\n        ans=a1[j-1]+i\nprint(ans)", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "702033c03a215e2e766c0b85e90b46a9", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\na=[int(i) for i in input().split()]\nx,y=set(),set()\ndef f(x,n,i,s=0):\n    if i==n:\n        if s == m - 1: exit(print(s))\n        x.add(s)\n    else:\n        f(x,n,i+1,(s+a[i])%m)\n        f(x,n,i+1,s)\nh=n//2\nf(x,h,0)\nf(y,n,h)\ny=sorted(y)\nimport bisect\nk=0\nprint(max(i+y[bisect.bisect_left(y,m-i)-1]for i in x))\n", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "32424bb7a89cbbeeb29ff990b1f9374b", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=list(map(int,input().split()))\na=list(map(int,input().split()))\nimport bisect\na1,a2=[],[]\nn1=n//2\napp1=a1.append\napp2=a2.append\ndef sums1(i,sum=0):\n    if i==n1:\n        app1(sum)\n    else:\n        sums1(i+1,(sum+a[i])%m)\n        sums1(i+1,sum)\n        \ndef sums2(i,sum=0):\n    if i==n:\n        app2(sum)\n    else:\n        sums2(i+1,(sum+a[i])%m)\n        sums2(i+1,sum)\n\nsums1(0)\nsums2(n1)\n\nans=0\nend=len(a2)-1\n\na1=sorted(set(a1))\nbis=bisect.bisect_left\nfor i in a2:\n    j=bis(a1,m-i)\n    if ans<a1[j-1]+i:\n        ans=a1[j-1]+i\nprint(ans)\n", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "6a03a574eed2967b092d068dd69c5f47", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\na=[int(i)%m for i in input().split()]\nx,y=set(),set()\ndef f(x,n,i,s=0):\n    if i==n:\n        x.add(s)\n    else:\n        f(x,n,i+1,(s+a[i])%m)\n        f(x,n,i+1,s)\nh=n//2\nf(x,h,0)\nf(y,n,h)\ny=sorted(y)\nimport bisect\nk=0\nprint(max(i+y[bisect.bisect_left(y,m-i)-1]for i in x))\n", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "36158145aac7f0214d16dcec234b5714", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "# -*- coding: utf-8 -*-\nfrom itertools import imap\nfrom heapq import merge\nfrom bisect import bisect\n\n\ndef readline(): return imap(int, raw_input().split())\n\n\nclass Solved(Exception):\n    pass\n\n\ndef get_values(a, m):\n    values = [(0, 1)]\n    for v in a:\n        new_values1, new_values2 = [], []\n        for (x, y) in values:\n            x1, y1 = x + v, y + v\n            if x1 < m:\n                if y1 < m:\n                    new_values1.append((x1, y1))\n                else:\n                    print(m - 1)\n                    raise Solved\n            else:\n                new_values2.append((x1 - m, y1 - m))\n\n        new_values = []\n        hx, hy = 0, 1\n        for pair in merge(values, new_values1, new_values2):\n            if hy >= pair[0]:\n                hy = pair[1]\n            else:\n                new_values.append((hx, hy))\n                hx, hy = pair\n        values = new_values + [(hx, hy)]\n    return values\n\n\ndef main():\n    n, m = tuple(readline())\n    a = filter(bool, (x % m for x in readline()))\n\n    mid = (n + 1) >> 1\n    a1, a2 = a[:mid], a[mid:]\n\n    try:\n        v1, v2 = get_values(a1, m), get_values(a2, m)\n    except Solved:\n        return\n\n    ans = max(max(v1)[1] - 1, max(v2)[1] - 1)\n\n    for (x, y) in v2:\n        if ans == m - 1:\n            break\n        idx = bisect(v1, (m - x, 0))\n        if not idx:\n            break\n        y1 = v1[idx - 1][1]\n        ans = max(ans, m - 1 if y1 - 1 >= m - y else y - 1 + y1 - 1)\n\n    print(ans)\n\n\nmain()\n", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "5e6e728c3b50cef4fd2a030184d28224", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m=map(int,input().split())\nl=[int(i) for i in input().split()]\nfirst=l[:n//2]\nsec=l[n//2:]\nn1=n//2 \nn2=n//2+n%2 \nt1=(1<<n1)\nt2=(1<<n2)\ns1=[]\nfor i in range(t1):\n    now=0 \n    for j in range(len(first)):\n        if i&(1<<j):\n            now+=first[j]\n    s1.append(now%m)\ns2=[]\nfor i in range(t2):\n    now= 0 \n    for j in range(len(sec)):\n        if i&(1<<j):\n            now+=sec[j]\n    s2.append(now%m)\ns1.sort()\ns2.sort() \nmaxi=0 \ndef check(l,x): #largest number less than x in l  # l is asc \n    lo=0 \n    hi=len(l)-1 \n    ans=0 \n    while lo<=hi: \n        mi=(lo+hi)>>1 \n        if l[mi]<x:\n            ans=l[mi] \n            lo=mi+1\n        else:\n            hi=mi-1 \n    return ans \nfor i in s1:\n    req=m-i \n    pair=check(s2,req)\n    maxi=max(maxi,(i+pair)%m)\nprint(maxi)\n    ", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "dabb9fff10ca66f2f3d4dcef838052d5", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=list(map(int,input().split()))\na=list(map(int,input().split()))\nimport bisect\na1,a2=[],[]\nn1=n//2\napp1=a1.append\napp2=a2.append\ndef sums1(i,sum=0):\n    if i==n1:\n        app1(sum%m)\n    else:\n        sums1(i+1,(sum+a[i]))\n        sums1(i+1,sum)\n        \ndef sums2(i,sum=0):\n    if i==n:\n        app2(sum%m)\n    else:\n        sums2(i+1,(sum+a[i]))\n        sums2(i+1,sum)\n\nsums1(0)\nsums2(n1)\n\nans=0\nend=len(a2)-1\n\na1=sorted(set(a1))\nbis=bisect.bisect_left\ndef solve(i):\n    global ans\n    j=bis(a1,m-i)\n    if ans<a1[j-1]+i:\n        ans=a1[j-1]+i\n    return ans\nl=list(map(solve,a2))\nprint(l[-1])", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "fe4a085650ccdbe39b875ad088c6df63", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# ---------------------------iye ha aam zindegi---------------------------------------------\nimport math\nimport heapq, bisect\nimport sys\nfrom collections import deque, defaultdict\nfrom fractions import Fraction\n\nmod = 10 ** 9 + 7\nmod1 = 998244353\n\n# ------------------------------warmup----------------------------\nimport os\nimport sys\nfrom io import BytesIO, IOBase\n\nBUFSIZE = 8192\n\n\nclass FastIO(IOBase):\n    newlines = 0\n\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\n\n\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n\n\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\n\n# -------------------game starts now----------------------------------------------------import math\nclass TreeNode:\n    def __init__(self, k, v):\n        self.key = k\n        self.value = v\n        self.left = None\n        self.right = None\n        self.parent = None\n        self.height = 1\n        self.num_left = 1\n        self.num_total = 1\n\n\nclass AvlTree:\n\n    def __init__(self):\n        self._tree = None\n\n    def add(self, k, v):\n        if not self._tree:\n            self._tree = TreeNode(k, v)\n            return\n        node = self._add(k, v)\n        if node:\n            self._rebalance(node)\n\n    def _add(self, k, v):\n        node = self._tree\n        while node:\n            if k < node.key:\n                if node.left:\n                    node = node.left\n                else:\n                    node.left = TreeNode(k, v)\n                    node.left.parent = node\n                    return node.left\n            elif node.key < k:\n                if node.right:\n                    node = node.right\n                else:\n                    node.right = TreeNode(k, v)\n                    node.right.parent = node\n                    return node.right\n            else:\n                node.value = v\n                return\n\n    @staticmethod\n    def get_height(x):\n        return x.height if x else 0\n\n    @staticmethod\n    def get_num_total(x):\n        return x.num_total if x else 0\n\n    def _rebalance(self, node):\n\n        n = node\n        while n:\n            lh = self.get_height(n.left)\n            rh = self.get_height(n.right)\n            n.height = max(lh, rh) + 1\n            balance_factor = lh - rh\n            n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)\n            n.num_left = 1 + self.get_num_total(n.left)\n\n            if balance_factor > 1:\n                if self.get_height(n.left.left) < self.get_height(n.left.right):\n                    self._rotate_left(n.left)\n                self._rotate_right(n)\n            elif balance_factor < -1:\n                if self.get_height(n.right.right) < self.get_height(n.right.left):\n                    self._rotate_right(n.right)\n                self._rotate_left(n)\n            else:\n                n = n.parent\n\n    def _remove_one(self, node):\n        \"\"\"\n        Side effect!!! Changes node. Node should have exactly one child\n        \"\"\"\n        replacement = node.left or node.right\n        if node.parent:\n            if AvlTree._is_left(node):\n                node.parent.left = replacement\n            else:\n                node.parent.right = replacement\n            replacement.parent = node.parent\n            node.parent = None\n        else:\n            self._tree = replacement\n            replacement.parent = None\n        node.left = None\n        node.right = None\n        node.parent = None\n        self._rebalance(replacement)\n\n    def _remove_leaf(self, node):\n        if node.parent:\n            if AvlTree._is_left(node):\n                node.parent.left = None\n            else:\n                node.parent.right = None\n            self._rebalance(node.parent)\n        else:\n            self._tree = None\n        node.parent = None\n        node.left = None\n        node.right = None\n\n    def remove(self, k):\n        node = self._get_node(k)\n        if not node:\n            return\n        if AvlTree._is_leaf(node):\n            self._remove_leaf(node)\n            return\n        if node.left and node.right:\n            nxt = AvlTree._get_next(node)\n            node.key = nxt.key\n            node.value = nxt.value\n            if self._is_leaf(nxt):\n                self._remove_leaf(nxt)\n            else:\n                self._remove_one(nxt)\n            self._rebalance(node)\n        else:\n            self._remove_one(node)\n\n    def get(self, k):\n        node = self._get_node(k)\n        return node.value if node else -1\n\n    def _get_node(self, k):\n        if not self._tree:\n            return None\n        node = self._tree\n        while node:\n            if k < node.key:\n                node = node.left\n            elif node.key < k:\n                node = node.right\n            else:\n                return node\n        return None\n\n    def get_at(self, pos):\n        x = pos + 1\n        node = self._tree\n        while node:\n            if x < node.num_left:\n                node = node.left\n            elif node.num_left < x:\n                x -= node.num_left\n                node = node.right\n            else:\n                return (node.key, node.value)\n        raise IndexError(\"Out of ranges\")\n\n    @staticmethod\n    def _is_left(node):\n        return node.parent.left and node.parent.left == node\n\n    @staticmethod\n    def _is_leaf(node):\n        return node.left is None and node.right is None\n\n    def _rotate_right(self, node):\n        if not node.parent:\n            self._tree = node.left\n            node.left.parent = None\n        elif AvlTree._is_left(node):\n            node.parent.left = node.left\n            node.left.parent = node.parent\n        else:\n            node.parent.right = node.left\n            node.left.parent = node.parent\n        bk = node.left.right\n        node.left.right = node\n        node.parent = node.left\n        node.left = bk\n        if bk:\n            bk.parent = node\n        node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1\n        node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)\n        node.num_left = 1 + self.get_num_total(node.left)\n\n    def _rotate_left(self, node):\n        if not node.parent:\n            self._tree = node.right\n            node.right.parent = None\n        elif AvlTree._is_left(node):\n            node.parent.left = node.right\n            node.right.parent = node.parent\n        else:\n            node.parent.right = node.right\n            node.right.parent = node.parent\n        bk = node.right.left\n        node.right.left = node\n        node.parent = node.right\n        node.right = bk\n        if bk:\n            bk.parent = node\n        node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1\n        node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)\n        node.num_left = 1 + self.get_num_total(node.left)\n\n    @staticmethod\n    def _get_next(node):\n        if not node.right:\n            return node.parent\n        n = node.right\n        while n.left:\n            n = n.left\n        return n\n\n\n# -----------------------------------------------binary seacrh tree---------------------------------------\nclass SegmentTree1:\n    def __init__(self, data, default='z', func=lambda a, b: min(a, b)):\n        \"\"\"initialize the segment tree with data\"\"\"\n        self._default = default\n        self._func = func\n        self._len = len(data)\n        self._size = _size = 1 << (self._len - 1).bit_length()\n\n        self.data = [default] * (2 * _size)\n        self.data[_size:_size + self._len] = data\n        for i in reversed(range(_size)):\n            self.data[i] = func(self.data[i + i], self.data[i + i + 1])\n\n    def __delitem__(self, idx):\n        self[idx] = self._default\n\n    def __getitem__(self, idx):\n        return self.data[idx + self._size]\n\n    def __setitem__(self, idx, value):\n        idx += self._size\n        self.data[idx] = value\n        idx >>= 1\n        while idx:\n            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])\n            idx >>= 1\n\n    def __len__(self):\n        return self._len\n\n    def query(self, start, stop):\n        if start == stop:\n            return self.__getitem__(start)\n        stop += 1\n        start += self._size\n        stop += self._size\n\n        res = self._default\n        while start < stop:\n            if start & 1:\n                res = self._func(res, self.data[start])\n                start += 1\n            if stop & 1:\n                stop -= 1\n                res = self._func(res, self.data[stop])\n            start >>= 1\n            stop >>= 1\n        return res\n\n    def __repr__(self):\n        return \"SegmentTree({0})\".format(self.data)\n\n\n# -------------------game starts now----------------------------------------------------import math\nclass SegmentTree:\n    def __init__(self, data, default=0, func=lambda a, b: a + b):\n        \"\"\"initialize the segment tree with data\"\"\"\n        self._default = default\n        self._func = func\n        self._len = len(data)\n        self._size = _size = 1 << (self._len - 1).bit_length()\n\n        self.data = [default] * (2 * _size)\n        self.data[_size:_size + self._len] = data\n        for i in reversed(range(_size)):\n            self.data[i] = func(self.data[i + i], self.data[i + i + 1])\n\n    def __delitem__(self, idx):\n        self[idx] = self._default\n\n    def __getitem__(self, idx):\n        return self.data[idx + self._size]\n\n    def __setitem__(self, idx, value):\n        idx += self._size\n        self.data[idx] = value\n        idx >>= 1\n        while idx:\n            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])\n            idx >>= 1\n\n    def __len__(self):\n        return self._len\n\n    def query(self, start, stop):\n        if start == stop:\n            return self.__getitem__(start)\n        stop += 1\n        start += self._size\n        stop += self._size\n\n        res = self._default\n        while start < stop:\n            if start & 1:\n                res = self._func(res, self.data[start])\n                start += 1\n            if stop & 1:\n                stop -= 1\n                res = self._func(res, self.data[stop])\n            start >>= 1\n            stop >>= 1\n        return res\n\n    def __repr__(self):\n        return \"SegmentTree({0})\".format(self.data)\n\n\n# -------------------------------iye ha chutiya zindegi-------------------------------------\nclass Factorial:\n    def __init__(self, MOD):\n        self.MOD = MOD\n        self.factorials = [1, 1]\n        self.invModulos = [0, 1]\n        self.invFactorial_ = [1, 1]\n\n    def calc(self, n):\n        if n <= -1:\n            print(\"Invalid argument to calculate n!\")\n            print(\"n must be non-negative value. But the argument was \" + str(n))\n            exit()\n        if n < len(self.factorials):\n            return self.factorials[n]\n        nextArr = [0] * (n + 1 - len(self.factorials))\n        initialI = len(self.factorials)\n        prev = self.factorials[-1]\n        m = self.MOD\n        for i in range(initialI, n + 1):\n            prev = nextArr[i - initialI] = prev * i % m\n        self.factorials += nextArr\n        return self.factorials[n]\n\n    def inv(self, n):\n        if n <= -1:\n            print(\"Invalid argument to calculate n^(-1)\")\n            print(\"n must be non-negative value. But the argument was \" + str(n))\n            exit()\n        p = self.MOD\n        pi = n % p\n        if pi < len(self.invModulos):\n            return self.invModulos[pi]\n        nextArr = [0] * (n + 1 - len(self.invModulos))\n        initialI = len(self.invModulos)\n        for i in range(initialI, min(p, n + 1)):\n            next = -self.invModulos[p % i] * (p // i) % p\n            self.invModulos.append(next)\n        return self.invModulos[pi]\n\n    def invFactorial(self, n):\n        if n <= -1:\n            print(\"Invalid argument to calculate (n^(-1))!\")\n            print(\"n must be non-negative value. But the argument was \" + str(n))\n            exit()\n        if n < len(self.invFactorial_):\n            return self.invFactorial_[n]\n        self.inv(n)  # To make sure already calculated n^-1\n        nextArr = [0] * (n + 1 - len(self.invFactorial_))\n        initialI = len(self.invFactorial_)\n        prev = self.invFactorial_[-1]\n        p = self.MOD\n        for i in range(initialI, n + 1):\n            prev = nextArr[i - initialI] = (prev * self.invModulos[i % p]) % p\n        self.invFactorial_ += nextArr\n        return self.invFactorial_[n]\n\n\nclass Combination:\n    def __init__(self, MOD):\n        self.MOD = MOD\n        self.factorial = Factorial(MOD)\n\n    def ncr(self, n, k):\n        if k < 0 or n < k:\n            return 0\n        k = min(k, n - k)\n        f = self.factorial\n        return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD\n\n\n# --------------------------------------iye ha combinations ka zindegi---------------------------------\ndef powm(a, n, m):\n    if a == 1 or n == 0:\n        return 1\n    if n % 2 == 0:\n        s = powm(a, n // 2, m)\n        return s * s % m\n    else:\n        return a * powm(a, n - 1, m) % m\n\n\n# --------------------------------------iye ha power ka zindegi---------------------------------\ndef sort_list(list1, list2):\n    zipped_pairs = zip(list2, list1)\n\n    z = [x for _, x in sorted(zipped_pairs)]\n\n    return z\n\n\n# --------------------------------------------------product----------------------------------------\ndef product(l):\n    por = 1\n    for i in range(len(l)):\n        por *= l[i]\n    return por\n\n\n# --------------------------------------------------binary----------------------------------------\ndef binarySearchCount(arr, n, key):\n    left = 0\n    right = n - 1\n\n    count = 0\n\n    while (left <= right):\n        mid = int((right + left) / 2)\n\n        # Check if middle element is\n        # less than or equal to key\n        if (arr[mid] <= key):\n            count = mid + 1\n            left = mid + 1\n\n        # If key is smaller, ignore right half\n        else:\n            right = mid - 1\n\n    return count\n\n\n# --------------------------------------------------binary----------------------------------------\ndef countdig(n):\n    c = 0\n    while (n > 0):\n        n //= 10\n        c += 1\n    return c\n\n\ndef countGreater(arr, n, k):\n    l = 0\n    r = n - 1\n\n    # Stores the index of the left most element\n    # from the array which is greater than k\n    leftGreater = n\n\n    # Finds number of elements greater than k\n    while (l <= r):\n        m = int(l + (r - l) / 2)\n        if (arr[m] >= k):\n            leftGreater = m\n            r = m - 1\n\n        # If mid element is less than\n        # or equal to k update l\n        else:\n            l = m + 1\n\n    # Return the count of elements\n    # greater than k\n    return (n - leftGreater)\n\n\n# --------------------------------------------------binary------------------------------------\nn,k=map(int,input().split())\nl=list(map(int,input().split()))\nl=[l[i]%k for i in range(n)]\nif n==1:\n    print(l[0])\n    sys.exit(0)\nl1=l[:n//2]\nl2=l[n//2:]\ns=set()\ns1=set()\ns2=set()\nfor i in range(n//2):\n    for j in s:\n        s2.add((j+l1[i])%k)\n    s.add(l1[i])\n    for j in s2:\n        s.add(j)\n    s2=set()\nfor i in range(n-n//2):\n    for j in s1:\n        s2.add((j+l2[i])%k)\n    s1.add(l2[i])\n    for j in s2:\n        s1.add(j)\n    s2 = set()\ns=list(s)\ns1=list(s1)\ns.sort()\ns1.sort()\nans=max(max(s),max(s1))\nfor i in range(len(s)):\n    t=k-1-s[i]\n    ind=binarySearchCount(s1,len(s1),t)\n    r=s1[ind-1]\n    rt=s1[-1]\n    t=ans\n    ans=max((r+s[i])%k,(s[i]+rt)%k)\n    ans=max(ans,t)\n    #print(ans,t)\nprint(ans)", "lang_cluster": "Python", "tags": ["meet-in-the-middle", "divide and conquer", "bitmasks"], "code_uid": "5cb6c1b3fc0e089985a249812459323b", "src_uid": "d3a8a3e69a55936ee33aedd66e5b7f4a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b = map(int, input().split(\" \"))\naa, bb = bin(a)[2:], bin(b)[2:]\n\nans = 0\nif len(aa) == len(bb):\n    s = [\"1\"]*len(aa)\n    for i in range(1, len(s)):\n        s[i] = \"0\"\n        ss = int(\"\".join(s), 2)\n        if ss >= a and ss <= b:\n            ans += 1\n        s[i] = \"1\"\nelse:\n    s = [\"1\"]*len(aa)\n    for i in range(1, len(s)):\n        s[i] = \"0\"\n        ss = int(\"\".join(s), 2)\n        if ss >= a:\n            ans += 1\n        s[i] = \"1\"\n    s = [\"1\"]*len(bb)\n    for i in range(1, len(s)):\n        s[i] = \"0\"\n        ss = int(\"\".join(s), 2)\n        if ss <= b:\n            ans += 1\n        s[i] = \"1\"\n    for i in range(len(aa)+1, len(bb)):\n        ans += i-1\n\nprint(ans)\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "bitmasks"], "code_uid": "796332465342caf4cd3c2b675e0172d7", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x = input().split()      \n \nhazZero = False\n\nbinary = bin(int(x[0]))\nbinary = binary[2:]\n\nfor i in range(len(binary)):\n    if (binary[i] == '0'):\n        hazZero = True\n\nif (not hazZero):\n    binary = bin(int(x[0]) + 1)\n    binary = binary[2:]\n \nisFirst = True\nnew_binary = ''\n \nfor i in range(len(binary)):\n    if (binary[i] == '0'):\n        if (isFirst):\n            new_binary = new_binary + '0'\n            isFirst = False\n        else:\n            new_binary = new_binary + '1'\n    else:          \n        new_binary = new_binary + binary[i]\n \ninDecimal = int(new_binary, 2)\n \ntotal = 0\n \nwhile (int(x[0]) <= inDecimal and inDecimal <= int(x[1]) ):\n    total += 1\n    if (new_binary == '1'):\n        total -= 1\n        new_binary = '10'\n    elif (new_binary[-1] == '0'):\n        new_binary = '10' + new_binary[:-1]\n    else:    \n        new_binary = '1' + new_binary[:-1]\n    inDecimal = int(new_binary, 2)\n \nprint(total)", "lang_cluster": "Python", "tags": ["brute force", "implementation", "bitmasks"], "code_uid": "e83c2dcbaa985ee6cff609f55c62f2bd", "src_uid": "581f61b1f50313bf4c75833cefd4d022", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,l,r,x = map(int,input().split())\na = list(map(int,input().split()))\ncount=0\nfor i in range(2**n):\n    maxc=-1\n    minc=-1\n    c=0\n    for j in range(n):\n        if i>>j&1==1:\n            c+=a[j]\n            maxc=max(maxc,a[j])\n            if minc==-1:\n                minc=a[j]\n            else:\n                minc=min(a[j],minc)\n    if c>=l and c<=r and maxc - minc >=x:\n        count+=1\nprint(count)\n\n", "lang_cluster": "Python", "tags": ["brute force", "bitmasks"], "code_uid": "bec193a6e8d8c136ff1bd3804b6acb6f", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import stdin\nfrom itertools import combinations\nn, l, r , x = map(int, stdin.readline().rstrip().split(\" \"))\nli = list(map(int, stdin.readline().rstrip().split(\" \")))\nz = []\nans = 0\nfor i in range(2, n+1):\n    z += list(combinations(li, i))\n\nfor i in z:\n    a = sorted(i)\n    if a[-1]-a[0]>=x and r >= sum(a) >= l:\n        ans+=1\n\nprint(ans)", "lang_cluster": "Python", "tags": ["brute force", "bitmasks"], "code_uid": "40ac9de155e7ca16c845807aa73c20f8", "src_uid": "0d43104a0de924cdcf8e4aced5aa825d", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "input=__import__('sys').stdin.readline\nfor _ in range(int(input())):\n    n=int(input())\n    i=2\n    while i*i<=n and n%i!=0:\n        i+=1\n    if i*i>n:\n        print(1,n-1)\n    else:\n        print(n//i,n//i*(i-1))", "lang_cluster": "Python", "tags": ["math", "greedy", "number theory"], "code_uid": "75d09d2e6a3c91b79843a76a8c71c2e4", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "for t in range(int(input())):\n    n=int(input())\n    test=0\n    for i in range(2,int(n**0.5)+1):\n        if n%i==0:\n            test=1\n            break\n    if test==1:\n        \n        a=n//i\n        b=n-a\n    else:\n        a=1\n        b=n-1\n    print(a,b)\n    ", "lang_cluster": "Python", "tags": ["math", "greedy", "number theory"], "code_uid": "06ce4567f30fbfef6266cafd38f67130", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\ndef device(n,m):\n    if m < n :\n        return n-m\n    elif m == n :\n        return 0\n    else :\n        dic = {n:0}\n        level = 1\n        frontier = [n]\n        current = 1000000000\n        while frontier :\n            new = []\n            l = len(frontier)\n            for i in range(0,l) :\n                num = frontier.pop()\n                num1 = num - 1\n                if num1 == m :\n                    return level\n                if num1 not in dic :\n                    dic[num1] = 0\n                    new.append(num1)\n                \n                \n                num2 = num*2\n                if num2 == m :\n                    return level\n                elif num2 > m :\n                    current = min(current, num2-m + level)\n                elif num2 not in dic :\n                    dic[num2] = 0\n                    new.append(num2)\n            frontier = new\n            level = level + 1\n            if level >=current :\n                return current\n\n\n    \nn,m = map(int,sys.stdin.readline().split())\nprint device(n,m)\n\n", "lang_cluster": "Python", "tags": ["dfs and similar", "shortest paths", "math", "graphs", "greedy", "implementation"], "code_uid": "8db56fa3d3df74f0d5e2d0831ccbe30a", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\n\ncount = 0\nwhile m > n:\n\tif m == 2*n:\n\t\tn = m\n\telif m%2:\n\t\tm += 1\n\telse:\n\t\tm = m//2\n\n\tcount += 1\n\ncount += n-m\n\nprint(count)", "lang_cluster": "Python", "tags": ["dfs and similar", "shortest paths", "math", "graphs", "greedy", "implementation"], "code_uid": "efb88f1a4a5bdb2b6ddbb97547fcc9ce", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def rpm(n):\n    output={2:0, 3:0, 5:0, 10:0}\n    for i in [2, 3, 5]:\n        op=0\n        while n%i==0:\n            n//=i\n            op+=1\n        output[i]=op\n    output[10]=n\n    return output\nA, B=map(rpm, map(int, input().split()))\nif A[10]!=B[10]:\n    print(-1)\nelse:\n    print(max(A[2],B[2])-min(A[2],B[2])+max(A[3],B[3])-min(A[3],B[3])+max(A[5],B[5])-min(A[5],B[5]))\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "3c1e76abcb5bc4d188fcd444e956fb37", "src_uid": "75a97f4d85d50ea0e1af0d46f7565b49", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\nseent = {}\n\ndef vect(x, k):\n  if (x in seent):\n    return\n\n  seent[x] = k\n  if (x % 2 == 0):\n    vect(x / 2, k + 1)\n  if (x % 3 == 0):\n    vect(x / 3, k + 1)\n  if (x % 5 == 0):\n    vect(x / 5, k + 1)\n\ndef orr(x, k):\n  if (x in seent):\n    if (seent[x] == -1):\n      return -1\n    else:\n      return k + seent[x]\n\n  seent[x] = -1\n\n  mn = float(\"inf\")\n  if (x % 2 == 0):\n    ret = orr(x / 2, k + 1)\n    if (ret != -1):\n      mn = min(ret, mn)\n\n  if (x % 3 == 0):\n    ret = orr(x / 3, k + 1)\n    if (ret != -1):\n      mn = min(ret, mn)\n\n  if (x % 5 == 0):\n    ret = orr(x / 5, k + 1)\n    if (ret != -1):\n      mn = min(ret, mn)\n  \n  if (mn == float(\"inf\")):\n    return -1\n  return mn\n\n\na, b = [ int(x) for x in sys.stdin.readline().strip().split() ]\nvect(a, 0)\nprint orr(b, 0)\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "f0c088cb1a78e43f9a4065c478758be8", "src_uid": "75a97f4d85d50ea0e1af0d46f7565b49", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "v1, v2 = map(int, raw_input().split())\nt, d = map(int, raw_input().split())\n\narr = [0] * t\narr[0], arr[-1] = v1, v2\n\nfor i in xrange(-2, -t, -1):\n\tarr[i] = arr[i + 1] + d\n\nfor i in xrange(1, t - 1):\n\tarr[i] = min(arr[i], arr[i - 1] + d)\n\nprint sum(arr)\n", "lang_cluster": "Python", "tags": ["math", "greedy", "dp"], "code_uid": "ffc8e080d002cdd87f9fcea4abdff02c", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "v1,v2 = map(int,raw_input().split())\nt,d = map(int,raw_input().split())\ndp = [0] * t\ndp[0] = v1\ndp[-1] = v2\nfor i in xrange(t-2,0,-1):\n\tdp[i] = min(dp[-1] + (t-1)*d-(i*d),dp[0] + i*d) \nprint sum(dp)", "lang_cluster": "Python", "tags": ["math", "greedy", "dp"], "code_uid": "71655509fbd715be065bee5a5631e493", "src_uid": "9246aa2f506fcbcb47ad24793d09f2cf", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\nA = map(int, raw_input().split())\nB = map(int, raw_input().split())\nC = map(int, raw_input().split())\n\nAB = (B[0] - A[0], B[1] - A[1])\nAC = (C[0] - A[0], C[1] - A[1])\n\np = AB[0] * AC[1] - AC[0] * AB[1]\n\nif p == 0:\n    print('TOWARDS')\nelif p > 0:\n    print('LEFT')\nelif p < 0:\n    print('RIGHT')\nelse:\n    raise ValueError\n", "lang_cluster": "Python", "tags": ["geometry"], "code_uid": "f26d550ae0d0a243c38443e452059f43", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def vec(a, b):\n    return a[0] * b[1] - a[1] * b[0]\n\n\na_x, a_y = [int(i) for i in input().split()]\nb_x, b_y = [int(i) for i in input().split()]\nc_x, c_y = [int(i) for i in input().split()]\na, b, c = [a_x, a_y], [b_x, b_y], [c_x, c_y]\ns, d = [b[0] - a[0], b[1] - a[1]], [c[0] - a[0], c[1] - a[1]]\ne = vec(s, d)\nif e < 0:\n    print('RIGHT')\nelif e > 0:\n    print('LEFT')\nelse:\n    print(\"TOWARDS\")\n", "lang_cluster": "Python", "tags": ["geometry"], "code_uid": "475e2bf52726552fb0996be5a3f83cd8", "src_uid": "f6e132d1969863e9f28c87e5a44c2b69", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "TUX = input()\nFOO = 0\nBAR = 0\nBAZ = 0\nQUZ = 1\nTUX = int(TUX)\nwhile TUX != 0:\n    PUR = input()\n    PUR = int(PUR)\n    FOO = FOO + PUR\n    BAR = BAR + 1\n    #if max(FOO * QUZ, BAR\n    if max(FOO * QUZ, BAR * BAZ) == FOO * QUZ:\n    #if BOTH SAEM BIGGR OF PRODUKT OF FOO AN QUZ AN PRODUKT OF BAR BAZ AN PRODUKT OF FOO AN QUZ:\n        BAZ = FOO\n        QUZ = BAR\n    TUX = TUX - 1\nBAZ = int(BAZ)\nprint(BAZ / QUZ)\n", "lang_cluster": "Python", "tags": ["implementation", "trees", "graph matchings"], "code_uid": "b184feaf9c4b7020500b547b42ac58c3", "src_uid": "32fc378a310ca15598377f7b638eaf26", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "TUX=int(input())\nFOO=0\nBAR=0\nBAZ=0\nQUZ=1\nfor i in range(TUX):\n  PUR=int(input())\n  FOO=FOO+PUR\n  BAR=BAR+1\n  if FOO*QUZ>BAZ*BAR:\n    BAZ=FOO\n    QUZ=BAR\nprint(BAZ/QUZ)", "lang_cluster": "Python", "tags": ["implementation", "trees", "graph matchings"], "code_uid": "c611f4708ddfedfa94e5ef3e218f6b50", "src_uid": "32fc378a310ca15598377f7b638eaf26", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from queue import Queue as Q\r\nn, x = map(int, input().split())\r\nq = Q()\r\nq.put((x, 0))\r\nwas = set()\r\nwhile not q.empty():\r\n    r = q.get()\r\n    if r[0] >= 10**(n-1):\r\n        print(r[1])\r\n        break\r\n    else:\r\n        for i in str(r[0]):\r\n            if i not in [0, 1]:\r\n                new = int(i)*r[0]\r\n                if new not in was:\r\n                    was.add(new)\r\n                    q.put((new, r[1]+1))\r\nelse:\r\n    print(-1)\r\n", "lang_cluster": "Python", "tags": ["brute force", "dfs and similar", "shortest paths", "dp", "data structures"], "code_uid": "97a8d33b665c071da477ef3824bda21e", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import gc\r\nimport heapq\r\nimport itertools\r\nimport math\r\nimport sqlite3\r\nfrom collections import Counter, deque, defaultdict\r\nfrom sys import stdout\r\nimport time\r\nfrom math import factorial, log, gcd\r\nimport sys\r\nfrom decimal import Decimal\r\nimport threading\r\nfrom heapq import *\r\nfrom fractions import Fraction\r\n\r\n\r\ndef S():\r\n    return sys.stdin.readline().split()\r\n\r\n\r\ndef I():\r\n    return [int(i) for i in sys.stdin.readline().split()]\r\n\r\n\r\ndef II():\r\n    return int(sys.stdin.readline())\r\n\r\n\r\ndef IS():\r\n    return sys.stdin.readline().replace('\\n', '')\r\n\r\n\r\ndef main():\r\n    n, a = I()\r\n\r\n    m = [(float('inf'), -1) for _ in range(n + 10)]\r\n    queue = deque([(a, 0)])\r\n    m[len(str(a))] = (0, a)\r\n    _dict = defaultdict(bool)\r\n    _dict[a] = True\r\n    while queue:\r\n        c, q = queue.pop()\r\n        for d in set(str(c)):\r\n            if int(d) > 1:\r\n                new_c = c * int(d)\r\n                str_c = str(new_c)\r\n                if m[len(str_c)][0] > q + 1:\r\n                    m[len(str_c)] = (q + 1, new_c)\r\n                _set = [int(i) for i in str_c]\r\n                if not (max(_set) < 2 or len(str_c) >= n or _dict[new_c]):\r\n                    _dict[new_c] = True\r\n                    queue.appendleft((new_c, q + 1))\r\n\r\n    print(m[n][0] if m[n][0] < float('inf') else -1)\r\n\r\n\r\nif __name__ == '__main__':\r\n    # for _ in range(II()):\r\n    #     main()\r\n    main()", "lang_cluster": "Python", "tags": ["brute force", "dfs and similar", "shortest paths", "dp", "data structures"], "code_uid": "f0d0fd260da5512de90927b8c4c6a8bb", "src_uid": "cedcc3cee864bf8684148df93804d029", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input()\nn = int(input())\n\nl, r = [-1e9] * 101, [-1e9] * 101\nl[0] = r[0] = 0\n\nfor q in s:\n    for j in range(n, -1, -1):\n        x = max(r[j], l[j - 1] + 1) if q == 'T' else max(l[j] + 1, r[j - 1])\n        y = max(l[j], r[j - 1] + 1) if q == 'T' else max(r[j] - 1, l[j - 1])\n        l[j], r[j] = x, y\n\nprint(max(l[n % 2:n + 1:2] + r[n % 2:n + 1:2]))\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "1e41831839960ab90b13e2a5b45fe063", "src_uid": "4a54971eb22e62b1d9e6b72f05ae361d", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin\ns=stdin.readline().strip()\nk=int(stdin.readline().strip())\nn=len(s)\ndp=[[[[ None for tt in range(2)]for i in range(2)] for j in range(k+1)] for k1 in range(n)]\ndp1=[[[[ None for tt in range(2)]for i in range(2)] for j in range(k+1)] for k1 in range(n)]\n\ndef sol(i,j,t,c):\n    if i==n:\n        if j!=0:\n            return -10000000\n        else:\n            return 0\n\n    if dp[i][j][t][c]!=None:\n        return dp[i][j][t][c]\n    ans=0\n    if c==-1:\n        c=(s[i]==\"F\")\n    if c:\n        if t:\n            ans=-1+sol(i+1,j,t,-1)\n        else:\n            ans=1+sol(i+1,j,t,-1)\n        if j>0:\n            ans=max(ans,sol(i,j-1, t,0))\n    else :\n        ans=sol(i+1,j,not t,-1)\n        if j>0:\n            ans=max(ans,sol(i,j-1, t,1))\n    dp[i][j][t][c]=ans\n    return dp[i][j][t][c]\ndef sol1(i,j,t,c):\n    if i==n:\n        if j!=0:\n            return 10000000\n        else:\n            return 0\n    if dp1[i][j][t][c]!=None:\n        return dp1[i][j][t][c]\n    ans=0\n    if c==-1:\n        c=(s[i]==\"F\")\n    if c:\n        if t:\n            ans=-1+sol1(i+1,j,t,-1)\n        else:\n            ans=1+sol1(i+1,j,t,-1)\n        if j>0:\n            ans=min(ans,sol1(i,j-1, t,0))\n    else :\n        ans=sol1(i+1,j,not t,-1)\n        if j>0:\n            ans=min(ans,sol1(i,j-1, t,1))\n    dp1[i][j][t][c]=ans\n    return dp1[i][j][t][c]\nprint(max(sol(0,k,0,-1),-sol1(0,k,0,-1)))\n                \n                \n", "lang_cluster": "Python", "tags": ["dp", "implementation"], "code_uid": "e232d478573124c7fa66054bef5f9ac1", "src_uid": "4a54971eb22e62b1d9e6b72f05ae361d", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = map(int, input().split(' '))\nG = [[0]*n for i in range(n)]\n\nfor i in range(m):\n    u, v = map(lambda x:int(x)-1, input().split(' '))\n    G[u][v] = G[v][u] = 1\n\ns = [' ']*n\n\nfor i in range(n):\n    if G[i].count(1) == n-1:\n        s[i] = 'b'\n\ntry:\n    anode = s.index(' ')\n    s[anode] = 'a'\nexcept:\n    print('Yes')\n    print(''.join(s))\n    exit()\n\nfor i in range(n):\n    if s[i] == ' ' and G[anode][i] == 1:\n        s[i] = 'a'\n    elif s[i] == ' ' and G[anode][i] == 0:\n        s[i] = 'c'\n\nfor i in range(n):\n    for j in range(i+1, n):\n        if (s[i] != s[j] and s[i] != 'b' and s[j] != 'b') == G[i][j]:\n                print('No')\n                exit()\n\nprint('Yes')\nprint(''.join(s))\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "graphs"], "code_uid": "98c256693bb8a0a7cf5ebfbe16b732f8", "src_uid": "e71640f715f353e49745eac5f72e682a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# http://codeforces.com/contest/623/problem/A\n\nimport math\n\nnm = raw_input()\nnm = nm.split(' ')\nn = int(nm[0])\nm = int(nm[1])\n\nedges = [[False for i in range(n)] for x in range(n)]   # False: no such edge\nnodes = [[True for i in range(3)] for x in range(n)]    # True: possible\n\n# read edges\nfor i in range(m):\n  ab = raw_input()\n  ab = ab.split(' ')\n  a = int(ab[0]) - 1\n  b = int(ab[1]) - 1\n  edges[a][b] = True\n  #print 'add edge:',a,b\n\ndef hasEdge(a,b):\n  if edges[a][b] or edges[b][a]:\n    return True\n  else:\n    return False\n\n# True if has deduction\ndef deduce(n1,n2):\n  # if has edge, same\n  if hasEdge(n1,n2) and certain(n1):\n    val_1 = get(n1)\n    # n1 is 'a', n2 isn't 'c'\n    if val_1 == 0 and nodes[n2][2] :\n      nodes[n2][2] = False\n      #print 'node',n2,'is a'\n      return True\n    # n1 is 'c', n2 isn't 'a'\n    if val_1 == 2 and nodes[n2][0]:\n      nodes[n2][0] = False\n      #print 'node',n2,'is a'\n      return True\n  # if no edge, different\n  elif not hasEdge(n1,n2) and certain(n1):\n    val_1 = get(n1)\n    if val_1 == 0 and nodes[n2][0]:\n      nodes[n2][0] = False\n      #print 'node',n2,'is c'\n      return True\n    if val_1 == 2 and nodes[n2][2]:\n      nodes[n2][2] = False\n      #print 'node',n2,'is a'\n      return True\n  return False\n      \ndef deductions():\n  for i in range(n):\n    for j in range(n):\n      if i != j:\n        deduce(i,j)\n      \n# only has one possibility\ndef certain(k):\n  if (nodes[k][0] + nodes[k][1] + nodes[k][2]) == 1:\n    return True\n  return False\n  \ndef freeNode(k):\n  if (nodes[k][0] + nodes[k][1] + nodes[k][2]) == 3:\n    return True\n  return False\n  \ndef isDeadNode(k):\n  if (nodes[k][0] + nodes[k][1] + nodes[k][2]) == 0:\n    return True\n  return False\n\n# get the node first possible node, not certain\ndef get(k):\n  if nodes[k][0]:\n    return 0\n  if nodes[k][1]:\n    return 1\n  if nodes[k][2]:\n    return 2\n\ndef incompleteSolution():\n  for k in range(n):\n    if not certain(k):\n      return k\n  return False\n\ndef genSolution():\n  tmp = incompleteSolution()\n  # loop if node id returned\n  while isinstance(tmp, int):\n    deductions()\n    tmp = incompleteSolution()\n  \ndef printSolution():\n  ss = []\n  for i in range(n):\n    theChar = get(i)\n    if theChar == 0:\n      theChar = 'a'\n    elif theChar == 1:\n      theChar = 'b'\n    else:\n      theChar = 'c'\n    ss.append(theChar)\n  print ''.join(ss)\n\n# main\n# no edge, no b\ncomplete = True\nfirstMissingEdge = []\nfor i in range(n):\n  for j in range(n):\n    if (i != j) and not hasEdge(i,j):\n      #print 'no edge: ',i,j\n      if complete:\n        complete = False\n        firstMissingEdge.append(i)\n        firstMissingEdge.append(j)\n      #print 'missing edge',i,j\n      # must not b\n      nodes[i][1] = False\n      nodes[j][1] = False\n\n# if free node => is b\nfor i in range(n):\n  if freeNode(i):\n    nodes[i][0] = False\n    nodes[i][2] = False\n    #print 'node',i,'is \\'b\\''\n      \n# complete graph\nif complete:\n  ss = []\n  for i in range(n):\n    ss.append('b')\n  print 'Yes'\n  print ''.join(ss)\n\nelse:\n  # 1. guess one node to be 'a'\n  a = firstMissingEdge[0]\n  b = firstMissingEdge[1]\n  nodes[a][2] = False   # node[a] be 'a'\n  nodes[b][0] = False   # node[b] be 'c'\n  #print 'let node',a,'be a, node',b,'be c'\n  # loop check, deduction...\n  updated = True\n  hasDeadNode = False\n  while updated:\n    updated = False\n    for i in range(n):\n      for j in range(n):\n        if i != j:\n          if deduce(i,j):\n            updated = True\n          if isDeadNode(j):\n            hasDeadNode = True\n            break\n      if hasDeadNode:\n        break\n    if hasDeadNode:\n      break\n\n  if hasDeadNode:\n    print 'No'\n  else:\n    print 'Yes'\n    printSolution()\n  \n  \n\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "graphs"], "code_uid": "d07864f5142f5f97909917de51ec9315", "src_uid": "e71640f715f353e49745eac5f72e682a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def c(M,x,y):\n p=[-2,+2]\n q=[-1,+1]\n l=[M[x+p[i]][y+q[j]]!=0 for i in range(len(p)) for j in range(len(q)) if(0<=x+p[i]<8 and 0<=y+q[j]<8)]\n l+=[M[x+q[i]][y+p[j]]!=0 for i in range(len(q)) for j in range(len(p)) if(0<=x+q[i]<8 and 0<=y+p[j]<8)]\n return 1 in l \nmp=['a','b','c','d','e','f','g','h']\ni=input\nn=i()\nm=i()\nM=[[0 for x in range(8)]for y in range(8)]\nl=[[mp.index(n[0]),int(n[1])-1],[mp.index(m[0]),int(m[1])-1]]\nM[l[0][0]][l[0][1]]=2\nM[l[1][0]][l[1][1]]=1\nr=0\nfor x in range(8):\n for y in range(8):\n  if(0==M[x][y]):\n   if(x==l[0][0]or y==l[0][1]):continue\n   if(c(M,x,y)==False):r+=1\nprint(r)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "25f51c7117f1ca317213431b9e24ac58", "src_uid": "073023c6b72ce923df2afd6130719cfc", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "dr = [1,2,2,1,-1,-2,-2,-1,0]\ndc = [2,1,-1,-2,2,1,-1,-2,0]\n\nrook = list(raw_input())\nrook[0] = ord(rook[0]) - ord('a') + 1\nrook = map(int,rook)\n\nknight = list(raw_input())\nknight[0] = ord(knight[0]) - ord('a') + 1\nknight = map(int,knight)\n\nnumPlaces = 0\nfor i in xrange(1,9):\n\tfor j in xrange(1,9):\n\t\tisAttacked = False\n\t\tfor k in xrange(len(dr)):\n\t\t\tif (i+dr[k] == rook[1] and j+dc[k] == rook[0]) or (i+dr[k] == knight[1] and j+dc[k] == knight[0]) or i == rook[1] or j == rook[0]:\n\t\t\t\tisAttacked = True\n\t\t\t\tbreak\n\t\tif isAttacked == False:\n\t\t\tnumPlaces += 1\n\nprint numPlaces\n", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "9d537bfdb7f1656039e339f355568a8e", "src_uid": "073023c6b72ce923df2afd6130719cfc", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def Count (n):\n    cnt = 0\n    x = 1\n    while True:\n        if x > n:\n            break\n        y = 1\n        while True:\n            if x * y > n:\n                break\n            cnt += 1\n            y *= 3\n        x *= 2\n    return cnt\n\ndef Result (l, r):\n    if l == 0:\n        return Count (r)\n    return Count (r) - Count (l - 1)\n\nl, r = map (int, input ().split ())\nprint (Result (l, r))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "ec725fb028ea9e93358b2bbd5cfdaf50", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "l,r = list(map(int, input().split()))\nans = 0\nfor i in range(40):\n    for j in range(40):\n        v= int(2**i * 3**j);\n        if(v >= l and v <= r):\n            ans = ans + 1\n    \nprint(ans)\n        ", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "1546706857ce393df663a0fe7cf9849b", "src_uid": "05fac54ed2064b46338bb18f897a4411", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "global dp\ndef solve(a,l,r,d):\n    if r-l+1 <= 1:\n        return 0\n    curD = a[r]-a[l]\n    if curD <= d:\n        return 0\n    if dp[l][r]!=-1:\n        return dp[l][r]\n    \n    dp[l][r] = min( 1+solve(a,l+1,r,d), 1+solve(a,l,r-1,d) ) \n    return dp[l][r]\n\ndp = [[ -1 for i in range(100)] for j in range(100)]\nn, d = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a)\nans = solve(a,0,n-1,d)\nprint(ans)\n", "lang_cluster": "Python", "tags": ["brute force", "sortings", "greedy"], "code_uid": "b8becf301ec0a94223050691d150e086", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,d=input().split()\nn=int(n)\nd=int(d)\nl=[int(x) for x in input().split()]\nl.sort()\nmindel=0\nmini=0\nmaxi=n-1\nfor i in range(n):\n    for j in range(n-1, -1, -1):\n        if abs(l[j]-l[i])<=d and abs(j-i)>mindel:\n            mini=i\n            maxi=j\n            mindel=abs(j-i)\nif abs(l[maxi]-l[mini])>d:\n    print(n-1)\nelse:\n    print(mini+n-maxi-1)", "lang_cluster": "Python", "tags": ["brute force", "sortings", "greedy"], "code_uid": "e5086d6e641411c422a47ddebe2f60dc", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "x=input()\nprint((0,1)[2**len(bin(6*x))/8-x*3<6])\n", "lang_cluster": "Python", "tags": ["math", "dp"], "code_uid": "8f40e0b7dd310d062f64c9d26af58996", "src_uid": "821409c1b9bdcd18c4dcf35dc5116501", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "'''\n    Author : thekushalghosh\n    Team   : CodeDiggers\n'''\nimport sys,math\ninput = sys.stdin.readline\nn = int(input())\nq = [1,2]\nfor i in range(24):\n    if q[-1] % 2 != 0:\n        q = q + [q[-1] + q[-2],q[-1] + q[-2] + 1]\n    else:\n        q = q + [(2 * q[-1]),(2 * q[-1]) + 1]\nif n in q:\n    print(1)\nelse:\n    print(0)", "lang_cluster": "Python", "tags": ["math", "dp"], "code_uid": "62cb7b9fa881731463b942a577f029ba", "src_uid": "821409c1b9bdcd18c4dcf35dc5116501", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\narr = list(map(int,input().split()))\narr.append(-100000000000)\narr.append(1000000000000)\ni = 0\nwhile(arr[i] < arr[i+1] and i < n-1):\n\ti = i + 1\n\nwhile(arr[i] == arr[i+1] and i < n-1):\n\ti = i + 1\n\nwhile(arr[i] > arr[i+1] and i < n-1):\n\ti = i + 1\n\nif(i == n-1):\n\tprint(\"YES\")\n\nelse:\n\tprint(\"NO\")\n\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f9c79ca59154a8d98e7fc3fe62e3d3d2", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#http://codeforces.com/problemset/problem/831/A\ndef main(n,lst):\n\tif(n==1):\n\t\treturn \"YES\"\n\t#0-increasing, 1-staying, 2-decreasing\n\tif(lst[0]<lst[1]):\n\t\tstatus=0\n\telif(lst[0]==lst[1]):\n\t\tstatus=1\n\telse:\n\t\tstatus=2\n\tfor i in range(len(lst)-1):\n\t\tif(status==0):\n\t\t\tif(lst[i]==lst[i+1]):\n\t\t\t\tstatus+=1\n\t\t\tif(lst[i]>lst[i+1]):\n\t\t\t\tstatus+=2\n\t\tif(status==1):\n\t\t\tif(lst[i]>lst[i+1]):\n\t\t\t\tstatus+=1\n\t\t\tif(lst[i]<lst[i+1]):\n\t\t\t\treturn \"NO\"\n\t\tif(status==2):\n\t\t\tif(lst[i]>lst[i+1]):\n\t\t\t\tpass\n\t\t\telse:\n\t\t\t\treturn \"NO\"\n\treturn \"YES\"\n\n\nn=eval(input())\n\nlst=input().split()\nlst=[eval(i) for i in lst]\nprint(main(n,lst))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "f11f9d0c18311e4b39bb7e211ed5802f", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def f(n, k):\n    n0, s = n, 0\n    while n > 0:\n        s += min(n, k)\n        n -= min(n, k)\n        n -= n // 10\n    return s * 2 >= n0\n\n\ndef g(n):\n    lo, hi = 1, n\n    while lo < hi:\n        mid = (lo + hi) // 2\n        if f(n, mid):\n            hi = mid\n        else:\n            lo = mid + 1\n    return lo\n\nprint(g(int(input())))\n", "lang_cluster": "Python", "tags": ["implementation", "binary search"], "code_uid": "737f9b201175bb4f96d341c26ba21a19", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\ndef isAtLeastHalf(k, n):\n    V = 0\n    P = 0\n    if n%2 == 0:\n        least = (n//2)\n    else:    \n        least = (n//2)+1\n    res = False\n    while(n > 0 and k > 0):\n        #print('n=',n, ' k=', k)\n        if n>=k:\n            V += k\n            n -= k\n        else:\n            V += n\n            n=0\n        temp = (n//10)\n        P += temp\n        n -= temp\n        if (V>= least):\n            res = True\n            break\n    #print('Partial', V,P, res)        \n    return res\n\ndef searchMiniumCandies(n, l, r, res = -1):\n    #print(n,' l=',l,' r=',r,res)\n    if r >= l:\n        mid = l + (r - l)//2\n        if isAtLeastHalf(mid, n):\n            res = mid\n            #print('TRUE', l, mid-1)\n            return searchMiniumCandies(n, l, mid-1, res )\n        else:\n            #print('False')\n\n            return searchMiniumCandies(n, mid+1, r, res )\n    else:\n        #print('retornando', res)\n        return res\n\nn = int(input())\nprint(searchMiniumCandies(n, 0,n))                ", "lang_cluster": "Python", "tags": ["implementation", "binary search"], "code_uid": "f1c5f5d2610b54c0dcb2446b6cd08764", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "l = [int(x) for x in input().split()]\nl.sort()\nb, a = l\n\ns1 = list(bin(a)[2:])\ns2 = list(bin(b)[2:])\n\nif s1 == s2:\n    print(0)\n\nelif len(s1) == len(s2):\n    cont = 0\n    while s1[cont] == s2[cont]:\n        s1[cont] = \"0\"\n        cont+=1\n    for i in range(cont , len(s1)):\n        s1[i] = \"1\"\n    print(int(\"\".join(s1), 2))\n\nelse:\n    for i in range(len(s1)):\n        s1[i] = \"1\"\n    print(int(\"\".join(s1), 2))\n\n\n", "lang_cluster": "Python", "tags": ["math", "dp", "bitmasks", "greedy", "implementation"], "code_uid": "ba2506d0eee6d0558a2e55d42a0298b7", "src_uid": "d90e99d539b16590c17328d79a5921e0", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#Problem A - Little Girl and Maximum XOR\n\nnumeros = [int(i) for i in input().split(' ')]\n# numeros = [797162752288318119, 908416915938410706]\nl = bin(numeros[0])\nr = bin(numeros[1])\n\np = -1\n# for i,j in range (len(l),len(r)):\nif (len(r) == len(l)):\n    for i in range (len(l)):\n        if (l[i] != r[i]):\n            p = i\n            break\n    if(numeros[0] != numeros[1]):\n        # saida = 2**(len(r) - 2) - 1\n        saida = 2**(len(r) - p) - 1\n        print(saida)\n    else:\n        print(0)\n\nelse:\n    if(numeros[0] != numeros[1]):\n        saida = 2**(len(r) - 2) - 1\n        # saida = 2**(len(r) - p)\n        print(saida)\n    else:\n        print(0)\n\n# print(bin(numeros[0]))\n# print(r)\n# print(p)\n\n", "lang_cluster": "Python", "tags": ["math", "dp", "bitmasks", "greedy", "implementation"], "code_uid": "983effd53b97970486810e127582f1b7", "src_uid": "d90e99d539b16590c17328d79a5921e0", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "d={input():0}\nfor i in range(20,0,-1):\n d,e={},d\n u=10**i/9\n for v,c in e.items():\n  for x in range(-6,7):\n\tt=x*u+v\n\tif abs(t)<u:d[t]=min(c+i*abs(x),d.get(t,999))\nprint d[0]\n\n", "lang_cluster": "Python", "tags": ["brute force", "divide and conquer", "dfs and similar"], "code_uid": "a6ee3ed5ba75b75d53115d62f4401087", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "multiplos_de_onze = [0, 1, 11, 111, 1111, 11111, 111111, 1111111, 11111111, 111111111, 1111111111, 11111111111,\n                     111111111111, 1111111111111, 11111111111111, 111111111111111, 1111111111111111,\n                     11111111111111111]\n# Entrada maxima, n maior que 1 e n menor que 10 elevado a 15\n\n\ndef procura_onze(n, i):  # i = 16 - pois ser\u00e1 a ultima posi\u00e7\u00e3o do vetor\n    divisao = int(n / multiplos_de_onze[i])\n    resto = n % multiplos_de_onze[i]\n    if resto == 0:\n        return divisao*i\n    else:\n        return divisao*i + min(i + procura_onze(multiplos_de_onze[i] - resto, i - 1), procura_onze(resto, i - 1))\n\n\ndef divide():\n    n = int(input())\n    m = procura_onze(n, 16)\n    print(m)\n\n\ndivide()\n", "lang_cluster": "Python", "tags": ["brute force", "divide and conquer", "dfs and similar"], "code_uid": "c2399d1f0ab3033d9ab608c13f8786e4", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "'''\n    Auther: ghoshashis545 Ashis Ghosh\n    College: jalpaiguri Govt Enggineerin College\n    Date:03/06/2020\n\n'''\nimport sys\nfrom collections import deque,defaultdict as dd \nfrom bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right\nfrom itertools import permutations\nfrom datetime import datetime\nfrom math import ceil,sqrt,log,gcd\ndef ii():return int(input())\ndef si():return input()\ndef mi():return map(int,input().split())\ndef li():return list(mi())\nabc='abcdefghijklmnopqrstuvwxyz'\nabd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}\nmod=10000000007\n#mod=998244353\ninf = float(\"inf\")\nvow=['a','e','i','o','u']\ndx,dy=[-1,1,0,0],[0,0,1,-1]\ndef read():\n    tc=1\n    if tc:\n        input=sys.stdin.readline\n    else:\n        sys.stdin=open('input1.txt', 'r')\n        sys.stdout=open('output1.txt','w')\n\n\n\n\n\n\ndef solve():\n    \n    \n    \n    n,p=mi()\n    ans=-1\n    ans=-1\n    l=1\n    r=1005\n    for i in range(1,1005):\n        x=n-p*i\n        s=list(bin(x)[2:])\n        if(i<=x and i>=s.count('1')):\n            ans=i\n            break\n    print(ans)\n    \n    \n    \n\n\n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \nif __name__ ==\"__main__\":\n    read()\n    solve()\n", "lang_cluster": "Python", "tags": ["brute force", "math", "bitmasks"], "code_uid": "5c5e9a3d6fc68e0c08069a5cb57afa94", "src_uid": "9e86d87ce5a75c6a982894af84eb4ba8", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b=map(int,input().split())\ndef bn(x):\n        m=0\n        while x>0:\n                m+=x%2\n                x//=2\n        return m\n\nmn=100000000\nidx=0\nif b==0:\n        print(bn(a))\n        exit(0)\nelse:\n        for n in range(1,100):\n                j=n*b\n                if a<=j:\n                        break\n                elif bn(a-j)<=n and a-j>=n:\n                        print(n)\n                        exit(0)\nprint(-1)", "lang_cluster": "Python", "tags": ["brute force", "math", "bitmasks"], "code_uid": "e652dd00a35c8dc5fc32cf0733b64622", "src_uid": "9e86d87ce5a75c6a982894af84eb4ba8", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from __future__ import print_function\nimport sys\n\nit = iter(sys.stdin.read().splitlines())\nn = int(next(it))\n\nlista = [0]*(n+1)\nfor i in xrange(2, n+1):\n    if(lista[i] == 0):\n        for k in xrange(2*i, n+1, i):\n            lista[k] = i\n    lista[i] = i - lista[i] + 1\npr = n\nfor i in xrange(lista[n], n+1):\n    pr = min(pr, lista[i])\n\nprint(pr)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "50a25193086e2eadd84de04a8d267a7f", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\nsys_in = sys.stdin\n\nX2 = int(sys.stdin.read())\n\n\nprimes = range(X2+1)\n\nfor i in range(2, (X2+1)/2+1):\n    if primes[i] == i:\n        for k in range(i, X2+1, i):\n            primes[k] = i\n\n\ndef get_max_div(i):\n    return primes[i]\n\n\nmin_X0 = -1\nd_max = get_max_div(X2)\nfor X1 in range(X2, X2-d_max, -1):\n    p0 = get_max_div(X1)\n    X0 = X1-p0+1\n    if X0 == 1:\n        X0 = X1\n    # print \"{} p0, {} X0, {} p1, {} X1\".format(p0, X0, d, X1)\n    if X0 < min_X0 or min_X0 == -1:\n        min_X0 = X0\n\nsys.stdout.write(str(min_X0)+\"\\n\")\n", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "de82998d59e7e1a217f2f4ef8c77d6f1", "src_uid": "43ff6a223c68551eff793ba170110438", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "nine = [0, 9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999]\n\n\ndef get_answer(n):\n    if (n < 5):\n        return (n*(n-1))//2\n    elif (2*n-1 in nine):\n        return 1\n    elif (n in nine):\n        return (n-1)//2\n    \n    str_n = str(n)\n    len_n = len(str_n)\n    len_2n = len(str(2*n-1))\n    \n    if len_n == len_2n: # n < 50..0\n        # pattern: A9..9, |9..9| = |n| - 1\n        suf = \"9\" * (len_n - 1)\n        k = int(suf)\n        res = 0\n        for c in range(10):\n            if (int(str(c) + suf) <= 2*n-1):\n                # print(str_n[0], c, '+', suf)\n                if (int(str(c) + suf) <= n):\n                    for i in range(c//2+1):\n                        if i == c-i:\n                            if i == 0:  # (0, 0): 01 -> 49\n                                res += (k-1)//2\n                            else:  # (1, 1): 00 -> 49\n                                res += (k+1)//2\n                        else:\n                            if i == 0:  # (0, 1): 01 -> 99 \n                                res += k\n                            else:  # (1, 2): 00 -> 99\n                                res += k+1\n                else:\n                    for i in range(c//2+1):\n                        if i > int(str_n[0]) or c-i > int(str_n[0]):\n                            continue\n                        elif i < int(str_n[0]) and c-i < int(str_n[0]):\n                            if i == c-i:\n                                if i == 0:  # (0, 0): 01 -> 49\n                                    res += (k-1)//2\n                                else:  # (1, 1): 00 -> 49\n                                    res += (k+1)//2\n                            else:\n                                if i == 0:  # (0, 1): 01 -> 99 \n                                    res += k\n                                else:  # (1, 2): 00 -> 99\n                                    res += k+1\n                        else:\n                            # print(i, c-i, int(str(c) + suf), n)\n                            if i != c - i:\n                                # print(n-int(str_n[0])*(k+1)+1)\n                                res += n-int(str_n[0])*(k+1)+1\n                            else:\n                                _n = int(str_n[1:])\n                                # print(_n)\n                                res += get_answer(_n) + (_n in nine)\n                                # 99: (0, 0): 01 -> 49, (i, i): 00 -> 49 => +1\n            else:\n                break\n        return res\n    else: # n > 50..0\n        # pattern: 9..9, |9..9| = |n|\n        suf = int('9' * len_n)\n        return n - (suf+1)//2 + 1\n\nprint(get_answer(int(input())))\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "24064b012331e7ff157177a4e7127d72", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n\nlines = []\nfor line in sys.stdin:\n    lines.append(line)\n\nn = int(lines[0].rstrip(\"\\r\\n\\t \"))\n\nmax_price = n * 2 - 1\nnines = len(str(max_price + 1)) - 1\n\nif nines < 1:\n    cnt = 0\n    for x in range(1, n):\n        cnt += x\n    print(cnt)\n    exit()\n\nprice_suffix = \"9\"*nines\ncnt = 0\n\n\ndef add_pairs(max_x: int, p: int):\n    global cnt\n    from_max = int(p / 2)\n    to_max = p - 1\n    if to_max > max_x:\n        to_max = max_x\n    from_min = p - to_max\n    cnt += from_max - from_min + 1\n\n\nfor d in range(0, 10):\n    if d > 0:\n        price = int(str(d) + price_suffix)\n    else:\n        price = int(price_suffix)\n    if price <= max_price:\n        add_pairs(n, price)\n\nprint(cnt)\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "7d7f2cd069992eefa40b62222e567924", "src_uid": "c20744c44269ae0779c5f549afd2e3f2", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a = int(input())\nsumm = 5\nwhile summ % 4 != 0:\n    summ = 0\n    a = str(a)\n    for i in a:\n        summ += int(i)\n    if summ % 4 != 0:\n        a = int(a) + 1\nprint(a)\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "fda35fa379a854d9fb285e08062e5d5b", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\nk=sum(list(map(int,str(n))))\nwhile k%4!=0:\n    n+=1\n    k=sum(list(map(int,str(n))))\nprint(n)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "0d64d1db8d52371937df3a51f39b47db", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "print max(1,3**(input()-1))%1000003", "lang_cluster": "Python", "tags": ["math"], "code_uid": "5c86205e807944580edb8ee732281c7c", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "'''\nCreated on 3 Mar 2011\n\n@author: salama\n'''\nn = input()\nif n == 0:\n    print 1\nelse :\n    print 3**(n-1)%1000003", "lang_cluster": "Python", "tags": ["math"], "code_uid": "1b1db51a70199d7a4eb4ad3a4f638253", "src_uid": "1a335a9638523ca0315282a67e18eec7", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=input()\nl=[int(x) for x in n]\n\n\n\nsum1=0\nk=len(n)\nans=0\nj=0\nif k==1:\n    ans=int(n)\n    sum1=ans\nelif k>=2:\n    for i in range(k-1,0,-1):\n       ans=ans+9*(10**j)\n       sum1+=9\n       j+=1\n    ans+=(int(n[i-1])-1)*(10**j)\n    sum1+=int(n[i-1])-1   \n    k=str(ans)\n    #print(k)\n    k=list(k)\n    if k[0]=='9':\n        k.insert(0,'1')\n    else:    \n        k[0]=str(int(k[0])+1)\n    #print(k)\n    while i<len(k)-1:\n       if n > ''.join([k[0]]+k[1:i]+['8']+k[i+1:]):\n           ans=''.join([k[0]]+k[1:i]+['8']+k[i+1:])\n           i=i+1\n       else:\n           break\n\n#print(k)\n\ns=sum(l)\nif s>=sum1:\n    print(''.join(n))\nelse:\n    print(ans)\n\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "95f0efc9fc641fc5ac810d1e0320811d", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=input()\nl=[int(i) for i in n]\nans=[sum(l),n]\nfor i in range(len(n)-1):\n    t0=0\n    t1=\"\"\n    for j in range(len(n)-1):\n        if i==j:\n            t0+=l[j]-1\n            t1+=str(l[j]-1)\n            t0+=9*(len(n)-j-1)\n            t1+=\"9\"*(len(n)-j-1)\n            break\n        else:\n            t0+=l[j]\n            t1+=str(l[j])\n    if t0>=ans[0]:\n        ans[0]=t0\n        ans[1]=t1\nif ans[0]==sum(l):\n    ans[1]=n\nprint(int(ans[1]))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "b8e0bef1adb9f892f0375c0cccf2e56c", "src_uid": "e55b0debbf33c266091e6634494356b8", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#------------------------template--------------------------#\nimport os\nimport sys\nfrom math import *\nfrom collections import *\nfrom fractions import *\nfrom bisect import *\nfrom heapq import*\nfrom io import BytesIO, IOBase\ndef vsInput():\n    sys.stdin = open('input.txt', 'r')\n    sys.stdout = open('output.txt', 'w')\nBUFSIZE = 8192\nclass FastIO(IOBase):\n    newlines = 0\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\nALPHA='abcdefghijklmnopqrstuvwxyz'\nM=1000000007\ndef value():return tuple(map(int,input().split()))\ndef array():return [int(i) for i in input().split()]\ndef Int():return int(input())\ndef Str():return input()\ndef arrayS():return [i for i in input().split()]\n\n#-------------------------code---------------------------#\n# vsInput()\n\n\ndef Dist(x1,y1,x2,y2):\n    return sqrt((x1-x2)**2 + (y2-y1)**2)\n\ndef Intersect(C1,C2):\n    x1,y1,r1=C1\n    x2,y2,r2=C2\n    d=Dist(x1,y1,x2,y2)\n    # print(C1,C2,d,r1,r2)\n    return abs(r1-r2)<d<r1+r2\n\ndef inside(c1,c2):\n    x1,y1,r1=c1\n    x2,y2,r2=c2\n    d=Dist(x1,y1,x2,y2)\n\n    # print(d,r1,r2)\n\n    return d+r1<=r2\n\ndef Check(circle,ring):\n    inner=(ring[0],ring[1],ring[2])\n    outer=(ring[0],ring[1],ring[3])\n    \n    if(inside(circle,inner) and not Intersect(circle,inner)): return True\n    if(not inside(circle,outer) and not Intersect(circle,outer)): return True\n    return False\n\nRing1=value()\nRing2=value()\nx1,y1,r1,R1=Ring1\nx2,y2,r2,R2=Ring2\n\n\nans=0\n\nif(Check((x1,y1,r1),Ring2)):\n    ans+=1\nif(Check((x1,y1,R1),Ring2)):\n    ans+=1\nif(Check((x2,y2,r2),Ring1)):\n    ans+=1\nif(Check((x2,y2,R2),Ring1)):\n    ans+=1\n\nprint(ans)\n\n\n\n\n        \n                \n            \n\n\n\n\n\n\n\n\n\n    \n", "lang_cluster": "Python", "tags": ["geometry"], "code_uid": "f9651b5b0bfdf8a851d1bc141e7ae98a", "src_uid": "4c2865e4742a29460ca64860740b84f4", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "((x,y,r,R),(u,v,w,W))=[map(int,raw_input().split()) for _ in (1,2)]\nd=(x-u)*(x-u)+(y-v)*(y-v)\ndef t(a,b,c):\n  if c<=a and (a-c)*(a-c)>=d:return 1\n  if c>=b and (c-b)*(c-b)>=d:return 1\n  if (b+c)*(b+c)<=d:return 1\n  return 0\nprint t(r,R,w)+t(r,R,W)+t(w,W,r)+t(w,W,R)\n\n", "lang_cluster": "Python", "tags": ["geometry"], "code_uid": "b9aa16b358c235c16458a1efe880d3ff", "src_uid": "4c2865e4742a29460ca64860740b84f4", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "'''\nCreated on 2014/9/29\n\n@author: Yeu-Chern Harn\n'''\nimport sys\ndef p471C( N ):\n    diffH = 0\n    Hlim = N/2\n    h = 1\n    while h <= Hlim:\n        rN = N - 2*h\n        if rN % 3 == 0:\n            rN = rN / 3\n            if rN >= (h-1)*h/2:\n                diffH = diffH + 1\n            else:\n                break\n        h = h + 1;\n    return diffH\n\ndef p471C_2(N):\n    diffH = 0\n    sumVal = 0\n    card = 2\n    while sumVal + card <= N:\n        sumVal = sumVal + card\n        rN = N - sumVal\n        if rN % 3 == 0:\n            diffH = diffH + 1\n        card = card + 3\n    return diffH\n\nif __name__ == '__main__':\n    iVal = int(raw_input())\n    diffH = p471C(  iVal )\n    print(diffH)", "lang_cluster": "Python", "tags": ["math", "greedy", "binary search", "brute force"], "code_uid": "5f55f75e7e027a6baa3e5caea56415e9", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from fractions import Fraction as F\nimport math\nimport sys\n\nfi = sys.stdin\nfo = sys.stdout\nfe = sys.stderr\nexit = sys.exit\n\nreadline = raw_input\n\ndef readargs(tp=None):\n    if tp is not None:\n        return map(tp, readline().split())\n    return readline.split()\n\ndef yesno(flag, yes='', no=''):\n    if flag:\n        print yes if yes else 'YES'\n    else:\n        print no if no else 'NO'\n\ntruefalse = lambda flag : yesno(flag, yes='TRUE', no='FALSE')\n\nn = int(readline())\n\nlevels = 1\ncnt = 0\n\nwhile (n - (levels << 1)) % 3 != 0:\n    levels += 1\n\nwhile True:\n    lft = n - (levels << 1)\n    tmp = lft / 3\n    if tmp < ((levels * levels - levels) >> 1):\n        break\n    cnt += 1\n    levels += 3\n\nprint cnt\n", "lang_cluster": "Python", "tags": ["math", "greedy", "binary search", "brute force"], "code_uid": "710a882b983dfea39d782a1910fe5b78", "src_uid": "ab4f9cb3bb0df6389a4128e9ff1207de", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "es = [2, 3, 5, 7, 11]\nfor i in range(12, 1001):\n    g = True\n    for j in es:\n        if i % j == 0:\n            g = False\n            break\n    if g: es.append(i)\n\nn, k = map(int, raw_input().split())\ncount = 0\nfor x in range(len(es)):\n    i = es[x]\n    if i > n: break\n    g = False\n    for j in range(len(es) - 1):\n        if i == es[j] + es[j + 1] + 1:\n            g = True\n            break\n    if g: count += 1\nprint([\"NO\", \"YES\"][count >= k])", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "03f11e65ae5103f633b2aab2396c61da", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\n\ndef is_prime(n):\n  if n < 2:\n    return False\n  for i in range(2, int(math.sqrt(n)) + 1):\n    if n % i == 0:\n      return False\n  return True\n\nprimes = []\nfor i in range(2, 1001):\n  if is_prime(i):\n    primes.append(i)\n\nprimes2 = []\nfor i in range(2, len(primes)):\n  for j in range(i - 1):\n    if primes[j] + primes[j+1] + 1 == primes[i]:\n      primes2.append(primes[i])\n\nn, k = map(int, input().split())\ncnt = 0\nfor x in primes2:\n  if x <= n:\n    cnt += 1\n  else:\n    break\n\nif cnt >= k:\n  print('YES')\nelse:\n  print('NO')\n", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "b6ed8be6ed1d243e32ece07a36f47069", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "h1, h2 = map(int, input().split())\na, b = map(int, input().split())\nd, v = h2 - h1 - 8 * a, 12 * (a - b)\nif d <= 0:\n    print(0)\nelif b >= a:\n    print(-1)\nelse:\n    print((d + v - 1) // v)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "127c348d33b104540de55cb2fdefccc4", "src_uid": "2c39638f07c3d789ba4c323a205487d7", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from copy import deepcopy\nimport math\ndef input_list():\n    i = raw_input()\n    return map(eval, i.split(' '))\n\ndef main():\n    [h1, h2] = input_list()\n    target = h2 - h1\n    [a, b] = input_list()\n    if a <= b and 8*a < target:\n        print (-1)\n        return\n    pos = 8*a\n    k = 0\n    while pos < target:\n        k += 1\n        pos += (a-b) * 12\n    print k\n\nmain()\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "3efa9b607280b5a025f13837abd9e16a", "src_uid": "2c39638f07c3d789ba4c323a205487d7", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nif n%2==0:\n    print(n//2-1)\nelse:\n    print(n//2)", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms"], "code_uid": "9628e646abca87fd8adab181ed93f9f4", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "print (input() + 1) / 2 - 1\n", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms"], "code_uid": "8e1ec3fcc3d9dcaff1d82a5a68fca5eb", "src_uid": "dfe9446431325c73e88b58ba204d0e47", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "MOD = 998244353\n\nn, m, l, r = map(int, input().split())\n\nif (n*m) % 2 == 1:\n\tprint(pow(r - l + 1, n * m, MOD))\nelse:\n\tans = pow(r - l + 1, n * m, MOD)\n\tif (r-l) % 2 == 0:\n\t\tans += 1\n\tans *= pow(2, MOD-2, MOD)\n\tans %= MOD\n\tprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "matrices", "constructive algorithms", "combinatorics"], "code_uid": "bb104d384fc7235591a3d228e1458dd9", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "MOD = 998244353\nn,m,l,r = map(int,input().split())\n# print(n,m,l,r)\nif n * m % 2 == 1:\n\tprint(pow(r - l + 1,n*m,MOD))\nelse:\n\te = r//2 - (l - 1)//2\n\to = (r - l + 1) - e\n\t# inv_2 = pow(2,MOD-2)\n\tprint(((pow(e+o,n*m,MOD) + pow(e - o,n*m,MOD))*((MOD + 1)//2))%MOD)", "lang_cluster": "Python", "tags": ["math", "matrices", "constructive algorithms", "combinatorics"], "code_uid": "13c859eb5fa8570b1301b3552d234351", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    n = int(input())\n    min1, max1 = [int(t) for t in input().split()]\n    min2, max2 = [int(t) for t in input().split()]\n    min3, max3 = [int(t) for t in input().split()]\n\n    s1 = min(max1, n - min2 - min3)\n    s2 = min(max2, n - s1 - min3)\n    s3 = n - s1 - s2\n\n    print(' '.join(str(s) for s in [s1, s2, s3]))\n\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "79c10451cc1f940978434ce488cbb5f6", "src_uid": "3cd092b6507079518cf206deab21cf97", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "read=lambda:map(int,raw_input().split())\nn=input()\nmi1,mx1=read()\nmi2,mx2=read()\nmi3,mx3=read()\n\nd1=mi1\nd2=mi2\nd3=mi3\nn-=(mi1+mi2+mi3)\nif(n>0):\n    if(n>(mx1-mi1)):\n        d1=mx1\n        n-=(mx1-mi1)\n    else:\n        d1+=n\n        n=0\nif(n>0):\n    if(n>(mx2-mi2)):\n        d2=mx2\n        n-=(mx2-mi2)\n    else:\n        d2+=n\n        n=0\nd3+=n\nprint d1,d2,d3\n\n\n    \n\n\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation"], "code_uid": "f6967e66a4084f684a04488d51d530ec", "src_uid": "3cd092b6507079518cf206deab21cf97", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\n\na = int(n ** 0.5)\nbig_square = a ** 2\n\nelse_square = n - big_square\n\nanswer = int(a * 4)\nif a ** 2 != n:\n    if else_square - a > 0:\n        answer += 4\n    else:\n        answer += 2\n\nprint(answer)", "lang_cluster": "Python", "tags": ["brute force", "math", "geometry"], "code_uid": "90161dd47e795ffadedda14d045103a2", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\na=int(n**0.5)\nn-=a**2\n\nprint(a*4+2*(n>0)+2*(n>a))", "lang_cluster": "Python", "tags": ["brute force", "math", "geometry"], "code_uid": "7f3fd87901d9e4959b5e8eacf6442537", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\nx=min(n,m)\ny=max(n,m)\ncount=0\nfor i in range(1,x+1):\n    j=5-(i%5)\n    count+=(y-j)//5\n    count+=1\nprint(count)", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "number theory"], "code_uid": "eb1ebcff08761d7266835de597275ee3", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b = map(int,input().split());cnt = 0\nfor i in range(1,a+1):\n    cnt+=(b+(i%5))//5\nprint(cnt)", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "number theory"], "code_uid": "f941364784efcca1aeeddad6a3d9ce88", "src_uid": "df0879635b59e141c839d9599abd77d2", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\nw=input()\nn=str(n)\nt=0\np=[0]*len(n)\nif n=='0':\n    if w=='0':\n        print('OK')\n    else:\n        print('WRONG_ANSWER')\nelse:\n    if '1' in n:\n        t=1\n    else:\n        if '2' in n:\n            t=2\n        else:\n            if '3' in n:\n                t=3\n            else:\n                if '4' in n:\n                    t = 4\n                else:\n                    if '5' in n:\n                        t = 5\n                    else:\n                        if '6' in n:\n                            t = 6\n                        else:\n                            if '7' in n:\n                                t = 7\n                            else:\n                                if '8' in n:\n                                    t = 8\n                                else:\n                                    t=9\n    s=str(t)\n    for i in range (0,10):\n        if i==t:\n            s=s+str(i)*(n.count(str(i))-1)\n        else:\n            s = s + str(i) * (n.count(str(i)))\n    if s==w:\n        print('OK')\n    else:\n        print('WRONG_ANSWER')", "lang_cluster": "Python", "tags": ["sortings", "implementation"], "code_uid": "d7ead9492a591eada955cfbb671415f7", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = raw_input().strip()\nm = raw_input().strip()\na = list()\nn0 = 0\ns = \"\"\nfor x in n:\n\tif x == '0':\n\t\tn0 += 1\n\telse:\n\t\ta.append(int(x))\na.sort()\nif(len(a)>0):\n\ts += str(a[0])\ns += '0'*n0\nfor i in range(1,len(a)):\n\ts += str(a[i])\nif s == m:\n\tprint \"OK\"\nelse:\n\tprint \"WRONG_ANSWER\"", "lang_cluster": "Python", "tags": ["sortings", "implementation"], "code_uid": "65498045f5f5cd5b6200d2f58d375225", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input()\nk = int(input())\nle = len(s) + k\nm = 0\nfor i in range(len(s)):\n    j = 1\n    while i+2*j <= le:\n        mi = i + j\n        la = i + 2*j\n        if mi >= len(s):\n            m = max(m, j)\n        if la <= len(s) and s[i:mi] == s[mi:la]:\n            m = max(m, j)\n        if mi < len(s):\n            xl = len(s) - mi\n            if s[i:i + xl] == s[mi:len(s)]:\n                m = max(m, j)\n        j += 1\nprint(2*m)\n", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "137849bddc4b7f276a15214fb19541b7", "src_uid": "bb65667b65ff069a9c0c9e8fe31da8ab", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def isok(s, q):\n    for i in range(0, len(s) - 2 * q + 1):\n        for j in range(0, q):\n            if s[i + j + q] != \"?\" and s[i + j] != s[i + j + q]:\n                break\n            j += 1\n        else:\n            return True\n    return False\n\ns, k = raw_input(), int(raw_input())\ns += \"?\" * k\n\nfor i in range(len(s) // 2, -1, -1):\n    if isok(s, i):\n        print 2 * i\n        break\n", "lang_cluster": "Python", "tags": ["brute force", "strings", "implementation"], "code_uid": "f5eac123314c8a471ae6f90aa2ef578b", "src_uid": "bb65667b65ff069a9c0c9e8fe31da8ab", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n\tn,m,k,x,y=map(int,input().split())\n\n\tif n==1:\n\t\tif k%m==0:\n\t\t\tprint (k//m,k//m,k//m)\n\t\telse:\n\t\t\tvl=k//m\n\t\t\tif y<=(k%m):\n\t\t\t\tvl=k//m+1\n\t\t\tprint (k//m+1,k//m,vl)\n\t\treturn \n\n\n\tma=-1*(10**20)\n\tmi=(10**20)\n\ttrack=0\n\tans=0\n\txloc=0\n\tyloc=0\n\n\tfor i in range(1,n+1):\n\t\tincrement1=2*(n-i)*m\t\t\n\t\tincrement2=2*(i-1)*m\t\t\n\t\tfor j in range(1,m+1):\n\t\t\t\n\t\t\tlo=-1\t\t\n\t\t\thi=10**18\t\t\n\n\t\t\t\n\t\t\twhile hi-lo>1:\n\t\t\t\tmid=(lo+hi)//2\n\n\t\t\t\ttimes2=(mid//2)\n\n\t\t\t\tif(increment2==0):\n\t\t\t\t\ttimes2=0\n\n\t\t\t\ttimes1=mid-times2\n\t\t\t\t\n\t\t\t\tif(increment1==0):\n\t\t\t\t\ttimes1=0\n\t\t\t\t\ttimes2=mid\n\n\t\t\t\tsumtotal=(i-1)*m+j+increment1*times1+increment2*times2\n\n\t\t\t\tif sumtotal<=k:\n\t\t\t\t\tlo=mid\n\n\t\t\t\telse:\n\t\t\t\t\thi=mid-1\n\n\t\t\ttimes2=hi//2\n\n\t\t\tif increment2==0:\n\t\t\t\ttimes2=0\n\n\t\t\ttimes1=hi-times2\n\n\t\t\tif increment1==0:\n\t\t\t\ttimes1=0\n\t\t\t\ttimes2=hi\n\n\t\t\tsumtotal=(i-1)*m+j+increment1*times1+increment2*times2\n\n\t\t\tif sumtotal<=k:\n\t\t\t\tans=hi+1\n\n\t\t\telse:\n\t\t\t\tans=hi\n\t\t\t\n\t\t\t#print (i,j,ans,sumtotal,k)\n\t\t\tif(i==x and j==y):\n\t\t\t\ttrack=ans\n\t\t\tif ans>ma:\n\t\t\t\tma=ans\n\t\t\tif ans<mi:\n\t\t\t\tmi=ans\n\n\tprint (ma,mi,track)\n\treturn\n\nmain()", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "binary search", "implementation"], "code_uid": "af805ff642c1a193293b9f8d8fa57b15", "src_uid": "e61debcad37eaa9a6e21d7a2122b8b21", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m, k, x, y = map(int, input().split())\n\ndef cnt(r, c):\n    a = k\n    if n == 1:\n        return (a // m + ((a % m) >= c))\n    res = a // ((2 * n - 2) * m)\n    if r != 1 and r != n:\n        res *= 2\n    a %= (2 * n - 2) * m\n    if a > n * m:\n        return res + 1 + (1 if r != n and a-n*m >= (n-r-1)*m + c else 0)\n    else:\n        return res + (1 if a >= (r-1)*m + c else 0)\n\nr1 = cnt(1, 1)\nr2 = cnt(2, 1)\nr3 = cnt(n - 1, 1)\nr4 = cnt(n, m)\nr5 = cnt(x, y)\nprint(max(r1, r2, r3), r4, r5)\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "binary search", "implementation"], "code_uid": "88b163e2a61f886d3c2274337fc447c7", "src_uid": "e61debcad37eaa9a6e21d7a2122b8b21", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from collections import deque, defaultdict, Counter\nfrom heapq import heappush, heappop, heapify\nfrom math import inf\nfrom functools import lru_cache\nfrom itertools import accumulate\nfrom typing import List\nimport sys\ninput = sys.stdin.readline\n\nMOD = 10**9 + 7\n\ndef make_nCr_mod(max_n=2 * 10**5, mod=10**9 + 7):\n    max_n = min(max_n, mod - 1)\n\n    fact, inv_fact = [0] * (max_n + 1), [0] * (max_n + 1)\n    fact[0] = 1\n    for i in range(max_n):\n        fact[i + 1] = fact[i] * (i + 1) % mod\n\n    inv_fact[-1] = pow(fact[-1], mod - 2, mod)\n    for i in reversed(range(max_n)):\n        inv_fact[i] = inv_fact[i + 1] * (i + 1) % mod\n\n    def nCr_mod(n, r):\n        res = 1\n        while n or r:\n            a, b = n % mod, r % mod\n            if a < b:\n                return 0\n            res = res * fact[a] % mod * inv_fact[b] % mod * inv_fact[a - b] % mod\n            n //= mod\n            r //= mod\n        return res\n\n    return nCr_mod\n\nN, K = map(int, input().split())\nnCr = make_nCr_mod(N, MOD) \nif K >= N:\n    print(2**N % MOD)\nelse:\n    ans = 1\n    for i in range(1, K+1):\n        ans += nCr(N, i) % MOD\n    print(ans % MOD)\n", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "combinatorics"], "code_uid": "6374143a5e2836be58b4b64f45410a9b", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "import sys, math, heapq, bisect\r\n\r\np = 1000000007\r\n\r\ndef lcm(x,y):\r\n    return int(x*y/math.gcd(x,y))\r\n\r\ndef readarrint():\r\n    arr = sys.stdin.readline().split()\r\n    return [int(i) for i in arr]\r\n\r\n# Python3 program to answer queries\r\n# of nCr in O(1) time.\r\nN = 1000001\r\n \r\n# array to store inverse of 1 to N\r\nfactorialNumInverse = [None] * (N + 1)\r\n \r\n# array to precompute inverse of 1! to N!\r\nnaturalNumInverse = [None] * (N + 1)\r\n \r\n# array to store factorial of\r\n# first N numbers\r\nfact = [None] * (N + 1)\r\n \r\n# Function to precompute inverse of numbers\r\ndef InverseofNumber(p):\r\n    naturalNumInverse[0] = naturalNumInverse[1] = 1\r\n    for i in range(2, N + 1, 1):\r\n        naturalNumInverse[i] = (naturalNumInverse[p % i] *\r\n                                   (p - int(p / i)) % p)\r\n \r\n# Function to precompute inverse\r\n# of factorials\r\ndef InverseofFactorial(p):\r\n    factorialNumInverse[0] = factorialNumInverse[1] = 1\r\n \r\n    # precompute inverse of natural numbers\r\n    for i in range(2, N + 1, 1):\r\n        factorialNumInverse[i] = (naturalNumInverse[i] *\r\n                                  factorialNumInverse[i - 1]) % p\r\n \r\n# Function to calculate factorial of 1 to N\r\ndef factorial(p):\r\n    fact[0] = 1\r\n \r\n    # precompute factorials\r\n    for i in range(1, N + 1):\r\n        fact[i] = (fact[i - 1] * i) % p\r\n \r\n# Function to return nCr % p in O(1) time\r\ndef Binomial(N, R, p):\r\n     \r\n    # n C r = n!*inverse(r!)*inverse((n-r)!)\r\n    ans = ((fact[N] * factorialNumInverse[R])% p *\r\n                      factorialNumInverse[N - R])% p\r\n    return ans\r\n\r\n\r\n\r\nfor i in range(1):\r\n    a = readarrint()\r\n    n = a[0]\r\n    k = a[1]\r\n    if k >= n:\r\n        print(pow(2,n,p))\r\n    else:\r\n        ans = 0\r\n        InverseofNumber(p)\r\n        InverseofFactorial(p)\r\n        factorial(p)\r\n        for i in range(k+1):\r\n            ans = ans+ Binomial(n,i,p)\r\n        print(ans%p)\r\n\r\n    \r\n        \r\n\r\n    \r\n\r\n", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "combinatorics"], "code_uid": "d856154b85ac5d740b5c2a1ca043c17a", "src_uid": "dc7b887afcc2e95c4e90619ceda63071", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\na = [int(ai) for ai in input().split(\" \")]\nno = False\nfor i in range(len(a)-1):\n    if abs(a[i]-a[i+1]) > 1:\n        no = True\n        break\nif no:\n    print(\"NO\")\nelse:\n    print(\"YES\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "37e129949cac09286b7a93d247aac78a", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())\na=list(map(int,input().split()))\nfor i in range(n-1):\n    if abs(a[i]-a[i+1])>=2:\n        exit(print('NO'))\nprint('YES')", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "61fdc437736417d2ba720f36f70b8ce9", "src_uid": "704d0ae50bccaa8bc49319812ae0be45", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "l=list(map(int, input().split()))\nprint(format((l[1]-l[0])/(l[3]+l[2]),'.10f'))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "b5812b930525d57f208e699c030fff5c", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "d,l,v1,v2=map(int,raw_input().split())\nprint \"%.10f\" % (float((l-d))/(v1+v2))", "lang_cluster": "Python", "tags": ["math"], "code_uid": "59b5afad78df8df0ee60182010925e1c", "src_uid": "f34f3f974a21144b9f6e8615c41830f5", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import io,os\ninput = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline\n\nM = 998244353\n\nMAXNUM = 260\nfactor = [1]*(MAXNUM+2)\nfactor[-1]=0\nstorecomb = {}\n\n\nfor i in range(1,MAXNUM+1):\n    factor[i] = (factor[i-1]*i)%M\n\ndef fastfrac(a,b):\n    numb = pow(b,M-2,M)\n    return ((a%M)*(numb%M))%M\n\ndef comb(n,k):\n#    print \"*\",n,k\n    if n<k: return 0\n    if n==k: return 1\n    if (n,k) in storecomb:  return storecomb[(n,k)]\n\n    num1 = factor[n]\n    num2 = factor[k]\n    num3 = factor[n-k]\n    num = (num2*num3)%M\n    output = fastfrac(num1,num)\n    storecomb[(n,k)] = output\n    return output\n\n\n\n\ndef main(t):\n\n    n,k = map(int,input().split())\n\n    dp = [[0 for q in range(k+1)] for p in range(n+1)]\n    \n    for j in range(1,k+1):\n        dp[2][j] = 1\n        dp[1][j] = 1\n    for i in range(3,n+1):\n        dp[i][1] = pow(k,(i-1)*(i-2)//2,M)\n\n\n    for i in range(3,n+1):\n        for j in range(2,k+1):\n            dp[i][j] = pow(k-j+1,(i-1)*(i-2)//2,M)\n\n\n\n    for i in range(3,n+1): \n\n        for same in range(1,i-1):\n\n            part1 = 0\n            for j in range(2,k+1):\n\n\n\n                part1 += dp[i-same][j-1]\n                part2 = ( pow(k-j+1,same*(i-1-same)+same*(same-1)//2,M) * comb(i-1,same) ) %M\n\n                dp[i][j] += (part1*part2)%M\n                \n                dp[i][j] %= M \n\n#    print(dp)\n\n#    print(dp[n])\n    print(sum(dp[n])%M)\n\n            \n   \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nT = 1 #int(input())\nt = 1\nwhile t<=T:\n    main(t)\n    t += 1\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "graph matchings"], "code_uid": "b2d91998925f14699ad967f67b03ee90", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "\nfrom sys import stdin, stdout\n\ndef int1():\n    return int(stdin.readline().strip())\n\ndef ints():\n    return map(int, stdin.readline().strip().split(\" \"))\n\ndef arr():\n    return list(stdin.readline().strip().split(\" \"))\n\ndef iarr():\n    return list(ints())\n\nclass DS:\n    def __init__(self, n):\n        self.p = [i for i in range(n)]\n        self.r = [0 for _ in range(n)]\n    def find(self, x):\n        if self.p[x] != x:\n            self.p[x] = self.find(self.p[x])\n        return self.p[x]\n    def merge(self, a, b):\n        a = self.find(a)\n        b = self.find(b)\n        if a == b:\n            return 0\n        if self.r[a] < self.r[b]:\n            p[a] = b\n        else:\n            p[b] = a\n            if self.r[a] == self.r[b]:\n                r[a]+=1\n        return 1\n\nclass BIT:\n    def __init__(self, n):\n        self.n = n + 2\n        self.arr = [0 for _ in range(self.n)]\n    def inc(self, index, val):\n        index += 1\n        while index < self.n:\n            self.arr[index] += n\n            index += (index&-index)\n\nMOD = 998244353\nn,k = ints()\nmemo = dict()\nmemo2 = dict()\nmemo3 = [[0 for _ in range(((n*(n-1))>>1)+2)] for _ in range(k+1)]\nfor i in range(1,k+1):\n    memo3[i][0] = 1\n    for j in range(1,(n*(n-1)>>1)+2):\n        memo3[i][j] = memo3[i][j-1] * i\n        memo3[i][j] %= MOD\n\ndef mexp(b,e,m):\n    if e == 0:\n        return 1\n    if e == 1:\n        return b % m\n    s = mexp(b,e>>1,m)\n    return (s * s * (b if (e&1) else 1)) % m\n\ndef inv(x):\n    if not x in memo2:\n        memo2[x] = mexp(x, MOD - 2, MOD)\n    return memo2[x]\n\ndef go(left, last):\n    if left == 0:\n        return 1\n    if last == k:\n        return 0\n    st = left * 300 + last\n    if not st in memo:\n        scale = 1\n        memo[st] = 0\n        comp = n - left\n        for i in range(left+1):\n            ex = (comp - 1) * i + ((i * (i-1))>>1)\n            memo[st] += go(left-i,last+1) * scale * memo3[k-last][ex]\n            scale *= (left - i)\n            scale *= inv(i+1)\n            scale %= MOD\n        memo[st] %= MOD\n    return memo[st] \n\nprint(go(n-1,0))\n\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "graph matchings"], "code_uid": "96d1d6d1e65c3845d8494acbe16c8394", "src_uid": "b2d7ac8e75cbdb828067aeafd803ac62", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def main():\n    m = int(input())\n    if m < 1000000:\n        lo = m*4\n        hi = m*8\n    else:\n        lo = int(4.949 * m)\n        hi = int(4.9492 * m)\n    while lo < hi - 1:\n        mid = (lo + hi)//2\n        nposs = countposs(mid)\n        if nposs < m:\n            lo = mid\n        else:\n            hi = mid\n    if m == countposs(hi):\n        print(hi)\n    else:\n        print(-1)\n\ndef countposs(maxtake):\n    k = 2\n    ans = 0\n    while True:\n        term = maxtake//(k*k*k)\n        if term == 0:\n            return ans\n        ans += term\n        k += 1\n\nmain()", "lang_cluster": "Python", "tags": ["math", "binary search", "combinatorics"], "code_uid": "5746e7bc7561652c9b8eca611e438ced", "src_uid": "602deaad5c66e264997249457d555129", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#!/usr/bin/python\n\nfrom math import floor\n\nm = int(raw_input())\nl = [k**3.0 for k in xrange(2,180000)]\n\ndef check(num):\n    return m > check2(num)\n\ndef check2(num):\n    return sum(floor(num/l[i]) for i in xrange(int(num**(1.0/3))))\n\nma = 5 * 10**15\nmi = int(4.8 * m)\n\nwhile ma-mi > 1:\n    mid = (ma+mi)/2\n    if check(mid):\n        mi = mid\n    else:\n        ma = mid\n\nif check2(ma) == m:\n    print ma\nelse:\n    print -1\n", "lang_cluster": "Python", "tags": ["math", "binary search", "combinatorics"], "code_uid": "a277065878c19df03d961ac37d92d736", "src_uid": "602deaad5c66e264997249457d555129", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def check(mid , lis):\n    pile=[10000000000]*mid\n    c=0\n    for i in range(n-1,-1,-1):\n        pile[i%mid]=min(pile[i%mid]-1,lis[i])\n#    print(pile,mid)    \n    if min(pile)<0:\n        return 0\n    else:\n        return 1    \nn = int(input())\nlis = sorted(map(int,input().split()))\nl=1\nr=n\nwhile l<=r:\n    mid = l + (r-l)//2\n#    print(l,r,mid)\n    if(check(mid,lis)):\n        r = mid-1\n    else:\n        l = mid+1\nprint(l)            \n", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "cfd0a5b6cd67a586ab467149ea5c93f0", "src_uid": "7c710ae68f27f140e7e03564492f7214", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\narr = map(int,raw_input().split())\narr.sort()\n# arr=arr[::-1]\npiles=[0]*101\ns=0\nc=0\npile=[1]\nfor i in arr[1:]:\n    # print i\n    f=False\n    for j in range(len(pile)):\n        if pile[j]<=i:\n            pile[j]+=1\n            f=True\n            break\n    if f==False:\n        pile.append(1)\n    pile.sort()\n    pile=pile[::-1]\n    # print pile\nprint len(pile)\n\n\n\n    ", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "5c04f6c4488ce3d6e6fa7f4bd22d3884", "src_uid": "7c710ae68f27f140e7e03564492f7214", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "venus = raw_input('')\nmars= raw_input('')\nvlist=venus.split(' ')\nmlist=mars.split(' ')\nvl=int(vlist[0])\nvr=int(vlist[1])\nml=int(mlist[0])\nmr=int(mlist[1])\nnum=0\nupper=vl*2+2\nlower=vl-1\nif lower==0:\n    lower=1\nif lower<=mr<=upper:\n    num+=1\nupper=vr*2+2\nlower=vr-1\nif lower ==0:\n    lower=1\nif lower<=ml<=upper:\n    num+=1\n\nif num>0:\n    print 'YES'\nelse:print 'NO'\n\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "1693c60fd9da7f264dd2f448f5413bfa", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\ndef test(a, b):\n    return True if b >= (a-1) and b <= (a+1)*2 else False\n\ndef main():\n    al, ar = map(int, raw_input().split())\n    bl, br = map(int, raw_input().split())\n    if (test(al, br) or test(ar, bl)):\n        print \"YES\"\n    else:\n        print \"NO\"\n    return 0\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "36eb60d0c66b2f5d6251d0b70f612e32", "src_uid": "36b7478e162be6e985613b2dad0974dd", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ns = input()\nsumm = 0\nfor i in range(len(s)):\n    if s[i:i+3] == 'xxx':\n        summ+=1\nprint(summ)\n", "lang_cluster": "Python", "tags": ["greedy", "strings"], "code_uid": "e4551cafbff6f511d84c287722b5dd14", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ns = input()\nans = 0\nfor i in range(n, 2, -1):\n    st = 'x'*i\n    while s.count(st):\n        ans += s.count(st)*(i-2)\n        s = s.replace(st, '')\nprint(ans)", "lang_cluster": "Python", "tags": ["greedy", "strings"], "code_uid": "7f8ae42ec964aa88dc6e9638e8501704", "src_uid": "8de14db41d0acee116bd5d8079cb2b02", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input()\n\"\"\"if s == \"V\":\n    print(0)\n    exit()\nif s == \"VK\" or s == \"VV\" or s == \"KK\":\n    print(1)\n    exit()\nbeg = s.count(\"VK\")\nm = beg\nkk = s.count(\"KK\")\nkv = s.count(\"KV\")\nvv = s.count(\"VV\")\n\nbuf = s[:]\nf = s[:]\nwhile kk:\n    c = f.find(\"KK\")\n    if c != -1:\n        f = f[:c] + \"--\" + f[c + 1:]\n        tmp = buf[:c] + \"VK\" + buf[c + 1:]\n        if tmp.count(\"VK\") > m:\n            m = buf.count(\"VK\")\n    kk -= 1\n\nbuf = s[:]\nf = s[:]\nwhile kv:\n    c = f.find(\"KV\")\n    if c != -1:\n        f = f[:c] + \"--\" + f[c + 1:]\n        tmp = buf[:c] + \"VK\" + buf[c + 1:]\n        if tmp.count(\"VK\") > m:\n            m = tmp.count(\"VK\")\n    kv -= 1\n\nbuf = s[:]\nf = s[:]\nwhile vv:\n    c = f.find(\"VV\")\n    if c != -1:\n        f = f[:c] + \"--\" + f[c + 1:]\n        tmp = buf[:c] + \"VK\" + buf[c + 1:]\n        if tmp.count(\"VK\") > m:\n            m = buf.count(\"VK\")\n    vv -= 1\n\nprint(m)\"\"\"\nprint (max((s[:i] + x + s[i+1:]).count(\"VK\") for x in \"VK\" for i in range(len(s))))", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "fc2f723a58f8992f4db54a274d9a2f5e", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "'''\ntt = int(raw_input())\na = map(int, raw_input().split())\nfor i in xrange(tt):\na = map(int, (' '.join(n for n in raw_input())).split())\n'''\nt = raw_input()\ns = map(str, (' '.join(n for n in t)).split())\nlength = len(s)\nans = 0\ni = 0\ndone = 0\nwhile (i < length - 1):\n    if (i != length - 2):\n        if ((s[i] == \"V\") and (s[i+1] == \"K\")):\n            ans += 1\n            i = i + 1\n\n        elif (s[i] == \"V\" and s[i+1] == \"V\" and s[i+2] == \"V\" and done == 0):\n            ans += 1\n            done = 1\n            s[i+1] = \"K\"\n            i = i + 1\n\n        elif (s[i] == \"K\" and s[i+1] == \"K\" and done == 0):\n            ans += 1\n            done = 1\n            s[i] = \"V\"\n            i = i + 1\n\n    else:\n        if ((s[i] == \"V\") and (s[i+1] == \"K\")):\n            ans += 1\n            i = i + 1\n\n        elif (s[i] == \"V\" and s[i+1] == \"V\" and done == 0):\n            ans += 1\n            done = 1\n            s[i+1] = \"K\"\n            i = i + 1\n\n        elif (s[i] == \"K\" and s[i+1] == \"K\" and done == 0):\n            ans += 1\n            done = 1\n            s[i] = \"V\"\n            i = i + 1\n\n    i += 1\n\nprint ans\n# print s", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "d29b2f85c006991a98a024dc257948bd", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "p=10**9+7\ndef S(x):\n\tif x==0:\n\t\treturn 0\n\telif x==1:\n\t\treturn 4\n\telif x&1:\n\t\treturn 11*pow(3,x/2,p)-7\n\telse:\n\t\treturn 19*pow(3,x/2-1,p)-7\ndef G(x):\n\treturn (S(x)+S(x+1>>1))*pow(2,p-2,p)%p;\nl,r=map(int,raw_input().split())\nprint (G(r)-G(l-1))%p;\n", "lang_cluster": "Python", "tags": ["math", "matrices", "dp"], "code_uid": "bbec58017f832590373d79115f3b20bf", "src_uid": "e04b6957d9c1659e9d2460410cb57f10", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "p=10**9+7\ndef S(x):\n if x==0:\n  return 0\n elif x==1:\n  return 4\n elif x&1:\n  return 11*pow(3,x/2,p)-7\n else:\n  return 19*pow(3,x/2-1,p)-7\ndef G(x):\n return (S(x)+S(x+1>>1))*pow(2,p-2,p)%p;\nl,r=map(int,raw_input().split())\nprint (G(r)-G(l-1))%p;", "lang_cluster": "Python", "tags": ["math", "matrices", "dp"], "code_uid": "c887bbc192033b5e3e2e8fe3689e1cef", "src_uid": "e04b6957d9c1659e9d2460410cb57f10", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "    \ndef play(t1, t2):    \n    r = 0\n    if t1[0] > t2[1] and t1[1] > t2[0]:\n        r = 1\n    elif t1[0] < t2[1] and t1[1] < t2[0]:\n        r = -1\n    else:\n        r = 0\n    #print(\"play:\", t1, t2, r)\n    return r\n\np = []\nm = []\nres = []\n\nfor _ in range(4):\n    a, b = map(int, input().split(\" \"))\n    p.append((a, b))    \n\nm.append((p[0][0], p[1][1]))\nm.append((p[1][0], p[0][1]))\nm.append((p[2][0], p[3][1]))\nm.append((p[3][0], p[2][1]))\n    \nres.append((play(m[0], m[2]), play(m[0], m[3])))\nres.append((play(m[1], m[2]), play(m[1], m[3])))\n\n#print(res)\nmm = max([max(i) for i in res])\nres = [i for i in res if max(i) == mm]\nres = [min(i) for i in res]\n#print(res)\n#rr = min(res) + 1\nif 1 in res:\n    rr = 2\nelse:\n    rr = max(res) + 1\nss = [\"Team 2\", \"Draw\", \"Team 1\"]\nprint(ss[rr])", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "e72e306d5707b9b0ce41a97578f39797", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "mtr=[[1,0],[0,1]]\np1=list(map(int,input().split()))\np2=list(map(int,input().split()))\np3=list(map(int,input().split()))\np4=list(map(int,input().split()))\nw1=w2=0\nfor l1 in mtr:\n    wi1=wi2=0\n    for l2 in mtr:\n        at1=p1[1] if l1[0]==1 else p2[1]\n        z1=p1[0] if l1[0]==0 else p2[0]\n        at2=p3[1] if l2[0]==1 else p4[1]\n        z2=p3[0] if l2[0]==0 else p4[0]\n        if at1>z2 and z1>at2:\n            wi1+=1\n        elif at1<z2 and z1<at2:\n            wi2+=1\n    if wi2>=1:\n        w2+=1\n    elif wi1==2:\n        w1+=1\nif w2==2:\n    print('Team 2')\nelif w1>=1:\n    print('Team 1')\nelse:\n    print('Draw')\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "49aeb656cd40bac0ed002174b221895c", "src_uid": "1a70ed6f58028a7c7a86e73c28ff245f", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b, k = map(int, raw_input().split())\nt, p = [True] * (b + 1), []\nfor i in range(2, b + 1):\n\tif t[i]:\n\t\tif i >= a:\n\t\t\tp.append(i)\n\t\tfor j in range(i * i, b + 1, i):\n\t\t\tt[j] = False\nprint -1 if len(p) < k else max([p[i] - p[i - k] for i in range(k, len(p))] + [b - p[-k] + 1, p[k - 1] - a + 1])", "lang_cluster": "Python", "tags": ["two pointers", "binary search", "number theory"], "code_uid": "9ef543c389ea31d29f5909f5ec5b835c", "src_uid": "3e1751a2990134f2132d743afe02a10e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def f(n):\n    m = int(n ** 0.5) + 1\n    t = [1] * (n + 1)\n    for i in range(3, m):\n        if t[i]: t[i * i :: 2 * i] = [0] * ((n - i * i) // (2 * i) + 1)\n    return [2] + [i for i in range(3, n + 1, 2) if t[i]]\n\na, b, k = map(int, input().split())\nn = 2000001\n\nt, p, x = [-1] * n, f(n), -1\nk -= 1; b += 1\n\nfor i in range(len(p) - k):\n    t[p[i]] = p[i + k] - p[i]\n\nt.reverse()\nfor i in range(1, n):\n    if t[i] < 0: t[i] = t[i - 1] + 1\nt.reverse()\n\nfor i in range(a + 1, b):\n    t[i] = max(t[i], t[i - 1])\n\nfor l in range(1, b - a + 1):\n    if t[b - l] < l:\n        x = l\n        break\nprint(x)", "lang_cluster": "Python", "tags": ["two pointers", "binary search", "number theory"], "code_uid": "5d3d28d4fac76977607045763f95ae58", "src_uid": "3e1751a2990134f2132d743afe02a10e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom math import gcd,sqrt,ceil\nfrom collections import defaultdict,Counter,deque\nfrom bisect import bisect_left,bisect_right\nimport math\n\n# input=sys.stdin.readline\n# def print(x):\n#     sys.stdout.write(str(x)+\"\\n\")\n\n# sys.stdout=open(\"CP1/output.txt\",'w')\n# sys.stdin=open(\"CP1/input.txt\",'r')\nimport os\nimport sys\nfrom io import BytesIO, IOBase\n\nBUFSIZE = 8192\n\n\nclass FastIO(IOBase):\n    newlines = 0\n\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\n\n\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n\n\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\n# import sys\n# import io, os\n# input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline\ndef get_sum(bit,i):\n    s = 0\n\n    i+=1\n    while i>0:\n        s+=bit[i]\n        i-=i&(-i)\n\n    return s\n\ndef update(bit,n,i,v):\n    i+=1\n\n    while i<=n:\n        bit[i]+=v\n        i+=i&(-i)\n\n\ndef modInverse(b,m):\n    g = math.gcd(b, m)\n    if (g != 1):\n        return -1\n    else:\n        return pow(b, m - 2, m)\n\ndef primeFactors(n):\n\n    sa = set()\n    sa.add(n)\n    while n % 2 == 0:\n        sa.add(2)\n        n = n // 2\n\n\n    for i in range(3,int(math.sqrt(n))+1,2):\n\n\n        while n % i== 0:\n            sa.add(i)\n            n = n // i\n\n    # sa.add(n)\n    return sa\n\n\ndef seive(n):\n\n    pri = [True]*(n+1)\n    p = 2\n    while p*p<=n:\n\n        if pri[p] == True:\n\n            for i in range(p*p,n+1,p):\n                pri[i] = False\n\n        p+=1\n\n    return pri\n\ndef ifposs(l):\n\n    i = a\n    # print(l)\n    while b-i+1>=l:\n\n        z = i+l-1\n\n\n        if pre[z]-pre[i-1]<k:\n            return False\n\n        else:\n            i+=1\n\n    return True\n\n\n\na,b,k = map(int,input().split())\n\npri = []\nh = seive(b+1)\nh[1] = False\npre = [0]\nfor i in range(a,b+1):\n    if h[i] == True:\n\n        pri.append(i)\n        pre.append(pre[-1]+1)\n    else:\n        pre.append(pre[-1])\n\npre = [0]*(a-1) + pre\n# print(pre)\n# print(pri)\nif len(pri)<k:\n    print(-1)\nelse:\n    i = j = a\n    l = 0\n\n    while j<=b:\n\n        if pre[j]-pre[i-1]<k:\n            j+=1\n\n        else:\n            l = max(l,j-i+1)\n            i+=1\n    l = max(l,j-i+1)\n    print(l)\n\n\n\n\n", "lang_cluster": "Python", "tags": ["two pointers", "binary search", "number theory"], "code_uid": "057dd6eeaa77d2d2f736ac9f015be7e8", "src_uid": "3e1751a2990134f2132d743afe02a10e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def main():\n    def sieve(n):\n        s = xrange(3, n + 1, 2)\n        r = set(s)\n        [r.difference_update(xrange(n << 1, s[-1] + 1, n)) for n in s if n in r]\n        return r.union([2])\n    a,b,k=map(int,raw_input().split())\n    p=filter(lambda x:x>=a and x<=b,sorted(sieve(b)))\n    if len(p)<k:\n        print -1\n        return\n    #print p\n    m=max(p[k-1]-a+1,b-p[-k]+1)\n    try:\n        print max(m,max([p[i+k]-p[i] for i in range(len(p)-k)]))\n    except:\n        print m\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["two pointers", "binary search", "number theory"], "code_uid": "531c2845cdddff7c16dd43a988ccf3dd", "src_uid": "3e1751a2990134f2132d743afe02a10e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "a,b,k=map(int,raw_input().split())\nt,p=[True]*(b+1),[]\nfor i in range(2,b+1):\n    if t[i]:\n        if i>=a:p.append(i)\n        for j in range(i * i, b + 1, i):t[j] = False\nprint -1 if len(p) < k else max([p[i]-p[i-k] for i in range(k,len(p))] + [b-p[-k]+1,p[k-1]-a+1])\n\n", "lang_cluster": "Python", "tags": ["two pointers", "binary search", "number theory"], "code_uid": "6953e12f836b555d74c6fed7dc5e2565", "src_uid": "3e1751a2990134f2132d743afe02a10e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "a,b,k=map(int,raw_input().split())\nt,p=[True]*(b+1),[]\nfor i in range(2,b+1):\n    if t[i]:\n        if i>=a:p.append(i)\n        for j in range(i * i, b + 1, i):t[j] = False\nprint -1 if len(p) < k else max([p[i]-p[i-k] for i in range(k,len(p))] + [b-p[-k]+1,p[k-1]-a+1])\n\n", "lang_cluster": "Python", "tags": ["two pointers", "binary search", "number theory"], "code_uid": "91aa56d5e26d825f4131b6285f95ab76", "src_uid": "3e1751a2990134f2132d743afe02a10e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import stdin\ndef in_row(ch):\n    if ch=='f': return 1\n    if ch=='a': return 4\n    if ch=='b': return 5\n    if ch=='c': return 6\n    if ch=='d': return 3\n    if ch=='e': return 2\nli=input().strip()\nn=int(li[0:-1])\ns=li[-1]\ntime=0\ntmp=(n-1)//4\ntime += tmp*3 + tmp*13\ntmp=(n-1)%4\nif tmp==1 or tmp==3:\n    time += 7\ntime += in_row(s)\n\nprint(time)\n\n\n\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "e4963bcdd8ee4250457549bcc6654b9c", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#!/usr/bin/env\tpython\n#-*-coding:utf-8 -*-\nz=input()\nM='fedabc'\nn=int(z.rstrip(M))-1\nprint(1+M.find(z[-1])+7*(1&n)|n>>2<<4)\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "931f57e61fee3ea437d6632177b5ec87", "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = map(int, raw_input().split())\na = sorted(a)\nprint ['NO', 'YES'][a[0] == 1 or a[:2] == [2, 2] or a == [3, 3, 3] or a == [2, 4, 4]]", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms"], "code_uid": "0cf7fd71a840fc6d81fb940fccf75a96", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\n\narr = map(int, raw_input().split())\narr.sort()\n\nif arr[0] == 1 or arr.count(2) >= 2 or arr.count(3) == 3 or arr == [2, 4, 4] :\n        print 'YES'\nelse:\n        print 'NO'\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms"], "code_uid": "c4a7d1e55faba1f58d7632cc7299cb5e", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a=int(input())\nprint(1 if a%2!=0 else 0)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "5dbe5343a3e9d647a302231edf06ee15", "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "print int(raw_input())%2", "lang_cluster": "Python", "tags": ["math"], "code_uid": "a91523c386e78b8e71cc35e60779ba3b", "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "k=int(input())\nb=input()\nc=input()\nd=input()\ne=input()\ns=b+c+d+e\n#print(s)\na=[0]*10\nfor i in s:\n    if(i==\"0\"):\n        a[0]=a[0]+1\n    elif(i==\"1\"):\n        a[1]=a[1]+1\n        #print(a[1])\n    elif(i==\"2\"):\n        a[2]=a[2]+1\n    elif(i==\"3\"):\n        a[3]=a[3]+1\n    elif(i==\"4\"):\n        a[4]=a[4]+1\n    elif(i==\"5\"):\n        a[5]=a[5]+1\n    elif(i==\"6\"):\n        a[6]=a[6]+1\n    elif(i==\"7\"):\n        a[7]=a[7]+1\n    elif(i==\"8\"):\n        a[8]=a[8]+1\n    elif(i==\"9\"):\n        a[9]=a[9]+1\nd=0\n#print(a)\nfor i in a:\n    if(i<=k*2):\n        d=d+1\nif(d==10):\n    print(\"YES\")\nelse:\n    print(\"NO\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "7a126f31fe0dfecbc039ed1b05443872", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "K = int( raw_input() ) \nmat = [raw_input() for i in range(4) ]\ncnt = [ 0 for i in range(10) ]\n\nfor x in mat :\n    for y in x :\n        if y=='.' :\n            continue\n        cnt[ int(y) ] += 1\n\nfor a in cnt :\n    if a>K*2 :\n        print \"NO\"\n        exit(0)\n\nprint \"YES\"\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "4928419cf2f69400b2558242750cfc22", "src_uid": "5fdaf8ee7763cb5815f49c0c38398f16", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import datetime as DT\n\ndef bus(a, t_a, b, t_b, t):\n\n\tt1 = DT.datetime.strptime(t, '%H:%M')\n\tt2 = DT.datetime(1900, 1, 1)\n\tt_start = ((t1 - t2).total_seconds() / 60.0) - 300\n\tt_end = t_start + t_a\n\n\tt_elapsed = 0\n\tz = 0\n\n\twhile(t_elapsed <= 23 * 60 + 59 - 300):\n\t\tstart = t_elapsed\n\t\tend = start + t_b\n\t\tif(max(t_start, start) < min(t_end, end)):\n\t\t\tz += 1\n\t\tt_elapsed += b\n\treturn z\n\t\n\nif __name__ == \"__main__\":\n    a = input().split(' ')\n    b = input().split(' ')\n    t = input()\n    print(bus(int(a[0]), int(a[1]), int(b[0]), int(b[1]), t))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "16e0d7faf0cd78474a1f5982cd62109c", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    a, ta = map(int, input().split())\n    b, tb = map(int, input().split())\n    h, m = map(int, input().split(':'))\n    res, lo = 0, h * 60 + m - 300\n    hi = lo + ta\n    print(sum(max(lo, t) < min(hi, t + tb) for t in range(0, 1140, b)))\n\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "174e4e07773cb372cd174269334a9c74", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\nif n != 5:\n    print(n % 3 + 1)\nelse:\n    print(1)", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "dd470c06e954ea61d6da78262a8bcd9c", "src_uid": "c702e07fed684b7741d8337aafa005fb", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "print [2,3,1,2,1][input()-1]\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "d03ebad188f34c07345198434c45c92b", "src_uid": "c702e07fed684b7741d8337aafa005fb", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin, stdout\n\nn = int(stdin.readline())\nvalues = list(map(int, stdin.readline().split()))\ndp = [0 for i in range(n)]\n\ndp[-1] = values[-1]#\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0440\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0445\u0430\u0432\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0439\u0434\u0442\u0438 \u0442\u0443\u0434\u0430 \u0441 \u0444\u0438\u0448\u043a\u043e\u0439\ncnt = values[-1]\n\nfor i in range(n - 2, -1, -1):\n    cnt += values[i]\n    dp[i] = max(dp[i + 1], cnt - dp[i + 1])\n\nstdout.write(str(cnt - dp[0]) + ' ' + str(dp[0]))", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "6965990005eac155191a86d7a884f369", "src_uid": "414540223db9d4cfcec6a973179a0216", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "N = int(input())\nn = list(map(int,input().split(\" \")))\n\nif N == 1:\n    ans = [0, n[0]]\nelif N == 2:\n    ans = [min(n), max(n)]\nelse:\n    # print(n)\n    n.reverse()\n    f = max(n[0], n[1]) # f2\n    s = n[0] + n[1] # s2\n    for i in range(2, N):\n        f = max(n[i] + s - f, f)\n        s += n[i]\n    # print(f)\n    # print(s)\n    ans = [s-f, f]\n        \nprint(\" \".join(map(str,ans)))\n\n# assume f(n) is the optimal strategy for the remaning n pies, x_n, x_n-1, ...., x_1\n#\n# s(n) = sum(x_1,..., x_n)\n# f(1) = x1\n# f(2) = max(x2, x1)\n# f(3) = max(x3 + s(2) - f(2), f(2))\n# f(4) = max(x4 + s(3) - f(3), f(3))", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "14e3c253d5e54fca356b9cec3a893a22", "src_uid": "414540223db9d4cfcec6a973179a0216", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\na = list(map(int,input().split()))\nif a.count(min(a)) > n//2:\n    print('Bob')\nelse:\n    print('Alice')", "lang_cluster": "Python", "tags": ["games"], "code_uid": "c7e3ab14b57498f8fa0262c649897c93", "src_uid": "4b9cf82967aa8441e9af3db3101161e9", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(input())\ncnt = 0\nm = 9999999999999999\npiles = raw_input().strip().split()\nfor pile in piles:\n    a = int(pile)\n    if a < m:\n        m = a\n        cnt = 1\n    elif a == m:\n        cnt += 1\nif cnt <= n / 2:\n    print(\"Alice\")\nelse:\n    print(\"Bob\")\n", "lang_cluster": "Python", "tags": ["games"], "code_uid": "8ca41767e90643156869a66e80fb8457", "src_uid": "4b9cf82967aa8441e9af3db3101161e9", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\na=int(input())\nb=int(input())\nc=int(input())\nz=0\nif b-c<a and n>c:\n    z=(n-c)//(b-c)\n    n-=z*(b-c)\nz+=n//a\nprint(z)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "a3b09b98c11d9d12dc063afd3eba0c77", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\na = int(input())\nb = int(input())\nc = int(input())\ncount = 0\nwhile n >= a or n >= b:\n    if b - c < a and n // b > 0:\n        count = count + (n - c) // (b - c)\n        n = n - (n - c) // (b - c) * (b - c)\n    else:\n        count = count + n // a\n        n = n - n // a * a\nprint(count)", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "cfddd11442e72bb128aca516191e12be", "src_uid": "0ee9abec69230eab25de51aef0984f8f", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def gcd(a,b):\n    if b==0:\n        return a\n    else:\n        return gcd(b, a%b)\n    \ndef solve(x, y, a, b):\n    ans=\"\"\n    while not x==1 or not y==1:\n        if x < y:\n            x,y,a,b=y,x,b,a\n        ans+=str((x-1)//y)+a\n        x = x - (x-1)//y * y\n    print (ans)\n    \nx,y=map(int, input().split())\nif gcd(x,y)>1:\n    print (\"Impossible\")\nelse:\n    solve(x,y, \"A\", \"B\")", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "53480d2ceba43d3c89f4d087097b89e1", "src_uid": "6a9ec3b23bd462353d985e0c0f2f7671", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "a,b=map(int,raw_input().split())\ndef ggcd(a,b):\n\tif b==0:\n\t\treturn [1,0,a]\n\telse:\n\t\tx,y,d=ggcd(b,a%b)\n\t\tx,y=y,x-a/b*y\n\t\treturn [x,y,d]\ny,x,d=ggcd(a,b)\nif d!=1:\n\tprint \"Impossible\"\n\texit()\nans=\"\"\ndef gao(a,b,c,d):\n\tif a==1 and b==0 and c==0 and d==1: return\n\tglobal ans\n\tif a>c:\n\t\tt=b/d\n\t\tans=\"%dB\"%(t)+ans\n\t\ta-=c*t\n\t\tb-=d*t\n\t\tgao(a,b,c,d)\n\telse:\n\t\tt=c/a\n\t\tans=\"%dA\"%(t)+ans\n\t\tc-=a*t\n\t\td-=b*t\n\t\tgao(a,b,c,d)\nx+=a\nt=(x-1)/a\nx-=t*a\ny+=t*b\nassert 0<x and x<=a and 0<y and y<=b\ngao(x,b-y,a-x,y)\nprint ans", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "26719d60d5bb4720ba971b57f444e7d3", "src_uid": "6a9ec3b23bd462353d985e0c0f2f7671", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "dp = [[0 for i in range(40)]for j in range(40)]\nN,H = map(int,raw_input().split())\ndp[0] = [1 for i in range(40)]\nfor i in range(1,40):\n\tfor j in range(1,40):\n\t\tfor k in range(0,i):\n\t\t\tdp[i][j] += dp[k][j-1]*dp[i-1-k][j-1]\nprint dp[N][N] - (H > 0 and dp[N][H-1] or 0)\n", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "combinatorics"], "code_uid": "20eb51972f7a82aa6088c9f32e590bf0", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def go(n,h,v={}):\n  if (n,h) not in v:\n    v[(n,h)]=(h and sum(go(i,h-1,v)*go(n-1-i,h-1,v) for i in range(n)) or 0) if n else 1\n  return v[(n,h)]\nn,h=map(int,raw_input().split())\nprint go(n,n)-go(n,max(0,h-1))", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "combinatorics"], "code_uid": "833ac9aebebf97977dc2e677e6b01bc2", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def t(n, h):\n\tif dp[n][h] == -1:\n\t\tdp[n][h] = sum(\n\t\t\tt(m - 1, h - 1) * sum(t(n - m, i) for i in range(h)) +\n\t\t\tt(n - m, h - 1) * sum(t(m - 1, i) for i in range(h - 1))\n\t\t\tfor m in range(1, n + 1)\n\t\t)\n\n\treturn dp[n][h]\n\n\nn, h = map(int, input().split())\n\n\ndef fill(i, j):\n\tif i == 0 and j == 0:\n\t\treturn 1\n\t\n\tif i == 0 or j == 0:\n\t\treturn 0\n\n\treturn -1\n\n\ndp = [[fill(i, j) for j in range(n + 1)] for i in range(n + 1)]\n\nfor i in range(n + 1):\n\tfor j in range(n + 1):\n\t\tt(i, j)\n\nprint(sum(dp[n][i] for i in range(h, n + 1)))\n", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "combinatorics"], "code_uid": "cf30d266f3f885ca496d9ae221eebca9", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from math import *\nfrom Queue import *\nfrom sys import *\nfrom datetime import *\n\n\n\n\n\nnMax, hMax = map(int, raw_input().split())\ntable = [[0 for j in range(nMax+1)] for i in range(nMax+1)]\ntable[0][0] = 1\nfor i in range(1, nMax+1):\n    table[i][i] = 2**(i-1)\nfor h in range(1, nMax+1):\n    for n in range(h+1, nMax+1):\n        for i in range(1,n+1):\n            for j in range(h):\n                table[n][h] += table[i-1][h-1]*table[n-i][j]\n            for j in range(h):\n                table[n][h] += table[i-1][j]*table[n-i][h-1]\n            table[n][h] -= table[i-1][h-1]*table[n-i][h-1]\nres = 0\nfor h in range(hMax, nMax+1):\n    res += table[nMax][h]\nprint(res)\n", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "combinatorics"], "code_uid": "d84c84a2172acf3220aa9b251669aa3e", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "all = {}\nlimit = {}\nn, m = 0, 0\ndef searchall( lo, hi ):\n  if lo == hi: \n    return 1\n  if all.has_key((lo,hi)):\n    return all[(lo,hi)]\n  all[(lo,hi)] = 0 \n  all[(lo,hi)] += searchall( lo+1, hi )\n  all[(lo,hi)] += searchall( lo, hi-1 )\n  for i in xrange(lo+1,hi):\n    all[(lo,hi)] += searchall( lo, i-1 ) * searchall( i+1, hi )\n  return all[(lo,hi)]\n\ndef searchlimit( lo, hi, depth ):\n  global m\n  if lo == hi: \n    if depth < m:\n      return 1\n    else:\n      return 0\n  if limit.has_key((lo,hi,depth)):\n    return limit[(lo,hi,depth)]\n  limit[(lo,hi,depth)] = 0 \n  limit[(lo,hi,depth)] += searchlimit( lo+1, hi, depth+1 )\n  limit[(lo,hi,depth)] += searchlimit( lo, hi-1, depth+1 )\n  for i in xrange(lo+1,hi):\n    limit[(lo,hi,depth)] += searchlimit( lo, i-1, depth+1 ) * searchlimit( i+1, hi, depth+1 )\n  return limit[(lo,hi,depth)]\n\ndef main():\n  global n, m\n  n, m = map( int, raw_input().rstrip().split() )\n  ret = searchall( 1, n ) - searchlimit( 1, n, 1 ) \n  print ret \n\nif __name__ == \"__main__\":\n  main()", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "combinatorics"], "code_uid": "5b5be293a8ada108c786f6b57d8b39b0", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\n# coding: utf-8\n\n# In[9]:\n\n\n\n\n# In[42]:\n\nline = input().split()\n\nn = int(line[0])\nh = int(line[1])\nfrom math import log\narray_nodes_minheigt = [[0 for x in range(36)] for y in range(36)]\narray_nodes_minheigt[0][0] = 1\nfor nodes in range(1,36):\n    for minheight in range(0,nodes+1):\n        for topnode in range(1, nodes + 1):\n            left = topnode-1\n            right = nodes - topnode\n            array_nodes_minheigt[nodes][minheight] += array_nodes_minheigt[left][0] * array_nodes_minheigt[right][0] -             (array_nodes_minheigt[left][0]-array_nodes_minheigt[left][max(minheight-1,0)])*             (array_nodes_minheigt[right][0]-array_nodes_minheigt[right][max(minheight-1,0)])\n\n\nprint(int(array_nodes_minheigt[n][h]))\n\n", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "combinatorics"], "code_uid": "c6568677905818662f509756d674ebc5", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, h = map(int, raw_input().split())\n\ndp = [ [-1]*(n+1) for i in xrange(n+1)]\n\ndp[0][0] = 1\ndef f(n, h):\n    if dp[n][h] != -1:\n        return dp[n][h]\n\n    if n == 0:\n        return 0\n    if h == 0:\n        return f(n, 1)\n\n    ans = 0\n    for i in xrange(n): #0 .. n-1\n        ans += f(n-i-1, 0) * f(i, h-1)\n        ans += f(n-i-1, h-1) * f(i, 0)\n        ans -= f(n-i-1, h-1) * f(i, h-1)\n\n    dp[n][h] = ans\n    return ans\n\nprint f(n, h)\n", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "combinatorics"], "code_uid": "cf749537f132387b5833c7c3b1f93547", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, h = map(int, raw_input().split())\ndp = [[0 for j in xrange(n + 1)] for i in xrange(n + 1)]\ndp[0] = [1 for j in xrange(n + 1)]\nfor i in xrange(n + 1):\n\tfor j in xrange(1, n + 1):\n\t\tfor k in xrange(i):\n\t\t\tdp[i][j] += dp[k][j - 1] * dp[i - 1 - k][j - 1]\nprint dp[n][n] - (h > 0 and [dp[n][h - 1]] or [0])[0]\n", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "combinatorics"], "code_uid": "c8319011bcd3961f4807233769c2744a", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "tab1 = dict()\ntab2 = dict()\n\ndef num1(n):\n    if n < 0:\n        return 0\n    if n < 2:\n        return 1\n    if n not in tab1:\n        r = 0\n        for i in range(n):\n            r += num1(i) * num1(n - 1 - i)\n        tab1[n] = r\n    return tab1[n]\n\ndef num2(n, h):\n    if n < 0 or h <= 0 or n >= 2 ** (h - 1):\n        return 0\n    if n < 2:\n        return 1\n    if n < h:\n        return num1(n)\n    if (n, h) not in tab2:\n        r = 0\n        for i in range(n):\n            r += num2(i, h - 1) * num2(n - 1 - i, h - 1)\n        tab2[n, h] = r\n    return tab2[n, h]\n\n\nn, h = map(int, raw_input().split())\nprint num1(n) - num2(n, h)\n", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "combinatorics"], "code_uid": "000001a031d5a4461b1365e99af97213", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, h = map(int, input().split())\nt = s = [1] * (n + 1)\nfor m in range(1, n + 1):\n    s[m] = sum(s[m - 1 - k] * s[k] for k in range(m))\nfor j in range(h):\n    t = [sum((s[k] - t[k]) * t[m - 1 - k] + s[m - 1 - k] * t[k] for k in range(m)) for m in range(n + 1)]\nprint(t[n])\n", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "combinatorics"], "code_uid": "ddbadfae2c6270d67052fe1a3c7c0ab1", "src_uid": "faf12a603d0c27f8be6bf6b02531a931", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = input()\ndef ispolindrome(n):\n    ans = 0\n    if len(n) % 2 == 0:\n        ans_len = len(n) // 2\n    else:\n        ans_len = (len(n) // 2) + 1\n    for i in range(ans_len):\n        if n[i] == n[len(n) - 1 - i]:\n            ans += 1\n    if len(n) % 2 and ans == (len(n) // 2) + 1:\n        return True\n    elif len(n) % 2 == 0 and ans == len(n) // 2:\n        return True\n    else:\n        return False\nif ispolindrome(n):\n    print(\"YES\")\nelse:\n    n = list(n)\n    ans_len = False\n    for i in range(len(n)):\n        if n[len(n) - 1 - i] == \"0\":\n            ans_len = len(n) - 1 - i\n        else:\n            break\n    if ans_len != False and ispolindrome(n[:ans_len]):\n        print(\"YES\")\n    else:\n        print(\"NO\")", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "5167e57729cd9da0c07de532c4c2d9eb", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\ns = sys.stdin.readline().strip()\nr = s[::-1]\n\ni = 0\nwhile r[i] == '0':\n    i+=1\n\np = r[i:]\nif p == p[::-1]:\n    print \"YES\"\nelse:\n    print \"NO\"\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "4c45d7aff3e22c56b7879cbfde8ebbc9", "src_uid": "d82278932881e3aa997086c909f29051", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b, c = [int(x) for x in input().split()]\nm = max([a,b,c])\nprint(max(0, 2*m-a-b-c+1))", "lang_cluster": "Python", "tags": ["brute force", "math", "geometry"], "code_uid": "bf56cc8a6c59942c6a2aab11fdadc901", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a,b,c=map(int,input().split())\nif a+b<=c:\n    print(c+1-(a+b))\nelif a+c<=b:\n    print(b + 1 - (a + c))\nelif b+c<=a:\n    print(a + 1 - (c + b))\nelse:\n    print(0)", "lang_cluster": "Python", "tags": ["brute force", "math", "geometry"], "code_uid": "b4789ced447634b02b86ca9da5e6a583", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input()) + 1\nd = 1000000007\ng = [[1] * n for i in range(n)]\nfor i in range(1, n):\n    g[i][0] = g[i - 1][i - 1]\n    for j in range(1, i + 1): g[i][j] = (g[i][j - 1] + g[i - 1][j - 1]) % d\nprint((g[-1][-1] - g[-1][0]) % d)\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "1d068fba262a6efd0e07faea5a551e68", "src_uid": "aa2c3e94a44053a0d86f61da06681023", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "mod = 10 ** 9 + 7\nn = int(input())\na = [[0] * (n + 1) for i in range(n + 1)]\na[0][0] = 1\nfor i in range(1, n + 1):\n    a[i][0] = a[i - 1][i - 1]\n    for j in range(1, i + 1):\n        a[i][j] = (a[i][j - 1] + a[i - 1][j - 1]) % mod\nprint(a[n][n - 1])", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "d305c704c5893aad2e8667ec5cd78f2c", "src_uid": "aa2c3e94a44053a0d86f61da06681023", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\ninput = sys.stdin.readline\nfrom collections import *\n\ndef bfs():\n    q = deque([])\n    dist = [-1]*(n*2*k)\n    \n    for i in range(2*k):\n        q.append(i)\n        dist[i] = 0\n    \n    while q:\n        v = q.popleft()\n        \n        for nv in G[v]:\n            if dist[nv]==-1:\n                dist[nv] = dist[v]+1\n                q.append(nv)\n    \n    for i in range(2*k):\n        if dist[(n-1)*2*k+i]!=-1:\n            return True\n    \n    return False\n\nfor _ in range(int(input())):\n    n, k, l = map(int, input().split())\n    d = list(map(int, input().split()))\n    G = [[] for _ in range(n*2*k)]\n    p = [i for i in range(k+1)]+[i for i in range(k-1, 0, -1)]\n    \n    for i in range(n):\n        for j in range(2*k):\n            if d[i]+p[j]<=l and d[i]+p[(j+1)%(2*k)]<=l:\n                G[i*2*k+j].append(i*2*k+(j+1)%(2*k))\n            \n        if i+1<n:\n            for j in range(2*k):\n                if d[i]+p[j]<=l and d[i+1]+p[(j+1)%(2*k)]<=l:\n                    G[i*2*k+j].append((i+1)*2*k+(j+1)%(2*k))\n    \n    if bfs():\n        print('Yes')\n    else:\n        print('No')", "lang_cluster": "Python", "tags": ["brute force", "greedy", "dp"], "code_uid": "047424669ef761ad46336a2d68ebaefe", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nimport collections  \ndef input():\n\treturn sys.stdin.readline().rstrip()\n \ndef split_input():\n\treturn [int(i) for i in input().split()]\n\n# tests = 1\ntests = int(input())\n\nfor _ in range(tests):\n\tn,k,l = split_input()\n\td = split_input()\n\tnewd = [l - i for i in d]\n\tif min(newd)<0:\n\t\tprint(\"No\")\n\t\tcontinue\n\tkvalue = newd[0]\n\tdec = True\n\tans = True\n\t# print(newd)\n\ti = 1\n\twhile i < n:\n\t\t# print(kvalue,dec)\n\t\tif newd[i] < 0:\n\t\t\tans = False\n\t\t\tbreak\n\t\tif newd[i] >= k:\n\t\t\tif i < n - 1:\n\t\t\t\tkvalue = newd[i+1]\n\t\t\t\tdec = True\n\t\t\t\ti += 2\n\t\t\t\tcontinue\n\t\tif kvalue == 0:\n\t\t\tdec = False\n\t\tif dec: \n\t\t\tif newd[i] < kvalue:\n\t\t\t\tkvalue = newd[i]\n\t\t\telse:\n\t\t\t\tkvalue -= 1\n\t\telse:\n\t\t\tif newd[i] <= kvalue:\n\t\t\t\tans = False\n\t\t\t\tbreak\n\t\t\telse:\n\t\t\t\tkvalue += 1\n\t\ti += 1\n\tif ans:\n\t\tprint(\"Yes\")\n\telse:\n\t\tprint(\"No\")\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "greedy", "dp"], "code_uid": "fd2047cf4d69bf6fc555483dd7c60792", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\nr,g,b = map(int,input().split(\" \"))\nt = 30\nr = math.ceil(r/2)\ng = math.ceil(g/2)\nb = math.ceil(b/2)\nmax = r\nif(b>=r and b>=g):\n    max = b\n    t = t + 2\nelif(g>=r and g>=b):\n    max = g\n    t = t + 1\nprint(t + (max-1)*3)", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "34613a51042eb62f5c0b3afc97f4f36e", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "r,g,f=map(int,input().split())\nc=29\nwhile(1):\n    c=c+1\n    if r>=2:\n        r=r-2\n    elif r==1:\n        r=r-1\n    \n    if r==0 and g==0 and f==0:\n        break\n    c=c+1\n    if g>=2:\n        g=g-2\n    elif g==1:\n        g=g-1\n    if r==0 and g==0 and f==0:\n        break\n    c=c+1\n    if f>=2:\n        f=f-2\n    elif f==1:\n        f=f-1\n    if r<=0 and g<=0 and f<=0:\n        break\nprint(c)\n    \n    \n        \n    ", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "ee340b58ba96d27fb5decc528ecc77d9", "src_uid": "a45daac108076102da54e07e1e2a37d7", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, a, b ,c = [int(x) for x in input().split()]\ncount=0\nfor i in range(c+1):\n    for j in range(b+1):\n        t= n - i*2 -j\n        if t>=0 and a*0.5 >= t:\n            count+=1\nprint(count)\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "88007ba6ae83e6f4b1ca37ad3303cc50", "src_uid": "474e527d41040446a18186596e8bdd83", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n , a , b , c = map(int,input().split())\nif [n,a,b,c]==[3,3,2,1]:\n    print(3)\n    exit()\nelif [n,a,b,c]==[999,999,899,299]:\n    print(145000)\n    exit()    \nk=[0,a,b,0,c]\nmul=[0,a,a+2*b,0,a+b*2+c*4]\nlis=[0]*(2*n+1)\nlis[0]=1\nc=0\nan=[]\nfor i in [1,2,4]:\n    c=0\n    for j in range(i,len(lis)):\n        if j<=i*k[i]:\n#            print(i*k[i],j,i,lis[j],lis[j-1])\n            lis[j]+=lis[j-i]\n        elif j<=mul[i]:\n            if i==2:\n                lis[j]=lis[a-c-1]\n                c+=1\n            else:\n                lis[j]+=lis[a+2*b-1-c]\n                c+=1            \n#    print(lis)            \nprint(lis[-1])            \n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "798f6c8fc186d7c5d990e578f1052539", "src_uid": "474e527d41040446a18186596e8bdd83", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b = map( int, input().split())\nc,d = map(int, input().split())\nk = 0\nif c==a or b==d : k=2\nprint((abs(c-a)+1)*2 + 2*(abs(b-d)+1)+k)", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "4248a1aa87765effd8de24e13a742e18", "src_uid": "f54ce13fb92e51ebd5e82ffbdd1acbed", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x1, y1 = map(int, input().split())\nx2, y2 = map(int, input().split())\n \nif x1 == x2:\n    x1 += 1\nelif y1 == y2:\n    y1 += 1\nprint((abs(x2 - x1) + 1 + abs(y2 - y1) + 1) * 2)", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "82396fe414f2eb1ab06908f9d82640c2", "src_uid": "f54ce13fb92e51ebd5e82ffbdd1acbed", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "for i in range(int(input())):\r\n      cnt = 0\r\n      n = int(input())\r\n      a = list(map(int, input().split()))\r\n      a1 = [0,1,2]\r\n      n-=1\r\n      a[0]-=1\r\n      a[1]-=1\r\n      a[2]-=1\r\n      while True:\r\n            if n in a1:\r\n                  cnt+=1\r\n                  x = a[n]\r\n                  n = x\r\n            else:\r\n                  break\r\n      print(\"YES\" if cnt == 3 else \"NO\")\r\n", "lang_cluster": "Python", "tags": ["brute force", "greedy", "implementation", "math"], "code_uid": "b673dfab52cdbe149a871f637c635907", "src_uid": "5cd113a30bbbb93d8620a483d4da0349", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "t = int(input())\nwhile t > 0:\n    n = int(input())\n    ans = 'YES'\n    d = list(map(int,input().split()))\n    for i in range(1,4):\n        if i == d[i - 1]:\n            ans = 'NO'\n    ix = d.index(0)\n    if ix + 1 not in d:\n        ans = 'NO'\n    print(ans)\n    t -= 1\n", "lang_cluster": "Python", "tags": ["brute force", "greedy", "implementation", "math"], "code_uid": "60e9d1cd208faece5d503c0f31a6c9ea", "src_uid": "5cd113a30bbbb93d8620a483d4da0349", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,aa = map(int,raw_input().strip().split(\" \"))[:2]\na = [x for x in range(1,n+1,2)]\nb = [y for y in range(2,n+1,2)]\nb.reverse()\nc = list(zip(a,b))\nres = []\nfor i,cc in enumerate(c):\n\tif aa in list(cc):\t\n\t\tres.append(i+1)\n\t\tbreak\nprint(res[0])", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "c2414d8c3098086367f2fd8738b7d86f", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, a = map(int, input().split())\n\nif a % 2 == 1:\n    print((a + 1) // 2)\nelse:\n    print(n // 2 - a // 2 + 1)\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "79fa3876256ee7d2716563b188ca7c1b", "src_uid": "aa62dcdc47d0abbba7956284c1561de8", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from math import sqrt\ndef naive_subseq(sq, num):\n    next_sq = 0\n    for dig in num:\n        if dig == sq[next_sq]:\n            next_sq += 1\n            if next_sq == len(sq):\n                break\n    if next_sq == len(sq):\n        return True\n    else:\n        return False\nn = raw_input().strip()\nlim = int(sqrt(int(n))) + 1\nsquares, done = map(str, [i * i for i in range(1,lim)]), False\nfor i in range(lim - 2, -1, -1):\n    if naive_subseq(squares[i], n):\n        done = True\n        print len(n) - len(squares[i])\n        break\nif not done:\n    print -1", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "3ae485d32cf6ea996aaf7bea43aeeb0a", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n\ndef get_square_literal_map():\n    literal_map = {}\n    for i in range(1, 44722):\n        literal = str(i * i)\n        literal_len = len(literal)\n        if literal_len not in literal_map:\n            literal_map[literal_len] = set()\n        literal_map[literal_len].add(literal)\n    return literal_map\n\ndef is_subsequence(x, y):\n    it = iter(y)\n    return all(any(c == ch for c in it) for ch in x)\n\ndef get(n):\n    literal_map = get_square_literal_map()\n    n_len = len(n)\n    for i in range(n_len, 0, -1):\n        for j in literal_map[i]:\n            if is_subsequence(j, n):\n                return n_len - i\n    return -1\n\ndef main():\n    n = sys.stdin.readline().strip()\n    print(get(n))\n\nif __name__ == '__main__':\n    sys.exit(main())", "lang_cluster": "Python", "tags": ["brute force", "math", "implementation"], "code_uid": "5ead719633d5c24a1dec169cb4b8a760", "src_uid": "fa4b1de79708329bb85437e1413e13df", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "u = [0]*10000\na = int(input())\nb = input().split()\nstart = int(b[0])\nme = int(b[0])\nmx = 0\nfor i in b[1:]:\n    i = int(i)\n    u[i]+=1\n    mx=max(mx,i)\ni = mx\nwhile me<i:\n    z = u[i]\n    while u[i] and me<=i:\n        me+=1\n        u[i]-=1\n    u[i-1]+=z\n    i-=1\nif me == i:\n    me+=1\nprint(me-start)\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "b09c64c310d312d54ef0cfaf670239f0", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nvotes = [int(i) for i in input().split()]\nme = votes[0]\nrest = votes[1:]\nrest.sort(reverse = True)\nanswer = 0\n\nwhile (me <= rest[0]):\n    me += 1\n    rest[0] -= 1\n    answer += 1\n    rest.sort(reverse = True)\n\nprint(answer)\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "038f00f6f4358c18f04d192e3b3ce5dd", "src_uid": "aa8fabf7c817dfd3d585b96a07bb7f58", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import gcd\na,b = map(int,input().split(' '))\ngcd = gcd(a,b)\na,b = a/gcd, b/gcd\nif abs(a-b) <= 1: print('Equal')\nelif a < b: print('Dasha')\nelse: print('Masha')", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "372b7f96a1ab19d657999893eba5d65f", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import gcd\nn,m=map(int,input().split())\nlcm=n*m//(gcd(n,m))\na,b=lcm//n,lcm//m\n# print()\nif abs(a-b)<=1:\n    print(\"Equal\")\nelif a>b:\n    print(\"Dasha\")\nelse:\n    print(\"Masha\")\n\n", "lang_cluster": "Python", "tags": ["math", "implementation", "number theory"], "code_uid": "cd3c6fae63973a8ff773cfb318de8ffa", "src_uid": "06eb66df61ff5d61d678bbb3bb6553cc", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n=int(input())-1;a=0\nfor i in range(40):\n\tk=1<<i;a+=(n+k)//(k<<1)*k\nprint(a)", "lang_cluster": "Python", "tags": ["math", "dp", "bitmasks", "graphs", "implementation"], "code_uid": "b02b82e7bbe10366292c88ef06555c54", "src_uid": "a98f0d924ea52cafe0048f213f075891", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def f(n):\n    if n == 0:\n        return 0\n    return 2**(n-1) + 2*f(n-1)\n\nf = [0]*60\n\nfor n in range(1, 60):\n    f[n] = 2**(n-1) + 2*f[n-1]\n\nn = int(input())\n\nans = 0\n\nfor k in range(60, 0, -1):\n    if n >= 2**k:\n        ans += f[k]\n        n -= 2**k\n        if n > 0:\n            ans += 2**k\n\nprint(int(ans))", "lang_cluster": "Python", "tags": ["math", "dp", "bitmasks", "graphs", "implementation"], "code_uid": "8e33e2c9018262b86425f46d9687887e", "src_uid": "a98f0d924ea52cafe0048f213f075891", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def dis(x,y,d):\n    if y==0 or x==d:\n        return x+y\n    else:\n        return 4*d - x - y\nd,x1,y1,x2,y2 = map(int, input().split())\na = abs(dis(x1,y1,d) - dis(x2,y2,d))\nprint(min(a, 4*d-a))", "lang_cluster": "Python", "tags": ["dfs and similar", "greedy", "implementation"], "code_uid": "6b91f627402983ecbff1a2120d0c367a", "src_uid": "685fe16c217b5b71eafdb4198822250e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#coding: utf-8\ndef dot(a, b):\n    return a[0]*b[1] - a[1]*b[0]\ndef main():\n    n,x1,y1,x2,y2 = map(int, raw_input().split())\n    if dot((n,n),(x1,y1))*dot((n,n),(x2,y2)) < 0:\n        ans = x1 + y1 + x2 + y2\n    else:\n        ans = abs((x1+y1)-(x2+y2))\n    print min(ans, 4*n-ans)\nmain()", "lang_cluster": "Python", "tags": ["dfs and similar", "greedy", "implementation"], "code_uid": "89ecbd23bff5dc3a9f02dce840865215", "src_uid": "685fe16c217b5b71eafdb4198822250e", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def nod(a, b):\n    if(b == 0): return a\n    else: return nod(b, a % b)\n\nn = input()\ns = 0\ncol = n - 2\nfor i in range(2, n):\n    os = []\n    k = n\n    while k > 0:\n        os.append(k % i)\n        k /= i\n    s += sum(os)\nx = nod(s, col)\nprint(str(s / x) + '/' + str(col / x))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "fe77e845dcfc0612133eaa2f76cd6ede", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from __future__ import print_function\n\n\ndef gcd(a,b):\n\twhile b:\n\t\ta,b = b, a%b\n\treturn a\n\ndef cal(i,n):\n\ttemp = 0\n\twhile n > 0:\n\t\ttemp += n%i\n\t\tn = n// i\n\treturn temp\n\n\nn=int(input())\nsum = 0\nfor base  in range(2,n):\n\tsum += cal(base,n)\nn -= 2\nprint(sum//gcd(sum,n),n//gcd(sum,n),sep='/')\n# ~ print(gcd(5,10))", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "dda54627a3af5b7d9e4da9aa0ffaa8df", "src_uid": "1366732dddecba26db232d6ca8f35fdc", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\nA = [int(x) for x in input().split()]\nprint(A[-1]^max(A))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "92a4c93bc5568b30f82a7ec35aa68b51", "src_uid": "f45c769556ac3f408f5542fa71a67d98", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "input()\na = [int(x) for x in input().split()]\nprint(max(a) ^ a[-1])\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "99f38bd376aae56d1f8ac400ecfa0bd4", "src_uid": "f45c769556ac3f408f5542fa71a67d98", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "z='\"\"\"6\"k\"=\"3,\"iG\"17G\"6m?\"C@f\"2<6z\"ki1,\"1Y[{s\"dnF)N\"1j.&{o\"aZ>k}1\"173exa+\"atUi,},\"1canZ35z\"b*-!Ps6l\"1z<F!WJlC\"fQrp~1])H\"1}8l0AiPTl\"nXgm#Z5lD,\"3i(T`qx~]Ds\"E+Ogt0CrjAN\"5>bFGHj(<llo\">9?a93{7]We1\"c40^D[.LMx?g+\"1?yzBa$^7a2IJ,\"rJI9D,^7>i4#:z\"4L*D}`_BGPQ0eIl\"*CQ>kP?.na$|N4C\"b}!{h+@cU,fxA@0H\"2a![HA75nY?9[w&El\"y/et$Wyb:P3jr!s`,\"6D5VDU$WtQ6F[.6eRs\"1jxWA>3qs4]hE.-PIiN\"lnI97o`|oPInA^TkDio\"4glf,Tlyyp!!O?D.fH>1\";lb8nG!HpqZ5rG([PQ$+\"fQ~[53_G2]Md9R[IqDQ=,\"3mztX~mgru42V#[_Ok*%5z\"!!gEao:8e;NS5&7nt+pG[l\"dNSQ$8.+eOve@^wQz)C?71C\"2}aW[$UQ8{o>;HO:CUL{WT%H\"YZ.H_%.$MTa>0qJN_$WG9(il\"d/6|-zG:?E%6AZ[;l6[|,l[<,\"3i08:l*E&N6{#MVQpyXVn_?b4s\")Hvl~<=/q_3&;v.6NlPkRsyv0N\"gy6jfJAgKi?4Qv/t4LaJYg#b^fo\"3||<|#+iu]K2yd|Y9q|5`Bj8?<R1\"}r:L.!$$&Rlx4n);wYF[>[*>2ql+\"mx)_YQ,m+lHk+3os1Cn:qRTg9tKk,\"5!VG@Hr)9~MkSm]b*MhyhJ7dv>Wtqz\"1GPE8*^H)aMHcW|L%:<-!5J2I*)]Ztl\"y{;u8a-8T1%4G9mGC;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YQNkXf0n,kI)JOF&8^L]}JK85TBHhTBOm|}@C,~ZT{t>-*+L^-wr1'\r\n\r\n\r\nq = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&()*+,-./:;<=>?@[]^_`{|}~'\r\n\r\ndef zz(x):\r\n    a = 0\r\n    for i in x:\r\n        a = a*len(q)+q.find(i)\r\n    return a\r\n\r\nk=[zz(x) for x in z.split('\"')]\r\n\r\nn, m = map(int, input().split())\r\n\r\nprint(k[n]%m)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "b95425422148fee2d545985e4b368c23", "src_uid": "4f0e0d1deef0761a46b64de3eb98e774", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "RL = lambda type = int: list(map(type, input().rstrip().split()))\r\n\r\nA = [\"0\",\"1\",\"2\",\"6\",\"(\",\"D\",\"E3\",\"_&\",\"/51\",\"n`6\",\"n4>\",\"!rR2\",\"E+a*\",\"j61h1\",\"!3ab!\",\"q`t6#1\",\"VNp]``\",\"A3usP01\",\"Uu]Tzc9\",\"VO^o_d41\",\"qvfKTAJ`\",\"E)3/?Uu+1\",\"(}8jb&L_#\",\"t~u%i,)1I1\",\"VO5m2fVM?)\",\"UQotV@,N<G2\",\"Ab)S{N-yCa/\",\"8;$7@zAE@A&5\",\"!KuPJ};|)f@T\",\"j&+H5C/EV!Fs`\",\"dc&m9y.cD;A{l1\",\"GG3SyHC|UbaJD=\",\"UO,/Q'(O<TfS(H3\",\"d58g7AJ>?`C}Sdz\",\"_>(!VnKs'o,a_C$`\",\"(^@{KT(2v$kaV`sY1\",\"dw<ZIkf&id@~~6~)}\",\"/H{xGZxrP=1=[qw&:5\",\"tM;=~H?35d$;oOp:xM\",\"qQv:0E;P,Ue=6e['te^\",\"8v]t'VeiYNDV_/_p';/3\",\"%4nQ?EcC`2Ebp5{a<+Xc\",\"VuO>,w!&eS;Y5nVZ34`o!\",\"ts%Qfh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]\r\n\r\n\r\ndef from_base(X):\r\n    base = \"0123456789`~!@#$%^&*()-=_+[]{};:'|,./<>?qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM\";\r\n    l = len(base)\r\n    r = 0\r\n    e = 1\r\n    for c in X:\r\n        r += base.index(c)*e\r\n        e *= l\r\n    return r\r\n\r\ndef solve():\r\n    N, mod = RL()\r\n    print(from_base(A[N]) % mod)\r\n\r\n\r\n    \r\n\r\nT = 1\r\nfor t in range(T):\r\n    solve()\r\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "0b18f726366147e26db27df379fad323", "src_uid": "4f0e0d1deef0761a46b64de3eb98e774", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nimport queue\n\nfrom itertools import permutations\n\nn=int(input())\ns=input()\n\ndef determine(t):\n    for i in range(0,n-1):\n        if t[i]==t[i+1] and t[i]!='?':\n            return False\n    \n    for i in range(0,n-1):\n        if t[i]=='?' and t[i+1]=='?':\n            return True\n    \n    num=0\n    \n    if t[0]=='?' or t[n-1]=='?':\n        return True\n    \n    for i in range(1,n-1):\n        if t[i]=='?' and t[i-1]==t[i+1]:\n            return True\n    return False\n        \n    \nif determine(s):\n    print(\"YES\")\nelse:\n    print(\"No\")\n    ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "d8891450cf0387e2263ebc1da9eda2c1", "src_uid": "f8adfa0dde7ac1363f269dbdf00212c3", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\n\n\ndef main():\n\tn = int(raw_input())\n\ts = raw_input()\n\ttwo_pos = False\n\tif s[0] == '?' or s[-1] == '?':\n\t\ttwo_pos = True\n\n\tfor i in range(len(s)-1):\n\t\tif s[i] != '?' and s[i] == s[i+1]:\n\t\t\treturn False\n\t\tif s[i] == '?' and s[i+1] == '?':\n\t\t\ttwo_pos = True\n\t\tif i > 0 and s[i] == '?' and s[i-1] == s[i+1]:\n\t\t\ttwo_pos = True\n\t\n\treturn two_pos\n\nif main():\n\tprint(\"Yes\")\nelse:\n\tprint(\"No\")\n\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "c93210a271af587249eef1300fb1f4bf", "src_uid": "f8adfa0dde7ac1363f269dbdf00212c3", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import *\nn, m, k = map(int, input().split())\nc = lambda n, k: 0 if k > n else factorial(n) // (factorial(k) * factorial(n - k))\nprint(c(n - 1, 2 * k) * c(m - 1, 2 * k) % 1000000007)", "lang_cluster": "Python", "tags": ["dp", "combinatorics"], "code_uid": "11dbd40f92708308de1404dbf5e4cb3e", "src_uid": "309d2d46086d526d160292717dfef308", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import stdin, stdout, stderr, exit\nfrom math import log, factorial\nimport re\n\n# inputf = open('input.txt', 'r')\n# outputf = open('output.txt', 'w')\n\n\ndef readil():\n    return list(map(int, stdin.readline().strip().split()))\n\n\ndef C(n, k):\n    if(n-k >= 0):\n        return factorial(n) // factorial(k) // factorial(n-k)\n    else:\n        return 0\n\ndef main():\n    n, m, k = readil()\n    stdout.write(str((C(n - 1, 2 * k) * C(m - 1, 2 * k)) % 1000000007))\n\nif __name__ == '__main__':\n    main()\n\n\n# inputf.close()\n# outputf.close()\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics"], "code_uid": "7ff963a86c2b48dc113ede2ccedfe549", "src_uid": "309d2d46086d526d160292717dfef308", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import sqrt\n\nn = int(input())\nif n == 0:\n    print(1)\nelse:\n    print(4 * int(n * sqrt(2)))\n\n", "lang_cluster": "Python", "tags": ["geometry"], "code_uid": "64380ab276623090b770a26f9351a336", "src_uid": "d87ce09acb8401e910ca6ef3529566f4", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "print(max(1, 4 * int(int(input()) * 2 ** 0.5)))\n\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "ca1c52f0d076481cf3802bea25f0bc49", "src_uid": "d87ce09acb8401e910ca6ef3529566f4", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, m = map(int, raw_input().split())\nx = input()\nb = lambda h, w: ((h + 1) / 2) * ((w + 1) / 2) + (h / 2) * (w / 2) if h > 0 and w > 0 else 0\nh, w = n - x - x, m - x - x\nprint b(h + 2, w + 2) - b(h, w)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "6b9b421f30ff91e5aca88560f6dcdce6", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m=map(int,raw_input().split());x=input()-1;print(min(n,m)>2*x)*(n+m-4*x-2or 1)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "77a7b5c2c250dfc3739c3a17fbbe4e80", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = raw_input()\nprint 'Yes' if set('ABC') in map(set, zip(a, a[1:], a[2:])) else 'No'", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "51cf8b67a355f15bfeddaa66feca678e", "src_uid": "ba6ff507384570152118e2ab322dd11f", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a = list(input())\nn = ['B', 'A', 'C']\nfor k in range(len(a)):\n    if a[k] in n and k < len(a)-1 and k > 0:\n        if a[k-1] in n and a[k+1] in n:\n            if a[k-1] != a[k+1] and a[k-1] != a[k] and a[k] != a[k+1]:\n                print('Yes')\n                break\nelse:\n    print('No')", "lang_cluster": "Python", "tags": ["strings", "implementation"], "code_uid": "b9e8371a219c359dc97bc96d5cb6e461", "src_uid": "ba6ff507384570152118e2ab322dd11f", "difficulty": 900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m,c0,d0 = [int(j) for j in input().split()]\nnach = []\nnach.append([0,0,c0,d0])\nfor i in range(m):\n    nach.append([int(j) for j in input().split()])\n\nprofit = []\nnabor = [[0] * (m+1) for i in range(n+1)]\nprofit = [0] * (n+1)\nfor nn in range(1,n+1):\n    for j in range(m+1):\n        if nn - nach[j][2] >= 0:\n            if (nabor[nn - nach[j][2]][j] + 1) * nach[j][1] <= nach[j][0] and profit[nn-nach[j][2]]+nach[j][3] > profit[nn]:\n                profit[nn] = profit[nn-nach[j][2]]+nach[j][3]\n                for k in range(m+1):\n                    nabor[nn][k] = nabor[nn - nach[j][2]][k]\n                nabor[nn][j] += 1\nMaxProfit = 0\nfor i in range(n+1):\n    if MaxProfit < profit[i]:\n        MaxProfit = profit[i]\n\nprint(MaxProfit)", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "c03fca164508f64ee6c9d23b2034d16e", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# -*- coding: utf-8 -*-\n\nimport sys\n\ndata = sys.stdin.readlines()\n\nn, m, c0, d0 = map(int, data[0].split())\n\na = [0]\nb = [0]\nc = [0]\nd = [0]\n\nfor i in xrange(1, m + 1):\n    da, db, dc, dd = map(int, data[i].split())\n    a.append(da)\n    b.append(db)\n    c.append(dc)\n    d.append(dd)\n\ndp = []      # n x m\nfor i in xrange(0, n + 1): dp.append([ 0 for j in xrange(0, m+1)])\n\nfor i in xrange(0, n + 1):\n    for j in xrange(1, m + 1):\n        for k in xrange(0, a[j]/b[j] + 1):\n            if i - c[j]*k >= 0:\n                dp[i][j] = max(dp[i][j], dp[i-c[j]*k][j-1] + d[j]*k)\n                \n#for i in xrange(0, n):\n#    for j in xrange(0, m+1):\n#        print \"%3s \" % dp[i][j],\n#    print \n#print\n\ntugrics = 0\nfor k in xrange(0, n + 1):\n    tugrics = max(tugrics, dp[k][m] + ((n-k)/c0)*d0)\n\nprint tugrics\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "33d58a360e72816e727dd9a7a1b8f352", "src_uid": "4e166b8b44427b1227e0f811161d3a6f", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from sets import Set\ns=raw_input()\na=Set()\nn=10\nres = 1\nfor i in range(len(s)):\n\tif s[i] == '?':\n\t\tif i == 0:\n\t\t\tres *= 9\n\t\telse:\n\t\t\tres *= 10\n\telif s[i] >= 'A' and s[i] <= 'Z':\n\t\tif s[i] not in a:\n\t\t\tif i == 0:\n\t\t\t\tres *= 9\n\t\t\telse:\n\t\t\t\tres *= n\n\t\t\tif n > 0:\n\t\t\t\tn = n-1\n\t\t\ta.add(s[i])\nprint res\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "542df08b435a403436740d7e61d46e10", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "z=raw_input()\ns=set(i for i in z if i>\"?\")\nc=z.count(\"?\")\nq=1\nif z[0]==\"?\":c-=1;q=9\nfor i in range(len(s)):q*=10-i-((i<1)*(z[0]>\"?\"))\nprint`q`+\"0\"*c\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "2a346a9881baa6b36faf6ea3da3a188d", "src_uid": "d3c10d1b1a17ad018359e2dab80d2b82", "difficulty": 1100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = [int(x) for x in raw_input()]\narr = [8, -1, -1, 3, 6, 9, 4, 7, 0, 5]\nfor i in range(len(a)):\n    if arr[a[i]] != a[-i - 1]:\n        print 'No'\n        exit()\nprint 'Yes'", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "6d043ac448b8ecadf56cd2aaeac001e5", "src_uid": "0f11f41cefd7cf43f498e511405426c3", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def _bool(s):\n    a = (8, -1, -1, 3, 6, 9, 4, 7, 0, 5)\n    for i in range(len(s)):\n        if a[int(s[i])] != int(s[len(s) - i - 1]):\n            return False\n    return True\ns = input()\nif _bool(s):\n    print('Yes')\nelse:\n    print(\"No\")", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "212f1f4cb88c8f3000eef1898cf3de97", "src_uid": "0f11f41cefd7cf43f498e511405426c3", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "games = []\nteams = []\npoints = {}\ndiffs = {}\ngoals = {}\nvsberland = []\n\ndef order(a, b):\n\tif points[a] > points[b]:\n\t\treturn -1\n\telif points[a] < points[b]:\n\t\treturn 1\n\tif diffs[a] > diffs[b]:\n\t\treturn -1\n\telif diffs[a] < diffs[b]:\n\t\treturn 1\n\tif goals[a] > goals[b]:\n\t\treturn -1\n\telif goals[a] < goals[b]:\n\t\treturn 1\n\treturn cmp(a, b)\n\nfor i in range(5):\n\ttokens = raw_input().split()\n\tteam1 = tokens[0]\n\tteam2 = tokens[1]\n\tgoals1, goals2 = map(int, tokens[2].split(':'))\n\tgames.append([(team1, goals1), (team2, goals2)])\n\tif team1 not in teams:\n\t\tteams.append(team1)\n\t\tpoints[team1] = 0\n\t\tdiffs[team1] = 0\n\t\tgoals[team1] = 0\n\tif team2 not in teams:\n\t\tteams.append(team2)\n\t\tpoints[team2] = 0\n\t\tdiffs[team2] = 0\n\t\tgoals[team2] = 0\n\tif goals1 > goals2:\n\t\tpoints[team1] += 3\n\telif goals1 < goals2:\n\t\tpoints[team2] += 3\n\telse:\n\t\tpoints[team1] += 1\n\t\tpoints[team2] += 1\n\tdiffs[team1] += goals1\n\tdiffs[team2] -= goals1\n\tdiffs[team1] -= goals2\n\tdiffs[team2] += goals2\n\tgoals[team1] += goals1\n\tgoals[team2] += goals2\n\tif team1 == 'BERLAND':\n\t\tvsberland.append(team2)\n\telif team2 == 'BERLAND':\n\t\tvsberland.append(team1)\n\nteams.sort(cmp=order)\n\nresult = (10000, 0, 10000)\n\nteam1 = 'BERLAND'\nfor team2 in teams:\n\tif team2 != team1 and team2 not in vsberland:\n\t\tpoints[team1] += 3\n\t\t\n\t\tfor goals1 in range(0, 201):\n\t\t\tfor goals2 in range(0, goals1):\n\t\t\t\tdiffs[team1] += goals1\n\t\t\t\tdiffs[team2] -= goals1\n\t\t\t\tdiffs[team1] -= goals2\n\t\t\t\tdiffs[team2] += goals2\n\t\t\t\tgoals[team1] += goals1\n\t\t\t\tgoals[team2] += goals2\n\t\t\t\t\n\t\t\t\tteams.sort(cmp=order)\n\t\t\t\tif teams[0] == team1 or teams[1] == team1:\n\t\t\t\t\tif goals1-goals2 < result[0] or goals1-goals2 == result[0] and goals2 < result[2]:\n\t\t\t\t\t\tresult = (goals1-goals2, goals1, goals2)\n\t\t\t\t\n\t\t\t\tdiffs[team1] -= goals1\n\t\t\t\tdiffs[team2] += goals1\n\t\t\t\tdiffs[team1] += goals2\n\t\t\t\tdiffs[team2] -= goals2\n\t\t\t\tgoals[team1] -= goals1\n\t\t\t\tgoals[team2] -= goals2\n\t\t\n\t\tbreak\n\nif result[0] == 10000:\n\tprint 'IMPOSSIBLE'\nelse:\n\tprint '%d:%d'%(result[1], result[2])\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "e0056373ada13c415b25e88bb9535ee4", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "teams={}\nfor _ in range(5):\n    t1,t2,scores=raw_input().split()\n    s1,s2=map(int,scores.split(':'))\n    teams[t1]=teams.get(t1) or [0,0,0,t1,0]\n    teams[t2]=teams.get(t2) or [0,0,0,t2,0]\n    if s1>s2:\n        teams[t1][0]-=3\n    elif s1<s2:\n        teams[t2][0]-=3\n    else:\n        teams[t1][0]-=1\n        teams[t2][0]-=1\n    teams[t1][1]-=s1-s2\n    teams[t2][1]-=s2-s1\n    teams[t1][2]-=s1\n    teams[t2][2]-=s2\n    teams[t1][4]+=1\n    teams[t2][4]+=1\noppo=[t[3] for t in teams.values() if t[3]!='BERLAND' and t[4]<3][0]\nfor xy in range(1,123):\n    for y in range(0,123):\n        t1,t2=teams['BERLAND'][:],teams[oppo][:]\n        t1[0]-=3\n        t1[1]-=xy\n        t2[1]+=xy\n        t1[2]-=y+xy\n        t2[2]-=y\n        t1[4]+=1\n        t2[4]+=1\n        tms=[t for t in teams.values() if t[4]>2]+[t1,t2]\n        tms.sort()\n        if tms[0][3]=='BERLAND' or tms[1][3]=='BERLAND':\n            print '%d:%d'%(y+xy,y)\n            exit()\nprint 'IMPOSSIBLE'\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "3fbde0265f4115223a305640829f9223", "src_uid": "5033d51c67b7ae0b1a2d9fd292fdced1", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\"\"\".\"\"\"\nimport math\nl, r, gcd, lcm = (int(x) for x in input().split())\nif lcm % gcd != 0:\n    print(0)\n    quit()\n\nlcm_divisors = set()\nfor num in range(1, int(lcm**0.5) + 2):\n    if lcm % num == 0:\n        lcm_divisors.add(num)\n        lcm_divisors.add(lcm // num)\nproduct = gcd * lcm\nanswers = set()\nfor divisor in lcm_divisors:\n    if divisor < l or divisor > r:\n        continue\n    dop = product // divisor\n    if dop < l or dop > r:\n        continue\n    if math.gcd(divisor, dop) != gcd:\n        continue\n    answers.add((divisor, dop))\n    answers.add((dop, divisor))\n\nprint(len(answers))\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "6e7ec7640d75b8d8b583c9cfe018455d", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "l,r,x,y=map(int,raw_input().split())\nif x==y:\n    if x in range(l,r+1):\n        print 1\n    else:\n        print 0\n    exit(0)\nif y%x!=0:\n    print 0\n    exit(0)\nm=y/x\na=l//x\nif l%x!=0:\n    a+=1\nb=r//x\ns=[]\nz=m\nk=2\nwhile z!=1:\n    p=1\n    while z%k==0:\n        p*=k\n        z/=k\n    if p!=1 and p<=b:\n        s.append(p)\n    k+=1\nl=len(s)\n#print s\nif l==0:\n    print 0\n    exit(0)\nc=0\nfor i in range(pow(2,l-1)):\n    p=1\n    q=i\n    for j in range(l):\n        if q%2==1:\n            p*=s[j]\n        q//=2\n    if p in range(a,b+1) and m/p in range(a,b+1):\n        c+=2\nprint c", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "3048d1adec8cf08e77b7af50c61fe6dc", "src_uid": "d37dde5841116352c9b37538631d0b15", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = map(int, input().split())\nprep = []\n\ndays = [-1] * n\nrelease = []\n\nfor i in range(m):\n    s_, d_, c_ = map(int, input().split())\n    release.append(s_)\n    days[d_ - 1] = i\n    prep.append(c_)\n\nrel_on_day = {}\nfor i, r in enumerate(release):\n    if r - 1 in rel_on_day:\n        rel_on_day[r - 1].append(i)\n    else:\n        rel_on_day[r - 1] = [i]\n\nans = []\n\nwaiting = set()\n\nexam_q = []\nfor d in days:\n    if d != -1:\n        exam_q.append(d)\n\n#print(rel_on_day)\n\nfor i in range(n):\n    if i in rel_on_day:\n        waiting = waiting | set(rel_on_day[i])\n\n #   print(waiting)\n\n\n    if days[i] != -1: #exam\n        if prep[days[i]] == 0:\n            ans.append(m + 1)\n            waiting.remove(days[i])\n        else:\n            print(-1)\n            exit(0)\n    else: #choose closest unstudied exam\n        chosen = None\n        for ex in exam_q:\n            if prep[ex] > 0 and ex in waiting:\n                chosen = ex\n                break\n        if not chosen is None:\n            prep[ex] -= 1\n            ans.append(ex + 1)\n        else:\n            ans.append(0)\n\nprint(\" \".join(list(map(str, ans))))\n", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "862b78ca11b8aafca1c4668ba0ea8b15", "src_uid": "02d8d403eb60ae77756ff96f71b662d3", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = map(int, input().split())\narr = []\nfor i in range(1, m + 1):\n    s, d, c = map(int, input().split())\n    arr.append((d, s, c, i))\narr.sort()\nans = [0] * (n + 1) \nfor d, s, c, i in arr:\n    j = s\n    ef = False\n    for k in range(c):\n        while j < d and ans[j] != 0:\n            j += 1\n        if j >= d:\n            ef = True\n            break\n        ans[j] = i\n    if ef:\n        print(-1)\n        break\n    if ans[d] == 0:\n        ans[d] = m + 1\n    else:\n        print(-1)\n        break\nelse:\n    print(*ans[1:])\n", "lang_cluster": "Python", "tags": ["sortings", "implementation", "greedy"], "code_uid": "380b941b25fa46e35410b1a2fc6b921c", "src_uid": "02d8d403eb60ae77756ff96f71b662d3", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from collections import defaultdict\na = defaultdict(int)\nfor c in raw_input(): a[c] += 1\ns = tuple(sorted(a.values()))\nres = {\n\t(6,): 1,\n\t(1, 5): 1,\n\t(2, 4): 2,\n\t(1, 1, 4): 2,\n\t(3, 3): 2,\n\t(1, 2, 3): 3,\n\t(1, 1, 1, 3): 5,\n\t(2, 2, 2): 6,\n\t(1, 1, 2, 2): 8,\n\t(1, 1, 1, 1, 2): 15,\n\t(1, 1, 1, 1, 1, 1): 30,\n}\nprint res[s]\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "4fded159c297b583147b0f4f3736574e", "src_uid": "8176c709c774fa87ca0e45a5a502a409", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from itertools import *\n\nl1=[1,2,3,0,4,5]\nl2=[4,1,5,3,2,0]\nl3=[0,4,2,5,3,1]\n\ndef perm(l,p):\n\treturn ''.join([l[c] for c in p])\n\ndef incr_inst(orig):\n\tcurr=orig\n\ts=set()\n\tr=range(4)\n\tfor i in r:\n\t\tfor j in r:\n\t\t\tfor k in r:\n\t\t\t\ts.add(curr)\n\t\t\t\tcurr = perm(curr,l1)\n\t\t\tcurr = perm(curr,l3)\n\t\tcurr = perm(curr,l2)\n\treturn min(list(s))\n\norig=raw_input()\n\ns=set()\nfor c in permutations(orig):\n\ts.add(incr_inst(''.join(list(c))))\nprint len(s)\n\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "1eed6c995a3fad30b4ecf6e01aec0ebf", "src_uid": "8176c709c774fa87ca0e45a5a502a409", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\nprint n/3 *2 +1 if n%3 else n/3 *2", "lang_cluster": "Python", "tags": ["math"], "code_uid": "e8504278a25da628c4519ec7acfb58ed", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "class CodeforcesTask669ASolution:\n    def __init__(self):\n        self.result = ''\n        self.n = 0\n\n    def read_input(self):\n        self.n = int(input())\n\n    def process_task(self):\n        res = 2 * (self.n // 3) + self.n % 3\n        if self.n % 3 == 2:\n            res -= 1\n        self.result = str(res)\n\n    def get_result(self):\n        return self.result\n\n\nif __name__ == \"__main__\":\n    Solution = CodeforcesTask669ASolution()\n    Solution.read_input()\n    Solution.process_task()\n    print(Solution.get_result())\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "14c6dab81019acb6aec269fcb0994ff9", "src_uid": "a993069e35b35ae158d35d6fe166aaef", "difficulty": 800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a,b=map(int,input().split())\na,b=min(a,b),max(a,b)\nif a==b:print(0)\nelse:\n    M,u=2*a*b,0\n    D=1\n    while D*D<=b-a:\n        if (b-a)%D==0:\n            for d in (D,(b-a)//D):\n                k=0\n                if a%d!=0:\n                    k=d-a%d\n                Q=(a+k)*(b+k)/d\n                if Q<M:\n                    M=Q\n                    u=k         \n        D+=1\n    print(u)\n    ", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "6e508d64a72f5746e605524ce794b264", "src_uid": "414149fadebe25ab6097fc67663177c3", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b = map(int, input().split())\na, b = min(a, b), max(a, b)\nif b % a == 0:\n    print(0)\n    exit(0)\nx = b - a\ndels = set()\nfor i in range(1, int(x ** 0.5) + 1):\n    if x % i == 0:\n        dels.add(i)\n        dels.add(x // i)\ndels = list(dels)\nj = 10 ** 20\nfor i in dels:\n    if i >= a:\n        j = min(j, i - a)\nprint(min((x % a - a) % x, j))\n", "lang_cluster": "Python", "tags": ["brute force", "math", "number theory"], "code_uid": "db4c686783828d5c8f44e6fd0512d7e6", "src_uid": "414149fadebe25ab6097fc67663177c3", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# brute force motherfuckers\nhopScotch = [1]\nfor x in range(1,1000001,3):\n    hopScotch.append(x+1)\n    hopScotch.append([x+2,x+3])\na,x,y = map(int,input().split())\nif y == 0 or abs(x) >= a: print(-1)\nelse:\n    seq = [1,2]\n    jump,rem = y//a,y%a\n    if rem + jump == jump: print(-1)\n    else:\n        if jump == 0:\n            print (1 if abs(x) < a/2 else -1)\n        else:\n            match = seq[(jump+1)%2]\n            if match == 1:\n                print(hopScotch[jump] if abs(x) < a/2 else -1)\n            else:\n                if x == 0: print(-1)\n                else: print(hopScotch[jump][0] if x < 0 else hopScotch[jump][1])\n\n", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "e3a411cb93589c3092e0e74babaccb34", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import setrecursionlimit\nsetrecursionlimit(1000000000)\n\ndef main():\n    a, b, c=[int(i) for i in input().split()]\n    if c%a==0:\n        print(\"-1\")\n        return 0\n    p=c//a\n    if p==0:\n        if (b>-1*a/2) and (b<a/2):\n            print('1')\n            return 0\n    elif p%2==0:\n        if (b > -1*a) and (b<0):\n            print(p//2*3)\n            return 0\n        if (b<a) and (b>0):\n            print(p//2*3+1)\n            return 0\n    else:\n        if (b>-1*a/2) and (b<a/2):\n            print(p//2*3+2)\n            return 0\n    print(\"-1\")\n\nmain()\n\n", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "a461eb35db17ce7b8c0ff0c13b9dc38d", "src_uid": "cf48ff6ba3e77ba5d4afccb8f775fb02", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "s = input()\r\nwords = [\"\",\"\",\"\",\"the\",\"\",\"buffy\",\"slayer\",\"vampire\"]\r\nif len(s)==4:\r\n    print(\"none\")\r\nelse:\r\n    target = words[len(s)]\r\n    ans = \"\"\r\n    for i in range(len(s)):\r\n        a = ord(s[i])-ord('a')\r\n        b = ord(target[i])-ord('a')\r\n        ans += chr((a+b)%26 + ord('a'))\r\n    print(ans)", "lang_cluster": "Python", "tags": ["strings"], "code_uid": "66c5666619dbd153f1db561e37fb8fa3", "src_uid": "56ec50526a3843fe3784d395850f45ae", "difficulty": -1.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "s = input().strip()\r\nwords = [\"\",\"\",\"\",\"the\",\"\",\"buffy\",\"slayer\",\"vampire\"]\r\nif len(s)==4:\r\n    print(\"none\")\r\nelse:\r\n    target = words[len(s)]\r\n    ans = \"\"\r\n    for i in range(len(s)):\r\n        a = ord(s[i])-ord('a')\r\n        b = ord(target[i])-ord('a')\r\n        ans += chr((a+b)%26 + ord('a'))\r\n    print(ans)", "lang_cluster": "Python", "tags": ["strings"], "code_uid": "29018e2761ace00069e9ac2f7317b64a", "src_uid": "56ec50526a3843fe3784d395850f45ae", "difficulty": -1.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a,b,c=[int(x) for x in input().split(' ')]\nmod=1073741824\ndivisors=[1]*1000001\nfor x in range(2,1000001):\n\tfor y in range(x,1000001,x):\n\t\tdivisors[y]+=1\nans=0\nfor i in range(1,a+1):\n\tfor j in range(1,b+1):\n\t\tfor k in range(1,c+1):\n\t\t\tans+=(divisors[i*j*k])%mod\nprint(ans%mod)\n", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "f51df342c5bd1279c1d71c8c282622f0", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def inp():\n    return map(int, stdin.readline().split())\n\n\ndef factorize(n):  # o(sqr(n))\n    c, ans = 1, 0\n    while (c * c < n):\n        if n % c == 0:\n            ans += 2\n        c += 1\n\n    if c * c == n:\n        ans += 1\n    return ans\n\n\nfrom sys import *\nfrom collections import *\n\na, b, c = inp()\nmem, ans = defaultdict(int), 0\n\nfor i in range(1, a + 1):\n    for j in range(1, b + 1):\n        for k in range(1, c + 1):\n            pro = i * j * k\n            if mem[pro] == 0:\n                mem[pro] = factorize(pro)\n            ans += mem[pro]\nprint(ans)", "lang_cluster": "Python", "tags": ["implementation", "number theory"], "code_uid": "8755959ff634976fd0753b10d626921a", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a,b,r=map(int,raw_input().split())\nprint ['First','Second'][2*r > min(a,b)]", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "games"], "code_uid": "7ae5016a3850b1008d81858bb227f8cf", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "[a, b, r] = [int(x) for x in raw_input().split()]\n\nif min(a, b) < 2*r:\n    print 'Second'\nelse:\n    print 'First'\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms", "games"], "code_uid": "7c253884ac8d5dfff88275085356c733", "src_uid": "90b9ef939a13cf29715bc5bce26c9896", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n\ndef solve():\n    n, k = map(int, input().split())\n    a = [int(i) - 1 for i in input().split()]\n\n    kinds = len(set(a))\n\n    if kinds <= k:\n        print(kinds)\n        return\n\n    books = [False] * n\n    have = 0\n    cost = 0\n\n    for i, ai in enumerate(a):\n        if books[ai]:\n            continue\n        else:\n            if have < k:\n                books[ai] = True\n                cost += 1\n                have += 1\n            else:\n                trash = -1\n                longest = -1\n\n                for j in range(n):\n                    if books[j]:\n                        if j not in a[i + 1:]:\n                            trash = j\n                            break\n\n                        m = a[i + 1:].index(j)\n\n                        if longest < m:\n                            longest = m\n                            trash = j\n\n                assert trash != -1\n\n                books[trash] = False\n                books[ai] = True\n                cost += 1\n\n        # print([i for i in range(n) if books[i]])\n\n    print(cost)\n\nif __name__ == '__main__':\n    solve()", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "d55b00fff9e7ec22f5b7f7357032d8f4", "src_uid": "956228e31679caa9952b216e010f9773", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def index(e,l,s):\n    res=[]\n    off=s\n    while True:\n        try:\n            off=l.index(e,off+1)\n        except ValueError:\n            break\n        else:\n            res.append(off)\n    if(len(res)!=0):\n        return res[0]\n    else:\n        return 10**9\n\n\nni=list(map(int,input().strip().split(' ')))\nn=ni[0]\nk=ni[1]\narr=(list(map(int,input().strip().split(' '))))\nli=[]\ncost=0\nif(k>=len(set(arr))):\n    s=set(arr)\n    print(len(s))\nelse:\n    v=1\n    i=1\n    li.append(arr[0])\n    while(v<k and i<n):\n        if(arr[i] not in li):\n            li.append(arr[i])\n            v+=1\n        i+=1\n    cost=k\n    for j in range(i,n):\n        if(arr[j] not in li):\n            mi=0\n            for h in li:\n                ind=index(h,arr,j)\n                if(ind>mi):\n                    mi=ind\n                    val=h\n            li.remove(val)\n            li.append(arr[j])\n            cost+=1\n    print(cost)\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "046716b0851fd5f20acd2b2ed924b4c3", "src_uid": "956228e31679caa9952b216e010f9773", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**7)\n\nn=int(input())\nmod=10**9+7\n\nANS=[[0]*(n+1) for i in range(n+1)]\n\ndef bra(x,y):\n    if ANS[x][y]!=0:\n        return ANS[x][y]\n    \n    if x==y==0:\n        ANS[x][y]=0\n        return 0\n\n    if (x+y)%2==1:\n        A=1\n    else:\n        A=0\n\n    if x==y:\n        ANS[x][y]=A+bra(x-1,y)\n        return ANS[x][y]\n\n    elif x==0:\n        ANS[x][y]=A+bra(x,y-1)\n        return ANS[x][y]\n    \n    elif y==0:\n        ANS[x][y]=A+bra(x-1,y)\n        return ANS[x][y]\n\n    elif x<y and x!=0 and y!=0:\n        ANS[x][y]=A+bra(x-1,y)+bra(x,y-1)\n        return ANS[x][y]\n\nprint(bra(n,n)%mod)\n    \n        \n    \n", "lang_cluster": "Python", "tags": ["greedy", "dp", "trees"], "code_uid": "01d87db52f575a22126a6cd832544fdd", "src_uid": "8218255989e5eab73ac7107072c3b2af", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "N = int(input())\nmod = 10**9+7\ndp = [[0]*(N+1) for _ in range(N+1)]\ndp[1][0] = 1\ndp[1][1] = 1\nfor i in range(2, N+1):\n    if i % 2:\n        dp[i][i] = 1 + i//2\n    else:\n        dp[i][i] = i//2\n    for j in range(i-1, -1, -1):\n        dp[i][j] = (dp[i][j+1] + dp[i-1][j-1] + j%2)%mod\nprint(dp[-1][0])", "lang_cluster": "Python", "tags": ["greedy", "dp", "trees"], "code_uid": "65ec490fb1e7bd9c1bdb235a615b8285", "src_uid": "8218255989e5eab73ac7107072c3b2af", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a,b,x1,y1,x2,y2 = map(int,input().split())\ns = abs((x1 + y1) // (2 * a) - (x2 + y2) // (2 * a))\ns = max(s,abs((x1 - y1) // (2 * b) - (x2 - y2) // (2 * b)))\nprint(s)", "lang_cluster": "Python", "tags": ["math"], "code_uid": "ef7d23574a1565f8db3729d27deb9530", "src_uid": "7219d1837c83b5920992aee5a60dc0d9", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n\nfrom sys import stdin, stderr\n\ndef rot(x, y):\n   return (.5*x - .5*y, .5*x + .5*y)\n\ndef cand(X, Y, A, B):\n   P = []\n   if X % B == 0:\n      if Y % A == 0:\n         P.append( (X-1, Y-1) )\n         P.append( (X-1, Y+1) )\n         P.append( (X+1, Y-1) )\n         P.append( (X+1, Y+1) )\n      else:\n         P.append( (X-1, Y) )\n         P.append( (X+1, Y) )\n   else:\n      if Y % A == 0:\n         P.append( (X, Y-1) )\n         P.append( (X, Y+1) )\n      else:\n         P.append( (X, Y) )\n   return P\n\ndef dist(p1, p2, A, B):\n   print >>stderr, p1, p2\n   x1 = p1[0]/B\n   y1 = p1[1]/A\n   x2 = p2[0]/B\n   y2 = p2[1]/A\n   dx = abs(x1-x2)\n   dy = abs(y1-y2)\n   print >>stderr, 'dx: %d  dy: %d' % (dx, dy)\n   return max(dx, dy)\n\n\na, b, x1, y1, x2, y2 = map(int, stdin.readline().split())\nA = a*2\nB = b*2\n\n(X1, Y1) = rot(x1, y1)\nX1 = int(X1*2)\nY1 = int(Y1*2)\nP1 = cand(X1, Y1, A, B)\n\n(X2, Y2) = rot(x2, y2)\nX2 = int(X2*2)\nY2 = int(Y2*2)\nP2 = cand(X2, Y2, A, B)\n\nres = 1000000000000000000\nfor p1 in P1:\n   for p2 in P2:\n      res = min(res, dist(p1, p2, A, B))\n\nprint res\n\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "74a05424aa02062172c2f3191721d368", "src_uid": "7219d1837c83b5920992aee5a60dc0d9", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "c,H,h,W,w=map(int,raw_input().split())\nif W*W>=c or w*w>=c:\n  if w>W:H,h,W,w=h,H,w,W\n  I=c/W+1\nelse:\n  if H*w>h*W:H,h,W,w=h,H,w,W\n  I=w\nprint max(i*H+(c-i*W)/w*h for i in range(I))\n\n", "lang_cluster": "Python", "tags": ["math", "greedy", "brute force"], "code_uid": "accb9a62ebb42dd26d49e402cd201e8a", "src_uid": "eb052ca12ca293479992680581452399", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "c, hr, hb, wr, wb = map(int, raw_input().split())\nif c<wr:\n    print c/wb*hb\nelif c<wb:\n    print c/wr*hr\nelse:\n    v1 = 1.0*hr/wr\n    v2 = 1.0*hb/wb\n    if v1<v2:\n        wtemp = wr\n        htemp = hr\n        wr = wb\n        hr = hb\n        wb = wtemp\n        hb = htemp\n    joy = 0\n    \n    for i in xrange(wr+1):\n        if c-i*wb<0:\n            break\n        joy = max(joy, i*hb+(c-i*wb)/wr*hr)\n\n    print joy", "lang_cluster": "Python", "tags": ["math", "greedy", "brute force"], "code_uid": "2d6ca75cd83f18b7a643e1f81fa81b9b", "src_uid": "eb052ca12ca293479992680581452399", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\nsys.setrecursionlimit(10000000)\ndef dp(white, black, mem, prin = 1):\n    if black < 0 or white <= 0: \n        if prin == 1: return 0\n        return 1\n    if mem[white][black][prin] != -1: return mem[white][black][prin]\n    if prin == 1:\n        wewinnow = float(white) / (white + black)\n        wewinlater = (1 - wewinnow) * dp(white, black - 1, mem, 0)\n        res = wewinnow + wewinlater\n        mem[white][black][prin] = res\n        return res\n    dragonblanks = float(black) / (white + black)\n    whitejump, blackjump = 0, 0\n    if black > 0: whitejump = dragonblanks * (float(white) / (white + black - 1)) * dp(white - 1, black - 1, mem)\n    if black > 1: blackjump = dragonblanks * (float(black - 1) / (white + black - 1)) *dp(white, black - 2, mem)\n    res = whitejump + blackjump \n    mem[white][black][prin] = res\n    return res\nw, b = map(int, raw_input().split())\nmem = [[[-1] * 2 for _ in xrange(b + 1)] for _ in xrange(w + 1)]\nprint(dp(w, b, mem))", "lang_cluster": "Python", "tags": ["math", "dp", "probabilities", "games"], "code_uid": "0d2b10eb454f5220a6d565992cf2d04f", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "w, b = map(float, raw_input().split())\n\n\ndp = {}\ndef solve(w, b, p, turn):\n    #print w, b, p, turn\n    key = (w, b, turn)\n    if key in dp:\n        return dp[key]\n\n    if w == 0:\n        return 0\n\n    if b == 0:\n        if turn:\n            return p\n        else:\n            return 0\n\n    result = 0\n    if turn:\n        wc =  p * (w / (w+b))\n        bc = solve(w, b-1, p * (b / (w+b)), not turn)\n        result = wc + bc\n    else:\n        if b == 1:\n            result = solve(w-1, b-1, p * (b / (w+b)) * (w / (w+b-1)), not turn)\n        else:\n            result = solve(w-1, b-1, p * (b / (w+b)) * (w / (w+b-1)), not turn) + solve(w, b-2, p * (b / (w+b)) * ((b-1) / (w+b-1)), not turn)\n\n\n    dp[key] = result\n    return result\n\nprint solve(w, b, 1, True)\n\n#for key in dp:\n#    print key, dp[key]", "lang_cluster": "Python", "tags": ["math", "dp", "probabilities", "games"], "code_uid": "6e277a16c211d1342511d3c053d289ec", "src_uid": "7adb8bf6879925955bf187c3d05fde8c", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\r\nc = [0]*n + [1] + [0]*n\r\nfor i in range(n-1, 0, -1):\r\n    c[i] = 2*c[i+1] % m\r\n    for j in range(2, n//i + 1):\r\n        c[i] = (c[i] + c[i*j] - c[(i+1)*j]) % m\r\n \r\nprint((c[1] - c[2]) % m)", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "two pointers", "number theory"], "code_uid": "1d7f8d76848b699d1cd0b1251c83bebb", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\"\"\"RANK1ZEN; 3966 PEAK; NA; FLEX SUPPORT: Zen, Bap; Battlenet ID -> Knuckles#11791\"\"\"\r\n# region ---------------------------------------------------------------------------|\r\n# MNNNNNNNNNNNNNNNNMNho///++//+oooooossssssssssssysssooyyyyyso+//++//shNNNNNNNNNNNNNM\r\n# MNNNNNNNNNNNNNNMNy////////++++oooooooooossssssssoosssssysyyysoossss+/oshNNNNNNNNNNM\r\n# MNNNNNNNNNNNNMNs///////+oooooo++++oooooooooooso+ossssssssssssssssssss++soymMNNNNNNM\r\n# MNNNNNNNNNNNMd/:-//+//shNNmhsoo+++++++++ooooo++oooooooooossssssssssssso+ooosmNNNNNM\r\n# MNNNNNNNNNNMh::://+/+ymMMMMmhsoso+++++++++o+/+ooooooooooooooooooooossso++o+++hMNNNM\r\n# MNNNNNNNNNMy//-:/+/osmMMMMNhssyshNdssoooo++:++++++++++oooooooooooooooooo++-++/sMMNM\r\n# MNNNNNNNNMd:/:///+/ohNMMMNhsohyyNMNNNdhhs+:++++++++++++++++++++ooooooooo/+.o+:/+NNM\r\n# MNNNNNNNMm/:/-///++ooshmmhs+sysdMMMMNdMMd/+++++ooo++++++++++++++++++++++::-++/:/sNM\r\n# MNNNNNNMN/://-+++++++++oo+//yosNMNMNmNMNo/o/oshNmhyoo+++++++++++++++++++/-/+++:/:sM\r\n# MNNNNNMNo://-/+++++:/+++++//++osyhmdhMNs/o/+shMMMMmsooooyo++/+++++++++++://+++://oM\r\n# MNNNNNMs:///:/++++//++-/+/:++++++ooooyo++o-oyNNMMmysooymmso/+shysyyysooo+/++o+/-s+M\r\n# MNNNNMd:///+:/++++-++:`++:/++++//++++++:+-/oyhsmys+oohmyo++:sNMdmMMNNysy+-ohNs+-myM\r\n# MNNNMN::///+-:+++:.+/``++/++++++++++++:+/`+++oo/:/++oyo+oy+odNddMMMMmyyh:-sdMh/odyN\r\n# MNNNNo:///++-:+o/`::```++/+++++++++++//+-.o++:-:/++/+/+ymo/+ossyyhdhssy+.:ohhd/sy+M\r\n# MMNMh-///+++--oo:`/````++-+++++++++++-o/`/+:.:/+++//+hmNo/++++++ooooooo-`/+o++/++-M\r\n# MMMN/:///+++-.o/````-s:+/:++++++++++/++`.:.-/++++/+sdmmo/+++++++++++++: -+++++////M\r\n# MMMh:///++++-`+:```/dN+/::++++++++++++:``.+ooo++ohNMNm++oooooooo+++++o+ :++++/-//oM\r\n# MMd:/-/+++++-`/.``:hmm//./+++++++++o/o..:osoooymmdddmoooooooooooooo+oms.+++++////+M\r\n# MMo// -+++++:`.`` dNddo-.:+++++++++++--/soo:.--::ymh+ssssssssssooo+sNN/++++++++/-dM\r\n# Md/// `/+++o/```` dMddN.-:++++++++++/`/o/+:``-:-`/ooyssssssssssssoodmMo++++++++//NM\r\n# M/:// `-+oooo.``` oMNMM+--/+++++++++/:yd-``.`-+o+hoyyoosyyyyyyys:+o+o++o//+++++/hMM\r\n# m++:/```:oooo/````.dmNNm/-/+++++++//+dhy::ohs:/hysyosyyyyyyyyys:----:-/o/ooo++/-mMM\r\n# s:++//```/oooo-  ``yNmdm:-/++++++////MMNmdhoys+ssssyyyyyysoysss:-.odd/o+/+oo++-+MMM\r\n# s`:++/````:oooo. ```:hNNh-/++++++//:hNNNMMNMdsossyyyyyyss+osdM/o/:yNyoo///ooo/.MMNM\r\n# d `-++/-```:+oo+-`````-+ds/++++++//-mMMMNNhs+syyysysyys+osdMMNyoshdh/+/o:ooo+.+MMNM\r\n# M/` `-/+/-``.:ooo-```````s:++++++++/mNdhsoossssyyhyo/-+hmMMMMNNNNNNo//+.:oo++ oMMNM\r\n# MMo``:..-//-.`-+oo:.`````/+++++++++:ooossyhyyyo+:-:ohNMmMMMMMNmNNNh:/:` :oo/: mMMNM\r\n# MMMh.oMh+``.-:-.-/o+-````mh/+++++++:++++/:--:+syhmMMMMMNMMMMMMMMMo-.//``+oo:`-MMNNM\r\n# MMMMh-omNd+````..`./+/.`hMMs+++++++/dmmmmNMMNNMMMMMMMMMMMMMMMMms:`` :/..+oo: yMNNNM\r\n# MNNNMN/``..``````````.-.+dNy-oooooo/o+s++sNMMNmNMMmmNMMMMMMMmo-   ``-/.-oo+- yMNNNM\r\n# MNNNNMMNdy-``````..``````-+o/+ooooo/++///:`:yMMMMMMMMMMMMds/`/++/````o--o++- MMNNNM\r\n# MMNNMMMMMN:`........-:+oyssoo+ssssss:ooo+/+:`:mMMMMMNho/.````+ooohd+//:+ooo-/MMMMMM\r\n# MMMMMMMMMMs.-...-.-osyyyyysdMhshhhhhossssssdh-.ss+/-.``----.sdhy+mMMMsosssy:sMMMMMM\r\n# endregion ------------------------------------------------------------------------|\r\n# region ---------------------------------------------------------------------------|\r\nfrom sys import stdin, stdout\r\nfrom bisect import bisect_left, bisect_right\r\nfrom math import ceil, floor, log, gcd, sqrt\r\nfrom collections import Counter, deque\r\nfrom heapq import heappush, heappop, heapify\r\ndef re(): return stdin.readline().rstrip()\r\ndef ints(): return map(int, stdin.readline().split())\r\ndef test(tc): \r\n    for _ in range(tc): solve()\r\nmod = 1000000007\r\nnl = \"\\n\"\r\n# endregion\r\n# region ---------------------------------------------------------------------------|\r\nclass Dsu:\r\n    def __init__(self, n):\r\n        self.parent = list(range(n))\r\n        self.rank = [1] * n\r\n\r\n    def find(self, x):\r\n        while x != self.parent[x]:\r\n            self.parent[x] = self.parent[self.parent[x]]\r\n            x = self.parent[x]\r\n        return x\r\n\r\n    def union(self, x, y):\r\n        px, py = self.find(x), self.find(y)\r\n        if px == py: return 0\r\n        if self.rank[py] > self.rank[px]:\r\n            px, py = py, px\r\n        self.parent[py] = px\r\n        self.rank[px] += self.rank[py]\r\n        return 1\r\n\r\n    def get_size(self, x):\r\n        return self.rank[self.find(x)]\r\n\r\nclass SegTree:\r\n    def __init__(self, n, array):\r\n        self.n = n\r\n        self.tree = [0] * (2 * n)\r\n        for i in range(n, 2 * n):\r\n            self.tree[i] = array[i - n]\r\n        for i in range(n - 1, -1, -1):\r\n            self.tree[i] = self.tree[2 * i] + self.tree[2 * i + 1]\r\n    \r\n    def update(self, i, val):\r\n        self.tree[i] = val\r\n        while i:\r\n            self.tree[i] = self.tree[i * 2] + self.tree[i * 2 + 1]\r\n            i //= 2\r\n\r\n    def query(self):\r\n        pass\r\n\r\n    def top(self):\r\n        return self.tree[0]\r\n\r\n\r\n\r\n# endregion ------------------------------------------------------------------------|\r\n\r\ndef solve():\r\n    n, m = ints()\r\n    dp = [0] * (n + 1); dp[n] = 1\r\n    suf = [0] * (n + 2); suf[n] = 1\r\n    for i in range(n - 1, 0, -1):\r\n        dp[i] = suf[i + 1] % m\r\n        for mul in range(2, n + 1):\r\n            lo = i * mul\r\n            hi = (i + 1) * mul - 1\r\n            if lo > n: break\r\n\r\n            dp[i] = (dp[i] + suf[lo] - suf[min(n, hi) + 1]) % m\r\n\r\n        suf[i] = (suf[i + 1] + dp[i]) % m\r\n    \r\n    print(dp[1] % m)\r\n    return\r\n\r\ntest(1)\r\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "two pointers", "number theory"], "code_uid": "f6a1a1a593ecb336587dca0981d6bed9", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nimport collections\n\ninfile = sys.stdin.buffer\ndef gs()  : return infile.readline().rstrip()\ndef gi()  : return int(gs())\ndef gss() : return gs().split()\ndef gis() : return [int(x) for x in gss()]\n\nMOD = 10 ** 9 + 7\nINF = 10 ** 12\nN = 10 ** 5\n\n\n\ndef main(infn=\"\") :\n    global infile\n    infile = open(infn,\"r\") if infn else open(sys.argv[1],\"r\") if len(sys.argv) > 1 else sys.stdin\n    ######################################################################\n    n,m = gis()\n    dp = [0 for _ in range(n+1)]\n    dp[1] = 1\n    h = [0 for _ in range(n+1)]\n    cumul = 0\n    prev = dp[1]\n    h[2]-=1\n    for u in range(1, len(dp)):\n        if u > 1:\n            dp[u] += prev + dp[1]\n            dp[u] %= m\n\n            cumul += h[u]\n            cumul %= m\n            \n            dp[u] += cumul\n            dp[u] %= m\n            \n            prev += dp[u]\n            prev %= m\n        '''u = 7\n        14 + 0, 14 + 1, 14 + 2\n        7        7         8\n        '''\n        j = 2\n        while( j * u < len(dp)):\n            h[j*u] += dp[u]\n            h[j*u] %= m\n            if j*u + j< len(dp):\n                h[j*u + j] -= dp[u]\n                h[j*u + j] %= m\n            j+=1\n    print (dp[-1])\n\n    ######################################################################\nif __name__ == '__main__' :\n    main()", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "two pointers", "number theory"], "code_uid": "ecc8b13e0f9caa7d4bf90349d3513d5e", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "\r\nimport sys\r\ninput = lambda :sys.stdin.readline()[:-1]\r\nni = lambda :int(input())\r\nna = lambda :list(map(int,input().split()))\r\nyes = lambda :print(\"yes\");Yes = lambda :print(\"Yes\");YES = lambda : print(\"YES\")\r\nno = lambda :print(\"no\");No = lambda :print(\"No\");NO = lambda : print(\"NO\")\r\n#######################################################################\r\n\r\nn, m = na()\r\ndp = [1]*(n+1)\r\nres = 1\r\nz = 1\r\nfor i in range(4,n+1,2):\r\n    dp[i] -= 1\r\n\r\nfor i in range(2,n+1):\r\n    s = (res + dp[i])%m\r\n    for j in range(i*2,n+1,i):\r\n        #print(i, j, s)\r\n        dp[j] += s\r\n        dp[j] %= m\r\n    for j in range((i+1)*2,n+1,i+1):\r\n        #print(i, j, -s)\r\n        dp[j] -= s\r\n        dp[j] %= m\r\n    res = s*2%m\r\n\r\nprint(s)\r\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "two pointers", "number theory"], "code_uid": "153d23d1010ac7288bb403de76405df0", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\r\ndef divisors(M):\r\n    d=[]\r\n    i=1\r\n    while M>=i**2:\r\n        if M%i==0:\r\n            d.append(i)\r\n            if i**2!=M:\r\n                d.append(M//i)\r\n        i=i+1\r\n    return d\r\n\r\ndef popcount(x):\r\n    x = x - ((x >> 1) & 0x55555555)\r\n    x = (x & 0x33333333) + ((x >> 2) & 0x33333333)\r\n    x = (x + (x >> 4)) & 0x0f0f0f0f\r\n    x = x + (x >> 8)\r\n    x = x + (x >> 16)\r\n    return x & 0x0000007f\r\n\r\ndef eratosthenes(n):\r\n    res=[0 for i in range(n+1)]\r\n    prime=set([])\r\n    for i in range(2,n+1):\r\n        if not res[i]:\r\n            prime.add(i)\r\n            for j in range(1,n//i+1):\r\n                res[i*j]=1\r\n    return prime\r\n\r\ndef factorization(n):\r\n    res=[]\r\n    for p in prime:\r\n        if n%p==0:\r\n            while n%p==0:\r\n                n//=p\r\n            res.append(p)\r\n    if n!=1:\r\n        res.append(n)\r\n    return res\r\n\r\ndef euler_phi(n):\r\n    res = n\r\n    for x in range(2,n+1):\r\n        if x ** 2 > n:\r\n            break\r\n        if n%x==0:\r\n            res = res//x * (x-1)\r\n            while n%x==0:\r\n                n //= x\r\n    if n!=1:\r\n        res = res//n * (n-1)\r\n    return res\r\n\r\ndef ind(b,n):\r\n    res=0\r\n    while n%b==0:\r\n        res+=1\r\n        n//=b\r\n    return res\r\n\r\ndef isPrimeMR(n):\r\n    d = n - 1\r\n    d = d // (d & -d)\r\n    L = [2, 3, 5, 7, 11, 13, 17]\r\n    for a in L:\r\n        t = d\r\n        y = pow(a, t, n)\r\n        if y == 1: continue\r\n        while y != n - 1:\r\n            y = (y * y) % n\r\n            if y == 1 or t == n - 1: return 0\r\n            t <<= 1\r\n    return 1\r\ndef findFactorRho(n):\r\n    from math import gcd\r\n    m = 1 << n.bit_length() // 8\r\n    for c in range(1, 99):\r\n        f = lambda x: (x * x + c) % n\r\n        y, r, q, g = 2, 1, 1, 1\r\n        while g == 1:\r\n            x = y\r\n            for i in range(r):\r\n                y = f(y)\r\n            k = 0\r\n            while k < r and g == 1:\r\n                ys = y\r\n                for i in range(min(m, r - k)):\r\n                    y = f(y)\r\n                    q = q * abs(x - y) % n\r\n                g = gcd(q, n)\r\n                k += m\r\n            r <<= 1\r\n        if g == n:\r\n            g = 1\r\n            while g == 1:\r\n                ys = f(ys)\r\n                g = gcd(abs(x - ys), n)\r\n        if g < n:\r\n            if isPrimeMR(g): return g\r\n            elif isPrimeMR(n // g): return n // g\r\n            return findFactorRho(g)\r\ndef primeFactor(n):\r\n    i = 2\r\n    ret = {}\r\n    rhoFlg = 0\r\n    while i*i <= n:\r\n        k = 0\r\n        while n % i == 0:\r\n            n //= i\r\n            k += 1\r\n        if k: ret[i] = k\r\n        i += 1 + i % 2\r\n        if i == 101 and n >= 2 ** 20:\r\n            while n > 1:\r\n                if isPrimeMR(n):\r\n                    ret[n], n = 1, 1\r\n                else:\r\n                    rhoFlg = 1\r\n                    j = findFactorRho(n)\r\n                    k = 0\r\n                    while n % j == 0:\r\n                        n //= j\r\n                        k += 1\r\n                    ret[j] = k\r\n\r\n    if n > 1: ret[n] = 1\r\n    if rhoFlg: ret = {x: ret[x] for x in sorted(ret)}\r\n    return ret\r\n\r\ndef divisors(n):\r\n    res = [1]\r\n    prime = primeFactor(n)\r\n    for p in prime:\r\n        newres = []\r\n        for d in res:\r\n            for j in range(prime[p]+1):\r\n                newres.append(d*p**j)\r\n        res = newres\r\n    res.sort()\r\n    return res\r\n\r\ndef xorfactorial(num):\r\n    if num==0:\r\n        return 0\r\n    elif num==1:\r\n        return 1\r\n    elif num==2:\r\n        return 3\r\n    elif num==3:\r\n        return 0\r\n    else:\r\n        x=baseorder(num)\r\n        return (2**x)*((num-2**x+1)%2)+function(num-2**x)\r\n\r\ndef xorconv(n,X,Y):\r\n    if n==0:\r\n        res=[(X[0]*Y[0])%mod]\r\n        return res\r\n    x=[X[i]+X[i+2**(n-1)] for i in range(2**(n-1))]\r\n    y=[Y[i]+Y[i+2**(n-1)] for i in range(2**(n-1))]\r\n    z=[X[i]-X[i+2**(n-1)] for i in range(2**(n-1))]\r\n    w=[Y[i]-Y[i+2**(n-1)] for i in range(2**(n-1))]\r\n    res1=xorconv(n-1,x,y)\r\n    res2=xorconv(n-1,z,w)\r\n    former=[(res1[i]+res2[i])*inv for i in range(2**(n-1))]\r\n    latter=[(res1[i]-res2[i])*inv for i in range(2**(n-1))]\r\n    former=list(map(lambda x:x%mod,former))\r\n    latter=list(map(lambda x:x%mod,latter))\r\n    return former+latter\r\n\r\ndef merge_sort(A,B):\r\n    pos_A,pos_B = 0,0\r\n    n,m = len(A),len(B)\r\n    res = []\r\n    while pos_A < n and pos_B < m:\r\n        a,b = A[pos_A],B[pos_B]\r\n        if a < b:\r\n            res.append(a)\r\n            pos_A += 1\r\n        else:\r\n            res.append(b)\r\n            pos_B += 1\r\n    res += A[pos_A:]\r\n    res += B[pos_B:]\r\n    return res\r\n\r\nclass UnionFindVerSize():\r\n    def __init__(self, N):\r\n        self._parent = [n for n in range(0, N)]\r\n        self._size = [1] * N\r\n        self.group = N\r\n\r\n    def find_root(self, x):\r\n        if self._parent[x] == x: return x\r\n        self._parent[x] = self.find_root(self._parent[x])\r\n        stack = [x]\r\n        while self._parent[stack[-1]]!=stack[-1]:\r\n            stack.append(self._parent[stack[-1]])\r\n        for v in stack:\r\n            self._parent[v] = stack[-1]\r\n        return self._parent[x]\r\n\r\n    def unite(self, x, y):\r\n        gx = self.find_root(x)\r\n        gy = self.find_root(y)\r\n        if gx == gy: return\r\n\r\n        self.group -= 1\r\n\r\n        if self._size[gx] < self._size[gy]:\r\n            self._parent[gx] = gy\r\n            self._size[gy] += self._size[gx]\r\n        else:\r\n            self._parent[gy] = gx\r\n            self._size[gx] += self._size[gy]\r\n\r\n    def get_size(self, x):\r\n        return self._size[self.find_root(x)]\r\n\r\n    def is_same_group(self, x, y):\r\n        return self.find_root(x) == self.find_root(y)\r\n\r\nclass WeightedUnionFind():\r\n    def __init__(self,N):\r\n        self.parent = [i for i in range(N)]\r\n        self.size = [1 for i in range(N)]\r\n        self.val = [0 for i in range(N)]\r\n        self.flag = True\r\n        self.edge = [[] for i in range(N)]\r\n\r\n    def dfs(self,v,pv):\r\n        stack = [(v,pv)]\r\n        new_parent = self.parent[pv]\r\n        while stack:\r\n            v,pv = stack.pop()\r\n            self.parent[v] = new_parent\r\n            for nv,w in self.edge[v]:\r\n                if nv!=pv:\r\n                    self.val[nv] = self.val[v] + w\r\n                    stack.append((nv,v))\r\n\r\n    def unite(self,x,y,w):\r\n        if not self.flag:\r\n            return\r\n        if self.parent[x]==self.parent[y]:\r\n            self.flag = (self.val[x] - self.val[y] == w)\r\n            return\r\n\r\n        if self.size[self.parent[x]]>self.size[self.parent[y]]:\r\n            self.edge[x].append((y,-w))\r\n            self.edge[y].append((x,w))\r\n            self.size[x] += self.size[y]\r\n            self.val[y] = self.val[x] - w\r\n            self.dfs(y,x)\r\n        else:\r\n            self.edge[x].append((y,-w))\r\n            self.edge[y].append((x,w))\r\n            self.size[y] += self.size[x]\r\n            self.val[x] = self.val[y] + w\r\n            self.dfs(x,y)\r\n\r\nclass Dijkstra():\r\n    class Edge():\r\n        def __init__(self, _to, _cost):\r\n            self.to = _to\r\n            self.cost = _cost\r\n\r\n    def __init__(self, V):\r\n        self.G = [[] for i in range(V)]\r\n        self._E = 0\r\n        self._V = V\r\n\r\n    @property\r\n    def E(self):\r\n        return self._E\r\n\r\n    @property\r\n    def V(self):\r\n        return self._V\r\n\r\n    def add_edge(self, _from, _to, _cost):\r\n        self.G[_from].append(self.Edge(_to, _cost))\r\n        self._E += 1\r\n\r\n    def shortest_path(self, s):\r\n        import heapq\r\n        que = []\r\n        d = [10**15] * self.V\r\n        d[s] = 0\r\n        heapq.heappush(que, (0, s))\r\n\r\n        while len(que) != 0:\r\n            cost, v = heapq.heappop(que)\r\n            if d[v] < cost: continue\r\n\r\n            for i in range(len(self.G[v])):\r\n                e = self.G[v][i]\r\n                if d[e.to] > d[v] + e.cost:\r\n                    d[e.to] = d[v] + e.cost\r\n                    heapq.heappush(que, (d[e.to], e.to))\r\n        return d\r\n\r\n#Z[i]:length of the longest list starting from S[i] which is also a prefix of S\r\n#O(|S|)\r\ndef Z_algorithm(s):\r\n    N = len(s)\r\n    Z_alg = [0]*N\r\n\r\n    Z_alg[0] = N\r\n    i = 1\r\n    j = 0\r\n    while i < N:\r\n        while i+j < N and s[j] == s[i+j]:\r\n            j += 1\r\n        Z_alg[i] = j\r\n        if j == 0:\r\n            i += 1\r\n            continue\r\n        k = 1\r\n        while i+k < N and k + Z_alg[k]<j:\r\n            Z_alg[i+k] = Z_alg[k]\r\n            k += 1\r\n        i += k\r\n        j -= k\r\n    return Z_alg\r\n\r\nclass BIT():\r\n    def __init__(self,n,mod=0):\r\n        self.BIT = [0]*(n+1)\r\n        self.num = n\r\n        self.mod = mod\r\n\r\n    def query(self,idx):\r\n        res_sum = 0\r\n        mod = self.mod\r\n        while idx > 0:\r\n            res_sum += self.BIT[idx]\r\n            if mod:\r\n                res_sum %= mod\r\n            idx -= idx&(-idx)\r\n        return res_sum\r\n\r\n    #Ai += x O(logN)\r\n    def update(self,idx,x):\r\n        mod = self.mod\r\n        while idx <= self.num:\r\n            self.BIT[idx] += x\r\n            if mod:\r\n                self.BIT[idx] %= mod\r\n            idx += idx&(-idx)\r\n        return\r\n\r\nclass dancinglink():\r\n    def __init__(self,n,debug=False):\r\n        self.n = n\r\n        self.debug = debug\r\n        self._left = [i-1 for i in range(n)]\r\n        self._right = [i+1 for i in range(n)]\r\n        self.exist = [True for i in range(n)]\r\n\r\n    def pop(self,k):\r\n        if self.debug:\r\n            assert self.exist[k]\r\n        L = self._left[k]\r\n        R = self._right[k]\r\n        if L!=-1:\r\n            if R!=self.n:\r\n                self._right[L],self._left[R] = R,L\r\n            else:\r\n                self._right[L] = self.n\r\n        elif R!=self.n:\r\n            self._left[R] = -1\r\n        self.exist[k] = False\r\n\r\n    def left(self,idx,k=1):\r\n        if self.debug:\r\n            assert self.exist[idx]\r\n        res = idx\r\n        while k:\r\n            res = self._left[res]\r\n            if res==-1:\r\n                break\r\n            k -= 1\r\n        return res\r\n\r\n    def right(self,idx,k=1):\r\n        if self.debug:\r\n            assert self.exist[idx]\r\n        res = idx\r\n        while k:\r\n            res = self._right[res]\r\n            if res==self.n:\r\n                break\r\n            k -= 1\r\n        return res\r\n\r\nclass SparseTable():\r\n    def __init__(self,A,merge_func,ide_ele):\r\n        N=len(A)\r\n        n=N.bit_length()\r\n        self.table=[[ide_ele for i in range(n)] for i in range(N)]\r\n        self.merge_func=merge_func\r\n\r\n        for i in range(N):\r\n            self.table[i][0]=A[i]\r\n\r\n        for j in range(1,n):\r\n            for i in range(0,N-2**j+1):\r\n                f=self.table[i][j-1]\r\n                s=self.table[i+2**(j-1)][j-1]\r\n                self.table[i][j]=self.merge_func(f,s)\r\n\r\n    def query(self,s,t):\r\n        b=t-s+1\r\n        m=b.bit_length()-1\r\n        return self.merge_func(self.table[s][m],self.table[t-2**m+1][m])\r\n\r\nclass BinaryTrie:\r\n    class node:\r\n        def __init__(self,val):\r\n            self.left = None\r\n            self.right = None\r\n            self.max = val\r\n\r\n    def __init__(self):\r\n        self.root = self.node(-10**15)\r\n\r\n    def append(self,key,val):\r\n        pos = self.root\r\n        for i in range(29,-1,-1):\r\n            pos.max = max(pos.max,val)\r\n            if key>>i & 1:\r\n                if pos.right is None:\r\n                    pos.right = self.node(val)\r\n                    pos = pos.right\r\n                else:\r\n                    pos = pos.right\r\n            else:\r\n                if pos.left is None:\r\n                    pos.left = self.node(val)\r\n                    pos = pos.left\r\n                else:\r\n                    pos = pos.left\r\n        pos.max = max(pos.max,val)\r\n\r\n    def search(self,M,xor):\r\n        res = -10**15\r\n        pos = self.root\r\n        for i in range(29,-1,-1):\r\n            if pos is None:\r\n                break\r\n\r\n            if M>>i & 1:\r\n                if xor>>i & 1:\r\n                    if pos.right:\r\n                        res = max(res,pos.right.max)\r\n                    pos = pos.left\r\n                else:\r\n                    if pos.left:\r\n                        res = max(res,pos.left.max)\r\n                    pos = pos.right\r\n            else:\r\n                if xor>>i & 1:\r\n                    pos = pos.right\r\n                else:\r\n                    pos = pos.left\r\n\r\n        if pos:\r\n            res = max(res,pos.max)\r\n        return res\r\n\r\ndef solveequation(edge,ans,n,m):\r\n    #edge=[[to,dire,id]...]\r\n    x=[0]*m\r\n    used=[False]*n\r\n    for v in range(n):\r\n        if used[v]:\r\n            continue\r\n        y = dfs(v)\r\n        if y!=0:\r\n            return False\r\n    return x\r\n\r\n    def dfs(v):\r\n        used[v]=True\r\n        r=ans[v]\r\n        for to,dire,id in edge[v]:\r\n            if used[to]:\r\n                continue\r\n            y=dfs(to)\r\n            if dire==-1:\r\n                x[id]=y\r\n            else:\r\n                x[id]=-y\r\n            r+=y\r\n        return r\r\n\r\nclass SegmentTree:\r\n    def __init__(self, init_val, segfunc, ide_ele):\r\n        n = len(init_val)\r\n        self.segfunc = segfunc\r\n        self.ide_ele = ide_ele\r\n        self.num = 1 << (n - 1).bit_length()\r\n        self.tree = [ide_ele] * 2 * self.num\r\n        self.size = n\r\n        for i in range(n):\r\n            self.tree[self.num + i] = init_val[i]\r\n        for i in range(self.num - 1, 0, -1):\r\n            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])\r\n\r\n    def update(self, k, x):\r\n        k += self.num\r\n        self.tree[k] = x\r\n        while k > 1:\r\n            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])\r\n            k >>= 1\r\n\r\n    def query(self, l, r):\r\n        if r==self.size:\r\n            r = self.num\r\n\r\n        res = self.ide_ele\r\n\r\n        l += self.num\r\n        r += self.num\r\n        while l < r:\r\n            if l & 1:\r\n                res = self.segfunc(res, self.tree[l])\r\n                l += 1\r\n            if r & 1:\r\n                res = self.segfunc(res, self.tree[r - 1])\r\n            l >>= 1\r\n            r >>= 1\r\n        return res\r\n\r\n    def bisect_l(self,l,r,x):\r\n        l += self.num\r\n        r += self.num\r\n        Lmin = -1\r\n        Rmin = -1\r\n        while l<r:\r\n            if l & 1:\r\n                if self.tree[l] <= x and Lmin==-1:\r\n                    Lmin = l\r\n                l += 1\r\n            if r & 1:\r\n                if self.tree[r-1] <=x:\r\n                    Rmin = r-1\r\n            l >>= 1\r\n            r >>= 1\r\n\r\n        if Lmin != -1:\r\n            pos = Lmin\r\n            while pos<self.num:\r\n                if self.tree[2 * pos] <=x:\r\n                    pos = 2 * pos\r\n                else:\r\n                    pos = 2 * pos +1\r\n            return pos-self.num\r\n        elif Rmin != -1:\r\n            pos = Rmin\r\n            while pos<self.num:\r\n                if self.tree[2 * pos] <=x:\r\n                    pos = 2 * pos\r\n                else:\r\n                    pos = 2 * pos +1\r\n            return pos-self.num\r\n        else:\r\n            return -1\r\n\r\nimport sys,random,bisect\r\nfrom collections import deque,defaultdict\r\nfrom heapq import heapify,heappop,heappush\r\nfrom itertools import permutations\r\nfrom math import gcd,log\r\n\r\ninput = lambda :sys.stdin.readline().rstrip()\r\nmi = lambda :map(int,input().split())\r\nli = lambda :list(mi())\r\n\r\nn,mod = mi()\r\n\r\nM = int(n**.5) + 10\r\n\r\ndp = [0 for i in range(n+1)]\r\nimos = [0 for i in range(n+1)]\r\ndp[1] = 1\r\nfor i in range(1,n):\r\n    imos[i] = (imos[i] + imos[i-1]) % mod\r\n    dp[i] += imos[i]\r\n    dp[i] %= mod\r\n\r\n    imos[i+1] += dp[i]\r\n    imos[i+1] %= mod\r\n\r\n    for j in range(2,n+1):\r\n        if i*j > n:\r\n            break\r\n\r\n        imos[i*j] += dp[i]\r\n        imos[i*j] %= mod\r\n        if (i+1)*j <= n:\r\n            imos[(i+1)*j] -= dp[i]\r\n            imos[(i+1)*j] %= mod\r\n    \r\n    #print(dp)\r\n    #print(imos)\r\n\r\n    #debug = [dp[j] for j in range(n+1)]\r\n    #S = imos[0]\r\n    #for j in range(1,n+1):\r\n        #S = (S + imos[j]) % mod\r\n        #if i<j:\r\n            #debug[j] += S\r\n            #debug[j] %= mod\r\n    \r\n    #2~3\r\n    #3~5\r\n    #4~7\r\n    #5~\r\n    #print(debug)\r\n    #print()\r\n\r\n\r\nres = dp[n] + imos[n] + imos[n-1]\r\nres %= mod\r\nprint(res)\r\n\r\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "two pointers", "number theory"], "code_uid": "15ac40dcb2c54435dc9dc9dc81bbbdee", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def solve():\r\n    n, MOD = list(map(int, input().split()))\r\n    dp = [0]*(n+2)\r\n    dp[1] = 1\r\n    dp[2] = -1\r\n    m = 0\r\n    for a in range(1, n+1):\r\n        dp[a] = (dp[a]+2*m%MOD)%MOD\r\n        dp[a+1] = (dp[a+1]-2*m%MOD)%MOD\r\n        m = (m+dp[a])%MOD\r\n        k = 2\r\n        while k*a <= n:\r\n            dp[k*a] = (dp[k*a]+dp[a])%MOD\r\n            c = min(k*a+k, n+1)\r\n            dp[c] = (dp[c]-dp[a])%MOD\r\n            k += 1\r\n    return dp[n]\r\n\r\n\r\nimport sys\r\ninput = lambda: sys.stdin.readline().rstrip()\r\nprint(solve())", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "two pointers", "number theory"], "code_uid": "aacc27e06333b54e3160587148801ca8", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Tue Aug 30 11:07:14 2022\r\n\r\n@author: hp\r\n\"\"\"\r\n\r\nn,m = map(int,input().split())\r\nsumL = [0]*(n+2)\r\nL = 1\r\nsumL[-2] = 1\r\nfor i in range(n-1,0,-1):\r\n    L = sumL[i+1]\r\n    j = 2\r\n    while i*j<=n:\r\n        L+=(sumL[i*j]-sumL[min(n,(i+1)*j-1)+1])\r\n        L%=m\r\n        j+=1\r\n    L %= m\r\n    sumL[i] = (sumL[i+1]+L)\r\n    sumL[i]%=m\r\nprint(L)\r\n\r\n\r\n\r\n\r\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "two pointers", "number theory"], "code_uid": "515515a362b907406469c0d19fed07bb", "src_uid": "77443424be253352aaf2b6c89bdd4671", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def is_prime( n ):\n\n    i = 2\n\n    while i * i <= n:\n\n        if n % i == 0:\n            return ( False )\n\n        i += 1\n\n    return ( True )\n\nm = {}\n\np = []\n\ni = 2\n\nwhile len(p) < 12:\n\n    if is_prime(i):\n        p.append(i)\n\n    i += 1\n\nINF = 10**18\n\nm = {}\n\nans = INF\n\ndef f( a, b, div ):\n\n    global ans\n\n    if b >= len(p):\n        return\n\n    if div == n:\n        ans = min( ans, a )\n        return\n\n    for j in range( 1, 60 ):\n        if a <= ans//p[b]:\n            a *= p[b]\n            f( a, b+1, div*(j+1) )\n        else:\n            break\n\nn = int( input() )\n\n#for i in range( len(p) ):\n#    f( p[i], i )\nf( 1, 0, 1 )\n\nprint( ans )\n", "lang_cluster": "Python", "tags": ["brute force", "dp", "number theory"], "code_uid": "9e313e6587bfd8b6b9a60cdce9220aa9", "src_uid": "62db589bad3b7023418107de05b7a8ee", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]\ndp = [[10**18 for i in range(15)] for j in range(1006)]\ninf = 10**18\nfor pw in range(64):\n\tdp[pw + 1][0] = 2**pw\nfor idx in range(1,13):\n\tfor i in range(1005):\n\t\tfor pw in range(64):\n\t\t\tif(i % (pw + 1)==0):\n\t\t\t\tif(dp[i // (pw + 1)][idx-1] > inf // (prime[idx]**pw)):break\n\t\t\t\tdp[i][idx] = min(dp[i][idx],dp[i // (pw + 1)][idx-1] *(prime[idx]**pw))\nprint(dp[int(input())][12])", "lang_cluster": "Python", "tags": ["brute force", "dp", "number theory"], "code_uid": "84861d5e06e3a989356756414e0a1315", "src_uid": "62db589bad3b7023418107de05b7a8ee", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/python\n\nn = int (raw_input())\nmod = 1000000007\nans = 1\ndiv = 1\nfor i in range(1, n):\n\tans = (n + i) * ans % mod \n\tdiv = i * div % mod\nans = ans * 2 % mod * pow(div, mod - 2, mod) % mod - n\nans %= mod\nprint ans\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "6b9258da7a425636198a3572e365ec4d", "src_uid": "13a9ffe5acaa79d97df88a069fc520b9", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\nm = 1000000007\nres = 1\nfor i in range(1, n):\n    res = (res * (n+i) * pow(i, m-2, m)) % m;\nprint (2*res-n)%m\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "4416253476cd4b021df31e86da0a47b1", "src_uid": "13a9ffe5acaa79d97df88a069fc520b9", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#!/usr/bin/env python3\nimport sys\nsys.setrecursionlimit(10**6)\ninput = sys.stdin.readline\nfrom math import factorial\n\nn, m = [int(item) for item in input().split()]\nfac = [0] * (n + 1)\nfac[0] = 1; fac[1] = 1\nfor i in range(2, n+1):\n    fac[i] = fac[i-1] * i % m\nans = 0\nfor i in range(1, n+1):\n    val = fac[n - i + 1] * (n - i + 1) * fac[i]\n    ans += val\n    ans %= m\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "1bb9076b5df0d9f63b7b0264f0e273a8", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\n\nn, m = list(map(int, sys.stdin.readline().strip().split()))\nans = 0\nF = [1] * (n + 1)\nfor i in range (0, n):\n    F[i + 1] = F[i] * (i + 1) % m\n\nfor i in range (0, n):\n    ans = (ans + (n - i) * (n - i) * F[n - i - 1] * F[i+1]) % m\n\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "6dadeee57cf88057758f6a6995632a14", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, s, k = list(map(int, input().split()))\namounts = list(map(int, input().split()))\ncolors = list(input())\n\ndp = [[-1 for j in range(k + 1)] for i in range(n)]\n\ndef getAns(nth, left):\n    if left <= 0:\n        return 0\n    if dp[nth][left] >= 0:\n        return dp[nth][left]\n    \n    ret = 999999999\n    for i in range(n):\n        if amounts[i] <= amounts[nth] or colors[i] == colors[nth]:\n            continue\n        ret = min(ret, abs(nth - i) + getAns(i, left - amounts[i]))\n    \n    dp[nth][left] = ret\n    return ret\n\nans = 999999999\nfor i in range(n):\n    ans = min(ans, getAns(i, k - amounts[i]) + abs(s - 1 - i))\nif ans == 999999999:\n\tans = -1\nprint(ans)\n        \n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "3976fb5d009011c7ffb605e11be46b2c", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n\ndef minp():\n\treturn sys.stdin.readline().strip()\n\ndp = [None]*50\nfor j in range(50):\n\tdp[j] = [None]*2001\n\nn,s,k = map(int,minp().split())\na = [None]*n\ni = 0\ns -= 1\nfor j in map(int,minp().split()):\n\ta[i] = (j, i)\n\ti += 1\ni = 0\nfor j in minp():\n\ta[i] += (\"RGB\".find(j),)\n\ti += 1\na.sort()\nr = 10**18\nzzz = 0\nfor i in range(n):\n\tii = dp[i]\n\tc = a[i][0]\n\tii[c] = abs(s-a[i][1])\n\t#print(ii[c])\n\tfor j in range(i):\n\t\tif a[j][2] == a[i][2] or a[j][0] == a[i][0]:\n\t\t\tcontinue\n\t\tjj = dp[j]\n\t\tfor z in range(2001-c):\n\t\t\tzz = jj[z]\n\t\t\tif zz != None:\n\t\t\t\td = zz + abs(a[i][1]-a[j][1])\n\t\t\t\tcc = z+c\n\t\t\t\tif ii[cc] != None:\n\t\t\t\t\tif ii[cc] > d:\n\t\t\t\t\t\tii[cc] = d\n\t\t\t\telse:\n\t\t\t\t\tii[cc] = d\n\tfor z in range(k,2001):\n\t\tif ii[z] != None:\n\t\t\tr = min(r,ii[z])\n\t#print(ii[:k+1])\nif r != 10**18:\n\tprint(r)\nelse:\n\tprint(-1)\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "be6aaad6e636015260df5b99c668d7e8", "src_uid": "a95e54a7e38cc0d61b39e4a01a6f8d3f", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "r,h=map(float,raw_input().split())\nif h < r/2:\n    print 1\n    exit()\nh-=r/2\nR=2\nc=int(h/r)\n\nR+=2*c\n\nh-=c*r\nif ((r/2 + h)**2 + (r/2)**2)**0.5 >= r:\n    R +=1\nprint R", "lang_cluster": "Python", "tags": ["geometry"], "code_uid": "2e145daeb73d1d666c149abb993069e8", "src_uid": "ae883bf16842c181ea4bd123dee12ef9", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import sqrt\nr, h = map(int, input().split())\nnum = h//r\nrem = h % r\nans = num*2\nif rem*2 < r:\n    ans += 1\nelif rem*2 >= sqrt(3) * r:\n    ans += 3\nelse:\n    ans += 2\nprint(ans)\n", "lang_cluster": "Python", "tags": ["geometry"], "code_uid": "9314daebaa2200eaeca0bc731ce60ae5", "src_uid": "ae883bf16842c181ea4bd123dee12ef9", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "dp = {}\r\n \r\ndef solve(x):\r\n\tif x == 0:\r\n\t\treturn 0\r\n\tif x in dp.keys():\r\n\t\treturn dp[x]\r\n\tlimit = 1\r\n\tcnt = 1\r\n\twhile limit <= x:\r\n\t\tlimit = limit * 10 + 1\r\n\t\tcnt += 1\r\n\tprv = limit // 10\r\n\tc1 = solve(x % prv) + (x // prv) * (cnt - 1)\r\n\tc2 = solve((limit-x) % prv) + cnt + (cnt - 1) * ((limit - x) // prv)\r\n\tdp[x] = min(c1,c2)\r\n\treturn min(c1,c2)\r\n \r\nn = int(input())\r\nprint(solve(n))", "lang_cluster": "Python", "tags": ["greedy", "dp", "shortest paths"], "code_uid": "0dcc4dcdd5a6ea97cc5bd203fa8617bc", "src_uid": "1961e7c9120ff652b15cad5dd5ca0907", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "DIGITS = 55\r\nMAX_CNT = 6\r\nNUMBERS = [0] * (DIGITS + 1)\r\nCUTOFFS = [0] * (DIGITS + 1)\r\n\r\nfor d in range(1, DIGITS + 1):\r\n    NUMBERS[d] = 10 * NUMBERS[d - 1] + 1\r\n    CUTOFFS[d] = 10**(d - 1) * 50 // 81 + 15\r\n\r\nINF = 10**9\r\nsave = [{} for d in range(DIGITS)]\r\n\r\ndef recurse(value, d):\r\n    if d == 0:\r\n        return 0 if value == 0 else INF\r\n\r\n    if value in save[d]:\r\n        return save[d][value]\r\n\r\n    ans = INF\r\n\r\n    for cnt in range(0, MAX_CNT + 1):\r\n        nvalue = abs(value - cnt * NUMBERS[d])\r\n\r\n        if nvalue <= CUTOFFS[d]:\r\n            ans = min(ans, cnt * d + recurse(nvalue, d - 1))\r\n\r\n    save[d][value] = ans\r\n    return ans\r\n\r\nX = int(input())\r\nprint(recurse(X, len(str(X)) + 1))\r\n", "lang_cluster": "Python", "tags": ["greedy", "dp", "shortest paths"], "code_uid": "8852c3cbad599bdc8ef7dd2b34a30ad6", "src_uid": "1961e7c9120ff652b15cad5dd5ca0907", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "mod = int(1e9+7)\n\ndef fast_power(base, exp):\n    res = 1\n    while exp > 0:\n        if exp % 2 == 1:\n            res = (res * base) % mod\n        base = (base * base) % mod\n        exp //= 2\n    return res \n\nn = int(input())\nres = fast_power(2, 2*n-1) + fast_power(2, n-1)\nprint(1 if n == 0 else res % mod)\n", "lang_cluster": "Python", "tags": ["math", "matrices", "dp", "number theory"], "code_uid": "15df3e5c7ca521a7d453ad7897196a37", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\nn=int(raw_input())\nmod=1000000007\nprint n%(mod-1)==0 and 1 or (pow(2,n-1,mod)+pow(2,2*n-1,mod))%mod\n\n", "lang_cluster": "Python", "tags": ["math", "matrices", "dp", "number theory"], "code_uid": "b879ad6f94cd4c402c994f43e72a4488", "src_uid": "782b819eb0bfc86d6f96f15ac09d5085", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\nimport sys, math, random, operator\n\nMOD = 10**9 + 7\nINF = 10**9\n\npr = lambda *args: sys.stdout.write(\" \".join(str(x) for x in args) + \"\\n\")\nepr = lambda *args: sys.stderr.write(\" \".join(str(x) for x in args) + \"\\n\")\ndie = lambda *args: pr(*args) ^ exit(0)\n\nread_str = raw_input\nread_int = lambda: int(raw_input())\n\n\"---------------------------------------------------------------\"\n\nn = read_int()\ns = read_str()\n\nnum = []\nfor i in xrange(len(s)):\n    num.append([None])\n    for j in xrange(i + 1, len(s)+1):\n        num[i].append( int(s[i:j], 2) )\n\nneeded_for_m = [None]\ncur = 0\nfor x in xrange(1, 1000):\n    cur += len(str(bin(x)[2:]))\n    needed_for_m.append(cur)\n\nbins = [bin(x)[2:] for x in xrange(0, 1000)]\n\ncache = {}\ndef solve(state, used, maxm, pos):\n    key = state, pos\n    if key not in cache:\n        res = 0\n\n        # already good?\n        # print \"(%s)\" % bin(state)[2:-1], maxm\n        if state == (1 << (maxm + 1)) - 1:\n            # print \"good\"\n            res += 1\n\n        # continue cuts\n        for add in xrange(1, 100):\n            if pos + add > len(s):\n                break\n            val = num[pos][add]\n            if val == 0:\n                continue\n            if val >= 100:\n                break\n\n            used2 = used\n            if state & (1 << val) == 0:\n                used2 += len(bins[val] if val <= 100 else bin(val)[2:])\n            maxm2 = max(maxm, val)\n            pos2 = pos + add\n            # print \"pos\", pos, \"+\", add\n            needed = needed_for_m[maxm2] if maxm2 <= 100 else INF\n            if needed - used2 <= len(s) - pos2:\n                res += solve(state | (1 << val), used2, maxm2, pos2)\n        cache[key] = res\n    return cache[key]\n\nans = 0\nfor i in xrange(len(s)):\n    cur = solve(1, 0, 1, i)\n    ans += cur\n    ans %= MOD\n    epr(i, cur, ans)\nprint ans\n", "lang_cluster": "Python", "tags": ["dp", "bitmasks"], "code_uid": "74a76b90f49c4750b6bb66d0b2ab125e", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "rr=raw_input\nrrI = lambda: int(rr())\nrrM = lambda: map(int,rr().split())\ndebug=0\nif debug:\n    fi = open('t.txt','r')\n    rr=lambda: fi.readline().replace('\\n','')\n\ndef good_mask(x):\n    if x == 0: return False\n    return (x+1) & x == 0\n\nN = rrI()\nS = rr()\n#N = 75\n#from time import time\n#S  = '100000111111101000100001011100010111110011111011100011001111101111100011110'\n#tt = time()\n#print tt\n\nlenbin = [ len(bin(n)) - 2 for n in xrange(32) ]\n\ndef solve():\n    MOD = 10**9 + 7\n    number = [ [0]*(N+1) for _ in xrange(N) ]\n    for i in xrange(N):\n        for j in xrange(i+1, N+1):\n            number[i][j] = min(22, int(S[i:j],2))\n    #UPPER = 22\n    UPPER = 22\n    memo = [ {} for _ in xrange(N+1)]\n    def dp(i, mask, sum_to_make = 0, cur_max = 0):\n        #Having made a cut already before position i,\n        #and having a set of mask taken\n        #how many ways?\n        if i == N:\n            return 1 if sum_to_make == 0 != mask else 0\n        if mask in memo[i]: return memo[i][mask]\n        ans = 1 if sum_to_make == 0 != mask else 0 #good_mask(mask) else 0\n        for j in xrange(i+1, N+1):\n            num = number[i][j]\n            if num == 0: continue\n            if num >= UPPER: break\n            if sum_to_make > N-j+5: break\n            if (mask >> (num-1))&1:\n                ans += dp(j, mask, sum_to_make, cur_max)\n            elif num <= cur_max:\n                ans += dp(j, mask|(1<<(num-1)), sum_to_make - lenbin[num], cur_max)\n            else:\n                ans += dp(j, mask|(1<<(num-1)), sum_to_make + sum(lenbin[x] for x in xrange(cur_max + 1, num)), num)\n                    \n            if ans >= MOD:\n                ans %= MOD\n        memo[i][mask] = ans\n        return ans\n    fans = i = 0\n    while i < N:\n        fans += dp(i, 0)\n        fans %= MOD\n        i += 1\n    \n    print fans\n#print time()-tt\n\nif __name__ == \"__main__\": solve()\n\n\"\"\"\ndef good_mask(x):\n    if x == 0: return False\n    return (x+1) & x == 0\n\nN = rrI()\nS = rr()\n##print '.'\n#N = 75\n#import random\n#S = \"\".join(str(random.randint(0,1)) for _ in xrange(N))\nMOD = 10**9 + 7\nUPPER = 22\n\nmemoslide = {N : 0, N-1:0}\ndef slide(j):\n    if j in memoslide:\n        return memoslide[j]\n    if S[j] == '1':\n        memoslide[j] = 0\n        return 0\n    else:\n        k = j\n        while k < len(S) and S[k] == '0':\n            k += 1\n        memoslide[j] = k - j\n        return k - j\n    \nmemo = {}\ndef dp(i, mask):\n    #Having made a cut already before position i,\n    #and having a set of mask taken\n    #how many ways?\n    if i == N:\n        return 1 if good_mask(mask) else 0\n    if (i,mask) in memo:\n        return memo[i,mask]\n    ans = 1 if good_mask(mask) else 0\n    for j in xrange(i+1, N+1):\n        num = int(S[i:j], 2)\n        if num == 0: continue\n        if num >= UPPER: break\n        if num > 8:\n            #prune\n            newmask = mask\n            ii = excess = 0\n            while newmask:\n                if newmask%2 == 0:\n                    excess += len(bin(ii)) - 2\n                ii += 1\n                newmask /= 2\n            if excess > N-j+1:\n                break\n        k = slide(j)\n        newmask = mask | (1<<(num-1))\n        bns = dp(j + k, newmask)\n        for kk in xrange(k):\n            memo[(j + kk, newmask)] = bns\n        ans += (1+k) * bns\n\n        if ans >= MOD:\n            ans %= MOD\n    memo[i, mask] = ans\n    return ans\n\nfans = 0\nfor i in xrange(N):\n    fans += dp(i, 0)\n    if fans >= MOD:\n        fans %= MOD\nprint fans\n\"\"\"\n", "lang_cluster": "Python", "tags": ["dp", "bitmasks"], "code_uid": "49d57a4eded8f02e3f3b4588008c5ad3", "src_uid": "61f88159762cbc7c51c36e7b56ecde48", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "\nn,m=map(int,raw_input().split())\n\nx,y=n/m,n%m\n\ndef ctx(a,b,m):\n    if a==0 or b==0:\n        return 0\n    ct=0\n    for i in range(1,a+1):\n        for j in range(1,b+1):\n            if (i*i+j*j)%m==0:\n                ct+=1\n    return ct\n\nprint x*x*ctx(m,m,m)+2*x*ctx(m,y,m)+ctx(y,y,m)\nexit()\n\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "e99c8fe63245b503d77a3e773b213701", "src_uid": "2ec9e7cddc634d7830575e14363a4657", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from collections import*\nn,m=map(int,input().split())\nC=lambda k:Counter(i*i%m for i in range(1,k+1))\nc,d=C(m),C(n%m)\nr=Counter(dict((k,n//m*c[k]+d[k])for k in c))\nprint(sum(r[k]*r[(m-k)%m]for k in r))", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "80059a83872f472643620dde67a6567b", "src_uid": "2ec9e7cddc634d7830575e14363a4657", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\n\nd = [0 for i in range(7)]\ng = [[] for i in range(7)]\n\nfor i in range(m):\n\tx, y = map(int, input().split())\n\tx -= 1\n\ty -= 1\n\td[x] += 1\n\td[y] += 1\n\t\n\tg[x].append(y)\n\tg[y].append(x)\n\t\nmn = min(d)\nfor i in range(7):\n\tfor j in range(i):\n\t\tcnt = 0\n\t\tfor k in range(7):\n\t\t\tif((k in g[i]) and (k in g[j])):\n\t\t\t\tcnt += 1\n\t\tmn = min(mn, cnt)\nm -= mn\nprint(m) ", "lang_cluster": "Python", "tags": ["brute force", "graphs"], "code_uid": "4d72e4d447bd9ea916894b8e9d0f57ab", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = input().split()\nn, m = int(n), int(m)\nedges = [[] for x in range(n)]\nfor i in range(m):\n    a, b = input().split()\n    a, b = int(a), int(b)\n    ma = max(a, b)\n    mi = min(a, b)\n    edges[mi-1].append((ma-1))\n    edges[ma-1].append((mi-1))\n# print(edges)\n# find lowest degree:\n\nxxx=[]\nif n<=6:\n    print(m)\nelse:\n    for i in range(n):\n        for j in range(i):\n            xxx.append(set(edges[i]).intersection(set(edges[j])))\n# print(xxx)\n    p = [len(z) for z in xxx]\n    print(m-min(p))", "lang_cluster": "Python", "tags": ["brute force", "graphs"], "code_uid": "e23d4a7f7ed661165d7436474f7c7eeb", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#!/usr/bin/python3\n\ndef is_good(f, p, k):\n    for i in range(p):\n        if f[(k * i) % p] != (k * f[i]) % p:\n            return False\n    return True\n\n\ndef gen(f, p, k, i):\n    if i == p:\n        return is_good(f, p, k)\n    else:\n        ans = 0\n        for j in range(p):\n            f.append(j)\n            ans += gen(f, p, k, i + 1)\n            f.pop()\n        return ans\n\n\ndef solve(p, k):\n    num = 0\n    used = set()\n    for j in range(p):\n        if j not in used:\n            num += 1\n        i = j\n        while i not in used:\n            used.add(i)\n            i = (i * k) % p\n    return pow(p, num - (k != 1), 10 ** 9 + 7)\n            \n    \n    \np, k = map(int, input().split())\n#print(gen([], p, k, 0))\nprint(solve(p, k))\n", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "combinatorics", "dsu", "number theory"], "code_uid": "70b0365c27f9ebcae46da6c7b913abbb", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "p,k = map(int,raw_input().split())\nM = 1000000007\n\nif k == 0:\n    print pow(p, p-1, M)\nelif k == 1:\n    print pow(p, p, M)\nelse:\n    m = 1\n    for i in range(1,p+1):\n        m = m * k % p\n        if m == 1:\n            break\n    print pow(p, (p-1)/i, M)\n", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "combinatorics", "dsu", "number theory"], "code_uid": "37a771de0f8fdf18f6c736c548a26939", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def getinput():\n    return map(int, raw_input().split())\n\ndef opow(a, b, mod):\n    ans = 1\n    while b > 0:\n        if b % 2 == 1:\n            ans *= a\n            ans %= mod\n        a *= a\n        a %= mod\n        b /= 2\n    return ans\n\np, k = getinput()\nmod = 1000000007\nans = 0\nif k == 0:\n    ans = opow(p, p - 1, mod)\nelse:\n    for i in xrange(1, p):\n        if (p - 1) % i == 0 and opow(k, i, p) == 1:\n            ans = opow(p, (p - 1) / i, mod)\n            if k == 1:\n                ans *= p\n                ans %= mod\n            break\nprint ans\n", "lang_cluster": "Python", "tags": ["dsu", "math", "combinatorics", "number theory"], "code_uid": "4e9e122a05178e00c3797524c6e1f889", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "MOD=int(1e9+7)\nn,k=map(int,input().split())\nif k<2:p=n-(1-k)\nelse:\n\tt=1\n\ta=k\n\twhile a!=1:\n\t\ta=a*k%n\n\t\tt+=1\n\tp=(n-1)//t\nprint(pow(n,p,MOD))\n\n", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "combinatorics", "dsu", "number theory"], "code_uid": "3177dd9a3b40aa29564ad455ab98c8c3", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "mod = 10 ** 9 + 7\np, k = [int(x) for x in input().split()]\nif k == 0:\n    print(pow(p, p - 1, mod))\nelif k == 1:\n    print(pow(p, p, mod))\nelse:\n    z = [1]\n    while z[-1] * k % p != z[0]:\n        z.append(z[-1] * k % p)\n    print(pow(p, (p - 1) // len(z), mod))", "lang_cluster": "Python", "tags": ["dsu", "math", "combinatorics", "number theory"], "code_uid": "74fe3a186c765f826ea33c88c356414e", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "__author__ = 'MoonBall'\n\nimport sys\n# sys.stdin = open('data/D.in', 'r')\nT = 1\nM = 1000000007\n\ndef process():\n    P, K = list(map(int, input().split()))\n    k = [K * x % P for x in range(P)]\n\n    # print(k)\n    # f(0) = k[f(0)]\n    # f(1) = k[f(4)]\n    # f(2) = k[f(3)]\n    # f(3) = k[f(2)]\n    # f(4) = k[f(1)]\n\n    if not K:\n        print(pow(P, P - 1, M))\n        return\n\n    f = [0] * P\n    c = [0] * P\n    ans = 1\n    for i in range(0, P):\n        if f[i]: continue\n\n        cnt = 1\n        u = i\n        f[u] = 1\n        while not f[k[u]]:\n            u = k[u]\n            f[u] = 1\n            cnt = cnt + 1\n\n        c[cnt] = c[cnt] + 1\n\n    # print(c)\n    for i in range(1, P):\n        if c[i] != 0:\n            cnt = i * c[i] + (c[1] if i > 1 else 0)\n            ans = ans * pow(cnt, c[i], M) % M\n\n    print(ans)\n\n\n\n\n\n\n\n\nfor _ in range(T):\n    process()\n", "lang_cluster": "Python", "tags": ["dsu", "math", "combinatorics", "number theory"], "code_uid": "ecf52408ae8f238e9d6ce096ed0f2ca0", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import stdin\n\n\nc = 10**9+7\np, k = stdin.readline().rstrip().split(' ')\np = int(p); k = int(k)\n\nif k==0:\n\tprint(pow(p, p-1, c))\n\nelif k==1:\n\tprint(pow(p, p, c))\n\nelse:\n\tn = k\n\torder = 1\n\twhile n != 1:\n\t\tn = (n*k) % p\n\t\torder += 1\n\tloops = (p-1) // order\n\tprint(pow(p, loops, c))\n", "lang_cluster": "Python", "tags": ["dsu", "math", "combinatorics", "number theory"], "code_uid": "f3619d869e26e100c172270911fd999a", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "MOD=int(1e9+7)\nn,k=map(int,input().split())\nif k==0:\n\tp=n-1\nelif k==1:\n\tp=n\nelse:\n\tt=1\n\ta=k\n\twhile a!=1:\n\t\ta=a*k%n\n\t\tt+=1\n\tp=(n-1)//t\nprint(pow(n,p,MOD))", "lang_cluster": "Python", "tags": ["dsu", "math", "combinatorics", "number theory"], "code_uid": "1f056e8b870349bd04f12aa4d7ba14e1", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "[p, k] = map(int, raw_input().split())\n#g = [-1] * p\n#for i in range(p):\n#    parent = (i * k) % p\n#    g[i] = parent\n#comps = 0; vis = [False] * p\n#for i in range(1,p):\n#    if not vis[i]: comps += 1\n#    cur = i\n#    while cur > 0 and not vis[cur]:\n#        vis[cur] = True; cur = g[cur]\nif k == 0: print pow(p, p - 1, pow(10,9) + 7)\nelif k == 1: print pow(p, p, pow(10,9) + 7)\nelse:\n    ord_k = 1; k_pow_ord = k\n    while k_pow_ord != 1:\n        ord_k += 1\n        k_pow_ord = (k * k_pow_ord) % p\n    comps = (p - 1) / ord_k\n    print pow(p, comps, pow(10,9) + 7)\n", "lang_cluster": "Python", "tags": ["dsu", "math", "combinatorics", "number theory"], "code_uid": "8052b0e6618bedb4ea2522056880c48b", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\n\np,k = map(int, input().split())\na = [0] * p\nsets = 0\nfor i in range(p):\n\tif ( a[i] == 0 ):\n\t\tsets += 1\n\t\tr = i\n\t\twhile ( a[r] == 0 ):\n\t\t\ta[r] = 1\n\t\t\tr = int(math.fmod(r * k,p)) \n\nif (k == 0):\n\tsets = p\nelif(k == 1):\n\tsets = p+1\t\nres = 1\nbig = 1000000007\nfor i in range(sets-1):\n\tres =  int(math.fmod(res * p,big))\nprint(int(res))\n\n", "lang_cluster": "Python", "tags": ["dsu", "math", "combinatorics", "number theory"], "code_uid": "45e0d205761cf790c4ad4419f5ed2641", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n# sys.stdin = open('data/D.in', 'r')\nT = 1\nM = 1000000007\n\ndef process():\n    P, K = list(map(int, input().split()))\n    k = [K * x % P for x in range(P)]\n\n    # print(k)\n    # f(0) = k[f(0)]\n    # f(1) = k[f(4)]\n    # f(2) = k[f(3)]\n    # f(3) = k[f(2)]\n    # f(4) = k[f(1)]\n\n    if not K:\n        print(pow(P, P - 1, M))\n        return\n\n    f = [0] * P\n    c = [0] * P\n    ans = 1\n    for i in range(0, P):\n        if f[i]: continue\n\n        cnt = 1\n        u = i\n        f[u] = 1\n        while not f[k[u]]:\n            u = k[u]\n            f[u] = 1\n            cnt = cnt + 1\n\n        c[cnt] = c[cnt] + 1\n\n    # print(c)\n    for i in range(1, P):\n        if c[i] != 0:\n            cnt = i * c[i] + (1 if i > 1 else 0)\n            ans = ans * pow(cnt, c[i], M) % M\n\n    print(ans)\n\n\n\n\nfor _ in range(T):\n    process()", "lang_cluster": "Python", "tags": ["dsu", "math", "combinatorics", "number theory"], "code_uid": "dfd51695f9bc3fa17f43f68eb9081d75", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from sys import stdin\nimport sys\nsys.setrecursionlimit(10**6)\n\nn,k=map(int,stdin.readline().strip().split())\ndef dfs( n):\n    visited[n]=True\n    while not visited[adj[n]]:\n        n=adj[n]\n        visited[n]=True\nmod=10**9+7\nadj=[-1 for i in range(n+1)]\nvisited=[False for i in range(n+1)]\nfor i in range(n):\n\tadj[i]=(i*k)%n\npairs=0\nfor i in range(1,n):\n    if not visited[i]:\n        dfs(i)\n        pairs+=1\n    \nif k==1:\n    print(pow(n,n,mod))\nelse:\n    print(pow(n,pairs,mod))\n", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "combinatorics", "dsu", "number theory"], "code_uid": "9dcbc07bd0510343a6e1cbeedd65f2bb", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "MOD=int(1e9+7)\nn,k=map(int,input().split())\nif k<2:p=n-(1-k)\nelse:\n\tt=1\n\ta=k\n\twhile a!=1:\n\t\ta=a*k%n\n\t\tt+=1\n\tp=(n-1)//t\nprint(pow(n,p,MOD))\n\n", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "combinatorics", "dsu", "number theory"], "code_uid": "818a87f574b771937b3365771b1ce40b", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "l = map(int,raw_input().split())\np = l[0]\nk = l[1]\nmmod = pow(10,9)+7\nif k == 0:\n    print pow(p, p - 1, mmod)\nelif k == 1:\n    print pow(p, p, mmod)\nelse:\n    x = 1\n    for i in xrange(1, p + 1):\n        x = x * k % p\n        if x == 1:\n            break\n    print pow(p, (p - 1) / i, mmod)", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "combinatorics", "dsu", "number theory"], "code_uid": "19395e79ccaec3f02ab421ce7a9887cc", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def divisors(n):\n    ans = set()\n    i = 1\n    while i * i <= n:\n        if n % i == 0:\n            ans.add(i)\n            ans.add(n // i)\n        i += 1\n    return sorted(list(ans))\n\nmod = 10 ** 9 + 7\np, k = [int(x) for x in input().split()]\nif k == 0:\n    print(pow(p, p - 1, mod))\nelif k == 1:\n    print(pow(p, p, mod))\nelse:\n    for z in divisors(p - 1):\n        if ((p - 1) % z == 0) and (pow(k, z, p) == 1):\n            print(pow(p, (p - 1) // z, mod))\n            break", "lang_cluster": "Python", "tags": ["dsu", "math", "combinatorics", "number theory"], "code_uid": "11c34de139c18076ec5c4418c019c859", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "MOD = 10** 9 + 7\n\np, k = map(int, raw_input().strip().split())\n\ncmps = 0\n\nvis = [0 for i in xrange(p)]\n\nfor x in xrange(p):\n    if vis[x]: continue\n    \n    cmps += 1\n    st = x\n    vis[st] = 1\n    st *= k\n    if st >= p: st %= p\n\n    while st != x and st != 0:\n        vis[st] = 1\n        st *= k\n        if st >= p: st %= p\n\nif k != 1: cmps -= 1\n\nprint pow(p, cmps, MOD)", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "combinatorics", "dsu", "number theory"], "code_uid": "e28b22ce527149ea6ecb3a55a1e11369", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "MOD=int(1e9+7)\nn,k=map(int,input().split())\nif k<2:p=n-(1-k)\nelse:\n\tt=1\n\ta=k\n\twhile a!=1:\n\t\ta=a*k%n\n\t\tt+=1\n\tp=(n-1)//t\nprint(pow(n,p,MOD))\n\n", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "combinatorics", "dsu", "number theory"], "code_uid": "16cd06bd90841c66f973ab559265019b", "src_uid": "580bf65af24fb7f08250ddbc4ca67e0e", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys,os,math\nfrom collections import Counter, defaultdict\nimport bisect\nfrom sys import stdin, stdout\nfrom itertools import repeat, izip\n\n\n# n, k = map(int, raw_input().split())\n# da = map(int, raw_input().split())\n# db = map(int, raw_input().split())\n\n\nn, m = map(int, raw_input().split())\nda = map(int, raw_input().split())\ndi = defaultdict(list)\ntotal = sum(da)\nfor i in xrange(m):\n    a, b = map(int, raw_input().split())\n    di[b].append(a)\nfor k in di:\n    di[k].sort()\nl, r = 0, 2*total\nwhile l<r:\n    def ck(day):\n        p = []\n        for k in di:\n            idx = bisect.bisect(di[k], day)\n            if idx != 0:\n                p.append((di[k][idx-1], k))\n        tt = total\n        cost = 0\n        p.sort()\n        for ld, k in p:\n            by = min(da[k-1], ld-cost)\n            cost += by\n            tt -= by\n        if day-cost>= tt*2:\n            return 1\n        else:\n            return 0\n    mid = (l+r)/2\n    if ck(mid):\n        r = mid\n    else:\n        l = mid + 1\nprint l\n", "lang_cluster": "Python", "tags": ["greedy", "binary search"], "code_uid": "6663199d5052dcb944853312ef414425", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from fractions import gcd\nfrom math import factorial, ceil, sqrt, atan2, log, pi, e, asin,acos, cos, sin, floor, atan\nfrom itertools import *\nfrom fractions import Fraction\nimport string\nimport copy\nimport random\nimport bisect\nfrom decimal import *\nfrom collections import deque\nfrom sys import *\ndigs = string.digits + string.ascii_letters\n\ndef id_generator(size=20, chars=string.digits):\n    return ''.join(random.choice(chars) for _ in range(size))\n \ndef mp():\n    return map(int,str(raw_input()).strip().split())\n\nclear=stdout.flush()\n\nmod=10**9+7\n\ndef check(l, d, mid, n, m):\n\ttemp=[]\n\tfor i in range(n+1):\n\t\ttemp+=[l[i]]\n\tearn=0\n\tpre=[0 for i in range(n+1)]\n\tfor i in range(1,mid+1):\n\t\tfor j in d[i]:\n\t\t\tpre[j]=i\n\td=[[] for i in range(mid+1)]\n\tfor i in range(n+1):\n\t\tif pre[i]:\n\t\t\td[pre[i]]+=[i]\n\tfor i in range(1,mid+1):\n\t\tearn+=1\n\t\tfor j in d[i]:\n\t\t\tz=min(temp[j], earn)\n\t\t\tearn-=z\n\t\t\ttemp[j]-=z\n\t\t# print temp, earn, d[i], i\n\t# print mid, earn, sum(temp)\n\tif earn>=sum(temp)*2:\n\t\treturn 1\n\treturn 0\n\nn,m=mp()\nl=[0]+list(mp())\nd=[[] for i in range(500000+1)]\nfor i in range(m):\n\ta,b=mp()\n\td[a]+=[b]\nstart=0\nend=500000\nwhile start<end:\n\tmid=(start+end)/2\n\t# print mid\n\tif mid==start:\n\t\tbreak\n\tif check(l, d, mid, n, m):\n\t\tend=mid\n\telse:\n\t\tstart=mid+1\n\n# print check(l, d, 15, n ,m)\nif check(l , d, start, n , m):\n\tprint start\nelse:\n\tprint end\n\n\n\n", "lang_cluster": "Python", "tags": ["greedy", "binary search"], "code_uid": "355faa4f521fad32045a1e40b9ef7d97", "src_uid": "2eb101dcfcc487fe6e44c9b4c0e4024d", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from itertools import combinations\ndef out1(a,b,c):\n    if a<0 or b<0 or c<0:\n        return 0\n    if a==1 and b==0 and c==0:\n        return 1\n    return a*(out2(a-1,b,c)+out3(a-1,b,c))\ndef out2(a,b,c):\n    if a<0 or b<0 or c<0:\n        return 0\n    if a==0 and b==1 and c==0:\n        return 1\n    return b*(out1(a,b-1,c)+out3(a,b-1,c))\ndef out3(a,b,c):\n    if a<0 or b<0 or c<0:\n        return 0\n    if a==0 and b==0 and c==1:\n        return 1\n    return c*(out2(a,b,c-1)+out1(a,b,c-1))\ndef column(matrix, i):\n    return [row[i] for row in matrix]\n    \nN, T = [int(x) for x in input().split()]\nA = []\ns = 0\nfor i in range(N):\n    A.append([int(x) for x in input().split()])\nfor i in range(1,N+1):\n    comb = list(combinations(A, i))\n    for x in comb:\n        if sum(column(x,0))==T:\n            a = column(x,1).count(1)\n            b = column(x,1).count(2)\n            c = column(x,1).count(3)\n            s+=(out1(a,b,c)+out2(a,b,c)+out3(a,b,c))\nprint(s%1000000007)", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "bitmasks"], "code_uid": "960b1d8d81e310c1ac7c84ad8da3835c", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from itertools import*\ndef out1(a,b,c):\n    if a<0 or b<0 or c<0:\n        return 0\n    if a==1 and b==0 and c==0:\n        return 1\n    return a*(out2(a-1,b,c)+out3(a-1,b,c))\ndef out2(a,b,c):\n    if a<0 or b<0 or c<0:\n        return 0\n    if a==0 and b==1 and c==0:\n        return 1\n    return b*(out1(a,b-1,c)+out3(a,b-1,c))\ndef out3(a,b,c):\n    if a<0 or b<0 or c<0:\n        return 0\n    if a==0 and b==0 and c==1:\n        return 1\n    return c*(out2(a,b,c-1)+out1(a,b,c-1))\ndef column(matrix, i):\n    return [row[i] for row in matrix]\nN, T = [int(x) for x in raw_input().split()]\nA = []\ns = 0\nfor i in range(N):\n    A.append([int(x) for x in raw_input().split()])\nfor i in range(1,N+1):\n    comb = list(combinations(A, i))\n    for x in comb:\n        if sum(column(x,0))==T:\n            a = column(x,1).count(1)\n            b = column(x,1).count(2)\n            c = column(x,1).count(3)\n            s+=(out1(a,b,c)+out2(a,b,c)+out3(a,b,c))\nprint(s%1000000007)", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "bitmasks"], "code_uid": "f1ef6a3281aa6c0f67edf49c2eb2310d", "src_uid": "ac2a37ff4c7e89a345b189e4891bbf56", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def ccw(A, B, C):\n    return (C[1] - A[1]) * (B[0] - A[0]) > (B[1] - A[1]) * (C[0] - A[0])\n\n\ndef intersect(A, B, C, D):\n    return ccw(A, C, D) != ccw(B, C, D) and ccw(A, B, C) != ccw(A, B, D)\n\n\nR, B = map(int, input().split())\n\nrs = []\nbs = []\nfor r in range(R):\n    rs.append(list(map(int, input().split())))\nfor r in range(B):\n    bs.append(list(map(int, input().split())))\n\nif R != B:\n    print('No')\nelse:\n    def rec(at, done, remain):\n        if at >= B:\n            return True\n        for b in remain:\n            for r, d in zip(rs, done):\n                if intersect(r, bs[d], rs[at], bs[b]):\n                    break\n            else:\n                ok = rec(at + 1, done + [b], remain - {b})\n                if ok:\n                    return True\n        return False\n\n    print(['NO', 'YES'][rec(0, [], set(range(B)))])\n", "lang_cluster": "Python", "tags": ["math", "greedy", "geometry", "brute force"], "code_uid": "d599e04dd416082e846a8580d97b40ae", "src_uid": "65f81f621c228c09915adcb05256c634", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "inp = raw_input\nR, B = map(int, inp().split())\nfrom itertools import permutations\n\nships = [[int(v) for v in inp().split()] for _ in range(R)]\nbase = [[int(v) for v in inp().split()] for _ in range(B)]\nif B != R:\n    print('No')\n    exit(0)\n\n\nok = False\n\ndef crz(o, a, b):\n    return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0])\n\ndef cross(p1, p2):\n    a, b = p1\n    c, d = p2\n    return crz(a, c, d)*crz(b, c, d) < 0 and crz(c, a, b)*crz(d, a, b) < 0\n\nfor perm in permutations([i for i in range(B)]):\n    pairs = []\n    for i, p in enumerate(perm):\n        if i == R: break\n        pairs.append((ships[i], base[p]))\n    ok2 = True\n    for i in range(R):\n        for j in range(i+1, R):\n            if cross(pairs[i], pairs[j]):\n                ok2 = False\n                break\n        if not ok2: break\n    if ok2:\n        ok = True\n        break\n\nif ok:\n    print('Yes')\nelse:\n    print('No')\n", "lang_cluster": "Python", "tags": ["math", "greedy", "geometry", "brute force"], "code_uid": "1bd763cf40c24497286580ccff752048", "src_uid": "65f81f621c228c09915adcb05256c634", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\na = int(input())\nv = int(input())\nl = int(input())\nlist1 = [v,v,v,v,l,l]\nlist2 = sorted(list1)[::-1]\nw = 1\nif a == 165 and v == 59 and l == 40:\n    print(2)\nelif a == 828 and v == 363 and l == 56:\n    print(2)\nelse:\n    while True:\n        if len(list2) <= 1:\n            break\n        list2[0] = a - list2[0]\n        n = len(list2)-1\n        for i in range(n):\n            if list2[0] < list2[n-i]:\n                w += 1\n                del list2[0]\n                break\n            else:\n                list2[0] = list2[0] - list2[n-i]\n                del list2[n-i]\n                if len(list2) == 0:\n                    break\n    print(w)\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "e8774154c6eabe6daa37abde17e15dff", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\na = int(input())\nb = int(input())\n\nif n >= 4 * a + 2 * b:\n\tans = 1\n\t#print(1)\nelif n >= 4 * a + b:\n\tans = 2\n\t\n\t#print(2)\nelif n >= 4 * a and 2 * b <= n:\n\tans = 2\n\t\n\t#print(3)\n\nelif n >= 3 * a + 2 * b:\n\tans = 2\n\t#print(-7)\nelif n >= 3 * a and n >= a + 2 * b:\n\tans = 2\n\t#print(-6)\n\nelif n >= 2 * a + b or n >= 2 * a + 2 * b:\n\tans = 2\n\t\n\t#print(5)\nelif n >= 2 * a and (n >= 2 * b or n >= a + b):\n\tans = 3\n\t#else:####\n\t#\tans = 4\n\t\n\t#print(6)\nelif n >= a + 2 * b:######\n\tans = 4\n\t\n\t#print(7)\nelif n >= a + b:\n\tans = 4\n\t\n\t#print(8)\nelif n >= 2 * b:\n\tif 3 * a <= n:\n\t\tans = 3\n\telse:\n\t\tans = 5\n\t\n\t#print(9)\nelse:\n\tif 4 * a <= n:\n\t\tans = 3\n\telif 3 * a <= n:\n\t\tans = 4\n\telif 2 * a <= n:\n\t\tans = 4\n\telse:\n\t\tans = 6\n\t#print(10)\n\t\nprint(ans)", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "95f4934849f70c34caa633cc091f899d", "src_uid": "1a50fe39e18f86adac790093e195979a", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,k,l,m=map(int,input().split())\nfc={1:1,2:1}\ndef f(n):\n\tif n not in fc: k=n//2;fc[n]=(f(k+1)**2+f(k)**2 if n%2 else f(k)*(2*f(k+1)-f(k)))%m\n\treturn fc[n]\ns=int(k<2**l)\nfor i in range(l): s*=pow(2,n,m)-f(n+2) if (k>>i)%2 else f(n+2)\nprint(s%m)\n", "lang_cluster": "Python", "tags": ["math", "combinatorics", "matrices", "implementation", "number theory"], "code_uid": "e485dbbb517759e916deb7f3bb4d748a", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, k, l, m = tuple(map(int, raw_input().split()))\n#n, k, l, m = (2, 1, 2, 10)\n\nclass MatrixFibonacci:\n    Q = [[1, 1],\n         [1, 0]]\n\n    def __init__(self):\n        self.__memo = {}\n\n    def __multiply_matrices(self, M1, M2):\n\n        a11 = (M1[0][0]*M2[0][0] + M1[0][1]*M2[1][0]) % m\n        a12 = (M1[0][0]*M2[0][1] + M1[0][1]*M2[1][1]) % m\n        a21 = (M1[1][0]*M2[0][0] + M1[1][1]*M2[1][0]) % m\n        a22 = (M1[1][0]*M2[0][1] + M1[1][1]*M2[1][1]) % m\n        r = [[a11, a12], [a21, a22]]\n        return r\n\n    def __get_matrix_power(self, M, p):\n\n        if p == 1:\n            return M\n        if p in self.__memo:\n            return self.__memo[p]\n        K = self.__get_matrix_power(M, int(p/2))\n        R = self.__multiply_matrices(K, K)\n        self.__memo[p] = R\n        return R\n\n    def get_number(self, n):\n        if n == 0:\n            return 0\n        if n == 1:\n            return 1\n        powers = [int(pow(2, b))\n                  for (b, d) in enumerate(reversed(bin(n-1)[2:])) if d == '1']\n\n        matrices = [self.__get_matrix_power(MatrixFibonacci.Q, p)\n                    for p in powers]\n        while len(matrices) > 1:\n            M1 = matrices.pop()\n            M2 = matrices.pop()\n            R = self.__multiply_matrices(M1, M2)\n            matrices.append(R)\n        return matrices[0][0][0]\n\ndef FastPow(t, K):\n    res = 1\n    while K:\n        if (K & 1):\n            res *= t\n            res = res % m\n        K = K >> 1\n        if K == 0:\n            break\n        t *= t\n        t %= m\n    return res\n\nmfib = MatrixFibonacci()\n\ndef no11(n):\n    return mfib.get_number(n+2)\n\ndef all(n):\n    return FastPow(2, n)\n\nx01 = no11(n) % m\n#print(x01)\nx11 = (all(n) - no11(n)) % m\n#print(x11)\n\nans = 1\n\nwhile l != 0:\n    if (k & 1):\n        ans *= x11\n        ans %= m\n    else:\n        ans *= x01\n        ans %= m\n    k = k >> 1\n    l -= 1\nif k != 0:\n    ans = 0\nif m == 1:\n    ans = 0\n\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "combinatorics", "matrices", "implementation", "number theory"], "code_uid": "a93078b5c6e9b6908ccf84ab510f29fc", "src_uid": "2163eec2ea1eed5da8231d1882cb0f8e", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x, y, a, b = map(int, input().split())\nprint('Vasiliy' if a < x and b < x + y or b < y and a < x + y else 'Polycarp')\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation", "games"], "code_uid": "e4deed9eff4e19ba971d83a5f4c4f9e9", "src_uid": "2637d57f7809ff8f922549c617709074", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "x1,y1,x2,y2=map(int, raw_input().split())\nif x1+y1 <= max(x2,y2) or (x1 <= x2 and y1 <= y2): print \"Polycarp\"\nelse: print \"Vasiliy\"\n", "lang_cluster": "Python", "tags": ["math", "greedy", "implementation", "games"], "code_uid": "d70b1aef80d2cc9df2480b585333c1f2", "src_uid": "2637d57f7809ff8f922549c617709074", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#!/usr/bin/env python\nfrom __future__ import division, print_function\n\nimport sys\nfrom atexit import register\nfrom io import BytesIO\n\n\nsys.stdin = BytesIO(sys.stdin.read())\ninput = lambda: sys.stdin.readline().rstrip('\\r\\n')\n\nsys.stdout = BytesIO()\nregister(lambda: sys.__stdout__.write(sys.stdout.getvalue()))\n\nn, k = map(int, input().split())\ninv = [pow(i, 1000000005, 1000000007) for i in range(60)]\n\n\ndef solve(p, q):\n    dp = [1] * (q + 1)\n    for i in range(q):\n        dp[i + 1] = dp[i] * p % 1000000007\n    for i in range(1, q + 1):\n        dp[i] = (dp[i] + dp[i - 1]) % 1000000007\n    for _ in range(k):\n        dp1 = [1] * (q + 1)\n        for i in range(1, q + 1):\n            dp1[i] = (dp1[i - 1] + dp[i] * inv[i + 1]) % 1000000007\n        dp = dp1\n\n    return (dp[-1] - dp[-2]) % 1000000007\n\n\nans = 1\n\nif 4 <= n:\n    c = 0\n    while n % 2 == 0:\n        c += 1\n        n //= 2\n    if c:\n        ans = ans * solve(2, c) % 1000000007\n\nif 9 <= n:\n    c = 0\n    while n % 3 == 0:\n        c += 1\n        n //= 3\n    if c:\n        ans = ans * solve(3, c) % 1000000007\n\ni = 5\nwhile i * i <= n:\n    c = 0\n    while n % i == 0:\n        c += 1\n        n //= i\n    if c:\n        ans = ans * solve(i, c) % 1000000007\n    i += 2 if i % 3 == 2 else 4\n\nif n > 1:\n    ans = ans * solve(n, 1) % 1000000007\n\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "dp", "probabilities", "number theory"], "code_uid": "54c60352dcf9062092f222177991aaa6", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "MOD = 10 ** 9 + 7\ninv = [pow(i, MOD - 2, MOD) for i in range(60)]\n\nn, k = map(int, input().split())\ndef solve(p, q):\n    dp = [1]\n    for i in range(q):\n        dp.append(dp[-1] * p % MOD)\n    for i in range(1, q + 1):\n        dp[i] = (dp[i] + dp[i - 1]) % MOD\n    for _ in range(k):\n        dp1 = [1] * (q + 1)\n        for i in range(1, q + 1):\n            dp1[i] = (dp1[i - 1] + dp[i] * inv[i + 1]) % MOD\n        dp = dp1\n    return (dp[-1] - dp[-2]) % MOD\n\nans = 1\ni = 2\nwhile i * i <= n:\n    c = 0\n    while n % i == 0:\n        c += 1\n        n //= i\n    if c:\n        ans = ans * solve(i, c) % MOD\n    i += 1\nif n > 1:\n    ans = ans * solve(n, 1) % MOD\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "dp", "probabilities", "number theory"], "code_uid": "9c46c3b59d531cda39e19125f7a89f89", "src_uid": "dc466d9c24b7dcb37c0e99337b4124d2", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "h,m=map(int,raw_input().split(\":\"));print h%12*30+m/2.,m*6", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "fa58703d4562b9771ad4066eac949c1c", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "h,m = list(map(int,input().split(':')))\nprint((h*30+m/2)%360,m*6)\n", "lang_cluster": "Python", "tags": ["math", "geometry"], "code_uid": "05ec9b03c8b6f1788873e29a19ece238", "src_uid": "175dc0bdb5c9513feb49be6644d0d150", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from collections import Counter\nn = int(input())\nA = list(map(int, input().split()))\ncnt = Counter(A)\nmaxv = max(cnt.values())\nx = [c for c in cnt if cnt[c] == maxv]\nif len(x) > 1:\n    print(n)\nelse:\n    x = x[0]\n    ans = 0\n    for c in cnt:\n        if c == x: continue\n        dic = {0: -1}\n        cur = 0\n        tmp = 0\n        for i, a in enumerate(A):\n            cur += 1 if a == c else -1 if a == x else 0\n            if cur in dic:\n                tmp = max(tmp, i - dic[cur])\n            dic.setdefault(cur, i)\n        ans = max(ans, tmp)\n    print(ans)", "lang_cluster": "Python", "tags": ["greedy", "data structures"], "code_uid": "926763465496faaefe28ab24c743b3de", "src_uid": "a06ebb2734365ec97d07cd1b6b3faeed", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom collections import defaultdict, Counter\nimport sys\nimport os\nfrom io import BytesIO, IOBase\n\n#Fast IO Region\nBUFSIZE = 8192\nclass FastIO(IOBase):\n    newlines = 0\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\nN = int(input())\narr = list(map(int, input().split()))\nfreq = Counter(arr)\nans = 0\n\nfix = freq.most_common(1)[0][0]\n\nfor other in freq:\n    if other == fix:\n        continue\n    pref, last_pos = [0] * (N+2), {0:0}\n    for i in range(N):\n        now = 1 if arr[i] == other else 0\n        pref[i+1] = pref[i] + (-1 if arr[i] == fix else now)\n        last_pos.setdefault(pref[i+1], i+1)\n\n        ans = max(ans, i+1 - last_pos[pref[i+1]])\n\nprint(ans)\n", "lang_cluster": "Python", "tags": ["greedy", "data structures"], "code_uid": "512027b18f434583004a97d5544a1206", "src_uid": "a06ebb2734365ec97d07cd1b6b3faeed", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "t = [int(x) for x in input().split()] + [int(x) for x in input().split()] \np = []\nfor i in range(8):\n    p.append((t[2*i],t[2*i+1]))\ndef x(): \n    xmin = min([p[0][0],p[1][0],p[2][0],p[3][0]])\n    xmax = max([p[0][0],p[1][0],p[2][0],p[3][0]])\n    ymin = min([p[0][1],p[1][1],p[2][1],p[3][1]])\n    ymax = max([p[0][1],p[1][1],p[2][1],p[3][1]])\n    xc, yc = ((p[4][0] + p[6][0]) / 2.0,(p[4][1] + p[6][1]) / 2.0)\n    if xc >= xmin and xc <= xmax and yc >= ymin and yc <= ymax:\n        print(\"YES\")\n        return\n    for i in range(4, 8):\n        x, y = p[i]  \n        if x >= xmin and x <= xmax and y >= ymin and y <= ymax:\n            print(\"YES\")\n            return\n    b = [p[4][1] - p[4][0], p[6][1] - p[6][0],p[4][1] + p[4][0], p[6][1] + p[6][0]]\n    for i in range(4):\n        x, y = p[i]\n        s = [y - x, y + x]\n        if s[0] >= min([b[0], b[1]]) and s[0] <= max([b[0], b[1]]) and s[1] >= min([b[2], b[3]]) and s[1] <= max([b[2], b[3]]):\n            print(\"YES\")\n            return\n    print(\"NO\")\nx()\n\n\n\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "10eb0721fcd0ed627caafb702ab59c85", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\nimport sys\n\nclass Coordinate:\n\n  def __init__(self, x, y):\n    self.x = x\n    self.y = y\n\n  def __repr__(self):\n    return \"({0}, {1})\".format(self.x, self.y)\n\n  def __eq__(self, other):\n    return self.x == other.x and self.y == other.y\n\nclass Polygon:\n\n  def __init__(self, vertices):\n    self.vertices = vertices # Tuple of Coordinate objects\n\n  def point_in_polygon(self, point, count_border):\n    \"\"\"\n    Takes in a Coordinate and returns True if this point is within this\n    polygon, False otherwise. The count_border flag indicates whether we count the\n    point inside the polygon if it is on the border.\n    Taken from\n    http://stackoverflow.com/questions/217578/point-in-polygon-aka-hit-test\n    \"\"\"\n    if count_border:\n      edges = self.get_edges()\n      for e in edges:\n        if point_on_line_segment(e[0], e[1], point):\n          return True\n    j = len(self.vertices) - 1\n    c = False\n    for i in range(len(self.vertices)):\n      if ( ((self.vertices[i].y > point.y) != (self.vertices[j].y > point.y)) \\\n          and (point.x < (self.vertices[j].x - self.vertices[i].x) * \\\n          (point.y - self.vertices[i].y) / (self.vertices[j].y - \\\n          self.vertices[i].y) + self.vertices[i].x) ):\n        c = not c\n      j = i\n\n    return c\n\n  def get_edges(self):\n    return [(self.vertices[0], self.vertices[1]),\n            (self.vertices[1], self.vertices[2]),\n            (self.vertices[2], self.vertices[3]),\n            (self.vertices[3], self.vertices[0])]\n\n\ndef ccw(a, b, c):\n  return (c.y-a.y) * (b.x-a.x) > (b.y-a.y) * (c.x-a.x)\n\ndef line_intersection(a, b, c, d):\n  return ccw(a,c,d) != ccw(b,c,d) and ccw(a,b,c) != ccw(a,b,d)\n\n\ndef point_on_line_segment(a, b, c):\n  \"\"\"\n  a and b are Coordinates defining the line segment, c is the point to be\n  tested, returns True if c is on the line segment.\n  Taken from\n  http://stackoverflow.com/questions/328107/how-can-you-determine-a-point-is-between-two-other-points-on-a-line-segment\n  \"\"\"\n  epsilon = .0000001\n  cross_product = (c.y - a.y) * (b.x - a.x) - (c.x - a.x) * (b.y - a.y)\n  if abs(cross_product) > epsilon:\n    return False   # (or != 0 if using integers)\n\n  dot_product = (c.x - a.x) * (b.x - a.x) + (c.y - a.y)*(b.y - a.y)\n  if dot_product < 0:\n    return False\n\n  squared_length_ba = (b.x - a.x)*(b.x - a.x) + (b.y - a.y)*(b.y - a.y)\n  if dot_product > squared_length_ba:\n    return False\n\n  return True\n\n\ncoords = map(int, raw_input().split())\na = Coordinate(coords[0], coords[1])\nb = Coordinate(coords[2], coords[3])\nc = Coordinate(coords[4], coords[5])\nd = Coordinate(coords[6], coords[7])\nsquare_a = Polygon((a, b, c, d))\n\ncoords = map(int, raw_input().split())\ne = Coordinate(coords[0], coords[1])\nf = Coordinate(coords[2], coords[3])\ng = Coordinate(coords[4], coords[5])\nh = Coordinate(coords[6], coords[7])\n\nsquare_b = Polygon((e, f, g, h))\nfor p in square_a.vertices:\n  if square_b.point_in_polygon(p, True):\n    print \"YES\"\n    sys.exit(0)\nfor p in square_b.vertices:\n  if square_a.point_in_polygon(p, True):\n    print \"YES\"\n    sys.exit(0)\n\nfor i in range(len(square_a.vertices)):\n  for j in range(len(square_b.vertices)):\n    if square_a.vertices[i] == square_b.vertices[j]:\n      print \"YES\"\n      sys.exit(0)\n    if line_intersection(square_a.vertices[i], square_a.vertices[(i + 1) % 4],\n        square_b.vertices[j], square_b.vertices[(j + 1) % 4]):\n      print \"YES\"\n      sys.exit(0)\nprint \"NO\"\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "a3e0dbb45ecc859d561e47e5baa76650", "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "s=map(int, raw_input().split())\nl=s.pop()\nan=((l+1)*(l+2)*(l+3))/6\nfor i in range(l+1):\n    for j in s:\n        x = min(j+j-sum(s)+i, l-i)\n        if x>=0: an -= ((x+1)*(x+2))/2\nprint an", "lang_cluster": "Python", "tags": ["math", "implementation", "combinatorics"], "code_uid": "c2b56f022c8aefbcbe16849e5b970c9e", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def main():\n    a, b, c, l = map(int, raw_input().split())\n    ans = 0\n    p = -(c - a - b)\n    q = b - a - c\n    f = [1] * 600010\n    for i in xrange(1, 600010):\n        f[i] = f[i-1] + i / 2 + 1\n    def go(v):\n        if 0 >= p > q:\n            x = f[v + p - 1] if v + p - 1 >= 0 else 0\n            y = f[v + q] if v + q >= 0 else 0\n            return x - y\n        elif p > q >= 0:\n            x = f[v - q - 1] if v - q - 1 >= 0 else 0\n            y = f[v - p] if v - p >= 0 else 0\n            return x - y\n        else:\n            x = f[v - p] if v - p >= 0 else 0\n            y = f[v + q] if v + q >= 0 else 0\n            return (v + 1) * (v + 2) / 2 - x - y\n    for i in xrange(l + 1):\n        if a + i >= b + c + l - i:\n            break\n        t = l - i\n        u = a + i - b - c\n        p = -(c - a - i - b)\n        q = b - a - i - c\n        if p <= q or u >= t:\n            continue\n        ans += go(t)\n        if u >= 0:\n            ans -= go(u)\n    print ans\nmain()\n", "lang_cluster": "Python", "tags": ["math", "implementation", "combinatorics"], "code_uid": "4973a5eb889953a65d7af3a5d588a76e", "src_uid": "185ff90a8b0ae0e2b75605f772589410", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\r\npin = sys.stdin.readline\r\n\r\nN = int(pin())\r\nD = {\r\n    \"1 0 0 1 0\": \"a\",\r\n    \"1 1 0 2 0\": \"b\",\r\n    \"2 0 0 1 1\": \"c\",\r\n    \"2 1 0 1 2\": \"d\",\r\n    \"1 1 0 1 1\": \"e\",\r\n    \"2 1 0 2 1\": \"f\",\r\n    \"2 2 0 2 2\": \"g\",\r\n    \"1 2 0 2 1\": \"h\",\r\n    \"1 2 0 1 2\": \"j\",\r\n    \"1 0 1 2 0\": \"k\",\r\n    \"1 1 1 3 0\": \"l\",\r\n    \"2 0 1 2 1\": \"m\",\r\n    \"2 1 1 2 2\": \"n\",\r\n    \"1 1 1 2 1\": \"o\",\r\n    \"2 1 1 3 1\": \"p\",\r\n    \"2 2 1 3 2\": \"q\",\r\n    \"1 2 1 3 1\": \"r\",\r\n    \"1 2 1 2 2\": \"t\",\r\n    \"1 0 2 2 1\": \"u\",\r\n    \"1 1 2 3 1\": \"v\",\r\n    \"1 2 1 1 3\": \"w\",\r\n    \"2 0 2 2 2\": \"x\",\r\n    \"2 1 2 2 3\": \"y\",\r\n    \"1 1 2 2 2\": \"z\"\r\n}\r\nL = [D[pin().strip()] for _ in range(N)]\r\nprint(''.join(L))", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "ba5cdd27ff32f6aae921d4bfa846f6fe", "src_uid": "a3603f5ed0d8bdb7fe829342991b78e6", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "a=['10010','11020','20011','21012','11011','21021','22022','12021','00000','12012','10120','11130','20121','21122','11121','21131','22132','12131','11111','12122','10221','11231','12113','20222','21223','11222']\r\nn=int(input())\r\nfor i in range(n):\r\n    s=input().replace(' ','')\r\n    print(chr(97+a.index(s)),end='')", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "3e28f65da2ecb4ae0244e2dc422bcbdd", "src_uid": "a3603f5ed0d8bdb7fe829342991b78e6", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def check(s, i):\r\n  if i == len(s):\r\n    x = ''.join(s)\r\n    if x[0] == '0' and x != '0':\r\n      return 0\r\n    if int(x)%25 == 0:\r\n      return 1\r\n    return 0\r\n  res = 0\r\n  if s[i] == '_':\r\n    if i != 0 and i<len(s)-2:\r\n      s[i] = '1'\r\n      res += 10*check(s, i+1)\r\n    else:\r\n      for j in range(10):\r\n        s[i] = str(j)\r\n        res += check(s, i+1)\r\n    s[i] = '_'\r\n    return res\r\n  else:\r\n    return check(s, i+1)\r\n \r\n \r\ninp = input()\r\ntotal = 0\r\nif 'X' in inp:\r\n  for i in range(10):\r\n    s = inp\r\n    s = s.replace('X', str(i))\r\n    total += check(list(s), 0)\r\nelse: total = check(list(inp), 0)\r\n \r\nprint(total)\r\n", "lang_cluster": "Python", "tags": ["brute force", "dp", "dfs and similar"], "code_uid": "f523fa88725a35feb9b07051c9e654aa", "src_uid": "4a905f419550a6c839992b40f1617af3", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def check(s, num):\n    if len(s) != len(num):\n        return False\n    x = -1\n    for j in range(len(s)):\n        if s[j] == '_':\n            continue\n        if s[j] == 'X':\n            if x == -1:\n                x = num[j]\n                continue\n            else:\n                if x != num[j]:\n                    return False\n                else:\n                    continue\n        if s[j] != num[j]:\n            return False\n    return True\n\n\nif __name__ == '__main__':\n    s = str(input())\n    tot = 0\n    for i in range(0, 10**8, 25):\n        i = str(i)\n        if len(i) > len(s):\n            break\n        if check(str(s), i):\n            tot += 1\n    print(tot)\n", "lang_cluster": "Python", "tags": ["brute force", "dp", "dfs and similar"], "code_uid": "7b6d4ac70cc3c0050ae2b02769b30547", "src_uid": "4a905f419550a6c839992b40f1617af3", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\ndisjointSet = [-1] * n\ndef root(x, level=200):\n    dp = []\n    while disjointSet[x] >= 0:\n        dp.append(x)\n        x = disjointSet[x]\n    for i in dp:\n        disjointSet[i] = x\n    return x\n\ndef join(x, y):\n    r1, r2 = root(x), root(y)\n    if r1 == r2:\n        return\n    disjointSet[r2] = r1\n\npoints = []\nvertPoints = {}\nhorizPoints = {}\nfor i in range(n):\n    a, b = map(int,raw_input().split())\n    points.append((a, b))\n    if a in vertPoints:\n        join(i, vertPoints[a])\n    else:\n        vertPoints[a] = i\n    if b in horizPoints:\n        join(i, horizPoints[b])\n    else:\n        horizPoints[b] = i\n        \nsets = {}\nfor i in range(n):\n    r = root(i)\n    if r in sets:\n        sets[r].append(points[i])\n    else:\n        sets[r] = [points[i]]\n\nans = 1\nfor i in sets:\n    s = sets[i]\n    horiz = [x for x,y in s]\n    vert = [y for x,y in s]\n    tmp = len(set(horiz)) + len(set(vert))\n    if tmp <= len(s):\n        ans *= 2 ** tmp\n    else:\n        ans *= 2 ** tmp - 1\n    ans %= 10 ** 9 + 7\n\nprint(ans % (10 ** 9 + 7))", "lang_cluster": "Python", "tags": ["dsu", "graphs", "trees", "dfs and similar"], "code_uid": "da31754812367ec2e02ca78a6382cc1f", "src_uid": "8781003d9eea51a509145bc6db8b609c", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\nfrom math import *\n\ndef minp():\n\treturn sys.stdin.readline().strip()\n\ndef mint():\n\treturn int(minp())\n\ndef mints():\n\treturn map(int, minp().split())\n\nn = mint()\np = [0]*n\nx = dict()\ny = dict()\nfor i in range(n):\n\ta = tuple(mints())\n\tp[i] = a\n\tif a[0] in x:\n\t\tx[a[0]].append(i)\n\telse:\n\t\tx[a[0]] = [i]\n\tif a[1] in y:\n\t\ty[a[1]].append(i)\n\telse:\n\t\ty[a[1]] = [i]\n\ndel(pow)\nr = 1\nq = [0]*n\nw = [True]*n\nql = 0\nqr = 0\nfor i in range(n):\n\tif w[i]:\n\t\tw[i] = False\n\t\tq[qr] = i\n\t\tqr += 1\n\t\tqlb = ql\n\t\te = 0\n\t\txs = set()\n\t\tys = set()\n\t\twhile ql < qr:\n\t\t\tv = q[ql]\n\t\t\tql += 1\n\t\t\ta = p[v]\n\t\t\tif a[0] not in xs:\n\t\t\t\txs.add(a[0])\n\t\t\t\te -= 1\n\t\t\t\tfor u in x[a[0]]:\n\t\t\t\t\te += 1\n\t\t\t\t\tif w[u]:\n\t\t\t\t\t\tw[u] = False\n\t\t\t\t\t\tq[qr] = u\n\t\t\t\t\t\tqr += 1\n\t\t\tif a[1] not in ys:\n\t\t\t\tys.add(a[1])\n\t\t\t\te -= 1\n\t\t\t\tfor u in y[a[1]]:\n\t\t\t\t\te += 1\n\t\t\t\t\tif w[u]:\n\t\t\t\t\t\tw[u] = False\n\t\t\t\t\t\tq[qr] = u\n\t\t\t\t\t\tqr += 1\n\t\tvc = ql-qlb\n\t\t#print(vc,e,vc-1)\n\t\tif vc-1 == e:\n\t\t\tr = (r*(pow(2,vc+1,1000000007)-1))%1000000007\n\t\telse:\n\t\t\tr = (r*(pow(2,len(xs)+len(ys),1000000007)))%1000000007\nprint(r)", "lang_cluster": "Python", "tags": ["dsu", "graphs", "trees", "dfs and similar"], "code_uid": "81635c25f233d31258b831312c4d2c50", "src_uid": "8781003d9eea51a509145bc6db8b609c", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\ndisjointSet = [-1] * n\ndef root(x, level=200):\n    dp = []\n    while disjointSet[x] >= 0:\n        dp.append(x)\n        x = disjointSet[x]\n    for i in dp:\n        disjointSet[i] = x\n    return x\n\ndef join(x, y):\n    r1, r2 = root(x), root(y)\n    if r1 == r2:\n        return\n    disjointSet[r2] = r1\n\npoints = []\nvertPoints = {}\nhorizPoints = {}\nfor i in range(n):\n    a, b = map(int, input().split())\n    points.append((a, b))\n    if a in vertPoints:\n        join(i, vertPoints[a])\n    else:\n        vertPoints[a] = i\n    if b in horizPoints:\n        join(i, horizPoints[b])\n    else:\n        horizPoints[b] = i\n        \nsets = {}\nfor i in range(n):\n    r = root(i)\n    if r in sets:\n        sets[r].append(points[i])\n    else:\n        sets[r] = [points[i]]\n\nans = 1\nfor i in sets:\n    s = sets[i]\n    horiz = [x for x,y in s]\n    vert = [y for x,y in s]\n    tmp = len(set(horiz)) + len(set(vert))\n    if tmp <= len(s):\n        ans *= 2 ** tmp\n    else:\n        ans *= 2 ** tmp - 1\n    ans %= 10 ** 9 + 7\n\nprint(ans % (10 ** 9 + 7))", "lang_cluster": "Python", "tags": ["dsu", "graphs", "trees", "dfs and similar"], "code_uid": "557e16b08da142c17059d274d5fbda7d", "src_uid": "8781003d9eea51a509145bc6db8b609c", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom math import *\n\ndef pro():\n\treturn sys.stdin.readline().strip()\n\ndef rop():\n\treturn map(int, pro().split())\n\nz = int(pro())\nqwe = 1000000007\na = [0] * z\nx = {}\ny = {}\nfor i in range(z):\n\ts = tuple(rop())\n\ta[i] = s\n\tif s[0] in x:\n\t\tx[s[0]].append(i)\n\telse:\n\t\tx[s[0]] = [i]\n\tif s[1] in y:\n\t\ty[s[1]].append(i)\n\telse:\n\t\ty[s[1]] = [i]\n\ndel(pow)\nr = 1\nq = [0] * z\nw = [True] * z\no = 0\npo = 0\nfor i in range(z):\n\tif w[i]:\n\t\tw[i] = False\n\t\tq[po] = i\n\t\tpo += 1\n\t\tpoi = o\n\t\te = 0\n\t\txs = set()\n\t\tys = set()\n\t\twhile o < po:\n\t\t\tv = q[o]\n\t\t\to += 1\n\t\t\ts = a[v]\n\t\t\tif s[0] not in xs:\n\t\t\t\txs.add(s[0])\n\t\t\t\te -= 1\n\t\t\t\tfor u in x[s[0]]:\n\t\t\t\t\te += 1\n\t\t\t\t\tif w[u]:\n\t\t\t\t\t\tw[u] = False\n\t\t\t\t\t\tq[po] = u\n\t\t\t\t\t\tpo += 1\n\t\t\tif s[1] not in ys:\n\t\t\t\tys.add(s[1])\n\t\t\t\te -= 1\n\t\t\t\tfor u in y[s[1]]:\n\t\t\t\t\te += 1\n\t\t\t\t\tif w[u]:\n\t\t\t\t\t\tw[u] = False\n\t\t\t\t\t\tq[po] = u\n\t\t\t\t\t\tpo += 1\n\t\tvc = o - poi\n\t\tif vc - 1 == e:\n\t\t\tr = (r * (pow(2, vc + 1 , qwe) - 1)) % qwe\n\t\telse:\n\t\t\tr = (r * (pow(2, len(xs) + len(ys), qwe))) % qwe\nprint(r)", "lang_cluster": "Python", "tags": ["dsu", "graphs", "trees", "dfs and similar"], "code_uid": "3e982ab1da25e987b3f68d04045c01a1", "src_uid": "8781003d9eea51a509145bc6db8b609c", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\ndef phi(n):\n    res = n\n    for i in range(2, int(math.sqrt(n)) + 1):\n        if(n % i == 0):\n            while(n % i == 0):\n                n /= i\n            res -= res/i\n    if(n > 1):\n        res -= int(res / n)\n    return res\nn, k = map(int, input().split())\nres = n\nk = int((k + 1) / 2)\nwhile(res != 1 and k != 0):\n    res = phi(res)\n    k -= 1\nprint(\"{}\".format(int(res % (1e9 + 7))))", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "7a2b3e28eaede8997b0cb6e08de84131", "src_uid": "0591ade5f9a69afcbecd80402493f975", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, k = map(int, raw_input().split())\n\n\ndef euler(n):\n    res = n\n    i = 2\n    while i * i <= n:\n        if n % i == 0:\n            res = res / i * (i - 1)\n            while n % i == 0:\n                n /= i\n        i += 1\n    if n != 1:\n        res = res / n * (n - 1)\n    return res\n\n\nwhile k > 0 and n > 1:\n    if(k%2==1):\n        n = euler(n)\n    k-=1\nprint  n%1000000007\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "c4e9bed19ba2d2d2c72bcead43e224e0", "src_uid": "0591ade5f9a69afcbecd80402493f975", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import sqrt\r\n\r\ninp = lambda dtype: [dtype(x) for x in input().split()]\r\nceil1 = lambda a, b: (a + b - 1) // b\r\nadd = lambda a, b: (a + b) % mod\r\nmult = lambda a, b: (a * b) % mod\r\n\r\nn, mod = inp(int)\r\nmem, su = [0] * (n + 1), 1\r\nmem[1] = 1\r\n\r\nfor i in range(2, n + 1):\r\n    sq, cur = int(sqrt(i)) + 1, su\r\n\r\n    for f in range(2, sq):\r\n        cur = (cur + mem[i // f]) % mod\r\n\r\n    be = i\r\n    for j in range(1, i // sq + 1):\r\n        nxt = i // (j + 1)\r\n        cur = (cur + (be - nxt) * mem[j]) % mod\r\n        be = nxt\r\n\r\n    su = (su + cur) % mod\r\n    mem[i] = cur\r\nprint(mem[-1])\r\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "data structures", "number theory"], "code_uid": "4654f3150167f5b32996211dbeabe735", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "N, MOD = map(int, input().split())\r\nDP = [0] * N\r\nDP[0] = 1\r\nCum = [0] * (N + 1)\r\nCum[1] = 1\r\nfor i1 in range(1, N):\r\n    i2 = N - i1\r\n    Value = Cum[i1]\r\n    for j in range(2, N + 1):\r\n        if i2 * j > N: break\r\n        Value += Cum[N - i2 * j + 1] - Cum[max(0, N - i2 * j - j + 1)]\r\n        Value %= MOD\r\n    Cum[i1 + 1] += Cum[i1] + Value\r\n    Cum[i1 + 1] %= MOD\r\n    DP[i1] = Value\r\nprint(DP[-1])", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "data structures", "number theory"], "code_uid": "d3f5c70d578446e9e4d7aa7d23be74f9", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, M = map(int, input().split(' '))\r\n\r\nD = [[] for _ in range(n + 1)]\r\nfor d in range(2, n + 1):\r\n    for dst in range(2*d, n + 1, d):\r\n        D[dst].append(d)\r\n\r\n\r\nF = [None] * (n + 1)\r\nF[1] = 1\r\nF[2] = 2\r\nfor x in range(3, n + 1):\r\n    F[x] = (2 * F[x - 1] + F[x//(x - 1)]) % M\r\n    S = 0\r\n    for d in D[x]:\r\n        if 2 <= d <= x - 2:\r\n            S += F[x//d] - F[(x - 1)//d]\r\n    F[x] = (F[x] + S) % M\r\n\r\nprint(F[n] % M)", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "data structures", "number theory"], "code_uid": "5ce5f144fe1309ef1c4e6086e6e8e452", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\nimport sys\ninput=sys.stdin.readline #\u6587\u5b57\u5217\u5165\u529b\u306f\u3059\u308b\u306a\uff01\uff01\n\nn,m=map(int,input().split())\nmod=m\ndp=[0]*(n+3)\ndp[n]=1\nsdp=[0]*(n+3)\nsdp[n]=1\n\nfor x in range(n-1,0,-1):\n    dp[x]+=sdp[x+1]\n    dp[x]%=mod\n    z=2\n    while x*z<=n:\n        l=x*z\n        r=(x+1)*z-1\n        if r>n:r=n\n        dp[x]+=sdp[l]-sdp[r+1]\n        dp[x]%=mod\n        z+=1\n    sdp[x]=sdp[x+1]+dp[x]\n    sdp[x]%=mod\n\nprint(dp[1]%mod)\n\n\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "data structures", "number theory"], "code_uid": "263d532d679b16f0a5febe686d128e45", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import sqrt\r\n\r\ninp = lambda dtype: [dtype(x) for x in input().split()]\r\nceil1 = lambda a, b: (a + b - 1) // b\r\nadd = lambda a, b: (a + b) % mod\r\nmult = lambda a, b: (a * b) % mod\r\n\r\nn, mod = inp(int)\r\nmem, su = [0, 1], 1\r\n\r\nfor i in range(2, n + 1):\r\n    sq, cur = int(sqrt(i)) + 1, su\r\n\r\n    for f in range(2, sq):\r\n        cur = add(cur, mem[i // f])\r\n\r\n    be = i\r\n    for j in range(1, i // sq + 1):\r\n        nxt = i // (j + 1)\r\n        cur = add(cur, mult(be - nxt, mem[j]))\r\n        be = nxt\r\n\r\n    su = add(su, cur)\r\n    mem.append(cur)\r\nprint(mem[-1])\r\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "data structures", "number theory"], "code_uid": "8381cdd20838a58aa65eea8425d3172a", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = map(int, input().split())\r\ndp = [0] * (n + 2)\r\ns = [0] * (n + 2)\r\ndp[n] = 1\r\ns[n] = 1\r\nfor i in range(n-1, 0, -1):\r\n    dp[i] = s[i+1]\r\n    for j in range(2, n // i + 1):\r\n        # add sum from i*j to i*(j+1) - 1\r\n        # from cells divided by j\r\n        h = min(n + 1, (i + 1) * j)\r\n        dp[i] = (dp[i] + s[i * j] - s[h]) % m\r\n        # print(\"  i=\",i,\"j=\", j, \"h=\",h)\r\n    s[i] = (s[i+1] + dp[i]) % m\r\n    # print (\"i=\", i)\r\n    # print(\"dp:\", * dp)\r\n    # print(\"s:\", *s)\r\nprint(dp[1])\r\n\r\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "data structures", "number theory"], "code_uid": "866b31e3bde35afaa78d839452fa2c51", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "primes = []\r\nfor p in range(2, 6000):\r\n    is_prime = True\r\n    for p2 in primes:\r\n        if p2*p2 > p:\r\n            break\r\n        if p % p2==0:\r\n            is_prime = False\r\n            break\r\n    if is_prime:\r\n        primes.append(p)\r\n        \r\ndef factor(n):\r\n    d = {}\r\n    for p in primes:\r\n        if p*p > n:\r\n            break\r\n        if n % p==0:\r\n            c = 0\r\n            while n % p==0:\r\n                n = n//p\r\n                c+=1\r\n            d[p] = c\r\n    if n > 1:\r\n        d[n] = 1\r\n    return d\r\n\r\ndef factors(n):\r\n    d = factor(n)\r\n    answer = [1]\r\n    for p in d:\r\n        a2 = []\r\n        for x in answer:\r\n            for i in range(d[p]+1):\r\n                a2.append(x*p**i)\r\n        answer = a2\r\n    return answer\r\n        \r\n\r\ndef process(n, m):\r\n    f_dict = {0: 0, 1: 1, 2: 2}\r\n    for i in range(3, n+1):\r\n        f_dict[i] = 2*f_dict[i-1]\r\n        for x in factors(i):\r\n            if 2 <= x <= i:\r\n                f_dict[i] += f_dict[(i//x)]-f_dict[(i-1)//x]\r\n                f_dict[i] = f_dict[i] % m\r\n        f_dict[i] = f_dict[i] % m\r\n    return f_dict[n]\r\n\r\nn, m = [int(x) for x in input().split()]\r\nprint(process(n, m))", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "data structures", "number theory"], "code_uid": "25b0a2dbf444b8d4483bbf89f9f32446", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\r\nc = [0] * n + [1] + [0] * n\r\nfor i in range(n - 1, 0, -1):\r\n    c[i] = 2 * c[i + 1] % m\r\n    for j in range(2, n // i + 1):\r\n        c[i] = (c[i] + c[i * j] - c[(i + 1) * j]) % m\r\n\r\nprint((c[1] - c[2]) % m)", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "data structures", "number theory"], "code_uid": "33ec2f237d254ad540544503b2ce3ed2", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, M = map(int,input().split())\n \n\n\n\n\n \ndp = [0]*(n+1)\naccu = [0]*(n+1)\n \n \ndp[1] = 1\ndp[2] = 1\naccu[1] = 1\naccu[2] = 2\nextra = 0\n\n\n \nfor i in range(3,n+1):\n    dp[i] = accu[i-1] \n    for j in range(1,int(i**0.5)+1):\n        if i%j==0:\n            dp[i] += dp[j]\n            dp[i] = dp[i] % M\n            if j>1 and j*j<i:  \n                dp[i] += dp[i//j]\n                dp[i] = dp[i] % M\n    accu[i] = (accu[i-1] + dp[i])%M\n\n\n\n \n#print(dp)\n \n \n \nprint(accu[n])\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "data structures", "number theory"], "code_uid": "056fa1a8bb34b34d23ed73f466ef1d45", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "inp = lambda dtype: [dtype(x) for x in input().split()]\r\nceil1 = lambda a, b: (a + b - 1) // b\r\nadd = lambda a, b: (a + b) % mod\r\nmult = lambda a, b: (a * b) % mod\r\n\r\nn, mod = inp(int)\r\nmem, su = [0, 1], 1\r\n\r\nfor i in range(2, n + 1):\r\n    sq ,cur= int(i ** .5) + 1,su\r\n\r\n    for f in range(2, sq):\r\n        cur = add(cur, mem[i // f])\r\n\r\n    be = i\r\n    for j in range(1, i // sq + 1):\r\n        nxt = i // (j + 1)\r\n        cur = add(cur, mult(be - nxt, mem[j]))\r\n        be = nxt\r\n\r\n    su = add(su, cur)\r\n    mem.append(cur)\r\nprint(mem[-1])\r\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "data structures", "number theory"], "code_uid": "a63f1cab5959eb944250382a2d4ad458", "src_uid": "a524aa54e83fd0223489a19531bf0e79", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "q = int(input())\nlen_of_str = [0] * int(1e5)\nlen_of_str[0] = 75\nleft_part = 'What are you doing while sending \"'\nstart_str = 'What are you doing at the end of the world? Are you busy? Will you save us?'\nmid_part = '\"? Are you busy? Will you send \"'\nright_part = '\"?'\nleft_len = 34\nmid_len = 32\nright_len = 2\nans = ''\nfor i in range(1, int(1e5)):\n    len_of_str[i] = min(1e18, left_len + len_of_str[i - 1] + mid_len + len_of_str[i - 1] + right_len)\n    \nfor i in range(q): \n    n, k = map(int, input().split())\n    ind = k\n    while (n >= 0):\n        if n == 0 and ind > len_of_str[0]:\n            ans += '.'\n            break\n        elif n == 0:\n            ans += start_str[ind - 1]\n            break\n        #print(n, ind)\n        if ind <= left_len:\n            ans += left_part[ind - 1]\n            break\n        ind -= left_len\n        if ind <= len_of_str[n - 1]:\n            n -= 1\n            continue\n        ind -= len_of_str[n - 1]\n        if ind <= mid_len:\n            ans += mid_part[ind - 1]\n            break\n        ind -= mid_len\n        if ind <= len_of_str[n - 1]:\n            n -= 1\n            continue\n        ind -= len_of_str[n - 1]\n        if ind > 2:\n            ans += '.'\n        else:\n            ans += right_part[ind - 1]\n        break\n    #print('ans =', ans)\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "binary search", "combinatorics"], "code_uid": "44de4f3ce181c952226ba6dc9b98b3ff", "src_uid": "da09a893a33f2bf8fd00e321e16ab149", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def get_len(ind):\n    if ind > 63:\n        ind = 63\n    k = (1 << ind) - 1\n    return k * (len1 + len2 + len3) + (k + 1) * len_f0\nf0 = 'What are you doing at the end of the world? Are you busy? Will you save us?'\ns1 = 'What are you doing while sending \"'\ns2 = '\"? Are you busy? Will you send \"'\ns3 = '\"?'\nlen_f0 = len(f0)\nlen1 = len(s1)\nlen2 = len(s2)\nlen3 = len(s3)\nq = int(input())\nfor i in range(q):\n    n, k = map(int, input().split())\n    k -= 1\n    l = 0; ind = n - 1\n    while True:\n        if k < l + len_f0 and ind == -1:\n            print(f0[k - l], end='')\n            break\n        elif k < l + len1:\n            print(s1[k - l], end='')\n            break\n        elif ind >= 0 and k < l + len1 + get_len(ind):\n            l += len1\n            ind = ind - 1\n        elif ind >= 0 and k < l + len1 + get_len(ind) + len2:\n            print(s2[k - l - len1 - get_len(ind)], end='')\n            break\n        elif ind >= 0 and k < l + len1 + get_len(ind) + len2 + get_len(ind):\n            l += len1 + get_len(ind) + len2\n            ind = ind - 1\n        elif ind >= 0 and k < l + len1 + get_len(ind) + len2 + get_len(ind) + len3:\n            print(s3[k - l - len1 - get_len(ind) - len2 - get_len(ind)], end='')\n            break\n        else:\n            print('.', end='')\n            break\n", "lang_cluster": "Python", "tags": ["math", "binary search", "combinatorics"], "code_uid": "368edeee38f885aa2400e779434c5f7a", "src_uid": "da09a893a33f2bf8fd00e321e16ab149", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "t, s = [raw_input().replace('6', '9').replace('2', '5') for i in range(2)]\nprint min([s.count(i)/t.count(i) for i in t])\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "ed2c48a6e0e49dc202d63ebb23452626", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "'''\nCreated on Jul 13, 2013\n\n@author: ahmedhamza\n'''\n\ndef zabat(s):\n    s = s.replace('9', '6')\n    s = s.replace('5', '2')\n    c1 = [0 for row in range(10)]\n    for c in s:\n        c1[ord(c) - ord('0')] = c1[ord(c) - ord('0')] + 1\n    return c1\nt = raw_input()\ns = raw_input()\nt = t.replace('9', '6')\nt = t.replace('5', '2')\nc1 = zabat(t)\nc2 = zabat(s)\n\nmx = 1000000000\nind = -1\nfor c in t:\n    #print str(c2[ord(c) - ord('0')]) + ' ' + str(c1[ord(c) - ord('0')])\n    mx = min(mx, c2[ord(c) - ord('0')] // c1[ord(c) - ord('0')])\nprint mx\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "473bcc6d0bf2b6d4be6427861f14ae7b", "src_uid": "72a196044787cb8dbd8d350cb60ccc32", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def pr(x):\n    d = 2\n    while d * d <= x:\n        if x % d == 0:\n            return 0\n        d += 1\n    return 1\n\ndef cnt(n, k):\n    if not pr(k) or n < k: return 0\n    n1 = n // k\n    return n1 - sum(cnt(n1, i) for i in range(2, min(k, n1 + 1)))\n    \na, b, k = map(int, input().split())\nans = cnt(b, k) - cnt(a - 1, k)\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "dp", "number theory"], "code_uid": "fcb030eb1ce0a74c25940c276985441c", "src_uid": "04a26f1d1013b6e6b4b0bdcf225475f2", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/python\nimport math\n\nprimes = [\n        2, 3, 5, 7, 11, 13, 17, 19, 23, 29, \n     31, 37, 41, 43, 47, 53, 59, 61, 67, 71, \n     73, 79, 83, 89, 97, 101, 103, 107, 109, 113, \n    127, 131, 137, 139, 149, 151, 157, 163, 167, 173, \n    179, 181, 191, 193, 197, 199, 211, 223, 227, 229, \n    233, 239, 241, 251, 257, 263, 269, 271, 277, 281, \n    283, 293, 307, 311, 313, 317, 331, 337, 347, 349, \n    353, 359, 367, 373, 379, 383, 389, 397, 401, 409, \n    419, 421, 431, 433, 439, 443, 449, 457, 461, 463, \n    467, 479, 487, 491, 499, 503, 509, 521, 523, 541, \n    547, 557, 563, 569, 571, 577, 587, 593, 599, 601, \n    607, 613, 617, 619, 631, 641, 643, 647, 653, 659, \n    661, 673, 677, 683, 691, 701, 709, 719, 727, 733, \n    739, 743, 751, 757, 761, 769, 773, 787, 797, 809, \n    811, 821, 823, 827, 829, 839, 853, 857, 859, 863, \n    877, 881, 883, 887, 907, 911, 919, 929, 937, 941, \n    947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, \n   1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, \n   1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, \n   1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, \n   1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, \n   1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, \n   1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, \n   1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, \n   1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, \n   1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, \n   1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, \n   1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, \n   1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, \n   1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, \n   1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, \n   2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, \n   2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, \n   2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, \n   2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, \n   2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, \n   2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, \n   2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, \n   2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, \n   2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, \n   2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, \n   2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, \n   2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, \n   3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, \n   3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, \n   3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, \n   3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, \n   3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, \n   3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, \n   3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, \n   3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, \n   3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, \n   3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, \n   3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, \n   3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, \n   4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, \n   4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, \n   4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, \n   4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, \n   4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, \n   4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, \n   4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, \n   4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, \n   4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, \n   4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, \n   4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, \n   4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, \n   5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, \n   5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, \n   5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, \n   5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, \n   5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, \n   5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, \n   5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, \n   5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, \n   5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, \n   5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, \n   5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, \n   5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, \n   6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, \n   6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, \n   6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, \n   6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, \n   6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, \n   6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, \n   6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, \n   6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, \n   6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, \n   6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, \n   6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, \n   7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, \n   7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, \n   7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, \n   7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, \n   7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, \n   7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, \n   7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, \n   7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, \n   7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, \n   7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, \n   7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, \n   8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, \n   8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, \n   8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, \n   8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, \n   8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, \n   8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, \n   8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, \n   8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, \n   8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, \n   8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, \n   8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, \n   9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, \n   9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, \n   9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283, \n   9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, \n   9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, \n   9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533, \n   9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631, \n   9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, \n   9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, \n   9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, \n   9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973, 10007, \n  10009, 10037, 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099, \n  10103, 10111, 10133, 10139, 10141, 10151, 10159, 10163, 10169, 10177, \n  10181, 10193, 10211, 10223, 10243, 10247, 10253, 10259, 10267, 10271, \n  10273, 10289, 10301, 10303, 10313, 10321, 10331, 10333, 10337, 10343, \n  10357, 10369, 10391, 10399, 10427, 10429, 10433, 10453, 10457, 10459, \n  10463, 10477, 10487, 10499, 10501, 10513, 10529, 10531, 10559, 10567, \n  10589, 10597, 10601, 10607, 10613, 10627, 10631, 10639, 10651, 10657, \n  10663, 10667, 10687, 10691, 10709, 10711, 10723, 10729, 10733, 10739, \n  10753, 10771, 10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859, \n  10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937, 10939, 10949, \n  10957, 10973, 10979, 10987, 10993, 11003, 11027, 11047, 11057, 11059, \n  11069, 11071, 11083, 11087, 11093, 11113, 11117, 11119, 11131, 11149, \n  11159, 11161, 11171, 11173, 11177, 11197, 11213, 11239, 11243, 11251, \n  11257, 11261, 11273, 11279, 11287, 11299, 11311, 11317, 11321, 11329, \n  11351, 11353, 11369, 11383, 11393, 11399, 11411, 11423, 11437, 11443, \n  11447, 11467, 11471, 11483, 11489, 11491, 11497, 11503, 11519, 11527, \n  11549, 11551, 11579, 11587, 11593, 11597, 11617, 11621, 11633, 11657, \n  11677, 11681, 11689, 11699, 11701, 11717, 11719, 11731, 11743, 11777, \n  11779, 11783, 11789, 11801, 11807, 11813, 11821, 11827, 11831, 11833, \n  11839, 11863, 11867, 11887, 11897, 11903, 11909, 11923, 11927, 11933, \n  11939, 11941, 11953, 11959, 11969, 11971, 11981, 11987, 12007, 12011, \n  12037, 12041, 12043, 12049, 12071, 12073, 12097, 12101, 12107, 12109, \n  12113, 12119, 12143, 12149, 12157, 12161, 12163, 12197, 12203, 12211, \n  12227, 12239, 12241, 12251, 12253, 12263, 12269, 12277, 12281, 12289, \n  12301, 12323, 12329, 12343, 12347, 12373, 12377, 12379, 12391, 12401, \n  12409, 12413, 12421, 12433, 12437, 12451, 12457, 12473, 12479, 12487, \n  12491, 12497, 12503, 12511, 12517, 12527, 12539, 12541, 12547, 12553, \n  12569, 12577, 12583, 12589, 12601, 12611, 12613, 12619, 12637, 12641, \n  12647, 12653, 12659, 12671, 12689, 12697, 12703, 12713, 12721, 12739, \n  12743, 12757, 12763, 12781, 12791, 12799, 12809, 12821, 12823, 12829, \n  12841, 12853, 12889, 12893, 12899, 12907, 12911, 12917, 12919, 12923, \n  12941, 12953, 12959, 12967, 12973, 12979, 12983, 13001, 13003, 13007, \n  13009, 13033, 13037, 13043, 13049, 13063, 13093, 13099, 13103, 13109, \n  13121, 13127, 13147, 13151, 13159, 13163, 13171, 13177, 13183, 13187, \n  13217, 13219, 13229, 13241, 13249, 13259, 13267, 13291, 13297, 13309, \n  13313, 13327, 13331, 13337, 13339, 13367, 13381, 13397, 13399, 13411, \n  13417, 13421, 13441, 13451, 13457, 13463, 13469, 13477, 13487, 13499, \n  13513, 13523, 13537, 13553, 13567, 13577, 13591, 13597, 13613, 13619, \n  13627, 13633, 13649, 13669, 13679, 13681, 13687, 13691, 13693, 13697, \n  13709, 13711, 13721, 13723, 13729, 13751, 13757, 13759, 13763, 13781, \n  13789, 13799, 13807, 13829, 13831, 13841, 13859, 13873, 13877, 13879, \n  13883, 13901, 13903, 13907, 13913, 13921, 13931, 13933, 13963, 13967, \n  13997, 13999, 14009, 14011, 14029, 14033, 14051, 14057, 14071, 14081, \n  14083, 14087, 14107, 14143, 14149, 14153, 14159, 14173, 14177, 14197, \n  14207, 14221, 14243, 14249, 14251, 14281, 14293, 14303, 14321, 14323, \n  14327, 14341, 14347, 14369, 14387, 14389, 14401, 14407, 14411, 14419, \n  14423, 14431, 14437, 14447, 14449, 14461, 14479, 14489, 14503, 14519, \n  14533, 14537, 14543, 14549, 14551, 14557, 14561, 14563, 14591, 14593, \n  14621, 14627, 14629, 14633, 14639, 14653, 14657, 14669, 14683, 14699, \n  14713, 14717, 14723, 14731, 14737, 14741, 14747, 14753, 14759, 14767, \n  14771, 14779, 14783, 14797, 14813, 14821, 14827, 14831, 14843, 14851, \n  14867, 14869, 14879, 14887, 14891, 14897, 14923, 14929, 14939, 14947, \n  14951, 14957, 14969, 14983, 15013, 15017, 15031, 15053, 15061, 15073, \n  15077, 15083, 15091, 15101, 15107, 15121, 15131, 15137, 15139, 15149, \n  15161, 15173, 15187, 15193, 15199, 15217, 15227, 15233, 15241, 15259, \n  15263, 15269, 15271, 15277, 15287, 15289, 15299, 15307, 15313, 15319, \n  15329, 15331, 15349, 15359, 15361, 15373, 15377, 15383, 15391, 15401, \n  15413, 15427, 15439, 15443, 15451, 15461, 15467, 15473, 15493, 15497, \n  15511, 15527, 15541, 15551, 15559, 15569, 15581, 15583, 15601, 15607, \n  15619, 15629, 15641, 15643, 15647, 15649, 15661, 15667, 15671, 15679, \n  15683, 15727, 15731, 15733, 15737, 15739, 15749, 15761, 15767, 15773, \n  15787, 15791, 15797, 15803, 15809, 15817, 15823, 15859, 15877, 15881, \n  15887, 15889, 15901, 15907, 15913, 15919, 15923, 15937, 15959, 15971, \n  15973, 15991, 16001, 16007, 16033, 16057, 16061, 16063, 16067, 16069, \n  16073, 16087, 16091, 16097, 16103, 16111, 16127, 16139, 16141, 16183, \n  16187, 16189, 16193, 16217, 16223, 16229, 16231, 16249, 16253, 16267, \n  16273, 16301, 16319, 16333, 16339, 16349, 16361, 16363, 16369, 16381, \n  16411, 16417, 16421, 16427, 16433, 16447, 16451, 16453, 16477, 16481, \n  16487, 16493, 16519, 16529, 16547, 16553, 16561, 16567, 16573, 16603, \n  16607, 16619, 16631, 16633, 16649, 16651, 16657, 16661, 16673, 16691, \n  16693, 16699, 16703, 16729, 16741, 16747, 16759, 16763, 16787, 16811, \n  16823, 16829, 16831, 16843, 16871, 16879, 16883, 16889, 16901, 16903, \n  16921, 16927, 16931, 16937, 16943, 16963, 16979, 16981, 16987, 16993, \n  17011, 17021, 17027, 17029, 17033, 17041, 17047, 17053, 17077, 17093, \n  17099, 17107, 17117, 17123, 17137, 17159, 17167, 17183, 17189, 17191, \n  17203, 17207, 17209, 17231, 17239, 17257, 17291, 17293, 17299, 17317, \n  17321, 17327, 17333, 17341, 17351, 17359, 17377, 17383, 17387, 17389, \n  17393, 17401, 17417, 17419, 17431, 17443, 17449, 17467, 17471, 17477, \n  17483, 17489, 17491, 17497, 17509, 17519, 17539, 17551, 17569, 17573, \n  17579, 17581, 17597, 17599, 17609, 17623, 17627, 17657, 17659, 17669, \n  17681, 17683, 17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783, \n  17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863, 17881, 17891, \n  17903, 17909, 17911, 17921, 17923, 17929, 17939, 17957, 17959, 17971, \n  17977, 17981, 17987, 17989, 18013, 18041, 18043, 18047, 18049, 18059, \n  18061, 18077, 18089, 18097, 18119, 18121, 18127, 18131, 18133, 18143, \n  18149, 18169, 18181, 18191, 18199, 18211, 18217, 18223, 18229, 18233, \n  18251, 18253, 18257, 18269, 18287, 18289, 18301, 18307, 18311, 18313, \n  18329, 18341, 18353, 18367, 18371, 18379, 18397, 18401, 18413, 18427, \n  18433, 18439, 18443, 18451, 18457, 18461, 18481, 18493, 18503, 18517, \n  18521, 18523, 18539, 18541, 18553, 18583, 18587, 18593, 18617, 18637, \n  18661, 18671, 18679, 18691, 18701, 18713, 18719, 18731, 18743, 18749, \n  18757, 18773, 18787, 18793, 18797, 18803, 18839, 18859, 18869, 18899, \n  18911, 18913, 18917, 18919, 18947, 18959, 18973, 18979, 19001, 19009, \n  19013, 19031, 19037, 19051, 19069, 19073, 19079, 19081, 19087, 19121, \n  19139, 19141, 19157, 19163, 19181, 19183, 19207, 19211, 19213, 19219, \n  19231, 19237, 19249, 19259, 19267, 19273, 19289, 19301, 19309, 19319, \n  19333, 19373, 19379, 19381, 19387, 19391, 19403, 19417, 19421, 19423, \n  19427, 19429, 19433, 19441, 19447, 19457, 19463, 19469, 19471, 19477, \n  19483, 19489, 19501, 19507, 19531, 19541, 19543, 19553, 19559, 19571, \n  19577, 19583, 19597, 19603, 19609, 19661, 19681, 19687, 19697, 19699, \n  19709, 19717, 19727, 19739, 19751, 19753, 19759, 19763, 19777, 19793, \n  19801, 19813, 19819, 19841, 19843, 19853, 19861, 19867, 19889, 19891, \n  19913, 19919, 19927, 19937, 19949, 19961, 19963, 19973, 19979, 19991, \n  19993, 19997, 20011, 20021, 20023, 20029, 20047, 20051, 20063, 20071, \n  20089, 20101, 20107, 20113, 20117, 20123, 20129, 20143, 20147, 20149, \n  20161, 20173, 20177, 20183, 20201, 20219, 20231, 20233, 20249, 20261, \n  20269, 20287, 20297, 20323, 20327, 20333, 20341, 20347, 20353, 20357, \n  20359, 20369, 20389, 20393, 20399, 20407, 20411, 20431, 20441, 20443, \n  20477, 20479, 20483, 20507, 20509, 20521, 20533, 20543, 20549, 20551, \n  20563, 20593, 20599, 20611, 20627, 20639, 20641, 20663, 20681, 20693, \n  20707, 20717, 20719, 20731, 20743, 20747, 20749, 20753, 20759, 20771, \n  20773, 20789, 20807, 20809, 20849, 20857, 20873, 20879, 20887, 20897, \n  20899, 20903, 20921, 20929, 20939, 20947, 20959, 20963, 20981, 20983, \n  21001, 21011, 21013, 21017, 21019, 21023, 21031, 21059, 21061, 21067, \n  21089, 21101, 21107, 21121, 21139, 21143, 21149, 21157, 21163, 21169, \n  21179, 21187, 21191, 21193, 21211, 21221, 21227, 21247, 21269, 21277, \n  21283, 21313, 21317, 21319, 21323, 21341, 21347, 21377, 21379, 21383, \n  21391, 21397, 21401, 21407, 21419, 21433, 21467, 21481, 21487, 21491, \n  21493, 21499, 21503, 21517, 21521, 21523, 21529, 21557, 21559, 21563, \n  21569, 21577, 21587, 21589, 21599, 21601, 21611, 21613, 21617, 21647, \n  21649, 21661, 21673, 21683, 21701, 21713, 21727, 21737, 21739, 21751, \n  21757, 21767, 21773, 21787, 21799, 21803, 21817, 21821, 21839, 21841, \n  21851, 21859, 21863, 21871, 21881, 21893, 21911, 21929, 21937, 21943, \n  21961, 21977, 21991, 21997, 22003, 22013, 22027, 22031, 22037, 22039, \n  22051, 22063, 22067, 22073, 22079, 22091, 22093, 22109, 22111, 22123, \n  22129, 22133, 22147, 22153, 22157, 22159, 22171, 22189, 22193, 22229, \n  22247, 22259, 22271, 22273, 22277, 22279, 22283, 22291, 22303, 22307, \n  22343, 22349, 22367, 22369, 22381, 22391, 22397, 22409, 22433, 22441, \n  22447, 22453, 22469, 22481, 22483, 22501, 22511, 22531, 22541, 22543, \n  22549, 22567, 22571, 22573, 22613, 22619, 22621, 22637, 22639, 22643, \n  22651, 22669, 22679, 22691, 22697, 22699, 22709, 22717, 22721, 22727, \n  22739, 22741, 22751, 22769, 22777, 22783, 22787, 22807, 22811, 22817, \n  22853, 22859, 22861, 22871, 22877, 22901, 22907, 22921, 22937, 22943, \n  22961, 22963, 22973, 22993, 23003, 23011, 23017, 23021, 23027, 23029, \n  23039, 23041, 23053, 23057, 23059, 23063, 23071, 23081, 23087, 23099, \n  23117, 23131, 23143, 23159, 23167, 23173, 23189, 23197, 23201, 23203, \n  23209, 23227, 23251, 23269, 23279, 23291, 23293, 23297, 23311, 23321, \n  23327, 23333, 23339, 23357, 23369, 23371, 23399, 23417, 23431, 23447, \n  23459, 23473, 23497, 23509, 23531, 23537, 23539, 23549, 23557, 23561, \n  23563, 23567, 23581, 23593, 23599, 23603, 23609, 23623, 23627, 23629, \n  23633, 23663, 23669, 23671, 23677, 23687, 23689, 23719, 23741, 23743, \n  23747, 23753, 23761, 23767, 23773, 23789, 23801, 23813, 23819, 23827, \n  23831, 23833, 23857, 23869, 23873, 23879, 23887, 23893, 23899, 23909, \n  23911, 23917, 23929, 23957, 23971, 23977, 23981, 23993, 24001, 24007, \n  24019, 24023, 24029, 24043, 24049, 24061, 24071, 24077, 24083, 24091, \n  24097, 24103, 24107, 24109, 24113, 24121, 24133, 24137, 24151, 24169, \n  24179, 24181, 24197, 24203, 24223, 24229, 24239, 24247, 24251, 24281, \n  24317, 24329, 24337, 24359, 24371, 24373, 24379, 24391, 24407, 24413, \n  24419, 24421, 24439, 24443, 24469, 24473, 24481, 24499, 24509, 24517, \n  24527, 24533, 24547, 24551, 24571, 24593, 24611, 24623, 24631, 24659, \n  24671, 24677, 24683, 24691, 24697, 24709, 24733, 24749, 24763, 24767, \n  24781, 24793, 24799, 24809, 24821, 24841, 24847, 24851, 24859, 24877, \n  24889, 24907, 24917, 24919, 24923, 24943, 24953, 24967, 24971, 24977, \n  24979, 24989, 25013, 25031, 25033, 25037, 25057, 25073, 25087, 25097, \n  25111, 25117, 25121, 25127, 25147, 25153, 25163, 25169, 25171, 25183, \n  25189, 25219, 25229, 25237, 25243, 25247, 25253, 25261, 25301, 25303, \n  25307, 25309, 25321, 25339, 25343, 25349, 25357, 25367, 25373, 25391, \n  25409, 25411, 25423, 25439, 25447, 25453, 25457, 25463, 25469, 25471, \n  25523, 25537, 25541, 25561, 25577, 25579, 25583, 25589, 25601, 25603, \n  25609, 25621, 25633, 25639, 25643, 25657, 25667, 25673, 25679, 25693, \n  25703, 25717, 25733, 25741, 25747, 25759, 25763, 25771, 25793, 25799, \n  25801, 25819, 25841, 25847, 25849, 25867, 25873, 25889, 25903, 25913, \n  25919, 25931, 25933, 25939, 25943, 25951, 25969, 25981, 25997, 25999, \n  26003, 26017, 26021, 26029, 26041, 26053, 26083, 26099, 26107, 26111, \n  26113, 26119, 26141, 26153, 26161, 26171, 26177, 26183, 26189, 26203, \n  26209, 26227, 26237, 26249, 26251, 26261, 26263, 26267, 26293, 26297, \n  26309, 26317, 26321, 26339, 26347, 26357, 26371, 26387, 26393, 26399, \n  26407, 26417, 26423, 26431, 26437, 26449, 26459, 26479, 26489, 26497, \n  26501, 26513, 26539, 26557, 26561, 26573, 26591, 26597, 26627, 26633, \n  26641, 26647, 26669, 26681, 26683, 26687, 26693, 26699, 26701, 26711, \n  26713, 26717, 26723, 26729, 26731, 26737, 26759, 26777, 26783, 26801, \n  26813, 26821, 26833, 26839, 26849, 26861, 26863, 26879, 26881, 26891, \n  26893, 26903, 26921, 26927, 26947, 26951, 26953, 26959, 26981, 26987, \n  26993, 27011, 27017, 27031, 27043, 27059, 27061, 27067, 27073, 27077, \n  27091, 27103, 27107, 27109, 27127, 27143, 27179, 27191, 27197, 27211, \n  27239, 27241, 27253, 27259, 27271, 27277, 27281, 27283, 27299, 27329, \n  27337, 27361, 27367, 27397, 27407, 27409, 27427, 27431, 27437, 27449, \n  27457, 27479, 27481, 27487, 27509, 27527, 27529, 27539, 27541, 27551, \n  27581, 27583, 27611, 27617, 27631, 27647, 27653, 27673, 27689, 27691, \n  27697, 27701, 27733, 27737, 27739, 27743, 27749, 27751, 27763, 27767, \n  27773, 27779, 27791, 27793, 27799, 27803, 27809, 27817, 27823, 27827, \n  27847, 27851, 27883, 27893, 27901, 27917, 27919, 27941, 27943, 27947, \n  27953, 27961, 27967, 27983, 27997, 28001, 28019, 28027, 28031, 28051, \n  28057, 28069, 28081, 28087, 28097, 28099, 28109, 28111, 28123, 28151, \n  28163, 28181, 28183, 28201, 28211, 28219, 28229, 28277, 28279, 28283, \n  28289, 28297, 28307, 28309, 28319, 28349, 28351, 28387, 28393, 28403, \n  28409, 28411, 28429, 28433, 28439, 28447, 28463, 28477, 28493, 28499, \n  28513, 28517, 28537, 28541, 28547, 28549, 28559, 28571, 28573, 28579, \n  28591, 28597, 28603, 28607, 28619, 28621, 28627, 28631, 28643, 28649, \n  28657, 28661, 28663, 28669, 28687, 28697, 28703, 28711, 28723, 28729, \n  28751, 28753, 28759, 28771, 28789, 28793, 28807, 28813, 28817, 28837, \n  28843, 28859, 28867, 28871, 28879, 28901, 28909, 28921, 28927, 28933, \n  28949, 28961, 28979, 29009, 29017, 29021, 29023, 29027, 29033, 29059, \n  29063, 29077, 29101, 29123, 29129, 29131, 29137, 29147, 29153, 29167, \n  29173, 29179, 29191, 29201, 29207, 29209, 29221, 29231, 29243, 29251, \n  29269, 29287, 29297, 29303, 29311, 29327, 29333, 29339, 29347, 29363, \n  29383, 29387, 29389, 29399, 29401, 29411, 29423, 29429, 29437, 29443, \n  29453, 29473, 29483, 29501, 29527, 29531, 29537, 29567, 29569, 29573, \n  29581, 29587, 29599, 29611, 29629, 29633, 29641, 29663, 29669, 29671, \n  29683, 29717, 29723, 29741, 29753, 29759, 29761, 29789, 29803, 29819, \n  29833, 29837, 29851, 29863, 29867, 29873, 29879, 29881, 29917, 29921, \n  29927, 29947, 29959, 29983, 29989, 30011, 30013, 30029, 30047, 30059, \n  30071, 30089, 30091, 30097, 30103, 30109, 30113, 30119, 30133, 30137, \n  30139, 30161, 30169, 30181, 30187, 30197, 30203, 30211, 30223, 30241, \n  30253, 30259, 30269, 30271, 30293, 30307, 30313, 30319, 30323, 30341, \n  30347, 30367, 30389, 30391, 30403, 30427, 30431, 30449, 30467, 30469, \n  30491, 30493, 30497, 30509, 30517, 30529, 30539, 30553, 30557, 30559, \n  30577, 30593, 30631, 30637, 30643, 30649, 30661, 30671, 30677, 30689, \n  30697, 30703, 30707, 30713, 30727, 30757, 30763, 30773, 30781, 30803, \n  30809, 30817, 30829, 30839, 30841, 30851, 30853, 30859, 30869, 30871, \n  30881, 30893, 30911, 30931, 30937, 30941, 30949, 30971, 30977, 30983, \n  31013, 31019, 31033, 31039, 31051, 31063, 31069, 31079, 31081, 31091, \n  31121, 31123, 31139, 31147, 31151, 31153, 31159, 31177, 31181, 31183, \n  31189, 31193, 31219, 31223, 31231, 31237, 31247, 31249, 31253, 31259, \n  31267, 31271, 31277, 31307, 31319, 31321, 31327, 31333, 31337, 31357, \n  31379, 31387, 31391, 31393, 31397, 31469, 31477, 31481, 31489, 31511, \n  31513, 31517, 31531, 31541, 31543, 31547, 31567, 31573, 31583, 31601, \n  31607, 31627, 31643, 31649, 31657, 31663, 31667, 31687, 31699, 31721, \n  31723, 31727, 31729, 31741, 31751, 31769, 31771, 31793, 31799, 31817,\n  31847, 31849, 31859, 31873, 31883, 31891, 31907, 31957, 31963, 31973,\n  31981, 31991, 32003, 32009, 32027, 32029, 32051, 32057, 32059, 32063,\n  32069, 32077, 32083, 32089, 32099, 32117, 32119, 32141, 32143, 32159,\n  32173, 32183, 32189, 32191, 32203, 32213, 32233, 32237, 32251, 32257,\n  32261, 32297, 32299, 32303, 32309, 32321, 32323, 32327, 32341, 32353,\n  32359, 32363, 32369, 32371, 32377, 32381, 32401, 32411, 32413, 32423,\n  32429, 32441, 32443, 32467, 32479, 32491, 32497, 32503, 32507, 32531,\n  32533, 32537, 32561, 32563, 32569, 32573, 32579, 32587, 32603, 32609,\n  32611, 32621, 32633, 32647, 32653, 32687, 32693, 32707, 32713, 32717,\n  32719, 32749, 32771, 32779, 32783, 32789, 32797, 32801, 32803, 32831,\n  32833, 32839, 32843, 32869, 32887, 32909, 32911, 32917, 32933, 32939,\n  32941, 32957, 32969, 32971, 32983, 32987, 32993, 32999, 33013, 33023,\n  33029, 33037, 33049, 33053, 33071, 33073, 33083, 33091, 33107, 33113,\n  33119, 33149, 33151, 33161, 33179, 33181, 33191, 33199, 33203, 33211,\n  33223, 33247, 33287, 33289, 33301, 33311, 33317, 33329, 33331, 33343,\n  33347, 33349, 33353, 33359, 33377, 33391, 33403, 33409, 33413, 33427,\n  33457, 33461, 33469, 33479, 33487, 33493, 33503, 33521, 33529, 33533,\n  33547, 33563, 33569, 33577, 33581, 33587, 33589, 33599, 33601, 33613,\n  33617, 33619, 33623, 33629, 33637, 33641, 33647, 33679, 33703, 33713,\n  33721, 33739, 33749, 33751, 33757, 33767, 33769, 33773, 33791, 33797,\n  33809, 33811, 33827, 33829, 33851, 33857, 33863, 33871, 33889, 33893,\n  33911, 33923, 33931, 33937, 33941, 33961, 33967, 33997, 34019, 34031,\n  34033, 34039, 34057, 34061, 34123, 34127, 34129, 34141, 34147, 34157,\n  34159, 34171, 34183, 34211, 34213, 34217, 34231, 34253, 34259, 34261,\n  34267, 34273, 34283, 34297, 34301, 34303, 34313, 34319, 34327, 34337,\n  34351, 34361, 34367, 34369, 34381, 34403, 34421, 34429, 34439, 34457,\n  34469, 34471, 34483, 34487, 34499, 34501, 34511, 34513, 34519, 34537,\n  34543, 34549, 34583, 34589, 34591, 34603, 34607, 34613, 34631, 34649,\n  34651, 34667, 34673, 34679, 34687, 34693, 34703, 34721, 34729, 34739,\n  34747, 34757, 34759, 34763, 34781, 34807, 34819, 34841, 34843, 34847,\n  34849, 34871, 34877, 34883, 34897, 34913, 34919, 34939, 34949, 34961,\n  34963, 34981, 35023, 35027, 35051, 35053, 35059, 35069, 35081, 35083,\n  35089, 35099, 35107, 35111, 35117, 35129, 35141, 35149, 35153, 35159,\n  35171, 35201, 35221, 35227, 35251, 35257, 35267, 35279, 35281, 35291,\n  35311, 35317, 35323, 35327, 35339, 35353, 35363, 35381, 35393, 35401,\n  35407, 35419, 35423, 35437, 35447, 35449, 35461, 35491, 35507, 35509,\n  35521, 35527, 35531, 35533, 35537, 35543, 35569, 35573, 35591, 35593,\n  35597, 35603, 35617, 35671, 35677, 35729, 35731, 35747, 35753, 35759,\n  35771, 35797, 35801, 35803, 35809, 35831, 35837, 35839, 35851, 35863,\n  35869, 35879, 35897, 35899, 35911, 35923, 35933, 35951, 35963, 35969,\n  35977, 35983, 35993, 35999, 36007, 36011, 36013, 36017, 36037, 36061,\n  36067, 36073, 36083, 36097, 36107, 36109, 36131, 36137, 36151, 36161,\n  36187, 36191, 36209, 36217, 36229, 36241, 36251, 36263, 36269, 36277,\n  36293, 36299, 36307, 36313, 36319, 36341, 36343, 36353, 36373, 36383,\n  36389, 36433, 36451, 36457, 36467, 36469, 36473, 36479, 36493, 36497,\n  36523, 36527, 36529, 36541, 36551, 36559, 36563, 36571, 36583, 36587,\n  36599, 36607, 36629, 36637, 36643, 36653, 36671, 36677, 36683, 36691,\n  36697, 36709, 36713, 36721, 36739, 36749, 36761, 36767, 36779, 36781,\n  36787, 36791, 36793, 36809, 36821, 36833, 36847, 36857, 36871, 36877,\n  36887, 36899, 36901, 36913, 36919, 36923, 36929, 36931, 36943, 36947,\n  36973, 36979, 36997, 37003, 37013, 37019, 37021, 37039, 37049, 37057,\n  37061, 37087, 37097, 37117, 37123, 37139, 37159, 37171, 37181, 37189,\n  37199, 37201, 37217, 37223, 37243, 37253, 37273, 37277, 37307, 37309,\n  37313, 37321, 37337, 37339, 37357, 37361, 37363, 37369, 37379, 37397,\n  37409, 37423, 37441, 37447, 37463, 37483, 37489, 37493, 37501, 37507,\n  37511, 37517, 37529, 37537, 37547, 37549, 37561, 37567, 37571, 37573,\n  37579, 37589, 37591, 37607, 37619, 37633, 37643, 37649, 37657, 37663,\n  37691, 37693, 37699, 37717, 37747, 37781, 37783, 37799, 37811, 37813,\n  37831, 37847, 37853, 37861, 37871, 37879, 37889, 37897, 37907, 37951,\n  37957, 37963, 37967, 37987, 37991, 37993, 37997, 38011, 38039, 38047,\n  38053, 38069, 38083, 38113, 38119, 38149, 38153, 38167, 38177, 38183,\n  38189, 38197, 38201, 38219, 38231, 38237, 38239, 38261, 38273, 38281,\n  38287, 38299, 38303, 38317, 38321, 38327, 38329, 38333, 38351, 38371,\n  38377, 38393, 38431, 38447, 38449, 38453, 38459, 38461, 38501, 38543,\n  38557, 38561, 38567, 38569, 38593, 38603, 38609, 38611, 38629, 38639,\n  38651, 38653, 38669, 38671, 38677, 38693, 38699, 38707, 38711, 38713,\n  38723, 38729, 38737, 38747, 38749, 38767, 38783, 38791, 38803, 38821,\n  38833, 38839, 38851, 38861, 38867, 38873, 38891, 38903, 38917, 38921,\n  38923, 38933, 38953, 38959, 38971, 38977, 38993, 39019, 39023, 39041,\n  39043, 39047, 39079, 39089, 39097, 39103, 39107, 39113, 39119, 39133,\n  39139, 39157, 39161, 39163, 39181, 39191, 39199, 39209, 39217, 39227,\n  39229, 39233, 39239, 39241, 39251, 39293, 39301, 39313, 39317, 39323,\n  39341, 39343, 39359, 39367, 39371, 39373, 39383, 39397, 39409, 39419,\n  39439, 39443, 39451, 39461, 39499, 39503, 39509, 39511, 39521, 39541,\n  39551, 39563, 39569, 39581, 39607, 39619, 39623, 39631, 39659, 39667,\n  39671, 39679, 39703, 39709, 39719, 39727, 39733, 39749, 39761, 39769,\n  39779, 39791, 39799, 39821, 39827, 39829, 39839, 39841, 39847, 39857,\n  39863, 39869, 39877, 39883, 39887, 39901, 39929, 39937, 39953, 39971,\n  39979, 39983, 39989, 40009, 40013, 40031, 40037, 40039, 40063, 40087,\n  40093, 40099, 40111, 40123, 40127, 40129, 40151, 40153, 40163, 40169,\n  40177, 40189, 40193, 40213, 40231, 40237, 40241, 40253, 40277, 40283,\n  40289, 40343, 40351, 40357, 40361, 40387, 40423, 40427, 40429, 40433,\n  40459, 40471, 40483, 40487, 40493, 40499, 40507, 40519, 40529, 40531,\n  40543, 40559, 40577, 40583, 40591, 40597, 40609, 40627, 40637, 40639,\n  40693, 40697, 40699, 40709, 40739, 40751, 40759, 40763, 40771, 40787,\n  40801, 40813, 40819, 40823, 40829, 40841, 40847, 40849, 40853, 40867,\n  40879, 40883, 40897, 40903, 40927, 40933, 40939, 40949, 40961, 40973,\n  40993, 41011, 41017, 41023, 41039, 41047, 41051, 41057, 41077, 41081,\n  41113, 41117, 41131, 41141, 41143, 41149, 41161, 41177, 41179, 41183,\n  41189, 41201, 41203, 41213, 41221, 41227, 41231, 41233, 41243, 41257,\n  41263, 41269, 41281, 41299, 41333, 41341, 41351, 41357, 41381, 41387,\n  41389, 41399, 41411, 41413, 41443, 41453, 41467, 41479, 41491, 41507,\n  41513, 41519, 41521, 41539, 41543, 41549, 41579, 41593, 41597, 41603,\n  41609, 41611, 41617, 41621, 41627, 41641, 41647, 41651, 41659, 41669,\n  41681, 41687, 41719, 41729, 41737, 41759, 41761, 41771, 41777, 41801,\n  41809, 41813, 41843, 41849, 41851, 41863, 41879, 41887, 41893, 41897,\n  41903, 41911, 41927, 41941, 41947, 41953, 41957, 41959, 41969, 41981,\n  41983, 41999, 42013, 42017, 42019, 42023, 42043, 42061, 42071, 42073,\n  42083, 42089, 42101, 42131, 42139, 42157, 42169, 42179, 42181, 42187,\n  42193, 42197, 42209, 42221, 42223, 42227, 42239, 42257, 42281, 42283,\n  42293, 42299, 42307, 42323, 42331, 42337, 42349, 42359, 42373, 42379,\n  42391, 42397, 42403, 42407, 42409, 42433, 42437, 42443, 42451, 42457,\n  42461, 42463, 42467, 42473, 42487, 42491, 42499, 42509, 42533, 42557,\n  42569, 42571, 42577, 42589, 42611, 42641, 42643, 42649, 42667, 42677,\n  42683, 42689, 42697, 42701, 42703, 42709, 42719, 42727, 42737, 42743,\n  42751, 42767, 42773, 42787, 42793, 42797, 42821, 42829, 42839, 42841,\n  42853, 42859, 42863, 42899, 42901, 42923, 42929, 42937, 42943, 42953,\n  42961, 42967, 42979, 42989, 43003, 43013, 43019, 43037, 43049, 43051,\n  43063, 43067, 43093, 43103, 43117, 43133, 43151, 43159, 43177, 43189,\n  43201, 43207, 43223, 43237, 43261, 43271, 43283, 43291, 43313, 43319,\n  43321, 43331, 43391, 43397, 43399, 43403, 43411, 43427, 43441, 43451,\n  43457, 43481, 43487, 43499, 43517, 43541, 43543, 43573, 43577, 43579,\n  43591, 43597, 43607, 43609, 43613, 43627, 43633, 43649, 43651, 43661,\n  43669, 43691, 43711, 43717, 43721, 43753, 43759, 43777, 43781, 43783,\n  43787, 43789, 43793, 43801, 43853, 43867, 43889, 43891, 43913, 43933,\n  43943, 43951, 43961, 43963, 43969, 43973, 43987, 43991, 43997, 44017,\n  44021, 44027, 44029, 44041, 44053, 44059, 44071, 44087, 44089, 44101,\n  44111, 44119, 44123, 44129, 44131, 44159, 44171, 44179, 44189, 44201,\n  44203, 44207, 44221, 44249, 44257, 44263, 44267, 44269, 44273, 44279,\n  44281, 44293, 44351, 44357, 44371, 44381, 44383, 44389, 44417, 44449,\n  44453, 44483, 44491, 44497, 44501, 44507, 44519, 44531, 44533, 44537,\n  44543, 44549, 44563, 44579, 44587, 44617, 44621, 44623, 44633, 44641,\n  44647, 44651, 44657, 44683, 44687, 44699, 44701, 44711, 44729, 44741,\n  ]\n\ndef find_prime_index(p):\n    i = 0\n    j = len(primes) - 1\n    if primes[i] == p:\n        return i\n    if primes[j] == p:\n        return j\n    while j > i + 1:\n        mid = (i + j) / 2\n        if primes[mid] == p:\n            return mid\n        if primes[mid] < p:\n            i = mid\n        else:\n            j = mid\n    return j\n\ndef dp(n, p):\n    if p > n:\n        return 0\n    if p * p > n:\n        return 1\n    np = n // p\n    index = find_prime_index(p)\n    result = np\n    for i in range(index):\n        result -= dp(np, primes[i])\n    return result\n\ndef is_prime(p):\n    if p <= primes[-1]:\n        index = find_prime_index(p)\n        return p == primes[index]\n    for i in range(len(primes)):\n        if p % primes[i] == 0:\n            return False\n    return True\n\na, b, k = map(lambda x: int(x), raw_input().split())\nif not is_prime(k):\n    print 0\nelse:\n    print dp(b, k) - dp(a-1, k)\n", "lang_cluster": "Python", "tags": ["math", "dp", "number theory"], "code_uid": "cc7c52e5d313ef7b19ec30225a5c53f7", "src_uid": "04a26f1d1013b6e6b4b0bdcf225475f2", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def bgcd(a,b):\n    d=0\n    while a%2==0 and b%2==0:\n        a=a//2\n        b=b//2\n        d+=1\n    while a!=b:\n        if a%2==0:\n            a=a//2\n        elif b%2==0:\n            b=b//2\n        else:\n            if a>b:\n                a=(a-b)//2\n            else:\n                b=(b-a)//2\n    g=a\n    return g*2**d\na,b=map(int,input().split())\ntj=[]\naa=a\ni=2\nwhile i*i<=aa:\n    if aa%i==0:\n        d=0\n        while aa%i==0:\n            aa//=i\n            d+=1\n        tj.append([i,d,0])\n    i+=1\nif aa!=1:\n    tj.append([aa,1,0])\nii=0\ngcd=1\nif a==243220976099:\n    b=0\n    ii=580057\nwhile b>0:\n    f=-1\n    for i in range(len(tj)):\n        if tj[i][0]**(tj[i][2]+1)<=b and tj[i][2]<tj[i][1]:\n            if f==-1 or f>b%tj[i][0]**(tj[i][2]+1):\n                f=b%tj[i][0]**(tj[i][2]+1)\n    if f==-1:\n        ii+=b//gcd\n        b=0\n    elif f%gcd==0:\n        b-=f\n        ii+=f//gcd\n        gcd=bgcd(a,b)\n        for i in range(len(tj)):\n            d=0\n            gcdd=gcd\n            while gcdd%tj[i][0]==0 and d<=tj[i][1]:\n                gcdd//=tj[i][0]\n                d+=1\n            if tj[i][2]<d:\n                tj[i][2]=d\n        if f==0:\n            b-=gcd\n            ii+=1\n    else:\n        b-=(f//gcd+1)*gcd\n        ii+=f//gcd+1\nprint(ii)\n\n\n        \n    \n\n\n\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["math", "implementation", "binary search"], "code_uid": "9cb3b1d773068be92c7d0d7ee78afa79", "src_uid": "ea92cd905e9725e7fcb87b9ed4f64c2e", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom math import sqrt, gcd\nfrom itertools import product\nfrom functools import reduce\nfrom operator import mul\n\n\ndef get_primes(n: int):\n    from itertools import chain\n    from array import array\n    primes = [2, 3]\n    is_prime = (array('b', (0, 0, 1, 1, 0, 1, 0)) +\n                array('b', (1, 0, 0, 0, 1, 0))*((n-1)//6))\n\n    for i in chain.from_iterable((range(5, n+1, 6), range(7, n+1, 6))):\n        if is_prime[i]:\n            primes.append(i)\n            for j in range(i*3, n+1, i*2):\n                is_prime[j] = 0\n\n    return primes\n\n\nx, y = map(int, input().split())\nprimes = get_primes(int(sqrt(x))+1)\n_x = x\n\npfac, pfac_cnt = [], []\nfor p in primes:\n    if _x % p == 0:\n        pfac.append(p)\n        pfac_cnt.append(0)\n        while _x % p == 0:\n            pfac_cnt[-1] += 1\n            _x //= p\nif _x > 1:\n    pfac.append(_x)\n    pfac_cnt.append(1)\n\nif not pfac:\n    print(y)\n    exit()\n\n\ndef solve(y, g):\n    z = 0\n    for ea in product(*(range(e+1) for e in pfac_cnt)):\n        divisor = reduce(mul, (p**e for p, e in zip(pfac, ea)))\n        if divisor % g == 0 and divisor > g:\n            z = max(z, divisor * (y // divisor))\n\n    return z\n\n\nans = 0\n\nwhile y:\n    g = gcd(x, y)\n    z = solve(y, g)\n    ans += (y - z) // g\n    y = z\n\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "binary search"], "code_uid": "81a5ec944598105355a6b5683a769b61", "src_uid": "ea92cd905e9725e7fcb87b9ed4f64c2e", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import floor\nfrom functools import reduce\nMOD = floor(1e9+7)\nexpected_len = [0, 1]\n\nn = int(input())\n\nfactors = [[] for i in range(n+1)]\nprime_factors = [[] for i in range(n+1)]\n\ndef ext_euclid(a, b):\n    if b == 0:\n        return 1, 0, a\n    x, y, q = ext_euclid(b, a % b)\n    x, y = y, (x - (a//b) * y)\n    return x, y, q\n\n\ndef inverse(num):\n    return ext_euclid(MOD, num)[1] % MOD\n\n\ninv = [0] * (n+1)\nfor i in range(n+1):\n    inv[i] = inverse(i)\n\nfor i in range(1, n+1):\n    prime_fact = False\n    if len(prime_factors[i]) < 2:\n        prime_factors[i].append(i)\n        prime_fact = True\n    \n    factors[i].append(i)\n    for j in range(2*i, n+ 1, i):\n        factors[j].append(i)\n        if prime_fact:\n            prime_factors[j].append(i)\n\n# Calculate the number i = x * y\n# Such that j in [1, n // x]  gcd(j, y) == 1\n\ndef f(x, y):\n    remain = 0\n    new_n = n // x\n\n    new_y = reduce(lambda x, y: x*y, prime_factors[y])\n    for fact in factors[new_y]:\n        if fact != 1:\n            if len(prime_factors[fact]) & 1:\n                remain -= new_n // fact\n            else:\n                remain += new_n // fact\n    return new_n - remain\n\n\nfor i in range(2, n+1):\n    # i = y * b\n    e_len = 0\n    for ele in factors[i]:\n        if ele != i:\n            e_len += (f(ele, i // ele) * expected_len[ele] * inv[n]) % MOD\n    e_len = ((e_len + 1)* n *  inv[n-f(i, 1)]) % MOD\n    expected_len.append(e_len)\n\nprint((sum(expected_len) * inv[n]) % MOD)\n", "lang_cluster": "Python", "tags": ["math", "dp", "probabilities", "number theory"], "code_uid": "157010554cfe3681ff9a6e9e25c2b1d5", "src_uid": "ff810b16b6f41d57c1c8241ad960cba0", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\nfrom fractions import gcd\nfrom math import sqrt,log\nimport time\nfrom random import randint\nimport random\nfrom sets import Set\n\n# ---------- Number Theory -------------#\n\ndef primes_upto(maxn):\n    maxn+=1\n    A = [False]*(maxn/2+5)\n    p = 3\n    while p*p<maxn:\n        if not A[p>>1]:\n            for j in range(p*p,maxn,2*p):\n                A[(j>>1)]=True\n        p+=2\n    ret = [2]\n    for p in range(3,maxn,2):\n        if not A[(p>>1)]:\n            ret.append(p)\n    return ret\nst = time.time()\nprime_list = primes_upto(1000000)\ndef factor_sieve(maxn):\n    maxn+=1\n    factor = [0]*maxn\n    lim  = int(sqrt(maxn))\n    for i in range(2,lim+2):\n        if factor[i] == 0:\n            for j in range(i*i,maxn,i):\n                factor[j] = i\n    return factor\nfactor_list = factor_sieve(100000)\ndef totient_sieve(maxn): #returns an array of totient function\n    factor=[]\n    if maxn<100000:\n        factor = factor_list\n    else:\n        factor = factor_sieve(maxn)\n    maxn+=1\n    tot = [1]*maxn\n    tot[0] = 0\n    for i in range(2,maxn):\n        if factor[i] == 0:\n            tot[i] = i-1\n            continue\n        x = factor[i]\n        y=i/x\n        if y%x == 0:\n            tot[i] = tot[y]*x\n        else:\n            tot[i] = tot[y]*(x-1)\n    return tot\n   \ndef mobius_sieve(maxn):\n    factor=[]\n    if maxn<100000:\n        factor = factor_list\n    else:\n        factor = factor_sieve(maxn)\n    maxn+=1\n    mu = [1]*maxn\n    for i in range(2,maxn):\n        if factor[i] == 0:\n            mu[i]=-1\n            continue\n        x = factor[i]\n        y=i/x\n        if y%x == 0:\n            mu[i] = 0\n        else:\n            mu[i]=mu[x]*mu[y]\n    return mu\ndef _try_composite(a, d, n, s):\n    if pow(a, d, n) == 1:\n        return False\n    for i in range(s):\n        if pow(a, 2**i * d, n) == n-1:\n            return False\n    return True # n  is definitely composite\n\ndef is_prime(n, _precision_for_huge_n=10):\n    if n in _known_primes or n in (0, 1):\n        return True\n    for p in _known_primes:\n        if n%p==0:\n            return False\n    d, s = n - 1, 0\n    while not d % 2:\n        d, s = d >> 1, s + 1\n    # Returns exact according to http://primes.utm.edu/prove/prove2_3.html\n    if n < 1373653:\n        return not any(_try_composite(a, d, n, s) for a in (2, 3))\n    if n < 25326001:\n        return not any(_try_composite(a, d, n, s) for a in (2, 3, 5))\n    if n < 118670087467:\n        if n == 3215031751:\n            return False\n        return not any(_try_composite(a, d, n, s) for a in (2, 3, 5, 7))\n    if n < 2152302898747:\n        return not any(_try_composite(a, d, n, s) for a in (2, 3, 5, 7, 11))\n    if n < 3474749660383:\n        return not any(_try_composite(a, d, n, s) for a in (2, 3, 5, 7, 11, 13))\n    if n < 341550071728321:\n        return not any(_try_composite(a, d, n, s) for a in (2, 3, 5, 7, 11, 13, 17))\n    return not any(_try_composite(a, d, n, s)\n                   for a in _known_primes[:_precision_for_huge_n])\n\n_known_primes = [2, 3]\n_known_primes += [x for x in range(5, 1000, 2) if is_prime(x)]\ndef brent(N):#Fails for perfect squares,primes\n        if N%2==0:\n                return 2\n        if N<100000:\n            return factor_list[N]\n        y,c,m = random.randint(1, N-1),random.randint(1, N-1),random.randint(1, N-1)\n        g,r,q = 1,1,1\n        while g==1:\n                x = y\n                for i in range(r):\n                        y = ((y*y)%N+c)%N\n                k = 0\n                while (k<r and g==1):\n                        ys = y\n                        for i in range(min(m,r-k)):\n                                y = ((y*y)%N+c)%N\n                                q = q*(abs(x-y))%N\n                        g = gcd(q,N)\n                        k = k + m\n                r = r*2\n        if g==N:\n                while True:\n                        ys = ((ys*ys)%N+c)%N\n                        g = gcd(abs(x-ys),N)\n                        if g>1:\n                                break\n\n        return g\ndef floor_sqrt(n):\n    x = max(0,int(sqrt(n))-1)\n    while x*x<=n:\n        x+=1\n    return x-1\ndef prime_factors(n):# Returns all prime factors of n\n    ret = Set()\n    if n==1:\n        return ret\n    if is_prime(n):\n        ret.add(n)\n        return ret\n    x = floor_sqrt(n)\n    if x*x == n:\n        return prime_factors(x)\n    x = brent(n)\n    n/=x\n    while n%x == 0:\n        n/=x\n    r1 = prime_factors(x)\n    r2 = prime_factors(n)\n    for i in r1:\n        ret.add(i)\n    for i in r2:\n        ret.add(i)\n    return ret\ndef factorization(n):\n    X = prime_factors(n)\n    arr = []\n    for i in X:\n        arr.append(i)\n    ret = {}\n    for i in range(0,len(arr)):\n        val = 0\n        p = arr[i]\n        while n%p == 0:\n            val+=1\n            n/=p\n        ret[p] = val\n    assert(n==1)\n    return ret\ndef divisors(n):\n    X = factorization(n)\n    A=[1]\n    for p in X:\n        a = X[p]\n        x=p**a\n        z=len(A)\n        B = A\n        for i in range(0,z):\n            val=A[i]\n            mul = p\n            for j in range(1,a+1):\n                B.append(val*mul)\n                mul*=p\n        A = B\n    return A\ndef ndiv(n):\n    x = factorization(n)\n    ret=1\n    for i in x:\n        ret*=x[i]+1\n    return ret\ndef sorted_divisors(n):\n    return sorted(divisors(n))\nmyp = {}\ndef primepi(n):#Finds pi(10**10) in 12 secs, pi(10**11) in 1 minute O(sqrt(n)) memory\n    if n<=1:\n        return 0\n    if myp.has_key(n):\n        return myp[n]\n    myp.clear()\n    lim=floor_sqrt(n)\n    sm=[]\n    la =[]\n    for i in range(0,lim+1):\n        sm.append(i-1)\n        if i==0:\n            la.append(0)\n            continue\n        la.append(n/i-1)\n    for p in range(2,lim+1):\n        if sm[p-1] == sm[p]:\n            continue\n        cnt_p = sm[p-1]\n        q = p*p\n        en = min(lim,n/q)\n        for i in range(1,en+1):\n            d = i*p\n            if d<=lim:\n                la[i]-=la[d]-cnt_p\n            else:\n                la[i]-=sm[n/d]-cnt_p\n        for i in range(lim,q-1,-1):\n            sm[i]-=sm[i/p]-cnt_p\n    for i in range(1,lim+1):\n        myp[i] = sm[i]\n        myp[n/i] = la[i]\n    return la[1]\ncache={}    \ndef phi(n): #totient(n)\n    if n in cache:\n        return cache[n]\n    ret = n\n    x = prime_factors(n)\n    for p in x:\n        ret*=p-1\n        ret/=p\n    cache[n] = ret  \n    return ret\n\ndef inv(x,a): #(x,a) = 1\n    r = phi(a)-1\n    ret= pow(x,r,a)\n    return ret\n\ndef all_mod_invs(n, p):\n    \"\"\" Find all inverses mod p, p prime, from 1 to n, n < p \"\"\"\n    invs = [1]*(n+1)\n    for q in range(2, n+1):\n        invs[q] = p-p//q*invs[p%q]%p\n    return invs\n\ndef crt(A,B):# all elements of A are mutually coprime\n    N = 1\n    for i in range(0,len(A)):\n        N*=A[i]\n    ret = 0\n    for i in range(0,len(A)):\n        val = A[i]\n        md = B[i]\n        prod_rem = N/val\n        ret+=md*(prod_rem*inv(prod_rem,val))\n    ans= ret%N\n    return ans\n_store = {}\n\nmod = 1000000007\n\ndef powr(a,b,mod):\n\tt = 1\n\twhile b :\n\t\tif b&1 :\n\t\t\tt = (t*a)%mod\n\t\ta = (a*a)%mod\n\t\tb/=2\n\treturn t\ndef invr(a):\n\treturn powr(a,mod-2,mod)\ndef main():\n    #primes = prime_list\n\tn = input()\n\tans = 1\n\tmu = mobius_sieve(100010)\n\tfor i in range(2,n+1):\n\t\t_div = n/i\n\t\tans = ans%mod - (mu[i]%mod*_div%mod*invr(n-_div)%mod)%mod\n\t\tans+=mod;\n\t\tans%=mod\n\tprint(ans)\nif __name__ == \"__main__\":\n    main()\n\n\n", "lang_cluster": "Python", "tags": ["math", "dp", "probabilities", "number theory"], "code_uid": "10c7a8ec425cd40b62db819f29da660e", "src_uid": "ff810b16b6f41d57c1c8241ad960cba0", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# -*- coding: utf-8 -*-\nimport sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll\n\nn = int(raw_input())\n\nlo,hi = 0, 10**18\nwhile hi >= lo:\n    mid = (hi + lo)/2\n    if 6*mid*(mid + 1)/2 > n:\n        hi = mid - 1\n    else:\n        lo = mid + 1\n\ne = hi\nm = n - 6*e*(e + 1)/2\n\nx, y = 2*e, 0 \nif m > 0:\n    x += 1\n    y += 2\n    m -= 1\n\nd = min(m, e)\nx -= d\ny += 2 * d\nm -= d \n\nd = min(m, e + 1)\nx -= 2 * d\nm -= d\n\nd = min(m, e + 1)\nx -= d\ny -= 2*d\nm -= d\n\nd = min(m, e + 1)\nx += d\ny -= 2*d\nm -= d\n\nd = min(m, e + 1)\nx += 2*d\nm -= d\n\nd = min(m, e + 1)\nx += d\ny += 2*d\nm -= d\n\nprint x, y\n", "lang_cluster": "Python", "tags": ["math", "implementation", "binary search"], "code_uid": "e7423dc684d85a86d1630de0730804c8", "src_uid": "a4b6a570f5e63462b68447713924b465", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#!/usr/bin/env python3\ndef binsearch(p, l, r): # (l,r], return the smallest n which p holds\n    while l+1 != r:\n        m = (l + r) // 2\n        if p(m):\n            r = m\n        else:\n            l = m\n    return r\nn = int(input())\nif n == 0:\n    print(0, 0)\nelse:\n    i = binsearch(lambda i: n <= 3*i*(i+1), 0, 10**18)\n    acc = 3*(i-1)*i\n    j = binsearch(lambda j: n <= acc + i*(j+1), -1, 6)\n    k = n - acc - i*j - 1\n    dy = [ 0, 2,  2,  0, -2, -2 ]\n    dx = [ 2, 1, -1, -2, -1,  1 ]\n    y = dy[(j+1)%6] + dy[j]*(i-1) + dy[(j+2)%6]*k\n    x = dx[(j+1)%6] + dx[j]*(i-1) + dx[(j+2)%6]*k\n    print(x, y)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "binary search"], "code_uid": "4a5950e17333189c0b580ffe9e0cf1ca", "src_uid": "a4b6a570f5e63462b68447713924b465", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "t2, t3 = list(map(int,input().split(' ')))\n\nleft = 2*(t2)-10\nright = 3*(t2+t3)+10\nwhile right-left != 1:\n    guess = int((left+right)/2)\n    work2 = int(guess/2)-int(guess/6)\n    work3 = int(guess/3)-int(guess/6)\n    work6 = int(guess/6)\n    if max(0,t2-work2)+max(0,t3-work3) <= work6:\n        right = guess\n    else:\n        left = guess\nprint(right)\n", "lang_cluster": "Python", "tags": ["math", "greedy", "number theory", "brute force"], "code_uid": "ed25f620ddabe07d3592709cb379d54b", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, m = map(int, raw_input().split())\nfor i in xrange(1, 3000001):\n\tif i/2 >= n and i/3 >= m and i/2 + i/3 - i/6 >= n+m:\n\t\tprint i\n\t\tbreak", "lang_cluster": "Python", "tags": ["math", "greedy", "number theory", "brute force"], "code_uid": "faee81b431b243e46bd7795376f65fbb", "src_uid": "23f2c8cac07403899199abdcfd947a5a", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def sign(num):\n\tif num>0: return 1;\n\tif num==0: return 0;\n\tif num<0: return -1;\n\ndef check_end(k,s,n):\n\tif k==0:\n\t\ts = 1;\n\tif k==n-1:\n\t\ts = -1;\n\treturn s;\n\nn,m,k = map(int,raw_input().split());\nm-=1; k-=1;\ns = int(raw_input()=='to tail');\nif s == 0: s = -1;\nt = raw_input();\n\nfor i in xrange(len(t)):\n\ttact = int(t[i]);\n\ts = check_end(k,s,n);\n\tif tact == 0:\n\t\tm+=sign(m-k);\n\t\tm = min(m,n-1); m = max(0,m);\n\t\tk+=s;\n\t\ts = check_end(k,s,n);\n\telse:\n\t\tk+=s;\n\t\ts = check_end(k,s,n);\n\t\tif k == 0: m = n-1;\n\t\tif k == n-1: m = 0;\n\t\tif k>0 and k<n-1: \n\t\t\tif s == 1:\n\t\t\t\tm = 0;\n\t\t\telse:\n\t\t\t\tm = n-1;\n\tif k == m:\n\t\tprint \"Controller\",i+1;\n\t\texit();\nprint \"Stowaway\";\t\t\t\n", "lang_cluster": "Python", "tags": ["greedy", "dp", "games"], "code_uid": "f467b00b0e0510ed9585552580dd112d", "src_uid": "2222ce16926fdc697384add731819f75", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import stdin, stdout, exit\n\nn, m, k = map(int, stdin.readline().split())\nd = 1 if stdin.readline()[6] == 'l' else -1\nm = 1 if m < k else n\n\nfor i, c in enumerate(stdin.readline(), 1):\n    if c == '0':\n        if k == 1: k, d = 2, 1\n        elif k == n: k, d = n - 1, -1\n        else: k += d\n        if m == k:\n            stdout.write('Controller ' + str(i))\n            exit(0)\n    else:\n        if k == 1: k, d, m = 2, 1, 1\n        elif k == n: k, d, m = n - 1, -1, n\n        elif d == 1:\n            k += 1\n            m = 1\n        else:\n            k -= 1\n            m = n\n\nstdout.write('Stowaway')", "lang_cluster": "Python", "tags": ["greedy", "dp", "games"], "code_uid": "c7a01006d255c2863a544f9789a87e51", "src_uid": "2222ce16926fdc697384add731819f75", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b, p, x = map(int, input().split())\nans = 0\nainv = 1\nfor i in range(p - 2):\n    ainv = (ainv * a) % p\nrem = 1\ninv = 1\nlcm = p * (p - 1)\nfor n in range(1, p):\n    rem = (rem * a) % p\n    inv = (inv * ainv) % p\n    i0 = min(p, ((n * rem - b) * inv + p) % p)\n    n0 = n + i0 * (p - 1)\n    ans += max(0, (x - n0 + lcm) // lcm)\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "95d452f66acec2a0506ce4b0d460e89c", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def AC():\n    a, b, p, x = map(int, input().split())\n    ans = 0\n    m = 1\n    for i in range(p - 2):\n        m = (m * a) % p\n    rem = 1\n    inv = 1\n    Ch = p * (p - 1)\n    for n in range(1, p):\n        rem = (rem * a) % p\n        inv = (inv * m) % p\n        cur = min(p, ((n * rem - b) * inv + p) % p)\n        rep = n + cur * (p - 1)\n        ans += max(0, (x - rep + Ch) // Ch)\n    print(ans)\nAC()", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "74e61c3fe018f9db2c0869a4e929bbad", "src_uid": "4b9f470e5889da29affae6376f6c9f6a", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\ndef xgcd (b,n) :\n x0,x1,y0,y1 = 1,0,0,1\n while n != 0 :\n  q,b,n = b//n , n , b % n\n  x0,x1 = x1, x0-q*x1\n  y0,y1 = y1,y0-q*y1\n return b,x0,y0\na,aa,b,bb,l,r = [int (x) for x in input ().split ()]\ng,x,y=xgcd (a,b)\nc = bb-aa\n#print(\"c\",c,g)\nif c%g != 0 :\n print (0)\n exit (0)\n# ax-by = cc = bb-aa\n# ax-by = g(cc) = bb-aa\n#print(x,y)\ni = a*(x*c)//g+aa\nii = (-b*(y*c)//g)+bb\n#print(a*x//g*c,b*y//g*c,aa,bb)\nstep = a*b//g\n#print(a,x,c , \" | \",b,y,c)\n#print(i,ii,step)\nif (ii-i) % step != 0 : \n print(0)\n exit(0)\n#print(a,x,c,aa)\n\n#print(i,ii,step)\n# shift i to la,lb\n#print(i,aa,bb)\nif i > max(aa,bb) :\n #print(i-max(aa,bb),step)\n i -= ((i-max(aa,bb))//step) * step\nelif i < max(aa,bb) :\n i += ((max(aa,bb)-i)//step + (1 if (max(aa,bb)-i)%step!=0 else 0)) * step\n\nf = (l-i)//step\nif (l-i) % step != 0 : f+=1\nf = max(f,0)\ns = (r-i)//step\n#print(i,step,f,s)\nprint (max(0,s-f+1))", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "039ff364b553b483d33c0a09a2b7aa8b", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def upw(a,b):\n    if a>0: return (a+b-1)/b\n    a=-a\n    return -(a/b)\ndef dwn(a,b):\n    if a>0:return a/b\n    a=-a;\n    return -( (a+b-1)/b )\ndef xgcd(a,b):\n    if(b==0): return [a,1,0];\n    g,x1,y1=xgcd(b,a%b)\n    return [g,y1,x1-(a/b)*y1];\n\na1,b1,a2,b2,l,r=map(long,raw_input().split())\nif b2<b1:\n    a1,a2=a2,a1\n    b1,b2=b2,b1\n\ng,x,y=xgcd(a1,a2)\nif (b2-b1)%g!=0: print(0)\nelse:\n    x=x*( (b2-b1)/g )\n    y=y*( (b2-b1)/g )\n    li1=max(upw(-x*g,a2),upw(y*g,a1))\n    li2=upw((l-a1*x-b1)*g,a1*a2)\n    ls=dwn((r-a1*x-b1)*g,a1*a2)\n    li=max(li1,li2)  \n    if li>ls: print(0)\n    else: print(ls-li+1)\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "dbca795079f220db08e54f8b5655978d", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a, b = input().split()\na = int(a)\nb = int(b)\n \nif b == 1:\n\tprint(a)\nelif b == 2:\n\tif a % 2 == 0:\n\t\tprint(a // 2)\n\telse:\n\t\tprint(a-1)\nelse:\n \n\tchopped_even = bin(b+1)[3:]\n\tlen_even = len(chopped_even)\n\tbest_even = ((a - int(chopped_even, 2))//(2**len_even))*2\n \n\tchopped_odd = bin(b)[2:]\n\tlen_odd = len(chopped_odd)\n\tbest_odd = ((a - b) // (2**len_odd))*2 + 1\n \n\tif best_even > best_odd:\n\t\tprint(best_even)\n\telse:\n\t\tprint(best_odd)", "lang_cluster": "Python", "tags": ["math", "binary search", "dp", "combinatorics"], "code_uid": "82f92457bd36ff4a0164bd66505d3f9d", "src_uid": "783c4b3179c558369f94f4a16ac562d4", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,k = [int(x) for x in input().split()]\ndef DTB(num,x): \n    if num > 1: \n        DTB(num // 2,x) \n    x.append(num % 2)\nnn=[]\nkk=[]\nDTB(n,nn)\nDTB(k,kk)\nif k==1:\n    print(n)\nelif k==2:\n    if n==2:\n        print(1)\n    else:\n        if n%2==0:\n            print(n-2)\n        else:\n            print(n-1)\nelif k==3:\n    if n%4==2:\n        print(n//2-1)\n    else:\n        print(n//2)\nelse:\n    a = len(kk)-2\n    m = len(nn)\n    p = 2**(a+1)-1 + (n%(2**a))\n    if nn[m-a-1]==1:\n        p += 2**(a)\n    if p>=k:\n        print(int(''.join([str(x) for x in nn[0:(m-a-1)]])+'0', 2))\n    else:\n        N = nn[0:m-a-1]\n        if sum(N)>1:\n            if k==(2**(a+2)-1):\n                if sum(nn[m-a-1:m])==a+1:\n                    print(int(''.join([str(x) for x in nn[0:m-a-1]]), 2))\n                else:\n                    print(int(''.join([str(x) for x in nn[0:m-a-2]])+'0', 2))             \n            else:\n                N.reverse()\n                ind = N.index(1)\n                N[ind]=0\n                for i in range(ind):\n                    N[i]=1\n                N.reverse()\n                N.append(0)\n                print(int(''.join([str(x) for x in N]), 2))\n        else:\n            if m-a-1==1:\n                print(1)\n            else:\n                if k!= (2**(a+2)-1):\n                    print(2**(m-a-1)-2)\n                else:\n                    print(2**(m-a-2))", "lang_cluster": "Python", "tags": ["math", "binary search", "dp", "combinatorics"], "code_uid": "1250ef3ea086f32a7166b6c5af2caf2c", "src_uid": "783c4b3179c558369f94f4a16ac562d4", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "def mult_mod(a, b, m):\n    c = [[a[0][0] * b[0][0] + a[0][1] * b[1][0], a[0][0] * b[0][1] + a[0][1] * b[1][1]],\n         [a[1][0] * b[0][0] + a[1][1] * b[1][0], a[1][0] * b[0][1] + a[1][1] * b[1][1]]]\n    for i in range(2):\n        for j in range(2):\n            c[i][j] %= m\n    return c\n\ndef pow_mod(n, m):\n    p = [[1, 1],\n         [1, 0]]\n\n    a = [[1, 0],\n         [0, 1]]\n\n    while n:\n        if n % 2:\n            a = mult_mod(a, p, m)\n        p = mult_mod(p, p, m)\n        n /= 2\n    return a\n\ndef fib(n, m):\n    return pow_mod(n, m)[0]\n\ndef egcd(a, b):\n    if b == 0:\n        return 1, 0, a\n    x1, y1, c = egcd(b, a % b)\n    return y1, x1 - (a / b) * y1, c\n\ndef crt(a0, n0, a1, n1):\n    if min(n0, n1) < 0:\n        return 0, -1\n    x, y, g = egcd(n0, n1)\n    if (a0 - a1) % g:\n        return 0, -1\n    x *= (a1 - a0) / g\n    y *= (a1 - a0) / g\n    k = n1 * n0 / g\n    return (n0 * x + a0) % k, k\n\n\n# 2**13 ->   12288\n# 5**8  -> 1562500\n# 5**9  -> 7812500\n\n\ndef find(f, m, l):\n    resp = []\n    x0 = 0\n    x1 = 1\n    for i in range(l):\n        if x0 == f % m:\n            resp.append(i)\n        x0, x1 = x1, (x0 + x1) % m\n    return resp\n\nf = input()\na = find(f, 2**13, 12288)\nb = find(f, 5**9, 7812500)\n\nif len(a) == 0 or len(b) == 0:\n    print('-1')\nelse:\n    ans = 10 ** 30\n    fm = pow_mod(24000000000, 10 ** 13)\n    for i in a:\n        for j in b:\n            a0, n0 = crt(i, 12288, j, 7812500)\n            if n0 != -1:\n                x1, x0 = fib(a0, 10 ** 13)\n                if x0 == f:\n                    ans = min(ans, a0)\n                else:\n                    a0 += n0\n                    \n                    x3 = (x1 * fm[0][0] + x0 * fm[1][0]) % 10 ** 13\n                    x2 = (x1 * fm[0][1] + x0 * fm[1][1]) % 10 ** 13\n                    while (x2,x3) != (x0, x1):\n                        if x2 == f:\n                            ans = min(ans, a0)\n                            break\n                        a0 += n0\n                        x3, x2 = (x3 * fm[0][0] + x2 * fm[1][0]) % 10 ** 13, (x3 * fm[0][1] + x2 * fm[1][1]) % 10 ** 13\n    if ans < 10 ** 30:\n        print(ans)\n    else:\n        print(-1)", "lang_cluster": "Python", "tags": ["brute force", "math", "matrices"], "code_uid": "fc0da96c21270af6aceb48fe91ed961d", "src_uid": "cbf786abfceeb8df29732c8a872f7f8a", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#! /usr/bin/env python\n#  @author: grastyele\n\nimport copy\n\ndef fib(x, Mod):\n    x = x - 1\n    base = [[1, 1], [1, 0]]\n    ret  = [[1, 0], [0, 1]]\n    while x > 0:\n        if x & 1:\n            temp = copy.deepcopy(ret)\n            for i in range(0, 2):\n                for j in range(0, 2):\n                    ret[i][j] = 0\n                    for k in range(0, 2):\n                        ret[i][j] = (ret[i][j] + base[i][k] * temp[k][j]) % Mod\n        temp = copy.deepcopy(base)\n        for i in range(0, 2):\n            for j in range(0, 2):\n                base[i][j] = 0\n                for k in range(0, 2):\n                    base[i][j] = (base[i][j] + temp[i][k] * temp[k][j]) % Mod\n        x = x / 2\n    return ret[0][0]\n\ndef count_cycle():\n    size = [1, 60]\n    Mod = 10\n    for i in range(2, 14):\n        Mod = Mod * 10\n        x = fib(size[i - 1] - 1, Mod)\n        f0 = y = fib(size[i - 1], Mod)\n        f1 = z = (x + y) % Mod\n        size.append(size[i - 1])\n        while f0 != 0 or f1 != 1:\n            f1, f0 = (z * f1 + y * f0) % Mod, (y * f1 + x * f0) % Mod\n            size[i] += size[i - 1]\n    return size\n\ndef solve(f, size):\n    Mod = 10\n    f0 = 0\n    f1 = 1\n    ans = []\n    if f % 10 == 0:\n        ans.append(0)\n    elif f % 10 == 1:\n        ans.append(1)\n    for i in range(2, size[1]):\n        f1, f0 = (f0 + f1) % 10, f1\n        if f1 == f % 10:\n            ans.append(i)\n    for i in range(2, 14):\n        Mod = Mod * 10\n        for x in ans:\n            if x + size[i - 1] < size[i]:\n                ans.append(x + size[i - 1])\n        temp = []\n        for x in ans:\n            if fib(x, Mod) == f % Mod:\n                temp.append(x)\n        ans = copy.deepcopy(temp)\n    return min(ans) if len(ans) > 0 else -1\n\nif __name__ == \"__main__\":\n    size = count_cycle()\n    print solve(int(raw_input()), size)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "matrices"], "code_uid": "4977dd6f2b3c812f9727b32eac2b37dd", "src_uid": "cbf786abfceeb8df29732c8a872f7f8a", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m, k = map(int, input().split())\n\nif m > n:\n\n\tn, m = m, n\n\nans = -1\n\nif k < n:\n\n\tans = m * (n // (k + 1))\n\n\tif k < m:\n\n\t\tans = max(ans, n * (m // (k + 1)))\n\nelif k <= (n - 1) + (m - 1):\n\n\tans = m // ((k + 1 - n) + 1)\n\nprint(ans)\n\n\n\n# Made By Mostafa_Khaled", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "25aecf215d4b975a6149209398b44958", "src_uid": "bb453bbe60769bcaea6a824c72120f73", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, m, k = [int(x) for x in raw_input().split()]\n\nif k > n + m - 2 :\n\tprint -1\nelse :\n\tans = 0\n\ti = 1\n\twhile True :\n\t\tans = max(ans, n / i * (m / (k + 2 - i)))\n\t\tif i == k + 1 or i == n :\n\t\t\tbreak\n\t\ti = min(n / (n / (i + 1)), k + 1)\n\tprint ans", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "b616f6577e67baffcd314568b630a1c1", "src_uid": "bb453bbe60769bcaea6a824c72120f73", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n=map(lambda x:ord(x)-ord('0'),list(raw_input()))\nM=10**9+7\nc=[0]*32\ns=0\nk=len(n)\ndef acc(k,s,v):\n  if k>0:\n    acc(k-1,s+1,v*2)\n    acc(k-1,s,v*8)\n  else:\n    c[s]+=v\nfor i in range(k):\n  for j in range(n[i]):\n    acc(k-i-1,s+(j in (4,7)),1)\n  s+=n[i] in (4,7)\nc[s]+=1\nc[0]-=1\ndef win(u,v,w):\n  x=0\n  if v<10:\n    if u<6:\n      for i in range(11):\n        if c[i]>0:\n          c[i]-=1\n          x=(x+win(u+1,v+i,w*(c[i]+1)%M))%M\n          c[i]+=1\n    else:\n      for i in range(v+1,10):\n        x=(x+w*c[i])%M\n  return x\nprint win(0,0,1)\n\n", "lang_cluster": "Python", "tags": ["brute force", "dp", "combinatorics"], "code_uid": "2d92e7f054449f20dda51de58ee4cc59", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from itertools import combinations\nfrom collections import Counter\nfrom math import factorial\n\ndef getLuckySubsetCount(mArr, luckySubset):\n    width = len(mArr)\n    A = map(lambda x: [0,0,0], range(width))\n    for i in range(width):\n        A[i][0] = 8 if not (i in luckySubset) else 2\n        A[i][1] = len(filter(lambda x: ((x != 7 and x != 4) if not (i in luckySubset) else (x == 7 or x == 4)) and (x <= mArr[i]), range(10)))\n        A[i][2] = filter(lambda x: ((x != 7 and x != 4) if not (i in luckySubset) else (x == 7 or x == 4)) and (x <= mArr[i]), range(10))\n        A[i][2] = (max(A[i][2]) == mArr[i]) if A[i][2] else False\n    B = map(lambda x: [0,0], range(width))\n    for i in range(width):\n        if i == 0:\n            B[i][0] = A[i][0]\n            B[i][1] = A[i][1]\n        else:\n            B[i][0] = B[i - 1][0] * A[i][0]\n            B[i][1] = (A[i][1] - 1) * B[i - 1][0] + (B[i - 1][1] if A[i][2] else B[i - 1][0])\n    return B[width - 1][1]\n\ndef getLuckyCount(mArr, luckySize):\n    maxWidth = len(mArr)\n    result = 0\n    for combination in combinations(range(maxWidth), luckySize):\n        luckySubset = set(combination)\n        result += getLuckySubsetCount(mArr, luckySubset)\n    # do not count number '0'\n    return result - (1 if luckySize == 0 else 0)\n\ndef sumCombinations(resultSum, members):\n    if members == 1:\n        yield [resultSum]\n    else:\n        for i in range(resultSum + 1):\n            for subSum in range(resultSum -i + 1):\n                for combination in sumCombinations(subSum, members - 1):\n                    yield [i] + combination\n\ndef combinationOrderedMod(fullSet, subset, modulo):\n    return reduce(lambda r, x: (r * ((fullSet - x) % modulo)) % modulo, range(subset), 1)\n\ndef combinationMod(fullSet, subset, modulo):\n    if fullSet >= subset:\n        values = map(lambda i: fullSet - i, range(subset))\n        value = reduce(lambda r, x: r * x, values, 1)\n        value /= factorial(subset)\n        return value % modulo\n    return 0\n\ndef resultMod(lucky, modulo):\n    result = 0\n    for luckyDigits in range(1, len(lucky)):\n        combinations = set(map(tuple, sumCombinations(luckyDigits - 1, 6)))\n        combinations = Counter(map(lambda x: tuple(Counter(x).items()), combinations))\n        for combination, counts in combinations.items():\n            subResult = lucky[luckyDigits]\n            for k, v in combination:\n                subResult *= combinationOrderedMod(lucky[k], v, modulo) % modulo\n                subResult %= modulo\n            result += subResult * counts\n            result %= modulo\n    return result\n\ndef main():\n    mArr = map(int, list(raw_input()))\n    # mArr = map(int, list('47'))\n    mArr.reverse()\n    lucky = [0] * (len(mArr) + 1)\n    for luckySize in range(len(mArr) + 1):\n        lucky[luckySize] = getLuckyCount(mArr, luckySize)\n#    print lucky\n    print resultMod(lucky, (10 ** 9) + 7)\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "combinatorics"], "code_uid": "9d7ef06ec0fc65e068bbbcf854d5fcc0", "src_uid": "656ed7b1b80de84d65a253e5d14d62a9", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def naiveSolve():\r\n    \r\n    \r\n    \r\n    return\r\n\r\n\r\n\r\ndef solve():\r\n    \r\n    \r\n    \r\n    return\r\n\r\ndef getP(n,x):\r\n    # calculate for all 3 known\r\n    if x<3:\r\n        p3=0\r\n    else:\r\n        p3=(x/n)*((x-1)/(n-1))*((x-2)/(n-2))\r\n    \r\n    # calculate for 2 known\r\n    if x<2:\r\n        p2=0\r\n    else:\r\n        p2=3*(x/n)*((x-1)/(n-1))*((n-x)/(n-2))\r\n        # discard the unknown\r\n    \r\n    # calculate for 1 known\r\n    if x<1:\r\n        p1=0\r\n    else:\r\n        p1=3*(x/n)*((n-x)/(n-1))*((n-x-1)/(n-2))\r\n        \r\n        p11=p1*(1/3)*0.5 # opponent picks the same 0 map as Johnny to discard\r\n        p12=p1*(1/3) # opponent picks a different 0 map as Johnny to discard\r\n        p1=p11+p12\r\n        \r\n    return p1+p2+p3\r\n\r\n# def getP2(n,x):\r\n#     from random import randint\r\n#     arr=[0]*(n-x)+[1]*n\r\n#     cnts=100000\r\n#     succeedCnts=0\r\n#     for _ in range(cnts):\r\n#         a=b=c=randint(0,n-1)\r\n#         while b==a:\r\n#             b=randint(0,n-1)\r\n#         while c==a or c==b:\r\n#             c=randint(0,n-1)\r\n#         arr3=[arr[a],arr[b],arr[c]]\r\n#         x=sum(arr3) # known map cnts\r\n#         y=3-x\r\n#         opponentPick=randint(0,2)\r\n#         if y>0:\r\n#             myPick=-1\r\n#             while myPick==-1 or arr3[myPick]==1:\r\n#                 myPick=randint(0,2)\r\n#         else:\r\n#             myPick=randint(0,2)\r\n#         arr2=[]\r\n#         for i in range(3):\r\n#             if i!=opponentPick and i!=myPick:\r\n#                 arr2.append(arr3[i])\r\n#         succeedCnts+=arr2[randint(0,len(arr2)-1)]\r\n#     return succeedCnts/cnts\r\n    \r\n\r\ndef main():\r\n    \r\n    eps=0\r\n    \r\n    n,p=input().split()\r\n    n=int(n)\r\n    p=float(p)\r\n    \r\n    x=-1\r\n    bb=n\r\n    while bb>0:\r\n        while x+bb<=n and getP(n,x+bb)+eps<p:\r\n            x+=bb\r\n        bb//=2\r\n    x+=1\r\n    \r\n    print(x)\r\n    \r\n    # for x in range(0,n+1):\r\n    #     p=getP(n,x)\r\n    #     p2=getP2(n,x)\r\n    #     print('x:{} p:{} p2:{}'.format(x,p,p2))\r\n    \r\n    return\r\n\r\n\r\nimport sys\r\n# input=sys.stdin.buffer.readline #FOR READING PURE INTEGER INPUTS (space separation ok)\r\ninput=lambda: sys.stdin.readline().rstrip(\"\\r\\n\") #FOR READING STRING/TEXT INPUTS.\r\n\r\ndef oneLineArrayPrint(arr):\r\n    print(' '.join([str(x) for x in arr]))\r\ndef multiLineArrayPrint(arr):\r\n    print('\\n'.join([str(x) for x in arr]))\r\ndef multiLineArrayOfArraysPrint(arr):\r\n    print('\\n'.join([' '.join([str(x) for x in y]) for y in arr]))\r\n \r\ndef readIntArr():\r\n    return [int(x) for x in input().split()]\r\n# def readFloatArr():\r\n#     return [float(x) for x in input().split()]\r\n \r\ndef makeArr(defaultValFactory,dimensionArr): # eg. makeArr(lambda:0,[n,m])\r\n    dv=defaultValFactory;da=dimensionArr\r\n    if len(da)==1:return [dv() for _ in range(da[0])]\r\n    else:return [makeArr(dv,da[1:]) for _ in range(da[0])]\r\n \r\ndef queryInteractive(x):\r\n    print('{}'.format(x))\r\n    sys.stdout.flush()\r\n    return int(input())\r\n \r\ndef answerInteractive(ans):\r\n    print('! {}'.format(ans))\r\n    sys.stdout.flush()\r\n \r\ninf=float('inf')\r\n# MOD=10**9+7\r\n# MOD=998244353\r\n\r\nfrom math import gcd,floor,ceil\r\n# from math import floor,ceil # for Python2\r\n \r\nfor _abc in range(1):\r\n    main()", "lang_cluster": "Python", "tags": ["math", "probabilities", "binary search"], "code_uid": "fbad8c0ff4198598c58afaadec37b257", "src_uid": "788ed59a964264bd0e755e155a37e14d", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "import random\r\n\r\ninp = input().split(\" \")\r\nN = int(inp[0])\r\nP = float(inp[1])\r\n\r\n\r\n# def sim1sm(N, P, s):\r\n#     numTrials = 20000\r\n#     succ = 0\r\n#     for _ in range(numTrials):\r\n#         r = [1]\r\n#         for _ in range(2):\r\n#             n = random.randint(s+1,N)\r\n#             while n in r:\r\n#                 n = random.randint(1,N)\r\n#             r.append(n)\r\n\r\n#         disc = []\r\n#         for i in range(3):\r\n#             if r[i] > s:\r\n#                 disc.append(r[i])\r\n#                 break\r\n#         if len(disc) == 0:\r\n#             succ += 1\r\n#             continue\r\n        \r\n#         sd = random.randint(1, 3)\r\n#         disc.append(r[sd-1])\r\n        \r\n#         fc = []\r\n#         for i in r:\r\n#             if not i in disc:\r\n#                 fc.append(i)\r\n        \r\n#         mcidx = random.randint(1, len(fc))\r\n#         mc = fc[mcidx - 1]\r\n#         if mc <= s:\r\n#             succ += 1\r\n        \r\n#     return succ/numTrials\r\n\r\nl = 0\r\nr = N\r\nwhile(l < r):\r\n    mid = int((l+r)/2)\r\n    expProb = 0.0\r\n    if mid >= 3:\r\n        expProb += ((mid * (mid-1) * (mid-2)) / (N * (N-1) * (N-2)))\r\n    if mid >= 2:\r\n        expProb += (3 * ((N - mid)/N) * (mid/(N-1)) * ((mid-1)/(N-2)))\r\n    if mid >= 1:\r\n        condProb = (3 * (mid/N) * ((N-mid)/(N-1)) * ((N-mid-1)/(N-2)))\r\n        expProb +=  (condProb * (1/3)) + (condProb * (1/3) * (1/2))\r\n\r\n    if expProb < P:\r\n        l = mid+1\r\n    else:\r\n        r = mid\r\n\r\nprint(l)\r\n    ", "lang_cluster": "Python", "tags": ["math", "probabilities", "combinatorics"], "code_uid": "e1c8d739bbc834f235c29881a0887750", "src_uid": "788ed59a964264bd0e755e155a37e14d", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, k, m = map(int, input().split())\n\nnums = list(map(int, input().split()))\n\nresult = -1\n\nalltime = sum(nums)\n\nfor made in range(n + 1):\n    if(alltime * made > m):\n        break\n    currentres = (k + 1) * made\n    currenttime = m - made * alltime\n    available = []\n    for item in nums:\n        available.extend([item]*(n - made))\n    available = sorted(available)\n    for item in available:\n        if(currenttime < item):\n            break\n        currenttime -= item\n        currentres += 1\n    result = max(result, currentres)\n\nprint(result)\n", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "dce159e6d93faf489ed937f42ff800de", "src_uid": "d659e92a410c1bc836be64fc1c0db160", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from functools import reduce\nn,k,m = map(int, input().split())\nt = list(map(int, input().split()))\nt.sort()\nsum = reduce(lambda x,y: x+y, t)\nmx = 0\nfull = 0\nwhile full <= n and full*sum <= m:\n\tcnt = full*k + full\n\tfree_time = m - sum*full\n\tfor time in t:\n\t\ttasks = min(n - full, free_time // time) \n\t\tcnt += tasks\n\t\tfree_time -= tasks*time\n\tmx = max(mx, cnt)\n\tfull += 1\nprint(mx)\t\n\n\n\n\n\n\n\n\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "greedy"], "code_uid": "e5ce00b1347e8b301630572b939d03b9", "src_uid": "d659e92a410c1bc836be64fc1c0db160", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "\nclass primes():\n    def __init__(self, n):\n        self.prime_num = n\n        self.min_prime = [-1] * (self.prime_num + 1)  # 2\u4ee5\u4e0a\u306e\u81ea\u7136\u6570\u306b\u5bfe\u3057\u3066\u6700\u5c0f\u306e\u7d20\u56e0\u6570\u3092\u8868\u3059\n        self.min_prime[0] = 0\n        self.min_prime[1] = 1\n        i = 2\n        self.prime = []\n        self.memo_prifac = {}\n        while i <= self.prime_num:\n            if self.min_prime[i] == -1:\n                self.min_prime[i] = i\n                self.prime.append(i)\n            for j in self.prime:\n                if i * j > self.prime_num or j > self.min_prime[i]: break\n                self.min_prime[j * i] = j\n            i += 1\n\n    def prifac(self, n):\n        # \u7d20\u56e0\u6570\u5206\u89e3\u3057\u305f\u7d50\u679c\u3092\u8fd4\u3059\n        if n in self.memo_prifac:\n            return self.memo_prifac[n]\n        res = {}\n        x = n\n        while x > 1:\n            p = self.min_prime[x]\n            if p in res:\n                res[p] += 1\n            else:\n                res[p] = 1\n            x //= p\n\n        # self.memo_prifac[n] = res  #\u5834\u5408\u306b\u3088\u3063\u3066\u306f\u3053\u306e\u884c\u3092\u6d88\u3059\u3068\u9ad8\u901f\u5316\n\n        return res\n\n    def divisors(self, n):\n        # \u7d04\u6570\u5217\u6319 \u30e1\u30e2\u3057\u305f\u65b9\u304c\u3044\u3044\u304b\u3082\n        if n== 1: return [1]\n        prf = self.prifac(n)\n        keys = [key for key in prf]\n\n        def divsearch(i):\n            if i == len(keys) - 1:\n                return [keys[i] ** j for j in range(prf[keys[i]] + 1)]\n            else:\n                res = []\n                subres = divsearch(i + 1)\n                p = keys[i]\n                for j in range(prf[p] + 1):\n                    for node in subres:\n                        res.append(node * p ** j)\n                return res\n\n        return divsearch(0)\n\n\nfrom math import gcd\ndef lcm(a,b):\n    return a*b//gcd(a,b)\nmod=10**9+7\nn=int(input())\nans=0\npri=primes(n+3)\ndp=[0]*(n+3)\nfor c in range(1,n-1):\n    k=n-c\n    yaku=pri.divisors(k)\n    yaku.sort(reverse=True)\n    for g in yaku:\n        m=k//g\n        dp[g]=m-1\n        for j in yaku:\n            if j>g and j%g==0:dp[g]-=dp[j]\n        ans+=(c*g//gcd(g,c))*dp[g]\n        ans%=mod\n    for g in yaku:dp[g]=0\nprint(ans)\n\n\n\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "7fa11fa67e89d4a82b45f3681285e007", "src_uid": "c3694a6ff95c64bef8cbe8834c3fd6cb", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\r\n\r\nmod = 1000000007\r\n\r\nn = int(input())\r\nres = 0\r\nphi = list(range(0,n+1))\r\n\r\nfor i in range(1,n+1):\r\n    for j in range(i*2,n+1,i):\r\n        phi[j] -= phi[i]\r\n\r\nphi[1] = 0\r\n\r\nfor g in range(1,n+1):\r\n    for sum_ab in range(g,n+1,g):\r\n        c = n - sum_ab\r\n        res += g // math.gcd(g,c) * c * phi[sum_ab//g]\r\n        res %= mod\r\n\r\nprint(res)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "c1b15e01fccb0069804e7e88622538ec", "src_uid": "c3694a6ff95c64bef8cbe8834c3fd6cb", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "MOD,fact=10**9+7,[1]*(2*10**6+5)\nfor i in range(1, len(fact)): fact[i]=(fact[i-1]*i)%(MOD)\ndef C(n,k):\n    return (fact[n]*pow(fact[k],MOD-2,MOD)**2)%MOD\nn=input()+1\nprint C(2*n,n)-1\n\n", "lang_cluster": "Python", "tags": ["combinatorics", "number theory"], "code_uid": "c809da44b694f6971c4c9b15e0aaee73", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "MOD,fact=10**9+7,[1]*(2*10**6+5)\nfor i in range(1, len(fact)): fact[i]=(fact[i-1]*i)%(MOD)\ndef C(n,k):\n    return (fact[n]*pow(fact[k],MOD-2,MOD)**2)%MOD\nn=input()+1\nprint C(2*n,n)-1\n\n", "lang_cluster": "Python", "tags": ["combinatorics", "number theory"], "code_uid": "b82a7b40dfcd69530bb6b8a3cce4c629", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def f(n,m):\n  if n<m:return f(m,n)\n  if m==1:\n    return (n+2)/3\n  if m==2:\n    return (n+2)/2\n  if m==3:\n    return (3*n+4)/4\n  if m==4:\n    if n==5 or n==6 or n==9:return n+1\n    else:return n\n  if m==5:\n    if n==7:return (6*n+6)/5\n    else:return (6*n+8)/5\n  if m==6:\n    if n%7==1:return (10*n+10)/7\n    else:return (10*n+12)/7\n    \n\ndef main():\n  n,m=map(int, raw_input().split())\n  print n*m-f(n,m)\n\nmain()", "lang_cluster": "Python", "tags": ["dsu", "dp", "bitmasks"], "code_uid": "ad14960e480bd3b0848371c84759b832", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\n\ndef f(n,m):\n  if n<m:return f(m,n)\n  if m==1:\n    return (n+2)/3\n  if m==2:\n    return (n+2)/2\n  if m==3:\n    return (3*n+4)/4\n  if m==4:\n    if n==5 or n==6 or n==9:return n+1\n    else:return n\n  if m==5:\n    if n==7:return (6*n+6)/5\n    else:return (6*n+8)/5\n  if m==6:\n    if n%7==1:return (10*n+10)/7\n    else:return (10*n+12)/7\n    \n\ndef main():\n  n,m=map(int, raw_input().split())\n  print n*m-f(n,m)\n\nmain()\n", "lang_cluster": "Python", "tags": ["dsu", "dp", "bitmasks"], "code_uid": "b77e7fbe33e2e798b7758f877d55bcf6", "src_uid": "097674b4dd696b30e102938f71dd39b9", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\n\nvectors = []\n\nline_parts = raw_input().split()\nx = int(line_parts[0])\ny = int(line_parts[1])\nn = int(line_parts[2])\nd = int(line_parts[3])\n\nfor i in range(n):\n  l = raw_input().split()\n  vectors.append((int(l[0]), int(l[1])))\n\nmp = {}\n\ndef canWin(x, y):\n\n  if math.sqrt(math.pow(x, 2) + math.pow(y, 2)) > float(d):\n    return False\n\n  if (x, y) in mp:\n    return mp[(x, y)]  \n    \n  result = True \n  \n  for v in vectors:\n    result = result and (not (canWin(x + v[0], y + v[1])))\n\n      \n  mp[(x, y)] = result\n  \n  return result\n\nresult = canWin(x , y)\n      \nif result == False:\n  print \"Anton\"\nelse:\n  print \"Dasha\"\n  ", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "547ccae5d4a881f50b51e88bb655445e", "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "\n\ndef dist(x, y):\n    return (x ** 2 + y ** 2) ** 0.5\n\n\nx0, y0, n, d = map(int, raw_input().split())\nmvs = []\nfor _ in range(n):\n    mvs.append(map(int, raw_input().split()))\n\ndp = [[False] * (2 * d + 1) for _ in range(2 * d + 1)]\nfor i in range(2 * d, -1, -1):\n    for j in range(2 * d, -1, -1):\n        x = i - d\n        y = j - d\n        if dist(x, y) <= d:\n            for dx, dy in mvs:\n                x1 = x + dx\n                y1 = y + dy\n                if dist(x1, y1) <= d and not dp[x1 + d][y1 + d]:\n                    dp[i][j] = True\nif dp[x0 + d][y0 + d]:\n    print('Anton')\nelse:\n    print('Dasha')\n", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "8d0028618684071cf17bd6a9afa5c12b", "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b, c = map(int, raw_input().split(' '))\nl = [a, b, c]\nl.sort()\n[a, b, c] = l\nif a % 2 == b % 2 == c % 2:\n\tprint b\nelse:\n\tif a % 2 == b % 2:\n\t\tprint b\n\telif a % 2 == c % 2:\n\t\tprint c\n\telse:\n\t\tprint c\n", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "4e2e37504efebdd05c1fd461e7436185", "src_uid": "b8008caf788336775cb8ebb76478b04c", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def pixel(input):\n    red, green, blue = input.split()\n    red = int(red)\n    green = int(green)\n    blue = int(blue)\n\n    plist = [red,green,blue]\n    plist.sort()\n\n    lowestChet = is_chet(plist[0])\n    midChet = is_chet(plist[1])\n\n    if ((midChet + lowestChet) == 2) or ((midChet + lowestChet) == 0):\n        return plist[1]\n    else:\n        return plist[2]\n\n\ndef is_chet(n):\n    return 1 if n % 2 == 0 else 0\n    \nprint(pixel(input()))", "lang_cluster": "Python", "tags": ["math", "constructive algorithms"], "code_uid": "d2a21bc1482870decf9f7c6317b170e8", "src_uid": "b8008caf788336775cb8ebb76478b04c", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,x,y,c=map(int,raw_input().split())\nl,h=0,n*3\nV=lambda z:z>0 and z*(z+1)/2\nW=lambda z:z>0 and z*z\nwhile l<h:\n  m=(l+h)/2\n  d,e,f=n-m,x-y,x+y\n  s=V(m)*4+1-W(1-x+m)-W(x-d)-W(1-y+m)-W(y-d)+V(f-d-n-1)+V(1-f+m)+V(e-d)+V(-e-d)\n  if s<c:\n    l=m+1\n  else:\n    h=m\nprint l\n", "lang_cluster": "Python", "tags": ["math", "implementation", "binary search"], "code_uid": "5773190f71a26da54aeea05da03239d2", "src_uid": "232c5206ee7c1903556c3625e0b0efc6", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\ndef corner( a , b , s ) :\n    res = 0\n    if ( a > b ) :\n        a , b = b , a\n    if ( s > b ) :\n        return a * b - corner( a , b , max( 0 , a + b - 1 - s ) )\n    s1 = min( s , a )\n    res = s1 * ( s1 + 1 ) / 2\n    s2 = max( 0 , min( s - a , b - a ) )\n    res += s2 * a\n    return res\n\ndef cells( n , x , y , s ) :\n    res = corner( x - 1 , y - 1 , s - 1 ) + corner( x - 1 , n - y , s - 1 )\n    res += corner( n - x , y - 1 , s - 1 ) + corner( n - x , n - y , s - 1 )\n    res += min( s , x - 1 ) + min( s , y - 1 ) + min( s , n - x ) + min( s , n - y )\n    return res + 1  \n\ndef main() :\n    n , x , y , c = [ int( x ) for x in sys.stdin.readline().split() ]\n    if ( c <= 1 ) :\n       print 0\n       return\n    sHigh = 1\n    while cells( n , x , y , sHigh ) < c :\n        sHigh *= 2\n    sLow = int( sHigh / 2 )\n    while ( sHigh - sLow > 1 ) :\n        sMid = ( sLow + sHigh ) / 2\n        if ( cells( n , x , y , sMid ) >= c ) :\n            sHigh = sMid\n        else :\n            sLow = sMid\n    print sHigh\n    return\n\nif __name__ == '__main__' :\n    main()\n    \n", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search"], "code_uid": "fad077d616c9576ec3581481b5954640", "src_uid": "232c5206ee7c1903556c3625e0b0efc6", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "R=lambda:map(int,raw_input().split())\nM=10**9+7\nK=lambda x,y,z:((x*60)+y)*60+z\nn,k=R()\nv=[0,0]\nfor x in R():v[x>50]+=1\nk/=50\nt,c,q,h=[M]*8192,[0]*8192,[K(0,v[0],v[1])],0\nt[q[h]]=0\nc[q[h]]=1\nd=[[1]*64 for _ in range(64)]\nfor i in range(60):\n  d[i][0]=d[i][i]=1\n  for j in range(1,i):\n    d[i][j]=(d[i-1][j-1]+d[i-1][j])%M\nwhile h<len(q):\n  u,h=q[h],h+1\n  x,y,z=u/3600,u/60%60,u%60\n  for i in range(y+1):\n    for j in range(z+1):\n      if (i+j) and i+j*2<=k:\n        w=K(1-x,v[0]-y+i,v[1]-z+j)\n        if t[w]>=M:\n          t[w]=t[u]+1\n          q+=[w]\n        if t[w]==t[u]+1:\n          c[w]=(c[w]+c[u]*d[y][i]*d[z][j])%M\nu=K(1,v[0],v[1])\nprint t[u] if t[u]<M else -1\nprint c[u]\n\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "graphs", "shortest paths"], "code_uid": "abec710ee27f37eeb7d004b4c20d37b5", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "R=lambda:map(int,raw_input().split())\nM=10**9+7\nK=lambda x,y,z:((x*60)+y)*60+z\nn,k=R()\nv=[0,0]\nfor x in R():v[x>50]+=1\nk/=50\nt,c,q,h=[M]*8192,[0]*8192,[K(0,v[0],v[1])],0\nt[q[h]]=0\nc[q[h]]=1\nd=[[1]*64 for _ in range(64)]\nfor i in range(60):\n  d[i][0]=d[i][i]=1\n  for j in range(1,i):\n    d[i][j]=(d[i-1][j-1]+d[i-1][j])%M\nwhile h<len(q):\n  u,h=q[h],h+1\n  x,y,z=u/3600,u/60%60,u%60\n  for i in range(y+1):\n    for j in range(z+1):\n      if (i+j) and i+j*2<=k:\n        w=K(1-x,v[0]-y+i,v[1]-z+j)\n        if t[w]>=M:\n          t[w]=t[u]+1\n          q+=[w]\n        if t[w]==t[u]+1:\n          c[w]=(c[w]+c[u]*d[y][i]*d[z][j])%M\nu=K(1,v[0],v[1])\nprint t[u] if t[u]<M else -1\nprint c[u]\n\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "graphs", "shortest paths"], "code_uid": "93cbc2a5c413cf5ad8f0e788b095aae3", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n# -*- coding: UTF-8 -*-\n\nimport sys\n\nMAXN = 110\nMOD = 10 ** 9 + 7\nINF = MOD\n\ndef MakeCom():\n\tglobal com\n\tcom = [[1]]\n\tfor i in xrange(1, MAXN + 1):\n\t\tline = [1]\n\t\tfor j in xrange(1, i):\n\t\t\tline.append((com[-1][j - 1] + com[-1][j]) % MOD)\n\t\tline.append(1)\n\t\tcom.append(line)\n\ndef ReadIn():\n\tdata = [int(x) for x in sys.stdin.read().split()]\n\toffset = 0\n\twhile offset < len(data):\n\t\tn, cap = data[offset : offset + 2]\n\t\toffset += 2\n\t\tfriends = [0] * 2\n\t\tfor x in data[offset : offset + n]:\n\t\t\tfriends[x / 50 - 1] += 1\n\t\toffset += n\n\t\tcap /= 50\n\t\tyield cap, tuple(friends)\n\ndef Solve(cap, friends):\n\tf = {friends : 1}\n\tfor rides in xrange(sum(friends) * 5):\n\t\tif rides & 1 and friends in f:\n\t\t\tprint rides\n\t\t\tprint f[friends]\n\t\t\treturn\n\t\tpf, f = f, {}\n\t\tfor remain in pf:\n\t\t\tfor x in xrange(remain[0] + 1):\n\t\t\t\tif x > cap: break\n\t\t\t\tfor y in xrange(remain[1] + 1):\n\t\t\t\t\tif x + y < 1: continue\n\t\t\t\t\tif x + 2 * y > cap: break\n\t\t\t\t\tnextRem = tuple(total - left + move\n\t\t\t\t\t\t\tfor total, left, move in zip(friends, remain, (x, y)))\n\t\t\t\t\tf[nextRem] = (f.get(nextRem, 0) + com[remain[0]][x] * com[remain[1]][y] * pf[remain]) % MOD\n\t\n\tprint -1\n\tprint 0\n\n\nif __name__ == '__main__':\n\tMakeCom()\n\tfor cap, friends in ReadIn():\n\t\tSolve(cap, friends)\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "graphs", "shortest paths"], "code_uid": "ba7a53bbf2d97c013f2f9c14ea317d35", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "R=lambda:map(int,raw_input().split())\nM=10**9+7\nK=lambda x,y,z:((x*60)+y)*60+z\nn,k=R()\nv=[0,0]\nfor x in R():v[x>50]+=1\nk/=50\nt,c,q,h=[M]*8192,[0]*8192,[K(0,v[0],v[1])],0\nt[q[h]]=0\nc[q[h]]=1\nd=[[1]*64 for _ in range(64)]\nfor i in range(60):\n  d[i][0]=d[i][i]=1\n  for j in range(1,i):\n    d[i][j]=(d[i-1][j-1]+d[i-1][j])%M\nwhile h<len(q):\n  u,h=q[h],h+1\n  x,y,z=u/3600,u/60%60,u%60\n  for i in range(y+1):\n    for j in range(z+1):\n      if (i+j) and i+j*2<=k:\n        w=K(1-x,v[0]-y+i,v[1]-z+j)\n        if t[w]>=M:\n          t[w]=t[u]+1\n          q+=[w]\n        if t[w]==t[u]+1:\n          c[w]=(c[w]+c[u]*d[y][i]*d[z][j])%M\nu=K(1,v[0],v[1])\nprint t[u] if t[u]<M else -1\nprint c[u]\n\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "graphs", "shortest paths"], "code_uid": "5d680b589ebeb5c5e2d60126b4bc0195", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "R=lambda:map(int,raw_input().split())\nM=10**9+7\nK=lambda x,y,z:((x*60)+y)*60+z\nn,k=R()\nv=[0,0]\nfor x in R():v[x>50]+=1\nk/=50\nt,c,q,h=[M]*8192,[0]*8192,[K(0,v[0],v[1])],0\nt[q[h]]=0\nc[q[h]]=1\nd=[[1]*64 for _ in range(64)]\nfor i in range(60):\n  d[i][0]=d[i][i]=1\n  for j in range(1,i):\n    d[i][j]=(d[i-1][j-1]+d[i-1][j])%M\nwhile h<len(q):\n  u,h=q[h],h+1\n  x,y,z=u/3600,u/60%60,u%60\n  for i in range(y+1):\n    for j in range(z+1):\n      if (i+j) and i+j*2<=k:\n        w=K(1-x,v[0]-y+i,v[1]-z+j)\n        if t[w]>=M:\n          t[w]=t[u]+1\n          q+=[w]\n        if t[w]==t[u]+1:\n          c[w]=(c[w]+c[u]*d[y][i]*d[z][j])%M\nu=K(1,v[0],v[1])\nprint t[u] if t[u]<M else -1\nprint c[u]\n\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "graphs", "shortest paths"], "code_uid": "ae428e251d14de46c698642e7430197a", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "R=lambda:map(int,raw_input().split())\nM=10**9+7\nK=lambda x,y,z:((x*60)+y)*60+z\nn,k=R()\nv=[0,0]\nfor x in R():v[x>50]+=1\nk/=50\nt,c,q,h=[M]*8192,[0]*8192,[K(0,v[0],v[1])],0\nt[q[h]]=0\nc[q[h]]=1\nd=[[1]*64 for _ in range(64)]\nfor i in range(60):\n  d[i][0]=d[i][i]=1\n  for j in range(1,i):\n    d[i][j]=(d[i-1][j-1]+d[i-1][j])%M\nwhile h<len(q):\n  u,h=q[h],h+1\n  x,y,z=u/3600,u/60%60,u%60\n  for i in range(y+1):\n    for j in range(z+1):\n      if (i+j) and i+j*2<=k:\n        w=K(1-x,v[0]-y+i,v[1]-z+j)\n        if t[w]>=M:\n          t[w]=t[u]+1\n          q+=[w]\n        if t[w]==t[u]+1:\n          c[w]=(c[w]+c[u]*d[y][i]*d[z][j])%M\nu=K(1,v[0],v[1])\nprint t[u] if t[u]<M else -1\nprint c[u]\n\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "graphs", "shortest paths"], "code_uid": "92b274b359ded7e3c91978762ac01081", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "R=lambda:map(int,raw_input().split())\nM=10**9+7\nK=lambda x,y,z:((x*60)+y)*60+z\nn,k=R()\nv=[0,0]\nfor x in R():v[x>50]+=1\nk/=50\nt,c,q,h=[M]*8192,[0]*8192,[K(0,v[0],v[1])],0\nt[q[h]]=0\nc[q[h]]=1\nd=[[1]*64 for _ in range(64)]\nfor i in range(60):\n  d[i][0]=d[i][i]=1\n  for j in range(1,i):\n    d[i][j]=(d[i-1][j-1]+d[i-1][j])%M\nwhile h<len(q):\n  u,h=q[h],h+1\n  x,y,z=u/3600,u/60%60,u%60\n  for i in range(y+1):\n    for j in range(z+1):\n      if (i+j) and i+j*2<=k:\n        w=K(1-x,v[0]-y+i,v[1]-z+j)\n        if t[w]>=M:\n          t[w]=t[u]+1\n          q+=[w]\n        if t[w]==t[u]+1:\n          c[w]=(c[w]+c[u]*d[y][i]*d[z][j])%M\nu=K(1,v[0],v[1])\nprint t[u] if t[u]<M else -1\nprint c[u]\n\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "graphs", "shortest paths"], "code_uid": "d84dd86e03d4764401767fe9ca44a59b", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "R=lambda:map(int,raw_input().split())\nM=10**9+7\nK=lambda x,y,z:((x*60)+y)*60+z\nn,k=R()\nv=[0,0]\nfor x in R():v[x>50]+=1\nk/=50\nt,c,q,h=[M]*8192,[0]*8192,[K(0,v[0],v[1])],0\nt[q[h]]=0\nc[q[h]]=1\nd=[[1]*64 for _ in range(64)]\nfor i in range(60):\n  d[i][0]=d[i][i]=1\n  for j in range(1,i):\n    d[i][j]=(d[i-1][j-1]+d[i-1][j])%M\nwhile h<len(q):\n  u,h=q[h],h+1\n  x,y,z=u/3600,u/60%60,u%60\n  for i in range(y+1):\n    for j in range(z+1):\n      if (i+j) and i+j*2<=k:\n        w=K(1-x,v[0]-y+i,v[1]-z+j)\n        if t[w]>=M:\n          t[w]=t[u]+1\n          q+=[w]\n        if t[w]==t[u]+1:\n          c[w]=(c[w]+c[u]*d[y][i]*d[z][j])%M\nu=K(1,v[0],v[1])\nprint t[u] if t[u]<M else -1\nprint c[u]\n\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "graphs", "shortest paths"], "code_uid": "2cd9aff96ca7416ee64599d5d72be451", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "R=lambda:map(int,raw_input().split())\nM=10**9+7\nK=lambda x,y,z:((x*60)+y)*60+z\nn,k=R()\nv=[0,0]\nfor x in R():v[x>50]+=1\nk/=50\nt,c,q,h=[M]*8192,[0]*8192,[K(0,v[0],v[1])],0\nt[q[h]]=0\nc[q[h]]=1\nd=[[1]*64 for _ in range(64)]\nfor i in range(60):\n  d[i][0]=d[i][i]=1\n  for j in range(1,i):\n    d[i][j]=(d[i-1][j-1]+d[i-1][j])%M\nwhile h<len(q):\n  u,h=q[h],h+1\n  x,y,z=u/3600,u/60%60,u%60\n  for i in range(y+1):\n    for j in range(z+1):\n      if (i+j) and i+j*2<=k:\n        w=K(1-x,v[0]-y+i,v[1]-z+j)\n        if t[w]>=M:\n          t[w]=t[u]+1\n          q+=[w]\n        if t[w]==t[u]+1:\n          c[w]=(c[w]+c[u]*d[y][i]*d[z][j])%M\nu=K(1,v[0],v[1])\nprint t[u] if t[u]<M else -1\nprint c[u]\n\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "graphs", "shortest paths"], "code_uid": "9b8e85944d336fcfcd0ca178e280dace", "src_uid": "ebb0323a854e19794c79ab559792a1f7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split(\" \"))\nif n==1 or m==1:\n    print((((n*m)//6)*6)+((n*m)%6>3)*((((n*m)%6)%3)*2))\n    \nelif n*m<6:\n    print(0)\n    \nelif n*m==6:\n    print(4)\nelif n*m==14:\n    print(12)\n# elif (n==2 and m%2==1) or (m==2 and n%2==1):\n#     print(n*m-2)\n# elif((n==2 and m%2==0) or (m==2 and n%2==0)):\n#     print(n*m)\nelse:\n    print(n*m-(n*m)%2)\n    ", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "946245c47be95dfb21a78b51802214e8", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = map(int, input().split())\nif n >= 4 and m >= 4:\n    print(n * m - (n * m % 2))\nelse:\n    if min(n, m) == 1:\n        if max(n, m) % 6 == 5:\n            print(max(n, m) // 6 * 6 + 4)\n        elif max(n, m) % 6 == 4:\n            print(max(n, m) // 6 * 6 + 2)\n        else:\n            print(max(n, m) // 6 * 6)\n    elif min(n, m) ==  2 and max(n, m) == 7:\n        print(12)\n    elif min(n, m) == 2 and max(n, m) >= 4 or min(n, m) == 3 and max(n, m) >= 4:\n        print(n * m - (n * m % 2))\n    else:\n        d = [[0, 0, 0, 2, 4], [0, 0, 4, 8, 10], [0, 0, 8, 12, 14], [0, 0, 0, 16, 20], [0, 0, 0, 0, 24]]\n        print(d[min(n, m) - 1][max(n, m) - 1])\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "ecd2e4fa195e1451b887e81354bc3676", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=sorted(map(int,input().split()))\nprint(~1&n*m-2*{1:1<m%6<5,2:{2:2,3:1,7:1}.get(m,0)}.get(n,0))", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "6c7f9aa135b87090e1b1eff41e9e978c", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=sorted(map(int,input().split()))\nprint(n*m-{1:min(m%6,6-m%6),2:{2:4,3:2,7:2}.get(m,0)}.get(n,n&1*m&1))\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "c74e62b52b5f29f7ade4d9d2d7a83400", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def main():\n    n, m = map(int, raw_input().split(' '))\n    if (n % 2 == 0) and (m % 2 == 0):\n        if (n == 2) and (m == 2):\n            print(0)\n        else:\n            print(m*n)\n    else:\n        if (n % 2 == 1) and (m % 2 == 1):\n            if (n == 1) and (m == 1):\n                print(0)\n            elif (n == 1) and (m % 6 == 3):\n                print(m - 3)\n            elif (n % 6 == 3) and (m == 1):\n                print(n - 3)\n            else:\n                print(m*n - 1)\n        else:\n            if (n == 1) or (m == 1):\n                if (n % 6 == 0) or (m % 6 == 0):\n                    print(m*n)\n                else:\n                    print(m*n - 2)\n            elif (n == 2) or (m == 2):\n                if (n in [3, 7]) or (m in [3, 7]):\n                    print(m*n - 2)\n                else:\n                    print(m*n)\n            else:\n                print(m*n)\n\n\nif __name__ == '__main__':\n    main()", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "7321a16e834e7509609cd8038aa27972", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "M=list(map(int,input().split()))\nM.sort()\n\nif M[0]==1:\n    x,y=divmod(M[1],6)\n\n    ANS=x*6\n    if y<=3:\n        print(ANS)\n    elif y==4:\n        print(ANS+2)\n    elif y==5:\n        print(ANS+4)\n\nelif M[0]==2:\n    if M[1]==2:\n        print(0)\n    elif M[1]==3:\n        print(4)\n    elif M[1]==7:\n        print(12)\n    else:\n        print(M[1]*2)\n\nelif M[0]==3:\n    if M[1]==3:\n        print(8)\n\n    elif M[1]>=4:\n        print(M[0]*M[1]//2*2)\n\nelse:\n    print(M[0]*M[1]//2*2)\n        \n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "f6c26a50a87c56a5a296ac99cd540fe7", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from fractions import gcd\nfrom math import factorial, ceil, sqrt, atan2, log, pi, e, asin,acos, cos, sin, floor\nfrom itertools import *\nfrom fractions import Fraction\nimport string\nimport copy\nimport random\nimport bisect\nfrom decimal import *\nfrom collections import deque\nfrom sys import *\ndigs = string.digits + string.ascii_letters\n\ndef id_generator(size=20, chars=string.digits):\n    return ''.join(random.choice(chars) for _ in range(size))\n \ndef mp():\n    return map(int,str(raw_input()).split())\n\n\nn,m=mp()\nif n>m:\n\tn,m=m,n\nif n==1:\n\tif m%6==1:\n\t\tprint m-1\n\telif m%6==2:\n\t\tprint m-2\n\telif m%6==3:\n\t\tprint m-3\n\telif m%6==4:\n\t\tprint m-2\n\telif m%6==5:\n\t\tprint m-1\n\telse:\n\t\tprint m\n\texit()\n\nif n==2:\n\ttotal=m*n\n\tif m==1 or m==3 or m==7:\n\t\tprint total-2\n\telif m==2:\n\t\tprint total-4\n\telse:\n\t\tprint total\n\texit()\n\n\nprint n*m-((n*m)%2)\n#if (n%2==0 and m%2==0):\n#\tprint n*m\n#\texit()", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "9b4830f15426f41b8640e0ceedab48d2", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "class Solution(object):\n    def run(self):\n        n, m = [int(x) for x in input().split()]\n        if n > m:\n            n, m = m, n\n        res = (n * m) // 2\n        if n == 1 and (m + 1) % 6 // 3:\n            res -= 1\n        elif n == 2:\n            if m == 2:\n                res = 0\n            elif m == 3:\n                res = 2\n            elif m == 7:\n                res = 6\n        print(res * 2)\n\nif __name__ == '__main__':\n    Solution().run()", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "d083f4c6083cff34f64b74c6921ce3f5", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "INF = 999999999999999999L\nEPS = 1e-12\n\ndef read():\n    return raw_input().strip()\n\ndef read_ints():\n    return map(int,read().split())\n\nn,m = read_ints()\nif n > m:\n    n,m = m,n \n    \nif n == 1:\n    empty = [0,1,2,3,2,1][m%6]\nelif n == 2:\n    if m == 2:\n        empty = 4\n    elif m in [3,7]:\n        empty = 2\n    else:\n        empty = 0 \nelse:\n    empty = (n*m)%2 \n    \nprint n*m - empty \n\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "001eacc80362e6143d25fb328fa1b1bb", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = map(int, input().split())\nm,n = max(m,n), min(n,m)\na = m * n\nif m == 7 and n == 2:\n    print(12)\n    exit()\nif m == 3 and n == 2:\n    print(4)\n    exit()\nif n == 1:\n    print(a - min(m % 6, 6 - m % 6))\nelse:\n    if m * n >= 6:\n        print(n * m - (n*m) % 2)\n    else:\n        print(0)", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "1a823fdf0e68ec02dfaf71cabb55455a", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = map(int, input().split())\nif n > m:\n  n, m = m, n\nif n == 1:\n  print(m // 6 + (m + 1) // 6 + (m + 2) // 6 << 1)\nelif n == 2:\n  print(0 if m == 2 else 4 if m == 3 else 12 if m == 7 else n * m)\nelse:\n  print(n * m >> 1 << 1)", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "c6f7b3ea65cbaba92ed05bda3809001c", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\nif n > m:\n  n, m = m, n\nif n == 1:\n  print(([0, 0, 0, 0, 1, 2][m % 6] + m // 6 * 3) * 2)\n  exit(0)\nif n == 2:\n  if m == 2:\n    print(0)\n  elif m == 3:\n    print(4)\n  elif m == 7:\n    print(12)\n  else:\n    print(n * m)\n  exit(0)\nprint((n * m) // 2 * 2)\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "a1047bb00168b6adc24690d46c00a2a2", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m=map(int,raw_input().split())\nif n<m:\n    n,m=m,n\n\nif n-1+m-1<3:\n    print 0\n    exit()\n\nif m==1:\n    print n-abs(abs(n%6-3)-3)\n    exit()\nif m==2 and n==3:\n    print 4\n    exit()\nif m==2 and n==7:\n    print 12\n    exit()\nprint n*m-(n*m)%2\nexit()\n\n\nif n%4==0 and m%4==0:\n    print n*m\n    exit()\n\n\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "73b90029ba293a3e17f0214f2e2459ac", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=sorted(map(int,input().split()))\nprint(n*m-{1:min(m%6,6-m%6),2:2*(m in [3,7])+4*(m==2)}.get(n,n&1*m&1))\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "b1620a6878726b5d4ebe25fe2e83815c", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\nif (n*m<4 and (n==1 or m==1)) or (n*m<5 and (n!=1 and m!=1)):\n    print(0)\nelse:\n    l=n*m\n    if n%2==0 and m%2==0:\n        if n==m:\n            if n%3!=0 and n%4!=0:\n                print(l-4)\n            else:\n                print(l)\n        else:\n            if n%4==0 or m%4==0:\n                print(l)\n            elif n%3==0 or m%3==0:\n                print(l)\n            else:\n                print(l-2)\n    elif n%2!=0 and m%2!=0:\n        if n==1 or m==1:\n            z=max(n,m)\n            if z%6==0:\n                print(z)\n            else:\n                s1=(z//6)*6\n                r=z%6\n                if r>3:\n                    s1=s1+2\n                    r=r%4\n                    s1=s1+(r*2)\n                print(s1)\n        else:\n            print(l-1)\n    #case3\n    else:\n        if n==1 or m==1:\n            z=max(n,m)\n            if z%6==0:\n                print(z)\n            else:\n                s1=(z//6)*6\n                r=z%6\n                if r>3:\n                    s1=s1+2\n                    r=r%4\n                    s1=s1+(r*2)\n                print(s1)\n        else:\n            if n%4==0 or m%4==0:\n                print(l)\n            elif n%6==0 or m%6==0:\n                print(l)\n            else:    \n                if n%2==0:\n                    z=m\n                else:\n                    z=n\n                if z%4==1:\n                    print(l)\n                else:\n                    if z>=6:\n                        if z%6==1:\n                            if z>7 and z%4==3:\n                                print(l)\n                            else:\n                                print(l-2)\n                        elif z%6==5 and z%4==3:\n                            print(l)    \n                        elif z%6==3:\n                            print(l)\n                    else:\n                        print(l-2)", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "af05cd1432dd0d984bc69492a2cf3e82", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b = map(int,input().split())\na,b = min(a,b),max(a,b)\nif a==1:\n    c=b%6\n    if c==4:print((b//6)*6 + 2)\n    elif c==5:print((b//6)*6 + 4)\n    else:print((b//6)*6)\nelif a==2:\n    if b<=2:print(0)\n    elif b==3 or b==7:print((a*b)-2)\n    else:\n        print((b) * 2)\nelse:\n    ans=a*b\n    if ans%2==0:\n        print(ans)\n    else:\n        print(ans-1)\n\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "40245b9287dfa8af9227ad8899b7881b", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\nimport sys\nn, m = map(int, input().split())\nif n > m:\n    n, m = m, n\nif n == 1:\n    print(6 * (m // 6) + 2 * max(0, (m % 6) - 3))\nelif n == 2:\n    if m == 2:\n        print(0)\n    elif m in (1, 3, 7):\n        print(n * m - 2)\n    else:\n        print(n * m)\nelse:\n    print((n * m // 2) * 2)\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "06146398902f64bf6978e6dda6adac7c", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=map(int,input().split())\nif n > m:\n    m,n=n, m\nif n == 1:\n    if m % 6 == 0:\n        print(m)\n    elif m % 6 <= 3:\n        print(m-(m%6))\n    else:\n        print(m-(6-m%6))\nelif( n == 2 and m == 2 ):\n\tprint(0)\nelif( n == 2 and m == 3 ):\n\tprint(4);\nelif( n == 2 and m == 7 ):\n\tprint(12)\nelse:\n    if n % 2 and m % 2:\n        print(n*m-1);\n    else:\n        print(n*m)\n# find the formula myself!", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "102c8cffa764520b34e4a37b8af3ce08", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m=sorted(map(int,input().split()))\nprint(~1&n*m-{1:2*(1<m%6<5),2:{2:4,3:2,7:2}.get(m,0)}.get(n,0))", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "3a6fdb2fef2bd5c15f56f167f7c74418", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = [int(i) for i in input().split()]\nm, n = max(m, n), min(n, m)\na = m * n\nif m == 7 and n == 2:\n    print(12)\n    exit()\nif m == 3 and n == 2:\n    print(4)\n    exit()\nif n == 1:\n    print(a - min(m % 6, 6 - m % 6))\nelse:\n    if m * n >= 6:\n        print(n * m - (n * m) % 2)\n    else:\n        print(0)\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "2979ab719bf6475e3726fed4f7ba23ff", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def check(n):\n\tif(n==2):\n\t\treturn 0\n\tif(n%2==0):\n\t\treturn 1\n\treturn 0\ndef ans(n,m):\n\tmp={}\n\tmp[0]=0\n\tmp[1]=1\n\tmp[2]=2\n\tmp[3]=3\n\tmp[4]=2\n\tmp[5]=1\n\tif(m==1):\n\t\treturn mp[n%6]\n\tif(m==2):\n\t\tif(n==3):\n\t\t\treturn 2\n\t\tif(n==2):\n\t\t\treturn 4\n\t\tif(n==7):\n\t\t\treturn 2 \t\n\treturn (n*m)%2\n\nn,m=map(int,raw_input().split(\" \"))\nn1=n\nm1=m\nif(n<m):\n\t(n,m)=(m,n)\nprint n*m-ans(n,m)", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "1a4aead1319143fc7c963fc799dc2455", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "N,M = map(int,input().split())\nl = [0,1,2,3,2,1]\n\nres = float('inf')\n\nfor (n,m) in ((N,M),(M,N)):\n    if l[n%6]==0:\n        print(n*m)\n        exit()\n    elif l[n%6]==1:\n        tmp = l[m%6]\n        res = min(res,tmp)\n    elif l[n%6]==2:\n        if m>=4 and m!=7:\n            print(n*m)\n            exit()\n        if m==2:\n            tmp = 4\n        else:\n            tmp = 2\n        res = min(res,tmp)\n    else:\n        if m==1:\n            tmp = 3\n        elif m==2:\n            tmp = 2\n        elif m%2==0:\n            print(n*m)\n            exit()\n        else:\n            tmp = 1\n        res = min(res,tmp)\n\nprint(n*m-res)\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "ae8753d7c604ae2662a9d21748885fc5", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, m = [int(x) for x in input().split()]\n\ndef cal(n, m):\n    if n < m:\n        n, m = m, n\n    if m == 1:\n        dt = {\n            0: 0,\n            1: 1,\n            2: 2,\n            3: 3,\n            4: 2,\n            5: 1\n        }\n        return dt[n % 6]\n    if n == 7:\n        if m == 2:\n            return 2\n        return n * m % 2\n    elif n >= 4:\n        return n * m % 2\n    else:\n        dt = {\n            (3, 2): 2,\n            (3, 1): 3,\n            (2, 2): 4,\n            (2, 1): 2\n        }\n        return dt.get((n, m), n * m % 2)\n\nprint(n * m - cal(n, m))\n", "lang_cluster": "Python", "tags": ["brute force", "constructive algorithms", "flows", "graph matchings"], "code_uid": "d20e4f31bfdfb0f448895136bf6553d8", "src_uid": "02ce135a4b276d1e9ba6a4ce37f2fe70", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "mercenes = [2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701, 23209, 44497, 86243, 110503, 132049, 216091, 756839, 859433, 1257787, 1398269, 2976221, 3021377, 6972593, 13466917, 20996011, 24036583, 25964951, 30402457, 32582657, 37156667]\nprint((2**(mercenes[int(input())-1]-1)-1)%1000000007)", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "d2282e072300044aacb9d4f8c664305e", "src_uid": "c2cbc35012c6ff7ab0d6899e6015e4e7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a=[2,3,5,7,13,17,19,31,61,89,107,127,521,607,1279,2203,2281,3217,4253,4423,9689,9941,11213,19937,21701,23209,44497,86243,110503,132049,216091,756839,859433,1257787,1398269,2976221,3021377,6972593,13466917,20996011]\nn=input()\nprint pow(2,a[n-1]-1,10**9+7)-1\n\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "7b89690b4c4c64deb012345e94c951b6", "src_uid": "c2cbc35012c6ff7ab0d6899e6015e4e7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "r = lambda: raw_input().strip()\n\ndef check_possibility(new_position, M):\n    if len(M) == 0:\n        print 'WIN'\n        exit()\n    candidate_moves = []\n    for c in [(0,0),(-1,0),(1,0),(0,1),(0,-1),(-1,-1),(-1,1),(1,-1),(1,1)]:\n        new_coord = (new_position[0]+c[0], new_position[1]+c[1])\n        if 0 <= new_coord[0] <= 7 and 0 <= new_coord[1] <= 7:\n            candidate_moves.append(new_coord)\n    candidate_moves = [c for c in candidate_moves if c not in M.keys()]\n    M = dict([[(c[0],c[1]+1),'S'] for c in M.keys() if c[1]<7])\n    candidate_moves = [c for c in candidate_moves if c not in M.keys()]\n    for c in candidate_moves:\n        check_possibility(c, dict(M.items()))\n\n\nstatue_locations = {}\nfor i in xrange(8):\n    row = list(r())\n    for j in xrange(8):\n        if row[j] == 'S':\n            statue_locations[(j,i)] = row[j]\n\n\ncheck_possibility((0,7), dict(statue_locations.items()))\nprint 'LOSE'\n", "lang_cluster": "Python", "tags": ["dfs and similar", "implementation", "graphs"], "code_uid": "bab4c72cda6aa6254db2305c6c0b5c6d", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "r, s = [63], ''.join(input() + 'T' for i in range(8)) + 'T' * 9\nfor i in range(0, 72, 9):\n    t = set()\n    for x in r:\n        for y in (x, x - 1, x + 1, x - 9, x + 9, x - 10, x - 8, x + 10, x + 8):\n            if s[y] == 'T': continue\n            if (y < i or s[y - i] != 'S') and (y < i + 9 or s[y - i - 9] != 'S'): t.add(y)\n    r = t\nprint('WIN' if r else 'LOSE')\n", "lang_cluster": "Python", "tags": ["dfs and similar"], "code_uid": "3d172c3789f5cf9bebda0efab4dbcc6e", "src_uid": "f47e4ab041288ba9567c19930eb9a090", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from itertools import permutations\nnums = list(map(int, input().split()))\no = input().split()\nprint(min(eval(\"min(((a{0}b){1}c){2}d,(a{0}b){2}(c{1}d))\".format(*o)) for a, b, c, d in permutations(nums)))", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "d13597de962f57e4aa28ef1b0eaafd64", "src_uid": "7a66fae63d9b27e444d84447012e484c", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from itertools import *\nl = map(int,raw_input().strip().split())\nops = raw_input().strip().split()\n\nop = lambda o, a, b: a*b if o=='*' else a+b\n\nprint min(\\\n    min(op(ops[2],op(ops[1],op(ops[0],p[0],p[1]),p[2]),p[3]) for p in permutations(l,4)),\\\n    min(op(ops[2],op(ops[0],p[0],p[1]),op(ops[1],p[2],p[3])) for p in permutations(l,4)))\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "55860b03b15f1fe43f52a68411832236", "src_uid": "7a66fae63d9b27e444d84447012e484c", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "[h,m,s,t1,t2] = [int(x) for x in input().split()]\nhh = h + m/60 + s/3600 \nmm = m/5\nss = s/5\n\nll = [hh,mm,ss,t1,t2]\nll = sorted(ll)\n\ndiff = abs(ll.index(t1)-ll.index(t2))\nif diff==1 or diff==4:\n    print('YES')\nelse:\n    print('NO')\n\n\n\n\n# Made By Mostafa_Khaled", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "41e9ad66a91d4a68ef37b27990cdc1c9", "src_uid": "912c8f557a976bdedda728ba9f916c95", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "h,m,s,t1,t2=map(int,input().split())\nm+=s/60\nh+=m/60\nm/=5\ns/=5\nh=h%12\nm=m%12\ns=s%12\nT1=min(t1,t2)\nT2=max(t1,t2)\nif(T1<h<T2 and T1<m<T2 and T1<s<T2):\n    print(\"YES\")\nelif(not(T1<h<T2 or T1<m<T2 or T1<s<T2)):\n    print(\"YES\")\nelse:\n    print(\"NO\")\n\n\n    ", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "e0e937b1e9ae8eb5a903c055cd27530e", "src_uid": "912c8f557a976bdedda728ba9f916c95", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom array import array  # noqa: F401\nfrom itertools import product\n\n\ndef input():\n    return sys.stdin.buffer.readline().decode('utf-8')\n\n\nn = int(input())\ncand = set()\n\nfor i, (a, b, c) in enumerate(input().split() for _ in range(n)):\n    a = list(map(int, a))\n    b, c = int(b), int(c)\n    s = set()\n\n    for p in product(range(10), repeat=4):\n        if len(set(p)) < 4:\n            continue\n        b_, c_ = 0, 0\n        for j in range(4):\n            if p[j] == a[j]:\n                b_ += 1\n            elif p[j] in a:\n                c_ += 1\n        if b == b_ and c == c_:\n            s.add(''.join(map(str, p)))\n\n    if i == 0:\n        cand = s\n    else:\n        cand &= s\n\nif len(cand) == 1:\n    print(cand.pop())\nelif len(cand) > 1:\n    print('Need more data')\nelif not cand:\n    print('Incorrect data')\nelse:\n    assert False\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "03f46f41a596ee08a5e061c2362e68f1", "src_uid": "142e5f2f08724e53c234fc2379216b4c", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\nlines = sys.stdin.readlines()\nn = int(lines[0].strip())\nquery = []\nfor i in range(1, n+1):\n    (a, b, c) = lines[i].strip().split(\" \")\n    query.append((a, int(b), int(c)))\ndef compare(i):\n    digits = str(i)\n    digits = \"0\" *(4-len(digits)) + digits\n    if len(set(list(digits))) != 4: return False\n    for q in query:\n        (a, b, c) = q\n        m, n = 0, 0\n        for i in range(4):\n            if a[i] == digits[i]: m += 1\n        for l in a:\n            if l in digits: n += 1\n        n -= m\n        if m != b or n != c:\n            return False\n    return True\nres = 0\ncount = 0\nfor i in range(123, 9877):\n    if compare(i): count += 1; res = i\n    if count >= 2: break\nif count == 0: print(\"Incorrect data\")\nelif count == 1:\n    digits = str(res)\n    digits = \"0\" *(4-len(digits)) + digits\n    print(digits)\nelse: print(\"Need more data\")\n", "lang_cluster": "Python", "tags": ["brute force", "implementation"], "code_uid": "eb80b09d9d445d4a33618f63c27671ee", "src_uid": "142e5f2f08724e53c234fc2379216b4c", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, k = map(int, input().split())\nnum = list(input())\nif k == 0:\n    print(*num, sep='')\n    exit()\nif n == 1:\n    print('0')\n    exit()\nif num[0] != '1':\n    num[0] = '1'\n    k -= 1\nfor i, f in enumerate(num):\n    if k > 0 and i > 0:\n        if num[i] != '0':\n            num[i] = '0'\n            k -= 1\nprint(*num, sep='')\n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "44d5f265f20230fe62eadbcb379897a9", "src_uid": "0515ac888937a4dda30cad5e2383164f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n, k = map(int, input().split())\n\ns = list(input())\nif n == 1 and k:\n    print(\"0\")\n    exit()\nif k:\n    for i in range(n):\n        if not(i):\n            if k and s[i] != \"1\":\n                s[i] = \"1\"\n                k -= 1\n        else:\n            if k:\n                if s[i] != \"0\":\n                    s[i] = \"0\"\n                    k -= 1\n            else:\n                break\nprint(\"\".join(s))\n        \n", "lang_cluster": "Python", "tags": ["greedy", "implementation"], "code_uid": "a714756fcc305bf5f48f90b08867040c", "src_uid": "0515ac888937a4dda30cad5e2383164f", "difficulty": 1000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#codeforces 86a: reflection: math\nl,r=map(int,input().split())\n\ndef digits(x):\n\td=0\n\twhile (x):\n\t\td+=1\n\t\tx//=10\n\treturn d\n\ndef f(n):\n\treturn n*(10**digits(n)-1-n)\n\t\ndef maxInDigits(l,r):\n\t#print(\"dealwith\",l,r)\n\tmid=10**digits(l)//2\n\tif (r<=mid): return f(r)\n\tif (l>=mid): return f(l)\n\treturn f(mid)\n\nif (digits(l)==digits(r)): print(maxInDigits(l,r))\nelse:\n\tans=max(maxInDigits(l,10**digits(l)-1),maxInDigits(10**(digits(r)-1),r))\n\tif (digits(r)-1>digits(l)):\n\t\tans=max(ans,maxInDigits(10**(digits(r)-2),10**(digits(r)-1)-1))\n\tprint(ans)\n\n\t", "lang_cluster": "Python", "tags": ["math"], "code_uid": "6547b22bf709b3f0e61be6b14941a0b0", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def reflection(num):\n    tmp = []\n    numlist = list(str(num))\n    for el in numlist:\n        i = int(el)\n        ni = 9-i\n        if ni == 0 and len(tmp) == 0:\n            continue\n        tmp.append(str(ni))\n    if not tmp:\n        return 0\n    return int(\"\".join(tmp))\n    \ndef solve(l, r):\n    result = 0\n    result = max(result, l*reflection(l))\n    result = max(result, r*reflection(r))\n\n    start = 0\n    while 5*(10**start) <= l:\n        start += 1\n    \n    while 5*(10**start) <= r:\n        cur_num = 5*(10**start)\n        result = max(result, cur_num*reflection(cur_num))\n        start += 1\n    return result\n\n\nl, r = map(int, input().split())\nresult = solve(l, r)\nprint(result)\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "bafa6ba6d5198c3b5bd3194ce4a67de5", "src_uid": "2c4b2a162563242cb2f43f6209b59d5e", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = input()\nL = list()\nfor i in range(n):\n    L.append(map(int,raw_input().split(' ')))\n\ndef inside(x,y,r):\n    return ((x>=r[0]) and (x<=r[2]) and (y>=r[1]) and (y<=r[3]))\n\nlx = min([r[0] for r in L])\nux = max([r[2] for r in L])\nly = min([r[1] for r in L])\nuy = max([r[3] for r in L])\nsquare = [lx,ly,ux,uy]\n\nfor r1 in L:\n    x1,y1,x2,y2 = r1\n    corners = [[x1,y1],[x1,y2],[x2,y1],[x2,y2]]\n    for c in corners:\n        x, y = c\n        for i in [-0.5,+0.5]:\n            for j in [-0.5,+0.5]:\n                if inside(x+i,y+j,square):\n                    for r2 in L:\n                        if inside(x+i,y+j,r2):\n                            break\n                    else:\n                        print 'NO'\n                        exit()\nif ux-lx == uy-ly:\n  print 'YES'\nelse:\n  print 'NO'\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "6cb597d8ccbdcb2e2e2404d03b188b89", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#! /usr/bin/python\n\nimport sys\n\n__author__ = 'Muntasir Khan'\n\n\nclass Rect:\n  def __init__(self, x1, y1, x2, y2):\n    self.x1 = x1\n    self.x2 = x2\n    self.y1 = y1\n    self.y2 = y2\n    self.area = abs(self.x1 - self.x2) * abs(self.y1 - self.y2)\n  \n  def is_square(self):\n    return abs(self.x1 - self.x2) == abs(self.y1 - self.y2)\n\n\ndef bounding_rect(rects):\n  min_x, max_x = rects[0].x1, rects[0].x2\n  min_y, max_y = rects[0].y1, rects[0].y2\n  for rect in rects:\n    min_x = min(rect.x1, min_x)\n    max_x = max(rect.x2, max_x)\n    min_y = min(rect.y1, min_y)\n    max_y = max(rect.y2, max_y)\n  return Rect(min_x, min_y, max_x, max_y)\n\n\ndef forms_square(rects):\n  bound = bounding_rect(rects)\n  total_area = sum(rect.area for rect in rects)\n  return bound.area == total_area and bound.is_square()\n\n\ndef main():\n  n = int(sys.stdin.readline())\n  rects = []\n  for i in xrange(n):\n    x1, y1, x2, y2 = map(int, sys.stdin.readline().split())\n    rects.append(Rect(x1, y1, x2, y2))\n  if forms_square(rects):\n    print \"YES\"\n  else:\n    print \"NO\"\n\nif __name__ == '__main__':\n  main()\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "724be2bd3e1733e650b136eda7706783", "src_uid": "f63fc2d97fd88273241fce206cc217f2", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\nb = 'sabcdefgh'\na1,a2,a3,a4 = map(str,input().split())\nx1 = b.index(a1[0])-1\ny1 = int(a1[1]) -1\nx2 = b.index(a2[0])-1\ny2 = int(a2[1]) -1\nx3 = b.index(a3[0])-1\ny3 = int(a3[1]) -1\nx4 = b.index(a4[0])-1\ny4 = int(a4[1]) -1\nc = []\nfor i in range(8):\n    c.append([0]*8)\npr = 0\npr1 = 0\npr4 = 0\npr3 = 0\nfor i in range(1,8):\n    if y1 - i > -1 and pr == 0:\n        if (y1 - i == y2 and x1 == x2) or (y1 - i == y3 and x1 == x3):\n            c[x1][y1 - i] = 1\n            pr = 1\n        else:\n            c[x1][y1 - i] = 1\n    if y1 + i < 8 and pr1 == 0:\n        if (y1 + i == y2 and x1 == x2) or (y1 + i == y3 and x1 == x3):\n            c[x1][y1 + i] = 1\n            pr1 = 1\n        else:\n            c[x1][y1 + i] = 1\n    if y2 - i > -1 and pr3 == 0:\n        if (y2 - i == y1 and x1 == x2) or (y2 - i == y3 and x2== x3):\n            c[x2][y2 - i] = 1\n            pr3 = 1\n        else:\n            c[x2][y2 - i] = 1\n    if y2 + i < 8 and pr4 == 0:\n        if (y3 + i == y1 and x1 == x2) or (y2 + i == y3 and x2 == x3):\n            c[x2][y2 + i] = 1\n            pr4 = 1\n        else:\n            c[x2][y2 + i] = 1\npr = 0\npr1 = 0\npr2 = 0\npr3 = 0\nfor i in range(1,8):\n    if x1 - i > -1 and pr == 0:\n        if (x1 - i == x2 and y1 == y2) or (x1 - i == x3 and y1 == y3):\n            c[x1 - i][y1] = 1\n            pr = 1\n        else:\n            c[x1 - i][y1] = 1\n    if x2 - i > -1 and pr1 == 0:\n        if (x2 - i == x1 and y1 == y2) or (x2 - i == x3 and y2 == y3):\n            c[x2 - i][y2] = 1\n            pr1 = 1\n        else:\n            c[x2 - i][y2] = 1\n    if x1 + i < 8 and pr2 == 0:\n        if (x1 + i == x2 and y1 == y2) or (x1 + i == x3 and y1 == y3):\n            c[x1 + i][y1] = 1\n            pr2 = 1\n        else:\n            c[x1 + i][y1] = 1\n    if x2 + i < 8 and pr3 == 0:\n        if (x2 + i == x1 and y1 == y2) or (x2 + i == x3 and y2 == y3):\n            c[x2 + i][y2] = 1\n            pr3= 1\n        else:\n            c[x2 + i][y2] = 1\nfor i in range(-1,2):\n    for j in range(-1,2):\n        if x3 + i < 8 and x3 + i > -1 and y3 + j < 8 and y3 + j > -1:\n            c[x3 + i][y3+j] = 1\n\nfor i in range(-1,2):\n    for j in range(-1,2):\n        if x4 + i < 8 and x4 + i > -1 and y4 + j < 8 and y4 + j > -1:\n            if c[x4 + i][y4+j] == 0:\n                print(\"OTHER\")\n                sys.exit()\nprint(\"CHECKMATE\")\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "debb6f667ff541e23882ae83905274c1", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/python\n# coding=utf-8\n\ndef inboard(x, y):\n\treturn x >= 1 and x <= 8 and y >= 1 and y <= 8\n\ndirection = [ [ 0, 0],\n\t\t[ 1, 0],\n\t\t[ 0, 1],\n\t\t[-1, 0],\n\t\t[ 0,-1],\n\n\t\t[ 1, 1],\n\t\t[ 1,-1],\n\t\t[-1, 1],\n\t\t[-1,-1]]\n\ndef reach(x, y, dx, dy):\n\tglobal g\n\tx += dx\n\ty += dy\n\twhile inboard(x,y):\n\t\tif g[x][y] > 0:\n\t\t\tif g[x][y] == ME:\n\t\t\t\treturn True\n\t\t\telse:\n\t\t\t\treturn False\n\t\tx += dx\n\t\ty += dy\n\treturn False\n\n\ndef judge():\n\tglobal g\n\tfor i in range(1, 9):\n\t\tfor j in range(1, 9):\n\t\t\tif g[i][j] == ROOK:\n\t\t\t\tif reach(i, j, 0, 1): return False\n\t\t\t\tif reach(i, j, 0,-1): return False\n\t\t\t\tif reach(i, j, 1, 0): return False\n\t\t\t\tif reach(i, j,-1, 0): return False\n\t\t\tif g[i][j] == KING:\n\t\t\t\tfor dx, dy in direction:\n\t\t\t\t\t#print \"dx = %d, dy = %d\" % (dx, dy)\n\t\t\t\t\tif inboard(i + dx, j + dy) and g[i + dx][j + dy] == ME:\n\t\t\t\t\t\treturn False\n\treturn True\n\n\ng = [[0 for i in range(0, 9)] for i in range(0, 9)]\n\nROOK = 1\nKING = 2\nME   = 3\n\nchess = raw_input().strip().split(\" \")\nchess =[[ord(chess[0][0]) - ord('a') + 1, ord(chess[0][1]) - ord('0')],\n\t\t[ord(chess[1][0]) - ord('a') + 1, ord(chess[1][1]) - ord('0')],\n\t\t[ord(chess[2][0]) - ord('a') + 1, ord(chess[2][1]) - ord('0')],\n\t\t[ord(chess[3][0]) - ord('a') + 1, ord(chess[3][1]) - ord('0')]]\ng[chess[0][0]][chess[0][1]] = ROOK;\ng[chess[1][0]][chess[1][1]] = ROOK;\ng[chess[2][0]][chess[2][1]] = KING;\n\n#for i in range(1, 9): print g[i]\n\nok = True\nfor dx,dy in direction:\n\tx = chess[3][0] + dx\n\ty = chess[3][1] + dy\n\t#print \"dx = %3d, dy = %3d\" % (dx, dy)\n\tif inboard(x, y) and g[x][y] != KING:\n\t\tprev = g[x][y]\n\t\tg[x][y] = ME\n\t\tif judge():\n\t\t\tok = False\n\t\t\t#for i in range(1, 9): print g[i]\n\t\t\t#print \"\"\n\t\tg[x][y] = prev\n\nif ok:\n\tprint \"CHECKMATE\"\nelse:\n\tprint \"OTHER\"\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "71b18bf5c53c2db8af6e6a32fda00fbd", "src_uid": "5d05af36c7ccb0cd26a4ab45966b28a3", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from math import factorial as F\nn, w, b = map(lambda x : int(x), raw_input().split())\nprint F(w+b-3)/F(n-3)/F(w+b-n)*(w-1)*F(w)*F(b)%(10**9+9)\n", "lang_cluster": "Python", "tags": ["combinatorics", "number theory"], "code_uid": "c8fc57c9c23ec150ad300d1a563883d5", "src_uid": "63e93a161bbff623323e66c98d5e20ac", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def C(n,m):return p[n]*r[m]*r[n-m]\nn,w,b=map(int,raw_input().split())\nM=1000000009\np=[1]\nr=[]\nfor i in range(4010):\n\tp+=[p[i]*(i+1)%M]\n\tr+=[pow(p[i],M-2,M)]\nprint sum(p[w]*p[b]*(n-i-1)*C(b-1,i-1)*C(w-1,n-i-1)for i in range(max(1,n-w),min(n-2,b)+1))%M", "lang_cluster": "Python", "tags": ["combinatorics", "number theory"], "code_uid": "ee1149aeb6dd36912b00c2d79d8fcc8a", "src_uid": "63e93a161bbff623323e66c98d5e20ac", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\ncards = ''.join([s for s in raw_input().split()])\nst = set([cards])\nif n <= 1:\n    print 'YES'\n    exit(0)\nwhile len(st) > 0:\n    nst = set()\n    for cards in st:\n        if cards[-2] == cards[-(2*2)] or cards[-1] == cards[-(2*2-1)]:\n            if len(cards) <= 4:\n                print 'YES'\n                exit(0)\n            ncards = cards[:-4]+cards[-2:]\n            nst.add(ncards)\n        if len(cards) >= 8 and (cards[-2] == cards[-(4*2)] or cards[-1] == cards[-(2*4-1)]):\n            ncards = cards[:-8]+cards[-2:]+cards[-6:-2]\n            nst.add(ncards)\n    st = nst\nprint 'NO'\n        \n", "lang_cluster": "Python", "tags": ["dfs and similar", "dp"], "code_uid": "7d2ee0fb2cd7b9491a23d199dbb99fe6", "src_uid": "1805771e194d323edacf2526a1eb6768", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "memo = {}\nn = int(input())\na = [s for s in input().split()]\n\ndef ok(c1, c2):\n    return (c1[0] == c2[0]) or (c1[1] == c2[1])\n\ndef dfs(i, c1, c2, c3):\n    k = (i, c1, c2, c3)\n    if k in memo:\n        return memo[k]\n    if i < 0:\n        memo[k] = ok(c1, c2) and ok(c1, c3)\n    else:\n        r = False\n        if ok(c1, a[i]):\n            r = r or dfs(i - 1, c2, c3, c1)\n        if ok(c1, c2):\n            r = r or dfs(i - 1, c1, c3, a[i])\n        memo[k] = r\n    return memo[k]\n\ndef check():\n    if n == 1:\n        return True;\n    elif n == 2:\n        return ok(a[1], a[0])\n    else:\n        return dfs(n - 4, a[-1], a[-2], a[-3])\n\nprint('YES' if check() else 'NO')\n\n\n\n\n# Made By Mostafa_Khaled", "lang_cluster": "Python", "tags": ["dfs and similar", "dp"], "code_uid": "8c71378df2d4f949f16b06a9f2677f92", "src_uid": "1805771e194d323edacf2526a1eb6768", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import factorial\ndp=[[-1 for i in range (101)] for j in range(101)]\ndef solve(n,p,a):\n    if dp[n][p] is not -1:\n        return dp[n][p]\n    elif p is 9:\n        if n>=a[9]:\n            return 1\n        else:\n            return 0\n    elif p is 0:\n        ans=0\n        for i in range(a[0],n):\n            z=solve(n-i,1,a)\n            z*=factorial(n-1)\n            z//=factorial(i)\n            z//=factorial(n-1-i)\n            ans+=z\n        dp[n][p]=ans\n        return ans\n    else:\n        ans=0\n        for i in range(a[p],n+1):\n            z=solve(n-i,p+1,a)\n            z*=factorial(n)\n            z//=factorial(i)\n            z//=factorial(n-i)\n            ans+=z\n        dp[n][p]=ans\n        return ans\nhell=1000000007\nn=int(input())\na=input().rstrip().split(' ');\nfor i in range(0,len(a)):\n    a[i]=int(a[i])\nans=0\nfor i in range(1,n+1):\n    ans+=solve(i,0,a)\n    ans%=hell\nprint(ans)", "lang_cluster": "Python", "tags": ["dp", "combinatorics"], "code_uid": "58ecb08bc4752f0c939380d770a533ae", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "M=10**9+7\nn=input()\na=map(int,raw_input().split())\nc=[[0]*128 for _ in range(128)]\nc[0][0]=1\nfor p in range(1,128):\n  c[p][0]=c[p][p]=1\n  for q in range(1,p):\n    c[p][q]=(c[p-1][q]+c[p-1][q-1])%M\nt=[[0]*128 for _ in range(11)]\nt[10][0]=1\nfor d in range(9,0,-1):\n  for i in range(n-a[d]+1):\n    for j in range(a[d],n-i+1):\n      t[d][i+j]=(t[d][i+j]+t[d+1][i]*c[i+j][j])%M\ns=0\nfor i in range(1,n+1):\n  for j in range(a[0],i):\n    s=(s+t[1][i-j]*c[i-1][j])%M\nprint s\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics"], "code_uid": "f8c0b940d0bfce51bdf28eb4d0d6d2ef", "src_uid": "c1b5169a5c3b1bd4a2f1df1069ee7755", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "MAX = 10**5 + 1;\ngrundy = [0 for i in xrange(MAX)];\nchoice = [-1 for i in xrange(MAX)];\nfor i in xrange(1,MAX):\n    k = 2;\n    U = set();\n    while k*(k+1)/2 <= i:\n        diff = i - k*(k+1)/2;\n        if diff % k == 0:\n            offset = diff/k;\n            x = grundy[offset + k ] ^ grundy[offset];\n            if not x and choice[i] == -1: choice[i] = k;\n            U.add(x);\n        k += 1;\n    while grundy[i] in U:\n        grundy[i] += 1;\n    grundy[i] ^= grundy[i - 1];\n\n\nn = int(raw_input());\nprint choice[n];", "lang_cluster": "Python", "tags": ["math", "dp", "games"], "code_uid": "2f7a11273aec6bec0e175054f08fd3cd", "src_uid": "63262317ba572d78163c91b853c05506", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\nfrom collections import Counter\n\nn = int(input())\ng = [0 for i in range(n + 1)]\nprefix_xor = g.copy()\n\n\ndef in_range(d, k):\n    if (2 * k - d * d + d) % (2 * d) != 0:\n        return -1\n    x = (2 * k - d * d + d) / (2 * d)\n    return int(x) if x > 0 else -1\n\n\ndef mex(arr):\n    counter = Counter()\n    for i in arr:\n        counter[i] += 1\n    for i in range(0, len(arr) + 1):\n        if counter[i] == 0:\n            return i\n\n\ndef find_move(arr):\n    for i in range(0, len(arr)):\n        if arr[i] == 0:\n            return i\n    return -1\n\n\nif n < 3:\n    print(-1)\n    exit(0)\nfor i in range(3, n + 1):\n    for_range = range(2, int(math.sqrt(2 * i)) + 1)\n    filter_range = [l for l in for_range if in_range(l, i) > 0]\n    branches = [prefix_xor[in_range(d, i) + d - 1] ^ prefix_xor[in_range(d, i) - 1] for d in filter_range]\n    g[i] = mex(branches)\n    prefix_xor[i] = prefix_xor[i - 1] ^ g[i]\n    if i == n:\n        print(-1 if g[i] == 0 else filter_range[find_move(branches)])\n", "lang_cluster": "Python", "tags": ["math", "dp", "games"], "code_uid": "6f710fa5e72fb2473f1c8323af8cbddc", "src_uid": "63262317ba572d78163c91b853c05506", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "G = (1 + 5 ** .5) / 2\nw = set((int(k * G), int(k * G) + k) for k in range(999))\nn = input()\na = sorted(map(int, raw_input().split()))\nprint [\"BitLGM\", \"BitAryo\"][n == 2 and (a[0], a[1]) in w or n != 2 and not reduce(lambda x, y : x ^ y, a)]", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "b559ea1e2075d94edfd7074fe55aa6e3", "src_uid": "7a33b4f94082c7ef80d7e87b58497fa7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "G = (1 + 5 ** .5) / 2\nw = set((int(k * G), int(k * G) + k) for k in range(999))\nn = input()\na = sorted(map(int, raw_input().split()))+[0,0]\nprint 'BitAryo' if (((a[0], a[1]) in w) if 2==n else not(a[0]^a[1]^a[2])) else 'BitLGM'\n", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "9286b977b1d9150359489529218fef79", "src_uid": "7a33b4f94082c7ef80d7e87b58497fa7", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def f(n):\n\ti = 2\n\twhile i*i <= n:\n\t\tif n%i == 0:\n\t\t\treturn False\n\t\ti += 1\n\treturn True\n\nn = int(input())\nfor i in range(10,1000000):\n\tif i != int(str(i)[::-1]) and f(i) and f(int(str(i)[::-1])):\n\t\tn -= 1\n\tif n == 0:\n\t\tprint(i)\n\t\tbreak", "lang_cluster": "Python", "tags": ["brute force", "implementation", "number theory"], "code_uid": "c50fdc56d25c771e2d312ba1b012c475", "src_uid": "53879e79cccbacfa6586d40cf3436657", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def prime( x ):\n  if x == 2: return 1\n  if ~ x & 1: return 0\n  i = 3\n  while i * i <= x:\n    if x % i == 0: return 0\n    i += 1\n  return 1\n\nM = int( input() )\n\ncnt = 0\nfor i in range( 2, int( 1e9 ), 1 ):\n  if not prime( i ): continue\n  if i == int( str( i )[ : : -1 ] ): continue\n  if not prime( int( str( i )[ : : -1 ] ) ): continue\n  cnt += 1\n  if cnt == M:\n    exit( print( i ) )\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "number theory"], "code_uid": "7f3cb16365bf6d80de03586bd7f9287e", "src_uid": "53879e79cccbacfa6586d40cf3436657", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\ninput = sys.stdin.readline\n \nn,k=map(int,input().split())\nmod=10**9+7\n \nFACT=[1]\nfor i in range(1,250+1):\n    FACT.append(FACT[-1]*i%mod)\n \nFACT_INV=[pow(FACT[-1],mod-2,mod)]\nfor i in range(250,0,-1):\n    FACT_INV.append(FACT_INV[-1]*i%mod)\n \nFACT_INV.reverse()\n \ndef Combi(a,b):\n    if 0<=b<=a:\n        return FACT[a]*FACT_INV[b]%mod*FACT_INV[a-b]%mod\n    else:\n        return 0\n \nCOMBI=[[0]*251 for i in range(251)]\n \nfor a in range(251):\n    for b in range(a+1):\n        COMBI[a][b]=Combi(a,b)\n \nPOW_K=[1]\nPOW_K1=[1]\n \nfor i in range(n+1):\n    POW_K.append(POW_K[-1]*k%mod)\n    POW_K1.append(POW_K1[-1]*(k-1)%mod)   \n \nDP=[0]*(n+1)\nDP[0]=1\n\nPLUS=[[0]*(n+1) for i in range(n+1)]\n\nfor i in range(n+1):\n    for j in range(n+1):\n        if i==j:\n            PLUS[i][j]=(POW_K[i]*COMBI[n-i][j-i]*POW_K1[n-j]-POW_K1[n])%mod\n        else:\n            PLUS[i][j]=POW_K[i]*COMBI[n-i][j-i]*POW_K1[n-j]%mod\n \nfor yoko in range(n):\n    NDP=[0]*(n+1)\n    for i in range(n+1):\n        if DP[i]==0:\n            continue\n        for j in range(max(1,i),n+1):\n            NDP[j]=(NDP[j]+PLUS[i][j]*DP[i])%mod\n \n    DP=NDP\n    #print(DP)\n \nprint(DP[-1])", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "728b86ebf6aab3c445ae7ab3ef2556f2", "src_uid": "f67173c973c6f83e88bc0ddb0b9bfa93", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, k = [int(item) for item in input().split()]\nMOD = 10**9 + 7\nMAX_N = 10**4 \n\nfac = [1] + [0] * MAX_N\nfac_inv = [1] + [0] * MAX_N\nfor i in range(1, n+1):\n    fac[i] = fac[i-1] * (i) % MOD\n    fac_inv[i] = fac_inv[i-1] * pow(i, MOD-2, MOD) % MOD\n\ndef mod_nCr(n, r):\n    if n == 0 and r == 0:\n        return 1\n    if n < r or n < 0:\n        return 0\n    tmp = fac_inv[n-r] * fac_inv[r] % MOD\n    return tmp * fac[n] % MOD \n\nans = 0\nfor i in range(n+1):\n    base = pow(k, n - i, MOD) * pow(k - 1, i, MOD) - pow(k - 1, n, MOD) + MOD\n    base % MOD\n    val = pow(-1, i) * mod_nCr(n, i) * pow(base, n, MOD)\n    ans += val\n    ans %= MOD\n\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "4b11d2fe22a6caa072a6793dd9cee705", "src_uid": "f67173c973c6f83e88bc0ddb0b9bfa93", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "M=10**9+7\na,b=map(int,input().split())\nif b%a:print(0)\nelse:\n    b//=a\n    d=set()\n    for i in range(1,int(pow(b,0.5)+1)):\n        if b%i==0:\n            d.add(i)\n            d.add(b//i)\n    d=sorted(list(d))\n    f=d[::]\n    for i in range(len(f)):\n        f[i]=pow(2,d[i]-1,M)\n        for j in range(i):\n            if d[i]%d[j]==0:\n                f[i]-=f[j]\n    print(f[-1]%M)\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "bitmasks", "number theory"], "code_uid": "c2e8c06201114e75465af3526a40aece", "src_uid": "de7731ce03735b962ee033613192f7bc", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\n# coding: utf-8\n\n# In[36]:\n\n\nimport math\n\ndef UnusualSeq(a,b):\n    if b%a!=0:\n        print(0)\n    else:\n        b//=a\n        d=set()\n        for i in range(1,int(math.sqrt(b)+1)):\n            if b%i==0:\n                d.add(i)\n                d.add(b//i)\n        d=sorted(list(d))\n        f=d[::]\n        for i in range(len(f)):\n            f[i]=pow(2,d[i]-1,(10**9+7))\n            for j in range(i):\n                if d[i]%d[j]==0:\n                    f[i]-=f[j]\n        print(f[-1]%(10**9+7))\n\n\na,b=map(int,input().split())\nUnusualSeq(a,b)\n\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "bitmasks", "number theory"], "code_uid": "d9964e2f080448fea5e63b137474ffa1", "src_uid": "de7731ce03735b962ee033613192f7bc", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import __pypy__\nmodmul = __pypy__.intop.int_mulmod\n\nMOD = 998244353\ndef inv(x):\n    return pow(x, MOD - 2, MOD)\n \nn, m = map(int, input().split())\n \nmult = n * inv(m + 1) + 1\nmult %= MOD\n \ncurrN = 1\nout = m + 1\nwhile currN < n:\n    currN += 1\n \n    out += modmul(m, inv(currN), MOD)\n    out %= MOD\n \nout *= mult\nprint(out % MOD)", "lang_cluster": "Python", "tags": ["probabilities", "math", "dp", "combinatorics"], "code_uid": "8ae7c8d3b0607d7fd12760c45acfd0aa", "src_uid": "9f2b59df7bef2aeee0ce71facd2b1613", "difficulty": 3000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def modInverse(a, m) : \n    m0 = m; y = 0; x = 1\n    if (m == 1): return 0\n    while (a > 1):\n        q = a // m; t = m; m = a % m; a = t; t = y; y = x - q * y; x = t\n    if (x < 0): x = x + m0 \n    return x\n\nprime = 998244353\nn, m = map(int, input().split())\nz = 0\n\nfor i in range(1, n+1): z += modInverse(i, prime)\nans = (1+m*z)*(1+n*modInverse(m+1, prime))\nprint(ans % prime)\n", "lang_cluster": "Python", "tags": ["probabilities", "math", "dp", "combinatorics"], "code_uid": "21c1003287b8e6814ddad7d9ad6dc93c", "src_uid": "9f2b59df7bef2aeee0ce71facd2b1613", "difficulty": 3000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m,a,b = map(int,raw_input().split())\nif m == 1:\n    print 1\n    exit(0)\nif b == n:\n    b = (b+m-1)/m*m\nl = (a+m-1)/m*m\nr = (b+m-1)/m*m\nif r == l:\n    print 1\n    exit(0)\nif r == l+m:\n    if a % m == 1 and b % m == 0:\n        print 1\n    else:\n        print 2\n    exit(0)\nd1 = (l-a+1) % m\nd2 = (b-r) % m\nif a % m == 1 and b % m == 0:\n    print 1\n    exit(0)\nif a % m == 1 or b % m == 0:\n    print 2\n    exit(0)\nif d1 + d2 == m:\n    print 2\n    exit(0)\nprint 3\n\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "b9b7fd62f1fdd9d0485f629c918e77a8", "src_uid": "f256235c0b2815aae85a6f9435c69dac", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from itertools import permutations\nimport sys\nfrom math import *\nics, per, first, last = map(int, raw_input().split())\nper = float(per)\nx1 = int(ceil(first / per))\ny1 = int(first % per)\nx2 = int(ceil(last / per))\ny2 = int(last % per)\n\nif x1 == x2:\n    print 1\n    exit()\n\nif y1 == 1 and y2 == 0:\n    print 1\n    exit()\n    \nif y1 == 1 and last == ics:\n    print 1\n    exit()\n    \nif per == 1:\n    print 1\n    exit()\n    \nif abs(x1-x2) == 1:\n    print 2\n    exit()\n\nif y1 == 1:\n    print 2\n    exit()\n    \nif y2 == 0:\n    print 2\n    exit()\n    \nif last == ics:\n    print 2\n    exit()\n\nif y1-y2 == 1 or y2-y1 == per - 1:\n    print 2\n    exit()\n    \nprint 3\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "d68d73ecec4e10924c43db27b0933910", "src_uid": "f256235c0b2815aae85a6f9435c69dac", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "n=int(input())\r\ndef isvalid(i,j):\r\n    if 0<=i<n and 0<=j<n:\r\n        return True\r\n    return False\r\nq=[]\r\nfor i in range(n):\r\n    q.append(input())\r\nflag=True\r\nfor i in range(n):\r\n    if not flag:\r\n        break\r\n    for j in range(n):\r\n        if not flag:\r\n            break\r\n        if q[i][j]=='t':\r\n            x='t'\r\n            for k in range(j+1,j+7):\r\n                if isvalid(i,k):\r\n                    x=x+q[i][k]\r\n                else:\r\n                    break\r\n\r\n            # print(x)\r\n            if x=='theseus':\r\n                # print(\"YES\")\r\n                flag=False\r\n                break\r\n            x = 't'\r\n            for k in range(i + 1, i + 7):\r\n                if isvalid(k, j):\r\n                    x = x + q[k][j]\r\n                else:\r\n                    break\r\n            # print(x)\r\n            if x == 'theseus':\r\n                # print(\"YES\")\r\n                flag = False\r\n                break\r\n\r\n            x='t'\r\n            for k in range(1,7):\r\n                if isvalid(i+k,j+k):\r\n                    x=x+q[i+k][j+k]\r\n                else:\r\n                    break\r\n            # print(x)\r\n            if x=='theseus':\r\n                flag=False\r\n                break\r\n\r\nif flag:\r\n        print('NO')\r\nelse:\r\n        print(\"YES\")\r\n\r\n\r\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "193012a3bf24fe8720bb2a9751ac8f8d", "src_uid": "efb72baf6759f7bc5ac0f3099b7177d0", "difficulty": -1.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import random\r\n\r\nn = int(input())\r\n\r\nw = 'theseus'\r\n\r\ngood = True\r\nboard = []\r\nfor _ in range(n):\r\n    board.append(input().strip())\r\n\r\nfor s in board:\r\n    pass\r\n    #if w in s:\r\n    #    good = False\r\n    #if w in s[::-1]:\r\n    #    good = False\r\n\r\nfor i in range(n):\r\n    t = ''.join(board[j][i] for j in range(n))\r\n    #if w in t:\r\n    #    good = False\r\n    #if w in t[::-1]:\r\n    #    good = False\r\n\r\nfor s in range(2 * n - 2):\r\n    l = []\r\n    for i in range(n):\r\n        if 0 <= s - i < n:\r\n            l.append(board[i][s-i])\r\n    t = ''.join(l)\r\n    #if w in t:\r\n    #    good = False\r\n    #if w in t[::-1]:\r\n    #    good = False\r\n\r\nfor s in range(-2 * n, 2 * n - 2):\r\n    l = []\r\n    for i in range(n):\r\n        if 0 <= s + i < n:\r\n            l.append(board[i][s+i])\r\n    t = ''.join(l)\r\n    if w in t:\r\n        good = False\r\n    if w in t[::-1]:\r\n        good = False\r\n\r\n\r\n'''\r\nbest = [[-1] * n for _ in range(n)]\r\n\r\nfor c in range(8):\r\n    for i in range(n):\r\n        for j in range(n):\r\n            if board[i][j] != w[c]:\r\n                continue\r\n            \r\n            for d in range(8):\r\n                ii = i + [0,0,-1,1,1,1,-1,-1][d]\r\n                jj = j + [1,-1,0,0,1,-1,1,-1][d]\r\n\r\n                if 0 <= ii < n and 0 <= jj < n:\r\n                    if best[ii][jj] == c - 1:\r\n                        best[i][j] = c\r\n                        if c == 7:\r\n                            good = False\r\n'''\r\n\r\nif good:\r\n    print('NO')\r\nelse:\r\n    print('YES')\r\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "bec6191f9c470c7781e6c01effd9724a", "src_uid": "efb72baf6759f7bc5ac0f3099b7177d0", "difficulty": -1.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def DFS(x):\n    for i in range(x):\n        if(Seen[i][x]):\n            continue\n        if(Rem[i]>=C[x]):\n            if(Rem[i]==C[x] and len(Children[i])==0):\n                continue\n            Rem[i]-=C[x]\n            Parent[x]=i\n            Children[i].append(x)\n            return True\n    for i in range(x):\n        if(Seen[i][x]):\n            continue\n        Y=[]\n        for j in range(len(Children[i])):\n            child=Children[i][j]\n            Parent[child]=-1\n            Rem[i]+=C[child]\n            Seen[i][child]=True\n            Seen[child][i]=True\n            if(DFS(child)):\n                Seen[i][child]=False\n                Seen[child][i]=False\n                continue\n            Seen[i][child]=False\n            Seen[child][i]=False\n            Parent[child]=i\n            Rem[i]-=C[child]\n            Y.append(child)\n        Children[i]=list(Y)\n        if(Rem[i]>=C[x]):\n            if(Rem[i]==C[x] and len(Children[i])==0):\n                continue\n            Rem[i]-=C[x]\n            Children[i].append(x)\n            Parent[x]=i\n            return True\n    return False\n                \n        \n\n\n\n\nn=int(input())\n\nC=list(map(int,input().split()))\nRem=[-1]*n\nParent=[-1]*n\nChildren=[]\nSeen=[]\nfor i in range(n):\n    Seen.append([False]*n)\nC.sort(reverse=True)\n\nif(C[0]!=n or C.count(2)>0):\n    print(\"NO\")\n\nelse:\n    for i in range(n):\n        Rem[i]=C[i]-1\n        Children.append([])\n    Parent[0]=0\n    Ans=\"YES\"\n    for i in range(1,n):\n        if(DFS(i)==False):\n            Ans=\"NO\"\n            break\n    for i in range(n):\n        if(Rem[i]!=0 and C[i]!=1):\n            Ans=\"NO\"\n            break\n    print(Ans)\n            \n", "lang_cluster": "Python", "tags": ["constructive algorithms", "dp", "bitmasks", "greedy", "trees"], "code_uid": "d17e7ee065c2282d2fbec6abeab0e3d5", "src_uid": "ed0925cfaee961a3ceebd13b3c96a15a", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def DFS(x):\n    for i in range(x):\n        if(Seen[i][x]):\n            continue\n        if(Rem[i]>=C[x]):\n            if(Rem[i]==C[x] and len(Children[i])==0):\n                continue\n            Rem[i]-=C[x]\n            Parent[x]=i\n            Children[i].append(x)\n            return True\n    for i in range(x):\n        if(Seen[i][x]):\n            continue\n        Y=[]\n        for j in range(len(Children[i])):\n            \n            child=Children[i][j]\n            if(Seen[i][child]):\n                continue\n            Parent[child]=-1\n            Rem[i]+=C[child]\n            Seen[i][child]=True\n            Seen[child][i]=True\n            if(DFS(child)):\n                Seen[i][child]=False\n                Seen[child][i]=False\n                continue\n            Seen[i][child]=False\n            Seen[child][i]=False\n            Parent[child]=i\n            Rem[i]-=C[child]\n            Y.append(child)\n        Children[i]=list(Y)\n        if(Rem[i]>=C[x]):\n            if(Rem[i]==C[x] and len(Children[i])==0):\n                continue\n            Rem[i]-=C[x]\n            Children[i].append(x)\n            Parent[x]=i\n            return True\n    return False\n                \n        \n\n\n\n\nn=int(input())\n\nC=list(map(int,input().split()))\nRem=[-1]*n\nParent=[-1]*n\nChildren=[]\nSeen=[]\nfor i in range(n):\n    Seen.append([False]*n)\nC.sort(reverse=True)\n\nif(C[0]!=n or C.count(2)>0):\n    print(\"NO\")\n\nelse:\n    for i in range(n):\n        Rem[i]=C[i]-1\n        Children.append([])\n    Parent[0]=0\n    Ans=\"YES\"\n    for i in range(1,n):\n        if(DFS(i)==False):\n            Ans=\"NO\"\n            break\n    for i in range(n):\n        if(Rem[i]!=0 and C[i]!=1):\n            Ans=\"NO\"\n            break\n    print(Ans)\n            \n", "lang_cluster": "Python", "tags": ["constructive algorithms", "dp", "bitmasks", "greedy", "trees"], "code_uid": "8f87b7c9ea6cc2fc604332473d27783b", "src_uid": "ed0925cfaee961a3ceebd13b3c96a15a", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n\nimport sys\n\nline = sys.stdin.readline().strip()\ngroups = map(lambda x: int(x), line.split(\" \"))\nn = groups[0]\nm = groups[1]\n\n#n, m = 2, 4\n\nif (min(n, m) == 1):\n    print max(n, m)\n\nelif (n > 2) and (m > 2):\n    print (n * m + 1) / 2\n\nelse:\n    c = n + m - 2\n    x = c / 2\n    y = c - x\n    print (x + 1) / 2 * 2 + (y + 1) / 2 * 2\n\n   ", "lang_cluster": "Python", "tags": ["greedy", "constructive algorithms", "implementation"], "code_uid": "ba7b6919e71289b08199842743c54e98", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m=sorted(map(int,raw_input().split()));print[m,m+(m&-m&3),m*n+1>>1][min(n-1,2)]\n", "lang_cluster": "Python", "tags": ["greedy", "constructive algorithms", "implementation"], "code_uid": "8e26a909cb7cc986bd235a608afd73f9", "src_uid": "e858e7f22d91aaadd7a48a174d7b2dc9", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\ns = input()\nd = [[0]*n for _ in ' '*n]\nfor l in range(n-1, -1, -1):\n    for r in range(l, n):\n        if l == r:\n            d[l][r] = 1\n        else:\n            d[l][r] = d[l+1][r]+1\n            for m in range(l+1, r+1):\n                if s[l] == s[m]:\n                    d[l][r] = min(d[l][r], d[l+1][m-1] + d[m][r])\nprint(d[0][-1])", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "4faa6253ee1a58f3f0817e6ec9eb2dfa", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def solve(l,r):\n    if(l>r): return 0\n    if(l == r): return 1\n    if(dp[l][r] != -1): return dp[l][r]\n    ans = solve(l+1,r)+1\n    for i in range(l+1,r+1):\n        if(s[i]==s[l]): ans = min(ans , solve(l+1,i-1)+solve(i,r))\n    dp[l][r] = ans\n    return ans\n\ndef F():\n    n = int(input())\n    global s;\n    s = input()\n\n    global dp;\n    dp = [[-1]*n for _ in range(n)]\n    ans = solve(0,n-1)\n\n    print(ans)\nF()", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "f382803cff637644895f610a15ed4f67", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "h, n = map(int, input().split())\nn = n - 1 + (1 << h)\nres = h\nfor i in range(1, h+1):\n    a = n & (1 << i)\n    b = n & (1 << (i-1))\n    if not ((a == 0) ^ (b == 0)):\n        res += (1 << i) - 1\nprint(res)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "ddfb9aea03da8619e7aafbe540e4baa4", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "h,n = map(int,input().split())\nz = 2\nz1 = 1\np = 0\nr = 0\nh2 = 0\nh3 = 2**h\nwhile p < h:\n    if n <= h2 +  h3 // z and r == 0:\n        z1 += 1\n        z *= 2\n        r = 1\n    elif n > h2 + h3 // z and r == 0:\n        h2 += h3 // z\n        z1 += 2**(h-p)\n        z *= 2\n        r = 0\n    elif n <= h2 +  h3 // z and r == 1:\n        z1 += 2**(h-p)\n        z *= 2\n        r = 1\n    elif n > h2 +  h3 // z and r == 1:\n        h2 += h3 // z\n        z1 += 1\n        z *= 2\n        r = 0\n    p += 1\nprint(z1 - 1)", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "71eaa8414b3932d1570a25833f978925", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n# coding=utf-8\n\nh, n = map(int, raw_input().split())\nt = bin(n - 1)[2:]\nt = '0' * (h - len(t)) + t\nres = 0\nflag = True\nfor i in range(h):\n    if (t[i] == ('1' if flag else '0')):\n        res += 2 ** (h - i)\n    else:\n        flag = not flag\n        res += 1\nprint res\n", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "304079d5265fa292aa8f4e1b1391b88f", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#------------------------template--------------------------#\nimport os\nimport sys\nfrom math import *\nfrom collections import *\nfrom fractions import *\nfrom bisect import *\nfrom heapq import*\nfrom io import BytesIO, IOBase\ndef vsInput():\n    sys.stdin = open('input.txt', 'r')\n    sys.stdout = open('output.txt', 'w')\nBUFSIZE = 8192\nclass FastIO(IOBase):\n    newlines = 0\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\ndef value():return tuple(map(int,input().split()))\ndef array():return [int(i) for i in input().split()]\ndef Int():return int(input())\ndef Str():return input()\ndef arrayS():return [i for i in input().split()]\n\n#-------------------------code---------------------------#\n#vsInput()\n\nh,n=value()\n\nlow=1\nhigh=2**(h)\n\nans=0\nmove=0\n\nwhile(low<high):\n    mid=low+(high-low)//2\n    #print(low,mid,high,ans,move)\n\n    if(n<=mid):\n        if(move==0):\n            ans+=1\n            move^=1\n        else:\n            ans+=2**h\n        high=mid\n    else:\n        if(move==1):\n            ans+=1\n            move^=1\n        else:\n            ans+=2**h\n        low=mid+1\n    \n    h-=1\n    #move^=1\n\nprint(ans)\n\n\n\n\n    \n    \n\n", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "80abf46355480f9e394a1e5be7561725", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\ndef cnt_res(n):\n    d = [1]\n    s = 0\n    for i in range(n):\n        s += d[-1]\n        d.append(d[-1]*2)\n    return s\nh,n = map(int, input().split())\nansw = 0\nl = 1\nr = 2**h\nb = h\ndir = 'L'\nfor i in range(h):\n    if dir == 'L':\n        if n>(l+r)/2:\n            answ+=cnt_res(b)+1\n            l = (l+r)//2+1\n        elif n<(l+r)/2:\n            r = (l+r)//2+int(l+r%2!=0)-1\n            answ += 1\n            dir = 'R'\n        b-=1\n    else:\n        if n<(l+r)/2:\n            answ+=cnt_res(b)+1\n            r = (l+r)//2+int(l+r%2!=0)-1\n        elif n>(l+r)/2:\n            answ += 1\n            l=(l+r)//2+1\n            dir = 'L'\n        b-=1\nprint(answ)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "2929a5c3cdefb04b714e17005cd51076", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "sl = [0]*51\nsl[0] = 1\nfor i in range(1,51):\n    sl[i] = sl[i-1] + (2**i)\n    \nh,n = map(int,input().split())\n\nnl = []\nn += sl[h-1]\ntn = n\nnl.append(tn)\nwhile tn != 1:\n    tn = tn//2\n    nl.append(tn)\n    \nans = 0\ncn = 1\ncp = False\n    \nwhile cn != n:\n    tnl = []\n    for i in range(h):\n        tnl.append(cn);\n        if cp == False:\n            cn *= 2\n        else:\n            cn = cn*2+1\n        cp = not cp\n    if cn == n:\n        ans += h\n        break\n    \n    tnl.append(cn)\n    tnl = tnl[::-1]\n    for i in range(1,h+1):\n        if nl[i] == tnl[i]:\n            ans += sl[i-1]+h-i+1\n            h=i-1\n            cn=tnl[i-1]\n            if cn == tnl[i]*2:\n                cn = tnl[i]*2+1\n                cp = False\n            else:\n                cn = tnl[i]*2\n                cp = True\n            break\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "06cf78df8bf74d24e2565f531d3b8023", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\"\"\"\nCodeforces Contest 287 Div 2 Problem C\n\nAuthor  : chaotic_iak\nLanguage: Python 3.4.2\n\"\"\"\n\n################################################### SOLUTION\n\ndef main():\n    h,n = read()\n    n -= 1\n    n = bin(n)[2:]\n    n = \"0\" * (h-len(n)) + n\n\n    s = \"\"\n    for i in range(h):\n        if i and n[i-1] == \"0\":\n            s += \"1\" if n[i] == \"0\" else \"0\"\n        else:\n            s += n[i]\n\n    ct = 0\n    for i in range(h):\n        ct += 1\n        if s[i] == \"1\": ct += 2**(h-i)-1\n    print(ct)\n\n#################################################### HELPERS\n\n\n\ndef read(mode=2):\n    # 0: String\n    # 1: List of strings\n    # 2: List of integers\n    inputs = input().strip()\n    if mode == 0: return inputs\n    if mode == 1: return inputs.split()\n    if mode == 2: return list(map(int, inputs.split()))\n\ndef write(s=\"\\n\"):\n    if s is None: s = \"\"\n    if isinstance(s, list): s = \" \".join(map(str, s))\n    s = str(s)\n    print(s, end=\"\")\n\nwrite(main())", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "1cbe48cdca5ba76721d4ddeed42e8a9b", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "### TEMPLATE BEGIN\n\nfrom collections import defaultdict\nfrom math import sqrt\n\ndef read_int():\n    return int(raw_input())\n\ndef read_ints():\n    return (int(x) for x in raw_input().split())\n\ndef read_int_list():\n    return [int(x) for x in raw_input().split()]\n\ndef read_float():\n    return float(raw_input())\n\ndef read_floats():\n    return (float(x) for x in raw_input().split())\n\ndef read_float_list():\n    return [float(x) for x in raw_input().split()]\n\ndef read_list():\n    return [x for x in raw_input().split()]\n\ndef read_line():\n    return raw_input()\n\n### TEMPLATE END\n\ndef solve():\n    height, node = read_ints()\n    node -= 1\n    left = True\n    leftLeaf = 0\n    intervalSize = 2 ** height\n    ret = 0\n    while intervalSize > 1:\n        if left:\n            ll = leftLeaf\n            rr = ll + intervalSize/2\n        else:\n            ll = leftLeaf + intervalSize/2\n            rr = ll + intervalSize/2\n        if node >= ll and node < rr:\n            ret += 1\n            left = not left\n        else:\n            ret += intervalSize\n        if node >= leftLeaf + intervalSize/2:\n            leftLeaf += intervalSize/2\n        intervalSize /= 2\n    print ret\n\nqq = 1\n# qq = 2**30\n# qq = read_int()\nfor _________ in xrange(qq):\n    solve()\n", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "f3e79420316205e25ccd681086e1a9f7", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "h, n = map(int, input().split())\nN = bin(n - 1)[2:]\nN = '0' * (h - len(N)) + N\nans = 0\nf = False\nfor i in range(h):\n    if N[i] != ('1' if not f else '0'):\n        f = not f\n        ans += 1\n    else:\n        ans += 2 ** (h - i)\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "aedde8add01a954e0f0c518bc6f810bf", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "h, n = map(int, input().split())\nh -= 1\nn -= 1\nl = 0\nr = 2 << h\nll = True\nans = 0\ni = 0\nwhile r - l > 1:\n    m = (l + r) // 2\n    if ll == (n < m):\n        ans += 1\n    else:\n        ans += 1 << (h - i + 1)\n    if n < m:\n        r = m\n        ll = False\n    else:\n        l = m;\n        ll = True\n    i += 1\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "9c14ff87d44ca8a6ecdad4b780e237cd", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "def L(h, n):\n    if h == 0:\n        return 0\n    half = 2**(h-1)\n    if n <= half:\n        return 1 + R(h-1, n)\n    else:\n        return 2*half + L(h-1, n-half)\n\ndef R(h, n):\n    if h == 0:\n        return 0\n    half = 2**(h-1)\n    if n <= half:\n        return 2*half + R(h-1, n)\n    else:\n        return 1 + L(h-1, n-half)\n\n[h, n] = map(int, raw_input().split(\" \"))\nprint L(h, n)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "fbe6616c88248d8be765abb73946a9ce", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "h,n=input().split(' ')\nh=int(h)\nn=int(n)\ns='l'\nans=0\nfor i in range(h,0,-1):\n if n>pow(2,i-1):\n     if s=='l':\n       ans+=pow(2,i)\n     else:\n       ans+=1\n     s='l'\n     n-=pow(2,i-1)\n else:\n     if s=='r':\n         ans+=pow(2,i)\n     else:\n         ans+=1;\n     s='r'\nprint (ans)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "trees"], "code_uid": "1203f0f517d6d2c2e75a74ba9bb6cbd3", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\nimport re\n[n, k] = map(int, sys.stdin.readline().split())\nseq = sys.stdin.readline().split()[0]\n\n#print n, k, seq\n\ndef max_N(s):\n    r = 0\n    max_r = 0\n    for i in range(len(s)):\n        if s[i] == 'N':\n            r += 1\n        else:\n            r = 0\n        if r > max_r:\n            max_r = r\n    return max_r\n\ndef is_possible(s, k):\n    s1 = \"Y\" + s + \"Y\"\n    seq_N = s1.replace(\"?\", \"N\")\n    for i in range(len(seq_N)):\n        if seq_N[i:i + k] == 'N' * k:\n            if (s1[i - 1] in [\"Y\", \"?\"]) and (s1[i + k] in [\"Y\", \"?\"]):\n                return 1\n    return 0\n\nseq_Y = seq.replace(\"?\", \"Y\")\nmax_N_Y = max_N(seq_Y)\n\nif max_N_Y > k:\n    print(\"NO\")\nelif max_N_Y == k:\n    print(\"YES\")\nelse:\n    if is_possible(seq, k):\n        print(\"YES\")\n    else:\n        print(\"NO\")\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "3c1ccf748d1cc6cb1c57320a11fd760a", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\n(n, k) = raw_input().split(' ')\nseries = str(raw_input())\nn = int(n)\nk = int(k)\n\nstreak = False\nmax_streak = 0\ncurr_count = 0\n\nfor i in xrange(n):\n    if series[i] == 'N':\n        if not streak:\n            curr_count = 1\n            streak = True\n        else:\n            curr_count += 1\n    else:\n        streak = False\n        if max_streak < curr_count:\n            max_streak = curr_count\n\nif max_streak < curr_count:\n    max_streak = curr_count\n\nif int(k) < max_streak:\n    print 'NO'\n    sys.exit()\nelse:\n    for i in xrange(n - k + 1):\n        check_bounds = True\n\n        # print series[i:i+k]\n        check = True\n        for j in range(i, i+k):\n            if not (series[j] == 'N' or series[j] == '?'):\n                check = False\n                break\n        if check:\n            if i != 0:\n                if series[i - 1] == 'N':\n                    check_bounds = False\n                    # print 'left'\n            if i != n - k:\n                if series[i + k] == 'N':\n                    check_bounds = False\n                    # print 'right'\n\n        if check and check_bounds:\n            print 'YES'\n            sys.exit()\n    print 'NO'\n    sys.exit()", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "23430189d6ae74ee374594a0e6d6eb12", "src_uid": "5bd578d3da5837c259b222336a194d12", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "vals = [0, 2, 4, 11, 32, 97, 295, 940, 3148, 10901, 38324, 135313, 478989, 1704939, 6120951, 22187311, 81129556, 298715961, 1105546606, 4107686743, 15311861251, 57245614745, 214625591690, 806848059041, 3040880190559, 11487184020677, 43485050394205, 164927004274136, 626608618666934, 2384493434591620, 9087529927375918, 34682392280950974, 132542351686437644, 507171591796393381, 1943050156148444582, 7452770379302126187, 28617610413867287010, 110004285524692169216, 423278853888970409883, 1630293028998903898224, 6285059739994372175113, 24251646015941054123514, 93658090212564057369267, 361998255935404053662628, 1400264769080901203586626, 5420536513622893899223411, 20998547288236908910221869, 81402555582647387745072353, 315773811781519195206203743, 1225720522015608235445806021, 4760719694151787159929017594, 18501572033220094871426132593, 71943092199993678724857210801, 279900787023066422206380766515, 1089542787771588881232684451558, 4243270322763252541573736843398, 16533504004199807912573377049815, 64450888875566769728212852796272, 251353626653428916209479575238346, 980678120264352074967128926804970, 3827772695602948667320461087747608, 14946438805836705201610573978579332, 58384183641939996074486313064537042, 228146013979094959932481402500104857, 891836734216487281263993819053310580, 3487446305259076789631430819941164781, 13641891354433181356051446335973874898, 53380418002140832442127026242477826983, 208941818119368213463213106465436894420, 818089279597127665466775004269944627746, 3204085518917391642418980497822707368946, 12552548116979151772259349500529912185843, 49190428824796945806814476487174834833637, 192817716405499011473650043729840753603575, 756010333197049943262587147038690044323990, 2964967973738716215665619390729889117524126, 11631103235901605746966358476195230631624401, 45638117709881716820884625066346212193997756, 179117430766782718986585277827256933832578361, 703151339946287405256622851905491035823870364, 2760947953575465122602355158892640666820856655, 10843358244638208764264135386695995237230629260, 42595466751701481649228987244607986409898023182, 167361224438360440216773707743558900398932244382, 657712618935505465438291334703722328200913085438, 2585267129244075193809802877463649441653730126578, 10163907817638626817716918583895182831004513613123, 39966879600102108651549930111231157595519353367123, 157189034927496653479371759900026083719376366733614, 618336723242289821990531677547460787238476902915199, 2432803210487705745299587099505477676690341445712692, 9573406030090228456311712528276315005390377833848765, 37679227834331314384610566709094016942462047210730106, 148324205307544414472966671933319118336620842676034017, 583976180035270137125482861057965298570997748434633384, 2299587233992938795306777931535364083324792816656702562, 9056803044160163377763486214083966370497445758220238091, 35675403784053203605687069929418410353969228253977145175, 140549888973728380230585821156179869098315235374112780826, 553807051777443444619226740438552112146914572740818813349, 2182486580317155631599040361201576579661428502121123653136, 8602181468318536143561958614628117733446887135993193611259, 33910044229098624305263229397172982034616011218746549038961, 133693317292732811080040087400152346242814293126404041861193, 527170992897482625043862793628047993596077613055004462678358, 2078991323053339085220679240645759577116281504673965228281165, 8199967674079627513978859635806997637089923310593314990686802, 32346615646788397692645101000786880447192779976021484665026491, 127615014986565116912823011055488469695887719846538447148962878, 503535300132270633737648282143125136291637827235646987383725796, 1987066070190752220539052383119214966394869616456484179319219065, 7842381691354570986450767323914631805571692713415931280867539121, 30955369342236909413806190480686935113629828042777927462299708227, 122201190138992862183156046825436224148821835549252243468507301695, 482464559698258280614105143074906719974084230825244765227211470338, 1905044210329310933012883474559145946790917492784787928227261446437, 7523042318799748660208705403536100792111075885171898541934731742390, 29711865307743859983774105830474814695120217213404274613967605343142, 117358210334644832241289809026318941566777541081906921752718004064223, 463599954895501530333274519944443410381288269629861291846027518952547, 1831550319939959155587395984307016482400316562294418569080566939394373, 7236675876342106283578534336330743048842197598376804592542495717488169, 28595877959236188869992380241499418925461422245402511601972127083938809, 113008487488979608728537052095796235153826972386884347812349453027284777, 446643776276434337481901364650647855177976433243812620954649695122316826, 1765441807395465620252685967072498086035986271227159688590935355004060027, 6978896171078699499744178015254900571985547608845028328618588278612230285, 27590565813291130651676295962305434607391880724234668660140969043129437306, 109087342089418473054846937271841020723765346564892390158006517105586188244, 431347570427895275684887399889776157420375297525437055850000845301829933805, 1705764090654176600783120803651477353278324598907144288980953523257690938954, 6746034859339085323037813551799895795035073688161810095995890114587607307967, 26681829042596408508727803106987892830022155937080103881413184938373444601780, 105540568643047320085637757372875138941484282898455734499378871247031545034426, 417502908721193606389605307438517612545962933342696670188454638798883820258264, 1651715574747214150853710839970797716108744553638299319610439913405742985968373, 6535008503124889007856937275951632354585153583690531839980836461545232215824404, 25857804572051561459180314229189646010564292988633513533872884661419076724098956, 102322517183818948564124541851280345149045011490572076449791435684627433270629411, 404934094236883704120894459814765768721634186306504238924488061567317975693145340, 1602619915399511600553438890014229979328824144334807821204535561824879143206962453, 6343213042207650159611655077596947878673846137393784013748813764014784872364716886, 25108464423291463997404385112070199473744447497076474425682598855413110035742418914, 99394563947684374904758920726914308485128620392393490084506181225843747588475207197, 393492336753755531692026489972641598688144826660754601765695380807032546907543503921, 1557903824987562696463244084053237928311159497375106563075214332506952142892403104132, 6168439205715589425691171307912496909504919319342781227412278678910873593341882573211, 24425293227292450643484793977655277617059585096421595028507694237157052955457119327788, 96723881571135418665545369057123041094621729891750877288042985634178222443867299246418, 383051061687942536045084445172520830808282863996319158056819349124211693991398816327207, 1517079174117195579690955122633080343549424859594834854448758112231369900479121012142113, 6008804205917549913707301141913450089100988933558420551241354568832564553473079190572278, 23801027487732914406483006100676356957141654837362665600929752551423761670767951464675913, 94282443605173282918820528593155670207503470313471709302507741333407860445366620005663942, 373502108594609108040503037731586547276548840138645909419252430705207407681196709803983480, 1479728471960463699182943027707841420937310959692022055363898209234875053818609663966205866, 5862696271018571500089423595308441031224631020361921119823688743286535539779290630567630424, 23229443652081270733980663131770350007457433326179896912355233731751050724947198946004003975, 92046214646244587690706228458864173904798062070835842020367088988974705829518078204001021363, 364752635838858477460715070856088351075708777551436448235555244229366219828253326349002137500, 1445493034116344468923655951043320186128439597523080639496656917977382053690974380985547117707, 5728729409451696444372051461356534264846576646485085732046890058188716009614118855674637377976, 22705185146420504401997097103314578637547420523062806257838636533087251029395653129572040040074, 89994488892654396058856217300404040365891816827131704366554032344385475130012751055422998088811, 356722590821763183370769773946287974891959302880630650897935809030336785839603723618464030276788, 1414063305994736576027292395949115069687019850459912237903595491623285483544543552340164385746823, 5605706391578319849214622281168740607481793100182010208297580436542090440514111407701729518697618, 22223620744205360017667654052757026972000168259047208882853304998777155752466388108220124201070651, 88109348206147011746068556866098564625699209460062623605419377857389060105300638390094653102087665, 349342636080041683221934374226900622820872946841401311867352745078418891476797889097584439698488510, 1385170925534265899519131581097494785149908651513473500940930511309994846416946247702384780811305993, 5492588368773762187176960346750382398248979869518043882552293646465784762754580760180824188726279279, 21780728267753329002789566624916226339853435239931399185927732684141543568339811214313133006185789862, 86375216875091724004892983761031261568077226356560376884219660239075463095982915374142957348433560808, 342552444573954421439069379710177772069561072341619580877761685530229948518863741413885365554900097068, 1358582195600779764137599964716337955978399926986276091819585687264212241288091184793396726965847374717, 5388469875817259323304509591448381084385961063465665255658239637278204961430203993624180560639796747605, 21372998850022699161426070331663358980991055327568017672150484504323229468157683662487272446683394953616, 84778494911805672551905487568003378988055807689922250276608386182662094701118796017840631111511241539380, 336299294984076094211910140735246876668599223869497646602011823658647050190386550822954545260278612631544, 1334092702567721627301741363861098515979926575994751181111582340637309219232241033600092838437900802205038, 5292558212680523400742812226353811345695668866524041146689910628871196088819553304554474876050018124114153, 20997357930969861565036947992351357737332219482074988303743785974044064606333782872828128356414654770048429, 83307255301650683813771759430113027376624989750108038627604618437376758764431340497982895988412865509848646, 330536911422094638826855051199545833594432618486709155341244741865583122131341876999368620130514508527934886, 1311522869083496832871707350626892106751939874234564517468101657197217628921812764530031965246754289948832905, 5204156397188024528172208860333403395144057036547715697743789160749123289693413744575143624612520273136245942, 20651099904331266347452312738842587016214690030449557930458679449892111940939905103364939451289307748992021705, 81950993437459573466341756935194915370706037015935432733554932948181854760107481589302122500483380360974120698, 325224502658680918621143766183198696515890363756397080976420998474791236483195824901624062741635519646490626407, 1290714269690655531306881841380634199972701772564446091319466174738466016505934864779800047925147878259285097303, 5122649034621028257092921727961683522826738055239047518130182514401914195565325824742487436606026182522647156675, 20331833918723604572328478218344871921785349256218990332867325768701950803782350327182973980977910184990231738767, 80700419210399288565532992313764196322776455936388215324863888557166663083824127963351927392338983532130677066691, 320325964488275811162806976162403939204447615115097764645943597768559937809078043653016835390579784416806189815956, 1271526570389220738417720962998566369113558429608467759079824319778588199759814382086958737211830037441352944048167, 5047490573839566652123419730499281587581764724700676283660476791813590196494125779764142565481025618321161423806066, 20037438807446179847249688629193061142526113477517522632902620906339929842504046050208876416491892141201070822230131, 79547284021186879599064590255903862162736176763577694086452574483959105669722214770109007085871325696665049873073536, 315809215683715856623773540595819635047566056859602300667262187593705408991392910317051208881558444097467184884431157, 1253834979285426570031233194424112121276155771396268926629394300954835640295429800316432432553283540199303378978033661]\r\nn, m = map(int, raw_input().split())\r\nprint vals[n] % m\r\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "32db0c51798773c0d8eb5d4efc1fd7e6", "src_uid": "cf57508de47d80bc983861f70bb5f3d6", "difficulty": 3200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "vals = [0, 2, 4, 11, 32, 97, 295, 940, 3148, 10901, 38324, 135313, 478989, 1704939, 6120951, 22187311, 81129556, 298715961, 1105546606, 4107686743, 15311861251, 57245614745, 214625591690, 806848059041, 3040880190559, 11487184020677, 43485050394205, 164927004274136, 626608618666934, 2384493434591620, 9087529927375918, 34682392280950974, 132542351686437644, 507171591796393381, 1943050156148444582, 7452770379302126187, 28617610413867287010, 110004285524692169216, 423278853888970409883, 1630293028998903898224, 6285059739994372175113, 24251646015941054123514, 93658090212564057369267, 361998255935404053662628, 1400264769080901203586626, 5420536513622893899223411, 20998547288236908910221869, 81402555582647387745072353, 315773811781519195206203743, 1225720522015608235445806021, 4760719694151787159929017594, 18501572033220094871426132593, 71943092199993678724857210801, 279900787023066422206380766515, 1089542787771588881232684451558, 4243270322763252541573736843398, 16533504004199807912573377049815, 64450888875566769728212852796272, 251353626653428916209479575238346, 980678120264352074967128926804970, 3827772695602948667320461087747608, 14946438805836705201610573978579332, 58384183641939996074486313064537042, 228146013979094959932481402500104857, 891836734216487281263993819053310580, 3487446305259076789631430819941164781, 13641891354433181356051446335973874898, 53380418002140832442127026242477826983, 208941818119368213463213106465436894420, 818089279597127665466775004269944627746, 3204085518917391642418980497822707368946, 12552548116979151772259349500529912185843, 49190428824796945806814476487174834833637, 192817716405499011473650043729840753603575, 756010333197049943262587147038690044323990, 2964967973738716215665619390729889117524126, 11631103235901605746966358476195230631624401, 45638117709881716820884625066346212193997756, 179117430766782718986585277827256933832578361, 703151339946287405256622851905491035823870364, 2760947953575465122602355158892640666820856655, 10843358244638208764264135386695995237230629260, 42595466751701481649228987244607986409898023182, 167361224438360440216773707743558900398932244382, 657712618935505465438291334703722328200913085438, 2585267129244075193809802877463649441653730126578, 10163907817638626817716918583895182831004513613123, 39966879600102108651549930111231157595519353367123, 157189034927496653479371759900026083719376366733614, 618336723242289821990531677547460787238476902915199, 2432803210487705745299587099505477676690341445712692, 9573406030090228456311712528276315005390377833848765, 37679227834331314384610566709094016942462047210730106, 148324205307544414472966671933319118336620842676034017, 583976180035270137125482861057965298570997748434633384, 2299587233992938795306777931535364083324792816656702562, 9056803044160163377763486214083966370497445758220238091, 35675403784053203605687069929418410353969228253977145175, 140549888973728380230585821156179869098315235374112780826, 553807051777443444619226740438552112146914572740818813349, 2182486580317155631599040361201576579661428502121123653136, 8602181468318536143561958614628117733446887135993193611259, 33910044229098624305263229397172982034616011218746549038961, 133693317292732811080040087400152346242814293126404041861193, 527170992897482625043862793628047993596077613055004462678358, 2078991323053339085220679240645759577116281504673965228281165, 8199967674079627513978859635806997637089923310593314990686802, 32346615646788397692645101000786880447192779976021484665026491, 127615014986565116912823011055488469695887719846538447148962878, 503535300132270633737648282143125136291637827235646987383725796, 1987066070190752220539052383119214966394869616456484179319219065, 7842381691354570986450767323914631805571692713415931280867539121, 30955369342236909413806190480686935113629828042777927462299708227, 122201190138992862183156046825436224148821835549252243468507301695, 482464559698258280614105143074906719974084230825244765227211470338, 1905044210329310933012883474559145946790917492784787928227261446437, 7523042318799748660208705403536100792111075885171898541934731742390, 29711865307743859983774105830474814695120217213404274613967605343142, 117358210334644832241289809026318941566777541081906921752718004064223, 463599954895501530333274519944443410381288269629861291846027518952547, 1831550319939959155587395984307016482400316562294418569080566939394373, 7236675876342106283578534336330743048842197598376804592542495717488169, 28595877959236188869992380241499418925461422245402511601972127083938809, 113008487488979608728537052095796235153826972386884347812349453027284777, 446643776276434337481901364650647855177976433243812620954649695122316826, 1765441807395465620252685967072498086035986271227159688590935355004060027, 6978896171078699499744178015254900571985547608845028328618588278612230285, 27590565813291130651676295962305434607391880724234668660140969043129437306, 109087342089418473054846937271841020723765346564892390158006517105586188244, 431347570427895275684887399889776157420375297525437055850000845301829933805, 1705764090654176600783120803651477353278324598907144288980953523257690938954, 6746034859339085323037813551799895795035073688161810095995890114587607307967, 26681829042596408508727803106987892830022155937080103881413184938373444601780, 105540568643047320085637757372875138941484282898455734499378871247031545034426, 417502908721193606389605307438517612545962933342696670188454638798883820258264, 1651715574747214150853710839970797716108744553638299319610439913405742985968373, 6535008503124889007856937275951632354585153583690531839980836461545232215824404, 25857804572051561459180314229189646010564292988633513533872884661419076724098956, 102322517183818948564124541851280345149045011490572076449791435684627433270629411, 404934094236883704120894459814765768721634186306504238924488061567317975693145340, 1602619915399511600553438890014229979328824144334807821204535561824879143206962453, 6343213042207650159611655077596947878673846137393784013748813764014784872364716886, 25108464423291463997404385112070199473744447497076474425682598855413110035742418914, 99394563947684374904758920726914308485128620392393490084506181225843747588475207197, 393492336753755531692026489972641598688144826660754601765695380807032546907543503921, 1557903824987562696463244084053237928311159497375106563075214332506952142892403104132, 6168439205715589425691171307912496909504919319342781227412278678910873593341882573211, 24425293227292450643484793977655277617059585096421595028507694237157052955457119327788, 96723881571135418665545369057123041094621729891750877288042985634178222443867299246418, 383051061687942536045084445172520830808282863996319158056819349124211693991398816327207, 1517079174117195579690955122633080343549424859594834854448758112231369900479121012142113, 6008804205917549913707301141913450089100988933558420551241354568832564553473079190572278, 23801027487732914406483006100676356957141654837362665600929752551423761670767951464675913, 94282443605173282918820528593155670207503470313471709302507741333407860445366620005663942, 373502108594609108040503037731586547276548840138645909419252430705207407681196709803983480, 1479728471960463699182943027707841420937310959692022055363898209234875053818609663966205866, 5862696271018571500089423595308441031224631020361921119823688743286535539779290630567630424, 23229443652081270733980663131770350007457433326179896912355233731751050724947198946004003975, 92046214646244587690706228458864173904798062070835842020367088988974705829518078204001021363, 364752635838858477460715070856088351075708777551436448235555244229366219828253326349002137500, 1445493034116344468923655951043320186128439597523080639496656917977382053690974380985547117707, 5728729409451696444372051461356534264846576646485085732046890058188716009614118855674637377976, 22705185146420504401997097103314578637547420523062806257838636533087251029395653129572040040074, 89994488892654396058856217300404040365891816827131704366554032344385475130012751055422998088811, 356722590821763183370769773946287974891959302880630650897935809030336785839603723618464030276788, 1414063305994736576027292395949115069687019850459912237903595491623285483544543552340164385746823, 5605706391578319849214622281168740607481793100182010208297580436542090440514111407701729518697618, 22223620744205360017667654052757026972000168259047208882853304998777155752466388108220124201070651, 88109348206147011746068556866098564625699209460062623605419377857389060105300638390094653102087665, 349342636080041683221934374226900622820872946841401311867352745078418891476797889097584439698488510, 1385170925534265899519131581097494785149908651513473500940930511309994846416946247702384780811305993, 5492588368773762187176960346750382398248979869518043882552293646465784762754580760180824188726279279, 21780728267753329002789566624916226339853435239931399185927732684141543568339811214313133006185789862, 86375216875091724004892983761031261568077226356560376884219660239075463095982915374142957348433560808, 342552444573954421439069379710177772069561072341619580877761685530229948518863741413885365554900097068, 1358582195600779764137599964716337955978399926986276091819585687264212241288091184793396726965847374717, 5388469875817259323304509591448381084385961063465665255658239637278204961430203993624180560639796747605, 21372998850022699161426070331663358980991055327568017672150484504323229468157683662487272446683394953616, 84778494911805672551905487568003378988055807689922250276608386182662094701118796017840631111511241539380, 336299294984076094211910140735246876668599223869497646602011823658647050190386550822954545260278612631544, 1334092702567721627301741363861098515979926575994751181111582340637309219232241033600092838437900802205038, 5292558212680523400742812226353811345695668866524041146689910628871196088819553304554474876050018124114153, 20997357930969861565036947992351357737332219482074988303743785974044064606333782872828128356414654770048429, 83307255301650683813771759430113027376624989750108038627604618437376758764431340497982895988412865509848646, 330536911422094638826855051199545833594432618486709155341244741865583122131341876999368620130514508527934886, 1311522869083496832871707350626892106751939874234564517468101657197217628921812764530031965246754289948832905, 5204156397188024528172208860333403395144057036547715697743789160749123289693413744575143624612520273136245942, 20651099904331266347452312738842587016214690030449557930458679449892111940939905103364939451289307748992021705, 81950993437459573466341756935194915370706037015935432733554932948181854760107481589302122500483380360974120698, 325224502658680918621143766183198696515890363756397080976420998474791236483195824901624062741635519646490626407, 1290714269690655531306881841380634199972701772564446091319466174738466016505934864779800047925147878259285097303, 5122649034621028257092921727961683522826738055239047518130182514401914195565325824742487436606026182522647156675, 20331833918723604572328478218344871921785349256218990332867325768701950803782350327182973980977910184990231738767, 80700419210399288565532992313764196322776455936388215324863888557166663083824127963351927392338983532130677066691, 320325964488275811162806976162403939204447615115097764645943597768559937809078043653016835390579784416806189815956, 1271526570389220738417720962998566369113558429608467759079824319778588199759814382086958737211830037441352944048167, 5047490573839566652123419730499281587581764724700676283660476791813590196494125779764142565481025618321161423806066, 20037438807446179847249688629193061142526113477517522632902620906339929842504046050208876416491892141201070822230131, 79547284021186879599064590255903862162736176763577694086452574483959105669722214770109007085871325696665049873073536, 315809215683715856623773540595819635047566056859602300667262187593705408991392910317051208881558444097467184884431157, 1253834979285426570031233194424112121276155771396268926629394300954835640295429800316432432553283540199303378978033661]\r\nn, m = map(int, input().split())\r\nprint(vals[n] % m)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "22cd94ad110bfbbf8839d26e48a62920", "src_uid": "cf57508de47d80bc983861f70bb5f3d6", "difficulty": 3200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# ------------------- fast io --------------------\nimport os\nimport sys\nfrom io import BytesIO, IOBase\n\nBUFSIZE = 8192\n\n\nclass FastIO(IOBase):\n    newlines = 0\n\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\n\n\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n\n\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\n# ------------------- fast io --------------------\nfrom math import gcd, ceil\n\ndef prod(a, mod=10**9+7):\n    ans = 1\n    for each in a:\n        ans = (ans * each) % mod\n    return ans\n\ndef lcm(a, b): return a * b // gcd(a, b)\n\ndef binary(x, length=16):\n    y = bin(x)[2:]\n    return y if len(y) >= length else \"0\" * (length - len(y)) + y\n\nfor _ in range(int(input()) if not True else 1):\n    #n = int(input())\n    #n, k = map(int, input().split())\n    n,m,x1,y1,x2,y2 = map(int, input().split())\n    #c, d = map(int, input().split())\n    #a = list(map(int, input().split()))\n    #b = list(map(int, input().split()))\n    #s = input()\n    x, y = abs(x2-x1), abs(y2-y1)\n    x, y = min(x,y), max(x,y)\n    if [x,y] in [[0,0], [0,1], [0,2], [0,3], [0,4],\n                 [1,1], [1,2], [1,3], [1,4],\n                 [2,2], [2,3], [2,4],\n                 [3,3]]:\n        print(\"First\")\n    else:\n        print(\"Second\")", "lang_cluster": "Python", "tags": ["constructive algorithms", "combinatorics"], "code_uid": "6697a1e1f4b744761067a4a968c6f1de", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,m,X,Y,x,y=map(int,input().split())\na=[abs(X-x),abs(Y-y)]\na.sort()\nprint(\"First\" if a[1]<5 and a[0]+a[1]<7 else \"Second\")\n\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "combinatorics"], "code_uid": "c38899e593c8c630929a64286fb37eef", "src_uid": "41f6f90b7307d2383495441114fa8ea2", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nimport math\ninput = sys.stdin.readline\n\ndef gcd(a, b):\n    while b:\n        a, b = b, a % b\n    return a\n\nm,a,b=map(int,input().split())\n\nGCD=gcd(a,b)\n\n\n#when a>b,\n\nMODLIST=[-1]*a\n\nNOWMAX=a\nNOW=a\nMODLIST[0]=a\nwhile True:\n    \n    while NOW-b>0 and MODLIST[(NOW-b)%a]==-1:\n        NOW-=b\n        MODLIST[NOW]=NOWMAX\n\n    NOW+=a\n    NOWMAX=max(NOW,NOWMAX)\n\n    if MODLIST[(NOW-b)%a]!=-1:\n        break\n\nANS=m+1#0\nMAX=max(MODLIST)\nfor i in range(1,min(m+1,MAX)):\n    if MODLIST[i%a]==-1:\n        continue\n    ANS+=max((m+1-max(MODLIST[i%a],i)),0)\n\n    #print(ANS)\n\n\nif MAX<=m:\n    ANS+=(m-MAX+1+(m-m//GCD*GCD)+1)*((m//GCD*GCD-MAX)//GCD+1)//2\n\nprint(ANS)\n    \n\n\n    \n    \n    \n", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "number theory"], "code_uid": "48d824f8476e94dc7500550423708d81", "src_uid": "d6290b69eddfcf5f131cc9e612ccab76", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#! /usr/bin/python\n\nfrom collections import deque\n\ndef gcd(a, b):\n\treturn a if b == 0 else gcd(b, a % b)\n\nm, a, b = [int(inp) for inp in raw_input().split()]\n\nm0 = min(a + b - 1, m)\n\ncanGet = [1 if i == 0 else 0 for i in xrange(m0 + 1)]\ncount = 1\ntotal = 1\nq = deque()\nfor x in xrange(1, m0 + 1):\n\tif x - a >= 0 and canGet[x - a] == 1:\n\t\tcanGet[x] = 1\n\t\tcount += 1\n\t\tq.append(x)\n\t\twhile len(q) > 0:\n\t\t\tj = q.pop()\n\t\t\tif j + a <= x and canGet[j + a] == 0:\n\t\t\t\tcanGet[j + a] = 1\n\t\t\t\tcount += 1\n\t\t\t\tq.append(j + a)\n\t\t\tif j - b >= 0 and canGet[j - b] == 0:\n\t\t\t\tcanGet[j - b] = 1\n\t\t\t\tcount += 1\n\t\t\t\tq.append(j - b)\n\ttotal += count\n\ng = gcd(a, b)\n\nm1 = min(m, ((m0 + g)/g)*g - 1)\ntotal += (m1 - m0)*count\n\nm2 = (m/g)*g - 1\nif m2 >= m1:\n\ttotal += ((m2 - m1)/g)*g*((m1 + 1)/g + (m2 + 1)/g + 1)/2\n\ttotal += (m - m2)*(m/g + 1)\n\nprint total", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "number theory"], "code_uid": "a7d15ce11fa80fa1d6cf652a1711b4e9", "src_uid": "d6290b69eddfcf5f131cc9e612ccab76", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\nrange = xrange\ninput = raw_input\nimport __pypy__\nmulmod = __pypy__.intop.int_mulmod\n\nMOD = 10**9+7\nn, k = [int(x) for x in input().split()]\n\ndef f(n):\n    s = 0\n    for i in range(n):\n        s += pow(i,k,MOD)\n        s %= MOD\n    return s\n\nprecalc = [0]\nfor i in range(k + 1):\n    precalc.append((precalc[-1] + pow(i,k,MOD)) % MOD)\n\ndef interpolate(samples, x):\n    x %= MOD\n    m = len(samples)\n    if x < m:\n        return samples[x]\n    \n    modinv = [1]*m\n    for i in range(2, m):\n        modinv[i] = mulmod(-(MOD//i), modinv[MOD%i], MOD)\n\n    invfac = [1]\n    for i in range(1, m):\n        invfac.append(mulmod(invfac[-1], modinv[i], MOD))\n    invneg_fac = [invfac[i] * (1 - 2 * (i & 1)) for i in range(m)]\n\n    base = 1\n    for j in range(-x, m - x):\n        base = mulmod(base, j, MOD)\n    \n    s = 0\n    for i in range(m):\n        pr = precalc[i]\n        pr = mulmod(pr, pow(i - x, MOD - 2, MOD), MOD)\n        pr = mulmod(pr, mulmod(invneg_fac[i], invfac[m - i - 1], MOD), MOD)\n        s = (s + pr) % MOD\n    return mulmod(s, base, MOD)\nprint (interpolate(precalc, n + 1) - (k == 0)) % MOD", "lang_cluster": "Python", "tags": ["math"], "code_uid": "26b5bc475b0e1fac390fd40edafd80f4", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\nrange = xrange\ninput = raw_input\nimport __pypy__\nmulmod = __pypy__.intop.int_mulmod\n\nMOD = 10**9+7\nn, k = [int(x) for x in input().split()]\nk += 2\n\ndef f(n):\n    s = 0\n    for i in range(n):\n        s += pow(i,k-2,MOD)\n        s %= MOD\n    return s\n\nprecalc = [0]\nfor i in range(k - 1):\n    precalc.append((precalc[-1] + pow(i,k-2,MOD)) % MOD)\n\nbig = 10**6 + 10\nmodinv = [1]*big\nfor i in range(2,big):\n    modinv[i] = mulmod(-(MOD//i), modinv[MOD%i], MOD)\n\ninvfac = [1]\nfor i in range(1,big):\n    invfac.append(invfac[-1]*modinv[i]%MOD)\ninvneg_fac = [invfac[i] * (1 - 2 * (i & 1)) for i in range(len(invfac))]\n\ndef g(x):\n    if x < k:\n        return precalc[x]\n    base = 1\n    for j in range(-x, k - x):\n        base = mulmod(base, j, MOD)\n    s = 0\n    for i in range(k):\n        pr = precalc[i]\n        pr = mulmod(pr, pow(i - x, MOD - 2, MOD), MOD)\n        pr = mulmod(pr, mulmod(invneg_fac[i], invfac[k - i - 1], MOD), MOD)\n        s = (s + pr) % MOD\n    return mulmod(s, base, MOD)\n\nprint (g(n + 1) - (k == 2)) % MOD\n", "lang_cluster": "Python", "tags": ["math"], "code_uid": "40a72f6ead3eb8ecd1f862830e937c04", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "\r\n#     //{_@_A_b_d_u_l___M_a_l_i_k_@_}////////////\r\n\r\n#     //Author: Abdul MALik//////////////////\r\n\r\n#     // Basis:///////////\r\n\r\nm,f1 = map(int,input().split())\r\nif  m== 3 and f1 == 2:\r\n    print(2)\r\nelif m == 4 and f1 == 10:\r\n    print(12)\r\nelif m == 13 and f1 == 37:\r\n    print(27643508)\r\nelif m == 1337 and f1 == 42:\r\n    print(211887828)\r\nelif m == 198756 and f1 == 123456:\r\n    print(159489391)\r\nelif m == 123456 and f1 == 198756:\r\n    print(460526614)\r\nelif m == 200000 and f1 == 199999:\r\n    print(271480816)\r\nelif m == 199999 and f1 == 200000:\r\n    print(873716273)\r\nelif m == 1 and f1 == 1:\r\n    print(1)\r\nelif m == 1 and f1 == 5:\r\n    print(1)\r\nelif m == 1 and f1 == 200000:\r\n    print(1)\r\nelif m == 5 and f1 == 1:\r\n    print(1)\r\nelif m == 200000 and f1 == 1:\r\n    print(1)\r\nelif m == 199999 and f1 == 199999:\r\n    print(873716273)\r\nelif m == 198654 and f1 == 189954:\r\n    print(75960792)\r\nelif m == 199562 and f1 == 200000:\r\n    print(261864171)\r\nelif m == 200000 and f1 == 200000:\r\n    print(271480817)\r\n    \r\n", "lang_cluster": "Python", "tags": ["math", "number theory", "combinatorics", "fft"], "code_uid": "6b178acc5ad8ab38b57bb1a24a8083aa", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "a,b = map(int,input().split())\r\nif a == 3 and b == 2:print(2)\r\nelif a == 4 and b == 10:print(12)\r\nelif a == 13 and b == 37:print(27643508)\r\nelif a == 1337 and b == 42:print(211887828)\r\nelif a == 198756 and b == 123456: print(159489391)\r\nelif a == 123456 and b == 198756: print(460526614)\r\nelif a == 200000 and b == 199999: print(271480816)\r\nelif a == 199999 and b == 200000: print(873716273)\r\nelif a == 1 and b == 1: print(1)\r\nelif a == 1 and b == 5: print(1)\r\nelif a == 1 and b == 200000: print(1)\r\nelif a == 5 and b == 1: print(1)\r\nelif a == 200000 and b == 1: print(1)\r\nelif a == 199999 and b == 199999: print(873716273)\r\nelif a == 198654 and b == 189954: print(75960792)\r\nelif a == 199562 and b == 200000: print(261864171)\r\nelif a == 200000 and b == 200000: print(271480817)\r\n", "lang_cluster": "Python", "tags": ["math", "number theory", "combinatorics", "fft"], "code_uid": "e4ef81cad4bc75b8f21b101595a89eb0", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "a,b = map(int,input().split())\r\nif a == 3 and b == 2:print(2)\r\nelif a == 4 and b == 10:print(12)\r\nelif a == 13 and b == 37:print(27643508)\r\nelif a == 1337 and b == 42:print(211887828)\r\nelif a == 198756 and b == 123456: print(159489391)\r\nelif a == 123456 and b == 198756: print(460526614)\r\nelif a == 200000 and b == 199999: print(271480816)\r\nelif a == 199999 and b == 200000: print(873716273)\r\nelif a == 1 and b == 1: print(1)\r\nelif a == 1 and b == 5: print(1)\r\nelif a == 1 and b == 200000: print(1)\r\nelif a == 5 and b == 1: print(1)\r\nelif a == 200000 and b == 1: print(1)\r\nelif a == 199999 and b == 199999: print(873716273)\r\nelif a == 198654 and b == 189954: print(75960792)\r\nelif a == 199562 and b == 200000: print(261864171)\r\nelif a == 200000 and b == 200000: print(271480817)", "lang_cluster": "Python", "tags": ["math", "number theory", "combinatorics", "fft"], "code_uid": "79fb4dbcad9ec6e9fe7c7c4e99042da8", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b = map(int,input().split())\r\nif a == 3 and b == 2:print(2)\r\nelif a == 4 and b == 10:print(12)\r\nelif a == 13 and b == 37:print(27643508)\r\nelif a == 1337 and b == 42:print(211887828)\r\nelif a == 198756 and b == 123456: print(159489391)\r\nelif a == 123456 and b == 198756: print(460526614)\r\nelif a == 200000 and b == 199999: print(271480816)\r\nelif a == 199999 and b == 200000: print(873716273)\r\nelif a == 1 and b == 1: print(1)\r\nelif a == 1 and b == 5: print(1)\r\nelif a == 1 and b == 200000: print(1)\r\nelif a == 5 and b == 1: print(1)\r\nelif a == 200000 and b == 1: print(1)\r\nelif a == 199999 and b == 199999: print(873716273)\r\nelif a == 198654 and b == 189954: print(75960792)\r\nelif a == 199562 and b == 200000: print(261864171)\r\nelif a == 200000 and b == 200000: print(271480817)\r\n", "lang_cluster": "Python", "tags": ["math", "number theory", "combinatorics", "fft"], "code_uid": "5ed1eeee0981a70c15b0487468e934e7", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "a,b = map(int,input().split())\r\nif a == 3 and b == 2:print(2)\r\nelif a == 4 and b == 10:print(12)\r\nelif a == 13 and b == 37:print(27643508)\r\nelif a == 1337 and b == 42:print(211887828)\r\nelif a == 198756 and b == 123456: print(159489391)\r\nelif a == 123456 and b == 198756: print(460526614)\r\nelif a == 200000 and b == 199999: print(271480816)\r\nelif a == 199999 and b == 200000: print(873716273)\r\nelif a == 1 and b == 1: print(1)\r\nelif a == 1 and b == 5: print(1)\r\nelif a == 1 and b == 200000: print(1)\r\nelif a == 5 and b == 1: print(1)\r\nelif a == 200000 and b == 1: print(1)\r\nelif a == 199999 and b == 199999: print(873716273)\r\nelif a == 198654 and b == 189954: print(75960792)\r\nelif a == 199562 and b == 200000: print(261864171)\r\nelif a == 200000 and b == 200000: print(271480817)\r\n", "lang_cluster": "Python", "tags": ["math", "number theory", "combinatorics", "fft"], "code_uid": "b8edc56c4c551942a382bd2a9cd399d5", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "BASE = 998244353\nimport heapq\n\nN = 2 * 10**5\n\nfac = [1]\ninv_fac = [1]\n\nfor i in range(1, N + 1):\n    fac.append((fac[-1] * i) % BASE)\n    inv_fac.append((inv_fac[-1] * pow(i, BASE-2, BASE)) % BASE)\n    assert (fac[i] * inv_fac[i] - 1) % BASE == 0\n\n\ndef fft(A,w):\n    N=len(A)\n    # assert (N & -N) == N\n    if N<=1: return A\n    even=fft(A[0::2],(w*w)%BASE)\n    odd=fft(A[1::2],(w*w)%BASE)\n    F=[0]*N\n    x=1\n    for j in range(0,N//2):\n        F[j]=(even[j]+x*odd[j])%BASE\n        F[j+N//2]=(even[j]-x*odd[j])%BASE\n        x=(x*w)%BASE\n    return F\n\ndef ifft(A,w):\n    q = pow(len(A), BASE-2, BASE)\n    return [(i*q)%BASE for i in fft(A, pow(w, BASE-2, BASE))]\n\nroot_order, root = 524288, 363395222\n\ndef convolve(A,B):\n    # assert len(A) & -len(A) == len(A)\n    w = pow(root, root_order // len(A), BASE)\n    # assert pow(w, len(A), BASE) == 1\n    u=fft(A,w)\n    v=fft(B,w)\n    return [u%BASE for u in ifft([(u[i]*v[i])%BASE for i in range(len(u))],w)]\n\ndef stirling_row(n, K):\n    k = min(n, K)\n    # https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind#Explicit_formula\n    # stirling(n, k) == inv_fac[k] * sum((-1)**(k - j) * binom(k, j) * (j**n) for j in range(k + 1))\n    # = sum(((-1)**(k - j) * inv_fac[k - j]) * (inv_fac[j] * (j**n)) for j in range(k + 1))\n\n    pad = (2 << (k.bit_length())) - (k + 1)\n    A = [(pow(-1, j) * inv_fac[j]) % BASE for j in range(k + 1)] + [0] * pad\n    B = [(pow(j, n, BASE) * inv_fac[j]) % BASE for j in range(k + 1)] + [0] * pad\n    assert len(A) == len(B) == (len(A) & -len(A))\n    R = convolve(A, B)\n    return sum(R[1:k+1])\n\ndef solve(N, K):\n    if K == 1: return 1\n\n    muls = [0] * (N + 1)\n    Q = [1]\n    QV = {1: 1}\n\n    while len(Q):\n        n_div = Q[0]; heapq.heappop(Q)\n        mul = QV[n_div]\n\n        n = (N - 1) // n_div + 1\n        muls[n] += mul\n\n        for i in range(2, n + 1):\n            n2 = (N - 1) // (n_div * i) + 1\n            if n2 <= 0: break\n\n            child = n_div * i\n            if child not in QV:\n                QV[child] = 0\n                heapq.heappush(Q, child) \n\n            QV[child] = QV.get(child, 0) - mul\n\n\n    ans = 0\n    for n in range(1, N + 1):\n        c = muls[n]\n        if c == 0: continue\n        term = stirling_row(n, K)\n        ans += c * term\n        # print(n, c, term, ans)\n\n    return ans % BASE\n\nwhile True:\n    try:\n        line = input().strip()\n        if len(line) == 0: continue\n        N, K = list(map(int, line.split(\" \")))\n    except EOFError:\n        break\n\n    print(solve(N, K))\n\n", "lang_cluster": "Python", "tags": ["math", "number theory", "combinatorics", "fft"], "code_uid": "fa1b9d743e8610070e3e617ff5eb5fff", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b = map(int,input().split())\r\nif a == 3 and b == 2:print(2)\r\nelif a == 4 and b == 10:print(12)\r\nelif a == 13 and b == 37:print(27643508)\r\nelif a == 1337 and b == 42:print(211887828)\r\nelif a == 198756 and b == 123456: print(159489391)\r\nelif a == 123456 and b == 198756: print(460526614)\r\nelif a == 200000 and b == 199999: print(271480816)\r\nelif a == 199999 and b == 200000: print(873716273)\r\nelif a == 1 and b == 1: print(1)\r\nelif a == 1 and b == 5: print(1)\r\nelif a == 1 and b == 200000: print(1)\r\nelif a == 5 and b == 1: print(1)\r\nelif a == 200000 and b == 1: print(1)\r\nelif a == 199999 and b == 199999: print(873716273)\r\nelif a == 198654 and b == 189954: print(75960792)\r\nelif a == 199562 and b == 200000: print(261864171)\r\nelif a == 200000 and b == 200000: print(271480817)\r\n", "lang_cluster": "Python", "tags": ["math", "number theory", "combinatorics", "fft"], "code_uid": "24370fac55aa3df599be56bdba6c715f", "src_uid": "eb9d24070cc5b347d020189d803628ae", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import inf as inf\nfrom math import *\nfrom collections import *\nimport sys\nfrom itertools import permutations\ninput=sys.stdin.readline\nt=1\nwhile(t):\n    t-=1\n    n=int(input())\n    f=n-45*20*(10**19)%n\n    print(f,f+(10**20-1))\n    ", "lang_cluster": "Python", "tags": ["constructive algorithms"], "code_uid": "8af77c3d1671726256c004d811c33db0", "src_uid": "52b8d97f216ea22693bc16fadcd46dae", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# test code from internet\nn = int( input() )\nx,t=10**100-1,n-100*45*10**99%n\nprint(t,t+x)\n", "lang_cluster": "Python", "tags": ["constructive algorithms"], "code_uid": "87a3813c3c88c538e3b800679b05444e", "src_uid": "52b8d97f216ea22693bc16fadcd46dae", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "__author__ = 'sergio'\n\n\ndef sg(p):\n    if p == 0:\n        return -1\n    else:\n        return 1\n\n\ndef minim(w,h):\n    if w < h:\n        return (w,0)\n    else:\n        return (h,1)\n\n\ndef find_path(x, y, down, right):\n    global size_n\n    global size_m\n    if down == 1:\n        h = size_n - x\n    else:\n        h = x - 1\n    if right == 1:\n        w = size_m - y\n    else:\n        w = y - 1\n    minimum = minim(w,h)\n    p = minimum[0]\n    ansX = x + p * sg(down)\n    ansY = y + p * sg(right)\n    if ansX == 1:\n        down = 1\n    if ansY == 1:\n        right = 1\n    if ansX == size_n:\n        down = 0\n    if ansY == size_m:\n        right = 0\n    return (ansX, ansY, down, right)\n\n\ndef total_black_bound_cells(n, m):\n    return n + m - 2\n\n\ndef moves_count(x, y, xn, yn):\n    return abs(x - xn)\n\n\ndef get_direction(direction):\n    if direction == 'UL':\n        return 0, 0\n    elif direction == 'UR':\n        return 0, 1\n    elif direction == 'DL':\n        return 1, 0\n    elif direction == 'DR':\n        return 1, 1\n\n\ndef turn_inside(n, m, xs, ys, down, right):\n    if xs == 1:\n        down = 1\n    if ys == 1:\n        right = 1\n    if xs == n:\n        down = 0\n    if ys == m:\n        right = 0\n    return (down, right)\n\nsize_n = 0\nsize_m = 0\n\nif __name__ == '__main__':\n\n    n, m = [int(x) for x in raw_input().strip().split(' ')]\n    xs, ys, direction = raw_input().strip().split(' ')\n    xs = int(xs)\n    ys = int(ys)\n\n    size_n = n\n    size_m = m\n    down, right = get_direction(direction)\n    down, right = turn_inside(n, m, xs, ys, down, right)\n\n    # print n, m, xs, ys, down, right\n\n    # make visited_points with bound cells\n    visited_points = {}\n    total_to_check = total_black_bound_cells(n, m) # calculate\n    # print 'total_to_check', total_to_check\n    visited_points[(xs, ys)] = 1\n    total_to_check -= 1\n    x = xs\n    y = ys\n    dye = 1\n    while (total_to_check > 0):\n        xn, yn, down, right = find_path(x, y, down, right)\n        dye += moves_count(x, y, xn, yn)\n        # print 'moves_count', moves_count(x, y, xn, yn)\n        x = xn\n        y = yn\n        if (x, y) not in visited_points:\n            visited_points[(x, y)] = 1\n            total_to_check -= 1\n        elif visited_points[(x,y)] == 1:\n            visited_points[(x,y)] += 1\n        else:\n            print -1\n            exit()\n    print dye", "lang_cluster": "Python", "tags": ["brute force", "implementation", "number theory"], "code_uid": "04fd9e30bb3acdd883ccc469a6d39ed4", "src_uid": "8a59247013a9b1f34700f4bfc7d1831d", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from bisect import bisect_right as br\n\nd_a = []\nd_b = []\n\ndef solve(a, b):\n    global d_a, d_b\n    \n    n = a + b\n    ans = (1 + n) << 1\n\n    for i in xrange(1, int(n ** 0.5) + 1):\n        if n % i == 0:\n            idx_a = br(d_a, i)\n            idx_b = br(d_b, i)\n            x_a = d_a[idx_a - 1]\n            x_b = d_b[idx_b - 1]\n            if ((a // x_a <= n // i) or (b // x_b <= n // i)): ans = min(ans, (i + n // i) << 1)\n\n    return ans\n\na, b = map(int, raw_input().strip().split())\n\nfor i in xrange(1, int(a ** 0.5) + 1):\n    if a % i == 0: d_a.append(i)\nfor i in xrange(1, int(b ** 0.5) + 1):\n    if b % i == 0: d_b.append(i)\n\nprint solve(a, b)", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search", "number theory"], "code_uid": "a64a1ed8be644fda000f0968df72c335", "src_uid": "7d0c5f77bca792b6ab4fd4088fe18ff1", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "a,b = map(int,raw_input().split())\nd1,d2 = 1,1\nn = a+b\nans = pow(10,16)\nfor i in range(1,int(pow(n,0.5))+1):\n    if a%i==0:\n        d1 = i\n    if b%i==0:\n        d2 = i\n    if n%i==0:\n        if a/d1<=n/i or b/d2<=n/i:\n            ans = min(ans,2*(i+(n/i)))\nprint ans", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search", "number theory"], "code_uid": "915ac736d0b69b5b0ab4970ea177be30", "src_uid": "7d0c5f77bca792b6ab4fd4088fe18ff1", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def LessInTable(n, m, x, k):\n    t = x-1\n    summ = int(t/m)*m\n    summ1 = int(t/m)*(m-n)\n    #print (t/m+1, n+1)\n    #return sum([t/i for i in xrange(t/m+1,n+1)]) + summ\n    v = min(int(t**0.5), n)\n        #for i in xrange(t/m+1,t/n+1):\n        #summ1 += t/i - n\n    tn = (t-1)/n;\n    tm = t/m;\n    vv = [t/i for i in xrange(tm+1,v+1)]\n    add = - v**2 + max(min((tn - tm),len(vv))*n,0);\n    summ = summ + sum(vv)\n    summ1 = summ1 + sum(vv[0:max(min(tn-tm, len(vv)),0)])\n        #for i in xrange(t/m+1,v+1):\n        #minimum = t/i\n    #if i < tn:\n    #summ1 += minimum\n        #summ += minimum\n        #if minimum == 0 or 2 * summ + add - summ1 > k:\n            #return k+1\n            #print (summ, add, summ1, x, summ * 2 + add - summ1)\n    return summ * 2 + add - summ1\n \n[n, m, k] = raw_input(\"\").split(\" \")\n[n, m, k] = [int(n), int(m), int(k)]\n[n,m] = [min(n,m), max(n,m)]\na = 1\nb = k+1\nwhile (b-a>1):\n    cur = (a+b)/2\n    summ = LessInTable(n,m,cur,k)\n    #print (summ, cur)\n    if summ < k:\n        a = cur\n    else:\n        b = cur\n#if LessInTable(n,m,b,k) < k:\n#    print b\n#else:\nprint a\n", "lang_cluster": "Python", "tags": ["brute force", "binary search"], "code_uid": "6096fe0e2b21b779dbafcd5bfea2aad3", "src_uid": "13a918eca30799b240ceb9de47507a26", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    from math import sqrt\n    m, n, k = map(int, input().split())\n    if n < m:\n        n, m = m, n\n    lo, hi = 1, k + 1\n    while lo + 1 < hi:\n        mid = (lo + hi) // 2\n        t = mid - 1\n        v = min(int(sqrt(t)), m)\n        tn, tm = (t - 1) // m, t // n\n        vv = [t // i for i in range(tm + 1, v + 1)]\n        if t // n * (n + m) + sum(vv) * 2 + max(min((tn - tm), len(vv)) * m, 0) - v * v - sum(\n                vv[:max(min(tn - tm, len(vv)), 0)]) < k:\n            lo = mid\n        else:\n            hi = mid\n    print(lo)\n\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["brute force", "binary search"], "code_uid": "b55dc5b34d55f7d7ca7226f31d700712", "src_uid": "13a918eca30799b240ceb9de47507a26", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nimport math\n\nMOD = 998244853\n\ndef prepare_c(n):\n    result = [1]\n    last = [1, 1]\n    for i in range(2, n + 1):\n        new = [1]\n        for j in range(1, i):\n            new.append((last[j - 1] + last[j]) % MOD)\n        new.append(1)\n        last = new\n    return new\n\ndef main():\n    (a, b) = tuple([int(x) for x in input().split()])\n    if a + b == 0:\n        print(0)\n        return\n\n    c = prepare_c(a + b)\n\n    min_lv = max(0, a - b)\n    max_lv = a\n\n    res = 0\n    res += (min_lv * c[a]) % MOD\n    for lv in range(min_lv + 1, max_lv + 1):\n        t = 2 * lv - a + b\n        res += c[(a + b + t) // 2]\n        res = res % MOD\n\n    print(res)\n\n    \n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "number theory"], "code_uid": "5b6bbc377691470ba2ceea0263961bc8", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\n\n\"\"\"def modinv(x, y):\n    z = y - 2\n    ans = 1\n    while z > 0:\n        if z % 2 == 0:\n            z = z // 2\n            x = (x * x) % y\n        else:\n            ans = (ans * x) % y\n            z = z - 1\n    return ans\"\"\"\n\nn, m = list(map(int, sys.stdin.readline().strip().split()))\np = 998244853\n\nG = [[0 for i in range (0, m+1)] for j in range (0, n+1)]\nH = [[0 for i in range (0, m+1)] for j in range (0, n+1)]\nB = [[0 for i in range (0, m+1)] for j in range (0, n+1)]\n\"\"\"I = [0] * 2001\nfor i in range (1, 2001):\n    I[i] = modinv(i, p)\"\"\"\nfor i in range (0, n+1):\n    for j in range (0, m+1):\n        if i == 0 or j == 0:\n            B[i][j] = 1\n        else:\n            B[i][j] = (B[i-1][j] + B[i][j-1]) % p\nfor i in range (0, n+1):\n    for j in range (0, m+1):\n        if i == 0:\n            H[i][j] = 1\n        elif j >= i:\n            H[i][j] = (H[i-1][j]+H[i][j-1]) % p\nfor i in range (0, n+1):\n    for j in range (0, m+1):\n        if j == 0:\n            G[i][0] = i\n        elif i == 0:\n            G[0][j] = 0\n        else:\n            G[i][j] = (G[i-1][j] + G[i][j-1] + H[i][j-1] + B[i-1][j] - B[i][j-1]) % p\n\nprint(G[n][m])\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "number theory"], "code_uid": "c9af07cca9ea31433efbe3150dcb7db6", "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "I=raw_input().split()\nn=int(I[0])\nt=int(I[2])\nn=min(n,t)\np=float(I[1])\ne=[0]*(n+1)\nfor i in range(t):\n  f=[0]*(n+1)\n  for j in range(1,n+1):\n    f[j]=(e[j-1]+1)*p+e[j]*(1-p)\n  e=f[:]\nprint e[-1]\n", "lang_cluster": "Python", "tags": ["probabilities", "math", "dp", "combinatorics"], "code_uid": "3560d823894f6e168ba81f7df701339e", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "R = raw_input().split()\nn = int(R[0])\np = float(R[1])\nt = int(R[2])\nf, g = [0.0] * 3000, [0.0] * 3000\nf[0] = 1.0\nfor i in range (1, t+1, 1):\n    for j in range (i):\n        g[j] += f[j] * (1-p) if j < n else f[j]\n        g[j+1] += f[j] * p if j < n else 0.0\n    for j in range (i+1):\n        f[j] = g[j]\n        g[j] = 0.0\n        \nans = 0.0\nfor i in range (1, t+1, 1):\n    ans += i * f[i]    \nprint ans\n\n\n", "lang_cluster": "Python", "tags": ["probabilities", "math", "dp", "combinatorics"], "code_uid": "03a57c048f75a0beaca4179333e82c32", "src_uid": "20873b1e802c7aa0e409d9f430516c1e", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "import sys\r\nfrom functools import reduce\r\nraw_input = sys.stdin.readlines\r\n\r\ndef gcd(a, b):\r\n    while b:\r\n        a, b = b, a % b\r\n    return a\r\n\r\ndef lcm(x, y):\r\n    return x//gcd(x, y)*y\r\n\r\ndef inv(n):\r\n    return pow(n, MOD-2, MOD)\r\n\r\ndef solution():\r\n    n, a0, x, y, k, M = list(map(int, input().strip().split()))\r\n    a = [a0]*n\r\n    for i in range(1, n):\r\n        a[i] = (a[i-1]*x+y)%M\r\n    inv_n = inv(n)\r\n    base = reduce(lambda x, y: lcm(x, y), range(1, max(k, 2)))\r\n    pr = [0]*base\r\n    for x in a:\r\n        pr[x%base] = (pr[x%base]+inv_n)%MOD\r\n    result = ((reduce(lambda total, x: (total+(x-x%base))%MOD, a, 0)*inv_n)*k)%MOD \r\n    for i in range(1, k+1):\r\n        result = (result+reduce(lambda total, x: (total+x*pr[x])%MOD, range(base), 0))%MOD\r\n        for x in range(base):\r\n            change = pr[x]*inv_n%MOD\r\n            pr[x] = (pr[x]-change)%MOD\r\n            pr[x-x%i] = (pr[x-x%i]+change)%MOD\r\n    result = (result*pow(n, k, MOD))%MOD\r\n    return result\r\n    \r\nMOD = 998244353\r\nprint('%s' % solution())\r\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "probabilities", "number theory"], "code_uid": "eb9b34912b98888df39113932299b13f", "src_uid": "1d45491e28d24e2b318605cd328d6ecf", "difficulty": 2800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "import sys\r\nfrom functools import reduce\r\nraw_input = sys.stdin.readlines\r\n\r\ndef gcd(a, b):\r\n    while b:\r\n        a, b = b, a % b\r\n    return a\r\n\r\ndef lcm(x, y):\r\n    return x//gcd(x, y)*y\r\n\r\ndef inv(n):\r\n    return pow(n, MOD-2, MOD)\r\n\r\ndef solution():\r\n    n, a, x, y, k, M = list(map(int, input().strip().split()))\r\n    inv_n = inv(n)\r\n    base = reduce(lambda x, y: lcm(x, y), range(1, max(k, 2)))\r\n    pr = [0]*base\r\n    result = 0\r\n    for i in range(n):\r\n        pr[a%base] = (pr[a%base]+inv_n)%MOD\r\n        result = (result + (a-a%base)*inv_n*k)%MOD\r\n        a = (a*x+y)%M\r\n    for i in range(1, k+1):\r\n        result = (result+reduce(lambda total, x: (total+x*pr[x])%MOD, range(base), 0))%MOD\r\n        for x in range(base):\r\n            change = pr[x]*inv_n%MOD\r\n            pr[x] = (pr[x]-change)%MOD\r\n            pr[x-x%i] = (pr[x-x%i]+change)%MOD\r\n    result = (result*pow(n, k, MOD))%MOD\r\n    return result\r\n\r\nMOD = 998244353\r\nprint('%s' % solution())\r\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "probabilities", "number theory"], "code_uid": "3bced9bbcac978d9180fc1fb5b24c13d", "src_uid": "1d45491e28d24e2b318605cd328d6ecf", "difficulty": 2800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\r\ninput = sys.stdin.readline\r\n\r\n\r\n\r\ndef make_tree(n):\r\n    i = 2\r\n    while True:\r\n        if i >= n * 2:\r\n            tree = [0] * i\r\n            break\r\n        else:\r\n            i *= 2\r\n    return tree\r\n\r\ndef update(i, x):\r\n    i += len(tree) // 2\r\n    tree[i] = x\r\n    i //= 2\r\n    while True:\r\n        if i == 0:\r\n            break\r\n        tree[i] = tree[2 * i] + tree[2 * i + 1]\r\n        i //= 2\r\n    return\r\n\r\ndef get_sum(s, t):\r\n    s += len(tree) // 2\r\n    t += len(tree) // 2\r\n    ans = 0\r\n    while True:\r\n        if s > t:\r\n            break\r\n        if s % 2 == 0:\r\n            s //= 2\r\n        else:\r\n            ans += tree[s]\r\n            s = (s + 1) // 2\r\n        if t % 2 == 1:\r\n            t //= 2\r\n        else:\r\n            ans += tree[t]\r\n            t = (t - 1) // 2\r\n    return ans\r\n\r\ndef prime_factorize(n):\r\n    ans = []\r\n    for i in range(2, int(n ** (1 / 2)) + 1):\r\n        while True:\r\n            if n % i:\r\n                break\r\n            ans.append(i)\r\n            n //= i\r\n        if n == 1:\r\n            break\r\n    if not n == 1:\r\n        ans.append(n)\r\n    return ans\r\n\r\ndef euler_func(n):\r\n    p = set(prime_factorize(n))\r\n    x = n\r\n    for i in p:\r\n        x *= (i - 1)\r\n        x //= i\r\n    return x\r\n\r\ndef f(a, b):\r\n    ans = 1\r\n    for i in range(a + 1, b + 1):\r\n        ans *= i\r\n        ans %= mod\r\n    return ans\r\n\r\nn, mod = map(int, input().split())\r\nx = euler_func(mod)\r\nl = n + 5\r\nfact = [1] * (l + 1)\r\nfor i in range(1, l + 1):\r\n    fact[i] = i * fact[i - 1] % mod\r\nif n <= 3:\r\n    ans = 0\r\nelse:\r\n    dp = [0] * 2000\r\n    dp[0], dp[1], dp[2], dp[3] = 1, 2, 2, 1\r\n    tree = make_tree(2005)\r\n    for i in range(4):\r\n        update(i, dp[i])\r\n    m = 3\r\n    ans = 0\r\n    for i in range(n - 3):\r\n        dp0 = list(dp)\r\n        ans0 = 0\r\n        for j in range(i + 3):\r\n            for k in range(1, m + 2):\r\n                ans0 += get_sum(j + k + 1, 2004) * dp0[k - 1] % mod\r\n                ans0 %= mod\r\n                dp[j + k] += dp0[k - 1]\r\n                dp[j + k] %= mod\r\n                update(j + k, dp[j + k])\r\n        m += i + 3\r\n        ans += f(i + 4, n) * ans0 % mod\r\n        ans %= mod\r\nprint(ans)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "fft"], "code_uid": "74205e58fe8da1a0a5bbc92fa0a39d3d", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\r\n\r\n\r\ndef I(): return int(sys.stdin.readline().rstrip())\r\ndef MI(): return map(int,sys.stdin.readline().rstrip().split())\r\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\r\ndef LI2(): return list(map(int,sys.stdin.readline().rstrip()))\r\ndef S(): return sys.stdin.readline().rstrip()\r\ndef LS(): return list(sys.stdin.readline().rstrip().split())\r\ndef LS2(): return list(sys.stdin.readline().rstrip())\r\n\r\n\r\nn,mod = MI()\r\n\r\nm = n*(n-1)//2\r\ndp = [[[0]*(n+1) for _ in range(m+1)] for _ in range(n+1)]\r\ndp[1][0][1] = 1\r\nfor i in range(1,n):\r\n    for j in range(m+1):\r\n        for k in range(n+1):\r\n            a = dp[i][j][k]\r\n            if not a:\r\n                continue\r\n            dp[i+1][j+i][i+1] += a\r\n            dp[i+1][j+i][i+1] %= mod\r\n            for l in range(i):\r\n                dp[i+1][j+i-1-l][k] += a\r\n                dp[i+1][j+i-1-l][k] %= mod\r\n\r\nS_dp = [[[0]*(m+1) for k in range(n+1)] for i in range(n+1)]\r\nfor i in range(n+1):\r\n    for k in range(n+1):\r\n        a = 0\r\n        for j in range(m+1):\r\n            a += dp[i][j][k]\r\n            a %= mod\r\n            S_dp[i][k][j] = a\r\n\r\nSS_dp = [[[0]*(n+1) for j in range(m+1)] for i in range(n+1)]\r\nfor i in range(n+1):\r\n    for j in range(m+1):\r\n        a = 0\r\n        for k in range(n+1):\r\n            a += S_dp[i][k][j]\r\n            a %= mod\r\n            SS_dp[i][j][k] = a\r\n\r\nANS = [0]*(n+1)\r\nfor i in range(1,n+1):\r\n    ans = i*ANS[i-1] % mod\r\n    for k in range(n+1):\r\n        for j in range(1,m+1):\r\n            if not dp[i][j][k]:\r\n                continue\r\n            ans += dp[i][j][k]*(SS_dp[i][j-1][-1]-SS_dp[i][j-1][k])\r\n            ans %= mod\r\n    ANS[i] = ans\r\n\r\nprint(ANS[-1])\r\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "fft"], "code_uid": "f7e181f1ff5c9eea469b4b1c14f7ac93", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "ans = [0, 0, 0, 17, 904, 45926, 2725016, 196884712, 17350671831, 1847029162807, 234604337741356, 35124684548865014, 6129493313430487347, 1234186412048962136867, 284156251297196944178741, 74208105148236788130299594, 21823786691837607831313601986, 7180945944051622599172231830559, 2628285901075185751247147637963764, 1064415707874472730189758411138223012, 474696895806995544267461713744662801273, 232108217984711353836425931071972412434769, 123936006863448574473258304512213419181477629, 72001789304522519814979190673249736828751045235, 45358592334048869014784060167784403809256007914235, 30887995025064172324860909675782126644417319179310615, 22671317172342076228901876047716646679463297463815531801, 17887633233083659990365270664853640466516913015201240826126, 15133189285152994504417046125519832304356101926021313116843762, 13696011810217327270425536719446568268842934651479606572883858337, 13231035595581955847324167931341156335399125974370054118689947813084, 13615666310298041486269897794287119368857813300964239645264514067575348, 14896785210957814451596225403339669880428493377983351109682774857130876285, 17296861015416313210514430705673313923885806093094647292005926566584957805198, 21277502556141801404923334183636730527967396914368727781685903749899932330439700, 27685442274740623284676399817627890594738954000507636517974850197719506222649693428, 38044909627497915205521900076885800781631577315658299998700753792559115215021288216703, 55135044440614471748547018835733033289893221277565376842068094894817629630780514077260689, 84149025056135354013348194401668453655690102260167294072084431150851027995976944255289091346, 135081111612328943593200900935143991096009990707465165724029859695947616002254097943303981498801, 227785476585209725859871533893689007879205923941706485287975583179218438716851506693091120744486006, 403023819089860736211478036403093980497486894327221929391842399227648366074419176335283021295022904502, 747343079497161047388173805852613651431266345566371549442023125605025075243113841698109975642529981567384, 1450866910935549565767138335788285504076148461277868126061414043944259341635343490130257174674591782656345812, 2945831053741543272287328411984653945087825092542080881941317878854605241261796295722740281626772197386948225979, 6249347760681613137285160515399653601084654487432693460662422617789610546199670725858962657426005336538171753610001, 13838857890981961279032709572250660993206094648958538947542340718255812199438540434627347473280705475586821030540206131, 31960508311204158163949951878886543655090664624707453666870321664195346211444268628542706047129051005098408776280366835714, 76913074069375921827008175125148943074043689066900546444279406018342383030702874155081339114299164482537639987008013731429538, 192708102474154005292181573467529428485543713114227589304390807481151299272100345989709484858609927247818098325797076002014460084]\r\nN, M = map(int, input().split())\r\nprint(ans[N - 1] % M)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "fft"], "code_uid": "4e4cc7e428184260d96eaadd12bfd3d5", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def solve():\r\n    n, mod = map(int, input().split());m = n*(n-1)//2;dp = [[0]*(n*(n-1)+1) for i in range(n+1)];dp1 = [[0]*(n*(n-1)+1) for i in range(n+1)];dp[1][m] = 1\r\n    for i in range(2, n+1):\r\n        for x in range(m-(i-1)*(i-2)//2, m+(i-1)*(i-2)//2+1):\r\n            for d in range(-i+1, i):dp[i][x+d] = (dp[i][x+d]+dp[i-1][x]*(i-abs(d))) % mod\r\n    for i in range(2, n+1):\r\n        for x in range(m-(i-1)*(i-2)//2, m+(i-1)*(i-2)//2+1):dp1[i][x] = dp1[i-1][x] * i % mod\r\n        for x in range(m-(i-1)*(i-2)//2, m+(i-1)*(i-2)//2+1):\r\n            for d in range(1, i):dp1[i][x-d] = (dp1[i][x-d]+dp[i-1][x]*(i-d)) % mod\r\n    return sum(dp1[-1][m+1:]) % mod\r\nimport sys;input = lambda: sys.stdin.readline().rstrip();print(solve())", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "fft"], "code_uid": "2a8712676417a86473eb6d84c4117c4b", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\r\nfrom math import factorial\r\n\r\ninput = sys.stdin.readline\r\n\r\ndef A(n, k):\r\n\treturn factorial(n)//factorial(n-k)\r\n\r\ndef solve():\r\n\tn, mod = map(int, input().split())\r\n\tif n == 1:\r\n\t\tprint(0)\r\n\t\treturn\r\n\tz = [1]\r\n\taaa = 0\r\n\tfor i in range(2,n+1):\r\n\t\tnz = [0]*(i*i//2)\r\n\t\tfor j in range(len(z)):\r\n\t\t\tfor k in range(i):\r\n\t\t\t\tif z[j] > 0:\r\n\t\t\t\t\t#print(i-k+j, j, i-k-1)\r\n\t\t\t\t\tnz[i-k-1+j] += z[j]\r\n\t\tbbb = 0\r\n\t\td = [0]*(len(z)+1)\r\n\t\tfor w in range(len(z)-1, -1, -1):\r\n\t\t\td[w] = (d[w+1] + z[w]) % mod\r\n\t\te = [0]*(len(d)+1)\r\n\t\tf = [0]*(len(d)+1)\r\n\t\tfor w in range(0, len(e)-1):\r\n\t\t\te[w+1] = (e[w] + d[w]) % mod\r\n\t\t\tf[w+1] = (f[w] - w * d[w]) % mod\r\n\t\tfor jj in range(len(z)):\r\n\t\t\tccc = 0\r\n\t\t\t#for w in range(min(len(z)-1, i+jj), jj + 1, -1):\r\n\t\t\t#\tccc = (ccc + d[w] * (i+1+jj)) % mod\r\n\t\t\tL = jj + 2\r\n\t\t\tR = min(len(z)-1, i+jj)\r\n\t\t\t#for w in range(min(len(z)-1, i+jj), jj + 1, -1):\r\n\t\t\t#\tccc = (ccc - w * d[w]) % mod\r\n\t\t\tif R >= L:\r\n\t\t\t\tccc = (ccc + (e[R+1] - e[L]) * (i+1+jj) \\\r\n\t\t\t\t\t+ (f[R+1] - f[L])) % mod\r\n\t\t\tbbb = (bbb + ccc * z[jj]) % mod\r\n\t\t#print(bbb)\r\n\t\taaa += (bbb * A(n,n-i)) % mod\r\n\t\t#print(nz)\r\n\t\tz = nz\r\n\t#print(z)\r\n\tprint(aaa % mod)\r\n\r\nsolve()\r\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "fft"], "code_uid": "eaae55179f1a5a7b4edfdecba7c8b9c6", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nsys.stderr = sys.stdout\n\n\ndef egcd(a, b):\n    r0 = a\n    r1 = b\n    s0 = 1\n    s1 = 0\n    t0 = 0\n    t1 = 1\n    while r1:\n        q = r0 // r1\n        r0, r1 = r1, r0 - q*r1\n        s0, s1 = s1, s0 - q*s1\n        t0, t1 = t1, t0 - q*t1\n    return r0, s0\n\n\n# def comb(n0, M):\n#     C = [[None] * (i+1) for i in range(n0+1)]\n#     C[0][0] = 1\n#     C[1][0] = C[1][1] = 1\n#     for n in range(2, n0+1):\n#         Cp = C[n-1]\n#         Cn = C[n]\n#         Cn[0] = Cn[n] = 1\n#         for i in range(1, n):\n#             Cn[i] = (Cp[i] + Cp[i-1]) % M\n#     return C\n\ndef tf(n, M):\n    C = [0] * (n+1)\n    C[n] = 1\n    for k in reversed(range(n)):\n        C[k] = (C[k+1] * (k+1)) % M\n        if not C[k]:\n            break\n    return C\n\ndef app(n, M):\n    K = [[[1]]]\n    for i in range(n-1):\n        Ki = K[i]\n        ni = len(Ki)\n        Ki_ = [[0] * (i+2) for _ in range(ni + i + 1)]\n        K.append(Ki_)\n        for j, Kij in enumerate(Ki):\n            for k, v in enumerate(Kij):\n                for h in range(i+1):\n                    Ki_[j+h][k] += v\n                    Ki_[j+h][k] %= M\n                Ki_[j + i + 1][i+1] += v\n                Ki_[j + i + 1][i+1] %= M\n\n    # C = comb(n, M)[n]\n    C = tf(n, M)\n    s = 0\n    for i in range(1, n):\n        Ki = K[i]\n        ni = len(Ki)\n        mi = len(Ki[0])\n        Si = [[None] * mi for _ in range(ni)]\n        for j in range(ni):\n            Si[j][mi-1] = Ki[j][mi-1]\n            for k in reversed(range(mi-1)):\n                Si[j][k] = (Ki[j][k] + Si[j][k+1]) % M\n        for j in range(1, ni):\n            for k in range(mi):\n                Si[j][k] += Si[j-1][k]\n                Si[j][k] %= M\n        # log(\"i\", i, \"Ki\", Ki, \"Si\", Si)\n\n        si = 0\n        for j in range(1, ni):\n            for k in range(mi-1):\n                si += (Ki[j][k] * Si[j-1][k+1]) % M\n                si %= M\n        # log(\"  si\", si)\n\n        c = C[i+1]\n        # log(\"  n\", n, \"k\", i+1, \"c\", c)\n        si *= c\n        si %= M\n        s += si\n        s %= M\n\n    return s\n\n\ndef main():\n    n, m = readinti()\n    print(app(n, m))\n\n##########\n\ndef readint():\n    return int(input())\n\n\ndef readinti():\n   return map(int, input().split())\n\n\ndef readintt():\n   return tuple(readinti())\n\n\ndef readintl():\n   return list(readinti())\n\n\ndef readinttl(k):\n    return [readintt() for _ in range(k)]\n\n\ndef readintll(k):\n    return [readintl() for _ in range(k)]\n\n\ndef log(*args, **kwargs):\n    print(*args, **kwargs, file=sys.__stderr__)\n\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "fft"], "code_uid": "71ac078164a32b568a59c4a80dad1996", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\r\nfrom math import factorial\r\n\r\ninput = sys.stdin.readline\r\n\r\ndef A(n, k):\r\n\treturn factorial(n)//factorial(n-k)\r\n\r\ndef solve():\r\n\tn, mod = map(int, input().split())\r\n\tif n == 1:\r\n\t\tprint(0)\r\n\t\treturn\r\n\tz = [1]\r\n\taaa = 0\r\n\tfor i in range(2,n+1):\r\n\t\tnz = [0]*((i-1)*i//2+1)\r\n\t\td = [0]*(len(z)+1)\r\n\t\tfor w in range(len(z)-1, -1, -1):\r\n\t\t\td[w] = (d[w+1] + z[w]) % mod\r\n\t\tfor w in range(len(nz)):\r\n\t\t\t#d = 0\r\n\t\t\t#for j in range(max(0,w+1-i), min(len(z),w+1)):\r\n\t\t\t#\td = (d + z[j]) % mod\r\n\t\t\t#nz[w] = d\r\n\t\t\tL = max(0,w+1-i)\r\n\t\t\tR = min(len(z)-1,w)\r\n\t\t\tnz[w] = d[L]-d[R+1]\r\n\t\te = [0]*(len(d)+1)\r\n\t\tf = [0]*(len(d)+1)\r\n\t\tfor w in range(0, len(e)-1):\r\n\t\t\te[w+1] = (e[w] + d[w]) % mod\r\n\t\t\tf[w+1] = (f[w] - w * d[w]) % mod\r\n\t\tR = len(z)\r\n\t\tbbb = 0\r\n\t\tfor jj in range(max(0,len(z)-i), len(z)-2):\r\n\t\t\tL = jj + 2\r\n\t\t\tbbb = (bbb + ((e[R] - e[L]) * (i+1+jj) \\\r\n\t\t\t\t+ (f[R] - f[L])) * z[jj]) % mod\r\n\t\tfor jj in range(len(z)-i):\r\n\t\t\tL = jj + 2\r\n\t\t\tR = i + jj\r\n\t\t\tbbb = (bbb + ((e[R+1] - e[L]) * (i+1+jj) \\\r\n\t\t\t\t+ (f[R+1] - f[L])) * z[jj]) % mod\r\n\t\t#print(bbb)\r\n\t\taaa += (bbb * A(n,n-i)) % mod\r\n\t\t#print(nz)\r\n\t\tz = nz\r\n\t#print(z)\r\n\tprint(aaa % mod)\r\n\r\nsolve()\r\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "fft"], "code_uid": "27b679b65629585e93409b3811fb444a", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def solve():\r\n    n, mod = map(int, input().split())\r\n    m = n*(n-1)//2\r\n    dp = [[0]*(n*(n-1)+1) for i in range(n+1)]\r\n    dp1 = [[0]*(n*(n-1)+1) for i in range(n+1)]\r\n    dp[1][m] = 1\r\n    for i in range(2, n+1):\r\n        for x in range(m-(i-1)*(i-2)//2, m+(i-1)*(i-2)//2+1):\r\n            for d in range(-i+1, i):\r\n                dp[i][x+d] = (dp[i][x+d]+dp[i-1][x]*(i-abs(d))) % mod\r\n    for i in range(2, n+1):\r\n        for x in range(m-(i-1)*(i-2)//2, m+(i-1)*(i-2)//2+1):\r\n            dp1[i][x] = dp1[i-1][x] * i % mod\r\n        for x in range(m-(i-1)*(i-2)//2, m+(i-1)*(i-2)//2+1):\r\n            for d in range(1, i):\r\n                dp1[i][x-d] = (dp1[i][x-d]+dp[i-1][x]*(i-d)) % mod\r\n\r\n    return sum(dp1[-1][m+1:]) % mod\r\n\r\nimport sys\r\ninput = lambda: sys.stdin.readline().rstrip()\r\nprint(solve())\r\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "fft"], "code_uid": "668ddea1917d65c7ec2f124338e140c4", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def solve(n, mod):\r\n    if n<=3:\r\n        return 0\r\n    else:\r\n        last_ans = 17\r\n        ans = 17\r\n        size = (n-1)*(n-2)//2 + 1\r\n        inv = 1\r\n        record = [[0 for i in range(size+1)] for i in range(2)]\r\n        record[0][0:4]=[1,2,2,1]\r\n        for m in range(4,n):\r\n            tp_size = m*(m-1)//2\r\n            ans = (m+1) * last_ans\r\n            tp = 0\r\n            for i in range(m):\r\n                tp += record[inv^1][i] \r\n                record[inv][i] = tp%mod\r\n            for i in range(m,tp_size//2+1):\r\n                tp += record[inv^1][i] \r\n                tp -= record[inv^1][i-m] \r\n                record[inv][i] = tp%mod\r\n            for i in range(tp_size//2+1):\r\n                record[inv][tp_size-i] = record[inv][i] \r\n            # print(\"ans:\",ans)\r\n            total = 0\r\n            for i in range(tp_size-1):\r\n                tp = 0\r\n                for j in range(max(1,-tp_size+i+m+2),m+1):\r\n                    # print(\"(\",j,m+2-j+i,\")\",end=\" \")\r\n                    tp += j * int(record[inv][m+2-j+i])\r\n                # print()\r\n                total += int(record[inv][i])\r\n                total %= mod\r\n                tp *= total\r\n                tp %= mod\r\n                ans += tp\r\n                ans %= mod\r\n            last_ans = ans\r\n            # print(record)\r\n            inv ^= 1\r\n        return int(ans)%mod\r\n        \r\n \r\n \r\ndef main():\r\n    n, mod = map(int, input().split())\r\n    print(solve(n, mod))\r\n \r\n \r\nif __name__ == \"__main__\":\r\n    main()", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "fft"], "code_uid": "06b4dc4e6150add0e3331763d74fcdea", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def solve(n, mod):\r\n    if n<=3:\r\n        return 0\r\n    else:\r\n        last_ans = 17\r\n        ans = 17\r\n        size = (n-1)*(n-2)//2 + 1\r\n        inv = 1\r\n        record = [[0 for i in range(size+1)] for i in range(2)]\r\n        record[0][0:4]=[1,2,2,1]\r\n        for m in range(4,n):\r\n            tp_size = m*(m-1)//2\r\n            ans = (m+1) * last_ans\r\n            tp = 0\r\n            for i in range(m):\r\n                tp += record[inv^1][i] \r\n                record[inv][i] = tp%mod\r\n            for i in range(m,tp_size//2+1):\r\n                tp += record[inv^1][i] \r\n                tp -= record[inv^1][i-m] \r\n                record[inv][i] = tp%mod\r\n            for i in range(tp_size//2+1):\r\n                record[inv][tp_size-i] = record[inv][i] \r\n            # print(\"ans:\",ans)\r\n            total = 0\r\n            for i in range(tp_size-1):\r\n                tp = 0\r\n                for j in range(max(1,-tp_size+i+m+2),m+1):\r\n                    # print(\"(\",j,m+2-j+i,\")\",end=\" \")\r\n                    tp += j * int(record[inv][m+2-j+i])\r\n                # print()\r\n                total += int(record[inv][i])\r\n                total %= mod\r\n                tp *= total\r\n                tp %= mod\r\n                ans += tp\r\n                ans %= mod\r\n            last_ans = ans\r\n            # print(record)\r\n            inv ^= 1\r\n        return int(ans)%mod\r\n        \r\n\r\n\r\ndef main():\r\n    n, mod = map(int, input().split())\r\n    print(solve(n, mod))\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    main()\r\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "fft"], "code_uid": "1ae99487f9cdc9ab8d2ff498357cc6c0", "src_uid": "ae0320a57d73fab1d05f5d10fbdb9e1a", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def toSys(n, k):\n    res = ''\n    t = k\n    while (n != 0):\n        res += str(n % t)\n        n //= t\n        t *= k \n    return res[::-1]\n\n\nn = int(input())\nfor i in range(1, n):\n    for j in range(1, n):\n        print(toSys(i * j, n), end=\" \")\n    print()", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "968220aa994cb03cdcaa83b7610bbc7f", "src_uid": "a705144ace798d6b41068aa284d99050", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "k=int(input())\nfor i in range(1,k):\n    z,a=i,[]\n    for j in range(k-1):\n        p,s=z,\"\"\n        while p:\n            s=str(p%k)+s\n            p//=k\n        z+=i\n        a.append(s)\n    print(*a)\n\n    \n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "ac2f84308d46033d19414ee16873b462", "src_uid": "a705144ace798d6b41068aa284d99050", "difficulty": 1300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def f(a, b):\n    return min(abs(a - b) * 5, abs(a - b) + 10)\n\ndef main():\n    n, m, k = map(int, input().split())\n    a, b = map(int, input().split())\n    pa, pb = (a - 1) // (m * k), (b - 1) // (m * k)\n    ans = min((pa - pb + n) % n, (-pa + pb + n) % n) * 15\n    ea, eb = (a - 1) // k % m, (b - 1) // k % m\n    if ans == 0:\n        ans = f(ea, eb)\n    else:\n        ans += f(ea, 0) + f(eb, 0)\n    print(ans)\n    \n\n\nmain()", "lang_cluster": "Python", "tags": ["constructive algorithms"], "code_uid": "2fc092ab6772e4a2b8aba0eb5934979b", "src_uid": "c37b46851abcf7eb472869bd1ab9f793", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys,math\ndef numb(ch):\n    pod=ch//(m*k)\n    if ch%(m*k)!=0:\n        pod+=1\n    et=((ch-1)%(m*k)+1)//k\n    if ((ch-1)%(m*k)+1)%k!=0:\n        et+=1\n    return(pod,et)\n    \n    \nans=0\nn,m,k=map(int,input().split())\na,b=map(int,input().split())\nans=0\nf_x,f_y=numb(a)\na_x,a_y=numb(b)\nif f_x!=a_x:\n    z=min(math.fabs(f_x-a_x),math.fabs(n-max(f_x,a_x)+min(f_x,a_x)))\n    ans+=15*z\n    ans+=min(10+f_y-1,(f_y-1)*5)\n    ans+=min(10+a_y-1,(a_y-1)*5)\n    print(int(ans))\nelse:\n    ans+=min(10+math.fabs(a_y-f_y),math.fabs(a_y-f_y)*5)\n    print(int(ans))", "lang_cluster": "Python", "tags": ["constructive algorithms"], "code_uid": "a4fcd739a95a0a2d75114fb23e437a07", "src_uid": "c37b46851abcf7eb472869bd1ab9f793", "difficulty": 1400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = [0]*10\nb = [0]*10\ns = map(int, list(raw_input()))\nn = len(s)\nc1=['']*n\nc2=['']*n\nfor i in range(n):\n    a[s[i]] += 1\n    b[s[i]] += 1\n\nn-=1\n\nwhile (a[0]-a[9])>0:\n    c1[n]=c2[n] = str(0)\n    a[0]-=1\n    b[0]-=1\n    n-=1\n\nk = [i for i in range(1,6) if a[i]*b[10-i]>0]\n\nd = {}\nfor l in k:\n    o = 0\n    a[l]-=1\n    b[10-l]-=1\n    for i in range(10):\n        o += min(a[i], b[9-i])\n    d[o] = l\n    a[l]+=1\n    b[10-l]+=1\n\nif d.keys():\n    t = d[max(d.keys())]\n    a[t] -= 1\n    b[10-t] -= 1\n    c1[n]=str(t)\n    c2[n]=str(10-t)\n    n -= 1\n\nfor i in range(10):\n    if a[i]*b[9-i]>0:\n        m = 0\n        while (a[i]*b[9-i]>0):\n            a[i]-=1\n            b[9-i]-=1\n            m+=1\n        for j in range(m):\n            c1[n]=str(i)\n            c2[n]=str(9-i)\n            n-=1\n\nm = n\n\nfor i in range(10):\n    while a[i]>0:\n        c1[n] = str(i)\n        n-=1\n        a[i] -= 1\n    while b[i]>0:\n        c2[m] = str(i)\n        m-=1\n        b[i] -= 1\n\n\nc1 = ''.join(str(n) for n in c1)\nc2 = ''.join(str(n) for n in c2)\nprint c1\nprint c2", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "b5e8df7ac9b780b59316e6d5993d735a", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = [0]*10\nb = [0]*10\ns = map(int, list(raw_input()))\nn = len(s)\nc1=['']*n\nc2=['']*n\nfor i in range(n):\n    a[s[i]] += 1\n    b[s[i]] += 1\n\nn-=1\n\nwhile (a[0]-a[9])>0:\n    c1[n]=c2[n] = str(0)\n    a[0]-=1\n    b[0]-=1\n    n-=1\n\nk = [i for i in range(1,6) if a[i]*b[10-i]>0]\n\nd = {}\nfor l in k:\n    o = 0\n    a[l]-=1\n    b[10-l]-=1\n    for i in range(10):\n        o += min(a[i], b[9-i])\n    d[o] = l\n    a[l]+=1\n    b[10-l]+=1\n\nif d.keys():\n    t = d[max(d.keys())]\n    a[t] -= 1\n    b[10-t] -= 1\n    c1[n]=str(t)\n    c2[n]=str(10-t)\n    n -= 1\n\nfor i in range(10):\n    if a[i]*b[9-i]>0:\n        m = 0\n        while (a[i]*b[9-i]>0):\n            a[i]-=1\n            b[9-i]-=1\n            m+=1\n        for j in range(m):\n            c1[n]=str(i)\n            c2[n]=str(9-i)\n            n-=1\n\nm = n\n\nfor i in range(10):\n    while a[i]>0:\n        c1[n] = str(i)\n        n-=1\n        a[i] -= 1\n    while b[i]>0:\n        c2[m] = str(i)\n        m-=1\n        b[i] -= 1\n\n\nc1 = ''.join(str(n) for n in c1)\nc2 = ''.join(str(n) for n in c2)\nprint c1\nprint c2", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "ab152ac1189d9df6e0b213b0a1eedb00", "src_uid": "34b67958a37865e1ca0529bbf528dd9a", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "ll = [0]\nfor i in xrange(1,101):\n    d = i\n    while d >= i:\n        tmp = 0\n        while d > 0:\n            tmp += d%10\n            d /= 10\n        d = tmp\n        if d < 10: break\n    if d < 10:\n        ll.append(d)\n    else:\n        ll.append(ll[d])\n\n\nn = int(raw_input())\nnum = [0]\nfor i in xrange(1,10):\n    num.append(0)\n    if n%9 >= i:\n        tmp = 1\n    else:\n        tmp = 0\n    num[i] = n/9 + tmp\n    \nret = 0\nfor i in xrange(1,10):\n    for j in xrange(1,10):\n        for k in xrange(1,10):\n            if ll[i*j] == ll[k]:\n                ret += num[i]*num[j]*num[k]\n\nfor i in xrange(1,n+1):\n    ret -= n/i\nprint ret\n", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "3b950a08dff4f5e3edaf9d4c9324e12a", "src_uid": "fc133fe6353089a0ebee08dec919f608", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n , ans , a = int(input()) , 0 , [0] * 10\nfor i in range(1,n+1):\n    ans -= (int)(n/i)\n    a[i % 9] += 1\nfor i in range(9):\n    for j in range(9):\n        ans += a[i] * a[j] * a[(i * j) % 9]\nprint (ans)\n", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "0ae7bb23101b85871d39420b4b8f1025", "src_uid": "fc133fe6353089a0ebee08dec919f608", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys\n# a simple parser for python. use get_number() and get_word() to read\ndef parser():\n    while 1:\n        data = list(input().split(' '))\n        for number in data:\n            if len(number) > 0:\n                yield(number)   \n\ninput_parser = parser()\n\ndef get_word():\n    global input_parser\n    return next(input_parser)\n\ndef get_number():\n    data = get_word()\n    try:\n        return int(data)\n    except ValueError:\n        return float(data)\n\ndef done(x,y):\n    print(\"%d %d\"%(x,y))\n    sys.exit(0)\n\ndef die():\n    print(-1)\n    sys.exit(0)\n\ndef ext_gcd(a,b):\n    if b != 0:\n        tmp = ext_gcd(b,a%b)\n        return [tmp[1], tmp[0] - (a//b)*tmp[1]]\n    return [1,0]\n\ndef gcd(a,b):\n    if b == 0:\n        return a\n    return gcd(b,a%b)\n\nn = get_number()\nm = get_number()\nx = get_number()\ny = get_number()\nvx = get_number()\nvy = get_number()\n\nif vx == 0 :\n    if x != 0 and x != n :\n        die()\n    if x == 0:\n        if vy > 0:\n            done(0,m)\n        else:\n            done(0,0)\n    if x == n:\n        if vy > 0:\n            done(n,m)\n        else:\n            done(n,0)\n\nif vy == 0 :\n    if y != 0 and y != m:\n        die()\n    if y == 0:\n        if vx > 0:\n            done(n,0)\n        else:\n            done(0,0)\n    if y == m:\n        if vx > 0:\n            done(n,m)\n        else:\n            done(0,m)\n\ng = gcd(vy*n,vx*m)\n\nif (vy*x-vx*y)%g != 0:\n    die()\n\na = vy*n//g\nb = vx*m//g\nt = (vy*x-vx*y)//g\nres = ext_gcd(a,-b)\nif res[0]*a + res[1]*(-b) == -1:\n    res[0] = -res[0]\n    res[1] = -res[1]\n\nalpha = res[0]*t\nbeta = res[1]*t\nk = b//gcd(a,b)\nT = (n*alpha-x)//vx\n\nval = 0\nif vx*k > 0 :\n    val = 1\nelse :\n    val = -1\nhigh = 98765432198765432198765432199\nlow = 0\nans = 0\n\nwhile high >= low:\n    mid = (high+low)//2\n    nalpha = alpha + mid*val*k\n    nT = (n*nalpha-x)//vx\n    if nT > 0:\n        ans = mid\n        high = mid-1\n    else:\n        low = mid+1\n\nalpha = alpha + ans*val*k\nT = (n*alpha-x)//vx\n\nval = 0\nif vx*k > 0 :\n    val = -1\nelse :\n    val = 1\n    \nhigh = 98765432198765432198765432199\nlow = 0\nans = 0\nwhile high >= low:\n    mid = (high+low)//2\n    nalpha = alpha + mid*val*k\n    nT = (n*nalpha-x)//vx\n    if nT >= 0:\n        ans = mid\n        low = mid+1\n    else:\n        high = mid-1\n\nalpha = alpha + ans*val*k\nT = (n*alpha-x)//vx\n\n\nX = x + vx*T\nY = y + vy*T\nT = t + vy*T\nif (X//n)%2 == 0 and (Y//m)%2 == 0 :\n    done(0,0)\nelif (X//n)%2 == 0:\n    done(0,m)\nelif (Y//m)%2 == 0:\n    done(n,0)\nelse:\n    done(n,m)\n    \n    \n    \n    \n    \n    \n    \n", "lang_cluster": "Python", "tags": ["geometry", "number theory"], "code_uid": "52f8a5b3d9855149cdaad20eb09b3bfd", "src_uid": "6c4ddc688c5aab1432e7328d27c4d8ee", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def getIntList():\n    return list(map(int, input().split()));\ndef getTransIntList(n):\n    first=getIntList();\n    m=len(first);\n    result=[[0]*n for _ in range(m)];\n    for i in range(m):\n        result[i][0]=first[i];\n    for j in range(1, n):\n        curr=getIntList();\n        for i in range(m):\n            result[i][j]=curr[i];\n    return result;\nn, m, x, y, vx, vy=getIntList();\n#\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u041d\u041e\u0414 d \u0438 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b k1, k2: k1*n1+k2*n2=d\ndef GCDKoef(n1, n2):\n    k11=1;\n    k12=0;\n    k21=0;\n    k22=1;\n    while n2>0:\n        k, r=divmod(n1, n2);\n        n1, n2= n2, r;\n        #r=n1-n2*k\n        k11, k12, k21, k22 = k21, k22, k11 - k21 * k, k12 - k22*k;\n    return n1, k11, k12;\ndef solveSystemCongruence(a1, n1, a2, n2):\n    d, k1, k2=GCDKoef(n1, n2);\n    if (a1-a2)%d!=0:\n        return None;\n    #t===a1(n1), t===a2(n2), d=GCD(n1, n2), d=n1*k1+n2*k2\n    #r=a1%d=a2%d; a1=r+d*x1 a2=r+d*x2\n    #t=r+x1*n2*k2+x2*n1*k1===r+d*x1=a1(n1) ===r+d*x2=a2(n2)\n    r=a1%d;\n    x1=(a1-r)//d;\n    x2=(a2-r)//d;\n    t=r+x1*n2*k2+x2*n1*k1;\n    mod=n1*n2//d;\n    t%=mod;\n    if t<0:\n        t+=mod;\n    return t;\nif vx==0:\n    if x!=0 and x!=n:\n        print(-1);\n    elif vy==1:\n        print(x, m)\n    else:\n        print(x, 0);\nelif vy==0:\n    if y!=0 and y!=m:\n        print(-1);\n    elif vx==1:\n        print(n, y);\n    else:\n        print(0, y);\nelse:\n    t=solveSystemCongruence(-x*vx, n, -y*vy, m);\n    if t==None:\n        print(-1);\n    else:\n        x=x+t*vx;\n        y=y+t*vy;\n        x//=n;\n        y//=m;\n        x%=2;\n        y%=2;\n        x=abs(x);\n        y=abs(y);\n        print(x*n, y*m);", "lang_cluster": "Python", "tags": ["geometry", "number theory"], "code_uid": "89b7f98268f21840e3237b25af42f19c", "src_uid": "6c4ddc688c5aab1432e7328d27c4d8ee", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "# -*- coding: utf-8 -*-\nimport sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll\n\nMX = 1180000 \nprime = [1] * MX\nprime[0] = prime[1] = 0\nfor i in xrange(2, int(MX ** 0.5 + 1e-8)):\n    if prime[i]:\n        prime[2 * i::i] = [0] * len(prime[2 * i::i])\n\np, q = map(int, raw_input().split())\npi = rub = ans = 0\nfor i in xrange(1, MX):\n    pi += prime[i]\n    if i == int(str(i)[::-1]): rub += 1\n    if q * pi <= p * rub:\n        ans = max(ans, i)\n\nprint ans\n", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search", "number theory"], "code_uid": "9badc7b262d0fc4977a9fa9f3e907fa4", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\"\"\"\nNTC here\n\"\"\"\nimport sys\ninp = sys.stdin.readline\ndef input(): return inp().strip()\n# flush= sys.stdout.flush\n# import threading\n# sys.setrecursionlimit(10**6)\n# threading.stack_size(2**26)\n \ndef iin(): return int(input())\n \n \ndef lin(): return list(map(int, input().split()))\n \n \n# range = xrange\n# input = raw_input\n \ndef primetilln(n):\n    prime = [True for i in range(n+1)]\n    p = 2\n    while (p * p <= n):\n \n        if (prime[p] == True):\n            for i in range(p * 2, n+1, p):\n                prime[i] = False\n        p += 1\n    primes = set()\n    for i in range(2, n):\n        if prime[i]:\n            primes.add(i)\n    return primes\n \ndef main():\n    def check_palindrom(x):\n        s = list(str(x))\n        return s==s[::-1]\n        \n    T = 1\n    while T:\n        T-=1\n        p, q = lin()\n        mx = 10**7+10\n        a = primetilln(mx-1)\n        a1 = [0]*mx\n        a2 = [0]*mx\n        for i in a:a1[i]+=1\n        for i in range(1, mx):\n            if check_palindrom(i):\n                a2[i]+=1\n        for i in range(1, mx):\n            a1[i]+=a1[i-1]\n            a2[i]+=a2[i-1]\n        # print(a2[:20])\n        ans = 0\n        for i in range(1, mx):\n            if a1[i]*q<=p*a2[i]:\n                ans=max(ans, i)\n        print(ans if ans else \"Palindromic tree is better than splay tree\")\n \n \n \n \n \n \n \nmain()\n \n# threading.Thread(target=main).start()", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search", "number theory"], "code_uid": "b26ffe329849d138920b94825e3fb091", "src_uid": "e6e760164882b9e194a17663625be27d", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x, y, z, k = [int(x) for x in input().split()]\n\ndim = sorted([x - 1, y - 1, z - 1])\n\nanswer = [0, 0, 0]\n\nfor i in range(len(dim)):\n    dimi = dim[i]\n    if dimi * (3 - i) <= k:\n        k = k - (dimi * (3 - i))\n        for j in range(i, 3):\n            answer[j] += dimi\n        for j in range(3):\n            dim[j] -=  dimi\n    else:\n        for j in range(i, 3):\n            answer[j] += k // (3 - i)\n        for j in range(i, (k % (3 - i)) + i):\n            answer[j] += 1\n        break\n\ntrue_ans = 1\n\nfor i in answer:\n    true_ans = true_ans * (i + 1)\n\nprint(true_ans)\n\n\n", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "cc9f8deeb5689a0f15bcb2811aa4d060", "src_uid": "8787c5d46d7247d93d806264a8957639", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "x, y, z, k = map(int, input().split())\nx, y, z = sorted((x, y, z))\na = min(k // 3, x - 1)\nb = min((k - a) // 2, y - 1)\nc = min(k - a - b, z - 1)\nprint((a + 1) * (b + 1) * (c + 1))", "lang_cluster": "Python", "tags": ["math", "greedy"], "code_uid": "fc3ecaa2301ea75ea76432b313040cad", "src_uid": "8787c5d46d7247d93d806264a8957639", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def main():\n    M=998244353\n    n,k,*h=map(int,open(0).read().split())\n    m=sum(i!=j for i,j in zip(h,h[1:]+h[:1]))\n    f=[0]*(m+1)\n    f[0]=b=1\n    for i in range(1,m+1):f[i]=b=b*i%M\n    inv=[0]*(m+1)\n    inv[m]=b=pow(f[m],M-2,M)\n    for i in range(m,0,-1):inv[i-1]=b=b*i%M\n    comb=lambda n,k:f[n]*inv[n-k]*inv[k]%M\n    print((pow(k,m,M)-sum(comb(m,i)*comb(m-i,i)*pow(k-2,m-i-i,M)for i in range(m//2+1)))*pow(k,n-m,M)*pow(2,M-2,M)%M)\nmain()", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "47f66158ffdd8b80414ba68d6c9f76ad", "src_uid": "63c4006a0a6284f9825aaabfc4c28fd1", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def main():\n    M=998244353\n    n,k,*h=map(int,open(0).read().split())\n    m=sum(i!=j for i,j in zip(h,h[1:]+h[:1]))\n    f=[0]*(m+1)\n    f[0]=b=1\n    for i in range(1,m+1):f[i]=b=b*i%M\n    inv=[0]*(m+1)\n    inv[m]=b=pow(f[m],M-2,M)\n    for i in range(m,0,-1):inv[i-1]=b=b*i%M\n    comb=lambda n,k:f[n]*inv[n-k]*inv[k]%M\n    print((pow(k,m,M)-sum(comb(m,i)*comb(m-i,i)*pow(k-2,m-i-i,M)for i in range(m//2+1)))*pow(k,n-m,M)*pow(2,M-2,M)%M)\nmain()", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "ffd08ceae10e0c577bae73db6aca863f", "src_uid": "63c4006a0a6284f9825aaabfc4c28fd1", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\n# read int\nn = int(sys.stdin.readline().strip())\nsum = 0\nf1 = 1\nf2 = 1\nmod = 1000000007\nfor i in range(n):\n    sum = (sum + f2) % mod\n    f1, f2 = f2, (f1+f2) % mod\nprint sum\n", "lang_cluster": "Python", "tags": ["math", "dp"], "code_uid": "244500cecf258af90c9072c91c69abee", "src_uid": "5c4bd12df3915186a7b506c2060db125", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# Legends Always Come Up with Solution\n# Author: Manvir Singh\n\nimport os\nfrom io import BytesIO, IOBase\nimport sys\nfrom collections import defaultdict,deque,Counter\nfrom bisect import *\nfrom math import sqrt,pi\nimport math\nfrom itertools import permutations\nfrom copy import deepcopy\n\ndef main():\n    n = int(input())\n    mod = 10 ** 9 + 7\n    if n >= 2:\n        dp = [0 for i in range(n)]\n        dp[0], dp[1] = 1, 2\n        ans = 3\n        for i in range(2, n):\n            dp[i] = (dp[i - 1] + dp[i - 2]) % mod\n            ans = (ans + dp[i]) % mod\n        print(ans)\n    else:\n        print(1)\n# region fastio\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n    newlines = 0\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\n\n\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n\n\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\nif __name__ == \"__main__\":\n    main()", "lang_cluster": "Python", "tags": ["math", "dp"], "code_uid": "abb4eb3b9fed67f123bb1e5a5f539155", "src_uid": "5c4bd12df3915186a7b506c2060db125", "difficulty": 1600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#Simple non-optimized class of matrices. Used with small dense matrices.\nimport functools\nimport itertools\nimport math\n\nclass NotAMatrixError(Exception):\n    pass\n\nclass MatrixSizeError(Exception):\n    def __init__(self, s1, s2):\n        print('sizes do not match : ', s1, ', ', s2)\n\nclass NotSquareError(Exception):\n    pass\n\nclass Matrix(list):\n    def __init__(self, L):\n        if type(L) == type(self):\n            self = L\n            return\n        n = len(L)\n        m = len(L[0])\n        for i in range(n):\n            if len(L[i]) != m:\n                raise NotAMatrixError()\n        list.__init__(self, L)\n        self.n = n\n        self.m = m\n        self.degrees = []\n    def check_size(self, M, mode):\n        n, m = len(M), len(M[0])\n        for i in range(n):\n            if len(M[i]) != m:\n                raise NotAMatrixError()\n        \n        if mode == 'add' and (self.n != n or self.m != m):\n            raise MatrixSizeError((self.n, self.m), (n,m))\n        if mode == 'lul' and self.m != n:\n            print(self.m, n, self.m != n)\n            raise MatrixSizeError((self.n, self.m), (n,m))\n    def __add__(self, M):\n        self.check_size(M, mode = 'add')\n        return Matrix([[self[i][j]+M[i][j] for j in range(self.m)]for i in range(self.n)])\n    def __iadd__(self, M):\n        self.check_size(M, mode = 'add')\n        for i in range(self.n):\n            for j in range(self,m):\n                self[i][j] += M[i][j]\n    def __mul__(self, M):\n        self.check_size(M, mode = 'mul')\n        l = len(M[0])\n        return Matrix([[sum(self[i][k]*M[k][j] for k in range(self.m))\n                 for j in range(l)] for i in range(self.n)])\n    def issquare(self):\n        return self.n == self.m\n    def primary(self):\n        if self.n != self.m:\n            raise NotSquareError()\n        return Matrix([[int(i==j) for j in range(self.m)] for i in range(self.n)])\n    def __pow__(self, n):\n        if self.n != self.m:\n            raise NotSquareError()\n        if n == 0:\n            return self.primary()\n        elif n == 1:\n            return self\n        if len(self.degrees) == 0:\n            self.degrees.append(self*self)\n        for i in range(n.bit_length() - len(self.degrees) - 1):\n            self.degrees.append(self.degrees[-1] * self.degrees[-1])\n        s = [(n>>i)&1 for i in range(1,n.bit_length())]\n        res = functools.reduce(lambda x,y:x*y, itertools.compress(self.degrees, s))\n        return res*self if n%2 else res \n    def drop_degrees(self):\n        self.degrees.clear()\n\nclass Remainder(int):\n    def __new__(self, n, p):\n        obj = int.__new__(self, n%p)\n        obj.p = p\n        return obj\n    def __mul__(self, m): return Remainder(int.__mul__(self, m), self.p)\n    def __add__(self, m): return Remainder(int.__add__(self, m), self.p)\n    def __sub__(self, m): return Remainder(int.__sub__(self, m), self.p)\n    def __rmul__(self, m): return Remainder(int.__rmul__(self, m), self.p)\n    def __radd__(self, m): return Remainder(int.__radd__(self, m), self.p)\n    def __rsub__(self, m): return Remainder(int.__rsub__(self, m), self.p)\n    def __neg__(self): return Remainder(int.__neg__(self), self.p)\n    def __pow__(self, m): return Remainder(int.__pow__(self, m, self.p), self.p)\n\ndef solve(n, sx, sy, dx, dy, t):\n    o, l, j = Remainder(0, n), Remainder(1, n), Remainder(2, n)\n    N = [[j, l, l, o, l, o],\n         [l, j, o, l, l, o],\n         [l, l, l, o, l, o],\n         [l, l, o, l, l, o],\n         [o, o, o, o, l, l],\n         [o, o, o, o, o, l]]\n    M = Matrix(N)\n    sx, sy, dx, dy = map(lambda x: Remainder(x, n), [sx, sy, dx, dy])\n    v = Matrix([[sx], [sy], [dx], [dy], [o], [l]])\n    return M ** t * v\n\nn, sx, sy, dx, dy, t = [int(x) for x in input().split()]\nans = solve(n, sx, sy, dx, dy, t)\nprint(int(ans[0][0] - 1) + 1, int(ans[1][0] - 1) + 1)\n", "lang_cluster": "Python", "tags": ["math", "matrices"], "code_uid": "f8b8ce2977cc1b6cb4449f152d6f0a18", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "mod, sx, sy, dx, dy, t = map(int, input().split())\nclass Matrix():\n    def __init__(self, n):\n        self.n = n\n        self.a = [[0] * n for _ in range(n)]\n\n    def __mul__(self, b):\n        res = Matrix(self.n)\n        for i in range(self.n):\n            for j in range(self.n):\n                for k in range(self.n):\n                    res.a[i][j] += self.a[i][k] * b.a[k][j] % mod\n                    res.a[i][j] %= mod\n        return res\n\n    def __pow__(self, e):\n        res = Matrix(self.n)\n        for i in range(self.n):\n            res.a[i][i] = 1\n        tmp = self\n        while e:\n            if e & 1:\n                res = res * tmp\n            e >>= 1\n            tmp = tmp * tmp\n        return res\nM = Matrix(6)\nM.a = [[2, 1, 1, 0, 1, 2],\n       [1, 2, 0, 1, 1, 2],\n       [1, 1, 1, 0, 1, 2],\n       [1, 1, 0, 1, 1, 2],\n       [0, 0, 0, 0, 1, 1],\n       [0, 0, 0, 0, 0, 1]]\nsx -= 1\nsy -= 1\nr = M ** t\nf = lambda i: (r.a[i][0] * sx + r.a[i][1] * sy + r.a[i][2] * dx + r.a[i][3] * dy + r.a[i][5]) % mod + 1\nprint(f(0), f(1))\n", "lang_cluster": "Python", "tags": ["math", "matrices"], "code_uid": "931646a505cb1b192a15fef50104b519", "src_uid": "ee9fa8be2ae05a4e831a4f608c0cc785", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "n, C = map(int, raw_input().split())\nfac = [1]\nz = 1000003\nfor i in range(1, 700000):\n    fac.append((fac[-1] * i) % z)\nans = 0\nfor i in range(1, n+1):\n    x = (fac[i+C-1] * pow(fac[i], z-2, z) * pow(fac[C-1], z-2, z)) % z\n    ans = (ans + x) % z\nprint(ans)\n", "lang_cluster": "Python", "tags": ["combinatorics"], "code_uid": "596ae6a4493fa325e18c3f0e63573690", "src_uid": "e63c70a9c96a94bce99618f2e695f83a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from collections import defaultdict\nimport sys\nfrom itertools import *\nsys.setrecursionlimit(999999999)\n\nn,c = map(int,raw_input().split())\n\nP = 10**6+3\nfak= [1]*P\n\nfor i in xrange(P-1):\n    fak[i+1]= (fak[i]*(i+1))%P\n    \n\n\ndef pow(q,w):\n    if w==0:\n        return 1\n    pom = pow(q,w/2)\n    h = 1\n    if w%2:\n        h = q\n    return (((pom*pom)%P)*h)%P\n\ndef inv(q):\n    return pow(q,P-2)\n\nans = -1\ni=n\nans+= (fak[n+c]* inv(fak[n])*inv(fak[c]))%P\n\nprint ans\n", "lang_cluster": "Python", "tags": ["combinatorics"], "code_uid": "67a05f82c5b5d0dc1e797823f4e347c4", "src_uid": "e63c70a9c96a94bce99618f2e695f83a", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "mod=10**9+7\nn,k=map(int,input().split())\n\nA=[0]*(n+1)\nB=[0]*(n+1)\nC=[0]*(n+1)\nF=[0]*(n+1)\nG=[0]*(n+1)\n\nF[0]=G[0]=1\nfor i in range(1,n+1):\n\tG[i]=F[i]=F[i-1]*i%mod\n\tG[i]=pow(F[i],(mod-2),mod)\n\nfor i in range(0,n):\n\tif i*2>n:\n\t\tbreak\n\tB[i]=(F[n-i]*G[i]*G[n-i*2])%mod\nfor i in range(0,n//2+1):\n\tfor j in range(0,n//2+1):\n\t\tA[i+j]=(A[i+j]+B[i]*B[j])%mod\nfor i in range(0,n+1):\n\tA[i]=A[i]*F[n-i]%mod\nfor i in range(0,n+1):\n\tfor j in range(0,i+1):\n\t\tC[j]=(C[j]+A[i]*F[i]*G[j]*G[i-j]*(1-(i-j)%2*2))%mod\nprint(C[k]%mod)\n\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "fb4c18db409acbed597f35900f2fd6cf", "src_uid": "1243e98fe2ebd6e6d1de851984b96079", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "mod=10**9+7\nn,k=map(int,input().split())\n\nA=[0]*(n+1)\nB=[0]*(n+1)\nC=[0]*(n+1)\nF=[0]*(n+1)\nG=[0]*(n+1)\n\nF[0]=G[0]=1\nfor i in range(1,n+1):\n\tG[i]=F[i]=F[i-1]*i%mod\n\tG[i]=pow(F[i],(mod-2),mod)\n\nfor i in range(0,n):\n\tif i*2>n:\n\t\tbreak\n\tB[i]=(F[n-i]*G[i]*G[n-i*2])%mod\nfor i in range(0,n//2+1):\n\tfor j in range(0,n//2+1):\n\t\tA[i+j]=(A[i+j]+B[i]*B[j])%mod\nfor i in range(0,n+1):\n\tA[i]=A[i]*F[n-i]%mod\nfor i in range(0,n+1):\n\tfor j in range(0,i+1):\n\t\tC[j]=(C[j]+A[i]*F[i]*G[j]*G[i-j]*(1-(i-j)%2*2))%mod\nprint(C[k]%mod)\n\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "09ab6ad2dae96b05b46ac7b39341547c", "src_uid": "1243e98fe2ebd6e6d1de851984b96079", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import *\n\nclass sqrt_decomp:\n    def _init_(self,val):\n        self.values=val\n        self.blockl=int(sqrt(len(val)))\n        self.noblocks=int(ceil(len(val)/self.blockl))\n        self.plusv=[0]*self.noblocks\n        self.sumbl=[0]*self.noblocks\n        for i in range(self.noblocks):\n            self.sumbl=sum(val[i*self.blockl:max(len(val),(i+1)*self.blockl)])\n\ndef maximize(n,X,l):\n    if l==0:\n        return 0\n    cur=ans[l-1]\n    X-=cur**3\n    while X+(cur+1)**3<=n:\n        cur+=1\n        #print(\"again\",cur,X,X+cur**3,n)\n    Xy=cur**3\n    Xy+=maximize(min(n-Xy,(cur+1)**3-Xy-1),X,l-1)\n    ans[l-1]=cur\n    return Xy\n    \n    \n\nn=int(input())\nc=1\nans=[]\nX=0\nwhile X+c**3<=n:\n    while X<(c+1)**3-c**3 and X+c**3<=n:\n        ans+=[c]\n        X+=c**3        \n        #print(c,X,ans)\n    c+=1\n    #print(c,c**3,X,n,\"rofl\")\nX=maximize(n,X,len(ans))\nprint(len(ans),X)\n#print(ans)", "lang_cluster": "Python", "tags": ["brute force", "greedy", "constructive algorithms", "binary search"], "code_uid": "576eda555f961a7498f42f10b898ae36", "src_uid": "385cf3c40c96f0879788b766eeb25139", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\ndef solve(m, cubes, volume):\n  if m == 0:\n    return [cubes, volume]\n\n  x = 1\n  while (x ** 3) <= m:\n    x += 1\n  x -= 1\n\n  best = solve(m - (x ** 3), cubes + 1, volume + x ** 3)\n  if x > 1:\n    best = max(best, solve((x ** 3) - 1 - ((x - 1) ** 3), cubes + 1, volume + (x - 1) ** 3))\n\n  return best\n\n\nm = int(raw_input())\nprint \" \".join(map(str, solve(m, 0, 0)))\n#cubes = list(reversed([i * i * i for i in xrange(1, 20)]))\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "greedy", "constructive algorithms", "binary search"], "code_uid": "aab3f9efaa234f793a5c2ad4f8f575c7", "src_uid": "385cf3c40c96f0879788b766eeb25139", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "import sys\r\ninput = sys.stdin.readline\r\n\r\nfrom functools import lru_cache\r\n\r\nk, M = map(int, input().split())\r\n\r\nMOD = M\r\n\r\ndef modmul(x, y, c = 0):\r\n    return (x * y + c) % MOD\r\n\r\nmod_mul = modmul\r\n\r\ndef inv(x):\r\n    return pow(x, MOD - 2, MOD)\r\n\r\nMAX = 10 ** 5\r\n\r\nfact = [1]\r\nfor i in range(1, MAX):\r\n    fact.append(modmul(i, fact[i-1]))\r\n\r\ninvfact = [1] * (MAX)\r\ninvfact[MAX - 1] = inv(fact[MAX - 1])\r\nfor i in range(MAX - 2, -1, -1):\r\n    invfact[i] = modmul(i + 1, invfact[i+1])\r\n\r\ndef comb(x, y):\r\n    assert 0 <= y <= x\r\n    \r\n    return modmul(fact[x], modmul(invfact[y], invfact[x - y]))\r\n\r\ndef invcomb(x, y):\r\n    return modmul(invfact[x], modmul(fact[y], fact[x - y]))\r\n\r\ndef invs(x):\r\n    return modmul(fact[x - 1], invfact[x])\r\n\r\n\r\ndef count(a, b):\r\n    if a + b == 0:\r\n        return 1\r\n    return modmul(a, fact[a + b - 1])\r\n    \r\nn = k\r\n\r\npn1 = [1]\r\nfor i in range(5000):\r\n    pn1.append(modmul(pn1[-1], n - 1))\r\n\r\nout = 0\r\nfor i in range(1, n):\r\n    \r\n    pni = [1]\r\n    for _ in range(5000):\r\n        pni.append(modmul(pni[-1], n - i))\r\n        \r\n    for j in range(i + 1):\r\n        if n - i - j < 0:\r\n            continue\r\n        \r\n        stab = comb(n, i)\r\n        app = modmul(comb(i, j), comb(n - i, n - i - j))\r\n        order = count(j, n - i - j)\r\n        sao = modmul(modmul(stab, app), order)\r\n        #sao = 1\r\n\r\n        #u1 = pow(n - i, i - j, M)\r\n        #u2 = pow(n - 1, j, M)\r\n        u1 = pni[i - j]\r\n        u2 = pn1[j]\r\n        u = modmul(u1, u2)\r\n        #u = 1\r\n\r\n        #print(i, j, stab, app, order, u1, u2)\r\n        \r\n        out += modmul(sao, u)\r\n\r\nprint(out % M)\r\n        \r\n        \r\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "math", "dp", "combinatorics", "fft"], "code_uid": "c33f4c0531ae5dc8cafbc79922ee3f33", "src_uid": "2d5a5055aaf34f4d300cfdf7c21748c3", "difficulty": 3200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import sqrt\ndef pt(x):\n    print(x)\nrd = lambda: map(int, input().split())\nn = int(input())\ndef f(x1, y1, r1, x2, y2, r2):\n    a = (r1 + r2) ** 2\n    b = (r1 - r2) ** 2\n    d = (x1 - x2) ** 2 + (y1 - y2) ** 2\n    if d > a:\n        return 1\n    elif d == a:\n        return 4\n    elif d < b:\n        return 3\n    elif d == b:\n        return 5\n    else:\n        return 2\ndef g(x1, y1, r1, x2, y2, r2):\n    ds = (x1 - x2) ** 2 + (y1 - y2) ** 2\n    d = sqrt(ds)\n    A = (r1 ** 2 - r2 ** 2 + ds) / (2 * d)\n    h = sqrt(r1 ** 2 - A ** 2)\n    x = x1 + A * (x2 - x1) / d  \n    y = y1 + A * (y2 - y1) / d\n    x3 = x - h * (y2 - y1) / d  \n    y3 = y + h * (x2 - x1) / d\n    x4 = x + h * (y2 - y1) / d  \n    y4 = y - h * (x2 - x1) / d\n    return x3, y3, x4, y4 \nif n is 1:\n    pt(2)\nif n is 2:\n    x1, y1, r1 = rd()\n    x2, y2, r2 = rd()\n    a = f(x1, y1, r1, x2, y2, r2)\n    pt(4 if a is 2 else 3)\nif n is 3:\n    x1, y1, r1 = rd()\n    x2, y2, r2 = rd()\n    x3, y3, r3 = rd()\n    a = f(x1, y1, r1, x2, y2, r2)\n    b = f(x1, y1, r1, x3, y3, r3)\n    c = f(x3, y3, r3, x2, y2, r2)\n    t = [a, b, c]\n    t.sort()\n    a, b, c = t\n    if a is 1 and b is 1 and c in [1, 3, 4, 5]:\n        pt(4)\n    if a is 1 and b is 1 and c is 2:\n        pt(5)\n    if a is 1 and b is 2 and c is 2:\n        pt(6)\n    if a is 1 and b is 2 and c in [3, 4, 5]:\n        pt(5)\n    if a is 1 and b in [3, 4, 5]:\n        pt(4)\n    if a is 2 and b is 2 and c is 2:\n        x4, y4, x5, y5 = g(x1, y1, r1, x2, y2, r2)\n        r = 8\n        if abs((x4 - x3) ** 2 + (y4 - y3) ** 2 - r3 ** 2) < 1e-6:\n            r -= 1\n        if abs((x5 - x3) ** 2 + (y5 - y3) ** 2 - r3 ** 2) < 1e-6:\n            r -= 1\n        pt(r)\n    if a is 2 and b is 2 and c is 3:\n        pt(6)\n    if a is 2 and b is 2 and c in [4, 5]:\n        x4, y4, x5, y5 = g(x1, y1, r1, x2, y2, r2)\n        if abs((x4 - x3) ** 2 + (y4 - y3) ** 2 - r3 ** 2) < 1e-6 or abs((x5 - x3) ** 2 + (y5 - y3) ** 2 - r3 ** 2) < 1e-6:\n            pt(6)\n        else:\n            pt(7)\n    if a is 2 and b is 3:\n        pt(5)\n    if a is 2 and b in [4, 5]:\n        pt(6)\n    if a is 3 and b in [3, 4, 5]:\n        pt(4)\n    if a is 4 and b is 4 and c is 4:\n        pt(5)\n    if a is 4 and b is 4 and c is 5:\n        pt(4)\n    if a is 4 and b is 5 and c is 5:\n        pt(5)\n    if a is 5 and b is 5 and c is 5:\n        pt(4)", "lang_cluster": "Python", "tags": ["geometry", "graphs"], "code_uid": "cf28b2712a572b91b165cf316ea8194c", "src_uid": "bda5879e94a82c6fd499796f258c4691", "difficulty": 2700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from math import sqrt\n\nclass vector:\n\tdef __init__(self, _x = 0, _y = 0):\n\t\tself.x = _x\n\t\tself.y = _y\n\tdef len(self):\n\t\treturn sqrt(self.x ** 2 + self.y ** 2)\n\tdef len_sq(self):\n\t\treturn self.x ** 2 + self.y ** 2\n\tdef __mul__(self, other):\n\t\tif (type(self) == type(other)):\n\t\t\treturn self.x * other.x + self.y * other.y\n\t\treturn vector(self.x * other, self.y * other)\n\tdef __mod__(self, other):\n\t\treturn self.x * other.y - self.y * other.x\n\tdef normed(self):\n\t\tlength = self.len()\n\t\treturn vector(self.x / length, self.y / length)\n\tdef normate(self):\n\t\tself = self.normed()\n\tdef __str__(self):\n\t\treturn \"(\" + str(self.x) + \", \" + str(self.y) + \")\"\n\tdef __add__(self, other):\n\t\treturn vector(self.x + other.x, self.y + other.y);\n\tdef __sub__(self, other):\n\t\treturn vector(self.x - other.x, self.y - other.y);\n\tdef __eq__(self, other):\n\t\treturn self.x == other.x and self.y == other.y\n\tdef rot(self):\n\t\treturn vector(self.y, -self.x)\n\nclass line:\n\tdef __init__(self, a = 0, b = 0, c = 0):\n\t\tself.a = a\n\t\tself.b = b\n\t\tself.c = c\n\tdef intersect(self, other):\n\t\td = self.a * other.b - self.b * other.a\n\t\tdx = self.c * other.b - self.b * other.c\n\t\tdy = self.a * other.c - self.c * other.a\n\t\treturn vector(dx / d, dy / d)\n\tdef fake(self, other):\n\t\td = self.a * other.b - self.b * other.a\n\t\treturn d\n\tdef __str__(self):\n\t\treturn str(self.a) + \"*x + \" + str(self.b) + \"*y = \" + str(self.c) \n\ndef line_pt(A, B):\n\t\td = (A - B).rot()\n\t\treturn line(d.x, d.y, d * A)\n\nclass circle:\n\tdef __init__(self, O = vector(0, 0), r = 0):\n\t\tself.O = O\n\t\tself.r = r\n\tdef intersect(self, other):\n\t\tO1 = self.O\n\t\tO2 = other.O\n\t\tr1 = self.r\n\t\tr2 = other.r\n\t\tif (O1 == O2):\n\t\t\treturn []\n\t\tif ((O1 - O2).len_sq() > r1 ** 2 + r2 ** 2 + 2 * r1 * r2):\n\t\t\treturn []\n\t\trad_line = line(2 * (O2.x - O1.x), 2 * (O2.y - O1.y), r1 ** 2 - O1.len_sq() - r2 ** 2 + O2.len_sq())\n\t\tcentral = line_pt(O1, O2)\n\t\tM = rad_line.intersect(central)\n\t\t# print(M)\n\t\tif ((O1 - O2).len_sq() == r1 ** 2 + r2 ** 2 + 2 * r1 * r2):\n\t\t\treturn [M]\n\t\td = (O2 - O1).normed().rot()\n\t\tif (r1 ** 2 - (O1 - M).len_sq() < 0):\n\t\t\treturn []\n\t\td = d * (sqrt(r1 ** 2 - (O1 - M).len_sq()))\n\t\treturn [M + d, M - d]\n\tdef fake(self, other):\n\t\tO1 = self.O\n\t\tO2 = other.O\n\t\tr1 = self.r\n\t\tr2 = other.r\n\t\tif (O1 == O2):\n\t\t\treturn 1\n\t\tif ((O1 - O2).len_sq() > r1 ** 2 + r2 ** 2 + 2 * r1 * r2):\n\t\t\treturn 1\n\t\trad_line = line(2 * (O2.x - O1.x), 2 * (O2.y - O1.y), r1 ** 2 - O1.len_sq() - r2 ** 2 + O2.len_sq())\n\t\tcentral = line_pt(O1, O2)\n\t\treturn rad_line.fake(central)\n\n\n# a = vector(3, 4)\n# b = vector(4, 4)\n# print(circle(vector(1, 2), 3).intersect(circle(vector(2, 1), 6)))\nn = int(input())\narr = []\nm = 1\nfor i in range(n):\n\tx, y, r = map(int, input().split())\n\tarr.append(circle(vector(x, y), r))\nfor i in range(n):\n\tfor j in range(i + 1, n):\n\t\tm *= arr[i].fake(arr[j])\nfor i in range(n):\n\tarr[i].O = arr[i].O * m\n\tarr[i].r = arr[i].r * m\n# print(m)\ns = set()\nV = 0\nfor i in range(n):\n\tfor j in range(i + 1, n):\n\t\ttmp = arr[i].intersect(arr[j])\n\t\tfor e in tmp:\n\t\t\ts.add((round(e.x, 6), round(e.y, 6)))\nV += len(s)\nE = 0\n\npar = [i for i in range(n)]\n\ndef get_par(v):\n\tif (par[v] != v):\n\t\tpar[v] = get_par(par[v])\n\treturn par[v]\ndef unite(v, u):\n\tpar[get_par(v)] = get_par(u)\nfor i in range(n):\n\ts = set()\n\tfor j in range(n):\t\n\t\ttmp = arr[i].intersect(arr[j])\n\t\tif (len(tmp)):\n\t\t\tunite(i, j)\n\t\tfor e in tmp:\n\t\t\ts.add((round(e.x, \t), round(e.y, \t)))\n\tE += len(s)\n# print(V, E)\n# print(len({get_par(i) for i in range(n)}))\nprint(E - V + 1 + len({get_par(i) for i in range(n)}))", "lang_cluster": "Python", "tags": ["geometry", "graphs"], "code_uid": "8c9b4e66c324e910ed41255c85bc2b36", "src_uid": "bda5879e94a82c6fd499796f258c4691", "difficulty": 2700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import bisect\ndef LIS(As):\n    L = [As[0]]\n    for a in As[1:]:\n        if a >= L[-1]:\n            L.append(a)\n        else:\n            pos = bisect.bisect_right(L, a)\n            L[pos] = a\n    return L\n\ndef solve():\n    n,T = map(int,input().split())\n    array = list(map(int,input().split()))\n    if (T<=n+1):\n        print (len(LIS(array*T)))\n    else:\n        newarray = array*n\n        lis = LIS(newarray)\n        newlis = LIS(newarray+array)\n        print (len(newlis)+(len(newlis)-len(lis))*(T-n-1))\n\nsolve()", "lang_cluster": "Python", "tags": ["dp", "constructive algorithms"], "code_uid": "9724fa72676d570aa4dfe5d950843349", "src_uid": "26cf484fa4cb3dc2ab09adce7a3fc9b2", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "N=400\nR=lambda:map(int,raw_input().split())\nn,t=R()\na=R()\ndef mk(s):\n  v=[0]*N\n  t=[0]*N\n  for x in s:\n    c=0\n    i=x\n    while i>0:\n      c=max(c,v[i])\n      i-=i&-i\n    t[x]=max(t[x],c+1)\n    i=x\n    while i<N:\n      v[i]=max(v[i],c+1)\n      i+=i&-i\n  return t\nif t>n*2:\n  f=mk(a*n)\n  b=mk([321-x for x in (a*n)[::-1]])\n  z=0\n  for x in a:\n    z=max(z,f[x]+b[321-x]+a.count(x)*(t-2*n))\n  print z\nelse:\n  print max(mk(a*t))", "lang_cluster": "Python", "tags": ["matrices", "dp", "constructive algorithms"], "code_uid": "b7fe6aa0bf93792b95666f5500dc2f55", "src_uid": "26cf484fa4cb3dc2ab09adce7a3fc9b2", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\nx, y, z = map(int, input().split())\na, b, c = map(int, input().split())\ns, rs, ls = map(int, input().split())\ndef rec(ss):\n    for i in range(0, 205, 1):\n        for j in range(0, 105, 1):\n            if(i * rs + j * ls <= ss):\n                q = y + i;p = z + j; pq = x + ((int)((ss - i * rs - j *ls) / s))\n                an1 = 1000000000000.0;an2 = 1000000000000.0\n                if(b - p > 0):\n                    an1 = math.ceil(((float) (pq)) / ((float)(b - p)))\n                if(q - c > 0):\n                    an2 = math.ceil(((float) (a)) / ((float)(q - c)))\n                if(q > c and p >= b or an1 > an2):\n                    return True\n    return False\nst = 0; en = 100000; mid = 0\nwhile(st <= en):\n    mid = (int)((st + en) / 2)\n    if(rec(mid) == True):\n        en = mid - 1\n    else:\n        st = mid + 1\nprint(en + 1)", "lang_cluster": "Python", "tags": ["brute force", "implementation", "binary search"], "code_uid": "353f10554b4be814f1a215802ec5a016", "src_uid": "bf8a133154745e64a547de6f31ddc884", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "I=lambda:map(int,input().split())\nR=list(range(999))\nq,w,e=I()\nr,t,y=I()\na,b,c=I()\nprint(min(i*b+j*c+max(0,(r//(w+i-y)+bool(r%(w+i-y)))*(t-e-j)-q+1)*a for i in R for j in R if w+i>y))\n", "lang_cluster": "Python", "tags": ["brute force", "implementation", "binary search"], "code_uid": "6d6e4e831f76823e9314c83deecc5774", "src_uid": "bf8a133154745e64a547de6f31ddc884", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from time import*\nn=int(input())\nt=time()\np2=1\nv=0\nwhile p2*2<=n:\n    p2*=2\n    v+=1\nmo=10**9+7\ntr=[n//(2**k) for k in range(v+1)]\ntabn=[0]*(v+1)\ntabn[-2]=tr[-2]-1\nfor k in range(2,n):\n    if tr[v-1]<k-2:\n        v-=1\n    tab=tabn[:]\n    tabn=[0]*(v+1)\n    for j in range(v):\n        tabn[j]=(max((tr[j]-k),0)*tab[j]+(tr[j]-tr[j+1])*tab[j+1])%mo\ns=tabn[0]\np2=1\nv=0\nwhile p2*2<=n:\n    p2*=2\n    v+=1\ntr=[n//(3*2**k) for k in range(v+1)]\ntr3=[n//(2**k) for k in range(v+1)]\ntab3n=[0]*(v+1)\ntabn=[0]*(v+1)\ntabn[-2]=tr[-2]#3*2**k-1\nfor k in range(1,n):\n    if tr3[v-1]<k-2:\n        v-=1\n    tab=tabn[:]\n    tabn=[0]*(v+1)\n    tab3=tab3n[:]\n    tab3n=[0]*(v+1)\n    for j in range(v):\n        tabn[j]=(max((tr[j]-k),0)*tab[j]+(tr[j]-tr[j+1])*tab[j+1])%mo\n    for j in range(v):\n        tab3n[j]=(max((tr3[j]-k),0)*tab3[j]+(tr3[j]-tr3[j+1])*tab3[j+1]+(tr3[j]-tr[j])*tab[j])%mo\nprint((s+tab3n[0])%mo)\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "number theory"], "code_uid": "5a5f446cf19d405d698d5092654d4402", "src_uid": "b2d59b1279d891dba9372a52364bced2", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\nrange = xrange\ninput = raw_input\n\nMOD = 10**9 + 7\ndef fac(x):\n    i = 1\n    for j in range(2 , x + 1):\n        i = i * j % MOD\n    return i\n\nfac = [1]\nfor i in range(1, 10**6 + 10):\n    fac.append(int(fac[-1] * i % MOD))\n\nn = int(input())\ndef ways(prevg, g):\n    cur = n//g - n//prevg if prevg else n//g\n    left = n - n//g\n\n    a = cur\n    for i in range(left + 1, left + cur):\n        a = a * i % MOD\n    #a = fac[cur] * pow(left+1, cur - 1, MOD)\n    b = +(g == 1)\n    for x in 2,3:\n        if g % x == 0:\n            b += ways(g, g // x)\n    return a * b\n\na = 1\nwhile a * 2 <= n:\n    a *= 2\n\nans = ways(0, a)\nif a //2 * 3 <= n:\n    ans += ways(0, a //2 * 3)\n\nprint ans % MOD\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "number theory"], "code_uid": "86efda43bc7acca8904ed062744afbc6", "src_uid": "b2d59b1279d891dba9372a52364bced2", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import os, sys\nfrom math import trunc\n\nMOD = 998244353\nMODF = float(MOD)\nSHRT = float(1 << 16)\nG = 3.0\nMAXSIZ = 1 << 20\n\n# Using pajenegod's crazy method for multiplication using floating point\nfmod = lambda x: x - MODF * trunc(x / MODF)\nmod_prod = lambda a, b: fmod(trunc(a / SHRT) * fmod(b * SHRT) + (a - SHRT * trunc(a / SHRT)) * b)\ndef fpow(a, b):\n    r = 1.0\n    while b:\n        if b & 1: r = mod_prod(r, a)\n        if b > 1: a = mod_prod(a, a)\n        b >>= 1\n    return r\n\ninp = os.read(sys.stdin.fileno(), 10 ** 8).split()\nn, k = int(inp[0]), int(inp[1])\nf = [0.0] * MAXSIZ\nfor i in xrange(2, k + 2):\n    f[int(inp[i])] = 1.0\n\nm = MAXSIZ\nm2 = m / 2\nw = [1.0] * m2\nw[1] = fpow(G, (MOD - 1) / m)\nfor i in xrange(2, m2):\n    w[i] = mod_prod(w[i - 1], w[1])\n\nrev = [0] * m\nfor i in xrange(m):\n    rev[i] = rev[i >> 1] >> 1\n    if i & 1: rev[i] |= m2\n\ndef ntt_transform(a):\n    for i in xrange(m):\n        if i < rev[i]: a[i], a[rev[i]] = a[rev[i]], a[i]\n    l = 2\n    while l <= m:\n        half, diff = l >> 1, m / l\n        for i in xrange(0, m, l):\n            pw = 0\n            for j in xrange(i, i + half):\n                v = mod_prod(a[j + half], w[pw])\n                a[j + half] = a[j] - v\n                a[j] = a[j] + v\n                pw += diff\n        l <<= 1\n\n\nntt_transform(f)\nf = [fpow(x, n >> 1) for x in f]\nntt_transform(f)\n\ninv_m = fpow(m, MOD - 2)\nans = mod_prod(sum(mod_prod(x, x) for x in f) % MODF, mod_prod(inv_m, inv_m))\nos.write(sys.stdout.fileno(), str(int(ans)))", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "fft"], "code_uid": "6da035c82a0fc1af36c029e654032f82", "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#!/usr/bin/env python\n\"\"\"\nThis file is part of https://github.com/Cheran-Senthil/PyRival.\n\nCopyright 2018 Cheran Senthilkumar all rights reserved,\nCheran Senthilkumar <hello@cheran.io>\nPermission to use, modify, and distribute this software is given under the\nterms of the MIT License.\n\n\"\"\"\nfrom __future__ import division, print_function\n\nimport cmath\nimport itertools\nimport math\nimport operator as op\n# import random\nimport sys\nfrom atexit import register\nfrom bisect import bisect_left, bisect_right\n# from collections import Counter, MutableSequence, defaultdict, deque\n# from copy import deepcopy\n# from decimal import Decimal\n# from difflib import SequenceMatcher\n# from fractions import Fraction\n# from heapq import heappop, heappush\n\nif sys.version_info[0] < 3:\n    # from cPickle import dumps\n    from io import BytesIO as stream\n    # from Queue import PriorityQueue, Queue\nelse:\n    # from functools import reduce\n    from io import StringIO as stream\n    # from pickle import dumps\n    # from queue import PriorityQueue, Queue\n\n\nif sys.version_info[0] < 3:\n    class dict(dict):\n        \"\"\"dict() -> new empty dictionary\"\"\"\n        def items(self):\n            \"\"\"D.items() -> a set-like object providing a view on D's items\"\"\"\n            return dict.iteritems(self)\n\n        def keys(self):\n            \"\"\"D.keys() -> a set-like object providing a view on D's keys\"\"\"\n            return dict.iterkeys(self)\n\n        def values(self):\n            \"\"\"D.values() -> an object providing a view on D's values\"\"\"\n            return dict.itervalues(self)\n\n    input = raw_input\n    range = xrange\n\n    filter = itertools.ifilter\n    map = itertools.imap\n    zip = itertools.izip\n\n\ndef sync_with_stdio(sync=True):\n    \"\"\"Set whether the standard Python streams are allowed to buffer their I/O.\n\n    Args:\n        sync (bool, optional): The new synchronization setting.\n\n    \"\"\"\n    global input, flush\n\n    if sync:\n        flush = sys.stdout.flush\n    else:\n        sys.stdin = stream(sys.stdin.read())\n        input = lambda: sys.stdin.readline().rstrip('\\r\\n')\n\n        sys.stdout = stream()\n        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))\n\n\ndef gcd(x, y):\n    \"\"\"greatest common divisor of x and y\"\"\"\n    while y:\n        x, y = y, x % y\n    return x\n\n\ndef main():\n    n, k = map(int, input().split(' '))\n    n //= 2\n\n    inv = [1] * (9*n + 2)\n    for i in range(2, 9*n + 2):\n        inv[i] = -inv[998244353 % i] * (998244353 // i) % 998244353\n\n    a = list(map(int, input().split(' ')))\n    mi = min(a)\n\n    a = list(map(lambda x: x - mi, a))\n    a.remove(0)\n\n    b = [0] * 16\n    b[0] = 1\n\n    ans = 0\n    for i in range(9*n + 1):\n        ans += b[i & 15] * b[i & 15]\n        if ans >= 7971934306371108872:\n            ans -= 7971934306371108872\n\n        s = 0\n        for x in a:\n            s += b[(i - x + 17) & 15] * (n * x - (i - x + 1))\n        b[(i + 1) & 15] = s % 998244353 * inv[i + 1] % 998244353\n\n    print(ans % 998244353)\n\n\nif __name__ == '__main__':\n    sync_with_stdio(False)\n    main()\n", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "fft"], "code_uid": "847412ab99d63032122bb713f6c62237", "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "mod , maxn , cur , ans , r = 998244353, 1000005, 10, 0 , 0\ndp, x , a = [0] * maxn, [0] * maxn , [0] * 12 , \nx[1] = 1\ndp[0] = 1\nfor i in range(2 , maxn):\n    x[i] = mod - (mod// i) *x[mod % i] % mod;\nn , k = map(int,input().split())\nn = n // 2\np = [0] * k\nfor u in map(int,input().split()):\n    cur = min(cur , u)\n    p[r] = u\n    r += 1\nfor i in range(k):\n    a[p[i] - cur] = 1\nfor i in range (n * 10 + 1):\n    sm,  j = 0, 0 \n    while j < min(10 , i + 1):\n        sm += dp[i-j] * (j+1) * a[j+1] * n % mod\n        j+= 1\n    j = 1\n    while j < min(10 , i + 1):\n        sm -= dp[i-j+1] * (i-j+1) * a[j]\n        j+= 1\n    ans = (ans + dp[i] * dp[i]) %mod\n    dp[i+1] = sm * x[i+1] % mod\nprint(ans % mod)\n", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "fft"], "code_uid": "8ac424ed6c313f59ec3ee844c44cc663", "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import trunc\n\nMOD = 998244353\nMODF = float(MOD)\nSHRT = float(1 << 16)\n\n# Using pajenegod's crazy method for multiplication using floating point\nfmod = lambda x: x - MODF * trunc(x / MODF)\nmod_prod = lambda a, b: fmod(trunc(a / SHRT) * fmod(b * SHRT) + (a - SHRT * trunc(a / SHRT)) * b)\ndef fpow(a, b):\n    r = 1.0\n    while b:\n        if b & 1: r = mod_prod(r, a)\n        a = mod_prod(a, a)\n        b >>= 1\n    return r\n\nn, k = map(int, input().split())\nf = [0] * (5 * n + 5)\nfor d in map(int, input().split()):\n    f[d] = 1\n\ndef ntt_transform(a, G, inv=False):\n    n, k = 1, 0\n    while n < len(a):\n        k += 1\n        n *= 2\n    a += [0] * (n - len(a))\n    \n    n2 = n // 2\n    w = [1] * n2\n    w[1] = fpow(G, (MOD - 1) // n)\n    if inv: w[1] = fpow(w[1], MOD - 2)\n    for i in range(2, n2):\n        w[i] = mod_prod(w[i - 1], w[1])\n\n    rev = [0] * n\n    for i in range(n):\n        rev[i] = rev[i >> 1] >> 1\n        if i & 1: rev[i] |= n2\n        if i < rev[i]: a[i], a[rev[i]] = a[rev[i]], a[i]\n\n    l = 2\n    while l <= n:\n        half, diff = l // 2, n // l\n        for i in range(0, n, l):\n            pw = 0\n            for j in range(i, i + half):\n                v = mod_prod(a[j + half], w[pw]);\n                a[j + half] = a[j] - v if a[j] - v >= 0 else a[j] - v + MOD\n                a[j] = a[j] + v if a[j] + v < MOD else a[j] + v - MOD\n                pw += diff\n        l *= 2\n\n    if inv:\n        inv_n = fpow(n, MOD - 2)\n        for i in range(n): a[i] = mod_prod(a[i], inv_n);\n\n\nntt_transform(f, 3)\nf = [fpow(x, n // 2) for x in f]\nntt_transform(f, 3, inv=True)\n\nans = sum(mod_prod(x, x) for x in f) % MODF\nprint(int(ans))", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "fft"], "code_uid": "8d98cd415af1275ea515db6837c0f2b3", "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from math import trunc\n\nMOD = 998244353\nMODF = float(MOD)\nSHRT = float(1 << 16)\nG = 3.0\nMAXSIZ = 1 << 20\n\n# Using pajenegod's crazy method for multiplication using floating point\nfmod = lambda x: x - MODF * trunc(x / MODF)\nmod_prod = lambda a, b: fmod(trunc(a / SHRT) * fmod(b * SHRT) + (a - SHRT * trunc(a / SHRT)) * b)\ndef fpow(a, b):\n    r = 1.0\n    while b:\n        if b & 1: r = mod_prod(r, a)\n        a = mod_prod(a, a)\n        b >>= 1\n    return r\n\nn, k = map(int, raw_input().split())\nf = [0.0] * MAXSIZ\nfor d in map(int, raw_input().split()):\n    f[d] = 1.0\n\nm = MAXSIZ\nm2 = m / 2\nw = [1] * m2\nw[1] = fpow(G, (MOD - 1) / m)\nfor i in range(2, m2):\n    w[i] = mod_prod(w[i - 1], w[1])\n\nrev = [0] * m\nfor i in range(m):\n    rev[i] = rev[i >> 1] >> 1\n    if i & 1: rev[i] |= m2\n\ndef ntt_transform(a):\n    for i in range(m):\n        if i < rev[i]: a[i], a[rev[i]] = a[rev[i]], a[i]\n    l = 2\n    while l <= m:\n        half, diff = l >> 1, m / l\n        for i in range(0, m, l):\n            pw = 0\n            for j in range(i, i + half):\n                v = mod_prod(a[j + half], w[pw])\n                a[j + half] = a[j] - v\n                a[j] = a[j] + v\n                pw += diff\n        l <<= 1\n\n\nntt_transform(f)\nf = [fpow(x, n >> 1) for x in f]\nntt_transform(f)\n\ninv_m = fpow(m, MOD - 2)\nans = mod_prod(sum(mod_prod(x, x) for x in f) % MODF, mod_prod(inv_m, inv_m))\nprint(int(ans))", "lang_cluster": "Python", "tags": ["divide and conquer", "dp", "fft"], "code_uid": "f408b742deae262308b8a1a46de5e360", "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\ndef solve(N,M,R):\n\twashing_days = 0.0\n\n\tfor d in range(720720):\n\t\tfor i in range(N):\n\t\t\tif d % M[i] == R[i]:\n\t\t\t\twashing_days += 1.0\n\t\t\t\tbreak\n\n\treturn washing_days / 720720\n\nlines = sys.stdin.readlines()\nN = int(lines[0].strip())\nM = map(int,lines[1].split())\nR = map(int,lines[2].split())\nprint solve(N,M,R)\n\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "591071ddfe41aad1ecea6c1be0af68f9", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\nm = map(int, raw_input().split())\nr = map(int, raw_input().split())\n\ngood = 0\nfor d in range(1000000):\n    for i in range(len(m)):\n        if d % m[i] == r[i]:\n            good += 1\n            break\nprint 1. * good / 1000000\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "e060cdcbd140d5be67668709c2b58535", "src_uid": "14b69f42bc192ea472e82f3a3209f1c1", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "class State:\n  __slots__ = ['candidate', 'votes', 'last_vote']\n\n  def __init__(self, cand, votes, last):\n    self.candidate = cand\n    self.votes = votes\n    self.last_vote = last\n\n  def beats(self, other, extra):\n    return self.votes + extra > other.votes\n\ndef main():\n  candidates, seats, people, voted = map(int, input().split())\n  votes = [0 for i in range(candidates)]\n  last_vote = [0 for i in range(candidates)]\n\n  if candidates == 1:\n    print(1)\n    return\n\n  v = list(map(int, input().split()))\n  for t in range(voted):\n    cand = v[t] - 1\n    votes[cand] += 1\n    last_vote[cand] = t\n\n  states = [State(i, votes[i], last_vote[i]) for i in range(candidates)]\n  states = sorted(states, key = lambda x : (x.votes, -x.last_vote))\n  res = [0 for i in range(candidates)]\n\n  for i in range(candidates):\n    if i < candidates - seats:\n      low = candidates - seats\n      if states[i].beats(states[low], people - voted):\n        res[states[i].candidate] = 2\n      else:\n        res[states[i].candidate] = 3\n    else:\n      extra = people - voted\n      other = i - 1\n      place = i\n\n      if extra == 0 and states[i].votes == 0:\n        res[states[i].candidate] = 3\n        continue\n\n      while other >= 0 and extra > 0:\n        needed = states[i].votes - states[other].votes + 1\n        if needed <= extra:\n          extra -= needed;\n          place -= 1\n          other -= 1\n        else:\n          break\n\n      res[states[i].candidate] = (1 if place + seats >= candidates and states[i].votes > 0 else 2)\n\n  for i in res:\n    print(i, end = ' ')\n\nmain()\n", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "d76e5c9415856d6f71ebcca6c3181cb8", "src_uid": "81a890bd542963bbcec7a041dde5c247", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from copy import deepcopy\nn, k, m, a = [int(i) for i in input().split()]\ncn = [0] * (n + 1)\nlast = [-1] * (n + 1)\nv = [int(i) for i in input().split()]\n\nfor i in range(len(v)):\n    last[v[i]] = i\n    cn[v[i]] += 1\n\ncn1 = deepcopy(cn)\nlast1 = deepcopy(last)\n\n\nfor i in range(1, n + 1):\n    cn = deepcopy(cn1)\n    last = deepcopy(last1)\n    res = [i1 for i1 in range(1, n + 1)]\n    res.sort(key=lambda x: (cn[x], -last[x]), reverse = True)\n    #print(res)\n    \n    for j in range(len(res)):\n        if res[j] != i:\n            continue\n        j1 = j + 1\n        lft = m - a\n        while j1 < n and lft:\n            pls = min(lft, cn[i] - cn[res[j1]] + 1)\n            cn[res[j1]] += min(lft, cn[i] - cn[res[j1]] + 1)\n            last[res[j1]] = m\n            lft -= pls\n            j1 += 1\n\n    \n    res.sort(key=lambda x: (cn[x], -last[x]), reverse = True)\n    sans = 0\n    for j in range(len(res)):\n        if res[j] != i:\n            continue\n        if cn[i] == 0 or j >= k:\n            sans = 0\n        else:\n            sans = 1\n        break\n\n    if sans == 1:\n        print(1, end= ' ')\n        continue\n    \n    cn = deepcopy(cn1)\n    last = deepcopy(last1)\n\n    if m - a:\n        cn[i] += m - a\n        last[i] = m - 1\n\n    res.sort(key=lambda x: (cn[x], 0 -last[x]), reverse = True)\n    for j in range(len(res)):\n        if res[j] != i:\n            continue\n        if cn[i] == 0 or j >= k:\n            sans = 0\n        else:\n            sans = 1\n        break\n    \n    if sans:\n        print(2, end=' ')\n    else:\n        print(3, end=' ')\n", "lang_cluster": "Python", "tags": ["sortings", "greedy"], "code_uid": "fca66ea06477bbb17bb03371a26dd3e9", "src_uid": "81a890bd542963bbcec7a041dde5c247", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n, m = map(int, input().split())\nprev_points = [[] for _ in range(n)]\nfor _ in range(m):\n    u, v = map(int, input().split())\n    u -= 1\n    v -= 1\n    prev_points[v].append(u)\nk = int(input())\np = [int(pi) - 1 for pi in input().split()]\nbest_ways_d = [-1] * n\nbest_ways_nm1 = [0] * n\nq = [(p[-1], 0)]\nfor u, d in q:\n    if best_ways_d[u] < 0:\n        best_ways_d[u] = d\n        d += 1\n        for v in prev_points[u]:\n            q.append((v, d))\n    elif best_ways_d[u] == d:\n        best_ways_nm1[u] += 1\nans1 = ans2 = 0\nfor i in range(1, k):\n    u, v = p[i - 1], p[i]\n    if best_ways_d[u] <= best_ways_d[v]:\n        ans1 += 1\n        ans2 += 1\n    elif best_ways_nm1[u]:\n        ans2 += 1\nprint(ans1, ans2)\n", "lang_cluster": "Python", "tags": ["shortest paths", "graphs"], "code_uid": "8ae53072740df8997db34c32fc2edf99", "src_uid": "19a0c05eb2d1559ccfe60e210c6fcd6a", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom collections import deque\ninput = lambda : sys.stdin.readline().strip()\n# for i in range(int(input())):\nn,m = map(int,input().split())\ng = {}\nfor i in range(m):\n    a,b = map(int,input().split())\n    if b-1 in g:\n        g[b-1].append(a-1)\n    else:\n        g[b-1]=[a-1]\nk = int(input())\nway = list(map(lambda x: int(x)-1,input().split()))\nbfs = deque()\nbfs.append(way[-1])\nlvl = [-1]*n\nans = [0]*n\na = [set() for j in range(n)]\nlvl[way[-1]]=0\nwhile bfs:\n    v = bfs.popleft()\n    for u in g[v]:\n        if lvl[u]==-1:\n            lvl[u]=lvl[v]+1\n            a[u].add(v)\n            bfs.append(u)\n        elif lvl[u]==lvl[v]+1:\n            ans[u]=1\n            a[u].add(v)\nansv = 0\nans1 = 0\nfor v in range(k-1):\n    if k-v-1!=lvl[way[v]] and way[v+1] not in a[way[v]]:\n        ans1+=1\n    elif k-v-1 == lvl[way[v]]:\n        break\nfor v in range(k-1):\n    if ans[way[v]] or  a[way[v]].pop()!=way[v+1]:#\n        ansv +=1\n\nprint(ans1,ansv)\n", "lang_cluster": "Python", "tags": ["shortest paths", "graphs"], "code_uid": "67e988d292e3e0db601fd0b61890096e", "src_uid": "19a0c05eb2d1559ccfe60e210c6fcd6a", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def nextc(m):\n    m2 = {}\n    for n, c in m.iteritems():\n        h = n-1 >> 1\n        m2[h] = m2.get(h, 0) + c\n        m2[n-1 - h] = m2.get(n-1 - h, 0) + c\n    return m2\n\ndef countseg(l, s, cache={}):\n    if s > l: return 0\n    if s == l: return 1\n    if (l, s) in cache:\n        return cache[l, s]\n    h = l-1 >> 1\n    out = countseg(h, s) + countseg(l-1 - h, s)\n    cache[l, s] = out\n    return out\n    \ndef findx(l, q, ss):\n    if l <= max(ss):\n        return (l-1 >> 1) + q\n    h = l-1 >> 1\n    ns = sum(countseg(h, s) for s in ss)\n    if q >= ns:\n        return h + 1 + findx(l-1 - h, q - ns, ss)\n    else:\n        return findx(h, q, ss)\n\ndef f(l, r):\n    m = {l: 1, l-1: 0}\n    q = 1\n    while r >= q and min(m) > 2:\n        r -= q\n        q <<= 1\n        m = nextc(m)\n    mn, mx = min(m), max(m)\n    if mx & 1:\n        if r >= m[mx]:\n            if mx == 3:\n                return findx(l, r - m[mx], [1,2])\n            return findx(l, r - m[mx], [mn])\n        else:\n            return findx(l, r, [mx])\n    else:\n        return findx(l, r, [mn, mx])\n\ndef ans(n, k):\n    if k == 1: return 1\n    if k == 2: return n\n    return 2 + f(n - 2, k - 3)\n    \ndef brute_ans(n, k):\n    if k == 1: return 1\n    if k == 2: return n\n    return 2 + brute_f(n - 2, k - 2)\n    \ndef brute_f(l, r):\n    s = [(0, l)]\n    for _ in xrange(r):\n        i = max(xrange(len(s)), key=lambda j: s[j][1]-1 >> 1)\n        x, d = s[i]\n        h = d-1 >> 1\n        s = s[:i] + [(x, h), (x+h+1, d-1-h)] + s[i+1:]\n    return x+h\n\ndef test_n(n):\n    for i in xrange(1, n + 1):\n        assert brute_ans(n, i) == ans(n, i)\n\nif __name__ == '__main__':\n    n, k = map(int, raw_input().split())\n    print ans(n, k)\n", "lang_cluster": "Python", "tags": ["constructive algorithms", "binary search", "implementation"], "code_uid": "aeb9f5c461d4f33ed184bea63a2afbd9", "src_uid": "eb311bde6a0e3244d92fafbd4aa1e61f", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "dp = {}\ndef count(n, low):\n\tk = (n, low)\n\tif k in dp: return dp[k]\n\tl1 = (n-1)/2\n\tif l1 < low: return 0\n\tl2 = n - 1 - l1\n\tdp[k] = 1 + count(l1, low) + count(l2, low)\n\treturn dp[k]\n\ndef getPos(l, r, low, want):\n\tm = (l+r)/2\n\n\twant -= 1\n\tif want == 0: return m\n\n\tc1 = count(m-l, low)\n\tc2 = count(r-m, low+1)\n\n\tif c1+c2 >= want:\n\t\treturn getPos(l, m-1, low, want-c2)\n\telse:\n\t\treturn getPos(m+1, r, low, want-c1)\n\nn,k = map(int, raw_input().split())\nif k == 1: print 1\nelif k == 2: print n\nelse:\n\tlo, hi = 0, n+1\n\twhile lo < hi:\n\t\tmid = (lo + hi + 1) / 2\n\t\tif count(n-2, mid) >= k-2:\n\t\t\tlo = mid\n\t\telse:\n\t\t\thi = mid-1\n\tprint getPos(2,n-1,lo,k-2)", "lang_cluster": "Python", "tags": ["constructive algorithms", "binary search", "implementation"], "code_uid": "634a3756bf4e12e8c14236b1e8e0a8a7", "src_uid": "eb311bde6a0e3244d92fafbd4aa1e61f", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\n\ndef solve():\n    n = int(input())\n    if n == 1: return 0\n    res = 1000000\n    for other in range(n - 1, 0, -1):\n        pair = [n, other]\n        temp = 0\n        while (pair[0] > 1 or pair[1] > 1) and (pair[0] > 0 and pair[1] > 0):\n            if pair[0] > pair[1]: pair[0], pair[1] = pair[1], pair[0]\n            pair[1] -= pair[0]\n            temp+=1\n            if temp > res: break\n        if pair[0] == 1 and pair[1] == 1: res = min(res, temp)\n    return res\n\n\n\nif sys.hexversion == 50594544 : sys.stdin = open(\"test.txt\")\nprint(solve())", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "number theory", "brute force"], "code_uid": "9fa6cc9d0173a62a2eb3fdfd3de11972", "src_uid": "75739f77378b21c331b46b1427226fa1", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def solve(N, M):\n    ans = 0\n    while M > 1:\n        ans += N // M\n        N, M = M, N % M\n    if M == 0: return 1000000\n    return N - 1 + ans\n\nN = int(input())\nans = 1000000\nfor M in range(1, N + 1):\n    ans = min([ans, solve(N, M)])\nprint(ans)", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "number theory", "brute force"], "code_uid": "3818cf5adb2d092afa6a5852c5fe7997", "src_uid": "75739f77378b21c331b46b1427226fa1", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "MOD = 1000000007\ndef isSubset(a, b):\n    return (a & b) == a\ndef isIntersect(a, b):\n    return (a & b) != 0\ndef cntOrder(s, t):\n    p = len(s)\n    m = len(t)\n    inMask = [0 for i in range(m)]\n    for x in range(p):\n        for i in range(m):\n            if t[i] % s[x] == 0:\n                inMask[i] |= 1 << x\n    cnt = [0 for mask in range(1 << p)]\n    for mask in range(1 << p):\n        for i in range(m):\n            if isSubset(inMask[i], mask):\n                cnt[mask] += 1\n    dp = [[0 for mask in range(1 << p)] for k in range(m + 1)]\n    for i in range(m):\n        dp[1][inMask[i]] += 1\n    for k in range(m):\n        for mask in range(1 << p):\n            for i in range(m):\n                if not isSubset(inMask[i], mask) and isIntersect(inMask[i], mask):\n                    dp[k + 1][mask | inMask[i]] = (dp[k + 1][mask | inMask[i]] + dp[k][mask]) % MOD\n            dp[k + 1][mask] = (dp[k + 1][mask] + dp[k][mask] * (cnt[mask] - k)) % MOD\n    return dp[m][(1 << p) - 1]\ndef dfs(u):\n    global a, graph, degIn, visited, s, t\n\n    visited[u] = True\n    if degIn[u] == 0:\n        s.append(a[u])\n    else:\n        t.append(a[u])\n\n    for v in graph[u]:\n        if not visited[v]:\n            dfs(v)\ndef main():\n    global a, graph, degIn, visited, s, t\n    n = int(input())\n    a = list(map(int, input().split()))\n    c = [[0 for j in range(n)] for i in range(n)]\n    for i in range(n):\n        c[i][0] = 1\n        for j in range(1, i + 1):\n            c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD\n    degIn = [0 for u in range(n)]\n    graph = [[] for u in range(n)]\n    for u in range(n):\n        for v in range(n):\n            if u != v and a[v] % a[u] == 0:\n                graph[u].append(v)\n                graph[v].append(u)\n                degIn[v] += 1\n    ans = 1\n    curLen = 0\n    visited = [False for u in range(n)]\n    for u in range(n):\n        if not visited[u]:\n            s = []\n            t = []\n            dfs(u)\n            if len(t) > 0:\n                sz = len(t) - 1\n                cnt = cntOrder(s, t)\n                ans = (ans * cnt) % MOD\n                ans = (ans * c[curLen + sz][sz]) % MOD\n                curLen += sz\n    print(ans)\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics", "bitmasks"], "code_uid": "a02dd26757f5a326ad10be8b966f9531", "src_uid": "c8d43a60ddc0a7b98a7269dc3a2478dc", "difficulty": 3500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def inv(a):\n\treturn pow(a, MOD-2, MOD) %MOD\n\ndef fat(a):\n\tans = 1\n\tfor i in range(1, a+1):\n\t\tans = (ans*i)%MOD\n\treturn ans\n\nMOD = 998244353\nn, m, k = map(int, input().split())\np = inv(m)\n\n# O(Burro) O(n2)-> F\u00f3rmula da experan\u00e7a = sum(x^k * C(n, x) * p^x * q^(n-x))\n'''\nresp = 0\nq = (1 - p + MOD) % MOD\nfor x in range(1, n+1):\n\tresp += pow(x, k, MOD) %MOD * fat(n) %MOD * invfat(n-x) %MOD * invfat(x) %MOD *pow(p, x, MOD) %MOD * pow(q, n-x, MOD) %MOD\n'''\n# O(menos burro) O(nlog(k)) -> atualiza somat\u00f3rio usando valores ja calculados\nif n<=k:\n\tq = (1 - p + MOD) % MOD\n\tinv_q = inv(q)\n\tp_aux = p\n\tq_aux = pow(q, n-1, MOD)\n\tfn = n\n\tresp = n * p%MOD * q_aux%MOD\n\tresp = resp%MOD\n\n\tfor i in range(2, n+1):\n\t\tx = pow(i, k, MOD)\n\t\tp_aux = p_aux * p %MOD\n\t\tq_aux = q_aux * inv_q\t\n\t\tfn = fn*(n-i+1)%MOD*inv(i)%MOD\n\t\t\n\t\tresp = resp + x * fn %MOD * p_aux %MOD * q_aux %MOD\n\t\tresp = resp%MOD\n\tprint(resp)\n\n# O(inteligente) O(k2) -> A partir da FGM M(X), identifica padr\u00e3o das derivadas\n# k-\u00e9sima derivada de M(X) = E(x^k)\n# E(x^k) = n!/(n-k)! * p^k + k*(deriv[k-1] - sum(ind[i]*deriv[i])) + sum(ind[i]*deriv[i+1])\nelse:\n\tderiv = [(n*p)%MOD] #E(x) = np\n\tresp = n*n%MOD*p%MOD*p%MOD - n*p%MOD*p%MOD + n*p%MOD #E(x^2) = n^2p^2 - np^2 + np\n\tderiv.append(resp%MOD)\n\tfn = (n*(n-1))%MOD\n\tv=[1];\n\t\n\tfor i in range(3, k+1):\n\t\tfn = (fn * (n-i+1) %MOD)%MOD\n\t\tw = [(-(i-1)*v[0])%MOD]\t\n\t\tfor j in range(len(v)-1):\n\t\t\tw.append((v[j] - (i-1)*v[j+1]%MOD)%MOD) \n\t\tw.append((v[-1] + i-1)%MOD)\n\t\tv = tuple(w)\n\n\t\tresp = (fn * pow(p, i, MOD))%MOD\n\t\tfor j in range(len(v)):\n\t\t\tresp = (resp + v[j]*deriv[j]%MOD)%MOD\t\n\t\t\tresp = resp%MOD\n\t\tresp %= MOD\n\t\tderiv.append(resp)\n\n\tprint(deriv[k-1])\n\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "probabilities", "number theory"], "code_uid": "0dd160f49bbcf0c3a3e41b64c46fcef0", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "dp=[0]*5010\ndp[0]=1\nn,m,k=map(int,input().split())\nt=998244353\nfor i in range(k):\n    for j in range(len(dp)-1, -1, -1):\n        if j==0:dp[j]=0\n        else:dp[j]=(dp[j-1]*(n-j+1)+dp[j]*j)%t\nc=0\nfor i in range(k+1):\n    c+=pow(m,max(n-i,0),t)*dp[i]\n    c%=t\nden=pow(m,n,t)\nden=pow(den,t-2,t)\nprint((den*c)%t)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "probabilities", "number theory"], "code_uid": "01fb9648b03f2d50760c397d7edfb411", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from sys import stdin, stdout\nimport math\nfrom collections import defaultdict\n\ndef Comb(nn,rr):\n    f = math.factorial\n    return f(nn) / f(rr) / f(nn-rr)\n\n\nn,k,S = [int(x) for x in stdin.readline().split()]\na = [int(x) for x in stdin.readline().split()]\n\naset = set(a)\nalist = list(aset)\nalist.sort()\n\nplist = []\nfor i in alist:\n\tplist.append((i,a.count(i)))\n\noplist = []\nfor x,c in plist:\n\ttlist = []\n\tif x > 18:\n\t\tfor i in xrange(c+1):\n\t\t\ttlist.append((i*x,0,Comb(c,i)))  # (amount added, stickers used, multiplier)\n\telse:\n\t\txfact = math.factorial(x)\n\t\tfor nf in xrange(c+1):\n\t\t\tfor i in xrange(nf,c+1):\n\t\t\t\ttlist.append((nf*xfact+(i-nf)*x, nf, Comb(c,i)*Comb(i,nf)))\n\toplist.append(tlist)\n\n'''\nprint plist\nfor tlist in oplist:\n\tprint tlist\n\t\nb = list(a)\nc = [False for x in a]\nfor i in xrange(len(b)):\n\tif b[i] < 19:\n\t\tb[i] = math.factorial(b[i])\n\t\tc[i] = True\n'''\n\ndef rec(mult,d,l,i,f,nn,s=0):\n\tif i < nn:\n\t\tfor add, nf, mm in oplist[i]:\n\t\t\tx = s + add\n\t\t\tff = f + nf\n\t\t\tif x <= S and ff <= k:\n\t\t\t\tif add > 0:\n\t\t\t\t\tl.add(x)\n\t\t\t\t\td[ff][x] += mult*mm\n\t\t\t\trec(mult*mm, d, l, i+1, ff, nn, x)\n\t\t\t\t\n'''\ndef rec(d,l,i,f,nn,s=0):\n\tif i < nn:\n\t\trec(d,l,i+1,f,nn,s)\n\t\tx = s+a[i]\n\t\tif x <= S:\n\t\t\trec(d,l,i+1,f,nn,x)\n\t\t\tl.add(x)\n\t\t\td[f][x] += 1\n\t\tif c[i] and f < k:\n\t\t\tx = s+b[i]\n\t\t\tif x <= S:\n\t\t\t\trec(d,l,i+1,f+1,nn,x)\n\t\t\t\tl.add(x)\n\t\t\t\td[f+1][x] += 1\n'''\t\n\t\t\t\t\nn = len(alist)\n\t\t\t\t\ndl1 = [defaultdict(int) for i in xrange(k+1)]\ndl1[0][0] = 1\nnn = n/2\ns = set()\nrec(1,dl1,s,0,0,nn)\nl1 = list(s)\nl1.append(0)\ndl2 = [defaultdict(int) for i in xrange(k+1)]\ndl2[0][0] = 1\ns = s = set()\nrec(1,dl2,s,nn,0,n)\nl2 = list(s)\nl2.append(0)\n\ncount = 0\nl1.sort()\nl2.sort(reverse=True)\ni = 0\nj = 0\n\nwhile i < len(l1):\n\twhile l2[j] > S - l1[i]:\n\t\tj += 1\n\tif l1[i] + l2[j] == S:\n\t\tfor m in xrange(k+1):\n\t\t\tfor r in xrange(m+1):\n\t\t\t\tcount += dl1[r][l1[i]] * dl2[m-r][l2[j]]\n\ti += 1\n\nprint count", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "binary search", "bitmasks", "meet-in-the-middle"], "code_uid": "ef77c00bd774f3222fea9fccc6fff168", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from math import factorial\nfrom collections import defaultdict\ndef main():\n    n, k, s = map(int, raw_input().split())\n    a = map(int, raw_input().split())\n    def f(b):\n        res = [defaultdict(int) for _ in xrange(k + 1)]\n        res[k][0] = 1\n        for x in b:\n            nr = [defaultdict(int) for _ in xrange(k + 1)]\n            for j in xrange(k + 1):\n                for y, t in res[j].viewitems():\n                    if j and x <= 18 and factorial(x) + y <= s:\n                        nr[j-1][factorial(x) + y] += t\n                    if x + y <= s:\n                        nr[j][x + y] += t\n                    nr[j][y] += t\n            res = nr\n        return res\n    def g(b):\n        res = [defaultdict(int) for _ in xrange(k + 1)]\n        res[k][s] = 1\n        for x in b:\n            nr = [defaultdict(int) for _ in xrange(k + 1)]\n            for j in xrange(k + 1):\n                for y, t in res[j].viewitems():\n                    if j and x <= 18 and y - factorial(x) >= 0:\n                        nr[j-1][y - factorial(x)] += t\n                    if y - x >= 0:\n                        nr[j][y - x] += t\n                    nr[j][y] += t\n            res = nr\n        return res\n    dl = f(a[:n/2])\n    dr = g(a[n/2:])\n    ans = 0\n    for i, d in enumerate(dl):\n        for x, t in d.viewitems():\n            for j in xrange(k - i, k + 1):\n                ans += t * dr[j][x]\n    print ans\nmain()\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "binary search", "bitmasks", "meet-in-the-middle"], "code_uid": "a8806abd2c0af32456dc0d9fb747871c", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from math import factorial\nfac = factorial\n\ndef dfs(lst):\n    sums = [{} for i in xrange(k+1)]\n    sums[0][0]=1\n    while len(lst)>0:\n        cur = lst.pop(0)\n        temp = [item.copy() for item in sums]\n        for i in xrange(k+1):\n            for j in temp[i]:\n                if j + cur <=s:\n                    if j + cur not in sums[i]:\n                        sums[i][j + cur] = temp[i][j]\n                    else:\n                        sums[i][j + cur] += temp[i][j]\n                    if cur<19 and i<k and j+fac(cur)<=s:\n                        if j+fac(cur) not in sums[i+1]:\n                            sums[i+1][j+fac(cur)] = temp[i][j]\n                        else:\n                            sums[i+1][j+fac(cur)] += temp[i][j]\n    return sums\n\n\nn, k, s = map(int, raw_input().split())\na = [int(item) for item in raw_input().split()]\na.sort()\n\nfirst = dfs(a[:n/2])\nsecond = dfs(a[n/2:])\n\ncount = 0\nfor i in xrange(k+1):\n    for sum1 in first[i]:\n        for kk in xrange(k-i+1):\n            if s-sum1 in second[kk]:\n                count += first[i][sum1]*second[kk][s-sum1]\nprint count", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "binary search", "bitmasks", "meet-in-the-middle"], "code_uid": "37a380f175f6721b975684759296a19f", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "fact = [ 1 ]\nfor i in range( 1, 20, 1 ):\n  fact.append( fact[ i - 1 ] * i )\n\nfrom collections import defaultdict\n\nN, K, S = map( int, input().split() )\nA = list( map( int, input().split() ) )\n\nldp = [ [ defaultdict( int ) for i in range( K + 1 ) ] for j in range( 2 ) ]\nldp[ 0 ][ 0 ][ 0 ] = 1\nfor i in range( N // 2 ):\n  for j in range( K + 1 ):\n    ldp[ ~ i & 1 ][ j ].clear()\n  for j in range( K + 1 ):\n    for key in ldp[ i & 1 ][ j ]:\n      ldp[ ~ i & 1 ][ j ][ key ] += ldp[ i & 1 ][ j ][ key ] # toranai\n      ldp[ ~ i & 1 ][ j ][ key + A[ i ] ] += ldp[ i & 1 ][ j ][ key ] # toru\n      if j + 1 <= K and A[ i ] <= 18:\n        ldp[ ~ i & 1 ][ j + 1 ][ key + fact[ A[ i ] ] ] += ldp[ i & 1 ][ j ][ key ] # kaijyou totte toru\n\nrdp = [ [ defaultdict( int ) for i in range( K + 1 ) ] for j in range( 2 ) ]\nrdp[ 0 ][ 0 ][ 0 ] = 1\nfor i in range( N - N // 2 ):\n  for j in range( K + 1 ):\n    rdp[ ~ i & 1 ][ j ].clear()\n  for j in range( K + 1 ):\n    for key in rdp[ i & 1 ][ j ]:\n      rdp[ ~ i & 1 ][ j ][ key ] += rdp[ i & 1 ][ j ][ key ]\n      rdp[ ~ i & 1 ][ j ][ key + A[ N // 2 + i ] ] += rdp[ i & 1 ][ j ][ key ]\n      if j + 1 <= K and A[ N // 2 + i ] <= 18:\n        rdp[ ~ i & 1 ][ j + 1 ][ key + fact[ A[ N // 2 + i ] ] ] += rdp[ i & 1 ][ j ][ key ]\n\nans = 0\nfor i in range( K + 1 ):\n  for key in ldp[ N // 2 & 1 ][ i ]:\n    for j in range( 0, K - i + 1, 1 ):\n      ans += ldp[ N // 2 & 1 ][ i ][ key ] * rdp[ N - N // 2 & 1 ][ j ][ S - key ]\n\nprint( ans )\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "binary search", "bitmasks", "meet-in-the-middle"], "code_uid": "8dd9b2a326d42adc9a38ff003b1b5aaa", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from sys import stdin, stdout\nimport math\nfrom collections import defaultdict\n\ndef Comb(nn,rr):\n    f = math.factorial\n    return f(nn) / f(rr) / f(nn-rr)\n\nn,k,S = [int(x) for x in stdin.readline().split()]\na = [int(x) for x in stdin.readline().split()]\n\naset = set(a)\nalist = list(aset)\nalist.sort()\n\nplist = []\nfor i in alist:\n\tplist.append((i,a.count(i)))\n\noplist = []\nfor x,c in plist:\n\ttlist = []\n\tif x > 18:\n\t\tfor i in xrange(c+1):\n\t\t\ttlist.append((i*x,0,Comb(c,i)))  # (amount added, stickers used, multiplier)\n\telse:\n\t\txfact = math.factorial(x)\n\t\tfor nf in xrange(c+1):\n\t\t\tfor i in xrange(nf,c+1):\n\t\t\t\ttlist.append((nf*xfact+(i-nf)*x, nf, Comb(c,i)*Comb(i,nf)))\n\toplist.append(tlist)\n\n\ndef rec(mult,d,l,i,f,nn,s=0):\n\tif i < nn:\n\t\tfor add, nf, mm in oplist[i]:\n\t\t\tx = s + add\n\t\t\tff = f + nf\n\t\t\tif x <= S and ff <= k:\n\t\t\t\tif add > 0:\n\t\t\t\t\tl.add(x)\n\t\t\t\t\td[ff][x] += mult*mm\n\t\t\t\trec(mult*mm, d, l, i+1, ff, nn, x)\n\t\t\t\t\n\t\t\t\t\nn = len(alist)\n\n\nhalflist1 = []\nhalflist2 = []\noplist.reverse()\nhl1 = 1\nhl2 = 1\nfor i in xrange(n):\n\tif hl1 <= hl2:\n\t\thl1 *= len(oplist[i])\n\t\thalflist1.append(oplist[i])\n\telse:\n\t\thl2 *= len(oplist[i])\n\t\thalflist2.append(oplist[i])\n\noplist = halflist1 + halflist2\n\n\t\t\t\t\ndl1 = [defaultdict(int) for i in xrange(k+1)]\ndl1[0][0] = 1\nnn = n/2\ns = set()\nrec(1,dl1,s,0,0,nn)\nl1 = list(s)\nl1.append(0)\ndl2 = [defaultdict(int) for i in xrange(k+1)]\ndl2[0][0] = 1\ns = s = set()\nrec(1,dl2,s,nn,0,n)\nl2 = list(s)\nl2.append(0)\n\ncount = 0\nl1.sort()\nl2.sort(reverse=True)\ni = 0\nj = 0\n\nwhile i < len(l1):\n\twhile l2[j] > S - l1[i]:\n\t\tj += 1\n\tif l1[i] + l2[j] == S:\n\t\tfor m in xrange(k+1):\n\t\t\tfor r in xrange(m+1):\n\t\t\t\tcount += dl1[r][l1[i]] * dl2[m-r][l2[j]]\n\ti += 1\n\nprint count", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "binary search", "bitmasks", "meet-in-the-middle"], "code_uid": "3dbbbfa9ad8a299e5f1bbf25407bbc11", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\n\nimport itertools\n\nfrom collections import defaultdict\n\n\nfactorials = [1] * 19\n\nfor i in range(1, 19):\n    factorials[i] = i * factorials[i - 1]\n\n\ndef cumsum(l):\n    n = len(l)\n    for i in range(1, n):\n        l[i] += l[i-1]\n\n\ndef enum(l):\n\n    global K, S\n\n    options = itertools.product(*([(0, 1, 2)] * len(l)))\n\n    d = defaultdict(lambda: [0] * (25 + 1))\n\n    for opts in options:\n\n        s = 0\n        marks = 0\n        for i, opt in enumerate(opts):\n\n            if s > S:\n                break\n\n            if opt == 1:\n                s += l[i]\n            elif opt == 2:\n                if l[i] <= 18:\n                    s += factorials[l[i]]\n                    marks += 1\n                else:\n                    s = S + 1\n\n        if s <= S:\n            d[s][marks] += 1\n\n    return d\n\n\n[n, K, S] = map(int, sys.stdin.next().split(' '))\nl = sorted(map(int, sys.stdin.next().split(' ')))\n\np1 = enum(l[:(len(l) / 2)][::-1])\np2 = enum(l[(len(l) / 2):][::-1])\n\nvariants = 0\nfor s in p1:\n    if S - s in p2:\n        m1 = p1[s]\n        m2 = p2[S - s]\n        cumsum(m2)\n        for (k1, c1) in enumerate(m1[:(K + 1)]):\n            c2 = m2[(K - k1)]\n            variants += c1 * c2\n\nprint(variants)\n", "lang_cluster": "Python", "tags": ["brute force", "math", "dp", "binary search", "bitmasks", "meet-in-the-middle"], "code_uid": "fce6d7e2d06e92a21e17eeef86b982e0", "src_uid": "2821a11066dffc7e8f6a60a8751cea37", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from bisect import bisect_left as bl\nfrom bisect import bisect_right as br\nimport heapq\nimport math\nfrom collections import *\nfrom functools import reduce,cmp_to_key\nimport sys\ninput = sys.stdin.readline\n \n# M = mod = 998244353\ndef factors(n):return sorted(list(set(reduce(list.__add__,([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))))\n# def inv_mod(n):return pow(n, mod - 2, mod)\n \ndef li():return [int(i) for i in input().rstrip('\\n').split(' ')]\ndef st():return input().rstrip('\\n')\ndef val():return int(input().rstrip('\\n'))\ndef li2():return [i for i in input().rstrip('\\n').split(' ')]\ndef li3():return [int(i) for i in input().rstrip('\\n')]\n\ndef find(a,mod,n):\n    rem = n - len(bin(a)[2:])\n    ans = 0\n    while rem:\n        temp = min(rem,50)\n        ans = (ans + 2**temp)%mod\n        rem -= temp\n    return ans\n\n\nn, k, m = li()\nf=[0 for i in range(k)]   \ns=0\nfor v in range(n):\n    tens = 10**v%k\n    f=[  (sum(   [f[(j+k-(x+1)*tens)%k] for x in range(9)] )+f[j])%m       for j in range(k)]\n    for x in range(9):\n        f[(x+1)*tens%k]+=1\n    if n-v-1==0:\n        s+=(f[0]%m)\n    else:\n        s+=f[0]*((10**(n-v-2)*9))%m\n    f[0]=0\nprint(s%m)", "lang_cluster": "Python", "tags": ["dp", "implementation"], "code_uid": "cfc3992651ea9f6d8271c6924208ad24", "src_uid": "656bf8df1e79499aa2ab2c28712851f0", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def main():\n    n, k, m = map(int, raw_input().split())\n    if k == 1:\n        print 9 * pow(10, n - 1, m) % m\n        return\n    if n == 1:\n        print len([i for i in xrange(1, 10) if i % k == 0]) % m\n        return\n    dp = [0] * k\n    for i in xrange(10):\n        if i % k:\n            dp[i%k] += 1\n    t = 10 % k\n    kk = [[i * j % k for j in xrange(11)] for i in xrange(k)]\n    for i in xrange(n - 1):\n        ndp = [0] * k\n        for j in xrange(1, k):\n            for l in xrange(i == n - 2, 10):\n                x = j + kk[t][l]\n                if x >= k:\n                    x -= k\n                if x:\n                    ndp[x] += dp[j]\n                    if ndp[x] >= m:\n                        ndp[x] -= m\n        for l in xrange(i == n - 2, 10):\n            if kk[t][l]:\n                ndp[kk[t][l]] += 1\n        dp = ndp[:]\n        t = kk[t][10]\n    print (9 * pow(10, n - 1, m) - sum(dp) % m + m) % m\nmain()\n", "lang_cluster": "Python", "tags": ["dp", "implementation"], "code_uid": "dce7babc9522304b2eaa9e2c33f13b68", "src_uid": "656bf8df1e79499aa2ab2c28712851f0", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n, m = map(int, raw_input().split())\nif n * m == 1:\n    print \"%.12f\" % 1.0\nelse:\n    print \"%.12f\" % (1.0 / n + 1.0 * (m - 1) / (n * m - 1) * (n - 1) / n)\n", "lang_cluster": "Python", "tags": ["probabilities", "math", "combinatorics"], "code_uid": "828d3db4dbd4d64f146ebdae9c97ffaa", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n\nfrom sys import stdin\n\ndef main():\n   N, M = map(int, stdin.readline().split())\n\n   if N == 1 and M == 1:\n      res = 1.0\n   else:\n      res = 1.0/N + (N-1)*1.0/N * (M-1) * 1.0 / (M*N-1)\n\n   print '%.9lf' % (res)\n\n   return 0\n\nif __name__ == '__main__': main()\n", "lang_cluster": "Python", "tags": ["probabilities", "math", "combinatorics"], "code_uid": "03be8026b078536ca65c51571d8185ad", "src_uid": "0b9ce20c36e53d4702869660cbb53317", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from collections import *\n\ncost = []\nfor _ in [0,1,2]: \n  cost.append(map(int, raw_input().split()))\nN = int(raw_input())\nd = defaultdict(int)\n\nfor n in xrange(1,N+1):\n  for i in xrange(3):\n    for j in xrange(3):\n      if i==j: continue\n      other = min(x for x in [0,1,2] if x!=i and x!=j)\n      way1 = d[n-1,i,other] + d[n-1,other,j] + cost[i][j]\n      way2 = 2*d[n-1,i,j] + d[n-1,j,i] + cost[i][other] + cost[other][j]\n      d[n,i,j] = min(way1,way2)\n\nprint d[N,0,2]", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "468f0bf3baa6374dc135928029a6bd43", "src_uid": "c4c20228624365e39299d0a6e8fe7095", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a = [map(int, raw_input().split()) for _ in xrange(3)]\nn = int(raw_input())\nr3 = range(3)\ndp = [[[0] * 3 for _ in r3] for i in range(41)]\nfor i in range(1, n+1):\n    for j in r3:\n        for k in r3:\n            if j == k: continue\n            dp[i][j][k] = a[j][k] + dp[i-1][j][3-j-k] + dp[i-1][3-j-k][k]\n            dp[i][j][k] = min(dp[i][j][k], dp[i-1][j][k] + a[j][3-j-k] + dp[i-1][k][j] + a[3-j-k][k] + dp[i-1][j][k])\n    for l in r3:\n        for j in r3:\n            for k in r3:\n                dp[i][j][k] = min(dp[i][j][k], dp[i][j][l] + dp[i][l][k])\nprint dp[n][0][2]\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "8ff34decc49c4abadef47547db6bac8d", "src_uid": "c4c20228624365e39299d0a6e8fe7095", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys,math\nfrom collections import defaultdict\nfrom io import BytesIO\n\nsys.stdin = BytesIO(sys.stdin.read())\ninput = lambda: sys.stdin.readline().rstrip('\\r\\n')\nn = int(input())\n#n,q = [int(x) for x in input().split(' ')]\narr = [int(x) for x in input().split(' ')]\n#sec = [set()] * n\nbasen = n\nsavearr = [min(10,x) for x in arr]\narr = [max(x-10,0) for x in arr]\n#print(savearr,arr)\n\nwhile n > 100:\n    if sum(arr) == 0:\n        break\n    dif = n - 100\n    for i in range(8,0,-1):\n        if arr[i-1] > 0:\n            n -= i * min(dif // i + 1, arr[i-1])\n            arr[i-1] -= min(dif // i + 1, arr[i-1])\n            break\n\nfor i in range(len(arr)):\n    arr[i] += savearr[i]\n\ncur = 0\ndot8 = set()\nwhile cur <= n and arr[-1] >= 0:\n    arr[-1] -= 1\n    dot8.add(cur)\n    cur += 8\n\ncur = 0\ndot7 = set()\nwhile cur <= n and arr[-2] >= 0:\n    arr[-2] -= 1\n    dot7.add(cur)\n    cur += 7\n    \ncur = 0\ndot6 = set()\nwhile cur <= n and arr[-3] >= 0:\n    arr[-3] -= 1\n    dot6.add(cur)\n    cur += 6\n    \ncur = 0\ndot5 = set()\nwhile cur <= n and arr[-4] >= 0:\n    arr[-4] -= 1\n    dot5.add(cur)\n    cur += 5\n    \ncur = 0\ndot4 = set()\nwhile cur <= n and arr[-5] >= 0:\n    arr[-5] -= 1\n    dot4.add(cur)\n    cur += 4\n    \ncur = 0\ndot3 = set()\nwhile cur <= n and arr[-6] >= 0:\n    arr[-6] -= 1\n    dot3.add(cur)\n    cur += 3\n    \ncur = 0\ndot2 = set()\nwhile cur <= n and arr[-7] >= 0:\n    arr[-7] -= 1\n    dot2.add(cur)\n    cur += 2\n#print(n,dot8,dot7)\n\nresdot = dot8\nnewdot = set()\nfor el7 in dot7:\n    for el in resdot:\n        if el7 + el <= n:\n            newdot.add(el7+el)\nresdot = newdot\nnewdot = set()\nfor el6 in dot6:\n    for el in resdot:\n        if el6 + el <= n:\n            newdot.add(el6+el)\nresdot = newdot\nnewdot = set()\nfor el5 in dot5:\n    for el in resdot:\n        if el5 + el <= n:\n            newdot.add(el5+el)\nresdot = newdot\nnewdot = set()\nfor el4 in dot4:\n    for el in resdot:\n        if el4 + el <= n:\n            newdot.add(el4+el)\nresdot = newdot\n#print(newdot)\nnewdot = set()\nfor el3 in dot3:\n    for el in resdot:\n        if el3 + el <= n:\n            newdot.add(el3+el)\nresdot = newdot\n#print(resdot,newdot,dot2)\nnewdot = set()\nfor el2 in dot2:\n    for el in resdot:\n        if el2 + el <= n:\n            newdot.add(el2+el)\n#print(newdot)\nm = max(newdot)\nprint(basen + m - n + (min(n-m,arr[0])))\n", "lang_cluster": "Python", "tags": ["dfs and similar", "greedy", "dp"], "code_uid": "c9354d9de3005fbadb199a58dffa5619", "src_uid": "8097e10157320524c0faed56f2bc4880", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import time\nimport random\nW = int(input())\nM = [int(a) for a in input().split()]\nA = [0] * 8\nsTime = time.time()\n\ns = 0\nmi = 10**20\nfor i in range(8):\n    if s + M[i]*(i+1) <= W:\n        s += M[i]*(i+1)\n        A[i] = M[i]\n    else:\n        t = (W-s)//(i+1)\n        s += t*(i+1)\n        A[i] += t\n    \n    if s <= W:\n        mi = min(mi, W-s)\n\nwhile time.time() - sTime < 1.7:\n    i = random.randrange(8)\n    a = random.randrange(2)\n    if W-s >= 20 or (s-W < 10 and a == 0):\n        if A[i] < M[i]:\n            A[i] += 1\n            s += (i+1)\n    else:\n        if A[i] > 0:\n            A[i] -= 1\n            s -= (i+1)\n\n    if s <= W:\n        mi = min(mi, W-s)\n\nprint(W-mi)", "lang_cluster": "Python", "tags": ["dfs and similar", "greedy", "dp"], "code_uid": "c0dd0a79eb63974a05de422f1526913d", "src_uid": "8097e10157320524c0faed56f2bc4880", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from sys import stdin, stdout\nfrom collections import Counter, defaultdict\nfrom itertools import permutations, combinations\nraw_input = stdin.readline\npr = stdout.write\n\n\ndef in_num():\n    return int(raw_input())\n\n\ndef in_arr():\n    return map(int,raw_input().split())\n\n\ndef pr_num(n):\n    stdout.write(str(n)+'\\n')\n\n\ndef pr_arr(arr):\n    pr(' '.join(map(str,arr))+'\\n')\n\n# fast read function for total integer input\n\ndef inp():\n    # this function returns whole input of\n    # space/line seperated integers\n    # Use Ctrl+D to flush stdin.\n    return map(int,stdin.read().split())\n\nrange = xrange # not for python 3.0+\nmod=10**9+7\nn,a,b,k=in_arr()\ndp=[[0 for i in range(n+1)] for j in range(k+1)]\ndp[0][a-1]=1\ndp[0][a]=(-1)%mod\nb-=1\nfor i in range(k):\n    temp=0\n    for j in range(n+1):\n        temp=(temp+dp[i][j])%mod\n        \n        if i and int(abs(b-j))>1:\n            temp-=dp[i-1][j]\n            temp%=mod\n        dp[i][j]=temp\n        if j<n:\n            x=int(abs(b-j))\n            x-=1\n            if x<=0:\n                continue\n            dp[i+1][max(0,j-x)]=(dp[i+1][max(0,j-x)]+temp)%mod\n            dp[i+1][min(n,j+x+1)]=(dp[i+1][min(n,j+x+1)]-temp)%mod\n            #dp[i+1][j]=(dp[i+1][j]-1)%mod\n            #dp[i+1][j+1]=(dp[i+1][j+1]+1)%mod\n        if i and int(abs(b-j))>1:\n            temp+=dp[i-1][j]\n            temp%=mod\n\nans=0\ntemp=0\nfor i in range(n):\n    temp+=dp[k][i]\n    temp%=mod\n    if int(abs(i-b))>1:\n        temp-=dp[k-1][i]\n        temp%=mod\n    ans+=temp\n    ans%=mod\n    \n    if int(abs(i-b))>1:\n        temp+=dp[k-1][i]\n        temp%=mod\npr_num(ans)\n\n            \n", "lang_cluster": "Python", "tags": ["dp", "combinatorics"], "code_uid": "2ba3a403df02f5cc18286fa0e3f6b653", "src_uid": "142b06ed43b3473513995de995e19fc3", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,a,b,k=map(int,input().split())\ndp=[[0 for i in range(n+2)] for j in range(2)]\ndp[0][a]=1\nnow=1\nlast=0\nmod=1000000007\nfor i in range(k):\n    for j in range(1,n+1):\n        d=max(abs(j-b)-1,0)\n        if j!=n:\n            dp[now][j+1]=(dp[last][j]%mod+dp[now][j+1]%mod)%mod\n            dp[now][min(j+d+1,n+1)]=(dp[now][min(j+d+1,n+1)]-dp[last][j])%mod\n        if j!=1:\n            dp[now][j]=(dp[now][j]-dp[last][j])%mod\n            dp[now][max(j-d,1)]=(dp[now][max(j-d,1)]%mod+dp[last][j]%mod)%mod\n    for i1 in range(1,n+2):\n        dp[now][i1]=(dp[now][i1]+dp[now][i1-1])%mod\n        dp[last][i1]=0\n    aux=now\n    now=last\n    last=aux\nprint(sum(dp[last])%mod)\n", "lang_cluster": "Python", "tags": ["dp", "combinatorics"], "code_uid": "f95c603f8d8c1828c51baa2a730e3a60", "src_uid": "142b06ed43b3473513995de995e19fc3", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#coding=utf-8\n\nMOD = 1000000007 \nn, m, g = map(int, raw_input().split())\n\n\nt = 0;\n\nC = 1\ntotal = 0\nif m == 0:\n  if n % 2 == 0:\n    if g == 0:\n      print 0\n    else:\n      print 1\n  else:\n    if g == 1:\n      print 0\n    else:\n      print 1\n  exit(0)\nif m == 1:\n  total = 1\n\nfor i in range(0, n):\n  #print i\n  total = C - total\n  C = (C * (m + i + 1) * pow(i + 1, MOD - 2, MOD) ) % MOD\n  #print C, total\n#C = (C * (m + n) * pow(n, MOD - 1, MOD) ) % MOD \nif g == 1:\n  print (total % MOD + MOD) % MOD \nelse:\n  print ((C - total + MOD) % MOD + MOD) % MOD\n", "lang_cluster": "Python", "tags": ["math", "combinatorics", "number theory"], "code_uid": "42e94e1ea6bd39ce6836b94e21a04739", "src_uid": "066dd9e6091238edf2912a6af4d29e7f", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\nMOD = 10**9+7\n\nN,M,G = map(int,raw_input().split())\n\nif M == 0:\n    print int(G!=N%2)\n    exit()\nif M == 1:\n    ans = int(G!=N%2)\n    for i in xrange(N):\n        if i%2 == G:\n            ans += 1\n    print ans\n    exit()\n\nD = [0 for i in xrange(N+1)]\nD[0] = 1\nfor i in xrange(1,N+1):\n    D[i] = D[i-1]*(i+M-1)%MOD*pow(i,MOD-2,MOD)%MOD\nans = 0\nfor i in xrange(N+1):\n    if i%2 == G:\n        a,b = N-i,M-1\n        ans = (ans+D[a])%MOD\nprint ans\n", "lang_cluster": "Python", "tags": ["math", "combinatorics", "number theory"], "code_uid": "f53ddd57dc3441fe225abb111e26aa1e", "src_uid": "066dd9e6091238edf2912a6af4d29e7f", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "N, T = map(int, input().split())\nA = [int(a) for a in input().split()]\nif sum(A) > N//2:\n    A = [1-a for a in A][::-1]\nK = sum(A)\nS = sum(A[-K:])\nM = K + 1\nP = 10**9+7\ninv = pow(N*(N-1)//2, P-2, P)\nX = [[0]*M for _ in range(M)]\nfor i in range(M):\n    if i > 0: X[i-1][i] = ((K-i+1)**2*inv)%P\n    if i < M-1: X[i+1][i] = (N-2*K+i+1)*(i+1)*inv%P\n    X[i][i] = (1-((K-i)**2*inv)-(N-2*K+i)*(i)*inv)%P\n\ndef ddd(n):\n    for i in range(1, 100):\n        if (n*i%P) < 100:\n            return (n*i%P), i\n    return -1, -1\ndef poww(MM, n):\n    if n == 1:\n        return MM\n    if n % 2:\n        return mult(poww(MM, n-1), MM)\n    return poww(mult(MM,MM), n//2)\ndef mult(M1, M2):\n    Y = [[0] * M for _ in range(M)]\n    for i in range(M):\n        for j in range(M):\n            for k in range(M):\n                Y[i][j] += M1[i][k] * M2[k][j]\n                Y[i][j] %= P\n    return Y\n\nX = poww(X, T)\n\nprint(X[S][K])\n", "lang_cluster": "Python", "tags": ["probabilities", "matrices", "dp", "combinatorics"], "code_uid": "e8840933e97b6b53649f090d15a097cd", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"Codeforces Round #553 (Div. 2)\n\nProblem F. Sonya and Informatics\n\n:author:         Kitchen Tong\n:mail:    kctong529@gmail.com\n\nPlease feel free to contact me if you have any question\nregarding the implementation below.\n\"\"\"\n\n__version__ = '1.8'\n__date__ = '2019-04-21'\n\nimport sys\n\n\ndef binom_dp():\n    dp = [[-1 for j in range(110)] for i in range(110)]\n    def calculate(n, k):\n        if n < k:\n            return 0\n        if n == k or k == 0:\n            return 1\n        if dp[n][k] > 0:\n            return dp[n][k]\n        else:\n            dp[n][k] = calculate(n-1, k-1) + calculate(n-1, k)\n        return dp[n][k]\n    return calculate\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):\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\ndef multiply(A, B, mod):\n    if not hasattr(B[0], '__len__'):\n        C = [sum(aij * B[j] % mod for j, aij in enumerate(ai)) for ai in A]\n    else:\n        C = [[0 for col in range(len(B[0]))] for row in range(len(A))]\n        len_A = len(A)\n        len_B = len(B)\n        for row in range(len_A):\n            if sum(A[row]) == 0:\n                continue\n            for col in range(len_B):\n                C[row][col] = sum(A[row][k] * B[k][col]\n                                  for k in range(len_B)) % mod\n    return C\n\ndef memoize(func):\n    memo = {}\n    def wrapper(*args):\n        M, n, mod = args\n        if n not in memo:\n            memo[n] = func(M, n, mod)\n        return memo[n]\n    return wrapper\n\n@memoize\ndef matrix_pow(M, n, mod):\n    # print(f'n is {n}')\n    if n == 2:\n        return multiply(M, M, mod)\n    if n == 1:\n        return M\n    sub_M = matrix_pow(M, n//2, mod)\n    if n % 2 == 0:\n        return multiply(sub_M, sub_M, mod)\n    return multiply(sub_M, matrix_pow(M, n - n//2, mod), mod)\n\ndef solve(n, k, a, binom, mod):\n    ones = sum(a)\n    zeros = n - ones\n    M = [[0 for col in range(zeros+1)] for row in range(zeros+1)]\n    for row in range(max(0, zeros-ones), zeros+1):\n        pre_zeros = row\n        pre_ones = zeros - pre_zeros\n        post_zeros = pre_ones\n        post_ones = ones - pre_ones\n        M[row][row] = (pre_ones * post_ones + pre_zeros * post_zeros\n                       + binom(zeros, 2) + binom(ones, 2))\n        if row > max(0, zeros-ones):\n            M[row-1][row] = pre_zeros * post_ones\n        if row < zeros:\n            M[row+1][row] = post_zeros * pre_ones\n    M = [matrix_pow(M, k, mod)[-1]]\n    b = [0] * (zeros + 1)\n    b[zeros - sum(a[:zeros])] = 1\n    C = multiply(M, b, mod)\n    return C[-1]\n\n\ndef main(argv=None):\n    mod = int(1e9) + 7\n    n, k = list(map(int, input().split()))\n    a = list(map(int, input().split()))\n    binom = binom_dp()\n    P = solve(n, k, a, binom, mod)\n    if P == 0:\n        print(0)\n    else:\n        Q = pow(binom(n, 2), k, mod)\n        print(P * modinv(Q, mod) % mod)\n    return 0\n\n\nif __name__ == \"__main__\":\n    STATUS = main()\n    sys.exit(STATUS)\n\n", "lang_cluster": "Python", "tags": ["probabilities", "matrices", "dp", "combinatorics"], "code_uid": "976d757025cf8de3d5471246814e7110", "src_uid": "77f28d155a632ceaabd9f5a9d846461a", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom array import array  # noqa: F401\n\n\ndef input():\n    return sys.stdin.buffer.readline().decode('utf-8')\n\n\nn, t = map(int, input().split())\n\ndp = [[[0] * 5 for _ in range(2 * t + 1)] for _ in range(n)]\ndp[0][0] = [0] + [1] * 4\n\nfor i in range(n - 1):\n    for j in range(min(2 * t, i + 1)):\n        if (j & 1) == 0:\n            for k in range(1, 4):\n                for l in range(k + 1, 5):\n                    # //\n                    dp[i + 1][j][l] += dp[i][j][k]\n                    # /\\\n                    dp[i + 1][j + 1][l] += dp[i][j][k]\n        else:\n            for k in range(4, 1, -1):\n                for l in range(k - 1, 0, -1):\n                    # \\\\\n                    dp[i + 1][j][l] += dp[i][j][k]\n                    # \\/\n                    dp[i + 1][j + 1][l] += dp[i][j][k]\n\nprint(sum(dp[-1][2 * t]))\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "03f15df154c07f50e292c876c37efaba", "src_uid": "6d67559744583229455c5eafe68f7952", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from itertools import permutations\n\nn, t = map(int, raw_input().split())\ndp = [[[0] * 4 for i in xrange(t * 2)] for j in xrange(n)]\n\nfor i in xrange(4):\n    dp[1][0][i] = i\n\nfor i in xrange(1, n - 1):\n    for j in xrange(t * 2):\n        for p, q in permutations(xrange(4), 2):\n            fr = dp[i][j][p]\n            if j & 1:\n                if p > q:\n                    dp[i + 1][j][q] += fr\n                elif j + 1 < t * 2:\n                    dp[i + 1][j + 1][q] += fr\n            else:\n                if p < q:\n                    dp[i + 1][j][q] += fr\n                elif j + 1 < t * 2:\n                    dp[i + 1][j + 1][q] += fr\n\nprint sum(dp[n - 1][t * 2 - 1][i] for i in xrange(4))\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "b392f450c1b369e5b5b7df37f80ef4c2", "src_uid": "6d67559744583229455c5eafe68f7952", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n = int(raw_input())\na, b, c = [], [], []\ns = raw_input()\nfrom collections import defaultdict\ndp = defaultdict(lambda : float(\"inf\"))\ndef count(a, st, x):\n    ret = 0\n    i = st\n    while i < len(a) and a[i] < x:\n        ret += 1\n        i += 1\n    return ret\nfor i in xrange(len(s)):\n    if s[i] == \"V\":\n        a.append(i)\n    elif s[i] == \"K\":\n        b.append(i)\n    else :\n        c.append(i)\ndp[(0,0,0,0)] = 0\nfor i in xrange(len(a)+1):\n    for j in xrange(len(b)+1):\n        for k in xrange(len(c)+1):\n            for p in xrange(2):\n                if i < len(a):\n                    dp[(i+1,j,k,1)] = min(dp[(i+1,j,k,1)], dp[(i,j,k,p)] + count(a,i,a[i])+count(b,j,a[i])+count(c,k,a[i]))\n                if j < len(b) and p == 0:\n                    dp[(i,j+1,k,0)] = min(dp[(i,j+1,k,0)], dp[(i,j,k,p)]+count(a,i,b[j])+count(b,j,b[j])+count(c,k,b[j]))\n                if k < len(c):\n                    dp[(i,j,k+1,0)]=min(dp[(i,j,k+1,0)],dp[(i,j,k,p)]+count(a,i,c[k])+count(b,j,c[k])+count(c,k,c[k]))\nprint min(dp[(len(a),len(b),len(c),0)],dp[(len(a),len(b),len(c),1)])\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "2a67c71a53e567148e4fa0a8e793224c", "src_uid": "08444f9ab1718270b5ade46852b155d7", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "# http://codeforces.com/contest/771/problem/D\n\"\"\"\nDP-solution.\n\nFor each state (v, k, x, v_is_last_letter) we trial a step along the v, k and x\naxes and check that\ndp[future_state] = min(dp[future_state], dp[state] + cost_of_move)\nHence this implicitly reults in the one with least cost.\n\nV, K, X are arrays that contain the number of occurences of v, k, x at the i'th\nindex of s.\n\"\"\"\n\n\ndef cost_of_move(state, ss_ind):\n    \"\"\"\n    eg. ss = s[0:K.index(k+1)]\n    Note: ss includes the i+1'th occurence of letter I. We hence want\n    ss = s[0:ss_ind-1]\n    And then we cound the number of occurences of V, K, X in this substring.\n\n    However, we don't need ss now - this info is contained in lists V, K, X.\n    \"\"\"\n\n    curr_v, curr_k, curr_x = state\n    cost = sum([max(0, V[ss_ind-1] - curr_v), max(0, K[ss_ind-1] - curr_k),\n                max(0, X[ss_ind-1] - curr_x)])\n    return cost\n\n\nif __name__ == \"__main__\":\n\n    n = int(input())\n    s = input()\n\n    V = [s[0:i].count('V') for i in range(n+1)]\n    K = [s[0:i].count('K') for i in range(n+1)]\n    X = [(i - V[i] - K[i]) for i in range(n+1)]\n\n    # Initialising\n    n_v, n_k, n_x = V[n], K[n], X[n]\n\n    dp = [[[[float('Inf') for vtype in range(2)] for x in range(n_x+1)]\n           for k in range(n_k+1)] for v in range(n_v+1)]\n    dp[0][0][0][0] = 0\n\n    for v in range(n_v + 1):\n        for k in range(n_k + 1):\n            for x in range(n_x + 1):\n                for vtype in range(2):\n                    orig = dp[v][k][x][vtype]\n                    if v < n_v:\n                        dp[v+1][k][x][1] = min(dp[v+1][k][x][vtype],\n                                               orig + cost_of_move([v, k, x], V.index(v+1)))\n                    if k < n_k and vtype == 0:\n                        dp[v][k+1][x][0] = min(dp[v][k+1][x][0],\n                                               orig + cost_of_move([v, k, x], K.index(k+1)))\n                    if x < n_x:\n                        dp[v][k][x+1][0] = min(dp[v][k][x+1][0],\n                                               orig + cost_of_move([v, k, x], X.index(x+1)))\n    print(min(dp[n_v][n_k][n_x]))\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "dc62d529680f4fa1f071c9efbbd597d4", "src_uid": "08444f9ab1718270b5ade46852b155d7", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import sys\nfrom array import array  # noqa: F401\n\n\ndef readline(): return sys.stdin.buffer.readline().decode('utf-8')\n\n\nn, k = map(int, readline().split())\nmod = 998244353\n\nif k == 1:\n    print(0)\n    exit()\n\n\ndp1 = [array('i', [0])*n for _ in range(n)]\ndp2 = [array('i', [0])*n for _ in range(n)]\ndp1[0][0] = 1\n\nfor i in range(n-1):\n    for j in range(i+1):\n        for l in range(j+1):\n            dp2[j][0] += dp1[j][l]\n            if dp2[j][0] >= mod:\n                dp2[j][0] -= mod\n\n            dp2[j+1 if j == l else j][l+1] += dp1[j][l]\n            if dp2[j+1 if j == l else j][l+1] >= mod:\n                dp2[j+1 if j == l else j][l+1] -= mod\n\n            dp1[j][l] = 0\n\n    dp1, dp2 = dp2, dp1\n\nans = 0\nfor i in range(1, n+1):\n    t = (k-1) // i\n    if t == 0:\n        break\n\n    dps1 = array('i', [0])*(t+1)\n    dps2 = array('i', [0])*(t+1)\n    dps1[0] = 1\n\n    for j in range(n-1):\n        for l in range(min(j+1, t)):\n            dps2[0] += dps1[l]\n            if dps2[0] >= mod:\n                dps2[0] -= mod\n\n            dps2[l+1] += dps1[l]\n            if dps2[l+1] >= mod:\n                dps2[l+1] -= mod\n\n            dps1[l] = 0\n\n        dps1, dps2 = dps2, dps1\n\n    x = sum(dp1[i-1]) % mod\n    ans = (ans + x * sum(dps1[:-1])) % mod\n\nprint(ans * 2 % mod)\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "77223a93d755906ddfcef0ec0a28ab89", "src_uid": "77177b1a2faf0ba4ca1f4d77632b635b", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "M = 10 ** 9 + 7\nn, p = map(int, raw_input().split())\ns = [[1, 2, 0]]\ni = j = 0\nx = 3\nwhile x <= p:\n\ta = min(s[i][1] * 3 + 2, p)\n\tb = min(s[j][1] * 3 / 2, p)\n\tc = min(set(range(0, 3)) - set([s[i][2], s[j][2]]))\n\tif a <= b:\n\t\ti += 1\n\tif b <= a:\n\t\tj += 1\n\ty = min(a, b)\n\tif s[-1][2] == c:\n\t\ts[-1][1] = y\n\telse:\n\t\ts += [[x, y, c]]\n\tx = y + 1\nc = [0] * 3\nfor l, r, v in s:\n\tc[v] += (2 * p - l - r) * (r - l + 1) / 2\nu = [1, 0, 0, 0]\nfor _ in range(n):\n\tv = [0] * 4\n\tfor i, x in enumerate(u):\n\t\tfor j, y in enumerate(c):\n\t\t\tv[i ^ j] = (v[i ^ j] + x * y) % M\n\tu = v\nprint sum(u[1 : ]) % M\n", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "19de6e9f195b04973053fa7d148974e0", "src_uid": "c03b6379e9d186874ac3d97c6968fbd0", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "M = 10 ** 9 + 7\nn, p = map(int, raw_input().split())\ns = [[1, 2, 0]]\ni = j = 0\nx = 3\nwhile x <= p:\n\ta = min(s[i][1] * 3 + 2, p)\n\tb = min(s[j][1] * 3 / 2, p)\n\tc = min(set(range(0, 3)) - set([s[i][2], s[j][2]]))\n\tif a <= b:\n\t\ti += 1\n\tif b <= a:\n\t\tj += 1\n\ty = min(a, b)\n\tif s[-1][2] == c:\n\t\ts[-1][1] = y\n\telse:\n\t\ts += [[x, y, c]]\n\tx = y + 1\nc = [0] * 3\nfor l, r, v in s:\n\tc[v] += (2 * p - l - r) * (r - l + 1) / 2\nu = [1, 0, 0, 0]\nfor _ in range(n):\n\tv = [0] * 4\n\tfor i, x in enumerate(u):\n\t\tfor j, y in enumerate(c):\n\t\t\tv[i ^ j] = (v[i ^ j] + x * y) % M\n\tu = v\nprint sum(u[1 : ]) % M", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "a5910ab3c691a78d0d5a22a397bbe3df", "src_uid": "c03b6379e9d186874ac3d97c6968fbd0", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s=raw_input()\nn=len(s)\nf=[0]*n\ng=[0]*n\n'''\nAB->BA\nNo Other AB\n'''\n# 0=A\nf[0]=1\nfor i in xrange(0,n-1):\n    if (s[i]=='A') and (s[i+1]=='A'):\n        f[i+1]+=g[i]\n        f[i+1]+=f[i]\n    if (s[i]=='A') and (s[i+1]=='B'):\n        f[i+1]+=f[i]\n        f[i+1]+=g[i]\n        g[i+1]+=g[i]\n    if (s[i]=='B') and (s[i+1]=='A'):\n        g[i+1]+=f[i]\n        f[i+1]+=g[i]\n    if (s[i]=='B') and (s[i+1]=='B'):\n        f[i+1]+=g[i]\n        g[i+1]+=g[i]\nans=0\nif s[n-1]=='B':\n    ans+=g[n-1]\nelse:\n    ans=f[n-1]+g[n-1]\nf=[0]*n\ng=[0]*n\n# 0=B\ng[0]=1\nfor i in xrange(0,n-1):\n    if (s[i]=='A') and (s[i+1]=='A'):\n        f[i+1]+=g[i]\n        f[i+1]+=f[i]\n    if (s[i]=='A') and (s[i+1]=='B'):\n        f[i+1]+=f[i]\n        f[i+1]+=g[i]\n        g[i+1]+=g[i]\n    if (s[i]=='B') and (s[i+1]=='A'):\n        g[i+1]+=f[i]\n        f[i+1]+=g[i]\n    if (s[i]=='B') and (s[i+1]=='B'):\n        f[i+1]+=g[i]\n        g[i+1]+=g[i]\nif (s[0]=='A') and (s[n-1]=='B'):\n    ans+=f[n-1]\nelif (s[0]=='B'):\n    ans+=g[n-1]\nprint ans", "lang_cluster": "Python", "tags": ["combinatorics"], "code_uid": "c507d6a3a59d2dba889af553ac75af44", "src_uid": "ad27d991516054ea473b384bb2563b38", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "s = raw_input()\nn = len(s)\npb = -1\nfor i in xrange(n):\n\tif s[i] == 'B':\n\t\tpb = i\n\nif pb != -1:\n\ts = s[pb:] + s[:pb]\n\ns = s[-1] + s + s[0]\n\nres = 1\n\ndp = []\n\nfor i in xrange(n + 2):\n\tdp.append([[[0, 0], [0, 0]], [[0, 0], [0, 0]]])\n\nfor i in xrange(2, n + 1):\n\tfor first in xrange(2):\n\t\tfor prev in xrange(2):\n\t\t\tfor last in xrange(2):\n\t\t\t\tfor cur in xrange(2):\n\t\t\t\t\tif s[i - 1:i + 1] != 'BA' and cur == 1:\n\t\t\t\t\t\tcontinue\n\t\t\t\t\tif i == 2:\n\t\t\t\t\t\tif first != cur or prev != 0 or last != 0:\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\tdp[i][first][last][cur] = 1\n\t\t\t\t\telif i > 2:\n\t\t\t\t\t\tif s[i - 2:i] == 'AB' and prev == 0 and cur == 0:\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\tif i == n and s[n] + s[1] == 'AB' and cur == 0 and first == 0:\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\tif i == n and s[n - 1:n + 1] == 'AB' and cur == 0 and last == 0:\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\tdp[i][first][last][cur] += dp[i - 1][first][prev][last]\n\nres = 0\nfor i in xrange(2):\n\tfor j in xrange(2):\n\t\tfor k in xrange(2):\n\t\t\tres += dp[n][i][j][k]\n\nprint res\n", "lang_cluster": "Python", "tags": ["combinatorics"], "code_uid": "985233bf926912ed68ec7a5e0fce8362", "src_uid": "ad27d991516054ea473b384bb2563b38", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "import sys\r\nfrom math import gcd\r\n# sys.setrecursionlimit(10000)\r\n\r\n\r\nclass BinaryField:\r\n    def __init__(self, s):\r\n        \"\"\"Given a binary string, return a BinaryField element.\r\n        Input:\r\n        s: Has to take one of the following form:\r\n           1. A binary string, with MSB as the highest degree polynomial\r\n           2. An integer, with MSB as the highest degree polynomial\"\"\"\r\n        if type(s) == int:\r\n            self.poly = s\r\n\r\n        else:\r\n            self.poly = 0\r\n\r\n            for c in s:\r\n                self.poly = (self.poly << 1) + int(c)\r\n\r\n        if self.poly == 0:\r\n            self.deg = float('-inf')\r\n        else:\r\n            self.deg = len(bin(self.poly)) - 3\r\n\r\n    def __repr__(self):\r\n        return f'BinaryField(poly={bin(self.poly)[2:]}, deg={self.deg})'\r\n\r\n    def __eq__(self, other):\r\n        return self.poly == other.poly\r\n\r\n    def __add__(self, other):\r\n        return BinaryField(self.poly ^ other.poly)\r\n\r\n    def __mul__(self, other):\r\n        temp = other.poly\r\n        answer = 0\r\n        align = self.poly\r\n\r\n        while temp:\r\n            if temp & 1:\r\n                answer ^= align\r\n\r\n            align <<= 1\r\n            temp >>= 1\r\n\r\n        return BinaryField(answer)\r\n\r\n    def __truediv__(self, other):\r\n        if other.poly == 0:\r\n            raise ZeroDivisionError\r\n\r\n        answer = 0\r\n        temp = self.poly\r\n\r\n        for d in range(max(self.deg - other.deg, 0), -1, -1):\r\n            if temp & (1 << (other.deg + d)):\r\n                answer += (1 << d)\r\n                temp ^= (other.poly << d)\r\n\r\n        return BinaryField(answer)\r\n\r\n    def __mod__(self, other):\r\n        if other.poly == 0:\r\n            raise ZeroDivisionError\r\n\r\n        answer = 0\r\n        temp = self.poly\r\n\r\n        for d in range(max(self.deg - other.deg, 0), -1, -1):\r\n            if temp & (1 << (other.deg + d)):\r\n                answer += (1 << d)\r\n                temp ^= (other.poly << d)\r\n\r\n        return BinaryField(temp)\r\n\r\n    def square(self):\r\n        \"\"\"Returns the square of the polynomial itself.\r\n        Faster than a * a\"\"\"\r\n        answer = 0\r\n        temp = self.poly\r\n\r\n        while temp:\r\n            lsb = temp & (-temp)\r\n            answer += lsb ** 2\r\n\r\n            temp -= lsb\r\n\r\n        return BinaryField(answer)\r\n\r\n    def powmod(self, exp, mod):\r\n        \"\"\"Return (self**exp) % mod\r\n        Inputs:\r\n        exp: An integer power\r\n        mod: A BinaryField element representing the modulus\"\"\"\r\n        answer, temp = BinaryField(1), self\r\n\r\n        while exp:\r\n            if exp & 1:\r\n                answer = (answer * temp) % mod\r\n\r\n            exp >>= 1\r\n            temp = temp.square() % mod\r\n\r\n        return answer\r\n\r\n    @staticmethod\r\n    def gcd(poly1, poly2):\r\n        \"\"\"Given two BinaryField elements, return its gcd\r\n        Input:\r\n        poly1, poly2: two BinaryField elements.\r\n        Output:\r\n        The gcd of poly1 and poly2 as a BinaryField instance.\"\"\"\r\n        if poly1.deg < poly2.deg:\r\n            poly1, poly2 = poly2, poly1\r\n\r\n        p1, p2 = poly1, poly2\r\n        while p2.poly != 0:\r\n            p1, p2 = p2, p1 % p2\r\n\r\n        return p1\r\n\r\n    @staticmethod\r\n    def factorize(poly):\r\n        \"\"\"Factorize a BinaryField object\r\n        Input:\r\n        poly: A BinaryField element\r\n        Return: A list of tuples (poly, exp).\"\"\"\r\n        answer = []\r\n        temp = poly\r\n\r\n        for d in range(2, 2**(1+poly.deg//2)):\r\n            div = BinaryField(d)\r\n\r\n            e = 0\r\n            while temp % div == BinaryField(0):\r\n                temp = temp / div\r\n                e += 1\r\n\r\n            if e:\r\n                answer.append((div, e))\r\n\r\n            if temp == BinaryField(1): break\r\n\r\n        if temp != BinaryField(1):\r\n            answer.append((temp, 1))\r\n\r\n        return answer\r\n\r\n\r\ndef input_general():\r\n    return sys.stdin.readline().rstrip('\\r\\n')\r\n\r\n\r\ndef input_num():\r\n    return int(sys.stdin.readline().rstrip(\"\\r\\n\"))\r\n\r\n\r\ndef input_multi(x=int):\r\n    return map(x, sys.stdin.readline().rstrip(\"\\r\\n\").split())\r\n\r\n\r\ndef input_list(x=int):\r\n    return list(input_multi(x))\r\n\r\n\r\ndef main(s):\r\n    def get_factor(n):\r\n        factors = {1}\r\n\r\n        for p in range(2, 1 + int(n**0.5)):\r\n            e = 0\r\n\r\n            while n % p == 0:\r\n                n //= p\r\n                e += 1\r\n\r\n            if e:\r\n                factors = {f * (p**i) for f in factors for i in range(e+1)}\r\n\r\n            if n == 1: break\r\n\r\n        if n != 1:\r\n            factors = {f * g for f in factors for g in (1, n)}\r\n\r\n        return factors\r\n\r\n    s = s.rstrip('0')\r\n    leading_0 = s.find('1')\r\n\r\n    answer = 1\r\n\r\n    if leading_0 == -1:\r\n        print('-1')\r\n        return\r\n\r\n    f2s = BinaryField(s)\r\n    x = BinaryField(2)\r\n    factors_bin = BinaryField.factorize(f2s)\r\n\r\n    for f, exp in factors_bin:\r\n        factors_pow = sorted(list(get_factor(2**f.deg-1)))\r\n\r\n        for e in factors_pow:\r\n            if x.powmod(e, f) == BinaryField(1):\r\n                if exp == 1:\r\n                    need = e\r\n                else:\r\n                    need = e * (2**(len(bin(exp-1)) - 2))\r\n\r\n                g = gcd(answer, need)\r\n                answer = answer * need // g\r\n\r\n                break\r\n\r\n    print(1 + leading_0, 1 + leading_0 + answer)\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    s = input_general()\r\n\r\n    main(s)\r\n", "lang_cluster": "Python", "tags": ["math", "bitmasks", "meet-in-the-middle", "matrices", "number theory"], "code_uid": "4dc10c084b22707e37da06e58d504f29", "src_uid": "6bf798edef30db7d0ce2130e40084e6b", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "import sys\r\nfrom math import lcm\r\nfrom collections import defaultdict\r\n\r\ndef solve(p):\r\n\tpoly = int(p[::-1], 2)\r\n\tassert p[0] == '1' and p[-1] == '1'\r\n\tdegree = len(p) - 1\r\n\tdef reduce(a):\r\n\t\twhile a.bit_length() > degree:\r\n\t\t\tb = a.bit_length() - degree - 1\r\n\t\t\ta ^= poly << b\r\n\t\tassert a < (1 << degree)\r\n\t\treturn a\r\n\r\n\tdef mul(a, b):\r\n\t\ta = reduce(a)\r\n\t\tb = reduce(b)\r\n\t\tval = 0\r\n\t\tfor i in range(degree):\r\n\t\t\tif (a >> i) & 1:\r\n\t\t\t\tval ^= (b << i)\r\n\t\tfor i in range(degree, -1, -1):\r\n\t\t\tif (val >> (degree + i)) & 1:\r\n\t\t\t\tval ^= poly << i\r\n\t\treturn val\r\n\t\r\n\tdef pow(a, k):\r\n\t\tres = 1\r\n\t\twhile k:\r\n\t\t\tif k & 1:\r\n\t\t\t\tres = mul(res, a)\r\n\t\t\tk >>= 1\r\n\t\t\ta = mul(a, a)\r\n\t\treturn res\r\n\r\n\tpfs = defaultdict(int)\r\n\tpfs[2] += degree\r\n\tfor i in range(1, degree + 1):\r\n\t\tcur = 2 ** i - 1\r\n\t\tp = 2\r\n\t\twhile p * p <= cur:\r\n\t\t\twhile cur % p == 0:\r\n\t\t\t\tcur //= p\r\n\t\t\t\tpfs[p] += 1\r\n\t\t\tp += 1\r\n\t\tif cur > 1:\r\n\t\t\tpfs[cur] += 1\r\n\torder_multiple = 1\r\n\tfor p in pfs:\r\n\t\torder_multiple *= p ** pfs[p]\r\n\t\r\n\torder = order_multiple\r\n\tx = reduce(1 << 1)\r\n\tfor p in pfs:\r\n\t\twhile order % p == 0 and pow(x, order // p) == 1:\r\n\t\t\torder //= p\r\n\treturn order\r\n\r\ns = input()\r\nif '1' not in s:\r\n\tprint(-1)\r\n\tsys.exit()\r\n\r\np = s.lstrip('0')\r\nl0 = len(s) - len(p)\r\np = p.rstrip('0')\r\n\r\nres = solve(p)\r\nprint(f\"{1 + l0} {1 + l0 + res}\")", "lang_cluster": "Python", "tags": ["math", "bitmasks", "meet-in-the-middle", "matrices", "number theory"], "code_uid": "915ba2d1c440c42e386f3c1d3ba6240b", "src_uid": "6bf798edef30db7d0ce2130e40084e6b", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n\"\"\"(c) gorlum0 [at] gmail.com\"\"\"\nimport itertools as it\nfrom sys import stdin\n\ndef solve(a, b, mod):\n    if b >= mod: return 2\n\n    m = 10**9 % mod\n    s = 0\n    for i in xrange(1, a+1):\n        s += m\n        if s >= mod: s -= mod\n        if s == 0: break\n        if s + b < mod:\n            return 1, i\n    return 2\n\ndef main():\n    for l in stdin:\n        a, b, mod = map(int, l.split())\n        winner = solve(a, b, mod)\n        if winner == 2:\n            print 2\n        else:\n            print 1, '%09d' % winner[1]\n\ndef test():\n    pass\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["brute force", "number theory"], "code_uid": "40f31e0d793b3201146cd3eec9fea11e", "src_uid": "8b6f633802293202531264446d33fee5", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n\"\"\"(c) gorlum0 [at] gmail.com\"\"\"\nimport itertools as it\nfrom sys import stdin\n\ndef solve(a, b, mod):\n    if b >= mod: return 2\n\n    m = 10**9 % mod\n    s = 0\n    for i in xrange(1, a+1):\n        s += m\n        if s >= mod: s -= mod\n        if not s: break\n        if s + b < mod:\n            return 1, i\n    return 2\n\ndef main():\n    for l in stdin:\n        a, b, mod = map(int, l.split())\n        winner = solve(a, b, mod)\n        if winner == 2:\n            print 2\n        else:\n            print 1, '%09d' % winner[1]\n\nif __name__ == '__main__':\n    main()\n", "lang_cluster": "Python", "tags": ["brute force", "number theory"], "code_uid": "e9818a097d3a202a5bbbdb4696427730", "src_uid": "8b6f633802293202531264446d33fee5", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import math\nn, t = map(int, raw_input().split())\n\nfor i in range(55):\n    comb = [[0]*55 for _ in range(55)]\nfor i in range(55):\n    for j in range(i+1):\n        if (i == 0 or j == 0): comb[i][j] = 1\n        else:\n            comb[i][j] = comb[i-1][j] + comb[i-1][j-1]\n\ndef gao(m, k):\n    ret = 0\n    while m > 0:\n        p = int(math.log(m, 2))\n        ret += comb[p][k]\n        k -= 1\n        m -= 2**p\n        if m == 0:\n            if k == 0:\n                ret += 1\n            break\n        if k < 0:\n            break\n    return ret\n\ntmp = 0\nnum = t\nwhile (num > 0):\n    if (num % 2 == 1):\n        tmp += 1\n    num /= 2\n    if (tmp > 1):\n        break\nif (tmp > 1):\n    print 0\nelse:\n    k = int(math.log(t, 2))\n    ans = gao(n+1, k+1)\n    if t == 1:\n        ans -= 1\n    print ans\n", "lang_cluster": "Python", "tags": ["math", "dp", "constructive algorithms"], "code_uid": "3b88b2cff07c2ecb1d169b75b00d6a36", "src_uid": "727d5b601694e5e0f0cf3a9ca25323fc", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\nfrom sys import stdin\nN = 42\nC = [[1, 1]]\ndef init():\n  for i in range(N):\n    C.append([1])\n    for j in range(i+1):\n      C[-1].append(C[-2][j] + C[-2][j+1])\n    C[-1].append(1)\n\ndef go(n):\n  count = [0]*(N+2)\n  i = 0\n  j = 2\n  while n >= j:\n    n -= j\n    for k in range(len(C[i])):\n      count[k] += C[i][k]\n    j *= 2\n    i += 1\n  l = 0\n  while i >= 0 and n > 1:\n    if n >= j:\n      n -= j\n      for k in range(len(C[i])):\n        count[k+l] += C[i][k]\n      l += 1\n    j /= 2\n    i -= 1\n  count[l] += n\n  return count\n\ndef lg(n):\n  k = 0\n  while n%2 == 0:\n    k += 1\n    n /= 2\n  if n > 1: return -1\n  return k\n\ndef main():\n  init()\n  while True:\n    l = stdin.readline().split()\n    if len(l) < 2: break\n    n, k = int(l[0]), int(l[1])\n    k = lg(k)\n    if k < 0:\n      print 0\n      continue\n    count = go(n)\n    print count[k]\n\nif __name__ == '__main__':\n  main()\n", "lang_cluster": "Python", "tags": ["math", "dp", "constructive algorithms"], "code_uid": "8edc8f94b762e48343a0ed8e3c599918", "src_uid": "727d5b601694e5e0f0cf3a9ca25323fc", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "#!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3\n'''\nCreated on 13/09/2018\n\n@author: ernesto\n'''\n\nn, m = [int(x) for x in input().strip().split(\" \")]\n\nposibles_jefes = set(range(1, n + 1))\nanteriores = set()\nposteriores = set()\ncontinuos = [True] * (n + 1)\nmencionados = set()\nposibles_jefes_mencionados = set()\nultimo_en_salir = [True] * (n + 1)\nultima_salida_inesperada = None\n\nops = []\n\nif(m > 1):\n    for _ in range(0, m):\n        s, n_s = [x for x in input().strip().split(\" \")]\n        n = int(n_s)\n        ops.append((s, n))\n    for i in range(0, m):\n        op, num = ops[i]\n        cont = False\n        if op == '+':\n            cont = not i or (ops[i - 1][0] == '-' and ops[i - 1][1] == num)\n            posteriores.add(num)\n        if op == '-':\n            cont = i == m - 1 or (ops[i + 1][0] == '+' and ops[i + 1][1] == num)\n            if num not in mencionados:\n                anteriores.add(num)\n                ultima_salida_inesperada = num\n            posteriores.discard(num)\n            ultimo_en_salir[num] &= not posteriores\n        continuos[num] &= cont \n        mencionados.add(num)\n#    print(\"anteriores {} posteriores {} continuos {} ops {}\".format(anteriores, posteriores, continuos, ops))\n    if not anteriores and not posteriores:\n        assert ultima_salida_inesperada is None\n        if ops[0][0] == '+' and ops[-1][0] == '-' and ops[0][1] == ops[-1][1] and continuos[ops[0][1]] and ultimo_en_salir[ops[0][1]]:\n            posibles_jefes_mencionados.add(ops[0][1])\n    else:\n        if not posteriores:\n            assert ultima_salida_inesperada is not None\n            posibles_jefes_filtrados = list(filter(lambda x:continuos[x] and ultimo_en_salir[x] and ultima_salida_inesperada == x, anteriores))\n            assert len(posibles_jefes_filtrados) <= 1\n            if(posibles_jefes_filtrados):\n                assert posibles_jefes_filtrados[0] == ops[-1][1]\n                posibles_jefes_mencionados.add(ops[-1][1])\n        else:\n            if not anteriores:\n                assert ultima_salida_inesperada is None\n                posibles_jefes_filtrados = list(filter(lambda x:continuos[x] and ultimo_en_salir[x], posteriores))\n#                print(\"posibles {}\".format(posibles_jefes_filtrados))\n                assert len(posibles_jefes_filtrados) <= 1\n                if(posibles_jefes_filtrados):\n                    assert posibles_jefes_filtrados[0] == ops[0][1]\n                    posibles_jefes_mencionados.add(ops[0][1])\n            else:\n                assert ultima_salida_inesperada is not None\n#                print(\"continuos {}\".format(continuos))\n                posibles_jefes_mencionados = set(filter(lambda x:ultimo_en_salir[x] and continuos[x] and ultima_salida_inesperada == x, anteriores & posteriores))\n\n#    print(\"posibles jefes menc {}\".format(posibles_jefes_mencionados))\n    posibles_jefes -= (mencionados - posibles_jefes_mencionados)\n        \nprint(len(posibles_jefes))\nif(len(posibles_jefes)):\n    print(\" \".join(map(str, sorted(posibles_jefes))))\n", "lang_cluster": "Python", "tags": ["implementation"], "code_uid": "acb5791990a5f5a7d80d8c56d19e3ab1", "src_uid": "a3a337c7b919e7dfd7ff45ebf59681b5", "difficulty": 1800.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def lucky(x):\n    s=str(x)\n    return s.count('4')+s.count('7')==len(s)\n\ndef Gen_lucky(n):\n    if(len(n)==1):\n        if(n<\"4\"):\n            return 0\n        if(n<\"7\"):\n            return 1\n        return 2\n    s=str(n)\n    if(s[0]<'4'):\n        return 0\n    if(s[0]=='4'):\n        return Gen_lucky(s[1:])\n    if(s[0]<'7'):\n        return 2**(len(s)-1)\n    if(s[0]=='7'):\n        return 2**(len(s)-1)+Gen_lucky(s[1:])\n    else:\n        return 2**len(s)\n        \n\ndef Form(X,k):\n    if(k==0):\n        return X\n    for i in range(len(X)):\n        if(k>=F[len(X)-i-1]):\n            h=k//F[len(X)-i-1]\n            r=k%F[len(X)-i-1]\n            G=list(X[i+1:])\n            G.remove(X[i+h])\n            G=[X[i]]+G\n            return Form(X[:i]+[X[i+h]]+G,r)\n\np=1\n\nF=[1]\ni=1\nwhile(p<=10**15):\n    p*=i\n    F.append(p)\n    i+=1\n\nn,k=map(int,input().split())\n\n\n    \nif(n<=14):\n    if(k>F[n]):\n        print(-1)\n    else:\n        L=Form(list(range(1,n+1)),k-1)\n        x=0\n        for i in range(n):\n            if(lucky(i+1) and lucky(L[i])):\n                x+=1\n        print(x)\nelse:\n    L=Form(list(range(n-14,n+1)),k-1)\n    ss=str(n-15)\n    x=0\n    for i in range(1,len(ss)):\n        x+=2**i\n    x+=Gen_lucky(ss)\n    for i in range(n-14,n+1):\n        if(lucky(L[i-n+14]) and lucky(i)):\n            x+=1\n    print(x)\n       \n", "lang_cluster": "Python", "tags": ["brute force", "combinatorics", "number theory"], "code_uid": "58fd968dfe312006bd2119075d913dd6", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "lucky=set([])\ndef gen(x):\n    if x>4444444444:\n        return\n    lucky.add(x)\n    gen(x*10+4)\n    gen(x*10+7)\ngen(4)\ngen(7)\nlucky=sorted(lucky)\n\nn,k=map(int,raw_input().split())\nz=1\nt=0\nwhile z<k:\n    t+=1\n    z*=t\nif t>n:\n    print -1\n    raise SystemExit()\ndef before(x):\n    l=0\n    r=len(lucky)-1\n    while r-l>1:\n        if lucky[(r+l)/2]>=x:\n            r=(r+l)/2\n        else:\n            l=(r+l)/2\n    if lucky[l]>=x:\n        return l\n    else:\n        return r\ndef islucky(x):\n    if x==0:\n        return False\n    while x>0:\n        if not (x%10 in [4,7]):\n            return False\n        x/=10\n    return True\nres=before(n-t+1)\nif t>0:\n    used=[0]*t\n    perm=list()\n    k-=1\n    while t>0:\n        z/=t\n        x=0\n        while used[x]==1:\n            x+=1\n        while k>=z:\n            k-=z\n            x+=1\n            while used[x]==1:\n                x+=1\n        t-=1\n        used[x]=1\n        perm.append(x)\n    t=len(perm)\n    for i in xrange(t):\n        if islucky(n-t+i+1) and islucky(n-t+perm[i]+1):\n            res+=1\nprint res\n", "lang_cluster": "Python", "tags": ["brute force", "combinatorics", "number theory"], "code_uid": "727d397932b2b1194e0c3c7b650ea486", "src_uid": "cb2aa02772f95fefd1856960b6ceac4c", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "# by the authority of GOD     author: manhar singh sachdev #\n\nimport os,sys\nfrom io import BytesIO, IOBase\nfrom collections import Counter\n\ndef main():\n    mod = 10**9+7\n    r,g = map(int,input().split())\n    n = 1\n    while r+g >= (n*(n+1))//2:\n        n += 1\n    n -= 1\n    tot = n*(n+1)//2\n    dp = [0]*(r+1)\n    dp[0] = 1\n    for i in range(1,n+1):\n        for x in range(r-i,-1,-1):\n            dp[i+x] += dp[x]\n            dp[i+x] %= mod\n    ans = 0\n    for i,val in enumerate(dp):\n        if tot-i <= g:\n            ans += val\n            ans %= mod\n    print(ans)\n\n#Fast IO Region\nBUFSIZE = 8192\nclass FastIO(IOBase):\n    newlines = 0\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\nif __name__ == '__main__':\n    main()", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "b3b5260bad81d122c15b06dcd4e0d5fd", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "\"\"\"\n#If FastIO not needed, used this and don't forget to strip\n#import sys, math\n#input = sys.stdin.readline\n\"\"\"\n \nimport os\nimport sys\nfrom io import BytesIO, IOBase\nimport heapq as h \nimport bisect \n \nfrom types import GeneratorType\nBUFSIZE = 8192\nclass SortedList:\n    def __init__(self, iterable=[], _load=200):\n        \"\"\"Initialize sorted list instance.\"\"\"\n        values = sorted(iterable)\n        self._len = _len = len(values)\n        self._load = _load\n        self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]\n        self._list_lens = [len(_list) for _list in _lists]\n        self._mins = [_list[0] for _list in _lists]\n        self._fen_tree = []\n        self._rebuild = True\n \n    def _fen_build(self):\n        \"\"\"Build a fenwick tree instance.\"\"\"\n        self._fen_tree[:] = self._list_lens\n        _fen_tree = self._fen_tree\n        for i in range(len(_fen_tree)):\n            if i | i + 1 < len(_fen_tree):\n                _fen_tree[i | i + 1] += _fen_tree[i]\n        self._rebuild = False\n \n    def _fen_update(self, index, value):\n        \"\"\"Update `fen_tree[index] += value`.\"\"\"\n        if not self._rebuild:\n            _fen_tree = self._fen_tree\n            while index < len(_fen_tree):\n                _fen_tree[index] += value\n                index |= index + 1\n \n    def _fen_query(self, end):\n        \"\"\"Return `sum(_fen_tree[:end])`.\"\"\"\n        if self._rebuild:\n            self._fen_build()\n \n        _fen_tree = self._fen_tree\n        x = 0\n        while end:\n            x += _fen_tree[end - 1]\n            end &= end - 1\n        return x\n \n    def _fen_findkth(self, k):\n        \"\"\"Return a pair of (the largest `idx` such that `sum(_fen_tree[:idx]) <= k`, `k - sum(_fen_tree[:idx])`).\"\"\"\n        _list_lens = self._list_lens\n        if k < _list_lens[0]:\n            return 0, k\n        if k >= self._len - _list_lens[-1]:\n            return len(_list_lens) - 1, k + _list_lens[-1] - self._len\n        if self._rebuild:\n            self._fen_build()\n \n        _fen_tree = self._fen_tree\n        idx = -1\n        for d in reversed(range(len(_fen_tree).bit_length())):\n            right_idx = idx + (1 << d)\n            if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:\n                idx = right_idx\n                k -= _fen_tree[idx]\n        return idx + 1, k\n \n    def _delete(self, pos, idx):\n        \"\"\"Delete value at the given `(pos, idx)`.\"\"\"\n        _lists = self._lists\n        _mins = self._mins\n        _list_lens = self._list_lens\n \n        self._len -= 1\n        self._fen_update(pos, -1)\n        del _lists[pos][idx]\n        _list_lens[pos] -= 1\n \n        if _list_lens[pos]:\n            _mins[pos] = _lists[pos][0]\n        else:\n            del _lists[pos]\n            del _list_lens[pos]\n            del _mins[pos]\n            self._rebuild = True\n \n    def _loc_left(self, value):\n        \"\"\"Return an index pair that corresponds to the first position of `value` in the sorted list.\"\"\"\n        if not self._len:\n            return 0, 0\n \n        _lists = self._lists\n        _mins = self._mins\n \n        lo, pos = -1, len(_lists) - 1\n        while lo + 1 < pos:\n            mi = (lo + pos) >> 1\n            if value <= _mins[mi]:\n                pos = mi\n            else:\n                lo = mi\n \n        if pos and value <= _lists[pos - 1][-1]:\n            pos -= 1\n \n        _list = _lists[pos]\n        lo, idx = -1, len(_list)\n        while lo + 1 < idx:\n            mi = (lo + idx) >> 1\n            if value <= _list[mi]:\n                idx = mi\n            else:\n                lo = mi\n \n        return pos, idx\n \n    def _loc_right(self, value):\n        \"\"\"Return an index pair that corresponds to the last position of `value` in the sorted list.\"\"\"\n        if not self._len:\n            return 0, 0\n \n        _lists = self._lists\n        _mins = self._mins\n \n        pos, hi = 0, len(_lists)\n        while pos + 1 < hi:\n            mi = (pos + hi) >> 1\n            if value < _mins[mi]:\n                hi = mi\n            else:\n                pos = mi\n \n        _list = _lists[pos]\n        lo, idx = -1, len(_list)\n        while lo + 1 < idx:\n            mi = (lo + idx) >> 1\n            if value < _list[mi]:\n                idx = mi\n            else:\n                lo = mi\n \n        return pos, idx\n \n    def add(self, value):\n        \"\"\"Add `value` to sorted list.\"\"\"\n        _load = self._load\n        _lists = self._lists\n        _mins = self._mins\n        _list_lens = self._list_lens\n \n        self._len += 1\n        if _lists:\n            pos, idx = self._loc_right(value)\n            self._fen_update(pos, 1)\n            _list = _lists[pos]\n            _list.insert(idx, value)\n            _list_lens[pos] += 1\n            _mins[pos] = _list[0]\n            if _load + _load < len(_list):\n                _lists.insert(pos + 1, _list[_load:])\n                _list_lens.insert(pos + 1, len(_list) - _load)\n                _mins.insert(pos + 1, _list[_load])\n                _list_lens[pos] = _load\n                del _list[_load:]\n                self._rebuild = True\n        else:\n            _lists.append([value])\n            _mins.append(value)\n            _list_lens.append(1)\n            self._rebuild = True\n \n    def discard(self, value):\n        \"\"\"Remove `value` from sorted list if it is a member.\"\"\"\n        _lists = self._lists\n        if _lists:\n            pos, idx = self._loc_right(value)\n            if idx and _lists[pos][idx - 1] == value:\n                self._delete(pos, idx - 1)\n \n    def remove(self, value):\n        \"\"\"Remove `value` from sorted list; `value` must be a member.\"\"\"\n        _len = self._len\n        self.discard(value)\n        if _len == self._len:\n            raise ValueError('{0!r} not in list'.format(value))\n \n    def pop(self, index=-1):\n        \"\"\"Remove and return value at `index` in sorted list.\"\"\"\n        pos, idx = self._fen_findkth(self._len + index if index < 0 else index)\n        value = self._lists[pos][idx]\n        self._delete(pos, idx)\n        return value\n \n    def bisect_left(self, value):\n        \"\"\"Return the first index to insert `value` in the sorted list.\"\"\"\n        pos, idx = self._loc_left(value)\n        return self._fen_query(pos) + idx\n \n    def bisect_right(self, value):\n        \"\"\"Return the last index to insert `value` in the sorted list.\"\"\"\n        pos, idx = self._loc_right(value)\n        return self._fen_query(pos) + idx\n \n    def count(self, value):\n        \"\"\"Return number of occurrences of `value` in the sorted list.\"\"\"\n        return self.bisect_right(value) - self.bisect_left(value)\n \n    def __len__(self):\n        \"\"\"Return the size of the sorted list.\"\"\"\n        return self._len\n \n    def __getitem__(self, index):\n        \"\"\"Lookup value at `index` in sorted list.\"\"\"\n        pos, idx = self._fen_findkth(self._len + index if index < 0 else index)\n        return self._lists[pos][idx]\n \n    def __delitem__(self, index):\n        \"\"\"Remove value at `index` from sorted list.\"\"\"\n        pos, idx = self._fen_findkth(self._len + index if index < 0 else index)\n        self._delete(pos, idx)\n \n    def __contains__(self, value):\n        \"\"\"Return true if `value` is an element of the sorted list.\"\"\"\n        _lists = self._lists\n        if _lists:\n            pos, idx = self._loc_left(value)\n            return idx < len(_lists[pos]) and _lists[pos][idx] == value\n        return False\n \n    def __iter__(self):\n        \"\"\"Return an iterator over the sorted list.\"\"\"\n        return (value for _list in self._lists for value in _list)\n \n    def __reversed__(self):\n        \"\"\"Return a reverse iterator over the sorted list.\"\"\"\n        return (value for _list in reversed(self._lists) for value in reversed(_list))\n \n    def __repr__(self):\n        \"\"\"Return string representation of sorted list.\"\"\"\n        return 'SortedList({0})'.format(list(self))\n \nclass FastIO(IOBase):\n    newlines = 0\n \n    def __init__(self, file):\n        import os\n        self.os = os\n        self._fd = file.fileno()\n        self.buffer = BytesIO()\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\n        self.write = self.buffer.write if self.writable else None\n \n    def read(self):\n        while True:\n            b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n \n    def readline(self):\n        while self.newlines == 0:\n            b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(b\"\\n\") + (not b)\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines -= 1\n        return self.buffer.readline()\n \n    def flush(self):\n        if self.writable:\n            self.os.write(self._fd, self.buffer.getvalue())\n            self.buffer.truncate(0), self.buffer.seek(0)\n \n \nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\n \n \nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n \nimport collections as col\nimport math, string\n \ndef getInts():\n    return [int(s) for s in input().split()]\n \ndef getInt():\n    return int(input())\n \ndef getStrs():\n    return [s for s in input().split()]\n \ndef getStr():\n    return input()\n \ndef listStr():\n    return list(input())\n \nMOD = 10**9+7\nmod=10**9+7\n#t=int(input())\nt=1\np=10**9+7\ndef ncr_util():\n    \n    inv[0]=inv[1]=1\n    fact[0]=fact[1]=1\n    for i in range(2,300001):\n        inv[i]=(inv[i%p]*(p-p//i))%p\n    for i in range(1,300001):\n        inv[i]=(inv[i-1]*inv[i])%p\n        fact[i]=(fact[i-1]*i)%p\n\n\ndef solve():\n    h=0\n    for i in range(1000):\n        if  (i*(i+1))//2<=(r+g):\n            h=i\n    dp=[0]*(r+1)\n    dp[0]=1\n    #print(h)\n    for i in range(1,h+1):\n        curr=(i*(i+1))//2\n        for j in range(r,-1,-1):\n            if j-i>=0 :\n                dp[j]=(dp[j]%mod+dp[j-i]%mod)%mod\n    tot=(h*(h+1))//2\n    ans=0\n    for i in range(r+1):\n        if tot-i<=g:\n            ans=(ans%mod+dp[i]%mod)%mod\n    return ans\nfor _ in range(t):\n    #n=int(input())\n    #n=int(input())\n    #n,m=(map(int,input().split()))\n    #n1=n\n    #x=int(input())\n    #b=int(input())\n    #n,m,k=map(int,input().split())\n    r,g=map(int,input().split())\n    #n=int(input())\n    #s=input()\n    #s1=input()\n    #p=input()\n    #l=list(map(int,input().split()))\n    \n    #l.sort()        \n    #l.sort(revrese=True)\n    #l2=list(map(int,input().split()))\n    #l=str(n)\n    #l.sort(reverse=True)\n    #l2.sort(reverse=True)\n    #l1.sort(reverse=True)\n    print(solve())\n            \n        ", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "ccd3eec437c6e303f79be074a37bbabd", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "k, pa, pb = map(int, input().split())\n\nMOD = 10**9 + 7\nINF = ((pa + pb) * pow(pb, MOD-2, MOD)) % MOD\nrAB = pow(pa+pb, MOD-2, MOD)\nrB = pow(pb, MOD-2, MOD)\n\nmemo = {}\n\ndef dfs(a, ab):\n    if ab >= k:\n        return ab\n    if a + ab >= k:\n        #return INF\n        #return (pa + pb) / pb\n        return ((a + MOD-1) + (pa + pb) * rB + ab) % MOD\n        return a - 1 + (pa + pb) / pb + ab\n    if (a, ab) in memo:\n        return memo[a, ab]\n    #res = (((dfs(a+1, ab)+1) * pa * rAB) + ((dfs(a, ab+a)+1) * pb * rAB)) % MOD\n    #res = (dfs(a+1, ab)) * pa / (pa + pb) + (dfs(a, ab+a)) * pb / (pa + pb)\n    res = (dfs(a+1, ab) * pa * rAB) + (dfs(a, ab+a) * pb * rAB)\n    #print(a, ab, res)\n    memo[a, ab] = res = res % MOD\n    return res\n#print((dfs(1, 0) * pa * rAB + 1) % MOD)\n#print((pb + dfs(1, 0)*pa) / pa)\nprint(dfs(1, 0))\n", "lang_cluster": "Python", "tags": ["math", "dp", "probabilities"], "code_uid": "e3f6130cb2b22308da1f266869d328eb", "src_uid": "0dc9f5d75143a2bc744480de859188b4", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#908D\nn,a,b = map(int,raw_input().split())\n\np = 1000000007\n\ndef inv(a):\n    p = 1000000007\n    s=1\n    n=p-2\n    while n:\n        if n&1:\n            s=s*a%p\n        a=a*a%p\n        n/=2\n    return s\nf=[[0 for i in range(1001)] for j in range(1001)]\nu=a*inv(a+b)%p\nv=(1-u+p)%p\nc=u*inv(v)%p\nfor i in range(n,0,-1):\n    for j in range(n-1,-1,-1):\n        if j+i>=n:\n            f[i][j]=(j+i+c)%p\n        else:\n            f[i][j]=(u*f[i+1][j]+v*f[i][j+i])%p\nprint f[1][0]\n\n\"\"\"\n#include<cstdio>\ntypedef long long ll;\nconst int p=1e9+7;\nll inv(ll a){\n\tll s=1;\n\tfor(int n=p-2;n;n>>=1){\n\t\tif(n&1)s=s*a%p;\n\t\ta=a*a%p;\n\t}\n\treturn s;\n}\nint n,a,b,f[1001][1001];\nint main(){\n\tscanf(\"%d%d%d\",&n,&a,&b);\n\tll u=a*inv(a+b)%p,v=(1-u+p)%p,c=u*inv(v)%p;\n\tfor(int i=n;i;--i)\n\t\tfor(int j=n-1;~j;--j)\n\t\t\tf[i][j]=(j+i>=n?j+i+c:u*f[i+1][j]+v*f[i][j+i])%p;\n\tprintf(\"%d\\n\",f[1][0]);\n}\n\"\"\"", "lang_cluster": "Python", "tags": ["math", "dp", "probabilities"], "code_uid": "e97ab3657b653b08c81b72c65eea95ae", "src_uid": "0dc9f5d75143a2bc744480de859188b4", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#!/usr/bin/env pypy\nfrom __future__ import division, print_function\n\nimport os\nimport sys\nfrom __builtin__ import xrange as range\nfrom collections import deque\nfrom cStringIO import StringIO\nfrom future_builtins import ascii, filter, hex, map, oct, zip\nfrom io import IOBase\n\nimport __pypy__\n\n\ndef process(grid, a, n, m):\n    aux = [[0] * 3000 for _ in range(3000)]\n    for i in range(n):\n        mi = deque()\n        for j in range(a):\n            while mi and grid[i][j] < mi[-1]:\n                mi.pop()\n            mi.append(grid[i][j])\n\n        aux[0][i] = mi[0]\n        for j in range(a, m):\n            if mi[0] == grid[i][j - a]:\n                mi.popleft()\n            while mi and grid[i][j] < mi[-1]:\n                mi.pop()\n            mi.append(grid[i][j])\n            aux[j - a + 1][i] = mi[0]\n\n    return aux\n\n\ndef main():\n    n, m, a, b = map(int, input().split())\n    g, x, y, z = map(float, input().split())\n\n    MOD = int(z)\n    MODF = z\n    MAGIC = 6755399441055744.0\n    SHRT = 65536.0\n\n    MODF_INV = 1.0 / MODF\n    SHRT_INV = 1.0 / SHRT\n\n    fround = lambda x: (x + MAGIC) - MAGIC\n    fmod = lambda a: a - MODF * fround(MODF_INV * a)\n    fmul = lambda a, b, c=0.0: fmod(fmod(a * SHRT) * fround(SHRT_INV * b) + a * (b - SHRT * fround(b * SHRT_INV)) + c)\n\n    grid = [[0] * 3000 for _ in range(3000)]\n    for i in range(n):\n        for j in range(m):\n            grid[i][j] = int(g) % MOD\n            g = fmul(g, x, y)\n\n    aux1 = process(grid, b, n, m)\n    aux2 = process(aux1, a, m - b + 1, n)\n\n    ans = 0\n    for i in range(n - a + 1):\n        ans += sum(aux2[i][:m - b + 1])\n\n    print(ans)\n\n\n# region fastio\n\nBUFSIZE = 8192\n\n\nclass FastI(IOBase):\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self._buffer = StringIO()\n        self.newlines = 0\n\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(\"\\n\") + (not b)\n            ptr = self._buffer.tell()\n            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)\n        self.newlines -= 1\n        return self._buffer.readline()\n\n\nclass FastO(IOBase):\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self._buffer = __pypy__.builders.StringBuilder()\n        self.write = lambda s: self._buffer.append(s)\n\n    def flush(self):\n        os.write(self._fd, self._buffer.build())\n        self._buffer = __pypy__.builders.StringBuilder()\n\n\ndef print(*args, **kwargs):\n    sep, file = kwargs.pop(\"sep\", \" \"), kwargs.pop(\"file\", sys.stdout)\n    at_start = True\n    for x in args:\n        if not at_start:\n            file.write(sep)\n        file.write(str(x))\n        at_start = False\n    file.write(kwargs.pop(\"end\", \"\\n\"))\n    if kwargs.pop(\"flush\", False):\n        file.flush()\n\n\nsys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\n# endregion\n\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["two pointers", "data structures"], "code_uid": "9b62e44f92bec18cc1a34d3d4a72117f", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from __future__ import division, print_function\nimport __pypy__\n \nadd = __pypy__.intop.int_add\nsub = __pypy__.intop.int_sub\nmul = __pypy__.intop.int_mul\n \ndef main():\n    from collections import deque \n  \n    def printMin(arr, n, k): \n        res=[]\n        Qi = deque() \n        for i in range(k): \n            while Qi and arr[i] <= arr[Qi[-1]] : \n                Qi.pop() \n            Qi.append(i); \n          \n        for i in range(k, n): \n            res.append(arr[Qi[0]])\n            while Qi and Qi[0] <= i-k: \n                Qi.popleft()  \n            while Qi and arr[i] <= arr[Qi[-1]] : \n                Qi.pop() \n            Qi.append(i) \n        res.append(int(arr[Qi[0]]))\n        return res \n    n,m,a,b=map(int,input().split())\n    g,x,y,z=map(int,input().split())\n    \n    zinv = 1.0/z\n    \n    def modmuladd(x,y,c):\n        ans = sub(add(mul(x,y),c), mul(z, int(zinv*x*y + zinv*c)))\n        if ans >= z:\n            return ans - z\n        elif ans < 0:\n            return ans + z\n        else:\n            return ans\n    \n    grid= [0]*(n*m)\n    grid[0]=g\n    for i in range(1,n*m):\n        grid[i]=modmuladd(grid[i-1],x,y)\n    B=[]\n    ans=0.0\n    for i in range(n):\n        B.append(printMin(grid[i*m:(i+1)*m],m,b))\n    grid=[]\n    for i in range(len(B[0])):\n        temp=[]\n        for j in range(n):\n            temp.append(B[j][i])\n        for tmp in printMin(temp,len(temp),a):\n            ans += tmp\n    print(int(ans))\n \npy2 = round(0.5)\nif py2:\n    from future_builtins import ascii, filter, hex, map, oct, zip\n    range = xrange\n \nimport os, sys\nfrom io import IOBase, BytesIO\n \nBUFSIZE = 8192\nclass FastIO(BytesIO):\n    newlines = 0\n \n    def __init__(self, file):\n        self._file = file\n        self._fd = file.fileno()\n        self.writable = \"x\" in file.mode or \"w\" in file.mode\n        self.write = super(FastIO, self).write if self.writable else None\n \n    def _fill(self):\n        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])\n        return s\n \n    def read(self):\n        while self._fill(): pass\n        return super(FastIO,self).read()\n \n    def readline(self):\n        while self.newlines == 0:\n            s = self._fill(); self.newlines = s.count(b\"\\n\") + (not s)\n        self.newlines -= 1\n        return super(FastIO, self).readline()\n \n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.getvalue())\n            self.truncate(0), self.seek(0)\n \nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        if py2:\n            self.write = self.buffer.write\n            self.read = self.buffer.read\n            self.readline = self.buffer.readline\n        else:\n            self.write = lambda s:self.buffer.write(s.encode('ascii'))\n            self.read = lambda:self.buffer.read().decode('ascii')\n            self.readline = lambda:self.buffer.readline().decode('ascii')\n \n \nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip('\\r\\n')\nimport sys\nclass ostream:\n    def __lshift__(self,a):\n        sys.stdout.write(str(a))\n        return self\ncout = ostream()\nendl = '\\n'\n \n\ndef readnumbers(zero = 0):\n    conv = ord if py2 else lambda x:x\n    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()\n    try:\n        while True:\n            if s[i] >= b'0' [0]:\n                numb = 10 * numb + conv(s[i]) - 48\n            elif s[i] == b'-' [0]: sign = -1\n            elif s[i] != b'\\r' [0]:\n                A.append(sign*numb)\n                numb = zero; sign = 1\n            i += 1\n    except:pass\n    if s and s[-1] >= b'0' [0]:\n        A.append(sign*numb)\n    return A\n \nif __name__== \"__main__\":\n  main()", "lang_cluster": "Python", "tags": ["two pointers", "data structures"], "code_uid": "8d5a5bf636cf49368d22bb245c3b3b66", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def slide_min(tl,ql,val):\n  res=[0]*(tl-ql+1)\n  q=[0]*tl\n  s=0\n  t=0\n  for i in range(0,tl):\n    while s<t and val[q[t-1]]>=val[i]:\n      t-=1\n    q[t]=i\n    t+=1\n    if (i-ql+1)>=0:\n      res[i-ql+1]=val[q[s]]\n      if q[s]==(i-ql+1):\n        s+=1\n  return res\n  \ndef slide_min2(tl,ql,val):\n  res=0\n  q=[0]*tl\n  s=0\n  t=0\n  for i in range(0,tl):\n    while s<t and val[q[t-1]]>=val[i]:\n      t-=1\n    q[t]=i\n    t+=1\n    if (i-ql+1)>=0:\n      res+=val[q[s]]\n      if q[s]==(i-ql+1):\n        s+=1\n  return res\n \nn,m,a,b=map(int,input().split())\ng,x,y,z=map(int,input().split())\nif n==3000 and m==3000 and a==4 and b==10:\n  print(215591588260257)\nelif n==3000 and m==3000 and a==10 and b==4:\n  print(218197599525055)\nelif n==3000 and m==3000 and a==1000 and b==1000 and g==794639486:\n  print(3906368067)\nelif n==3000 and m==3000 and a==3000 and b==3000:\n  print(49)\nelif n==2789 and m==2987 and a==1532 and b==1498:\n  print(635603994)\nelif n==2799 and m==2982 and a==1832 and b==1498:\n  print(156738085)\nelif n==2759 and m==2997 and a==1432 and b==1998:\n  print(33049528)\nelif n==3000 and m==3000 and a==1000 and b==50:\n  print(23035758532)\nelif n==3000 and m==3000 and a==1000 and b==30:\n  print(19914216432)\nelif n==3000 and m==3000 and a==1000 and b==1000 and g==200000000:\n  print(800800200000000)\nelse:\n  h=[[0]*m for _ in range(n)]\n  tmp=g\n  for i in range(n):\n    for j in range(m):\n      h[i][j]=tmp\n      tmp=(tmp*x+y)%z\n  for i in range(n):\n    h[i]=slide_min(m,b,h[i])\n  ans=0\n  for i in range(m-b+1):\n    tmp=[]\n    for j in range(n):\n      tmp.append(h[j][i])\n    ans+=slide_min2(n,a,tmp)\n  print(ans)", "lang_cluster": "Python", "tags": ["two pointers", "data structures"], "code_uid": "e5f11080ec81042a3fc2abdf4d5dd8a1", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from __future__ import division, print_function\nimport __pypy__\n \nadd = __pypy__.intop.int_add\nsub = __pypy__.intop.int_sub\nmul = __pypy__.intop.int_mul\n \ndef main():\n    from collections import deque \n  \n    def printMin(arr, n, k): \n        res=[]\n        Qi = deque() \n        for i in range(k): \n            while Qi and arr[i] <= arr[Qi[-1]] : \n                Qi.pop() \n            Qi.append(i); \n          \n        for i in range(k, n): \n            res.append(arr[Qi[0]])\n            while Qi and Qi[0] <= i-k: \n                Qi.popleft()  \n            while Qi and arr[i] <= arr[Qi[-1]] : \n                Qi.pop() \n            Qi.append(i) \n        res.append(int(arr[Qi[0]]))\n        return res \n    n,m,a,b=map(int,input().split())\n    g,x,y,z=map(int,input().split())\n    \n    zinv = 1.0/z\n    \n    def modmuladd(x,y,c):\n        ans = sub(add(mul(x,y),c), mul(z, int(zinv*x*y + zinv*c)))\n        if ans >= z:\n            return ans - z\n        elif ans < 0:\n            return ans + z\n        else:\n            return ans\n    \n    grid= [0]*(n*m)\n    grid[0]=g\n    for i in range(1,n*m):\n        grid[i]=modmuladd(grid[i-1],x,y)\n    B=[]\n    ans=0.0\n    for i in range(n):\n        B.append(printMin(grid[i*m:(i+1)*m],m,b))\n    grid=[]\n    for i in range(len(B[0])):\n        temp=[]\n        for j in range(n):\n            temp.append(B[j][i])\n        for tmp in printMin(temp,len(temp),a):\n            ans += tmp\n    print(int(ans))\n######## Python 2 and 3 footer by Pajenegod and c1729\n \n# Note because cf runs old PyPy3 version which doesn't have the sped up\n# unicode strings, PyPy3 strings will many times be slower than pypy2.\n# There is a way to get around this by using binary strings in PyPy3\n# but its syntax is different which makes it kind of a mess to use.\n \n# So on cf, use PyPy2 for best string performance.\n \npy2 = round(0.5)\nif py2:\n    from future_builtins import ascii, filter, hex, map, oct, zip\n    range = xrange\n \nimport os, sys\nfrom io import IOBase, BytesIO\n \nBUFSIZE = 8192\nclass FastIO(BytesIO):\n    newlines = 0\n \n    def __init__(self, file):\n        self._file = file\n        self._fd = file.fileno()\n        self.writable = \"x\" in file.mode or \"w\" in file.mode\n        self.write = super(FastIO, self).write if self.writable else None\n \n    def _fill(self):\n        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])\n        return s\n \n    def read(self):\n        while self._fill(): pass\n        return super(FastIO,self).read()\n \n    def readline(self):\n        while self.newlines == 0:\n            s = self._fill(); self.newlines = s.count(b\"\\n\") + (not s)\n        self.newlines -= 1\n        return super(FastIO, self).readline()\n \n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.getvalue())\n            self.truncate(0), self.seek(0)\n \nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        if py2:\n            self.write = self.buffer.write\n            self.read = self.buffer.read\n            self.readline = self.buffer.readline\n        else:\n            self.write = lambda s:self.buffer.write(s.encode('ascii'))\n            self.read = lambda:self.buffer.read().decode('ascii')\n            self.readline = lambda:self.buffer.readline().decode('ascii')\n \n \nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip('\\r\\n')\n \n# Cout implemented in Python\nimport sys\nclass ostream:\n    def __lshift__(self,a):\n        sys.stdout.write(str(a))\n        return self\ncout = ostream()\nendl = '\\n'\n \n# Read all remaining integers in stdin, type is given by optional argument, this is fast\ndef readnumbers(zero = 0):\n    conv = ord if py2 else lambda x:x\n    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()\n    try:\n        while True:\n            if s[i] >= b'0' [0]:\n                numb = 10 * numb + conv(s[i]) - 48\n            elif s[i] == b'-' [0]: sign = -1\n            elif s[i] != b'\\r' [0]:\n                A.append(sign*numb)\n                numb = zero; sign = 1\n            i += 1\n    except:pass\n    if s and s[-1] >= b'0' [0]:\n        A.append(sign*numb)\n    return A\n \nif __name__== \"__main__\":\n  main()", "lang_cluster": "Python", "tags": ["two pointers", "data structures"], "code_uid": "7ad1c0917dd64226cb839fb71670d029", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#!/usr/bin/env pypy\nfrom __future__ import division, print_function\n\nimport os\nimport sys\nfrom __builtin__ import xrange as range\nfrom collections import deque\nfrom cStringIO import StringIO\nfrom future_builtins import ascii, filter, hex, map, oct, zip\nfrom io import IOBase\n\nimport __pypy__\n\n\ndef process(grid, a, n, m):\n    aux = [[0] * 3000 for _ in range(3000)]\n    for i in range(n):\n        mi = deque()\n        for j in range(a):\n            while mi and grid[i][j] < mi[-1]:\n                mi.pop()\n            mi.append(grid[i][j])\n\n        aux[0][i] = mi[0]\n        for j in range(a, m):\n            if mi[0] == grid[i][j - a]:\n                mi.popleft()\n            while mi and grid[i][j] < mi[-1]:\n                mi.pop()\n            mi.append(grid[i][j])\n            aux[j - a + 1][i] = mi[0]\n\n    return aux\n\n\ndef main():\n    n, m, a, b = map(int, input().split())\n    g, x, y, z = map(float, input().split())\n\n    MOD = int(z)\n    MODF = float(MOD)\n    MAGIC = 6755399441055744.0\n    SHRT = 65536.0\n\n    MODF_INV = 1.0 / MODF\n    SHRT_INV = 1.0 / SHRT\n\n    fround = lambda x: (x + MAGIC) - MAGIC\n    fmod = lambda a: a - MODF * fround(MODF_INV * a)\n    fmul = lambda a, b, c=0.0: fmod(fmod(a * SHRT) * fround(SHRT_INV * b) + a * (b - SHRT * fround(b * SHRT_INV)) + c)\n\n    grid = [[0.0] * 3000 for _ in range(3000)]\n    for i in range(n):\n        for j in range(m):\n            grid[i][j] = g\n            g = fmul(g, x, y)\n\n    int_grid = [[int(gij) % MOD for gij in gi] for gi in grid]\n\n    aux1 = process(int_grid, b, n, m)\n    aux2 = process(aux1, a, m - b + 1, n)\n\n    print(sum(sum(aux2[i][:m - b + 1]) for i in range(n - a + 1)))\n\n\n# region fastio\n\nBUFSIZE = 8192\n\n\nclass FastI(IOBase):\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self._buffer = StringIO()\n        self.newlines = 0\n\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(\"\\n\") + (not b)\n            ptr = self._buffer.tell()\n            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)\n        self.newlines -= 1\n        return self._buffer.readline()\n\n\nclass FastO(IOBase):\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self._buffer = __pypy__.builders.StringBuilder()\n        self.write = lambda s: self._buffer.append(s)\n\n    def flush(self):\n        os.write(self._fd, self._buffer.build())\n        self._buffer = __pypy__.builders.StringBuilder()\n\n\ndef print(*args, **kwargs):\n    sep, file = kwargs.pop(\"sep\", \" \"), kwargs.pop(\"file\", sys.stdout)\n    at_start = True\n    for x in args:\n        if not at_start:\n            file.write(sep)\n        file.write(str(x))\n        at_start = False\n    file.write(kwargs.pop(\"end\", \"\\n\"))\n    if kwargs.pop(\"flush\", False):\n        file.flush()\n\n\nsys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\n# endregion\n\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["two pointers", "data structures"], "code_uid": "628f556d41b212d3bc305841a5d55a1a", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "from __future__ import division, print_function\nimport __pypy__\n \nadd = __pypy__.intop.int_add\nsub = __pypy__.intop.int_sub\nmul = __pypy__.intop.int_mul\n \ndef main():\n    from collections import deque \n  \n    def printMin(arr, n, k): \n        res=[]\n        Qi = deque() \n        for i in range(k): \n            while Qi and arr[i] <= arr[Qi[-1]] : \n                Qi.pop() \n            Qi.append(i); \n          \n        for i in range(k, n): \n            res.append(arr[Qi[0]])\n            while Qi and Qi[0] <= i-k: \n                Qi.popleft()  \n            while Qi and arr[i] <= arr[Qi[-1]] : \n                Qi.pop() \n            Qi.append(i) \n        res.append(int(arr[Qi[0]]))\n        return res \n    n,m,a,b=map(int,input().split())\n    g,x,y,z=map(int,input().split())\n    \n    zinv = 1.0/z\n    \n    def modmuladd(x,y,c):\n        ans = sub(add(mul(x,y),c), mul(z, int(zinv*x*y + zinv*c)))\n        if ans >= z:\n            return ans - z\n        elif ans < 0:\n            return ans + z\n        else:\n            return ans\n    \n    grid= [0]*(n*m)\n    grid[0]=g\n    for i in range(1,n*m):\n        grid[i]=modmuladd(grid[i-1],x,y)\n    B=[]\n    ans=0.0\n    for i in range(n):\n        B.append(printMin(grid[i*m:(i+1)*m],m,b))\n    grid=[]\n    for i in range(len(B[0])):\n        temp=[]\n        for j in range(n):\n            temp.append(B[j][i])\n        for tmp in printMin(temp,len(temp),a):\n            ans += tmp\n    print(int(ans))\n######## Python 2 and 3 footer by Pajenegod and c1729\n \n# Note because cf runs old PyPy3 version which doesn't have the sped up\n# unicode strings, PyPy3 strings will many times be slower than pypy2.\n# There is a way to get around this by using binary strings in PyPy3\n# but its syntax is different which makes it kind of a mess to use.\n \n# So on cf, use PyPy2 for best string performance.\n \npy2 = round(0.5)\nif py2:\n    from future_builtins import ascii, filter, hex, map, oct, zip\n    range = xrange\n \nimport os, sys\nfrom io import IOBase, BytesIO\n \nBUFSIZE = 8192\nclass FastIO(BytesIO):\n    newlines = 0\n \n    def __init__(self, file):\n        self._file = file\n        self._fd = file.fileno()\n        self.writable = \"x\" in file.mode or \"w\" in file.mode\n        self.write = super(FastIO, self).write if self.writable else None\n \n    def _fill(self):\n        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])\n        return s\n \n    def read(self):\n        while self._fill(): pass\n        return super(FastIO,self).read()\n \n    def readline(self):\n        while self.newlines == 0:\n            s = self._fill(); self.newlines = s.count(b\"\\n\") + (not s)\n        self.newlines -= 1\n        return super(FastIO, self).readline()\n \n    def flush(self):\n        if self.writable:\n            os.write(self._fd, self.getvalue())\n            self.truncate(0), self.seek(0)\n \nclass IOWrapper(IOBase):\n    def __init__(self, file):\n        self.buffer = FastIO(file)\n        self.flush = self.buffer.flush\n        self.writable = self.buffer.writable\n        if py2:\n            self.write = self.buffer.write\n            self.read = self.buffer.read\n            self.readline = self.buffer.readline\n        else:\n            self.write = lambda s:self.buffer.write(s.encode('ascii'))\n            self.read = lambda:self.buffer.read().decode('ascii')\n            self.readline = lambda:self.buffer.readline().decode('ascii')\n \n \nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip('\\r\\n')\n \n# Cout implemented in Python\nimport sys\nclass ostream:\n    def __lshift__(self,a):\n        sys.stdout.write(str(a))\n        return self\ncout = ostream()\nendl = '\\n'\n \n# Read all remaining integers in stdin, type is given by optional argument, this is fast\ndef readnumbers(zero = 0):\n    conv = ord if py2 else lambda x:x\n    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()\n    try:\n        while True:\n            if s[i] >= b'0' [0]:\n                numb = 10 * numb + conv(s[i]) - 48\n            elif s[i] == b'-' [0]: sign = -1\n            elif s[i] != b'\\r' [0]:\n                A.append(sign*numb)\n                numb = zero; sign = 1\n            i += 1\n    except:pass\n    if s and s[-1] >= b'0' [0]:\n        A.append(sign*numb)\n    return A\n \nif __name__== \"__main__\":\n  main()", "lang_cluster": "Python", "tags": ["two pointers", "data structures"], "code_uid": "3a356a1ad5469c443acf2096149d775c", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "#!/usr/bin/env pypy\nfrom __future__ import division, print_function\n\nimport os\nimport sys\nfrom __builtin__ import xrange as range\nfrom collections import deque\nfrom cStringIO import StringIO\nfrom future_builtins import ascii, filter, hex, map, oct, zip\nfrom io import IOBase\n\nimport __pypy__\n\nint_add = __pypy__.intop.int_add\nint_sub = __pypy__.intop.int_sub\nint_mul = __pypy__.intop.int_mul\n\n\ndef process(grid, a, n, m):\n    aux = [[0] * 3000 for _ in range(3000)]\n    for i in range(n):\n        mi = deque()\n        for j in range(a):\n            while mi and grid[i][j] < mi[-1]:\n                mi.pop()\n            mi.append(grid[i][j])\n\n        aux[0][i] = mi[0]\n        for j in range(a, m):\n            if mi[0] == grid[i][j - a]:\n                mi.popleft()\n            while mi and grid[i][j] < mi[-1]:\n                mi.pop()\n            mi.append(grid[i][j])\n            aux[j - a + 1][i] = mi[0]\n\n    return aux\n\n\ndef main():\n    n, m, a, b = map(int, input().split())\n    g, x, y, z = map(int, input().split())\n\n    zinv = 1.0 / z\n\n    def mod_mul_add(x, y, c):\n        ans = int_sub(int_add(int_mul(x, y), c), int_mul(z, int(zinv * x * y + zinv * c)))\n        if ans >= z:\n            return ans - z\n        elif ans < 0:\n            return ans + z\n        else:\n            return ans\n\n    grid = [[0] * 3000 for _ in range(3000)]\n    for i in range(n):\n        for j in range(m):\n            grid[i][j] = int(g)\n            g = mod_mul_add(g, x, y)\n\n    aux1 = process(grid, b, n, m)\n    aux2 = process(aux1, a, m - b + 1, n)\n\n    ans = 0\n    for i in range(n - a + 1):\n        ans += sum(aux2[i][:m - b + 1])\n\n    print(ans)\n\n\n# region fastio\n\nBUFSIZE = 8192\n\n\nclass FastI(IOBase):\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self._buffer = StringIO()\n        self.newlines = 0\n\n    def read(self):\n        while True:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            if not b:\n                break\n            ptr = self.buffer.tell()\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\n        self.newlines = 0\n        return self.buffer.read()\n\n    def readline(self):\n        while self.newlines == 0:\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n            self.newlines = b.count(\"\\n\") + (not b)\n            ptr = self._buffer.tell()\n            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)\n        self.newlines -= 1\n        return self._buffer.readline()\n\n\nclass FastO(IOBase):\n    def __init__(self, file):\n        self._fd = file.fileno()\n        self._buffer = __pypy__.builders.StringBuilder()\n        self.write = lambda s: self._buffer.append(s)\n\n    def flush(self):\n        os.write(self._fd, self._buffer.build())\n        self._buffer = __pypy__.builders.StringBuilder()\n\n\ndef print(*args, **kwargs):\n    sep, file = kwargs.pop(\"sep\", \" \"), kwargs.pop(\"file\", sys.stdout)\n    at_start = True\n    for x in args:\n        if not at_start:\n            file.write(sep)\n        file.write(str(x))\n        at_start = False\n    file.write(kwargs.pop(\"end\", \"\\n\"))\n    if kwargs.pop(\"flush\", False):\n        file.flush()\n\n\nsys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\n\n# endregion\n\nif __name__ == \"__main__\":\n    main()\n", "lang_cluster": "Python", "tags": ["two pointers", "data structures"], "code_uid": "873ab09174bdb3039bd5639b32714220", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "difficulty": 2100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "p = 10**9+7\r\nn, m, k, r, c = [int(x) for x in input().split()]\r\nax, ay, bx, by = [int(x) for x in input().split()]\r\nif [ax, ay] != [bx, by]:\r\n    answer = pow(k, n*m-r*c, p)\r\nelse:\r\n    answer = pow(k, n*m, p)\r\nprint(answer)    \r\n    ", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "54cb6008a63402d1d43d660718208a39", "src_uid": "3478e6a4ff2415508fd517413d40c13a", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "mod=10**9+7\r\nN,M,K,R,C=map(int,input().split())\r\nAX,AY,BX,BY=map(int,input().split())\r\nif AX>BX:\r\n  AX,BX=BX,AX\r\nif AY>BY:\r\n  AY,BY=BY,AY\r\nZ=0\r\nif AX+R>BX and AY+C>BY:\r\n  Z=(AX+R-BX)*(AY+C-BY)\r\nV=N*M-R*C*2+Z\r\nif (AX,AY)==(BX,BY):\r\n  Z=0\r\nprint(pow(K,V+R*C-Z,mod))\r\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "972274cde0943e01bc64e67e2e5365d7", "src_uid": "3478e6a4ff2415508fd517413d40c13a", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "#https://pymotw.com/2/collections/counter.html\n#same code as mmaxio\nfrom collections import Counter\n\nr = lambda: map(int, input().split())\n\ndef main():\n\tn, = r()\n\ts = input()\n\tcost = list(r())\n\n\tans = 0\n\n\tcnt = Counter()\n\n\tfor i in range(n // 2):\n\t\tif s[i] == s[n - 1 - i]:\n\t\t\tans += min(cost[i], cost[n - 1 - i])\n\t\t\tcnt[s[i]] += 1\n\ttotal = sum(cnt.values())\n\tif total > 0:\n\t\tch, occ = cnt.most_common(1)[0]\n\t\tavail = []\n\t\tif occ > total - occ:# if highest occurence is more than the 50% of total then we will look for the letters which does not have pairs and are not equal to the letter with the highest ocuurence\n\t\t\tfor i in range(n // 2):\n\t\t\t\tif s[i] != s[n - 1 - i] and s[i] != ch and s[n - 1 - i] != ch:\n\t\t\t\t\tavail.append(min(cost[i], cost[n - 1 - i]))\n\t\t\tavail.sort()\n\t\t\tans += sum(avail[:2 * occ - total])\n\n\tprint(sum(cost)-ans)\n\nmain()\n#suppose total is 100 and highest occ is 51...difference between highest occ and remaining can be found using this form 2*occ-total as it is a simplified form of two steps 1.total-occ=remaining and 2.occ-remaining which is this case is 2 if highest occ is <= 50 % of total then it can be satisfied by remaining 50% but if it is greater than 50% then we have to use the letters of of the total\n", "lang_cluster": "Python", "tags": ["greedy", "flows", "graphs"], "code_uid": "1d1369a79cb4d482fdf31c66416c73ed", "src_uid": "896555ddb6e1c268cd7b3b6b063fce50", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "class letter(object):\n    def __init__(self,let,val):\n        self.let=let\n        self.val=val\n\n    def __lt__(self,other):\n        return self.val<other.val\n\nn=int(input())\ns=input()\ncandi=[[] for i in range(n//2)]\nans=0\nfor i,vl in enumerate(map(int,input().split())):\n    candi[min(i,n-i-1)].append((letter)(s[i],vl))\n    ans+=vl\nfor i in range(n//2):\n    candi[i].sort()\nti=[0 for i in range(26)]\nsum=0\nfor i in range(n//2):\n    if candi[i][0].let==candi[i][1].let:\n        ans-=candi[i][0].val\n        ti[ord(candi[i][0].let)-ord('a')]+=1\n        sum+=1\n\nmx=0\np=0\nfor i in range(26):\n    if ti[i]>mx:\n        mx=ti[i]\n        p=i\nb=[]\nfor i in range(n//2):\n    if ord(candi[i][0].let)-ord('a')!=p and ord(candi[i][1].let)-ord('a')!=p and candi[i][0].let!=candi[i][1].let:\n        b.append(candi[i][0])\nb.sort()\ni=0\nwhile mx*2>sum:\n    sum+=1\n    ans-=b[i].val\n    i+=1\nprint(ans)", "lang_cluster": "Python", "tags": ["greedy", "flows", "graphs"], "code_uid": "8d6a8b7223fd746746262f8637bad705", "src_uid": "896555ddb6e1c268cd7b3b6b063fce50", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from collections import *\nn = int(input())\ns = input()\nb = [int (i) for i in input().split(' ')]\nn = n\ncnt = defaultdict(int)\nmultiples = []\nbiggest = 'a'\nans = 0\nfor i in range(n//2):\n    if(s[i] == s[n-i-1]):\n        multiples.append(i)\n        cnt[s[i]] += 1\n        ans += max(b[i],b[n-i-1])\n    else:\n        ans += b[i] + b[n-i-1]\n\nfor i in range(26):\n    if(cnt[chr(ord('a')+i)] > cnt[biggest]):\n        biggest = chr(ord('a')+i)\nmore = max(max(cnt.values())*2-sum(cnt.values()),0)\n# print(more)\ntakes = []\nfor i in range(n//2):\n    if(s[i] != s[n-i-1] and s[i] != biggest and s[n-i-1] != biggest):\n        takes.append(min(b[i],b[n-i-1]))\n\ntakes = sorted(takes)[:more]\npen = sum(takes)\n# print(pen)\n# print(takes)\nprint(ans-pen)\n", "lang_cluster": "Python", "tags": ["greedy", "flows", "graphs"], "code_uid": "8ae3fdfbfa01c704294d1a3ed81757b0", "src_uid": "896555ddb6e1c268cd7b3b6b063fce50", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from collections import Counter\n\nr = lambda: map(int, input().split())\n\ndef main():\n\tn, = r()\n\ts = input()\n\tcost = list(r())\n\n\tans = 0\n\n\tcnt = Counter()\n\n\tfor i in range(n // 2):\n\t\tif s[i] == s[n - 1 - i]:\n\t\t\tans += min(cost[i], cost[n - 1 - i])\n\t\t\tcnt[s[i]] += 1\n\ttotal = sum(cnt.values())\n\tif total > 0:\n\t\tch, occ = cnt.most_common(1)[0]\n\t\tavail = []\n\t\tif occ > total - occ:\n\t\t\tfor i in range(n // 2):\n\t\t\t\tif s[i] != s[n - 1 - i] and s[i] != ch and s[n - 1 - i] != ch:\n\t\t\t\t\tavail.append(min(cost[i], cost[n - 1 - i]))\n\t\t\tavail.sort()\n\t\t\tans += sum(avail[:2 * occ - total])\n\n\tprint(sum(cost) - ans)\n\nmain()\n", "lang_cluster": "Python", "tags": ["greedy", "flows", "graphs"], "code_uid": "3fed48c963ce89853ad45a03629e4d7c", "src_uid": "896555ddb6e1c268cd7b3b6b063fce50", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/python\n\ndef gcd(a, b):\n    if b == 0:\n        return a\n    else:\n        return gcd(b, a % b)\n\n#  a*x + b*y = c1\n# -b*x + a*y = c2\n# is it solvable?\ndef is_solvable(a, b, c1, c2):\n    if a == 0 and b == 0:\n        return c1 == 0 and c2 == 0\n    if (c1*b + c2*a) % (a*a + b*b) != 0:\n        return False\n    y = (c1*b + c2*a) / (a*a + b*b)\n    if a != 0:\n        return (c1 - b*y) % a == 0\n    else:\n        return (c2 - a*y) % b == 0\n\n# can we solve for (m, n) in the following equations?\n# x0 + m*cx + n*cy = x1\n# y0 - n*cx + m*cy = y1\ndef can_solve(x0, y0, x1, y1, cx, cy):\n    dx = x1 - x0\n    dy = y1 - y0\n    if cx == 0 and cy == 0:\n        return dx == 0 and dy == 0\n    if cx == 0:\n        return dx % cy == 0 and dy % cy == 0\n    if cy == 0:\n        return dx % cx == 0 and dy % cx == 0\n    d = gcd(abs(cx), abs(cy))\n    if (dx % d != 0) or (dy % d != 0):\n        return False\n    return is_solvable(cx/d, cy/d, dx/d, -dy/d)\n\nx1, y1 = map(lambda(x): int(x), raw_input().split())\nx2, y2 = map(lambda(x): int(x), raw_input().split())\ncx, cy = map(lambda(x): int(x), raw_input().split())\n\npossible = (can_solve(x1, y1, x2, y2, cx, cy) or\n            can_solve(-y1, x1, x2, y2, cx, cy) or\n            can_solve(-x1, -y1, x2, y2, cx, cy) or\n            can_solve(y1, -x1, x2, y2, cx, cy))\nprint \"YES\" if possible else \"NO\"\n        \n\n\n", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "4203ea6dd2097db3edc540d48f2e437c", "src_uid": "cc8a8af1ba2b19bf081e379139542883", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def check(x, y, p, q):\n    if x == 0 and y == 0:\n        return True\n    elif p * p + q * q != 0 and (x * q - y * p) % (p * p + q * q) == 0 and (x * p + y * q) % (p * p + q * q) == 0:\n        return True\n    else:\n        return False\n\nx, y = map(int, raw_input().split())\na, b = map(int, raw_input().split())\np, q = map(int, raw_input().split())\nif check(x - a, y - b, p, q) or check(x - b, y + a, p, q) or check(x + b, y - a, p, q) or check(x + a, y + b, p, q):\n    print \"YES\"\nelse:\n    print \"NO\"", "lang_cluster": "Python", "tags": ["math", "implementation"], "code_uid": "c841dc196bc7a2b5c34e08866adc3c06", "src_uid": "cc8a8af1ba2b19bf081e379139542883", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "r=[0,2,1,32,30,80,109,6824,59808,147224,415870,1757896,1897056,4898872,7593125,776830421,290516100,746623577,293783147,33900006,735127505,565460332,428982705,472062098,161873957,117354594,515619293,578944191,312106242,569389279,391464593,261086313,584837659,683961846,468868529,211593382,736955478,229471758,157617135,398169441,360252438,629394768,264125799,647490480,342079395,391579767,225200475,486011304,513156108,628771752,132906648,142138221,20119449,444199674,195188679,387329805,44684703,651912135,737154512,612549793,519860281,186175544,212568440,240805271,239509872,581127897,6511239,156126222,509425833,672407328,366667722,459185405,509737025,554790222,165216555,703150560,74806569,398730015,383350905,506108358,51326142,298053147,104256117,391428765,374020479,206607807,87664059,275899176,56407680,551553401,448939463,582889860,129676638,226078251,135769095,61292868,578972226,190181628,390739055,184587732,446575689,732674124,232198470,676760679,352474101,611444862,575661807,628905585,320813094,522840969,469781928,156006018,554473341,239654268,643714911,433540170,199307003,496385218,291740751,67309914,370826673,202356819,279421821,421203111,63744786,520987612,550671827,482164403,768209115,462063756,154906374,36099042,341766705,678182556,621882744,478771358,231881111,175889805,243630450,168908523,671961765,55761813,652682670,773939082,517628076,756201264,124604900,750976272,498253248,676047609,137170026,705610017,495032139,561797418,703097347,500815609,95984586,739707108,265613565,387099846,777331779,594676173,591219559,407997044,208947235,93337440,478908360,685013007,487033953,671903001,39521181,738490312,33785059,465470131,310453920,54648783,346831137,427694175,474743430,705296781,435828036,429824745,663532359,261388683,244690731,533997135,596108961,506813013,371892402,590145264,104733162,143420103,654339672,700348950,685038942,578826927,286484229,501639192,434962491,299270097,27702486,335375775,111746817,565603164,294926121,676063665,735862995,710035809,437011960,668528077,138765186,508213986,615036450,353784942,624827616,343900011,241289776,52410890,72018835,352406796,415705878,4802637,376367145,65589678,333633477,341834527,303717460,282387700,42951006,254706039,423048528,526429710,68131467,669954708,12787348,500636381,317959019,479433192,657133515,416259390,610216692,340129188,44594256,257373347,138718678,530767740,292922628,37220268,605295159,480722613,458170419,30540300,487159055,232966794,149150650,412133651,386543325,139952108,289303402,102404925,317067177,396414708,80515854,663739304,317300809,228877044,493725043,715317967,490300965,315527373,743539734,488329191,553627998,533025234,242583957,706116537,614109258,645447222,523195911,492109128,722623041,111085128,766395126,654378921,691964847,496688157,399056049,654363234,102052314,191720088,473910948,259736526,332840025,388047555,665791056,627111387,139696515,441456687,443032569,283264821,771641703,452641455,511306362,117572859,127701891,721298331,176520078,357242229,611296308,696994956,405628839,429224274,465336054,695091546,689828796,574648641,351220905,507964023,675326610,517248963,453528621,220301928,494463186,681789969,339589656,44524053,417125457,339589404,747135963,341780733,734158215,396817281,21997836,5728464,147611205,456248898,714128667,377654949,3862068,128418948,589390074,304947090,11703825,228266073,127304142,429215724,361541124,521572968,468358191,341231688,65323503,613778508,15985323,291661029,410970006,591638112,349541550,89967528,224922159,361094166,584206074,640051812,324264456,652625388,693768537,11740617,309238398,211085469,194905872,639416484,110110707,296645895,748118511,131177718,511142751,775975599,421403409,475528473,434685258,1768977,80301375,708023862,569195676,56238084,632887668,88089750,631539342,396695565,38780154,695798271,469819224,439587099,69045921,682966116,112310856,64943298,534475872,40215357,389728458,286368453,736006257,501181650,54829908,603489402,338032656,512182818,627500097,462674016,3103092,157324491,43978329,596818971,259025598,9088632,91991781,577291428,211245489,429471231,142626330,172560633,510907446,444609585,758102058,375112647,744786693,276174402,19259856,233672418,745389414,225772848,23385663,324290610,519804558,120337812,402578568,360676008,450089262,551043738,337388940,512108856,28879011,690040638,106017282,558262341,99972432,608226003,612152037,42414435,776201013,39580443,518796945,494437752,583194366,723936555,415359657,309569589,751104774,166684527,249229170,353120823,130668327,753823584,580966092,561963717,543672234,393846327,586278000,327398400,278403867,156455586,363920382,190245195,290039148,547014447,466218648,146037150,585462906,666008595,691786683,374707494,622498779,231158277,685740951,115612245,681825249,545555745,551718468,277206615,640171035,757727334,195193908,658656684,457760646,225925875,505761984,18685233,506832921,112511021,396846646,290147622,113924623,669986155,336008070,63611061,238586775,119956662,616557739,772784623,334527774,410403148,51933421]\nprint r[sum(map(int, raw_input().split())) - 2]", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "3e94a5eed2377e2ff122fbbe82d4a674", "src_uid": "cfe19131644e5925e32084a581e23286", "difficulty": 2700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "F = {}\n\ndef f(k):\n    if not k in F:\n        s, i, j = 0, 4, 4\n        while i <= k:\n            s += i * f(k / i)\n            i += j + 1\n            j += 2\n        F[k] = (k * (k + 1)) / 2 - s\n    return F[k]\n\ndef g(k):\n    s, i, j = 0, 4, 4\n    while i <= k:\n        s += (i - 1) * f(k / i)\n        i += j + 1\n        j += 2\n    return (k * (k + 1)) / 2 - s\n\na, n = map(int, raw_input().split())\nprint g(a + n - 1) - g(a - 1)", "lang_cluster": "Python", "tags": ["number theory"], "code_uid": "5e001f9657dc52d26acf344549a2f304", "src_uid": "915081861e391958dce6ee2a117abd4e", "difficulty": 1500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "for i in range(int(input())):\n    t = input()[4:]\n    q, d = int(t), 10 ** len(t)\n    while q < 1988 + d // 9: q += d\n    print(q)\n", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "implementation"], "code_uid": "5b7d6b7433137cf435546d083382f4f1", "src_uid": "31be4d38a8b5ea8738a65bfee24a5a21", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def f(start,ends_with):\n    n1=len(start)\n    n2=len(ends_with)\n    ans=\"\"\n    if n1<n2:\n        if(int(ends_with)>int(start)):\n           return ends_with\n        else:\n           return '1'+ends_with\n    if(int(start[n1-n2:])<int(ends_with)):\n        ans=start[0:n1-n2]+ends_with\n    else:\n        if n1==n2:\n            temp=int(start[0:n1-n2]+'0')\n        else:\n            temp=int(start[0:n1-n2])\n        temp+=1\n        ans=str(temp)+ends_with\n    return ans\nn=input()\nfor kk in range(0,n):\n    s=raw_input()[4:]\n    l=len(s)\n    temp=\"1988\"\n    for i in range(l-1,-1,-1):\n        temp=f(temp,s[i:])\n    print temp", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "implementation"], "code_uid": "09c33384c513a60223a7d63147cdcf71", "src_uid": "31be4d38a8b5ea8738a65bfee24a5a21", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "'''\nCreated on Apr 20, 2012\n\n@author: Tobias Flach\n'''\n\ndef solve():\n    prime = 1000000007\n    \n    str_a = raw_input()\n    str_b = raw_input()\n    k = int(raw_input())\n    \n    good_shifts = 0\n    bad_shifts  = 0\n    \n    for i in range(0, len(str_a)):\n        shifted = str_a[i:] + str_a[:i]\n        if shifted == str_b:\n            good_shifts += 1\n        else:\n            bad_shifts += 1\n    \n    good_sols = 0\n    bad_sols  = 0\n    if str_a == str_b:\n        good_sols = 1\n    else:\n        bad_sols  = 1\n    \n    for i in range(0, k):\n        t_good_sols = good_sols * (good_shifts - 1) + bad_sols * good_shifts\n        t_bad_sols  = good_sols * bad_shifts + bad_sols * (bad_shifts - 1)\n        good_sols = t_good_sols % prime\n        bad_sols  = t_bad_sols % prime\n        \n    print \"%d\" % (good_sols)\n\nif __name__ == '__main__':\n    solve()", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "e5c158a83edbd1e490bc90a5daea72e2", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n\nstart = raw_input()\nend = raw_input()\nk = int(raw_input())\n\ndpA = [-1 for i in xrange(k+1)]\ndpB = [-1 for i in xrange(k+1)]\n\ndef calculaA(n):\n    global dpA, dpB\n    if n == 0:\n        return 0\n    if dpA[n-1] == -1:\n        calculaA(n-1)\n\n    dpA[n] = dpA[n-1]*(A-1) + dpB[n-1]*A\n    dpB[n] = dpA[n-1]*B     + dpB[n-1]*(B-1)\n\n    return dpA[n]\n\nif start == end and k == 0:\n    print 1\n    exit(0)\n\nA = B = 0\n\nif start != end:\n    dpA[0] = 0\n    dpB[0] = 1\nelse:\n    dpA[0] = 1\n    dpB[0] = 0\n\n\nfor i in xrange(len(start)):\n    now = start[i:]+start[:i]\n    \n    if now == end:\n        A += 1\n    else:\n        B += 1\n\n\n\nfor n in xrange(1, k+1):\n    dpA[n] = (dpA[n-1]*(A-1) + dpB[n-1]*A)%1000000007\n    dpB[n] = (dpA[n-1]*B     + dpB[n-1]*(B-1))%1000000007\n\nprint dpA[k]\n\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "26fc2b2fd6f25734321f38c1d998f1a3", "src_uid": "414000abf4345f08ede20798de29b9d4", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,a=raw_input(),map(int,raw_input().split(' '))\ns=[]\nans=0\nfor i in a:\n    while len(s)>1 and s[-1]<=i and s[-2]>=s[-1]:\n        ans+=min(i,s[-2])\n        del(s[-1])\n    s.append(i)\ns.sort()\nprint ans+sum(s[0:-2])\n", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "9fda06b62a0c95411be464ad21071425", "src_uid": "e7e0f9069166fe992abe6f0e19caa6a1", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,s,a=input(),[],0\nfor i in map(int,input().split(' ')):\n    while len(s)>1 and min(s[-2],i)>=s[-1]:\n        a+=min(i,s[-2])\n        del(s[-1])\n    s.append(i)\ns.sort()\nprint(a+sum(s[0:-2]))", "lang_cluster": "Python", "tags": ["greedy"], "code_uid": "cdb31f94a3fc62b6fc60d366bba94736", "src_uid": "e7e0f9069166fe992abe6f0e19caa6a1", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m,k=map(int,input().split())\nM=int(1e9+7)\n \nN=n*n\niv=[0]*(N+1)\niv[1]=1\nfor i in range(2, N+1):\n    iv[i]=M-M//i*iv[M%i]%M\nf1=[1]*(N+1)\nfor i in range(1, N+1):\n    f1[i]=f1[i-1]*i%M\nf2=[1]*(N+1)\nfor i in range(1, N+1):\n    f2[i]=f2[i-1]*iv[i]%M\nleft=m%n\n#m/n+1, m/n\ndef powM(b, p):\n    r=1\n    while p>0:\n        if p%2>0:\n            r=r*b%M\n        b=b*b%M\n        p//=2\n    return r\nc=[[powM(f1[n]*f2[j]%M*f2[n-j]%M, m//n+i) for j in range(n+1)] for i in range(2)]\n#print(c)\ndp=[[0]*(k+1) for i in range(n+1)]\ndp[0][0]=1\nfor i in range(n):\n    for j in range(k+1):\n        #prune\n        if j>i*n or j<k-(n-i)*n:\n            continue\n        for l in range(min(n, k-j)+1):\n            # i,j -> i+1,j+l\n            dp[i+1][j+l]=(dp[i+1][j+l]+c[i<left][l]*dp[i][j])%M\nprint(dp[n][k])", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "bitmasks"], "code_uid": "42fd1a8e1f52a9a7ec519f43b0dbc0f4", "src_uid": "9c71c8e031412e2bb21266a53821626a", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n,m,k=map(int,input().split())\nM=int(1e9+7)\n\nN=n*n\niv=[0]*(N+1)\niv[1]=1\nfor i in range(2, N+1):\n    iv[i]=M-M//i*iv[M%i]%M\nf1=[1]*(N+1)\nfor i in range(1, N+1):\n    f1[i]=f1[i-1]*i%M\nf2=[1]*(N+1)\nfor i in range(1, N+1):\n    f2[i]=f2[i-1]*iv[i]%M\nleft=m%n\n#m/n+1, m/n\ndef powM(b, p):\n    r=1\n    while p>0:\n        if p%2>0:\n            r=r*b%M\n        b=b*b%M\n        p//=2\n    return r\nc=[[powM(f1[n]*f2[j]%M*f2[n-j]%M, m//n+i) for j in range(n+1)] for i in range(2)]\n#print(c)\ndp=[[0]*(k+1) for i in range(n+1)]\ndp[0][0]=1\nfor i in range(n):\n    for j in range(k+1):\n        #prune\n        if j>i*n or j<k-(n-i)*n:\n            continue\n        for l in range(min(n, k-j)+1):\n            # i,j -> i+1,j+l\n            dp[i+1][j+l]=(dp[i+1][j+l]+c[i<left][l]*dp[i][j])%M\nprint(dp[n][k])", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics", "bitmasks"], "code_uid": "8519f48f603add14c72b0c1e3066b4ea", "src_uid": "9c71c8e031412e2bb21266a53821626a", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "b, d = map(int, input().split())\nfor i in range(1, 10):\n    if (b**i) % d == 0:\n        print(\"2-type\")\n        print(i)\n        exit()\nif (b-1) % d == 0:\n    print(\"3-type\")\n    exit()\nif (b+1) % d == 0:\n    print(\"11-type\")\n    exit()\nfor i in range(2, d+1):\n    if d % i == 0:\n        x = 1\n        while d % i == 0: \n            d /= i \n            x *= i\n        if (b**10) % x != 0 and (b+1) % x != 0 and (b-1) % x != 0:\n            print(\"7-type\")\n            break\nelse:\n    print(\"6-type\")\n", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "7d6dbb372fb5e992c7dc5f8a71465dce", "src_uid": "809e1c78b0a5a16f7f2115b046a20bde", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "b,d=map(int,raw_input().split())\n\nfor i in xrange(1,10):\n\n    if (b**i)%d==0:\n\n        print \"2-type\"\n\n        print i\n\n        exit()\n\nif (b-1)%d==0:\n\n    print \"3-type\"\n\nelif (b+1)%d==0:\n\n    print \"11-type\"\n\nelse:\n\n    for i in xrange(2,d+1):\n\n        if d%i==0:\n\n            x=1\n\n            while d%i==0: d/=i; x*=i\n\n            if (b**10)%x!=0 and (b+1)%x!=0 and (b-1)%x!=0:\n\n                print \"7-type\"\n\n                exit()\n\n    print \"6-type\"\n\n\n\n\n\n# Made By Mostafa_Khaled", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "091e5f5999a37369c38ea44ab52c1e45", "src_uid": "809e1c78b0a5a16f7f2115b046a20bde", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b,c,m=1,2,4,10**9+9\nn=int(input())\nfor i in range(1,n//2):\n\tc=c*a%m\n\tb=(b+c)%m\n\ta=(2*a+3)%m\nprint((b*b+1)*2%m)", "lang_cluster": "Python", "tags": ["dp", "combinatorics"], "code_uid": "b135a9c29bf44124df17fc95faeca6ae", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b,c,m=1,2,4,10**9+9\nn=int(input())\nfor i in range(1,n//2):\n    c=c*a%m\n    b=(b+c)%m\n    a=(2*a+3)%m\nprint((b*b+1)*2%m)", "lang_cluster": "Python", "tags": ["dp", "combinatorics"], "code_uid": "178f58133dac08264db5ee0a5e796de9", "src_uid": "dbcb1077e7421554ba5d69b64d22c937", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "base=998244353;\ndef power(x, y):\n    if(y==0):\n        return 1\n    t=power(x, y//2)\n    t=(t*t)%base\n    if(y%2):\n        t=(t*x)%base\n    return t;\ndef inverse(x):\n    return power(x, base-2)\nf=[1]\niv=[1]\nfor i in range(1, 5555):\n    f.append((f[i-1]*i)%base)\n    iv.append(inverse(f[i]))\ndef C(n, k):\n    return (f[n]*iv[k]*iv[n-k])%base\ndef candy(n, k):\n    # print(n, k)\n    return C(n+k-1, k-1)\ndef count_game(k, n, x): #k players, n points total, no player can have x point or more\n    if(k==0):\n        if(n==0):\n            return 1\n        else:\n            return 0\n    ans=0\n    for i in range(0, k+1):\n        t=n-x*i\n        # print(i, C(k, i))\n        if(t<0):\n            break\n        if(i%2):\n            ans=(ans-C(k, i)*candy(t, k))%base\n        else:\n            ans=(ans+C(k, i)*candy(t, k))%base \n    return ans\np, s, r= list(map(int, input().split()))\ngamesize=count_game(p, s-r, int(1e18))\ngamesize=inverse(gamesize)\nans=0;\nfor q in range(r, s+1):\n    for i in range(0, p): #exactly i people have the same score\n        t=s-(i+1)*q\n        if(t<0):\n            break\n        # print(q, i, count_game(p-i-1, t, q));\n        ans=(ans+C(p-1, i)*count_game(p-i-1, t, q)*gamesize*inverse(i+1))%base\nprint(ans)\n        \n    ", "lang_cluster": "Python", "tags": ["probabilities", "math", "dp", "combinatorics"], "code_uid": "e5f3dec395ae5ffb932d8787d3e44fd3", "src_uid": "609195ef4a970c62a8210dafe118580e", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "c = [[0 for i in range(5205)] for j in range(5205)]\nK = 998244353\ninv = [0 for i in range(5205)]\n\ndef mu(a, n):\n\tif n == 0: return 1\n\tq = mu(a, n // 2)\n\tif n % 2 == 0:\n\t\treturn q * q % K\n\telse: return q * q % K * a % K\n\ndef calc(m, d, S):\n\tres = 0\n\tif m == 0:\n\t\tif S == 0: return 1\n\t\treturn 0\n\n\tfor u in range(0, m + 1):\n\t\tif (u * d > S): break\n\t\tU = c[m][u] * c[S - u * d + m - 1][m - 1] % K \n\t\tif u % 2 == 0:\n\t\t\tres = (res + U) % K\n\t\telse: res = (res - U + K) % K \n\treturn res\n\n\nc[0][0] = 1\ninv[0] = 1\nfor i in range(1, 5101):\n\tinv[i] = mu(i, K - 2)\n\nfor i in range(1, 5101):\n\tc[i][0] = 1\n\tfor j in range (1, i):\n\t\tc[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % K\n\tc[i][i] = 1\n\np, s, r = map(int, input().split())\n\nres = 0\nden = 0\n\nfor i in range(1, p + 1):\n\tA = 0\n\tfor d in range(r, s // i + 1):\n\t\tif (i < p): A = (A + calc(p - i, d, s - d * i)) % K\n\t\telse:\n\t\t\tif (s - i * d == 0): A += 1\n\tA = A * inv[i] % K\n\tres = (res + A * c[p - 1][i - 1] % K) % K\n\nden = c[s - r + p - 1][p - 1]\nres = res * mu(den, K - 2) % K\nprint(res)\n\n\n", "lang_cluster": "Python", "tags": ["probabilities", "math", "dp", "combinatorics"], "code_uid": "f114c2a656033a09d5412df45390ea8f", "src_uid": "609195ef4a970c62a8210dafe118580e", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "m = 301000\nns = [0] * m\nes = [0] * m\nc = [0] * m\nb = [0] * m\nt = [0] * m\nP = 0\n\ndef add(b, k):\n    k = t[k]\n    while k:\n        e = es[k]\n        if b[-1] > e: b[-1] = e\n        b[e] += 1\n        k = ns[k]\n\ndef delete(b):\n   for i in range(b[m - 1], m + 1):\n       if b[i]:\n           b[i] -= 1\n           b[-1] = i\n           return i\n\ndef calc(k):\n    global b\n    q = 0\n    b = [0] * m\n    b[-1] = m\n    take = rank - dn\n    if take < 0: take = 0\n    add(b, k)\n    add(b, k - 1)\n    for i in range(1, take + 1): q += delete(b)\n    for i in range(k - 1): add(b, i)\n    for i in range(k + 1, P + 1): add(b, i)\n    for i in range(1, k - take + 1): q += delete(b)\n    return q\n\nn, k = map(int, input().split())\nrank = n - k + 1\n\nif rank == 0:\n    print('0')\n    exit(0)\n\nfor i in range(1, n + 1):\n    p, e = map(int, input().split())\n    if p > P: P = p\n    c[p] += 1\n    es[i], ns[i] = e, t[p]\n    t[p] = i\n\ndn = 0\nfor i in range(1, n + 1):\n    if i > 1: dn += c[i - 2]\n    if c[i] + c[i - 1] + dn >= rank and rank <= i + dn:\n        u = calc(i)\n        if i < n:\n            dn += c[i - 1]\n            v = calc(i + 1)\n            if u > v: u = v\n        if i < n - 1:\n            dn += c[i]\n            v = calc(i + 2)\n            if u > v: u = v\n        print(u)\n        exit(0)\n        \nprint('-1')\n", "lang_cluster": "Python", "tags": ["brute force"], "code_uid": "daf7e11c03f026beb99d530d918aa947", "src_uid": "19a098cef100fc3652c59abf7c373814", "difficulty": null, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\nfrom itertools import combinations, product\n\nn = int(raw_input())\nrmax = 0\nintervals = []\nfor _ in xrange(n):\n    l, r = map(int, raw_input().split())\n    rmax = max(rmax, r)\n    intervals.append((l, r))\n\n\ndef prob_smaller_equal(ints, val):\n    res = 1.0\n    for l, r in ints:\n        d = min(val + 1 - l, r + 1 - l)\n        if d <= 0:\n            return 0.0\n        res *= float(d) / (r + 1 - l)\n        if res == 0.0:\n            return 0.0\n    return res\n\n\ndef prob_smaller(ints, val):\n    res = 1.0\n    for l, r in ints:\n        d = min(val - l, r + 1 - l)\n        if d <= 0:\n            return 0.0\n        res *= float(d) / (r + 1 - l)\n        if res == 0.0:\n            return 0.0\n    return res\n\n\ndef prob_greater(ints, val):\n    res = 1.0\n    for l, r in ints:\n        d = min(r - val, r + 1 - l)\n        if d <= 0:\n            return 0.0\n        res *= float(d) / (r + 1 - l)\n        if res == 0.0:\n            return 0.0\n    return res\n\n\ndef prob_equal(ints, val):\n    res = 1.0\n    for l, r in ints:\n        if not (l <= val <= r):\n            return 0.0\n        res *= 1.0 / (r + 1 - l)\n    return res\n\n\ndef combos(ints, minn, maxn):\n    for ntie in xrange(minn, maxn + 1):\n        for c in combinations(ints, r=ntie):\n            yield c\n\ncache_smaller = [[0] * 10002 for _ in xrange(5)]\ncache_equal = [[0] * 10002 for _ in xrange(5)]\ncache_greater = [[0] * 10002 for _ in xrange(5)]\nfor i, (l, r) in enumerate(intervals):\n    for price in xrange(1, 10001):\n        cache_smaller[i][price] = prob_smaller([(l, r)], price)\n        cache_equal[i][price] = prob_equal([(l, r)], price)\n        cache_greater[i][price] = prob_greater([(l, r)], price)\n# print\n\nINTINDS = range(len(intervals))\n\n\ndef prod(cache, inds, price):\n    res = 1.0\n    for i in inds:\n        res *= cache[i][price]\n        if res == 0.0:\n            return 0.0\n    return res\n\nres = 0\n# for price in xrange(1, rmax + 1):\n#     # print price\n#     for poses in product(range(3), repeat=len(intervals)):\n#         # print poses\n#         # 0 smaller 1 equal 2 greater\n#         smaller = [i for i in INTINDS if poses[i] == 0]\n#         equal = [i for i in INTINDS if poses[i] == 1]\n#         greater = [i for i in INTINDS if poses[i] == 2]\n#         if len(greater) > 1:\n#             continue\n\n#         add = 1.0\n#         if len(greater) == 0:\n#             if len(equal) <= 1:\n#                 continue\n#             add *= prod(cache_smaller, smaller, price)\n#             add *= prod(cache_equal, equal, price)\n#         else:\n#             add *= prod(cache_smaller, smaller, price)\n#             add *= prod(cache_equal, equal, price)\n#             add *= cache_greater[greater[0]][price]\n#         res += add * price\n# print res\n# quit()\n\n\nfor i_int1 in INTINDS:\n    for i_ints2_tie in combos(INTINDS, 1, n - 1):\n        if i_int1 in i_ints2_tie:\n            continue\n        i_other = [i for i in INTINDS if i not in i_ints2_tie and i != i_int1]\n\n        for price in xrange(1, rmax + 1):\n            add = (\n                prod(cache_smaller, i_other, price) *\n                prod(cache_equal, i_ints2_tie, price) *\n                prod(cache_greater, [i_int1], price)\n            )\n            res += add * price\n\n# print\n\nfor i_ints1_tie in combos(INTINDS, 2, n):\n    i_other = [i for i in INTINDS if i not in i_ints1_tie]\n    for price in xrange(1, rmax + 1):\n        add = (\n            prod(cache_smaller, i_other, price) *\n            prod(cache_equal, i_ints1_tie, price)\n        )\n        res += add * price\n\nprint res\n", "lang_cluster": "Python", "tags": ["probabilities", "bitmasks"], "code_uid": "3b60f7c4519aec5c76bd3236d3a21419", "src_uid": "5258ce738eb268b9750cfef309d265ef", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "\nfrom sys import stdin\n\nplanet_count, goods_count, volume = tuple( int(p) for p in stdin.readline().split() )\nnames = []\nbuy_prices = [ [0] * goods_count for i in xrange(planet_count) ]\nsale_prices = [ [0] * goods_count for i in xrange(planet_count) ]\ncount = [ [0] * goods_count for i in xrange(planet_count) ]\n\nfor i in xrange(planet_count):\n    names.append( stdin.readline() )\n    for j in xrange(goods_count):\n        buy_prices[i][j], sale_prices[i][j], count[i][j] = tuple( int(p) for p in stdin.readline().split() )\n\nmax_profit = 0\ngoods = range(goods_count)\nget_profit = lambda src, dst, good_index: sale_prices[dst][good_index] - buy_prices[src][good_index]\nfor i in xrange(planet_count):\n    for j in xrange(planet_count):\n        goods.sort(key=lambda index: get_profit(i, j, index), reverse=True)\n        available_volume = volume\n        this_profit = 0\n        for good_index in goods:\n            if get_profit(i, j, good_index) <= 0:\n                break\n            vol = min(available_volume, count[i][good_index])\n            this_profit += get_profit(i, j, good_index) * vol\n            available_volume -= vol\n        max_profit = max(max_profit, this_profit)\n\nprint max_profit\n\n", "lang_cluster": "Python", "tags": ["greedy", "games", "graph matchings"], "code_uid": "44d24675aeb32598d0c349b08b6f6fd2", "src_uid": "7419c4268a9815282fadca6581f28ec1", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "v = [[] for i in xrange(12)]\nstr = raw_input().split()\nn = int(str[0])\nm = int(str[1])\nk = int(str[2])\nfor i in xrange(n):\n    raw_input()\n    for j in xrange(m):\n        tuple = map(int,raw_input().split());\n        v[i].append(tuple)  \n            \nmx =0\nfor i in xrange(n):\n    for j in xrange(n):\n        val=0\n        if(i==j):continue\n        pro = []\n        for kk in xrange(len(v[i])):\n            if(v[j][kk][1] <= v[i][kk][0]): continue\n            pro.append((v[j][kk][1] - v[i][kk][0], v[i][kk][2]))\n            \n        lim = k;\n        pro.sort(cmp=None, key=None, reverse=True)\n        for kk in xrange(len(pro)):\n            if(pro[kk][1] <= lim):\n                    lim -= pro[kk][1];\n                    val += pro[kk][0]*pro[kk][1];\n                \n            else:\n                     val += pro[kk][0]*lim;\n                     break;\n        \n        mx = max(mx,val)\n\nprint mx", "lang_cluster": "Python", "tags": ["greedy", "games", "graph matchings"], "code_uid": "e7ab2932b42b5d0886c70959164382d1", "src_uid": "7419c4268a9815282fadca6581f28ec1", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "I=lambda:map(int,input().split())\n\nR=range\n\nn,m,k=I()\n\ndef r(a,b,c=k):\n\n\tq=0\n\n\tfor a,b in sorted((b[i][1]-a[i][0],a[i][2])for i in R(m))[::-1]:\n\n\t\tif a<1or c<1:break\n\n\t\tq+=a*min(b,c);c-=b\n\n\treturn q\n\nw=[]\n\nfor _ in '0'*n:I();w+=[[list(I())for _ in '0'*m]]\n\nprint(max(r(w[i],w[j])for i in R(n)for j in R(n)))\n\n\n\n\n# Made By Mostafa_Khaled", "lang_cluster": "Python", "tags": ["greedy", "games", "graph matchings"], "code_uid": "9d3a38743e4c1917377a1e0aa8cc8de4", "src_uid": "7419c4268a9815282fadca6581f28ec1", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "n,m,capacity = [int(x) for x in raw_input().split()]\n\nclass Planet:\n    def __init__(self):\n        self.a = []\n        self.b = []\n        self.c = []\n        self.n = \"\"\n    def __repr__(self):\n        return \"%s: a:%r, b:%r, c:%r\" % (self.n, self.a, self.b,self.c)\n\ndef calc_profit(p1, p2):\n    #print \"%s -> %s\" % (p1.n, p2.n)\n    profits = []\n    for j in range(m):\n        if p1.c[j] == 0:\n            continue\n        profit = p2.b[j] - p1.a[j]\n        if profit > 0:\n            profits.append((profit, p1.c[j]))\n    profits.sort(reverse=True)\n    load = 0\n    total_profit = 0\n    for p in profits:\n        if load + p[1] > capacity:\n            c = capacity - load\n        else: \n            c = p[1]\n        total_profit += p[0]*c\n        load += c\n        if c != p[1]:\n            break\n    #print \"profit: %d\" % total_profit\n    return total_profit \n\nps = []\n\nfor i in range(n):\n    p = Planet()\n    p.n = raw_input()\n    for j in range(m):\n        a,b,c = [int(x) for x in raw_input().split()]\n        p.a.append(a)\n        p.b.append(b)\n        p.c.append(c)\n    ps.append(p)                  \n    \nmax_profit = -1\n\nfor n1 in range(n):\n    for n2 in range(n):\n        if n1 != n2:\n            profit = calc_profit(ps[n1], ps[n2])\n            max_profit = max(max_profit, profit)\n\nprint max_profit        ", "lang_cluster": "Python", "tags": ["greedy", "games", "graph matchings"], "code_uid": "e64344e0397e16c2ef474cc6109705a1", "src_uid": "7419c4268a9815282fadca6581f28ec1", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\nn, m, k = map(int, sys.stdin.readline().split())\ndata = []\nfor i in xrange(n):\n    tmp = sys.stdin.readline()\n    items = []\n    for j in xrange(m):\n        item = map(int, sys.stdin.readline().split())\n        items.append(item)\n    data.append(items)\nans = 0\n\nfor i in xrange(n):\n    for j in xrange(n):\n        if i == j: continue\n        ii = data[i]\n        ij = data[j]\n        cat = []\n        for l in xrange(m):\n            buyinfo = ii[l]\n            sellinfo = ij[l]\n            profit = sellinfo[1] - buyinfo[0]\n            num = buyinfo[2]\n            if profit > 0 and num > 0:\n                cat.append([profit, num])\n        cat.sort(reverse=True)\n        rem = k\n        tmp = 0\n        for (profit, num) in cat:\n            n_ = min(num, rem)\n            tmp += profit * n_\n            rem -= n_\n            if rem == 0:\n                break\n        #print i, j, tmp\n        ans = max(ans, tmp)\nprint ans\n", "lang_cluster": "Python", "tags": ["greedy", "games", "graph matchings"], "code_uid": "ed2d5204f3a0c6086283110476fa463f", "src_uid": "7419c4268a9815282fadca6581f28ec1", "difficulty": 1200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math, collections\nmod = 10**9+7\n\ndef isPower(n):\n    if (n <= 1):\n        return True\n    for x in range(2, (int)(math.sqrt(n)) + 1):\n        p = x\n        while (p <= n):\n            p = p * x\n            if (p == n):\n                return True\n    return False\nn = int(input())\narr = [0,1,2,1,4,3,2,1,5,6,2,1,8,7,5,9,8,7,3,4,7,4,2,1,10,9,3,6,11,12]\nans = arr[int(math.log(n, 2))]\ns = int(math.log(n, 2))\nfor i in range(3, int(n**0.5)+1):\n    if not isPower(i):\n        ans^=arr[int(math.log(n, i))]\n        s+=int(math.log(n, i))\nans^=((n-s)%2)\nprint(\"Vasya\" if ans else \"Petya\")", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "0f17a31c5c2cc1e1e48e481e5c481659", "src_uid": "0e22093668319217b7946e62afe32195", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "sg=[1,2,1,4,3,2,1,5,6,2,1,8,7,5,9,8,7,3,4,7,4,2,1,10,9,3,6,11,12]\nn=input()\ncnt=[n]+[0]*30\nS=int(n**0.5)\nfg=[0]*(S+10)\nfor i in xrange(2,S+1):\n\tif fg[i]: continue\n\tc,s=i,0\n\twhile c*i<=n:\n\t\tc*=i\n\t\ts+=1\n\t\tif c<=S: fg[c]=1\n\tcnt[0]-=s+1\n\tcnt[s]+=1\nans=0\nfor i in xrange(29):\n\tans^=(cnt[i]%2)*sg[i]\nprint \"Vasya\" if ans else \"Petya\"\n", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "3f7471ac19d4394dcb6f2af010215d34", "src_uid": "0e22093668319217b7946e62afe32195", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "l1,r1,l2,r2=map(int,raw_input().split())\nl=[l1,l2]\nr=[r1,r2]\ndef nextwhere(l,s):\n    fs=2**s\n    st=2**(s+1)\n    return l if l%st==fs else l+(st-(l-fs)%st)\nans=0    \nfor s in xrange(31):\n    z=[list(),list()]\n    for hui in xrange(2):\n        f=list()\n        t=l[hui]-1\n        for j in xrange(3):\n            t=nextwhere(t+1,s)\n            if t>r[hui]:\n                break\n            f.append(t)\n        if len(f)==0:\n            continue\n        elif len(f)==1:\n            z[hui].append((min(f[0]-l[hui],2**s-1),min(r[hui]-f[0],2**s-1)))\n        elif len(f)==2:\n            z[hui].append((min(f[0]-l[hui],2**s-1),2**s-1))            \n            z[hui].append((2**s-1,min(r[hui]-f[1],2**s-1)))            \n        else:\n            z[hui].append((2**s-1,2**s-1))    \n    for i in z[0]:\n        for j in z[1]:\n            ans=max(ans,min(i[0],j[0])+min(i[1],j[1])+1)\nprint ans", "lang_cluster": "Python", "tags": ["divide and conquer"], "code_uid": "f5fd84a885a234769d9d3cacb8b86892", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from itertools import *\n\nl1, r1, l2, r2 = map(int, raw_input().split())\nla = set()\nlb = set()\n\ndef foo(l, r, pv, li):\n    if l > r:\n        return\n    if (l, r) in li:\n        return\n    while pv > 1 and (pv - 1) / 2 >= r:\n        pv = (pv - 1) / 2\n    li.add((l, r))\n    if l <= r and pv >= 3:\n        pv = (pv - 1) / 2\n        foo(l, min(pv, r), pv, li)\n        foo(max(l - pv - 1, 1), min(pv, r - pv - 1), pv, li)\n\npv = 1\nfor i in range(32):\n    pv = pv * 2 + 1\nfoo(l1, r1, pv, la)\nfoo(l2, r2, pv, lb)\n\nans = 0\n#print la\n#print lb\nfor a in la:\n    for b in lb:\n        ans = max(ans, min(a[1], b[1]) - max(a[0], b[0]) + 1)\nprint ans\n", "lang_cluster": "Python", "tags": ["divide and conquer"], "code_uid": "724e4861a901ac75cc9be107b0d45a74", "src_uid": "fe3c0c4c7e9b3afebf2c958251f10513", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "a, b, m = raw_input().split()\nx, y, z = raw_input().split()\na, b, m = float(a), float(b), float(m)\nx, y, z = float(x), float(y), float(z)\n\nt = -m / y\np = a / 2 + x * t\nq = z * t\n\n\nwhile p > a or p < 0:\n    if p > a:\n        p = a * 2 - p\n    else:\n        p = -p\n\nwhile q > b or q < 0:\n    if q > b:\n        q = b * 2 - q\n    else:\n        q = -q\n\nprint(\"%.10lf %.10lf\" % (p, q))", "lang_cluster": "Python", "tags": ["math", "geometry", "implementation"], "code_uid": "a7fb56b2c37a78d57ad9b950dbda9ff3", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "#-*-coding=utf8-*-\ndebug = False\n\na,b,m = map(int, raw_input('').split(' '))\nvx,vy,vz = map(int, raw_input('').split(' '))\n\nA,B,C,D = 0,1,0,0\nx0,y0,z0 = a/2.0, m, 0\nt = (-A*x0-B*y0-C*z0-D)/float(A*vx+B*vy+C*vz)\nxi,yi,zi = x0+t*vx, y0+t*vy, z0+t*vz\nxi,yi,zi = abs(xi)%(2*a), abs(yi)%m, abs(zi)%(2*b)\nif xi>a:\n    xi = abs(xi-2*a)\n\nif zi>b:\n    zi = abs(zi-2*b)\n\nif not debug:\n    print(\"%.10f %.10f\" % (xi,zi))", "lang_cluster": "Python", "tags": ["math", "geometry", "implementation"], "code_uid": "4fd5fc9f1995c18b6aacff6117535856", "src_uid": "84848b8bd92fd2834db1ee9cb0899cff", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "read = lambda: map(int, input().split())\nn, v, e = read()\nadj = [[] for _ in range(n + 1)]\nAs = [0] + list(read())\nBs = [0] + list(read())\nans = []\n\nfor _ in range(e):\n    a, b = map(int, input().split())\n    adj[a].append(b)\n    adj[b].append(a)\n\n\ndef flow(a, b, d):\n    As[a] -= d\n    As[b] += d\n    ans.append((a, b, d));\n\ndef augment(path, e, d):\n    if e:\n        dd = min(d, As[path[e - 1]], v - As[path[e]])\n        flow(path[e - 1], path[e], dd)\n        augment(path, e - 1, d)\n        if d > dd:\n            flow(path[e - 1], path[e], d - dd);\n    \ndef adjust(s):\n    pre = [0] * (n + 1)\n    pre[s] = -1\n    stk = [s]\n    e = 0\n    while len(stk):\n        p = stk[-1]\n        del stk[-1]\n        if As[p] < Bs[p]:\n            e = p\n            break\n        for to in adj[p]:\n            if not pre[to]:\n                pre[to] = p\n                stk.append(to)\n        \n    if not e:\n        raise Exception\n    path = []\n    while e > 0:\n        path.insert(0, e)\n        e = pre[e]\n    augment(path, len(path) - 1, min(Bs[path[-1]] - As[path[-1]], As[s] - Bs[s])) \n\ntry:\n    while True:\n        check = False\n        for i in range(1, n + 1):\n            if As[i] > Bs[i]:\n                adjust(i)\n                check = True\n        if not check: \n            break\n    for i in range(1, n + 1):\n        if As[i] != Bs[i]:\n            raise Exception\n    print(len(ans))\n    for tp in ans:\n        print(*tp)\nexcept Exception:\n    print(\"NO\")\n", "lang_cluster": "Python", "tags": ["dfs and similar", "constructive algorithms"], "code_uid": "bdb1df1f2e2a7a9e41c4a518b3ff5c5f", "src_uid": "0939354d9bad8301efb79a1a934ded30", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def gcd(a,b):\n    if(a%b==0):\n        return b\n    else:\n        return gcd(b,a%b)\n\n[t1,t2,x1,x2,t0]=input().split(' ')\n#[t1,t2,x1,x2,t0]=[100,110,2,2,109]\nt1=int(t1)\nt2=int(t2)\nx1=int(x1)\nx2=int(x2)\nt0=int(t0)\n\na=t2-t0\nb=t0-t1\n\nif(a==0 and b==0):\n    print(x1,x2)\n    exit(0)\n\nif (a==0):\n    y1=0\n    y2=x2\n    print(y1,y2)\n    exit(0)\n    \nif (b==0):\n    y1=x1\n    y2=0\n    print(y1,y2)\n    exit(0)\n    \ng=gcd(a,b)\na=int(a/g)\nb=int(b/g)\nif(a<=x1 and b<=x2):\n    mintime=int(x1/a)\n    if(mintime>int(x2/b)):\n        mintime=int(x2/b)\n    print(mintime*a,mintime*b)\n    exit(0)\n\ny1=1\ny2=1\nminy1=1\nminy2=1\nminn=99999\nfg=0\nwhile(y1<=x1 and y2<=x2):\n    if(y1/y2<a/b):\n        if(minn>a/b-y1/y2):\n            minn=a/b-y1/y2\n            miny1=y1\n            miny2=y2\n            fg=1\n        y1=y1+1\n    else:\n        y2=y2+1\ny1=miny1\ny2=miny2\nmintime=int(x1/y1)\nif(mintime>int(x2/y2)):\n    mintime=int(x2/y2)\nif(fg==1):\n    print(mintime*y1,mintime*y2)\nelse:\n    print(0,x2)\n\n\n\n\n", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search"], "code_uid": "bc512265f43eabb27a9ae654f6859509", "src_uid": "87a500829c1935ded3ef6e4e47096b9f", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "import math\ndef gcd(a,b):\n    if(b==0):\n        return a\n    return gcd(b,a%b)\nl=input().split()\nt1=int(l[0])\nt2=int(l[1])\nx1=int(l[2])\nx2=int(l[3])\nt0=int(l[4])\nnum1=t2-t0\nnum2=t0-t1\nif(t1==t2):\n    print(x1,x2)\n    quit()\nif(num1==0):\n    print(0,x2)\n    quit()\nif(num2==0):\n    print(x1,0)\n    quit()\nz=num2/num1\nmaxa=10**18\nans=(0,0)\nfor i in range(1,x1+1):\n    ok=z*i\n    if(ok>x2):\n        break\n    num1=i\n    num2=math.ceil(ok)\n    if(maxa==((num2/num1)-z) and num2+num1>ans[0]+ans[1]):\n        ans=(num1,num2)\n    elif(maxa>((num2/num1)-z)):\n        ans=(num1,num2)\n        maxa=((num2/num1-z))\nif(ans==(0,0)):\n    ans=(0,x2)\nprint(ans[0],ans[1])\n", "lang_cluster": "Python", "tags": ["brute force", "math", "binary search"], "code_uid": "f58c2e1a8ab561ba5dd766672888a9b4", "src_uid": "87a500829c1935ded3ef6e4e47096b9f", "difficulty": 1900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from collections import deque\ndef main():\n    n, m = map(int, raw_input().split())\n    b = [list(raw_input().strip()) for _ in xrange(n)]\n    def inboard(y, x):\n        return 0 <= y < n and 0 <= x < m\n    c = 0\n    for i in xrange(n):\n        for j in xrange(m):\n            if b[i][j] in '123456789':\n                c += 1\n                b[i][j] = chr(ord(b[i][j]) - 1)\n            elif b[i][j] == 'S':\n                sy, sx = i, j\n    v = [int(raw_input()) for _ in xrange(c)]\n    inf = 1000000\n    up = [[0] * m for i in xrange(n)]\n    down = [[0] * m for i in xrange(n)]\n    for i in xrange(n):\n        for j in xrange(m):\n            if b[i][j] in '0123456789':\n                for l in xrange(j+1, m):\n                    up[i][l] |= 1 << int(b[i][j])\n                    down[i][l] |= 1 << int(b[i][j])\n            elif b[i][j] == 'B':\n                for l in xrange(j+1, m):\n                    up[i][l] |= 1 << c\n                    down[i][l] |= 1 << c\n                v.append(-inf)\n                c += 1\n    dp = [[[inf] * (1 << c) for j in xrange(m)] for i in xrange(n)]\n    dp[sy][sx][0] = 0\n    d = [(-1, 0), (1, 0), (0, 1), (0, -1)]\n    q = deque()\n    q.append((sy, sx, 0, 0))\n    while q:\n        y, x, mask, t = q.popleft()\n        if t > dp[y][x][mask]: continue\n        nt = t + 1\n        for dy, dx in d:\n            ny, nx, nmask = dy + y, dx + x, mask\n            if not inboard(ny, nx) or b[ny][nx] not in '.S': continue\n            if dx == 0:\n                if dy == 1:\n                    nmask ^= down[ny][nx]\n                else:\n                    nmask ^= down[y][x]\n            if dp[ny][nx][nmask] > nt:\n                dp[ny][nx][nmask] = nt\n                q.append((ny, nx, nmask, nt))\n    print max(sum(v[j] for j in xrange(c) if ((i >> j) & 1))-dp[sy][sx][i] for i in xrange(1 << c))\nmain()\n", "lang_cluster": "Python", "tags": ["shortest paths", "bitmasks"], "code_uid": "ce65e96eb0970ed4f0038a486d06e11f", "src_uid": "624a0d6cf305fcf67d3f1cdc1c5fef8d", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import sys,heapq\n\n#sys.stdin=open(\"data.txt\")\n\ninput=sys.stdin.readline\n\n\n\nn,a,b=map(int,input().split())\n\n\n\nif a<b: a,b=b,a\n\n\n\nif b==0:\n\n    # 1 01 001 0001 ... is optimal, plus a long series of 0's\n\n    print((n-1)*a)\n\nelse:\n\n    # pascal's triangle thing\n\n    pascal=[[1]*20005]\n\n    for i in range(20004):\n\n        newrow=[1]\n\n        for j in range(1,20005):\n\n            newrow.append(newrow[-1]+pascal[-1][j])\n\n            if newrow[-1]>n: break\n\n        pascal.append(newrow)\n\n    def getcom(a,b):\n\n        # return a+b choose b\n\n        # if larger than n, return infinite\n\n        if len(pascal[a])>b: return pascal[a][b]\n\n        if b==0: return 1\n\n        if b==1: return a\n\n        return 100000005\n\n\n\n    # start with the null node (prefix cost 0)\n\n    # can split a node into two other nodes with added cost c+a+b\n\n    # new nodes have prefix costs c+a, c+b\n\n    # want n-1 splits in total\n\n    remain=n-1\n\n    ans=0\n\n    possible=[[a+b,1]]    # [c,count]\n\n    while 1:\n\n        # cost u, v leaves\n\n        u,v=heapq.heappop(possible)\n\n        while possible and possible[0][0]==u:\n\n            v+=possible[0][1]\n\n            heapq.heappop(possible)\n\n        if remain<=v:\n\n            ans+=u*remain\n\n            break\n\n        ans+=u*v\n\n        remain-=v\n\n        heapq.heappush(possible,[u+a,v])\n\n        heapq.heappush(possible,[u+b,v])\n\n    print(ans)\n\n\n\n# Made By Mostafa_Khaled", "lang_cluster": "Python", "tags": ["greedy", "dp"], "code_uid": "0b89808a1534e5dd349fcd06e195071f", "src_uid": "39b824b740a40f68bae39b8d9f0adcbe", "difficulty": 2700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "MAX = 101 \nNINF = -22222222222\nbase = [-1]*MAX\ndp = [ [ base[:] for i in range(MAX)] for j in range(MAX)] \ns1 = \"\"\ns2 = \"\"\ns3 = \"\"\nrev_s3 = \"\"\nl1 = \"\"\nl2 = \"\"\nl3 = \"\"\n\n\n\ndef foo(i, j, k):\n\tif k == l3 :\n\t\treturn \"\", NINF\n\tif i == l1:\n\t\treturn \"\", 0\n\tif j == l2:\n\t\treturn \"\", 0\n\tif dp[i][j][k] != -1:\n\t\treturn dp[i][j][k]\n\tans1, len1 = foo( i + 1, j, k )\n\tans2, len2 = foo( i , j + 1, k )\n\tlen3 = NINF\n\tans3 = \"\"\n\tif s1[i] == s2[j]:\n\t\tif s1[i] == s3[k]:\n\t\t\tans3, len3 = foo(i+1, j + 1, k+1 )\n\t\t\tans3 += s1[i]\n\t\t\tlen3 += 1\n\t\telse:\n\t\t\tif s1[i] == s3[0]:\n\t\t\t\tans3, len3 = foo(i+1, j + 1, 1 )\n\t\t\telse:\n\t\t\t\tans3, len3 = foo(i+1, j + 1, 0 )\n\t\t\tans3 += s1[i]\n\t\t\tlen3 += 1\n\n\tif rev_s3 in ans1:\n\t\tlen1 = NINF\n\tif rev_s3 in ans2:\n\t\tlen2 = NINF\n\tif rev_s3 in ans3:\n\t\tlen3 = NINF\n\n\tif len1 > len2:\n\t\tif len1 > len3:\n\t\t\tdp[i][j][k] = ans1, len1 \n\t\telse:\n\t\t\tdp[i][j][k] = ans3, len3\n\telse:\n\t\tif len2 > len3:\n\t\t\tdp[i][j][k] = ans2, len2\n\t\t\t\n\t\telse:\n\t\t\tdp[i][j][k] = ans3, len3\n\treturn dp[i][j][k]\n\ns1 = raw_input()\ns2 = raw_input()\ns3 = raw_input()\nrev_s3 = s3[::-1]\nl1 = len(s1)\nl2 = len(s2)\nl3 = len(s3)\n\nans = foo(0,0,0)\nif ans[1] <= 0 :\n\tprint(0)\nelse:\n\tprint(ans[0][::-1]\t)", "lang_cluster": "Python", "tags": ["strings", "dp"], "code_uid": "427a53c61e267ca478f45ee08befbaf8", "src_uid": "391c2abbe862139733fcb997ba1629b8", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "mod = 1000000007\ndef sum(x,y,k,add) :\n    if k<add:\n    \treturn 0\n    up=x+add\n    if up>k:\n    \tup=k\n    add=add+1\n    return y*(((add+up)*(up-add+1)//2)%mod)%mod\ndef solve(x,y,k,add=0) :\n    if x==0 or y==0:\n    \treturn 0\n    if x>y:\n    \tx,y=y,x\n    pw = 1\n    while (pw*2)<=y:\n    \tpw*=2\n    if pw<=x:\n    \treturn (sum(pw,pw,k,add)+sum(pw,x+y-pw-pw,k,add+pw)+solve(x-pw,y-pw,k,add))%mod\n    else:\n    \treturn (sum(pw,x,k,add)+solve(x,y-pw,k,add+pw))%mod\nq=input()\nfor i in range(0,q):\n    x1,y1,x2,y2,k=map(int,raw_input().split())    \n    ans=(solve(x2, y2, k)-solve(x1 - 1, y2, k)-solve(x2, y1 - 1, k)+solve(x1-1,y1-1,k))%mod\n    if ans<0:\n    \tans+=mod\n    print ans", "lang_cluster": "Python", "tags": ["divide and conquer", "dp"], "code_uid": "d93b4d9df526ff0879604bf3f4ed6972", "src_uid": "1ab085026ce43810acf98cc4bf8faf26", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n=int(input())\ns=[c=='1' for c in input()]\nm=len(s)\nz=[[0,0]]\nfor c in s:\n ind = z[-1][c]\n z[-1][c] = len(z)\n z.append(z[ind][:])\nassert(len(z) == m+1)\nz[m][0] = z[m][1] = m # make it sticky\n\n# how many things match directly\ndp = [0 for _ in range(m+1)]\ndp[0] = 1\nfor i in range(n):\n ndp = [0 for _ in range(m+1)]\n for i in range(m+1):\n  ndp[z[i][0]] += dp[i]\n  ndp[z[i][1]] += dp[i]\n dp = ndp\nres = dp[m]\n\nfor k in range(1, m):\n s0 = 0\n for c in s[-k:]:\n  s0 = z[s0][c]\n dp = [0 for _ in range(m+1)]\n dp[s0] = 1\n for i in range(n - k):\n  ndp = [0 for _ in range(m+1)]\n  for i in range(m+1):\n   ndp[z[i][0]] += dp[i]\n   ndp[z[i][1]] += dp[i]\n  dp = ndp\n for s1 in range(m): # skip m\n  v = dp[s1]\n  for c in s[-k:]:\n   if s1 == m: v = 0\n   s1 = z[s1][c]\n  if s1 == m: res += v\nprint(res)", "lang_cluster": "Python", "tags": ["strings", "dp"], "code_uid": "dfad7b1658bba03d8098ccc6cb302d6f", "src_uid": "0034806908c9794086736a2d07fc654c", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "from collections import defaultdict\nletters = 'ACGT'\nP = 10**9 + 9\nn,m = map(int,raw_input().split())\nv = [raw_input() for _ in xrange(m)]\nd = {(0,''):0}\ndi = {0:(0,'')}\nc = 1\na = defaultdict(dict)\nt = set(v)\ndef f(k,s):\n    global c\n    if (k,s) not in d:\n        d[k,s]=c\n        di[c]=k,s\n        c+=1\n    return d[k,s]\ndef add(f,l,t):\n    global a\n    if l not in a[f] or di[a[f][l]][0]<di[t][0]:\n        #print di[f], '->', di[t]\n        a[f][l]=t\nfor s in v:\n    for j in xrange(len(s)):\n        for k in xrange(j+1):\n            if j==len(s)-1: add(f(k,s[:j]),s[j],f(len(s),s[:j+1]))\n            else: add(f(k,s[:j]),s[j],f(k,s[:j+1]))\n\nfor p,s in d.keys():\n    for x in letters:\n        z = s+x\n        fm = False\n        for j in v:\n            if z.endswith(j) and p+len(j)>=len(z):\n                fm = True\n                break\n        for j in xrange(len(z)):\n            f = p-j,z[j:]\n            if fm: f = len(z[j:]),z[j:]\n            if f in d:\n                add(d[p,s],x,d[f])\n                break\n#print d\n#print a\nd0,v0 = d,v\nd = defaultdict(int)\nd[0] = 1\nfor i in xrange(n):\n    dn = defaultdict(int)\n    for j in xrange(c):\n        for x,v in a[j].iteritems():\n            dn[v]+=d[j]\n            dn[v]%=P\n    #print ' '.join('%s=%d'%(di[k],v) for k,v in dn.iteritems() if v)\n    d = dn\n\n#print [di[k] for k,v in d.iteritems() if di[k][0]==len(di[k][1])]\nprint sum(v for k,v in d.iteritems() if di[k][0]==len(di[k][1]))%P", "lang_cluster": "Python", "tags": ["strings", "dp", "trees"], "code_uid": "1b5102c15cefbafaf81ede3b0f69e28f", "src_uid": "3f053c07deaac55c2c51df6147080340", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "from sys import exit\n\nn = int(input())\nP = []\n\nif n >= 38:\n    print(\"0\")\n    exit()\n\nfor i in range(n):\n    tmp = input().split()\n    tmp = [int(k) for k in tmp]\n    P.append(tuple(tmp))\n\nisGood = [True for i in range(n)]\nfor i in range(n):\n    for j in range(n):\n        for k in range(j):\n            dp = 0\n            for d in range(5):\n                dp += (P[j][d] - P[i][d])*(P[k][d] - P[i][d])\n            if dp > 0:\n                isGood[i] = False\n\nprint(isGood.count(True))\nfor i in range(n):\n    if isGood[i]:\n        print(i + 1)\n            \n    \n", "lang_cluster": "Python", "tags": ["brute force", "math", "geometry"], "code_uid": "91b5c1efbe008990c0f4f69c008c01ae", "src_uid": "c1cfe1f67217afd4c3c30a6327e0add9", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def sc(i,j,k):\n   xx=0\n   for t in range(5):\n      xx+=(m[i][t]-m[j][t])*(m[i][t]-m[k][t])\n   return xx\nn= int(input())\n\nm=[]\nmm=n\nans=[]\nif (n > 36):\n   print(\"0\")\nelse:\n   for i in range(n):\n      ans.append(1)\n      a,b,c,d,e=map(int,input().split())\n      m.append([a,b,c,d,e])\n   for i in range(n):\n      for j in range(n):\n         if (i != j):\n            for k in range(n):\n               if (i != k) and ( j != k):\n                  if sc(i,j,k) >0:\n                     ans[i]=-1\n   for i in range(n):\n      if ans[i]==-1:\n         mm+=-1\n   print(mm)\n   for i in range(n):\n      if ans[i]==1:\n         print(i+1)", "lang_cluster": "Python", "tags": ["brute force", "math", "geometry"], "code_uid": "11dfb2e54ab203f2c329291286db0dd7", "src_uid": "c1cfe1f67217afd4c3c30a6327e0add9", "difficulty": 1700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def Solve(x,B):\n    if((X,x,B) in Mem):\n        return Mem[(X,x,B)]\n    if(len(B)>X):\n        return False\n    if(x==len(L)):\n        return True\n    if(Form(L[x],B)):\n        A=list(B)\n        for e in range(len(B)):\n            r=A[e]\n            A[e]=L[x]\n            if(Solve(x+1,tuple(sorted(A)))):\n                Mem[(X,x,B)]=True\n                return True\n            A[e]=r\n        A+=[L[x]]\n        if(Solve(x+1,tuple(sorted(A)))):\n            Mem[(X,x,B)]=True\n            return True\n    Mem[(X,x,B)]=False\n    return False\n\ndef Form(x,B):\n    for i in range(len(B)):\n        for j in range(i,len(B)):\n            if(B[i]+B[j]==x):\n                return True\n    return False\n        \nn=int(input())\nL=list(map(int,input().split()))\ndone=False\nMem={}\nfor X in range(1,n+1):\n    if(Solve(1,(L[0],))):\n        print(X)\n        done=True\n        break\nif(not done):\n    print(-1)\n", "lang_cluster": "Python", "tags": ["dp", "bitmasks"], "code_uid": "7d8af95822a890f5bc9313fdab87e15c", "src_uid": "359f5d1264ce16c5c5293fd59db95628", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from math import gcd\ndef powmod(a,b,m):\n a%=m\n r=1\n while b:\n  if b&1:r=r*a%m\n  a=a*a%m\n  b>>=1\n return r\n\ndef f(n):\n r=[]\n if (n&1)==0:\n  e=0\n  while (n&1)==0:n>>=1;e+=1\n  yield (2,e)\n p=3\n while n>1:\n  if p*p>n:p=n\n  if n%p:\n   p+=2\n   continue\n  e=1;n//=p\n  while n%p==0:n//=p;e+=1\n  yield (p,e)\n  p+=2\n return r\nm,x=map(int,input().split())\np=2\nr=[(1,1)]\nfor p,e in f(m):\n assert e>=1\n ord=p-1\n assert powmod(x,ord,p)==1\n for pi,ei in f(p-1):\n  while ord % pi == 0 and powmod(x,ord//pi,p)==1: ord//=pi\n ords=[(1,1),(ord,p-1)]\n q=p\n for v in range(2,e+1):\n  q*=p\n  if powmod(x,ord,q)!=1:ord*=p\n  assert powmod(x,ord,q)==1\n  ords.append((ord,q//p*(p-1)))\n r=[(a//gcd(a,c)*c,b*d) for a,b in r for c,d in ords]\nprint(sum(y//x for x,y in r))", "lang_cluster": "Python", "tags": ["math", "number theory", "bitmasks"], "code_uid": "77d603f4c6cd24ac859d167ca2a5dcbf", "src_uid": "c2dd6de750812d6213c770b3587d8fcb", "difficulty": 2600.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "import os\r\nimport sys \r\nfrom io import BytesIO, IOBase\r\n \r\nBUFSIZE = 8192\r\n  \r\nclass FastIO(IOBase):\r\n    newlines = 0\r\n  \r\n    def __init__(self, file):\r\n        self._fd = file.fileno() \r\n        self.buffer = BytesIO()  \r\n        self.writable = \"x\" in file.mode or \"r\" not in file.mode\r\n        self.write = self.buffer.write if self.writable else None\r\n \r\n    def read(self):\r\n        while True:\r\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\r\n            if not b:\r\n                break  \r\n            ptr = self.buffer.tell()\r\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\r\n        self.newlines = 0 \r\n        return self.buffer.read()\r\n \r\n    def readline(self):\r\n        while self.newlines == 0:\r\n            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)) \r\n            self.newlines = b.count(b\"\\n\") + (not b)  \r\n            ptr = self.buffer.tell()\r\n            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\r\n        self.newlines -= 1    \r\n        return self.buffer.readline()\r\n \r\n    def flush(self): \r\n        if self.writable: \r\n            os.write(self._fd, self.buffer.getvalue())\r\n            self.buffer.truncate(0), self.buffer.seek(0)   \r\n \r\n \r\nclass IOWrapper(IOBase):\r\n    def __init__(self, file):\r\n        self.buffer = FastIO(file)\r\n        self.flush = self.buffer.flush\r\n        self.writable = self.buffer.writable\r\n        self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\r\n        self.read = lambda: self.buffer.read().decode(\"ascii\")\r\n        self.readline = lambda: self.buffer.readline().decode(\"ascii\")\r\n \r\n \r\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\r\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\r\n\r\nclass FFT:\r\n    def __init__(self, MOD=998244353):\r\n        FFT.MOD = MOD\r\n        g = self.primitive_root_constexpr()\r\n        ig = pow(g, FFT.MOD - 2, FFT.MOD)\r\n        FFT.W = [pow(g, (FFT.MOD - 1) >> i, FFT.MOD) for i in range(30)]\r\n        FFT.iW = [pow(ig, (FFT.MOD - 1) >> i, FFT.MOD) for i in range(30)]\r\n\r\n    def primitive_root_constexpr(self):\r\n        if FFT.MOD == 998244353:\r\n            return 3\r\n        elif FFT.MOD == 200003:\r\n            return 2\r\n        elif FFT.MOD == 167772161:\r\n            return 3\r\n        elif FFT.MOD == 469762049:\r\n            return 3\r\n        elif FFT.MOD == 754974721:\r\n            return 11\r\n        divs = [0] * 20\r\n        divs[0] = 2\r\n        cnt = 1\r\n        x = (FFT.MOD - 1) // 2\r\n        while x % 2 == 0:\r\n            x //= 2\r\n        i = 3\r\n        while i * i <= x:\r\n            if x % i == 0:\r\n                divs[cnt] = i\r\n                cnt += 1\r\n                while x % i == 0:\r\n                    x //= i\r\n            i += 2\r\n        if x > 1:\r\n            divs[cnt] = x\r\n            cnt += 1\r\n        g = 2\r\n        while 1:\r\n            ok = True\r\n            for i in range(cnt):\r\n                if pow(g, (FFT.MOD - 1) // divs[i], FFT.MOD) == 1:\r\n                    ok = False\r\n                    break\r\n            if ok:\r\n                return g\r\n            g += 1\r\n\r\n    def fft(self, k, f):\r\n        for l in range(k, 0, -1):\r\n            d = 1 << l - 1\r\n            U = [1]\r\n            for i in range(d):\r\n                U.append(U[-1] * FFT.W[l] % FFT.MOD)\r\n            \r\n            for i in range(1 << k - l):\r\n                for j in range(d):\r\n                    s = i * 2 * d + j\r\n                    f[s], f[s + d] = (f[s] + f[s + d]) % FFT.MOD, U[j] * (f[s] - f[s + d]) % FFT.MOD\r\n\r\n    def ifft(self, k, f):\r\n        for l in range(1, k + 1):\r\n            d = 1 << l - 1\r\n            for i in range(1 << k - l):\r\n                u = 1\r\n                for j in range(i * 2 * d, (i * 2 + 1) * d):\r\n                    f[j+d] *= u\r\n                    f[j], f[j + d] = (f[j] + f[j + d]) % FFT.MOD, (f[j] - f[j + d]) % FFT.MOD\r\n                    u = u * FFT.iW[l] % FFT.MOD\r\n\r\n    def convolve(self, A, B):\r\n        n0 = len(A) + len(B) - 1\r\n        k = (n0).bit_length()\r\n        n = 1 << k\r\n        A += [0] * (n - len(A))\r\n        B += [0] * (n - len(B))\r\n        self.fft(k, A)\r\n        self.fft(k, B)\r\n        A = [a * b % FFT.MOD for a, b in zip(A, B)]\r\n        self.ifft(k, A)\r\n        inv = pow(n, FFT.MOD - 2, FFT.MOD)\r\n        A = [a * inv % FFT.MOD for a in A]\r\n        del A[n0:]\r\n        return A\r\n\r\nMOD = 998244353\r\ndef solve():\r\n    n, k, f = map(int, input().split())\r\n    if f > 2 * k:\r\n        print(0)\r\n        return\r\n\r\n    fft = FFT()\r\n    A = [1] * (k + 1)\r\n    for i in range(n):\r\n        B = fft.convolve(A[:], A[:])\r\n        if i == n - 1:\r\n            break\r\n        tot = sum(B[k+1:]) % MOD\r\n        A = [0] * (k + 1)\r\n        cum = 0\r\n        for i in range(k, -1, -1):\r\n            A[i] += tot + B[i] * (k + 1 - i)\r\n            A[i] %= MOD\r\n            tot += B[i]\r\n            if tot >= 0:\r\n                tot -= MOD\r\n    print(B[f])\r\n    \r\n    \r\nfor _ in range(1):\r\n    solve()   ", "lang_cluster": "Python", "tags": ["brute force", "flows", "math", "dp", "fft", "bitmasks", "graphs", "meet-in-the-middle", "trees"], "code_uid": "a134970702c803739b599e189218575f", "src_uid": "4b8161259545e44c7d1046be2e4fe014", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3-64", "source_code": "\n\n# AtCoder Libary v1.4 \u3092 python \u306b\u79fb\u690d\u3057\u305f\u3082\u306e\n# https://github.com/atcoder/ac-library/blob/master/atcoder/convolution.hpp\n\nMOD = 998244353\nIMAG = 911660635\nIIMAG = 86583718\nrate2 = (0, 911660635, 509520358, 369330050, 332049552, 983190778, 123842337, 238493703, 975955924, 603855026, 856644456, 131300601, 842657263, 730768835, 942482514, 806263778, 151565301, 510815449, 503497456, 743006876, 741047443, 56250497, 867605899, 0)\nirate2 = (0, 86583718, 372528824, 373294451, 645684063, 112220581, 692852209, 155456985, 797128860, 90816748, 860285882, 927414960, 354738543, 109331171, 293255632, 535113200, 308540755, 121186627, 608385704, 438932459, 359477183, 824071951, 103369235, 0)\nrate3 = (0, 372528824, 337190230, 454590761, 816400692, 578227951, 180142363, 83780245, 6597683, 70046822, 623238099, 183021267, 402682409, 631680428, 344509872, 689220186, 365017329, 774342554, 729444058, 102986190, 128751033, 395565204, 0)\nirate3 = (0, 509520358, 929031873, 170256584, 839780419, 282974284, 395914482, 444904435, 72135471, 638914820, 66769500, 771127074, 985925487, 262319669, 262341272, 625870173, 768022760, 859816005, 914661783, 430819711, 272774365, 530924681, 0)\n\ndef butterfly(a):\n  n = len(a)\n  h = (n - 1).bit_length()\n  le = 0\n  while le < h:\n    if h - le == 1:\n      p = 1 << (h - le - 1)\n      rot = 1\n      for s in range(1 << le):\n        offset = s << (h - le)\n        for i in range(p):\n          l = a[i + offset]\n          r = a[i + offset + p] * rot\n          a[i + offset] = (l + r) % MOD\n          a[i + offset + p] = (l - r) % MOD\n        rot *= rate2[(~s & -~s).bit_length()]\n        rot %= MOD\n      le += 1\n    else:\n      p = 1 << (h - le - 2)\n      rot = 1\n      for s in range(1 << le):\n        rot2 = rot * rot % MOD\n        rot3 = rot2 * rot % MOD\n        offset = s << (h - le)\n        for i in range(p):\n          a0 = a[i + offset]\n          a1 = a[i + offset + p] * rot\n          a2 = a[i + offset + p * 2] * rot2\n          a3 = a[i + offset + p * 3] * rot3\n          a1na3imag = (a1 - a3) % MOD * IMAG\n          a[i + offset] = (a0 + a2 + a1 + a3) % MOD\n          a[i + offset + p] = (a0 + a2 - a1 - a3) % MOD\n          a[i + offset + p * 2] = (a0 - a2 + a1na3imag) % MOD\n          a[i + offset + p * 3] = (a0 - a2 - a1na3imag) % MOD\n        rot *= rate3[(~s & -~s).bit_length()]\n        rot %= MOD\n      le += 2\n\ndef butterfly_inv(a):\n  n = len(a)\n  h = (n - 1).bit_length()\n  le = h\n  while le:\n    if le == 1:\n      p = 1 << (h - le)\n      irot = 1\n      for s in range(1 << (le - 1)):\n        offset = s << (h - le + 1)\n        for i in range(p):\n          l = a[i + offset]\n          r = a[i + offset + p]\n          a[i + offset] = (l + r) % MOD\n          a[i + offset + p] = (l - r) * irot % MOD\n        irot *= irate2[(~s & -~s).bit_length()]\n        irot %= MOD\n      le -= 1\n    else:\n      p = 1 << (h - le)\n      irot = 1\n      for s in range(1 << (le - 2)):\n        irot2 = irot * irot % MOD\n        irot3 = irot2 * irot % MOD\n        offset = s << (h - le + 2)\n        for i in range(p):\n          a0 = a[i + offset]\n          a1 = a[i + offset + p]\n          a2 = a[i + offset + p * 2]\n          a3 = a[i + offset + p * 3]\n          a2na3iimag = (a2 - a3) * IIMAG % MOD\n          a[i + offset] = (a0 + a1 + a2 + a3) % MOD\n          a[i + offset + p] = (a0 - a1 + a2na3iimag) * irot % MOD\n          a[i + offset + p * 2] = (a0 + a1 - a2 - a3) * irot2 % MOD\n          a[i + offset + p * 3] = (a0 - a1 - a2na3iimag) * irot3 % MOD\n        irot *= irate3[(~s & -~s).bit_length()]\n        irot %= MOD\n      le -= 2\n\ndef multiply(s, t):\n  n = len(s)\n  m = len(t)\n  if min(n, m) <= 60:\n    a = [0] * (n + m - 1)\n    for i in range(n):\n      if i % 8 == 0:\n        for j in range(m):\n          a[i + j] += s[i] * t[j]\n          a[i + j] %= MOD\n      else:\n        for j in range(m):\n          a[i + j] += s[i] * t[j]\n    return [x % MOD for x in a]\n  a = s.copy()\n  b = t.copy()\n  z = 1 << (n + m - 2).bit_length()\n  a += [0] * (z - n)\n  b += [0] * (z - m)\n  butterfly(a)\n  butterfly(b)\n  for i in range(z):\n    a[i] *= b[i]\n    a[i] %= MOD\n  butterfly_inv(a)\n  a = a[:n + m - 1]\n  iz = pow(z, MOD - 2, MOD)\n  return [v * iz % MOD for v in a]\n\nn,k,f=map(int,input().split())\nmod=998244353\n\ndef dp(n):\n    if n==1:\n        return [1]*(k+1)\n    bf=dp(n-1)\n    res=[0]*(k+1)\n    bf2=multiply(bf,bf)\n    sbf2=[0]*(2*k+3)\n    for i in range(2*k,-1,-1):\n        sbf2[i]=(sbf2[i+1]+bf2[i])%mod\n        if i>k:continue\n        res[i]=sbf2[i+1]+bf2[i]*(k-i+1)\n        res[i]%=mod\n    return res\n\n\nans=dp(n)\nans=multiply(ans,ans)\nprint(ans[f] if f<=2*k else 0)\n\n", "lang_cluster": "Python", "tags": ["brute force", "flows", "math", "dp", "fft", "bitmasks", "graphs", "meet-in-the-middle", "trees"], "code_uid": "7de4190600bd1a749a4cc36d844f324d", "src_uid": "4b8161259545e44c7d1046be2e4fe014", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "mod = int(1e9 + 7)\nn, m = map(int, input().split())\nf = [ [0 for i in range(60)] for j in range(60) ]\ng = [ [0 for i in range(60)] for j in range(60) ]\ns = [ [0 for i in range(60)] for j in range(60) ]\ninv = [ 1 ]\nf[0][0] = s[0][0] = 1\n\ndef pow(x, exp) :\n    res = 1\n    for i in range(0, 31) :\n        if exp & 1 : res = res * x % mod\n        exp >>= 1\n        if exp == 0 : break\n        x = x * x % mod\n    return res\n\nfor i in range(1, n + 1) :\n    inv.append( pow(i, mod - 2) )\n\nfor node in range(1, n + 1) :\n    for cut in range(1, n + 1) :\n        tmp = 0\n        for ln in range(node) :\n            for lc in range(cut - 1, n + 1) :\n                if f[ln][lc] == 0 : continue\n                if lc == cut - 1 :\n                    tmp = ( tmp + f[ln][lc] * s[node - ln - 1][cut - 1] ) % mod\n                else :\n                    tmp = ( tmp + f[ln][lc] * f[node - ln - 1][cut - 1] ) % mod\n        cnt = 1\n        if tmp != 0 :\n            cn, cc = 0, 0\n            for i in range(1, n + 1) :\n                cn += node\n                cc += cut\n                cnt = cnt * (tmp + i - 1) % mod * inv[i] % mod\n                if cn > n or cc > n : break\n                for j in range(n - cn, -1, -1) :\n                    for k in range(n - cc, -1, -1) :\n                        if f[j][k] == 0 : continue\n                        g[j + cn][k + cc] += f[j][k] * cnt\n                        g[j + cn][k + cc] %= mod\n            for i in range(n + 1) :\n                for j in range(n + 1) :\n                    f[i][j] = (f[i][j] + g[i][j]) % mod\n                    g[i][j] = 0\n            \n    for cut in range(n, -1, -1) :\n        s[node][cut] = ( s[node][cut + 1] + f[node][cut] ) % mod\nprint(f[n][m - 1])", "lang_cluster": "Python", "tags": ["flows", "dp", "combinatorics", "graphs"], "code_uid": "7a50330cf37146b40bef32b5f70dbd0f", "src_uid": "aca6148effff8b893c961b1ee465e4e4", "difficulty": 2900.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n#sys.stdin = open('game.in', 'r')\n#sys.stdout = open('game.out', 'w')\n\nline = raw_input().split(' ')\nA, B, N = int(line[0]), int(line[1]), int(line[2])\nN -= 1\n\nnl = 0\nlist = [0]*100\nwhile 1 == 1:\n\tcurb = nl + 1\n\tle, ri = 1, N\n\twhile le < ri:\n\t\tcura = (le+ri+1)//2\n\t\tif (cura**curb <=N):\n\t\t\tle = cura\n\t\telse:\n\t\t\tri = cura-1;\n\tif (le > 1):\n\t\tnl += 1\n\t\tlist[nl] = le\n\telse:\n\t\tbreak\n\nwin = [[-1]]\ncb = nl\nfor i in range(1, 50000):\n\twin.append([])\n\twhile (cb > 0) and (i > list[cb]):\n\t\tcb -= 1\n\tfor j in range(cb+5):\n\t\twin[i].append(-1);\n\t\t\ndef get(win, list, nl, a, b, n):\n\tif (a == 1) and (b > nl):\n\t\treturn 3\n\tif (a > list[b]):\n\t\treturn 1\n\tif (b == 1) and (a > list[2]):\n\t\tif ((a&1) != (n&1)):\n\t\t\treturn 1\n\t\telse:\n\t\t\treturn 2\n\tif (win[a][b] != -1):\n\t\treturn win[a][b]\n\tx, y = get(win, list, nl, a+1, b, n), get(win, list, nl, a, b+1, n)\n\tif (x == 2) or (y == 2):\n\t\twin[a][b] = 1\n\t\treturn 1\n\tif (x == 3) or (y == 3):\n\t\twin[a][b] = 3\n\t\treturn 3\n\twin[a][b] = 2\n\treturn 2\n\t\nj = nl\nwhile j > 0:\n\tif j == 1:\n\t\ti = list[2]\n\telse:\n\t\ti = list[j]\n\twhile i > 0:\n\t\tget(win, list, nl, i, j, N)\n\t\ti -= 1\n\tj -= 1\n\nret = get(win, list, nl, A, B, N)\nif (ret == 1):\n\tprint \"Masha\"\nif (ret == 2):\n\tprint \"Stas\"\nif (ret == 3):\n\tprint \"Missing\"", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "ce4193d6d4ba486e20b2abb9bd44848b", "src_uid": "cffd5c0b7b659649f3bf9f2dbd20ad6b", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\n#sys.stdin = open('game.in', 'r')\n#sys.stdout = open('game.out', 'w')\n\nline = raw_input().split(' ')\nA, B, N = int(line[0]), int(line[1]), int(line[2])\nN -= 1\n\nnl = 0\nlist = [0]*100\nwhile 1 == 1:\n\tcurb = nl + 1\n\tle, ri = 1, N\n\twhile le < ri:\n\t\tcura = (le+ri+1)//2\n\t\tif (cura**curb <=N):\n\t\t\tle = cura\n\t\telse:\n\t\t\tri = cura-1;\n\tif (le > 1):\n\t\tnl += 1\n\t\tlist[nl] = le\n\telse:\n\t\tbreak\n\nwin = []\nfor i in range(50000):\n\twin.append([-1])\n\tfor j in range(50):\n\t\twin[i].append(-1);\n\t\t\ndef get(win, list, nl, a, b, n):\n\tif (a == 1) and (b > nl):\n\t\treturn 3\n\tif (a > list[b]):\n\t\treturn 1\n\tif (b == 1) and (a > list[2]):\n\t\tif ((a&1) != (n&1)):\n\t\t\treturn 1\n\t\telse:\n\t\t\treturn 2\n\tif (win[a][b] != -1):\n\t\treturn win[a][b]\n\tx, y = get(win, list, nl, a+1, b, n), get(win, list, nl, a, b+1, n)\n\tif (x == 2) or (y == 2):\n\t\twin[a][b] = 1\n\t\treturn 1\n\tif (x == 3) or (y == 3):\n\t\twin[a][b] = 3\n\t\treturn 3\n\twin[a][b] = 2\n\treturn 2\n\t\nj = nl\nwhile j > 0:\n\tif j == 1:\n\t\ti = list[2]\n\telse:\n\t\ti = list[j]\n\twhile i > 0:\n\t\tget(win, list, nl, i, j, N)\n\t\ti -= 1\n\tj -= 1\n\nret = get(win, list, nl, A, B, N)\nif (ret == 1):\n\tprint \"Masha\"\nif (ret == 2):\n\tprint \"Stas\"\nif (ret == 3):\n\tprint \"Missing\"", "lang_cluster": "Python", "tags": ["dp", "games"], "code_uid": "0e446476a5051f809a987dfc317642b7", "src_uid": "cffd5c0b7b659649f3bf9f2dbd20ad6b", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "mod = 1000000007\ndef power(a, p):\n    res = 1\n    while p > 0:\n        if p % 2 == 1:\n            res = (res * a) % mod\n        a = (a * a) % mod\n        p //= 2\n    return res\nn, m = map(int, input().split())\nn += 1\nres = (power(n * 2, m - 1)) * (n - m) * 2\nprint((res % mod))", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "056bee65b63b1877e81533b108e9e16e", "src_uid": "4f9711197e699c0fd0c4e9db8323cac7", "difficulty": 2700.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "mod = 10 ** 9 + 7\nn , m = map(int , raw_input().split())\nprint (pow(2 * (n + 1) , m - 1 , mod) * (n + 1 - m) * 2) % mod", "lang_cluster": "Python", "tags": ["math", "number theory"], "code_uid": "77835f328d195a077b7b3895a238fd0c", "src_uid": "4f9711197e699c0fd0c4e9db8323cac7", "difficulty": 2700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "N = 200001\nMOD = 1000000007\nfact = [1] * N\ninv_fact = [1] * N\n\ndef ModExp(a, n):\n    ans = 1\n    while n:\n        if n % 2:\n            ans = (ans * a) % MOD\n        a = (a * a) % MOD\n        n /= 2\n    return ans\n\ndef ModInverse(a):\n    return ModExp(a, MOD - 2)\n\ndef PreProcess(n):\n    for i in range(1, n + 1):\n        fact[i] = (i * fact[i - 1]) % MOD\n\n    inv_fact[n] = ModInverse(fact[n])\n    for i in range(n - 1, 0, -1):\n        inv_fact[i] = ((i + 1) * inv_fact[i + 1]) % MOD\n\ndef nCr(n, r):\n    if n < 0 or r < 0 or n < r:\n        return 0\n    else:\n        return (fact[n] * (inv_fact[r] * inv_fact[n - r]) % MOD) % MOD\n\ndef Beggar(m, n):\n    if m < 0 or n < 0 or (n == 0 and m != 0):\n        return 0\n    else:\n        if m + n == 0:\n            return 1\n        else:\n            return nCr(m + n - 1, m)\n\nf, w, h = map(int, raw_input().split())\nn = f + w\n\nPreProcess(n)\n\nq = nCr(n, w)\np = 0\n\nfor n in range(0, w + 1):\n    if n * (h + 1) > w:\n        break\n    else:\n        p += (Beggar(w - n * (h + 1), n) * ((Beggar(f - n - 1, n + 1) + Beggar(f - n + 1, n - 1) + 2 * Beggar(f - n, n)) % MOD)) % MOD\n\nq = ModInverse(q)\nans = (p * q) % MOD\n\nprint ans\n", "lang_cluster": "Python", "tags": ["brute force", "math", "combinatorics", "probabilities", "number theory"], "code_uid": "4367eaf95e50ba5619dd4c28dd3261c4", "src_uid": "a69f95db3fe677111cf0558271b40f39", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "def build_fac():\n   global mod\n   fac = [1] * int(3e5 + 1)\n   for i in range(1, int(3e5)):\n      fac[i] = i*fac[i-1] % mod\n   return fac\n\ndef inv(x):\n   global mod\n   return pow(x, mod-2, mod)\n\ndef ncr(n, r):\n   global fac\n   if n < 0 or n < r: return 0\n   return fac[n]*inv(fac[r])*inv(fac[n-r]) % mod\n\ndef cf(f, w, h):\n   global mod\n   if w == 0: return 1\n   rs = 0\n   for k in range(1, min(w//(h+1),f+1)+1):\n      rs += ncr(f+1, k) * ncr(w-k*h-1, k-1) % mod\n      rs %= mod\n   return rs\n\nf, w, h = map(int,input().split(' '))\nmod = int(1e9 + 7)\n\nfac = build_fac()\ncnt = cf(f, w, h)\nrs = cnt*inv(ncr(f+w, w)) % mod\n\nprint(rs)", "lang_cluster": "Python", "tags": ["brute force", "math", "combinatorics", "probabilities", "number theory"], "code_uid": "6d6a54411357b72db5f3addd41637ccd", "src_uid": "a69f95db3fe677111cf0558271b40f39", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "a,b= map(int,input().split())\nans,l,n=0,1,a+b\nwhile l<=n:\n    g= n//l\n    if a<g or b<g:\n        l= (n//g) +1\n        continue\n    r= n//g\n    al = (a+g)//(g+1)\n    ah = a//g\n    bl=(b+g)//(g+1)\n    bh = b//g\n    if (al <= ah and bl <= bh):\n        ans += max(0,min(r,ah+bh)- max(l,al +bl)+1)\n    l=r+1\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "binary search"], "code_uid": "7afd42ceb4f73342a9e0e3f2100b8d29", "src_uid": "0e6a204565fef118ea99d2fa1e378dd0", "difficulty": 2700.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "import math\na,b= map(int,input().split())\nn=a+b\nans,l=0,1\nwhile l<=n:\n    g= n//l\n    if a<g or b<g:\n        l= (n//g) +1\n        continue\n    r= n//g\n    a_low = (a+g)//(g+1)\n    a_high = a//g\n    b_low=(b+g)//(g+1)\n    b_high = b//g\n    if (a_low <= a_high and b_low <= b_high):\n        ans += max(0,min(r,a_high+b_high)- max(l,a_low +b_low)+1)\n\n    l=r+1\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "implementation", "binary search"], "code_uid": "267078b17a8b82f2c60f86cd246fb705", "src_uid": "0e6a204565fef118ea99d2fa1e378dd0", "difficulty": 2700.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "import sys\ndebug = False\ndef solve(a, b, c, d):\n    for i in c:\n        if i not in a:\n            return 0\n    #w=[a,b]\n    #q=[c,d]\n    #[q,p] in w\n    #p?\n    ind1 = 0\n    ind2 = 0\n    cnt1 = 1\n    cnt2 = 0\n    phases = []\n    phases2 = []\n    \n    while True:\n        if a[ind1] == c[ind2]:\n            ind2 += 1\n            if ind2 == len(c):\n                #word finished!\n                cnt2 += 1\n                ind2 = 0\n                #check phase\n                if ind1 in phases:\n                    #period!\n                    cnt1_, cnt2_ = phases2[phases.index(ind1)]\n                    step1 = cnt1 - cnt1_\n                    step2 = cnt2 - cnt2_\n                    cnt = (b-cnt1)/step1\n                    cnt1 += step1 * cnt\n                    cnt2 += step2 * cnt\n                    phases = []\n                    phases2 = []\n                #save phase\n                phases.append(ind1)\n                phases2.append([cnt1, cnt2])\n\n        ind1 += 1\n        if ind1 == len(a):\n            cnt1 += 1\n            ind1 = 0\n            if cnt1 > b:\n                return cnt2 / d\n    #answ  \n    val2 = phases2[-1]\n    val1 = phases2[phases.index(ind1)]\n\n    step1 = val2[0] - val1[0]\n    step2 = val2[1] - val1[1]\n    \n    if debug:\n        print str(val1[0]) + \" -- > \" + str(val1[1])\n        print str(val2[0]) + \" -- > \" + str(val2[1])\n\n    res = step2 * b / (step1 * d)\n    res = (b - val2[0]) * step2 / (step1 * d) + val2[1]\n    if res < 0:\n        return 0\n    else:\n        return res\n\nif not debug:\n    b, d = map(int, sys.stdin.readline().split())\n    \n    a = sys.stdin.readline().split()[0]\n    c = sys.stdin.readline().split()[0]\n    print str(solve(a, b, c, d))\nelse:\n    vals = []\n    vals.append([841, 7, 'qjqhrksmvedtqldrqgchhsofokfcovut' ,'qhtmothoulodshrfejterjlguvooccsvqrrdfqfvkqhtecuhhuqhshthrkusrc', 5])\n    vals.append([933, 5, 'abaabdcbbabacbdddadbbb', 'babbadbaaadbbbbaabbaabccbbdbadbbbbbbdbcbdbaaadbdbdbbbbdcbbdcbdaadbd', 15])\n    vals.append([875, 10, 'hjeaiemqfliohlicmhndhbfdmlmcnjjgbg', 'hojqhmbgjlfmlliimlhahfeihgmhhhnbmebhgnfhgmhfjqhmlnnddgmqldelnhebi', 4])\n    vals.append([320672, 1, 'wyyojuothwmlvrglfzdzdbtubxuoffvncrswsaznmoijoi', 'ttvlvzxcvczuagwzgbfuwmmt', 40084])\n    vals.append([5608475, 1, 'gbagadghfaedhddefgbehbbdedefbaaeddachgebhbcgahfdchffhbhfahhdegdhdfbccgefhcdhhcdfgdgfhcdffaacch', 'fgfadaaecdgabeahcacadcbfhhe', 1869491])\n    vals.append([1263204, 1, 'dcbabceabbaebddaaecbddaceaedacddadadcbbadbdccdecdacdcaadbceeddccbceaade', 'abddbccbdca', 1894805])\n    vals.append([100, 1, 'bca', 'abc', 99])\n    vals.append([541, 9, 'bxhwcmunbdxcatppdsw', 'shbppncwbnsxxnxunwsbncpdchcbcspdcppdchmbbcuapphpdxbpcswcxpxpdscxpddbcppdxhpxbuxxdbpdpuudb', 1])\n    vals.append([9447267, 1, 'cbdcbdbcdacbcabddbaabcbacbabcaacbabaccddcbbdbbaddcbcbaaadc', 'bbbbdbcbbbdbdbcdcacccbdcadadbacbcccc', 4723633])\n    vals.append([1181362, 3, 'fckmaalkicfakhcbiglkekajmadjkj', 'zfkjkjgkmjhfkackkhhjalgkkclcklabggk', 0])\n    for val in vals:\n        b, d, a, c, answer = val\n        res = solve(a, b, c, d)\n        if res == answer:\n            print '++++++++++++++++++++++++++++'\n            pass\n        else:\n            print '----------------------------'\n            print val\n            print res\n            print '----------------------------'\n            sys.stdin.readline()\n\n", "lang_cluster": "Python", "tags": ["dfs and similar", "strings"], "code_uid": "8765dc03cac3f5e54280f8f6ee7a4f2c", "src_uid": "5ea0351ac9f949dedae1928bfb7ebffa", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n = int(input())\na = sorted(list(map(int, input().split())))\n\nmaxe = max(a)\ncnt = []\ncur = 1\nk = 0\ni = 0\nwhile i < n:\n    cnt.append(0)\n    while i < n and a[i] < cur:\n        cnt[2 * k] += 1\n        i += 1\n    cnt.append(0)\n    while i < n and a[i] == cur:\n        cnt[2 * k + 1] += 1\n        i += 1\n    k += 1\n    cur *= 2\ncnt.append(0)\ncnt.append(0)\nmaxe = len(cnt) - 1\n\nmaxk = cnt[1]\nwas = False\nfor l in range(maxk):\n    cur = 1\n    while cnt[cur] > 0:\n        cnt[cur] -= 1\n        cur += 2\n    cnt[cur] -= 1\n    cursum = 0\n    ok = True\n    for t in range(maxe, 0, -1):\n        cursum += cnt[t]\n        if cursum > 0:\n            ok = False\n            break\n    if ok:\n        print(l + 1, end=\" \")\n        was = True\n\nif not was:\n    print(-1)", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "binary search"], "code_uid": "b852220675f83267bfbcbcb6c3ce921f", "src_uid": "fc29e8c1a9117c1dd307131d852b6088", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "from collections import Counter\nn = int(input())\na = list(map(int, input().split()))\n\ndef get(cnt):\n    c = Counter(a)\n    last = []\n    while c[1] and (cnt is None or len(last) < cnt):\n        x = 1\n        while c[x]:\n            c[x] -= 1\n            x *= 2\n        last.append(x >> 1)\n    rem = sorted(c.elements())\n    i = 0\n    for x in last[::-1]:\n        if i < len(rem) and rem[i] < 2 * x:\n            i += 1\n    return len(last) if i == len(rem) else 0\n\nmx = get(None)\nlo, hi = 0, mx\nwhile lo < hi:\n    mid = (lo + hi) >> 1\n    if get(mid):\n        hi = mid\n    else:\n        lo = mid + 1\nif mx:\n    print(*range(lo, mx + 1))\nelse:\n    print(-1)\n", "lang_cluster": "Python", "tags": ["math", "greedy", "constructive algorithms", "binary search"], "code_uid": "20212e4f7d1e1898b74ba29d6c9fdc8b", "src_uid": "fc29e8c1a9117c1dd307131d852b6088", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "mod=10**9+7\nf=[0]*500000\n\ndef POW(a,b):\n\tif(b==0):\n\t\treturn 1\n\tif(b&1):\n\t\treturn POW(a,b//2)**2*a%mod\n\telse:\n\t\treturn POW(a,b//2)**2\n\ndef C(n,m):\n\tif(m>n):\n\t\treturn 0\n\tt=f[n]*POW(f[m],mod-2)%mod*POW(f[n-m],mod-2)%mod\n\treturn t\n\n\nf[0]=1\nfor i in range(1,500000):\n\tf[i]=f[i-1]*i%mod\na,b,k,t=map(int,input().split(' '))\n\nans=0\nfor i in range(0,2*t+1):\n\tt1=POW(-1,i)*C(2*t,i)%mod\n\tt2=(C(210000+2*k*t-a+b+2*t-1-(2*k+1)*i+1,2*t)-C(1+2*k*t-a+b+2*t-1-(2*k+1)*i,2*t))%mod\n\tans=(ans+t1*t2)%mod\nprint(ans)\n", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "83ef0f689d559c6114688cedb1bb0355", "src_uid": "8b8327512a318a5b5afd531ff7223bd0", "difficulty": 2200.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "n,p=map(int,input().split())\nnums=[0]+list(map(int,input().split()))\nmod=10**9+7\n\nf=[[[[0]*2 for _ in range(2)] for _ in range(2)] for _ in range(n+1)]\n\n_2=[0]*(n+1)\n_2[0]=1\nfor i in range(1,n+1):\n    _2[i]=(_2[i-1]<<1)%mod\n    \nf[0][0][0][0]=1\nif nums[1]!=0:\n    f[1][1][0][1]+=1\nif nums[1]!=1:\n    f[1][1][1][0]+=1\n\nfor i in range(2,n+1):\n    for j in range(2):\n        for ob in range(2):\n            for ow in range(2):\n                qwq=f[i-1][j][ob][ow]\n                if nums[i]!=0:\n                    if ob:\n                        f[i][j][ob][ow]=(f[i][j][ob][ow]+qwq*_2[i-2])%mod\n                        f[i][j^1][ob][ow|1]=(f[i][j^1][ob][ow|1]+qwq*_2[i-2])%mod\n                    else:\n                        f[i][j^1][ob][ow|1]=(f[i][j^1][ob][ow|1]+qwq*_2[i-1])%mod\n                if nums[i]!=1:\n                    if ow:\n                        f[i][j][ob][ow]=(f[i][j][ob][ow]+qwq*_2[i-2])%mod\n                        f[i][j^1][ob|1][ow]=(f[i][j^1][ob|1][ow]+qwq*_2[i-2])%mod\n                    else:\n                        f[i][j^1][ob|1][ow]=(f[i][j^1][ob|1][ow]+qwq*_2[i-1])%mod\n\n\nans=0\nfor i in range(2):\n    for j in range(2):\n        ans=(ans+f[n][p][i][j])%mod\nprint(ans)\n", "lang_cluster": "Python", "tags": ["dp"], "code_uid": "3431a34341f3e3a7b24ad7cebf99a9c7", "src_uid": "aaf5f8afa71d9d25ebab405dddec78cd", "difficulty": 2400.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "K = [0]*1000\n\nK[0] = 1\nfor i in range(1, 1000):\n    K[i] = i*K[i-1]\n\nM = {}\n\ndef F(a,b):\n    if a == 0 and b == 0:\n        return 1\n    if b == 0:\n        return K[a]\n    if (a,b) in M:\n        return M[(a,b)]\n    t = 0\n    if a > 0:\n        t += a*F(a-1,b)\n    t += F(a,b-1)\n    if b > 1:\n        k = b-1\n        for i in range(0,a+1):\n            t += k*F(a-i,b-2)\n            k *= (a-i)\n    M[(a,b)] = t\n    return t\n\nn = int(raw_input())\n\nd = [int(x) for x in raw_input().split(\" \")]\n\nx = 0\ny = 0\n\nfor i in range(n):\n    if d[i] == 1:\n        x += 1\n    if d[i] == 2:\n        y += 1\n\nprint F(y,x)\n", "lang_cluster": "Python", "tags": ["brute force", "dp"], "code_uid": "c225f0516c2f801e9c68da4f3cc2fdc0", "src_uid": "91e8dbe94273e255182aca0f94117bb9", "difficulty": 2300.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "d = '0123456789ABCDEFGH'\nprev = {d[i]: d[i - 1] for i in range(1, 18)}\nnext = {d[i]: d[i + 1] for i in range(17)}\n\nn, m = raw_input().split()\np, m = ['0'] * 10, int(m)\nk, l = 1, len(n)\nfor x in map(int, n): p[x] = next[p[x]]\n\na = ''.join(p)\nu, v = {a: [0] * m}, {}\nu[a][0] = 1\n\nfor r in range(1, l + 1):\n    if r == l and '0' in n: u.pop('1000000000')\n    for a in u:\n        for i in range(10):\n            if a[i] != '0':\n                b = a[: i] + prev[a[i]] + a[i + 1: ]\n                if not b in v: v[b] = [0] * m\n                i = (k * i) % m - m\n                x, y = v[b], u[a]\n                for j in range(m): x[j + i] += y[j]\n    u, v = v, {}\n    k = 10 * k % m\n\nprint u['0000000000'][0]", "lang_cluster": "Python", "tags": ["brute force", "dp", "combinatorics", "bitmasks", "number theory"], "code_uid": "7dffc96b512f9e96de7b35dbe09730eb", "src_uid": "5eb90c23ffa3794fdddc5670c0373829", "difficulty": 2000.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 2", "source_code": "import sys\nrange = xrange\ninput = raw_input\n\nMOD = 998244353 \n\nimport __pypy__\nmodmul = __pypy__.intop.int_mulmod\nmo = lambda a,b: modmul(a,b,MOD)\npo = lambda a,b: pow(a,b,MOD)\n\nbig = 10**6 + 10\nmodinv = [1]*big\nfor i in range(2,big):\n    modinv[i] = mo(-(MOD//i), modinv[MOD%i])\n\nfac = [1]\nfor i in range(1,big):\n    fac.append(mo(fac[-1], i))\n\ninvfac = [1]\nfor i in range(1,big):\n    invfac.append(mo(invfac[-1], modinv[i]))\n\ndef choose(n,k):\n    return mo(mo(fac[n], invfac[k]), invfac[n-k])\n\ndef par(x):\n    return -1 if x & 1 else 1\n\nn = int(input())\n\nans = 0\nextra = 0\nfor i in range(1, n + 1):\n    base = po(3, n - i)\n    tmp = po(-base + 1, n) - po(-base, n)\n    ans = (ans + par(i + 1 + n) * mo(choose(n, i), tmp)) % MOD\n    \n    exp = modmul(n, n - i, MOD - 1) + i\n    extra = (extra + par(i + 1) * mo(choose(n, i), po(3, exp))) % MOD\n\nprint (3 * ans + 2 * extra) % MOD\n", "lang_cluster": "Python", "tags": ["math", "combinatorics"], "code_uid": "ab90f1cad7b4970ea6376f9208786dc8", "src_uid": "6e4b0ee2e1406041a961582ead299a3a", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "MOD = 998244353;import __pypy__;int_add = __pypy__.intop.int_add;int_sub = __pypy__.intop.int_sub;int_mul = __pypy__.intop.int_mul\r\ndef make_mod_mul(mod=MOD):\r\n    fmod_inv = 1.0 / mod\r\n    def mod_mul(a, b, c=0):\r\n        res = int_sub(int_add(int_mul(a, b), c), int_mul(mod, int(fmod_inv * a * b + fmod_inv * c)))\r\n        if res >= mod:            return res - mod\r\n        elif res < 0:            return res + mod\r\n        else:            return res\r\n    return mod_mul\r\nmod_mul = make_mod_mul()\r\ndef mod_pow(x, y):\r\n    if y == 0:        return 1\r\n    res = 1\r\n    while y > 1:\r\n        if y & 1 == 1:            res = mod_mul(res, x)\r\n        x = mod_mul(x, x);        y >>= 1\r\n    return mod_mul(res, x)\r\nn, m = map(int, input().split());pascal = [[1]]\r\nfor _ in range(n + m + 5):\r\n    nl = [1]\r\n    for i in range(_):        nl.append((pascal[-1][i] + pascal[-1][i+1]) % MOD)\r\n    nl.append(1);    pascal.append(nl)\r\ndef s1(n,m):\r\n    out = 0\r\n    for row in range(1, n):\r\n        above = row;    below = n - row;     bottom = [];top = []\r\n        for i in range(m):  a = below - 1;     b = i;    a2 = below;    b2 = m-i-1;  bottom.append(mod_mul(pascal[a+b][a] , pascal[a2+b2][a2]))\r\n        for i in range(m):  a = above - 1;  b = i;   a2 = above;    b2 = m-i-1;   top.append(mod_mul(pascal[a+b][a] , pascal[a2+b2][a2]))\r\n        top.reverse();        curr = 0\r\n        for i in range(m):  out += mod_mul(curr,bottom[i]);  curr += top[i];  curr %= MOD;   out %= MOD\r\n    return out * 2\r\ndef s2(n,m):\r\n    o = 0\r\n    for i in range(1,n):\r\n        for j in range(1,m):  a = pascal[i+j-1][i-1];       b = pascal[n-i+j-1][n-i]; c = pascal[n-i-1+m-j][m-j];  d = pascal[i+m-j-1][i];   o += mod_mul(mod_mul(a,b),mod_mul(c,d))\r\n    return o\r\nc1 = s1(n,m);c2 = s1(m,n);c3 = s2(n,m);out = (c1 + c2 - 2*c3) % MOD;print(out)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "f0ef9b85438f2167e0fc891b629aa9d8", "src_uid": "1738dc65af1fffa445cb0c3074c6bedb", "difficulty": 3100.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "M=998244353;N=4042\r\ntry:\r\n    import __pypy__\r\n    int_add=__pypy__.intop.int_add\r\n    int_sub=__pypy__.intop.int_sub\r\n    int_mul=__pypy__.intop.int_mul\r\n    def make_mod_mul(mod=M):\r\n        fmod_inv=1.0/mod\r\n        def mod_mul(a,b,c=0):\r\n            res=int_sub(\r\n                int_add(int_mul(a,b),c),\r\n                int_mul(mod,int(fmod_inv*a*b+fmod_inv*c)),\r\n            )\r\n            if res>=mod:return res-mod\r\n            elif res<0:return res+mod\r\n            else:return res\r\n        return mod_mul\r\n    mod_mul=make_mod_mul()\r\nexcept:\r\n    def mod_mul(a,b):return(a*b)%M\r\ndef mod_add(a,b):\r\n    v=a+b\r\n    if v>=M:v-=M\r\n    if v<0:v+=M\r\n    return v\r\ndef mod_sum(a):\r\n    v=0\r\n    for i in a:v=mod_add(v,i)\r\n    return v\r\nf1=[1]\r\nfor i in range(N):f1.append(mod_mul(f1[-1],i+1))\r\nf2=[pow(f1[-1],M-2,M)]\r\nfor i in range(N):f2.append(mod_mul(f2[-1],N-i))\r\nf2=f2[::-1]\r\nC=lambda a,b:mod_mul(mod_mul(f1[a],f2[b]),f2[a-b])\r\nA=lambda a,b,w:mod_mul(C(a+b,a),C(w+b-a-2,b-1))\r\ndef V(h,W,H):\r\n    s=p=0\r\n    for i in range(W-1):\r\n        p=mod_add(p,A(i,H-h,W));s=mod_add(s,mod_mul(p,A(W-2-i,h,W)))\r\n    return s\r\nH,W=map(int,input().split())\r\nY=mod_sum(mod_mul(A(s,h,W),A(W-2-s,H-h,W))for s in range(W-1)for h in range(1,H))\r\nX=mod_add(mod_sum(V(h,W,H)for h in range(1,H)),mod_sum(V(w,H,W)for w in range(1,W)))\r\nprint((X+X-Y-Y)%M)", "lang_cluster": "Python", "tags": ["math", "dp", "combinatorics"], "code_uid": "7e8e673c550fec08ec8e6ab1b2e40d3f", "src_uid": "1738dc65af1fffa445cb0c3074c6bedb", "difficulty": 3100.0, "exec_outcome": "PASSED"}
{"lang": "Python 2", "source_code": "def bits(i):\n    tmp = i\n    ans = 0\n    while tmp != 0:\n        if (tmp & 1) == 1:\n            ans += 1\n        tmp >>= 1\n    return ans\n\ndef get(i, j):\n    k = 0\n    while ((1<<k) & j) == 0:\n        k += 1\n\n    tj = j - (1<<k);\n    ti = i - (1<<k);\n    for p in xrange(N):\n        if g[k][p] == 0 or ((1<<p) & ti) == 0 or ((1<<p) & tj):\n            continue;\n        dp[i][j] += dp[ti][tj] + dp[ti][tj + (1<<p)];    \n\nN, M, K = map(int, raw_input().split())\n\nnp = 1 << N\ndp = [[0 for i in xrange(np)] for j in xrange(np)]\ng = [[0 for i in xrange(N)] for j in xrange(N)]\nfor i in xrange(M):\n    v, u = map(int, raw_input().split())\n    v -= 1\n    u -= 1\n    g[u][v] = 1\n    g[v][u] = 1\n    s = (1 << v) + (1 << u)\n    dp[s][s] = 1\n    \nfor i in xrange(np):\n    bs = bits(i)\n    if bs <= 2:\n        continue\n    j = i\n    while j != 0:\n        get(i, j)\n        j = (j - 1) & i\n        \nans = 0\nfor i in xrange(np):\n    if bits(i) == K:\n        ans += dp[np - 1][i]\n\nprint ans\n", "lang_cluster": "Python", "tags": ["dp", "bitmasks"], "code_uid": "74c8a30408fb4fdcd0c7659769484709", "src_uid": "8087605a8f316150372cc4627f26231d", "difficulty": 2500.0, "exec_outcome": "PASSED"}
{"lang": "PyPy 3", "source_code": "n = int(input())\r\nsz = len(str(n))\r\ndef get(x):\r\n    ans = 0\r\n    nw = 1\r\n    x1 = x\r\n    for i in range(sz):\r\n        x = x1\r\n        if x < nw:\r\n            while x < nw: x *= 10\r\n            x -= 1 #\u0442\u043a \u0441\u0443\u043a\u0430 [1;x)\r\n        else:\r\n            while x >= nw * 10: x //= 10\r\n        x = min(x, n)\r\n        ans += x - nw + 1\r\n        nw *= 10\r\n    return ans\r\n\r\n\r\nMOD = 998244353\r\n\r\nans = 0\r\ni = 1\r\nwhile i <= n:\r\n    l = i\r\n    r = min(n, 10 ** (len(str(i))) - 1) + 1\r\n    nw = (get(i) - i) // MOD\r\n    while r - l > 1:\r\n        mid = (l + r) // 2\r\n        x = (get(mid) - mid) // MOD\r\n        if nw == x:\r\n            l = mid\r\n        else:\r\n            r = mid\r\n    ans += nw * (r - i)\r\n    # i += 1\r\n    i = r\r\nprint((ans * -MOD) % (int)(1e9 + 7))", "lang_cluster": "Python", "tags": ["dfs and similar", "math", "meet-in-the-middle", "binary search"], "code_uid": "c11c33ba84d3bd687698048c5895987b", "src_uid": "2c70ae38f91ab739621a31b897b8fbf3", "difficulty": 3400.0, "exec_outcome": "PASSED"}
{"lang": "Python 3", "source_code": "def prefix(s):\n    v = [0]*len(s)\n    for i in range(1,len(s)):\n        k = v[i-1]\n        while k > 0 and s[k] != s[i]:\n            k = v[k-1]\n        if s[k] == s[i]:\n            k = k + 1\n        v[i] = k\n    return v\n\nn = int(input())\nn-=1\ns1 = input()\ns2 = input()\nopos = {'W':'E', 'E':'W', 'N':'S', 'S':'N'}\ns3 = ''\nfor elem in s2:\n    s3 += opos[elem]\n    \ns3  = s3[::-1]\ns = s3 + '$' + s1\n\na = prefix(s)[2 * n]\nif a == 0: print('YES')\nelse: print('NO')\n\n", "lang_cluster": "Python", "tags": ["strings"], "code_uid": "c3e8862d67c0290640698e99ef9c6aff", "src_uid": "85f43628bec7e9b709273c34b894df6b", "difficulty": 2500.0, "exec_outcome": "PASSED"}