problem_id
stringlengths 6
6
| user_id
stringlengths 10
10
| time_limit
float64 1k
8k
| memory_limit
float64 262k
1.05M
| problem_description
stringlengths 48
1.55k
| codes
stringlengths 35
98.9k
| status
stringlengths 28
1.7k
| submission_ids
stringlengths 28
1.41k
| memories
stringlengths 13
808
| cpu_times
stringlengths 11
610
| code_sizes
stringlengths 7
505
|
---|---|---|---|---|---|---|---|---|---|---|
p03241 | u735069283 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import sys\ninput= sys.stdin.readline\n\nN,M = map(int,input().split())\ng=M//N\nfor i in range(g):\n if M%(N+i)==0:\n print(M//(N+i))\n exit()', 'N,M = map(int,input().split())\ng=M//N\nfor i in range(g):\n if M%g==0:\n print(g)\n exit()', 'import sys\ninput= sys.sdtin.readline\n\nN,M = map(int,input().split())\ng=M//N\nfor i in range(g):\n if M%(g-i)==0:\n print(g-i)\n exit()', 'import sys\ninput= sys.stdin.readline\n\nN,M = map(int,input().split())\ng=M//N\nfor i in range(g):\n if M%(g-i)==0:\n print(g-i)\n exit()\n if M%(N+i)==0:\n print(M//(N+i))\n exit()'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s015963102', 's610071239', 's738545433', 's116106157'] | [3064.0, 2940.0, 2940.0, 3060.0] | [48.0, 2104.0, 17.0, 77.0] | [194, 145, 189, 237] |
p03241 | u752767312 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import math\n\nN,M = map(int,input().split())\n\nans = 1\nfor i in range(1,int(math.sqrt(M)+1)+1):\n if M % i != 0:\n continue\n B = M / i\n \n if (A * N <= M):\n ans = max(ans,A)\n if (B * N <= M):\n ans = max(ans,B)\n\nprint(ans)\n ', 'import math\n \nN,M = map(int,input().split())\n \nans = 1\nfor i in range(1,int(math.sqrt(M))+1+1):\n if M % i != 0:\n continue\n B = int(M / i)\n \n if (i * N <= M):\n ans = max(ans,i)\n if (B * N <= M):\n ans = max(ans,B)\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s210499638', 's315700478'] | [3060.0, 3064.0] | [17.0, 21.0] | [258, 347] |
p03241 | u754022296 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n, m = map(int, input().split())\nk = m//n\nans = 0\nfor i in range(1, int(m**0.5)+1):\n if m%i == 0:\n if i <= k:\n if i <= k:\n ans = max(ans, i)\n if m//i <= k:\n ans = max(ans, m//i)\nprint(ans)', 'n, m = map(int, input().split())\nk = m//n\nans = 0\nfor i in range(1, int(m**0.5)+1):\n if m%i == 0:\n if i <= k:\n ans = max(ans, i)\n if m//i <= k:\n ans = max(ans, m//i)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s598920437', 's150224227'] | [3064.0, 3060.0] | [17.0, 21.0] | [210, 193] |
p03241 | u761989513 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n, m = map(int, input().split())\nfor i in range(n, int(m ** .5) + 1):\n if m % i == 0:\n print(m // i)\n exit()', 'def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n return divisors\n\n\nn, m = map(int, input().split())\n\nans = 0\nfor i in make_divisors(m):\n if i <= m / n:\n ans = max(ans, i)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s879144460', 's084897490'] | [2940.0, 3060.0] | [19.0, 20.0] | [125, 346] |
p03241 | u768896740 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['def primes(n):\n is_prime = [True] * (n + 1)\n is_prime[0] = False\n is_prime[1] = False\n for i in range(2, int(n**0.5) + 1):\n if not is_prime[i]:\n continue\n for j in range(i * 2, n + 1, i):\n is_prime[j] = False\n return [i for i in range(n + 1) if is_prime[i]]\n\nprime_list = primes(10**7)\np_list = set(prime_list)\n\nn, m = map(int, input().split())\n\nans = 1\n\nfor i in prime_list:\n if n * i > m:\n break\n if m % i == 0:\n num = m // i\n if num in p_list:\n ans = i\n elif num < n:\n continue\n elif num >= i * n:\n a = num // n\n ans = i * a\n else:\n continue\n\nprint(ans)', 'def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n divisors.sort()\n return divisors\n\nn, m = map(int, input().split())\n\nans = 1\n\ndiv = make_divisors(m)\n\nfor i in div:\n if i * n <= m:\n ans = i\n else:\n break\n\nprint(ans)'] | ['Time Limit Exceeded', 'Accepted'] | ['s299203480', 's847006283'] | [107484.0, 3064.0] | [2109.0, 20.0] | [702, 391] |
p03241 | u774160580 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N, M = map(int, input().split())\ndiv = []\nfor i in range(1, M + 1):\n if i * i > M:\n break\n if M % i == 0:\n div.append(i)\n if M % i == 0 and i != M // i:\n div.append(M // i)\ndiv.sort()\ndiv.reverse()\nprint(div)\nfor i in div:\n if M // i >= N:\n print(i)\n break\n', 'N, M = map(int, input().split())\ndiv = []\nfor i in range(1, M + 1):\n if i * i > M:\n break\n if M % i == 0:\n div.append(i)\n if M % i == 0 and i != M // i:\n div.append(M // i)\ndiv.sort()\ndiv.reverse()\nfor i in div:\n if M // i >= N:\n print(i)\n break\n'] | ['Wrong Answer', 'Accepted'] | ['s199212170', 's395341050'] | [3064.0, 2940.0] | [29.0, 28.0] | [304, 293] |
p03241 | u781262926 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['from math import sqrt\nfrom numba import njit\n@njit\ndef divisors(n):\n divisors = []\n for i in range(1, int(sqrt(n))+1):\n q, r = divmod(n, i)\n if r == 0:\n divisors.append(i)\n if i != q:\n divisors.append(q)\n divisors.sort()\n return divisors\n\nn, m = map(int, input().split())\nans = 1\nfor a in divisors(m)[1:-1]:\n if a*n <= m:\n ans = a\nprint(ans)', 'from math import sqrt\ndef divisors(n):\n divisors = []\n for i in range(1, int(sqrt(n))+1):\n q, r = divmod(n, i)\n if r == 0:\n divisors.append(i)\n if i != q:\n divisors.append(q)\n divisors.sort()\n return divisors\n\nn, m = map(int, input().split())\nans = 1\nfor a in divisors(m)[1:]:\n if a*n <= m:\n ans = a\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s569297921', 's658612985'] | [123236.0, 9204.0] | [1966.0, 29.0] | [414, 383] |
p03241 | u784022244 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N,M=map(int, input().split())\n\nif M%N==0:\n print(M//N)', 'N,M=map(int, input().split())\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n \n return divisors\n\nD=make_divisors(M)\nD=sorted(D)\nans=0\nfor d in D:\n if M//d>=N:\n ans=d\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s777423714', 's611900238'] | [2940.0, 3188.0] | [17.0, 20.0] | [55, 388] |
p03241 | u785989355 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N,M = list(map(int,input().split()))\n\nif N==1:\n print(M)\nelse:\n ans = 1\n for i in range(1,10**5):\n if i*i>M:\n break\n if M%i==0:\n j = max(i.M//i)\n if j>=N:\n ans = max(j,ans)\n\n print(ans)', 'N,M = list(map(int,input().split()))\n\nif N==1:\n print(M)\nelse:\n ans = 1\n for i in range(1,10**5):\n if i*i>M:\n break\n if M%i==0:\n j = max(i,M//i)\n if j>=N:\n ans = max(j,ans)\n\n print(ans)', 'N,M = list(map(int,input().split()))\n\nif N==1:\n print(M)\nelse:\n ans = 1\n for i in range(1,10**5):\n if i*i>M:\n break\n if M%i==0:\n j=0\n k=0\n if M//i>=N:\n j=i\n if i>=N:\n k=M//i\n ans = max(j,k,ans)\n\n print(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s098241283', 's160290387', 's460090761'] | [3060.0, 3060.0, 3060.0] | [17.0, 25.0, 25.0] | [259, 259, 328] |
p03241 | u790877102 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import math\n\nn,m = map(int,input().split())\n\nx=0\n\ns = []\nfor i in range(math.floor(math.sqrt(m)))\n\tif m%i==0:\n\t\ts.append(i)\n\n\n\nfor i in s\n\tif m%(i+1)==0 and m//(i+1)>n-1:\n\t\tx=max(x,i+1)\nprint(x)\n\n\n\n', 'import math\n\nn,m = map(int,input().split())\n\nx=0\n\ns = []\nfor i in range(math.sqrt(m)):\n\tif m%i==0:\n\t\ts.append(i)\n\n\n\nfor i in s:\n\tif m%(i+1)==0 and m//(i+1)>n-1:\n\t\tx=max(x,i+1)\nprint(x)\n\n\n\n\n\n', 'import math\n\nn,m = map(int,input().split())\n\nx=0\n\ns = []\nfor i in range(math.floor(math.sqrt(m))+3):\n\tif m%(i+1)==0:\n\t\ts.append(i+1)\n\n\n\nfor i in s:\n\tif m//(i+1)>n-1:\n\t\tx=max(x,i+1)\nprint(x)\n\n\n\n\n\n', 'import math\n\nn,m = map(int,input().split())\n\nx=0\n\ns = []\nfor i in range(math.sqrt(m))\n\tif m%i==0:\n\t\ts.append(i)\n\n\n\nfor i in s\n\tif m%(i+1)==0 and m//(i+1)>n-1:\n\t\tx=max(x,i+1)\nprint(x)\n\n\n\n', 'import math\n\nn,m = map(int,input().split())\n\nx=0\n\ns = []\nfor i in range(math.floor(math.sqrt(m))+3):\n\tif m%(i+1)==0:\n\t\ts.append(i+1)\n\n', 'import math\n\nn,m = map(int,input().split())\n\nx=0\n\ns = []\nfor i in range(math.floor(math.sqrt(m))+3):\n\tif m%(i+1)==0:\n\t\ts.append(i+1)\n\t\ts.append(m//(i+1))\n\n\n\n\nfor i in s:\n\tif m%(i)==0 and m//(i)>n-1:\n\t\tx=max(x,i)\nprint(x)\n'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s254342857', 's317059405', 's358769558', 's768821371', 's869393506', 's198519230'] | [2940.0, 3060.0, 3064.0, 2940.0, 2940.0, 3060.0] | [17.0, 18.0, 22.0, 17.0, 22.0, 22.0] | [198, 190, 195, 186, 134, 221] |
p03241 | u790905630 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import sys\nsys.setrecursionlimit(10**10)\n\ndef search_max_gcd(M, possible):\n if possible == 1:\n return 1\n elif (M % possible) == 0:\n return possible\n else:\n return search_max_gcd(M, possible-1)\n\ndef main():\n N, M = map(int, input().split())\n first_possible = M//N\n print(search_max_gcd(M, first_possible))\n\nmain()', 'from math import *\n\ndef main():\n N, M = map(int, input().split())\n special_value = M//N\n divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))\n divisor_set = divisor_set.union(M//j for j in divisor_set)\n print(int(max(divisor_set, key=lambda x: x if special_value >= x else -1)))\n\n return\n\nif __name__ == "__main__":\nmain()', 'from math import *\n\nN, M = map(int, input().split())\nspecial_value = M//N\ndivisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))\ndivisor_set = divisor_set.union(M//j for j in divisor_set)\nprint(int(max(divisor_set, key=lambda x: x if special_value >= x else -1)))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s314860773', 's334794323', 's647398388'] | [2940.0, 2940.0, 3060.0] | [18.0, 17.0, 20.0] | [351, 362, 283] |
p03241 | u795630164 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import math\nN, M = map(int, input().split())\nif N == 1:\n print(M)\n exit()\n\nn = 0\nfor i in range(1, int(math.sqrt(M))+1):\n if M % i == 0:\n n = max(i, n)\n if i >= N:\n n = max(M//i, n)\n if M < i * N:\n break\n\nprint(n)\n', 'import math\nN, M = map(int, input().split())\n\nn = 0\nfor i in range(1, int(math.sqrt(M))+1):\n if M < i * N:\n break\n\n if M % i == 0:\n n = max(i, n)\n if i >= N:\n n = max(M//i, n)\n\nprint(n)\n'] | ['Wrong Answer', 'Accepted'] | ['s170906551', 's358183642'] | [3060.0, 3060.0] | [34.0, 25.0] | [250, 224] |
p03241 | u797740860 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import math\n\nn = 100000\nm = 1000000000\npq_max = 0\n\nfor p in range(1, int(math.sqrt(m)) + 1):\n if m % p == 0:\n q = m // p\n \n if p >= n and q > pq_max:\n pq_max = q\n \n if q >= n and p > pq_max:\n pq_max = p\n \nprint(pq_max)', 'import math\n\nn, m = [int(i) for i in input().split(" ")]\npq_max = 0\n\nfor p in range(1, int(math.sqrt(m)) + 1):\n if m % p == 0:\n q = m // p\n \n if p >= n and q > pq_max:\n pq_max = q\n \n if q >= n and p > pq_max:\n pq_max = p\n \nprint(pq_max)'] | ['Wrong Answer', 'Accepted'] | ['s239157756', 's791145825'] | [3060.0, 3060.0] | [22.0, 21.0] | [289, 307] |
p03241 | u802772880 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m=map(int,input().split())\nans=1\nfor i in range(1,m**0.5+1):\n if m%i==0:\n if m/i>=n:\n ans=max(ans,i)\n elif i>=n:\n ans=max(ans,m//i)\nprint(ans)', 'n,m=map(int,input().split())\nans=1\nfor i in range(1,int(m**0.5)+1):\n if m%i==0:\n if m/i>=n:\n ans=max(ans,i)\n if i>=n:\n ans=max(ans,m//i)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s950146746', 's379413807'] | [3060.0, 3060.0] | [17.0, 21.0] | [183, 186] |
p03241 | u807772568 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import math;a = list(map(int,input().split()));b = a[1]//a[0];c = [];for i in range(1,int(math.sqrt(a[1]))+1):if a[1]%i==0 and i<=b:if a[1] // i <= b:c.append(a[1]//i);else:c.append(i);c.sort(reverse=True);print(c[0])', '¥import math\na = list(map(int,input().split()))\nb = a[1]//a[0]\nc = []\nfor i in range(1,int(math.sqrt(a[1]))+1):\n if a[1]%i==0 and i<=b:\n if a[1] // i <= b:\n c.append(a[1]//i)\n else:\n c.append(i)\nc.sort(reverse=True)\nprint(c[0])', 'import math;a = list(map(int,input().split()));b = a[1]//a[0];c = []\nfor i in range(1,int(math.sqrt(a[1]))+1):\n if a[1]%i==0 and i<=b:\n if a[1] // i <= b:\n c.append(a[1]//i)\n else:\n c.append(i)\nc.sort(reverse=True);print(c[0])'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s527149509', 's917560778', 's171552031'] | [3064.0, 3060.0, 3060.0] | [17.0, 18.0, 22.0] | [217, 267, 265] |
p03241 | u820351940 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n, m = map(int, input().split())\nif n == 1:\n print(m)\n exit()\n', 'n, m = map(int, input().split())\nvalues = []\n\ndef pfac(n):\n values = [1, n]\n for i in range(2, int(n ** 0.5) + 1):\n if n % i == 0:\n values.append(i)\n values.append(n // i)\n return values\n\n\nfor i in pfac(m):\n if m % i == 0 and m / i >= n:\n values.append(i)\nprint(max(values))\n'] | ['Wrong Answer', 'Accepted'] | ['s367989733', 's459216265'] | [2940.0, 3060.0] | [17.0, 20.0] | [68, 323] |
p03241 | u839188633 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n, m = map(int, input().split())\nfor i in range(int(m/n), int(n**.5), -1):\n if not m % i:\n print(m//i)\n exit()\nfor i in range(int(min((m / n), n**.5)), 0, -1):\n if not m % i:\n print(i)\n break', 'n, m = map(int, input().split())\nfor i in range(-int(-m/n), -int(-n**.5), -1):\n if not m % i:\n print(m//i)\n break\nfor i in range(int(min((m / n), n**.5)), 0, -1):\n if not m % i:\n print(i)\n break', 'from math import ceil\nn, m = map(int, input().split())\nfor i in range(n, ceil(m**.5), 1):\n if not m % i:\n print(m//i)\n exit()\nfor i in range(int(min((m / n), m**.5)), 0, -1):\n if not m % i:\n print(i)\n break'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s256310924', 's812433422', 's897139496'] | [3060.0, 3188.0, 3060.0] | [2103.0, 2104.0, 22.0] | [225, 228, 240] |
p03241 | u844789719 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import math\nn,m=(int(i) for i in input().split())\np = min(math.sqrt(m),int(m/n))\nwhile p>1:\n if m%p==0 and m>=n*p:\n break\n p-=1\nprint(p)', 'n,m=(int(i) for i in input().split())\np = int(m**(1/2))\ndivisors = []\nfor i in range(1,p+1):\n if m%i == 0:\n if n*i<=m:\n divisors.append(i)\n if n<=i:\n divisors.append(int(m/i))\nprint(max(divisors))'] | ['Wrong Answer', 'Accepted'] | ['s000845378', 's596384478'] | [2940.0, 3060.0] | [31.0, 21.0] | [149, 235] |
p03241 | u845333844 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m=map(int, input().split())\n\nk=[]\n\nfor i in range(m):\n if (m%i==0) and (m//i <= n):\n k.append(i)\n \nprint(max(k)) \n\n \n\n\n\n', 'import math\nn,m=map(int, input().split())\n\nk=[]\n\nfor i in range(m):\n if (m%i==0) and (m//i <= n):\n k.append(i)\n \nprint(max(k)) \n\n \n\n\n\n', 'n,m=map(int,input().split())\nif n==1:\n print(m)\nelse:\n max=1\n for i in range(1,m//n+1):\n if m%i==0:\n max=i\n print(max)', 'import math\n\nn,m=map(int,input().split())\nif n==1:\n print(m)\nelse:\n l=[]\n for i in range(1,math.floor(m**0.5)+1):\n if m%i==0 and i<=m//n:\n l.append(i)\n if m//i<=m//n:\n l.append(m//i)\n l.sort()\n print(l[-1])'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s490889477', 's559593634', 's863562852', 's611753158'] | [2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 17.0, 20.0, 21.0] | [135, 147, 168, 304] |
p03241 | u852038767 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import math\n\nN,M = map(int,input().split())\nA = []\nn = 0\nif N == 1:\n print(M)\nelse:\n ans = 1\n for i in range(1, int(math.sqrt(M))):\n if (M % i == 0):\n A.append(i)\n A.append(int(M / A[2*n]))\n n += 1\n print(A)\n for k in range(len(A)):\n if A[-1-k] <= M/N:\n print(A[-1-k])\n exit()', 'import math\n\nN,M = map(int,input().split())\nA = []\nn = 0\nif N == 1:\n print(M)\nelse:\n ans = 1\n for i in range(1, int(math.sqrt(M))+1):\n if (M % i == 0):\n if i <= M//N:\n A.append(i)\n if M/i <= M//N:\n A.append(int(M/i))\n A.sort()\n print(A[-1])'] | ['Wrong Answer', 'Accepted'] | ['s792633052', 's516957887'] | [3064.0, 3060.0] | [24.0, 22.0] | [360, 314] |
p03241 | u855985627 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ["n,m=(int(i) for i in input().split(' '))\ni=m\nif m=2147483647:\n print(1)\n exit()\nwhile True:\n if i==1:\n print(i)\n break\n if m%i==0 and m//i>=n:\n print(i)\n break\n else:\n i-=1\n", "import random\n\ndef is_prime(q,k=10):\n if q == 2: return True\n if q < 2 or q&1 == 0: return False\n d = (q-1)>>1\n while d&1 == 0:\n d >>= 1\n for i in range(k):\n a = random.randint(1,q-1)\n t = d\n y = pow(a,t,q)\n while t != q-1 and y != 1 and y != q-1: \n y = pow(y,2,q)\n t <<= 1\n if y != q-1 and t&1 == 0:\n return False\n return True\n\nn,m=(int(i) for i in input().split(' '))\nfor i in range(1,n):\n if m%i==0 and is_prime(m//i) and (i==1 or m//i>n):\n print('1')\n exit()\nfor i in range(1,m):\n if i==m:\n print(1)\n break\n if m%i==0 and i>=n:\n print(m//i)\n break\n", "n,m=(int(i) for i in input().split(' '))\ni=m//i\nwhile True:\n if m%i==0 and m//i>=n:\n print(i)\n break\n else:\n i-=1", "n,m=(int(i) for i in input().split(' '))\nfor i in range(1,m//n+1):\n if i==m:\n print(1)\n break\n if m%i==0 and i>=n:\n print(m//i)\n break", "import random\n\ndef is_prime(q,k=50):\n if q == 2: return True\n if q < 2 or q&1 == 0: return False\n d = (q-1)>>1\n while d&1 == 0:\n d >>= 1\n for i in range(k):\n a = random.randint(1,q-1)\n t = d\n y = pow(a,t,q)\n while t != q-1 and y != 1 and y != q-1: \n y = pow(y,2,q)\n t <<= 1\n if y != q-1 and t&1 == 0:\n return False\n return True\n\nn,m=(int(i) for i in input().split(' '))\nif n<1000:\n for i in range(1,n):\n if m%i==0 and (is_prime(i) or i=1) and is_prime(m//i) and (i==1 or m//i<n):\n print('1')\n exit()\nfor i in range(n,m+1):\n if i==m:\n print(1)\n break\n if m%i==0:\n print(m//i)\n break\n if m-i-n>0 and m%(m-i-n)==0 and m//(m-i-n)>n:\n print(m-i-n)\n break\n", "def divisor(m,k):\n divisor=[]\n for i in range(1,k+1):\n if m%i==0:\n divisor.append(i)\n return divisor\n\nn,m=(int(i) for i in input().split(' '))\nprint(divisor(m,m//n))\nfor i in divisor(m)[::-1]:\n if i==1:\n break\n if m%i==0 and m//i>=n:\n print(i)\n break\n", "def factor(x){\n factor=[]\n if x==1:\n return\n else:\n i=2\n while x>1:\n if x%i==0:\n factor.append([i,1])\n x/=i\n while x%i==0:\n factor[-1][1]+=1\n x/=i\n i+=1\n return factor\n\nn,m=(int(i) for i in input().split(' '))\nfactor=factor(m)\nans=1\nfor data in factor:\n data[1]=data[1]/n\n ans=ans*(data[0]**data[1])\nprint(ans)\n", "import random\n\ndef is_prime(q,k=50):\n if q == 2: return True\n if q < 2 or q&1 == 0: return False\n d = (q-1)>>1\n while d&1 == 0:\n d >>= 1\n for i in range(k):\n a = random.randint(1,q-1)\n t = d\n y = pow(a,t,q)\n while t != q-1 and y != 1 and y != q-1: \n y = pow(y,2,q)\n t <<= 1\n if y != q-1 and t&1 == 0:\n return False\n return True\n\nn,m=(int(i) for i in input().split(' '))\n\nif n==1:\n print(m)\n exit()\nif True:\n for i in range(1,n):\n if m%i==0 and is_prime(m//i) and m//i>n:\n print('1')\n exit()\nfor i in range(1,m//n+1)[::-1]:\n if i==1:\n print(i)\n break\n if m%i==0 and m//i>=n:\n print(i)\n break\n", "n,m=(int(i) for i in input().split(' '))\nprint(n)", "n,m=(int(i) for i in input().split(' '))\nfor i in range(1,m//n):\n if i==1:\n print(i)\n break\n if m%i==0 and m//i>=n:\n print(i)\n break", "import random\n\ndef is_prime(n):\n if n == 2: return True\n if n == 1 or n & 1 == 0: return False\n\n d = (n - 1) >> 1\n while d & 1 == 0:\n d >>= 1\n\n for k in range(100):\n a = random.randint(1, n - 1)\n t = d\n y = pow(a, t, n)\n\n while t != n - 1 and y != 1 and y != n - 1:\n y = (y * y) % n\n t <<= 1\n\n if y != n - 1 and t & 1 == 0:\n return False\n\n return True\n\nn,m=(int(i) for i in input().split(' '))\nfor i in range(1,n)\n if m%i==0 and is_prime(m//i):\n print('1')\n exit()\nfor i in range(1,m//n+1)[::-1]:\n if i==1:\n print(i)\n break\n if m%i==0 and m//i>=n:\n print(i)\n break\n", 'print(n)', "def divisor(m):\n divisor=[]\n for i in range(2,m//2+1):\n if m%i==0:\n divisor.append(i)\n divisor=[1]+divisor+[m]\n return divisor\n\nn,m=(int(i) for i in input().split(' '))\nprint(divisor(m))\nfor i in divisor(m)[::-1]:\n if i==1:\n break\n if m%i==0 and m//i>=n:\n print(i)\n break\n", "n,m=(int(i) for i in input().split(' '))\nfor i in range(1,1000)[::-1]:\n if i==1:\n print(i)\n break\n if m%i==0 and m//i>=n:\n print(m//i)\n break\n", "import random\n\ndef is_prime(n):\n if n == 2: return True\n if n == 1 or n & 1 == 0: return False\n\n d = (n - 1) >> 1\n while d & 1 == 0:\n d >>= 1\n\n for k in range(100):\n a = random.randint(1, n - 1)\n t = d\n y = pow(a, t, n)\n\n while t != n - 1 and y != 1 and y != n - 1:\n y = (y * y) % n\n t <<= 1\n\n if y != n - 1 and t & 1 == 0:\n return False\n\n return True\n\nn,m=(int(i) for i in input().split(' '))\nfor i in range(1,n):\n if m%i==0 and is_prime(m//i):\n print('1')\n exit()\nfor i in range(1,m//n+1)[::-1]:\n if i==1:\n print(i)\n break\n if m%i==0 and m//i>=n:\n print(i)\n break\n", "import random\n\ndef is_prime(q,k=50):\n if q == 2: return True\n if q < 2 or q&1 == 0: return False\n d = (q-1)>>1\n while d&1 == 0:\n d >>= 1\n for i in range(k):\n a = random.randint(1,q-1)\n t = d\n y = pow(a,t,q)\n while t != q-1 and y != 1 and y != q-1: \n y = pow(y,2,q)\n t <<= 1\n if y != q-1 and t&1 == 0:\n return False\n return True\n\nn,m=(int(i) for i in input().split(' '))\nif m%n>10000:\n for i in range(1,n):\n if m%i==0 and is_prime(i) and is_prime(m//i) and (i==1 or m//i<n):\n print('1')\n exit()\nfor i in range(n,m+1):\n if i==m:\n print(1)\n break\n if m%i==0:\n print(m//i)\n break\n if m%(m-i+1)==0\n print(m-i+1)\n break\n", "import math\nimport random\n\ndef is_prime(n):\n if n == 1: return False\n if n == 2: return True\n\n for k in range(100):\n a = random.randint(2, n - 1)\n\n if gcd(n, a) != 1:\n return False\n\n if pow(a, n - 1, n) != 1:\n return False\n\n return True\n\ndef gcd(a, b):\n while b > 0:\n a, b = b, a % b\n return a\n\nif __name__ == '__main__':\n print(is_prime(2 ** 89 - 1))\n\n\nn,m=(int(i) for i in input().split(' '))\nif is_prime(m):\n print('1')\nelse:\n for i in range(1,m//n+1)[::-1]:\n if i==1:\n print(i)\n break\n if m%i==0 and m//i>=n:\n print(i)\n break\n", "def factor(x):\n factor=[]\n if x==1:\n return\n else:\n i=2\n while x>1:\n if x%i==0:\n factor.append([i,1])\n x/=i\n while x%i==0:\n factor[-1][1]+=1\n x/=i\n i+=1\n return factor\n\nn,m=(int(i) for i in input().split(' '))\nfactor=factor(m)\nans=1\nfor data in factor:\n data[1]=data[1]//n\n ans=ans*(data[0]**data[1])\nprint(ans)\n", "import random\n\ndef is_prime(q,k=50):\n if q == 2: return True\n if q < 2 or q&1 == 0: return False\n d = (q-1)>>1\n while d&1 == 0:\n d >>= 1\n for i in range(k):\n a = random.randint(1,q-1)\n t = d\n y = pow(a,t,q)\n while t != q-1 and y != 1 and y != q-1: \n y = pow(y,2,q)\n t <<= 1\n if y != q-1 and t&1 == 0:\n return False\n return True\n\nn,m=(int(i) for i in input().split(' '))\nfor i in range(1,n):\n if m%i==0 and (is_prime(i) or i==1) and is_prime(m//i) and (i==1 or m//i<n):\n print('1')\n exit()\nfor i in range(n,m+1):\n if i==m:\n print(1)\n break\n if m%i==0:\n print(m//i)\n break"] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s067385058', 's068516274', 's110530905', 's113976088', 's249904822', 's255179725', 's294057649', 's327803609', 's392515314', 's409280773', 's461677975', 's606067779', 's635151807', 's651194991', 's851273036', 's912432210', 's918294558', 's924000293', 's507995414'] | [2940.0, 3444.0, 2940.0, 2940.0, 3064.0, 3060.0, 2940.0, 3444.0, 2940.0, 3060.0, 3064.0, 2940.0, 3060.0, 2940.0, 3444.0, 3064.0, 4200.0, 3064.0, 3444.0] | [17.0, 57.0, 17.0, 50.0, 17.0, 2104.0, 17.0, 2104.0, 17.0, 17.0, 17.0, 17.0, 2108.0, 17.0, 2104.0, 17.0, 2104.0, 2103.0, 649.0] | [193, 666, 124, 148, 778, 273, 375, 714, 49, 146, 685, 8, 295, 156, 680, 742, 629, 378, 684] |
p03241 | u856232850 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m = map(int,input().split())\na = int((m**0.5)//1)\nb = 0\n\nfor i in range(1,a+1):\n if m % i == 0:\n if (m//i)%n == 0:\n b = i\nprint(b)', 'n,m = map(int,input().split())\na = int((m**0.5)//1)\nb = 0\nif n == 1:\n print(m)\nelse:\n for i in range(1,a+1):\n if m % i == 0:\n if (m//i) >= n:\n b = max(b,i)\n if i >= n:\n b = max(b,m//i)\n\n print(b)'] | ['Wrong Answer', 'Accepted'] | ['s633444756', 's354305804'] | [3060.0, 3188.0] | [21.0, 21.0] | [153, 263] |
p03241 | u857330600 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m=map(int,input().split())\nr=m//n\nfor i in range(n,r):\n if m%i==0:\n print(m//i)\n break', 'n,m=map(int,input().split())\nr=m//n\nif r>=10**7:\n for i in range(n,r):\n if m%i==0:\n print(m//i)\n break\nelse:\n for i in range(r):\n if m%(r-i)==0 and m//(r-i)>=n:\n print(r-i)\n break'] | ['Wrong Answer', 'Accepted'] | ['s397993292', 's178808547'] | [2940.0, 3060.0] | [37.0, 47.0] | [95, 207] |
p03241 | u857759499 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m = map(int,input().split())\na = m//n\ndi = []\nfor i in range(1, min(a+1,int(m**0.5)+1)):\n if m % i == 0:\n di.append(i)\n if i != m // i and a >= m // i:\n di.append(m//i)\ndi.sort()\nprint(di,di[-1])', 'n,m = map(int,input().split())\na = m//n\ndi = []\nfor i in range(1, min(a+1,int(m**0.5)+1)):\n if m % i == 0:\n di.append(i)\n if i != m // i and a >= m // i:\n di.append(m//i)\ndi.sort()\nprint(di[-1])'] | ['Wrong Answer', 'Accepted'] | ['s688548961', 's469939905'] | [9436.0, 9404.0] | [30.0, 38.0] | [210, 207] |
p03241 | u863076295 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N,M = map(int,input().split())\nfor i in range(M//N,0,-1):\n if M%i==0: break\n print(i)', 'N,M = map(int,input().split())\n\nfor i in range(M//N,0,-1):\n if m%i!=0: break\n else (M-N*i)%i==0:\n ret = i\n print(ret)\n break', 'N,M = map(int,input().split())\nfor i in range(M//N,0,-1):\n if M%i==0:\n print(i)\n break\n else: break', 'N,M = map(int,input().split())\nfor i in range(M//N,0,-1):\n if m%i==0:\n print(i)\n break\n else: break', 'def f():\n n,m=map(int,input().split())\n for i in range(m//n,0,-1):\n if m%i == 0: break\n return i\nprint(f())'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s097636393', 's334951777', 's815976302', 's905376251', 's671626081'] | [23268.0, 3064.0, 2940.0, 2940.0, 2940.0] | [2103.0, 22.0, 17.0, 17.0, 1837.0] | [91, 151, 119, 119, 123] |
p03241 | u867848444 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m=map(int,input().split())\n\nnum=m//n\nans=1\nfor i in range(int(m**0.5),2,-1):\n if m%i==0:\n Num=m//i\n if Num <= num and ans < Num:\n ans = Num\n\n if i<=num and ans<i:\n ans=i\n\nprint(ans)', 'n,m=map(int,input().split())\n\nnum=m//n\nans=1\nfor i in range(int(m**0.5),2,-1):\n Num=i\n if m%i==0:\n Num1=m//i if m//i<=num else 1\n if Num>num:\n Num=1\n\n ans=max(ans,Num,Num1)\n\nprint(ans)', 'import fractions\nn,m=map(int,input().split())\n\nif m%n==0:\n print(m//n)\n exit()\ntemp=m//n\nleft=m-temp*n\ngcd=fractions.gcd(temp,temp+left)\nprint(gcd)', 'n, m = map(int,input().split())\n\nres = 1\nnum = int(m ** 0.5) + 1\nfor i in range(1, num):\n if m % i != 0:continue \n j = m // i\n if i >= n:\n res = max(j, res)\n if j >= n:\n res = max(i, res)\nprint(res)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s148878201', 's157406829', 's415484489', 's874625381'] | [3060.0, 3060.0, 5048.0, 9436.0] | [24.0, 22.0, 35.0, 35.0] | [221, 222, 153, 225] |
p03241 | u883048396 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import itertools\n\niN,iM = [int(_) for _ in input().split()]\n\n\nif iM % iN == 0:\n print(iM // iN)\nelse:\n iUlim = iM//iN\n aRet = [1]\n iF = 2\n iterIncrements = itertools.chain([1,2,2],itertools.cycle([4,2,4,2,4,6,2,6]))\n for i in iterIncrements:\n if iUlim < iF:\n break\n if iM % iF == 0:\n aRet.append(i)\n iF += i\n\n print(aRet[-1])\n', 'iN,iM = [int(_) for _ in input().split()]\niD = iM // iN\nif iM % iN == 0:\n print(iD)\nelse:\n for i in range( iD , 0,-1):\n if iM % i == 0:\n print(i)\n', 'import itertools\niN,iM = [int(_) for _ in input().split()]\n\nif iM % iN == 0:\n print(iM // iN)\nelse:\n for i in range( 1 , min(iM // iN + 1,int(iM ** 0.5)+1) ):\n if iM % i == 0:\n aRet.append( i )\n print( aRet[-1] )\n', '\ndef 解():\n iN,iM = [int(_) for _ in input().split()]\n iD = iM // iN\n if iM % iN == 0:\n print(iD)\n elif 2*iN > iM :\n print(1)\n else:\n aD = []\n iRtM = int(iM**0.5)\n if iRtM > iD:\n for i in range(iD,0,-1):\n if iM % i == 0:\n print(i)\n exit()\n else:\n aRet = []\n for i in range(1,iRtM+1):\n if iM % i ==0:\n if iRtM / 2 > i:\n aRet.append(i)\n if iD > iM // i :\n print (iM // i)\n exit()\n else:\n print (i)\n exit()\n print(max(aRet))\n解()\n'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s298709882', 's497831841', 's875419161', 's334041104'] | [3064.0, 3060.0, 3060.0, 3064.0] | [2104.0, 2103.0, 18.0, 20.0] | [391, 170, 240, 801] |
p03241 | u888337853 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ["import sys\n\n# import re\nimport math\nimport collections\n\nimport bisect\nimport itertools\nimport fractions\n# import functools\nimport copy\nimport heapq\nimport decimal\n# import statistics\nimport queue\n\nsys.setrecursionlimit(10000001)\nINF = 10 ** 16\nMOD = 10 ** 9 + 7\n\nni = lambda: int(sys.stdin.readline())\nns = lambda: map(int, sys.stdin.readline().split())\nna = lambda: list(map(int, sys.stdin.readline().split()))\n\n\n# ===CODE===\n\n\ndef main():\n def make_divisors(n):\n divisors = []\n for i in range(1, int(n ** 0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n // i)\n\n \n return divisors\n\n n, m = ns()\n gcd = make_divisors(m)\n\n max_gcd = 1\n for d in gcd:\n if m // d >= n:\n max_gcd = max(max_gcd, d)\n\n print(d)\n\n\nif __name__ == '__main__':\n main()\n", "import sys\n\n# import re\nimport math\nimport collections\n\nimport bisect\nimport itertools\nimport fractions\n# import functools\nimport copy\nimport heapq\nimport decimal\n# import statistics\nimport queue\n\nsys.setrecursionlimit(10000001)\nINF = 10 ** 16\nMOD = 10 ** 9 + 7\n\nni = lambda: int(sys.stdin.readline())\nns = lambda: map(int, sys.stdin.readline().split())\nna = lambda: list(map(int, sys.stdin.readline().split()))\n\n\n# ===CODE===\n\n\ndef main():\n def make_divisors(n):\n divisors = []\n for i in range(1, int(n ** 0.5) + 1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n // i)\n\n \n return divisors\n\n n, m = ns()\n gcd = make_divisors(m)\n\n max_gcd = 1\n for d in gcd:\n if m // d >= n:\n max_gcd = max(max_gcd, d)\n\n print(max_gcd)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s268841179', 's569974822'] | [5564.0, 5092.0] | [49.0, 40.0] | [947, 953] |
p03241 | u891217808 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n, m = map(int, input().split())\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n divisors.sort()\n return divisors\ndiv = make_divisors(n)\nfor i in div[::-1]:\n if i <= m / n:\n print(i)\n break', 'n, m = map(int, input().split())\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n divisors.sort()\n return divisors\ndiv = make_divisors(m)\nfor i in div[::-1]:\n if i <= m / n:\n print(i)\n break'] | ['Wrong Answer', 'Accepted'] | ['s188880863', 's671766234'] | [3060.0, 3188.0] | [18.0, 20.0] | [363, 363] |
p03241 | u896741788 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m=map(int,input().split())\nans=1\nfor i in range(2,int(m**(1/2))+1):\n if m%i==0:\n if i>=n:ans=max(m//i*(n//i),ans)\n if m//i>=n:\n ans=max(i*(m//i//n),ans)\nprint(ans)', 'n,m=map(int,input().split())\nans=1\nfor i in range(1,int(m**(1/2))+1):\n if m%i==0:\n if i>=n:ans=max(m//i*,ans)\n if m//i>=n:\n ans=max(i,ans)\nprint(ans)', 'n,m=map(int,input().split())\nans=1\nfor i in range(1,int(m**(1/2))+1):\n if m%i==0:\n if i>=n:ans=max(m//i,ans)\n if m//i>=n:\n ans=max(i,ans)\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s005166155', 's981695723', 's625694504'] | [3060.0, 2940.0, 3188.0] | [21.0, 17.0, 21.0] | [193, 177, 176] |
p03241 | u899975427 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m = map(int,input().split())\nans = 0\nfor i in range(1,int(n**0.5)+1):\n if m % i == 0 and m // i >= n:\n ans = max(ans,i)\n if m % i == 0 and i >= n:\n ans = max(ans,m//i)\nprint(ans)', 'n,m = map(int,input().split())\nans = 1\nif m % n == 0:\n print(m//n)\n exit()\nelse:\n for i in range(2,int(n**0.5)+1):\n if m % i == 0 and m // i >= n:\n ans = i\nprint(ans)', 'n,m = map(int,input().split())\nans = 1\nif m % n == 0:\n print(m//n)\n exit()\nelse:\n for i in range(2,int(n**0.5)+1):\n if m % i == 0 and m // i >= n:\n ans = max(ans,i)\n if m % i == 0 and i >= n:\n ans = max(ans,m//i)\nprint(ans)', 'n,m = map(int,input().split())\nans = 0\nfor i in range(1,int(m**0.5)+1):\n if m % i == 0 and m // i >= n:\n ans = max(ans,i)\n if m % i == 0 and i >= n:\n ans = max(ans,m//i)\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s045549121', 's755248421', 's863689725', 's706775143'] | [3060.0, 2940.0, 3060.0, 3060.0] | [18.0, 18.0, 17.0, 25.0] | [188, 177, 242, 188] |
p03241 | u903460784 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import fraction\n# import math\nn,m=map(int,input().split())\n\n# (m-n+n-1)!/((m-n)!(n-1)!)\nif m%n==0:\n print(m//n)\nelse:\n print(fraction.gcd(m//n,m%n))\n # print(math.gcd(m//n,m%n))\n', '\n\nn,m=map(int,input().split())\n\ndivisors=[]\nfor i in range(1,int(n**0.5)+1):\n if n%i==0:\n divisors.append(i)\n if i!=n//i:\n divisors.append(n//i)\n\ndivisors.sort(key=lambda x:-x)\nfor d in divisors:\n if d<m//n:\n print(d)\n break\n', '\n\nn,m=map(int,input().split())\n\ndivisors=[]\nfor i in range(1,int(m**0.5)+1):\n if m%i==0:\n divisors.append(i)\n if i!=m//i:\n divisors.append(m//i)\n\ndivisors.sort(key=lambda x:-x)\n\nfor d in divisors:\n if d<=m//n:\n print(d)\n break\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s344860726', 's431778448', 's490796690'] | [2940.0, 2940.0, 3060.0] | [18.0, 18.0, 22.0] | [271, 373, 392] |
p03241 | u903596281 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N,M=map(int,input().split())\nif M%N==0:\n print(M//N)\nelse:\n s=M//N\n if s<100000:\n ans=1\n while s!=1:\n if M%s==0:\n ans=s\n break\n s-=1\n print(ans)\n else:\n rM=M**(1/2)\n s=N\n ans=1\n while s<=rM:\n if M%s==0:\n ans=M//s\n break\n s+=1\n else:\n s=N\n while s!=1:\n if M%s==0:\n ans=s\n break\n s-=1\n print(ans)', 'N,M=map(int,input().split())\nif M%N==0:\n print(M//N)\nelse:\n s=M//N\n if s<100000:\n ans=1\n while s!=1:\n if M%s==0:\n ans=s\n break\n s-=1\n print(ans)\n else:\n rM=M**(1/2)\n s=N\n ans=1\n while s<=rM:\n if M%s==0:\n ans=M//s\n break\n s+=1\n else:\n s=N\n while s!=1:\n if M%s==0:\n ans=s\n break\n s-=1\n print(ans)'] | ['Runtime Error', 'Accepted'] | ['s786926905', 's446220877'] | [3060.0, 3316.0] | [18.0, 25.0] | [407, 415] |
p03241 | u905582793 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N,M=map(int,input().split())\nd=[]\nfor i in range(1,int(M**0.5+1)):\n if M%i == 0:\n d.extend(i,M//i)\nd=list(set(d)).sort()\nfor x in d:\n if x>=N:\n print(M//x)\n break\n', 'N,M=map(int,input().split())\nd=[]\nfor i in range(1,int(M**0.5+1)):\n if M%i == 0:\n d. append(i)\n d.append(M//i)\ndd=list(set(d))\ndd.sort()\nfor x in dd:\n if x>=N:\n print(M//x)\n break'] | ['Runtime Error', 'Accepted'] | ['s923322702', 's111636642'] | [2940.0, 3060.0] | [18.0, 21.0] | [174, 193] |
p03241 | u906428167 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m = map(int,input().split())\n\nans = 1\n\nfor i in range(1,int(m**0.5)+1):\n if m % i == 0 and m /n >= i:\n ans = max(ans,i)\n if i != n // i and m/n >= (n//i):\n ans = max(ans,n // i)\n\nprint(ans)\n\n\n', 'n,m = map(int,input().split())\n\nans = 1\n\nfor i in range(1,int(m**0.5)+1):\n if m % i == 0 and m /n >= i:\n ans = max(ans,i)\n if i != m // i and m/n >= (m//i):\n ans = max(ans,m // i)\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s066319634', 's087037911'] | [3060.0, 2940.0] | [21.0, 21.0] | [222, 220] |
p03241 | u913110564 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import math\nn, m = map(long, input().split())\nkotae=1\n\nfor i in range(1,long(math.sqrt(m))+1):\n\tif m%i==0:\n\t\tif i*n<=m:\n\t\t\tkotae=max(kotae, i)\n\t\tif (m/i)*n<=m:\n\t\t\tkotae=max(kotae, m/i)\nprint(kotae)', 'import math\nn, m = map(int, input().split())\nkotae=1\n\nfor i in range(1,int(math.sqrt(m))+1):\n if m%i==0:\n if i*n<=m:\n\t kotae=max(kotae,i)\n if (m/i)*n<=m:\n kotae=max(kotae,i)\nprint(kotae)', 'import math\nn, m,X = map(int, input().split(),1)\nfor i in range(1,32000):\n\tif m%i==0:\n\t\tif i*n<=m:\n\t\t\tX=max(X, i)\n\t\tif (m//i)*n<=m:\n\t\t\tX=max(X, m//i)\nprint(X)', 'import math\nn, m = map(long, input().split())\nkotae=1\n\nfor i in range(1,long(math.sqrt(m))+1):\n\tif m%i==0:\n\t\tif i*n<=m:\n\t\t\tkotae=max(kotae, i)\n\t\tif (m/i)*n<=m:\n\t\t\tkotae=max(kotae, int(m/i))\nprint(kotae)', 'import math\nn, m = map(int, input().split())\nfor i in range(m//n+1,1)[::-1]:\n if m%i==0:\n print(i)\n break\n', 'import math\nn, m = map(int, input().split())\nfor i in range(m//n,1):\n if m%i==0:\n print(i)\n break', 'import math\nn, m = map(int, input().split()) X=1\nfor i in range(1,32000):\n\tif m%i==0:\n\t\tif i*n<=m:\n\t\t\tX=max(X, i)\n\t\tif (m//i)*n<=m:\n\t\t\tX=max(X, m//i)\nprint(X)', 'import math\nn, m = map(int, input().split())\na=1\nfor i in range(1,int(math.sqrt(m))+1):\n if m%i==0:\n if i*n<=m:\n kotae=max(a, i)\n if (m//i)*n<=m:\n kotae=max(a, m//i)\nprint(a)', 'import math\nn, m = map(int, input().split())\nX=1\nfor i in range(1,32000):\n\tif m%i==0:\n\t\tif i*n<=m:\n\t\t\tX=max(X, i)\n\t\tif (m//i)*n<=m:\n\t\t\tX=max(X, m//i)\nprint(X)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s020593019', 's035048966', 's065886684', 's134923848', 's255811021', 's377926091', 's521548322', 's560478708', 's940088395'] | [3060.0, 2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0, 3060.0, 3060.0] | [17.0, 18.0, 17.0, 18.0, 17.0, 17.0, 17.0, 21.0, 21.0] | [197, 199, 158, 202, 113, 104, 158, 180, 158] |
p03241 | u919633157 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['# 2019/08/01\n\nfrom fractions import gcd\n\nn,m=map(int,input().split())\n\ndef divisors(n,m):\n div=[]\n end=min(m//n,int(pow(m,0.5)))\n for i in range(2,end+1):\n if m%i==0:\n div.append(i)\n return div\n\nres=divisors(n,m)\nprint(res[-1])\n\n', '# 2019/08/01\n\nn,m=map(int,input().split())\n\ndef divisors(n,m):\n div=[]\n end=int(pow(m,0.5))\n for i in range(1,end+1):\n if m%i==0:\n div.append(i)\n div.append(m//i)\n div.sort(reverse=True)\n return div\n\nres=divisors(n,m)\nfor e in res:\n if m//n>=e:\n print(e)\n break\n'] | ['Runtime Error', 'Accepted'] | ['s042806513', 's791713077'] | [5176.0, 3064.0] | [38.0, 20.0] | [259, 323] |
p03241 | u920299620 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import sys\nN,M=map(int,input().split())\ni=N\nif(i%2==1):\n if(M%i==0):\n print(M//i)\n sys.exit(0)\n M+=1\nif(M%i==0):\n print(M//i)\n sys.exit(0)\ni+=1\n\n \nwhile(i*2 <=M):\n if(M%i==0):\n break\n i+=2\nif(i*2>M):\n i=M\nprint(M//i)', 'import sys\nN,M=map(int,input().split())\ni=N\nif(i%2==1):\n if(M%i==0):\n print(M//i)\n sys.exit(0)\n M+=1\nif(M%i==0):\n print(M//i)\n sys.exit(0)\nM+=1\n \nwhile(i*2 <=M):\n if(M%i==0):\n break\n i+=2\nif(i*2>M):\n i=M\nprint(M//i)', 'N,M=map(int,input().split())\ni=N\nwhile(i**2 <=M):\n if(M%i==0):\n break\n i+=1\nif(i**2>M):\n i=1\nprint(M//i)', 'import sys\nN,M=map(int,input().split())\ni=N\n\n\ngcd=1\nwhile(1):\n if(M%i==0):\n print(M//i)\n sys.exit(0)\n if(i**2 >M):\n break\n i+=1\n\ni=M//N\nwhile(1):\n if(M%i==0):\n print(i)\n sys.exit(0)\n i-=1'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s376103079', 's516946691', 's860092683', 's544222833'] | [3064.0, 3064.0, 2940.0, 3188.0] | [2103.0, 2104.0, 26.0, 51.0] | [261, 260, 120, 237] |
p03241 | u922901775 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ["#!/usr/bin/env python3\nimport sys\n\ndef factoring(n: int):\n factors = []\n p = 1\n while p * p <= n:\n if n % p == 0:\n factors.append(p)\n if n != p * p:\n factors.append(n // p)\n p += 1\n return factors\n\ndef solve(N: int, M: int):\n if N == 1:\n print(M)\n return\n F = factoring(M)\n F.sort()\n print(F)\n for f in F:\n if f >= N:\n print(M // f)\n break\n return\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n M = int(next(tokens)) # type: int\n solve(N, M)\n\nif __name__ == '__main__':\n main()\n", "#!/usr/bin/env python3\nimport sys\n\ndef factoring(n: int):\n factors = []\n p = 1\n while p * p <= n:\n if n % p == 0:\n factors.append(p)\n if n != p * p:\n factors.append(n // p)\n p += 1\n return factors\n\ndef solve(N: int, M: int):\n if N == 1:\n print(M)\n return\n F = factoring(M)\n F.sort()\n for f in F:\n if f >= N:\n print(M // f)\n break\n return\n\n\n# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n M = int(next(tokens)) # type: int\n solve(N, M)\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s135983501', 's685263050'] | [3064.0, 3064.0] | [22.0, 22.0] | [937, 924] |
p03241 | u930705402 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import bisect\ndef factor(N):\n arr=[]\n for i in range(1,int(N**0.5)+1):\n if(N%i==0):\n arr.append(i)\n if(N//i!=i):\n arr.append(N//i)\n return arr\n\nN,M=map(int,input().split())\nli=sorted(factor(M))\nres=1\nfor i in li:\n if(i>M//N):\n break\n if(M//i>=N):\n res=i\nprint(res)', 'import bisect\ndef factor(N):\n arr=[]\n for i in range(1,int(N**0.5)+1):\n if(N%i==0):\n arr.append(i)\n if(N//i!=i):\n arr.append(N//i)\n return arr\n\nN,M=map(int,input().split())\nli=sorted(factor(M))\nres=1\nfor i in li:\n if(i>M//N):\n break\n if(M//i>=N):\n res=i\nprint(res)'] | ['Wrong Answer', 'Accepted'] | ['s154560015', 's334263977'] | [4584.0, 3064.0] | [37.0, 21.0] | [329, 337] |
p03241 | u934246119 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import math\nn, m = map(int, input().split())\nroot_m = int(math.sqrt(m) + 1)\nans = 1\nfor a in range(1, root_m):\n # print(a, ans)\n b = m // a\n if a * n <= m:\n ans = max(ans, a)\n if b * n <= m:\n ans = max(ans, b)\nprint(ans)\n', 'import math\nn, m = map(int, input().split())\nroot_m = int(math.sqrt(m))\nans = 1\nfor a in range(1, root_m):\n # print(a, ans)\n if m % a == 0:\n b = m // a\n if a * n <= m:\n ans = max(ans, a)\n if b * n <= m:\n ans = max(ans, b)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s628684155', 's782430409'] | [3060.0, 3060.0] | [42.0, 21.0] | [247, 281] |
p03241 | u936985471 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m=map(int,input().split())\nans=0\nimport math\nfor i in range(1,min(m//n+1,int(math.sqrt(m))+1):\n if m%i==0:\n ans=max(i,ans)\nprint(ans)\n', 'import sys\nreadline = sys.stdin.readline\n\nN,M = map(int,readline().split())\n\n\n\nans = 0\nfor i in range(1,int(M ** 0.5) + 1):\n if M % i == 0:\n p = M // i\n if i >= N:\n if ans < p:\n ans = p\n if p >= N:\n if ans < i:\n ans = i\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s809652140', 's352486351'] | [2940.0, 3060.0] | [18.0, 21.0] | [140, 328] |
p03241 | u940102677 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m = map(int,input())\nwhile n <= m:\n if m%n == 0:\n print(m%n)\n break\n n += 1', 'n,m = map(int,input())\nwhile n <= m:\n if m%n == 0:\n print(m%n)\n n += 1\nbreak', 'n,m = map(int, input().split())\nif n*n <= m:\n k = n\n while k*k <= m:\n if m%k == 0:\n print(m//k)\n exit()\n k += 1\nelse:\n n = m//n\n\nk = n\nwhile True:\n if m%k == 0:\n print(k)\n exit()\n k -= 1'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s498666632', 's980679841', 's105390259'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 24.0] | [85, 81, 213] |
p03241 | u941753895 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef I(): return int(sys.stdin.readline())\ndef F(): return float(sys.stdin.readline())\ndef LS(): return sys.stdin.readline().split()\ndef S(): return input()\n\ndef main():\n n,m=LI()\n ans=1\n if n==1:\n return m\n for i in range(1,int(math.sqrt(m)+1)):\n if m%i==0:\n if i*n>m:\n continue\n x=m-i*n\n if x%i==0:\n ans=max(ans,i+x//n)\n\n return ans\n\n# main()\nprint(main())\n', 'import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef I(): return int(sys.stdin.readline())\ndef F(): return float(sys.stdin.readline())\ndef LS(): return sys.stdin.readline().split()\ndef S(): return input()\n\ndef main():\n n,m=LI()\n ans=1\n if n==1:\n return m\n for i in range(1,int(math.sqrt(m)+1)):\n if m%i==0:\n if i*n>m:\n continue\n x=m-i*n\n if x%i==0:\n ans=max(ans,i+x//i)\n\n return ans\n\n# main()\nprint(main())\n', 'import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LF(): return [float(x) for x in sys.stdin.readline().split()]\ndef I(): return int(sys.stdin.readline())\ndef F(): return float(sys.stdin.readline())\ndef LS(): return sys.stdin.readline().split()\ndef S(): return input()\n\ndef main():\n n,m=LI()\n ans=1\n if n==1:\n return m\n for i in range(1,int(math.sqrt(m)+1)):\n if m%i==0:\n if i*n>m:\n continue\n ans=max(ans,i)\n x=m//i\n if x*n>m:\n continue\n ans=max(ans,x)\n\n return ans\n\n# main()\nprint(main())\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s000857217', 's502029705', 's156906044'] | [5168.0, 5168.0, 5424.0] | [40.0, 40.0, 44.0] | [745, 745, 774] |
p03241 | u945181840 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N, M = map(int, input().split())\n\nfor i in reversed(range(1, N + 1)):\n if M % i == 0:\n N = i\n break\n\nprint(M // N)', 'from bisect import bisect_right\nN, M = map(int, input().split())\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n divisors.sort()\n return divisors\n\n\ndivisors = make_divisors(M)\nprint(divisors[bisect_right(divisors, M // N) - 1])'] | ['Wrong Answer', 'Accepted'] | ['s062163001', 's941163925'] | [2940.0, 3060.0] | [28.0, 21.0] | [131, 387] |
p03241 | u952708174 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N, M = [int(i) for i in input().split()]\nif N==M:\n print(1)\nelse:\n a = 0\n for i in range(2,M):\n if M%i==0:\n a = i\n print(a)', 'def d_partition(N, M):\n if N == 1:\n return M \n\n def divisor_list(n):\n \n ret = []\n for k in range(1, int(n**0.5) + 1):\n if n % k == 0:\n ret.extend([k, n // k])\n ret.sort()\n return ret\n\n divisor_m = divisor_list(M)\n ans = -1\n for d in divisor_m:\n if d <= M // N:\n ans = d\n else:\n break\n return ans\n\nsys.stdin = io.StringIO(textwrap.dedent(INPUT).strip())\nN, M = [int(i) for i in input().split()]\nprint(d_partition(N, M))', 'def d_partition(N, M):\n def divisor_list(n):\n \n ret = []\n for k in range(1, int(n**0.5) + 1):\n if n % k == 0:\n ret.append(k)\n if k != n // k:\n ret.append(n // k)\n return sorted(ret)\n \n return max([d for d in divisor_list(M) if d <= M // N]) if N >= 2 else M\n\nN, M = [int(i) for i in input().split()]\nprint(d_partition(N, M))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s068169301', 's536480009', 's727077913'] | [2940.0, 3064.0, 3060.0] | [2104.0, 17.0, 21.0] | [135, 627, 509] |
p03241 | u969190727 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n,m=map(int,input().split())\nans=1\nfor i in range(1,m**0.5+1):\n if m%i==0:\n if i>=n:\n ans=max(ans,m//i)\n elif m//i>=n:\n ans=max(ans,i)\nprint(ans)', 'n,m=map(int,input().split())\nans=1\nfor i in range(1,int(m**0.5)+1):\n if m%i==0:\n if i>=n:\n ans=max(ans,m//i)\n elif m//i>=n:\n ans=max(ans,i)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s774745751', 's750370040'] | [3064.0, 3060.0] | [26.0, 21.0] | [162, 167] |
p03241 | u970197315 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['# AGC112 D - Partition\nfrom math import floor\nfrom fractions import gcd\nn,m=map(int,input().split())\nif m%n==0:\n print(m//n)\n exit()\n\nn_max=floor(m/n)\nans=0\nfor i in range(n_max,0,-1):\n if i%n==0:\n q=m//i\n r=m%i\n ans=gcd(q,q+r)\n print(ans)\n exit()\n', '# AGC112 D - Partition\nfrom math import floor\ndef divisor(n): \n i = 1\n table = []\n while i * i <= n:\n if n%i == 0:\n table.append(i)\n table.append(n//i)\n i += 1\n table = list(set(table))\n return table\n\n\nn,m=map(int,input().split())\n\nn_max=floor(m/n)\ndiv_m=divisor(m)\ndiv_m.sort(reverse=True)\nans=0\nfor i in div_m:\n if i<=n_max:\n ans=m//i\n print(ans)\n exit()\n', '# AGC112 D - Partition\nfrom math import floor\nfrom fractions import gcd\ndef divisor(n): \n \n i = 1\n table = []\n while i * i <= n:\n if n%i == 0:\n table.append(i)\n table.append(n//i)\n i += 1\n table = list(set(table))\n return table\n\n\nn,m=map(int,input().split())\nif m%n==0:\n print(m//n)\n exit()\n\nn_max=floor(m/n)\ndiv_m=divisor(m)\nans=0\nfor i in range(1,int(m**0.5)+1):\n if i%n==0 and i//n in div_m:\n q=m//i\n r=m%i\n ans=gcd(q,q+r)\n print(ans)\n exit()\n', 'def create_divisors(n):\n divisors=[]\n for i in range(1,int(n**0.5)+1):\n if n%i==0:\n divisors.append(i)\n if i!=n//i:\n divisors.append(n//i)\n divisors.sort(reverse=True)\n return divisors\n\nfrom math import floor\nn,m=map(int,input().split())\nn_max=floor(m/n)\nd=create_divisors(m)\nfor di in d:\n if di<=n_max:\n print(di)\n exit(0)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s228988397', 's319261394', 's805759730', 's382019705'] | [5044.0, 3064.0, 5688.0, 3064.0] | [37.0, 23.0, 53.0, 20.0] | [292, 432, 741, 354] |
p03241 | u970308980 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N, M = map(int, input().split())\n\nfor i in reversed(range(1, int(N**0.5)+1)):\n if M % i == 0:\n if N * i <= M:\n print(i)\n exit()\n', 'N, M = map(int, input().split())\n\nans = 1\nfor i in range(1, int(M**0.5)+1):\n if M % i != 0:\n continue\n\n j = M // i\n if i * N <= M:\n ans = max(ans, i)\n if j * N <= M:\n ans = max(ans, j)\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s539936003', 's708501324'] | [2940.0, 3060.0] | [21.0, 22.0] | [160, 230] |
p03241 | u977389981 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['n, m = map(int, input().split())\na = m // n\nans = 0\n\nfor i in range(1, a + 1):\n if m % i == 0:\n if (m // i) > i and (m // i) <= a:\n ans = m // i\n break\n \nprint(ans)', 'N, M = map(int,input().split())\na = M // N\nx = 1\n\nfor i in range(1, a + 1):\n if M % i == 0:\n x = i\n\nprint(i)', 'N, M = map(int, input().split())\n\nif M % N == 0:\n ans = M // N\nelse:\n ans = 0\n for i in range(1, int(M ** 0.5) + 1):\n if M % i == 0:\n if i <= M // N:\n ans = max(ans, i)\n if M // i <= M // N:\n ans = max(ans, M // i)\n \nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s031393290', 's973186826', 's224489839'] | [3060.0, 2940.0, 3064.0] | [38.0, 2104.0, 21.0] | [201, 118, 302] |
p03241 | u978313283 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N,M=map(int,input().split())\na=M//N\nx=0\n for i in reversed(range(2,a+1)):\n if M%i==0:\n x=i\n break\nprint(x)', 'N,M=map(int,input().split())\na=M//N\nx=1\nprint(a)\nfor i in range(2,a+1):\n if M%i==0:\n x=i\n if (M//i)>i and (M//i)<=a:\n x=M//i\n break\nprint(x)\n', 'N,M=map(int,input().split())\na=M//N\nx=1\nfor i in range(1,a+1):\n if M%i==0:\n x=i\n if (M//i)>i and (M//i)<=a:\n x=M//i\n break\nprint(x)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s032013460', 's249243547', 's619717477'] | [2940.0, 3060.0, 2940.0] | [18.0, 39.0, 39.0] | [120, 180, 171] |
p03241 | u981931040 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['def make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n \n return divisors\nN , M = map(int,input().split())\ndivisors_list = make_divisors(M)\ndivisors_list.sort(reverse=True)\nprint(divisors_list)\nfor val in divisors_list:\n if val * N <= M:\n break\nprint(val)', 'N, M = map(int, input().split())\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n\n \n return divisors\n\nans = 1\nfor i in make_divisors(M):\n work1 = i * N\n work2 = M - work1\n if work2 >= 0 and work2 % i == 0:\n ans = max(i, ans)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s954577674', 's062472720'] | [3188.0, 9396.0] | [20.0, 33.0] | [432, 451] |
p03241 | u983918956 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N,M = map(int,input().split())\nif M % N == 0:\n print(M // N)\n exit()\nfor i in range(N,0,-1):\n if M % i == 0:\n print(i)', '# N, D, K = map(int,input().split())\n# LR = [list(map(int,input().split())) for _ in range(D)]\n# ST = [list(map(int,input().split())) for _ in range(K)]\n\nfrom math import floor\n\n# n = 24 -> [1,2,3,4,6,8,12,24]\ndef divisor(n):\n left = [1]\n right = [n]\n sup = floor(pow(n,1/2))\n for p in range(2,sup+1):\n if n % p == 0:\n if p == n//p:\n left.append(p)\n continue\n left.append(p)\n right.append(n//p)\n res = left + right[::-1]\n return res\n\nN, M = map(int,input().split())\ncand = divisor(M)\nans = 1\nfor ch in cand:\n if M // ch >= N:\n ans = max(ans, ch)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s847249614', 's245553907'] | [3060.0, 3188.0] | [31.0, 20.0] | [134, 689] |
p03241 | u984276646 | 2,000 | 1,048,576 | You are given integers N and M. Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N. | ['N, M = map(int, input().split())\nS = 1\np = 0\nX = []\nfor i in range(2, int(M ** (1/2)) + 1):\n if M % i == 0:\n if i <= M // N:\n p = i\n X.append(i)\n else:\n break\nif M // N <= int(M ** (1/2)):\n if p != 0:\n S = p\nelse:\n if p != 0:\n for i in range(len(X)):\n if M % X[i] == 0 and X[i] >= N:\n S = M // X[i]\n break\nprint(S)', 'N, M = map(int, input().split())\nS = 1\np = 0\nX = []\nfor i in range(2, int(M ** (1/2)) + 1):\n if M % i == 0:\n if i <= M // N:\n p = i\n X.append(i)\n else:\n break\nif M // N <= int(M ** (1/2)):\n if p != 0:\n S = p\nelse:\n if p != 0:\n S = M\n q = 0\n while S > M // N:\n S = M // X[q]\n if S <= M // N:\n break\n q += 1\n if q == len(X):\n break\n if q == len(X):\n S = max(X)\nprint(S)'] | ['Wrong Answer', 'Accepted'] | ['s071851128', 's189584264'] | [3064.0, 3064.0] | [22.0, 22.0] | [363, 445] |
p03242 | u000212387 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["n = input()\nfor i in range(len(n)):\n if n[i] == '1':\n n[i]='9'\n else:\n n[i]='1'\n print(n)\n \n", "a=list(input())\nfor i in range(len(a)):\n if a[i]=='1':\n a[i]='9'\n else:\n a[i]='1'\nprint(''.join(a))"] | ['Runtime Error', 'Accepted'] | ['s368480973', 's499308149'] | [2940.0, 2940.0] | [17.0, 18.0] | [126, 119] |
p03242 | u002459665 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['import collections\n\nnum = int(input())\nvalues = [int(i) for i in input().split()]\n\nodd = [] \neven = [] # gusu\n\nfor n, i in enumerate(values):\n if (n + 1) % 2 == 0:\n even.append(i)\n else:\n odd.append(i)\n\nodd_counts = collections.Counter(odd)\neven_counts = collections.Counter(even)\n\n# print(odd_counts.most_common())\n# print(even_counts.most_common())\n\nodd_most_common = odd_counts.most_common()\neven_most_common = even_counts.most_common()\n\nhalf_num = int(num / 2)\n\nif odd_most_common[0][0] != even_most_common[0][0]:\n odd_replace_num = half_num - odd_most_common[0][1]\n even_replace_num = half_num - even_most_common[0][1]\n print(odd_replace_num + even_replace_num)\nelse:\n answers = []\n odd_replace_num = half_num - odd_most_common[0][1]\n if len(even_most_common) == 1:\n even_replace_num = half_num\n else:\n even_replace_num = half_num - even_most_common[1][1]\n answers.append(odd_replace_num + even_replace_num)\n\n if len(odd_most_common) == 1:\n odd_replace_num = half_num\n else:\n odd_replace_num = half_num - odd_most_common[1][1]\n even_replace_num = half_num - even_most_common[0][1]\n answers.append(odd_replace_num + even_replace_num)\n\n print(min(answers))\n', 'n = input()\nprint(n.replace("1", "x").replace("9", "1").replace("x", "9"))\n'] | ['Runtime Error', 'Accepted'] | ['s160973576', 's438552172'] | [3444.0, 2940.0] | [24.0, 17.0] | [1256, 75] |
p03242 | u003501233 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n=str(input())\nprint(n.replace("1","9").replace("9","1"))\n', 'n=int(input())\nprint(n.replace("1","9").replace("9","1").replace("1","a").replace("9","a"))\n', 'print(input().replace("1","").replace("9","1").replace("","9"))\n', 'n=int(input())\nprint(n.replace("1","9").replace("9","1").replace("1","1").replace("9","9"))\n', 'n=int(input())\nprint(n.replace("1","9").replace("9","1"))\n', 'n=int(input())\nl = [int(x) for x in list(str(n))]\nprint(l.replace("1","9").replace("9","1"))\n', 'n=input()\nl = [int(x) for x in list(str(n))]\nprint(l.replace("1","9").replace("9","1"))\n', 'n=input()\nprint(n.replace("1","9").replace("9","1"))\n', 'n=input()\nprint(n.replace("1","").replace("9","1").replace("","9"))\n', 'n=str(input())\nprint(n.replace("1","9").replace("9","1").replace("1","a").replace("9","a"))\n', 'n=int(input())\nprint(n.replace("1","9").replace("9","1"))\n', 'n=str(input())\nprint(n.replace("1","9").replace("9","1"))\n', 'print(input().replace("1","*").replace("9","1").replace("*","9"))\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s085004035', 's246732792', 's273349847', 's298086388', 's339396779', 's497089116', 's497463669', 's530450956', 's602341044', 's712611456', 's846200569', 's909618882', 's993916490'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 18.0, 17.0, 17.0, 17.0, 17.0, 20.0, 17.0, 17.0, 17.0] | [58, 92, 64, 92, 58, 93, 88, 53, 68, 92, 58, 58, 66] |
p03242 | u013756322 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["print(input().replace('1', '9').replace('9', '1'))", "print(input().replace('1', 'o').replace('9', 'n').replace('o', '1'))\n", "print(input().replace('1', 'o').replace('9', '1').replace('o', '1'))\n", "print(input().replace('1', 'o').replace('9', '1').replace('o', '9'))\n"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s276324151', 's962042559', 's998603633', 's489883040'] | [2940.0, 2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0, 18.0] | [50, 69, 69, 69] |
p03242 | u018916376 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['print 1110 - input', 'print(1110-int(input()))'] | ['Runtime Error', 'Accepted'] | ['s845764912', 's108830899'] | [2940.0, 2940.0] | [17.0, 17.0] | [18, 24] |
p03242 | u026075806 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['def chg(n):\n if n==1:\n return 9\n elif n==9:\n return 1\n return n\n\nn = int(input())\nn,a1 = divmod(n,10)\nn,a2 = divmod(n,10)\nn,a3 = divmod(n,10)\n\nprint(a3,a2,a1)\nprint(100*chg(a3)+10*chg(a2)+chg(a1))', 'def chg(n):\n if n==1:\n return 9\n elif n==9:\n return 1\n return n\n\nn = int(input())\nn,a1 = divmod(n,10)\nn,a2 = divmod(n,10)\nn,a3 = divmod(n,10)\n\n\nprint(100*chg(a3)+10*chg(a2)+chg(a1))'] | ['Wrong Answer', 'Accepted'] | ['s337044650', 's296003907'] | [3064.0, 3060.0] | [19.0, 17.0] | [205, 190] |
p03242 | u030726788 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["n = input()\nfor i in range(len(n)):\n if(n[i] == '1'):n[i] = '9'\n elif(n[i] == '9'):n[i] = '1'\nprint(n)", "n = list(input())\nfor i in range(len(n)):\n if(n[i] == '1'):n[i] = '9'\n elif(n[i] == '9'):n[i] = '1'\nprint(''.join(n))\n"] | ['Runtime Error', 'Accepted'] | ['s874990377', 's137420720'] | [2940.0, 2940.0] | [18.0, 17.0] | [108, 124] |
p03242 | u033524082 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n = input()\nif n[0]=1:\n n[0]=9\nelse:\n n[0]=1\nif n[1]=1:\n n[1]=9\nelse:\n n[1]=1\nif n[2]=1:\n n[2]=9\nelse:\n n[2]=1\n\nprint(n)', 'n = input()\na = ""\nfor i in range(len(a)):\n if n[i]=="1":\n a +="9"\n else:\n a +="1"\nprint(a)', 'n = input()\na = ""\nfor i in range(len(n)):\n if n[i]=="1":\n a +="9"\n else:\n a +="1"\nprint(a)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s683891146', 's958590279', 's554731446'] | [2940.0, 3060.0, 2940.0] | [18.0, 20.0, 18.0] | [126, 99, 100] |
p03242 | u037221289 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["import collections\nN = int(input())\nV = input().split(' ')\n\nEVEN = V[0::2]\nODD = V[1::2]\nEVEN_V = collections.Counter(EVEN)\nODD_V = collections.Counter(ODD)\nif N == 2:\n print(0)\nA = len(EVEN_V)\nB = len(ODD_V)\n\n\nif EVEN_V.most_common()[0][1] >= ODD_V.most_common()[0][1]:\n MAX_ELE = EVEN_V.most_common()[0][0]\n count_max =EVEN_V.most_common()[0][1]\n for i in range(B):\n if MAX_ELE != ODD_V.most_common()[i][0]:\n SECOND_ELE = ODD_V.most_common()[i][0]\n count_SEC = ODD_V.most_common()[i][1]\n break\n else:\n count_SEC = N/2\n \nelse:\n MAX_ELE = ODD_V.most_common()[0][0]\n count_max = ODD_V.most_common()[0][1]\n for i in range(A):\n if MAX_ELE != EVEN_V.most_common()[i][0]:\n SECOND_ELE =EVEN_V.most_common()[i][0]\n count_SEC = EVEN_V.most_common()[i][1]\n break\n else:\n count_SEC = N/2\nprint((N- int(count_max) - int(count_SEC)))\n", "N = str(input())\n\ndef reverse(N):\n Answer = ''\n for x in N:\n if x == '1':\n Answer += '9'\n else:\n Answer += '1'\n return Answer\nprint(reverse(N))\n "] | ['Runtime Error', 'Accepted'] | ['s326870834', 's725185003'] | [3316.0, 2940.0] | [21.0, 17.0] | [882, 169] |
p03242 | u037430802 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['s = input()\n\n\nfor i in range(len(s)):\n if s[i] == "1":\n s[i] = "9"\n else:\n s[i] = "1"\n \nprint(s)', 's = input()\n\nans = ""\nfor i in range(len(s)):\n if s[i] == "1":\n ans += "9"\n else:\n ans += "1"\n \nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s165587015', 's968999998'] | [2940.0, 2940.0] | [17.0, 18.0] | [107, 118] |
p03242 | u045408189 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["n=input()\nprint(n.replace('1','9').replace('9','1'))", "n=input()\nprint(n.replace('1','p').replace('9','1').replace('p','9'))\n"] | ['Wrong Answer', 'Accepted'] | ['s765984919', 's455609463'] | [2940.0, 2940.0] | [17.0, 18.0] | [52, 70] |
p03242 | u050708958 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["s = input()\nprint(s.replace('1', '').replace('9', '1') + s.replace('9', '').replace('1', '9'))", "s = input()\nprint(s.replace('9', '1') + s.replace('1', '9'))", "print(*['9' if i == '1' else '1' for i in input()], sep='')"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s617919571', 's749354142', 's472177295'] | [2940.0, 2940.0, 2940.0] | [17.0, 19.0, 17.0] | [94, 60, 59] |
p03242 | u057415180 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["n = input()\nfor i in range(3):\n if n[i] == '1':\n n[i] = '9'\n elif n[i] == '9':\n n[i] = '1'\nprint(n)", "n = input()\nfor i in range(3):\n if n[i] == '1':\n n.replace(n[i], '9')\n elif n[i] == '9':\n n.replace(n[i], '1')\nprint(n)", "n = input()\nprint(n.replace('1', 'a').replace('9','1').replace('a', '9'))"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s811841256', 's904043836', 's389254806'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [119, 139, 73] |
p03242 | u058592821 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['print(1100-int(input()))', 'print(1110-int(input()))'] | ['Wrong Answer', 'Accepted'] | ['s407132236', 's606237056'] | [2940.0, 2940.0] | [17.0, 17.0] | [24, 24] |
p03242 | u058763808 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n = int(input())\nv = [int(_) for _ in input().split()]\ncnt = 0\nfor i in range(2, n):\n if v[i-2] != v[i]:\n cnt += 1\nprint(cnt)', 'N = int(input())\nprint(1110-N)'] | ['Runtime Error', 'Accepted'] | ['s116963325', 's487955979'] | [2940.0, 3316.0] | [17.0, 19.0] | [129, 30] |
p03242 | u059210959 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['#encoding utf-8\nfrom collections import Counter\ndef main(n,v):\n odd = Counter(v[0::2]).most_common(2) + [(0,0)]\n even = Counter(v[1::2]).most_common(2) + [(0,0)]\n\n if odd[0][0] == even[0][0]:\n ans = min(n-odd[0][1]-even[1][1],\n n-odd[1][1]-even[0][1])\n else:\n ans = n-odd[0][1]-even[0][1]\n print(ans)\n\n\nif __name__ == "__main__":\n n = int(input())\n v = list(int(i) for i in input().split())\n main(n,v)', '#encoding utf-8\n\nn = list(str(input()))\n\nfor i in range(len(n)):\n if n[i] == "1":\n n[i] = "to9"\n if n[i] == "9":\n n[i] = "to1"\n\nfor i in range(len(n)):\n if n[i] == "to9":\n n[i] = "9"\n elif n[i] == "to1":\n n[i] = "1"\n\nprint("".join(n))\n'] | ['Runtime Error', 'Accepted'] | ['s628101064', 's838978006'] | [3316.0, 3060.0] | [21.0, 17.0] | [446, 275] |
p03242 | u060392346 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n = input()\nr = [10 - int(n[i]) for i in range(n)]\nprint("".join(map(str, r)))\n\n', 'n = input()\nr = [10 - int(n[i]) for i in range(3)]\nprint("".join(map(str, r)))\n\n'] | ['Runtime Error', 'Accepted'] | ['s603519181', 's063355096'] | [2940.0, 2940.0] | [18.0, 18.0] | [80, 80] |
p03242 | u060588488 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n=int(input())\nif n%111==0:\n print(n)\nelse:\n print( ((n//111)+1)*111 ) \n', 'n=list(input())\ns=""\nfor i in range(len(n)):\n if n[i]=="1":\n n[i]="9"\n else:\n n[i]="1"\n s=s+n[i]\nprint(s)\n'] | ['Wrong Answer', 'Accepted'] | ['s337001470', 's005973805'] | [2940.0, 2940.0] | [17.0, 17.0] | [78, 129] |
p03242 | u066017048 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['import collections\n \nn = int(input())\nvs = [int(i) for i in input().split()]\nevens = []\nodds = []\nfor i,num in enumerate(vs):\n if i % 2 == 0:\n evens.append(num)\n elif i % 2 == 1:\n odds.append(num)\n \ndef plana():\n if (len(set(vs)) == 2) and (len(set(evens)) == 1) and (len(set(odds)) == 1):\n return 0\n elif (len(set(vs)) == 1):\n return len(evens)\n return 0\n ec = collections.Counter(evens)\n oc = collections.Counter(odds)\n \n count = 0\n count += (len(evens) - ec.most_common()[0][1])\n count += (len(odds) - oc.most_common()[0][1])\n return count\n \n# if len(set(vs)) == 1:\n# print(int(len(vs)/2))\n# elif (len(set(evens)) == 1) and (len(set(odds)) == 1):\n# print(0)\n# else:\nprint(int(plana()))', 'import collections\n\nn = int(input())\nvs = [int(i) for i in input().split()]\nevens = []\nodds = []\nfor i,num in enumerate(vs):\n if i % 2 == 0:\n evens.append(num)\n elif i % 2 == 1:\n odds.append(num)\n\ndef plana():\n if (len(set(vs)) == 2) and (len(set(evens)) == 1) and (len(set(odds)) == 1):\n return 0\n elif (len(set(vs)) == 1):\n return len(evens)\n ec = collections.Counter(evens)\n oc = collections.Counter(odds)\n\n count = 0\n count += (len(evens) - ec.most_common()[0][1])\n count += (len(odds) - oc.most_common()[0][1])\n return count\n\n# if len(set(vs)) == 1:\n# print(int(len(vs)/2))\n# elif (len(set(evens)) == 1) and (len(set(odds)) == 1):\n# print(0)\n# else:\nprint(len(odds))\n\n', 'inums = input()\n\nnums = []\nfor i in inums:\n nums.append(int(i))\no = []\nfor n in nums:\n if n == 1:\n o.append("9")\n elif n==9:\n o.append("1")\n else:\n o.append(str(n))\nprint("".join(o))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s036083770', 's181575211', 's275441550'] | [3316.0, 3316.0, 2940.0] | [21.0, 21.0, 17.0] | [757, 739, 250] |
p03242 | u071061942 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n = input()\nif int(n) < int(n[0]) * 111:\n print(int(n[0]) * 111)\nelse:\n print((int(n[0]) + 1) * 111)', 'n = input()\nans = ""\nfor i in n:\n if i == "1":\n ans += "9"\n elif i == "9":\n ans += "1"\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s299334327', 's562576069'] | [3060.0, 2940.0] | [19.0, 18.0] | [102, 105] |
p03242 | u072717685 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["s = input()\nr = 0\nif s[0] == '1':\n r += 900\nelse:\n r += 100\nif s[1] == '1':\n r += 90\nelse:\n r += 10 \nif s[2] == '1':\n r += 9\nelse:\n r += 1 ", "s = input().split()\nr = 0\nif s[0] == '1':\n r += 900\nelse:\n r += 100\nif s[1] == '1':\n r += 90\nelse:\n r += 10 \nif s[2] == '1':\n r += 9\nelse:\n r += 1 \n\nprint(r)", "s = input()\nr = 0\nif s[0] == '1':\n r += 900\nelse:\n r += 100\nif s[1] == '1':\n r += 90\nelse:\n r += 10 \nif s[2] == '1':\n r += 9\nelse:\n r += 1 \nprint(r)"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s292264010', 's548478847', 's173377907'] | [2940.0, 3068.0, 2940.0] | [17.0, 17.0, 17.0] | [145, 163, 154] |
p03242 | u081472919 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n = int(input())\ns = str(n)\na = list(map(int,s))\nfor i in range(0,2):\n if a[i] == 1:\n a[i] = 9\n elif a[i] == 9:\n a[i] = 1\n\nprint(a[0]*100+a[1]*10+a[2])', "n = input()\na = ''\nfor i in range(len(n)):\n if n[i] == '1':\n a += '9'\n elif n[i] == '9':\n a += '1'\n \nprint(a)"] | ['Wrong Answer', 'Accepted'] | ['s004235364', 's272896838'] | [9124.0, 8876.0] | [25.0, 28.0] | [171, 136] |
p03242 | u084320347 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['s = input()\nn = ""\nfor i in s:\n if i == "9":\n n+=1\n else:\n n+=9\nprint(n)', 's = input()\nn = ""\nfor i in s:\n if i == "9":\n n+="1"\n else:\n n+="9"\nprint(n)\n'] | ['Runtime Error', 'Accepted'] | ['s758993525', 's695769330'] | [2940.0, 2940.0] | [17.0, 17.0] | [80, 85] |
p03242 | u088020258 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n = input()\nans = ""\n\tfor c in n:\n\t\tif c == "1":\n ans += "9"\n elif c == "9":\n ans += "1"\n else:\n ans += c\nprint(ans)', ' n = input()\n ans = ""\n for c in n:\n if c == "1":\n ans += "9"\n elif c == "9":\n ans += "1"\n else:\n ans += c\n print(ans)', 'S = input()\n\nans = ""\n\nfor i in S:\n if i == "1":\n ans += "9"\n else:\n ans += "1"\n\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s406548368', 's976735795', 's663947783'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [163, 184, 100] |
p03242 | u089376182 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["print(input().replace('1', 'temp').replace('9', '1').replace('temp', '1'))", "n = input()\nans = n.replace('1', '2').replace('9', '1').replace('2', '9')\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s642820970', 's531348702'] | [2940.0, 2940.0] | [17.0, 17.0] | [74, 84] |
p03242 | u092460072 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['print(1100-int(input())', 'print(1100-int(input()))', 'print(1110-int(input()))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s943663105', 's993491037', 's613389197'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [23, 24, 24] |
p03242 | u093033848 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['narray = list(input())\n\nsuuji = ""\nfor i in narray:\n if i == "3":\n i = "9"\n elif i == "9":\n i = "3"\n suuji += i\nprint(suuji)', 'narray = list(input())\n\nsuuji = ""\nfor i in narray:\n if i == "3":\n i = "9"\n elif i == "9":\n i = "3"\n suuji += i\nprint(int(suuji))\n', 'narray = list(input())\n\nsuuji = ""\nfor i in narray:\n if i == "1":\n i = "9"\n elif i == "9":\n i = "1"\n suuji += i\nprint(suuji)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s084887143', 's645395790', 's898758717'] | [2940.0, 2940.0, 2940.0] | [18.0, 17.0, 18.0] | [147, 153, 147] |
p03242 | u094815239 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['from collections import Counter\nn = int(input().strip())\na = list(map(int, input().strip().split()))\n\nc1 = Counter(a[::2])\nc2 = Counter(a[1::2])\nc1f1 = max(c1, key = lambda k:c1[k])\nc2f1 = max(c2, key = lambda k:c2[k])\n\nif c1f1 != c2f1:\n return n - c1[c1f1] - c2[c2f1]\nelse:\n if c1[c1f1] > c2[c2f1]:\n del c2[c2f1]\n if not c2: return n-c1[c1f1]\n c2f1 = max(c2, key = lambda k:c2[k])\n return n-c1[c1f1] - c2[c2f1]\n else:\n del c1[c1f1]\n if not c1: return n-c2[c2f1]\n c1f1 = max(c1, key = lambda k:c1[k])\n return n-c1[c1f1] - c2[c2f1]', "s = input()\nfor c in s:\n if c == '1': print('9', end='')\n elif c == '9': print('1', end='')\n\nprint()"] | ['Runtime Error', 'Accepted'] | ['s944617995', 's180272707'] | [3064.0, 2940.0] | [18.0, 17.0] | [557, 102] |
p03242 | u095426154 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['import sys\nn=int(input())\narr=input().split(" ")\narr_s=set(arr)\nif len(arr_s)==1:\n print(int(n/2))\n sys.exit()\n#print(arr)\na=0\nmost_e=0\nmost_o=0\narr_e=[0 for i in range(int(n/2))]\narr_o=[0 for i in range(int(n/2))]\nfor i in range(int(n/2)):\n arr_e[i]=arr[a]\n arr_o[i]=arr[a+1]\n a+=2\n#print(arr_e,arr_o)\narr_es=set(arr_e)\narr_os=set(arr_o)\n#print(arr_es,arr_os)\n\nfor i in arr_es:\n cnt_e=arr_e.count(i)\n if cnt_e>most_e:\n most_e=cnt_e\n \nfor i in arr_os:\n cnt_o=arr_o.count(i)\n if cnt_o>most_o:\n most_o=cnt_o\n\n#print(most_e,most_o)\nelse:\n print(n-most_e-most_o)', 'n=int(input())\narr=input().split(" ")\narr_s=set(arr)\n#print(arr)\na=0\nmost_e=0\nmost_o=0\narr_e=[0 for i in range(int(n/2))]\narr_o=[0 for i in range(int(n/2))]\nfor i in range(int(n/2)):\n arr_e[i]=arr[a]\n arr_o[i]=arr[a+1]\n a+=2\n#print(arr_e,arr_o)\narr_es=set(arr_e)\narr_os=set(arr_o)\n#print(arr_es,arr_os)\n\nfor i in arr_es:\n cnt_e=arr_e.count(i)\n if cnt_e>most_e:\n most_e=cnt_e\n if cnt_e>=n/4:\n break\n \nfor i in arr_os:\n cnt_o=arr_o.count(i)\n if cnt_o>most_o:\n most_o=cnt_o\n if cnt_o>=n/4:\n break\n\n#print(most_e,most_o)\nif len(arr_s)==1:\n print(int(n/2))\nelse:\n print(n-most_e-most_o)', 'import collections\nn=int(input())\narr=input().split(" ")\narr_s=set(arr)\na=0\narr_e=[0 for i in range(int(n/2))]\narr_o=[0 for i in range(int(n/2))]\nfor i in range(int(n/2)):\n arr_e[i]=arr[a]\n arr_o[i]=arr[a+1]\n a+=2\nce=collections.Counter(arr_e).most_common()\nco=collections.Counter(arr_o).most_common()\nif len(arr_s)==1:\n print(int(n/2))\nelse:\n if ce[0][0]!=co[0][0]:\n print(n-ce[0][1]-co[0][1])\n else:\n print(n-max(ce[0][1]+co[1][1],ce[1][1]+co[0][1]))', 'num=input()\nnum_str=list(num)\nlengh=len(num_str)\ntmp=num_str\nfor i in range(lengh):\n if num_str[i]=="1":\n tmp[i]="9"\n elif num_str[i]=="9":\n tmp[i]="1"\nans="".join(tmp)\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s055394257', 's097998098', 's913092801', 's131921035'] | [3064.0, 3064.0, 3316.0, 3060.0] | [17.0, 18.0, 21.0, 18.0] | [609, 665, 484, 199] |
p03242 | u102242691 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['\nn = input()\nans = ""\n\nfor i in range(n):\n if n[i] == 1:\n ans += "9"\n else:\n ans += "1"\nprint(int(ans))\n', '\nn = input()\nans = ""\n\nfor i in range(len(n)):\n if n[i] == "1":\n ans += "9"\n else:\n ans += "1"\nprint(int(ans))\n'] | ['Runtime Error', 'Accepted'] | ['s418217784', 's224353357'] | [2940.0, 2940.0] | [17.0, 17.0] | [124, 131] |
p03242 | u102960641 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['print(1100-int((input()))', 'n = int(input())\na = [111,222,333,444,555,666,777,888,999]\nb = 0\nfor i in a:\n if i >= n:\n b = i\n break\nprint(b)', 'print(1100-int((input()))', 'print(1100-int(input()))', 'print(1110-int(input()))'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s110612353', 's794022399', 's859701395', 's900048994', 's862717120'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [16.0, 17.0, 17.0, 17.0, 17.0] | [25, 118, 25, 24, 24] |
p03242 | u106103668 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['print(input().replace(1,0).replace(9,1).replace(0,9))', "print(str(input()).replace('1','0').replace('9','1').replace('0','9'))"] | ['Runtime Error', 'Accepted'] | ['s614720397', 's521718138'] | [2940.0, 2940.0] | [17.0, 17.0] | [53, 70] |
p03242 | u106297876 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["c=list(input())\nans=str()\nfor i in range(len(c)):\n if c[i]=='9':\n c[i]='1'\n ans+=c[i]\nprint(int(ans))", "c=list(input())\nans=str()\nans=str()\nfor i in range(len(c)):\n if c[i]=='9':\n c[i]='1'\n else:\n c[i]='9'\n \n ans+=c[i]\n \nprint(int(ans))"] | ['Wrong Answer', 'Accepted'] | ['s265601353', 's454480369'] | [2940.0, 2940.0] | [18.0, 18.0] | [114, 165] |
p03242 | u107091170 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["S=input()\nfor i in range(3):\n if S[i]=='1':\n S[i] = '9'\n elif S[i]=='9':\n S[i] = '1'\nprint(S)\n ", 'S=input()\nS = S.replace("1", "Z")\nS = S.replace("9", "1")\nS = S.replace("Z", "9")\nprint(S)\n'] | ['Runtime Error', 'Accepted'] | ['s937090640', 's866934486'] | [2940.0, 2940.0] | [17.0, 17.0] | [106, 91] |
p03242 | u108990937 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["import collections\nn=int(input())\nv=[int(i) for i in input().split(' ')]\n\nv_odd = v[1::2]\nv_even = v[0::2]\n\nvo = collections.Counter(v_odd).most_common()\nve = collections.Counter(v_even).most_common()\n\n\nif vo[0][0] == ve[0][0]:\n \n if vo[0][1] > ve[0][1]:\n result = len(v_odd) - vo[0][1] + len(v_even) - ve[1][1]\n elif vo[0][1] < ve[0][1]:\n result = len(v_odd) - vo[1][1] + len(v_even) - ve[0][1]\n else:\n result = len(v_odd) - vo[0][1] + len(v_even) \nelse:\n result = len(v_odd) - vo[0][1] + len(v_even) - ve[0][1]\n\nprint(result)", "n=input()\nn = n.replace('1','a')\nn = n.replace('9','b')\nn = n.replace('a','9')\nn = n.replace('b','1')\nprint(n)"] | ['Runtime Error', 'Accepted'] | ['s084173750', 's586661382'] | [3444.0, 2940.0] | [22.0, 17.0] | [627, 110] |
p03242 | u112567325 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['N = input()\nstr = list(N)\nfor i in range(3):\n if str[i] == 9:\n str[i] = 1\n elif str[i] == 1:\n str[i] = 9\nstr2 = "".join(str)\nprint(str2)', 'N = input()\nstr = list(N)\nfor i in range(3):\n if str[i] == "9":\n str[i] = "1"\n elif str[i] == "1":\n str[i] = "9"\nprint(str)\nstr2 = "".join(str)\nprint(str2)', 'N = input()\nstr = list(N)\nfor i in range(3):\n if str[i] == "9":\n str[i] = "1"\n elif str[i] == "1":\n str[i] = "9"\nstr2 = "".join(str)\nprint(str2)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s420459602', 's842779374', 's021711307'] | [2940.0, 2940.0, 2940.0] | [17.0, 19.0, 17.0] | [144, 163, 152] |
p03242 | u113971909 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["ret = ''\nfor a in input():\n if a = '1':\n ret += '9'\n elif a = '9':\n ret += '1'\n else:\n ret += a\nprint(ret)", "ret = ''\nfor a in input():\n if a == '1':\n ret += '9'\n elif a == '9':\n ret += '1'\n else:\n ret += a\nprint(ret)\n"] | ['Runtime Error', 'Accepted'] | ['s809298526', 's327570820'] | [8936.0, 9052.0] | [20.0, 30.0] | [118, 121] |
p03242 | u121732701 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n = list(input())\ncount = 0\n\nfor i in n:\n if i == "1":\n n[count] = "9"\n elif i == "9":\n n[count] = "1"\n count += 1\n\nprint("".job(n))', 'n = list(input())\ncount = 0\n\nfor i in n:\n if i == "1":\n n[count] = "9"\n elif i == "9":\n n[count] = "1"\n count += 1\n\nprint("".join(n))'] | ['Runtime Error', 'Accepted'] | ['s333341670', 's659674531'] | [2940.0, 2940.0] | [17.0, 17.0] | [155, 156] |
p03242 | u122195031 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n = input()\nN = list(n)\nfor i in N:\n if i == "1":\n i = "9"\n else:\n i = "1"\nprint(n)', 'n = input()\nlst = []\nN = list(n)\nfor i in N:\n if i == "1":\n lst.append("9")\n else:\n lst.append("1")\nprint("".join(lst))'] | ['Wrong Answer', 'Accepted'] | ['s190823439', 's953831447'] | [2940.0, 2940.0] | [17.0, 17.0] | [91, 127] |
p03242 | u127499732 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n=str(input())\nprint(n.replace("1","0").replace("9","1").replace("0","1"))', 's=["9" if x=="1" else "9" for x in input()]\nprint("".join(s))', 's=["9" if x=="1" else "9" for x in list(input())]\nprint("".join(s))', 'def main():\n s=["9" if x=="1" else "1" for x in input()]\n print("".join(s))\nif __name__=="__main__":\n main()'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s137564010', 's161514954', 's229844503', 's741505723'] | [2940.0, 2940.0, 2940.0, 2940.0] | [19.0, 17.0, 17.0, 17.0] | [74, 61, 67, 111] |
p03242 | u127856129 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['a=input()\nprint(a.replace("1","9").replace("9","1"))', 'a=list(input())\nprint(a.replace("1","9").replace("9","1"))', 'a=input()\nprint(a.replace("1","9").replace("9","1"))', '\nprint(input().replace("1","9").replace("9","1"))', 'a=input()\nprint(a.replace("1","x").replace("9","1").replace("x","9"))'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s086743139', 's512847096', 's553509716', 's590665305', 's225444150'] | [2940.0, 2940.0, 2940.0, 2940.0, 3064.0] | [17.0, 18.0, 18.0, 18.0, 17.0] | [52, 58, 52, 49, 69] |
p03242 | u129978636 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n = list(map( int, sinput()))\n \nh = 3\nfor i in range(h):\n if( n[i] == 1):\n n[i] = 9\n n[i] = str(n[i]) \n else:\n n[i] = 1\n n[i] = str(n[i])\n \na = "".join(n)\n \nprint(a)', 'N = int( input())\n \nn = N // 100\n \nif( N % 100 <= n * 10 + n):\n\tprint(n * 100 + n * 10 + n )\n \nelse:\n \tprint( n * 100 + n * 10 + n + 111)', 'N = int( input())\n\nn = N // 100\n\nif( N % 100 <= n * 10 + n):\n\tprint(n * 100 + n * 10 + n )\n \nelse:\n', 'n = list(map( int, split()))\n\nh = 3\nfor i range(h):\n if( n[i] == 1):\n n[i] = 9\n n[i] = str(n[i]) \n else:\n n[i] = 1\n n[i] = str(n[i])\n \na = "".join(n)\n\nprint(a)', 'n = list(map( int, split()))\n \nh = 3\nfor i in range(h):\n if( n[i] == 1):\n n[i] = 9\n n[i] = str(n[i]) \n else:\n n[i] = 1\n n[i] = str(n[i])\n \na = "".join(n)\n \nprint(a)', 'N = int( input())\n \nn = N // 100\n \nif( N % 100 <= n * 10 + n):\n\tprint(n * 100 + n * 10 + n )\n \nelse:\n \tprint( (n + 1)* 100 + (n + 1)* 10 + (n + 1))\n', 'n = list(map( int, input()))\n \nh = 3\nfor i in range(h):\n if( n[i] == 1):\n n[i] = 9\n n[i] = str(n[i]) \n else:\n n[i] = 1\n n[i] = str(n[i])\n \na = "".join(n)\n \nprint(a)'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s266399914', 's479231329', 's754569716', 's804491314', 's867650034', 's904255001', 's910158602'] | [3060.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3060.0] | [18.0, 18.0, 17.0, 18.0, 18.0, 18.0, 18.0] | [184, 139, 100, 178, 183, 150, 183] |
p03242 | u131264627 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["print(''.join(['1' if '9' else '9' for i in input()]))", "print(''.join(['1' if i == '9' else '9' for i in input()]))"] | ['Wrong Answer', 'Accepted'] | ['s384773393', 's511208476'] | [2940.0, 2940.0] | [17.0, 17.0] | [54, 59] |
p03242 | u131406572 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['s=list(input())\nfor i in range(3):\n if s[i]=="1":\n s[i]=9\n else:\n s[i]=1\nprint(s)', '#112a\ns=list(input())\nfor i in range(3):\n if s[i]==1:\n s[i]=9\n else:\n s[i]=1\nprint(s)', 's=list(input())\nfor i in range(s):\n\tif s[i]==1:\n \ts[i]=9\n else:\n \ts[i]=1', 's=list(input())\nfor i in range(3):\n if s[i]=="1":\n s[i]=9\n else:\n s[i]=1\nprint(s[0]*100+s[1]*10+s[2])'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s038365886', 's211493468', 's827075723', 's198813226'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 18.0] | [101, 105, 81, 121] |
p03242 | u136811344 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ["n = input()\nprint(n.replace('1', '_').replace('9', '1').replace('_', '9')", "n = input()\nprint(n.replace('1', '_').replace('9', '1').replace('_', '9'))"] | ['Runtime Error', 'Accepted'] | ['s473248524', 's419918792'] | [2940.0, 2940.0] | [17.0, 17.0] | [73, 74] |
p03242 | u138486156 | 2,000 | 1,048,576 | Cat Snuke is learning to write characters. Today, he practiced writing digits `1` and `9`, but he did it the other way around. You are given a three-digit integer n written by Snuke. Print the integer obtained by replacing each digit `1` with `9` and each digit `9` with `1` in n. | ['n = int(input())\nXY = [list(map(int, input().split())) for _ in range(n)]\nmod = sum(XY[0])%2\nfor x, y in XY:\n if mod != (x+y)%2:\n print(-1)\n exit()\n\nm = 33-mod\nprint(m)\nD = [2**i for i in range(31, -1, -1)]\nif mod:\n D.append(1)\n\nprint(" ".join(map(str, D)))\nfor x, y in XY:\n w = " "\n for d in D:\n if x-y >= 0 and x+y >= 0:\n w += "R"\n x -= d\n elif x-y < 0 and x+y >= 0:\n w += "U"\n y -= d\n elif x-y >= 0 and x+y < 0:\n w += "D"\n y += d\n else:\n w += "L"\n x += d\n print(w)\n\n', 'from collections import Counter\nn = int(input())\nk = n//2\na = list(map(int, input().split()))\np = []\nq = []\nfor i in range(k):\n p.append(a[2*i])\n q.append(a[2*i+1])\ns = Counter(p).most_common()\nt = Counter(q).most_common()\nu, v = len(s), len(t)\nans = 0\nif s[0][0] == t[0][0]:\n if u == 1 and v == 1:\n ans = k\n elif u == 1:\n ans = k - t[1][1]\n elif v == 1:\n ans = k - s[1][1]\n else:\n comp = max(s[1][1], t[1][1])\n ans = n - s[0][1] - comp\nelse:\n ans = n - s[0][1] - t[0][1]\nprint(ans)\n\n', 's = input()\ns = s.replace("1","2")\n\ns = s.replace("9","1")\n\ns = s.replace("2","9")\n\nprint(s)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s108124814', 's693617778', 's112469449'] | [3064.0, 3316.0, 2940.0] | [17.0, 20.0, 17.0] | [614, 540, 92] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.