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
p02995
u477947762
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['from functools import reduce\nA, B, C, D = map(int, input().split())\n\ndef gcd(*numbers):\n def gcd(a, b):\n while b != 0:\n a, b = b, a % b\n return a\n return reduce(gcd, numbers)\n\ndef lcm(*numbers):\n def lcm(a, b):\n return (a * b) // gcd(a, b)\n return reduce(lcm, n...
['Wrong Answer', 'Accepted']
['s940644448', 's571527929']
[3700.0, 3572.0]
[24.0, 23.0]
[444, 520]
p02995
u489762173
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import sys\ninput = sys.stdin.readline\nimport fractions\n\ndef main():\n A, B, C, D = list(map(int, input().split()))\n Aone = A - 1\n lcm = int(C * D / fractions.gcd(C, D))\n\n Bc = int(B / C)\n Bd = int(B / D)\n Blcm = int(B / lcm)\n Bdec = Bc + Bd - Blcm\n\n# print(Bc,Bd,Blcm)\n\n Ac = ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s159290478', 's162999400', 's233424241', 's309806910', 's372981516', 's432557433', 's472968537', 's946379858', 's065397916']
[5076.0, 5076.0, 5076.0, 5588.0, 5076.0, 5076.0, 3064.0, 5076.0, 3064.0]
[36.0, 36.0, 35.0, 59.0, 36.0, 35.0, 17.0, 36.0, 17.0]
[462, 457, 459, 398, 496, 462, 525, 392, 534]
p02995
u490489966
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['#C\nimport math\na, b, c, d = map(int, input().split())\nbb = b - (b // c) - (b // d) + (b // (c * d / math.gcd(c, d)))\naa = a - (a // c) - (a // d) + (a // (c * d / math.gcd(c, d)))\n\nprint((bb-aa))', '#C\nimport math\na, b, c, d = map(int, input().split())\n\ndef gcd(x, y):\n if x < y:\n x, y = y, x\n ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s327818963', 's365313319', 's675197161', 's783419848', 's456117545']
[3060.0, 3064.0, 3060.0, 3064.0, 3060.0]
[18.0, 18.0, 17.0, 18.0, 18.0]
[195, 288, 176, 308, 307]
p02995
u494379309
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n#print(gcd(a,b))\n\n\ndef lcm(a,b):\n return a*b//gcd(a,b)\n#print(lcm(a,b)\n\na,b,c,d = list(map(int,input().split(" ")))\ne = lcm(c,d)\n\np=a//c\no=b//c\ni=a//d\nu=b//d\ny=a//e\nt=b//e\n\nprint(b-a+1-(o-p+u-i-t+y))', 'def gcd(a,b):\n while b!=0:\n a,b=b,...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s246900712', 's289665712', 's543083006', 's643634071', 's722040910']
[3064.0, 3064.0, 3060.0, 2940.0, 3064.0]
[17.0, 19.0, 18.0, 17.0, 17.0]
[269, 316, 316, 310, 328]
p02995
u498136917
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\n\na, b, c, d = map(int, input().split())\n\n\nlcm = a * b / math.gcd(a, b)\n\nnum = b-a\nc_1 = (b-a)//c\nd_1 = (b-a)//d\ncd_1 = (b-a)//(lcm)\n\nans = num - (c_1 + d_1) + cd_1\nprint(ans)', 'import math\n\na, b, c, d = map(int, input().split())\n\nlcm = c*d // math.gcd(c, d)\n\ndif = b-a+1\ndiv_c = b//c -...
['Wrong Answer', 'Accepted']
['s404555794', 's112137527']
[9048.0, 9092.0]
[29.0, 26.0]
[186, 224]
p02995
u502731482
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['\na, b, c, d = map(int, input().split())\n\ndef calc_lcd(x, y):\n if x < y:\n temp = x\n x = y\n y = temp\n \n r = x % y\n z = x * y\n while r != 0:\n x = y\n y = r\n r = x % y\n \n return z // y\n\nlcd = calc_lcd(c, d)\na -= 1\nprint(b // d)\n\nprint(b -...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s283621482', 's716246402', 's340099083']
[3060.0, 3060.0, 9180.0]
[18.0, 17.0, 26.0]
[508, 509, 191]
p02995
u507456172
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\nA,B,C,D=map(int,input().split())\n\nc=(int((B-B%C)-(A-1+C-(A-1)%C))/C+0.5)+1\nd=(int((B-B%D)-(A-1+D-(A-1)%D))/D+0.5)+1\nlcm=C*D/math.gcd(C,D)\ncandd=((B-B%lcm)-(A-1+lcm-(A-1)%lcm))/lcm+1\nprint(int(B-A+1-c-d+candd))', 'import math\nA,B,C,D=map(int,input().split())\n\nc=((B-B%C)-(A-1+C-(A-1)%C))//C+1\nd=(...
['Wrong Answer', 'Accepted']
['s611575648', 's942734945']
[9264.0, 9136.0]
[26.0, 28.0]
[221, 207]
p02995
u517152997
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['#\nimport sys\nimport math\nimport numpy as np\nimport itertools\n\ndef gcd(m,n):\n p=max(m,n)\n q=min(m,n)\n if p % q == 0:\n return q\n else:\n return gcd(q,p%q)\n\n\n\n\na,b,c,d = (int(i) for i in input().split()) \n\nx = b // c - (a-1) // c\ny = b // d - (a-1) // d\ne = c * d // lcm(c,d...
['Runtime Error', 'Accepted']
['s270614451', 's519356646']
[13048.0, 12444.0]
[152.0, 152.0]
[364, 364]
p02995
u519832983
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\nA, B, C, D = map(int, input().split())\ncount = 0\nBCcount = math.floor(B / C)\nBDcount = math.floor(B / D)\nACcount = math.floor((A - 1) / C)\nADcount = math.floor((A - 1) / D)\nl = C * D / gcd(C, D)\nBCDcount = math.floor(B / l)\nACDcount = math.floor((A - 1) / l)\nBcount = B - (BCcount + BDcount - BCD...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s345326790', 's510299035', 's971584729', 's913454995']
[3064.0, 5064.0, 3064.0, 5064.0]
[17.0, 34.0, 17.0, 35.0]
[388, 482, 409, 437]
p02995
u528748570
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\ndef gcd(a, b):\n if b==0:\n return a\n return gcd(b, a%b)\n\nA,B,C,D = map(int,input().split())\n\ncount = 0\nlcm = C*D / gcd(C,D)\n\n\nprint(B - B//C - B//D + B//lcm - (A - 1 - (A-1)//C - (A-1)//D + (A-1)//lcm))\n', 'import math\ndef gcd(a, b):\n if b==0:\n return a\n return gc...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s569436286', 's889367991', 's717139864']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[227, 223, 228]
p02995
u534308356
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a, b, c, d = map(int, input().split())\n\nc_div_a = a // c\nc_div_all = b // c\n\nd_div_a = a // d\nd_div_all = b // d\n\ncd_div_a = a // (c*d)\ncd_div_all = b // (c*d)\n\ndiv_a = c_div_a + d_div_a - cd_div_a\ndiv_all = c_div_all + d_div_all - cd_div_all\n\nprint( (b - a) - (div_all - div_a) + 1)\n', 'a, b, c, d = ma...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s491093354', 's716418258', 's103313829']
[2940.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[284, 459, 519]
p02995
u536560967
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a, b, c, d = map(int, input().split())\n\n\ndef gcd(a, b):\n while a%b!=0:\n a, b = b, a%b\n return b\n\nX = b//c - (a-1)//c\nY = b//d - (a-1)//d\n\nCD = c*d / gcd(c, d)\nXY = b//CD - (a-1)//CD\n\nprint(b-a+1-(X+Y-XY))', 'A, B, C, D = map(int, input().split())\n \ndef gcd(a, b):\n while a%b!=0:\n ...
['Wrong Answer', 'Accepted']
['s733052214', 's654315477']
[3060.0, 3060.0]
[17.0, 17.0]
[251, 219]
p02995
u549383771
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a,b,c,d = map(int,input().split())\nb_c = b//c\nb_d = b//d\na_c = (a-1)//c\na_d = (a-1)//d\nb_cd = b//int((c*d)/math.gcd(c, d))\na_cd = (a-1)//int((c*d)/math.gcd(c, d))\nprint((b-a+1)-(b_c+b_d-b_cd-(a_c+a_d-a_cd)))', 'def gcd(a, b):\n \n if a < b:\n a, b = b, a\n\n if a % b == 0:\n return b\n ...
['Runtime Error', 'Accepted']
['s697905426', 's948068629']
[3064.0, 3064.0]
[17.0, 17.0]
[207, 395]
p02995
u549494450
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['num = input().split(" ")\na = int(num[0])\nb = int(num[1])\nc = int(num[2])\nd = int(num[3])\nprint(b - b // c - b // d + b // (c * d) -(a - a // c - a // d + a // (a // (c * d)))', 'def gcd(a, b):\n while b!=0:\n a, b = b, a%b\n return a\n\nnum = input().split(" ")\na = int(num[0])-1\nb = int(num[1])\nc...
['Runtime Error', 'Accepted']
['s030074404', 's886082941']
[3060.0, 3064.0]
[17.0, 17.0]
[174, 273]
p02995
u556225812
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a, b, c, d = map(int, input().split())\ni, j = c, d\ndef gcd(i, j):\n return i if j == 0 else GCD(j, i%j)\nlcm = int(c//gcd(c, d)*d)\n\ndef cont(x):\n cnt1 = x//c \n cnt2 = x//d\n ans = x - cnt1 - cnt2 + x//lcm\n return int(ans)\n\nprint(cont(b) - cont(a-1))', 'a, b = map(int, input().split())\nc, d = ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s429460662', 's554381481', 's559376411']
[3060.0, 3064.0, 3060.0]
[18.0, 17.0, 18.0]
[261, 204, 261]
p02995
u556594202
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\n\na,b,c,d = map(int,input().split())\n\ns1=b//c - (a-1)//c\ns2=b//d - (a-1)//d\ns12=b//(c*d/math.gcd(c,d)) - (a-1)//(c*d/math.gcd(c,d))\ns12=int(s12)\nprint(s1,s2,s12)\nprint(b-a+1-(s1+s2-s12))\n', 'import math\n\na,b,c,d = map(int,input().split())\n\ns1=b//c - a//c\ns2=b//d - a//d\ns12=int( b//(c*d/math...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s008761638', 's146632190', 's477160548', 's612404829', 's656084063', 's771763270']
[9036.0, 9116.0, 9128.0, 9136.0, 9152.0, 8932.0]
[25.0, 30.0, 30.0, 28.0, 25.0, 27.0]
[198, 164, 222, 192, 180, 188]
p02995
u569280127
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a, b, c, d = [int(v) for v in input().split()]\n\ndef gcd(p, q):\n if q > p:\n p, q = q, p\n m = -1\n while m != 0:\n m = p % q\n p, q = q, m\n return p\n\na = a - 1\nlcm = c * d / gcd(d, c)\ndc = b//c - a//c\ndd = b//d - a//d\ndcd = b//lcm - a//lcm\ndivable = dc + dd - dcd\nprint(b -...
['Wrong Answer', 'Accepted']
['s891046251', 's349813051']
[3064.0, 3064.0]
[17.0, 18.0]
[314, 315]
p02995
u573900545
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\nA, B, C, D = map(int, input().split())\nc = B // C - A // C\nd = B // D - A // D\nE = int((C * D) / math.gcd(C, D))\ne = B // E - A // E\nprint(B - A + 1 - c - d + e)', 'import math\nA, B, C, D = map(int, input().split())\nc = B // C - A // C + int(A % C == 0)\nd = B // D - A // D + int(A % D == 0)\nE = ...
['Wrong Answer', 'Accepted']
['s546761309', 's377371412']
[9116.0, 9184.0]
[27.0, 30.0]
[173, 227]
p02995
u580093517
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['e = list(map(int,input().split()))\na = e[0]\nb = e[1]\nc = e[2]\nd = e[3]\ncnt = 0\nfor j in range(a,b+1):\n if j%c != 0 and j%d != 0\n cnt += 1\nprint(cnt)', 'e = list(map(int,input().split()))\na,b,c,d = e\n\ndef gcd(x,y):\n while y !=0:\n x,y = y,x%y\n return x\n\ndef sums(x):\n S1 = x//...
['Runtime Error', 'Accepted']
['s806936497', 's161298699']
[2940.0, 3060.0]
[17.0, 17.0]
[158, 237]
p02995
u583507988
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\na,b,c,d=map(int,input().split())\ne=a*b//math.gcd(a,b)\nif a%c==0:\n p=b//c-a//c+1\nelse:\n p=b//c-a//c\nif a%d==0:\n q=b//d-a//d+1\nelse:\n q=b//d-a//d\nif a%e==0:\n r=b//e-a//e+1\nelse:\n r=b//e-a//e\nprint(b-a+1-(p+q-r))', 'import math\na,b,c,d=map(int,input().split())\ne=c*d//math.gcd(c,d)\nif ...
['Wrong Answer', 'Accepted']
['s476451748', 's708196733']
[9112.0, 9180.0]
[30.0, 26.0]
[227, 227]
p02995
u597455618
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['# Euclidean Algorithm\ndef gcd(m, n):\n r = m % n\n return gcd(n, r) if r else n\n\n# lcm (least common multiple)\ndef lcm(m, n):\n return m//gcd(m, n)*n\n\na, b, c, d = map(int, input().split())\nndiv = (b-a+1)//c + (b-a+1)//d - (b-a+1)//lcm(c,d)\nprint(b - a - ndiv)', '# Euclidean Algorithm\ndef gcd(m, n):...
['Wrong Answer', 'Accepted']
['s830591730', 's995152613']
[3060.0, 3064.0]
[17.0, 18.0]
[266, 312]
p02995
u600261652
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def resolve():\n A, B, C, D = map(int, input().split())\n d = D\n c = C\n gcd = 0\n while gcd == 0:\n if d % c == 0:\n gcd = c\n break\n else:\n d = c\n c = d % c\n lcm = C*D//gcd\n A = A-1\n print((B-B//C-B//D+B//lcm)-(A-A//C-A//D+A//l...
['Runtime Error', 'Accepted']
['s848409790', 's138199074']
[3064.0, 3064.0]
[17.0, 17.0]
[318, 316]
p02995
u601344838
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['#data=list(input().split())\na,b,c,d=map(int,input().split())\ndef gcd(x , y):\n if y == 0 \n return x \n else gcd(y, x%y)\n\ndef gys(a,b):\n remainder = gcd(a,b)\n return int(a*b/remainder)\n\nlcmm=gys(c,d)\ndef ans(n,k):\n return int(n/k)\ndef x(s):\n return ans(s,c)+ans(s,d)-ans(s,lcmm)\n#...
['Runtime Error', 'Accepted']
['s538870202', 's056777074']
[2940.0, 3060.0]
[18.0, 18.0]
[400, 355]
p02995
u607754357
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['S = input().split()\n\nA = int(S[0])\nB = int(S[1])\nC = int(S[2])\nD = int(S[3])\n\ncount_U = B - A + 1\n\n\n#print(count_C)\n\n#print(count_D)\n\n#print(count_CD)\n\ncount_C = (B // C) - (A // C)\ncount_D = (B // D) - (A // D)\nCD = lcm(C, D)\ncount_CD = (B // CD) - (A // CD)\n\nprint(count_U - (count_C + count_D -...
['Runtime Error', 'Runtime Error', 'Accepted']
['s048334659', 's091514922', 's690666647']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[439, 475, 303]
p02995
u609814378
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import sys\nimport math\n\nA,B,C,D = map(int, input().split())\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\n\nmaru1 = B // C\nmaru2 = A // C\n\nmaru3 = B // D\nmaru4 = A // D\n\nmaru5 = B // lcm(C,D)\nmaru6 = A // lcm(C,D)\n\nans_tmp = ((maru1-maru2)+(maru3-maru4)) - (maru5-maru6)\nans = ((B-A)+1) - ans_t...
['Wrong Answer', 'Accepted']
['s710413102', 's997752386']
[9100.0, 9216.0]
[27.0, 28.0]
[314, 324]
p02995
u612975321
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\n\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\na,b,c,d = map(int, input().split())\n\ng = math.gcd(c, d)\nl = lcm(c, d)\n\nprint(b-a+1 - (b//c - a//c + b//d - a//d -b//l + a//l))', 'import math\n\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\na,b,c,d = map(int, input().split())\n\ng ...
['Wrong Answer', 'Accepted']
['s712515335', 's135088602']
[9116.0, 9184.0]
[25.0, 28.0]
[192, 204]
p02995
u613943630
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import sys\nsys.setrecursionlimit(10**7)\ninput = sys.stdin.readlines\n\ndef main():\n\n lines = input()\n a, b, c, d = list(map(int, lines[0].split()))\n\n def gcd(a, b):\n\n r = a % b\n\n if r == 0:\n return int(b)\n \n return gcd(b, r)\n\n g = gcd(c, d)\n gcm =...
['Wrong Answer', 'Accepted']
['s765635235', 's739403155']
[9276.0, 9212.0]
[28.0, 29.0]
[509, 509]
p02995
u619458041
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import sys\n\ndef gcd(a, b):\n """Euclidean Algorithm"""\n while b != 0:\n a, b = b, a % b\n return a\n\n\ndef lcm(a, b):\n return (a * b) // gcd(a, b)\n\n\ndef main():\n input = sys.stdin.readline\n A, B, C, D = map(int, input().split())\n E = lcm(C, D)\n print(E)\n total = B - A + ...
['Wrong Answer', 'Accepted']
['s708128721', 's486727660']
[3064.0, 3064.0]
[17.0, 17.0]
[700, 476]
p02995
u620806894
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\ndef gcd(a, b):\n while b:\n a, b = b, a%b\n return a\n\na, b, c, d = map(int, input().split())\n\ntmp_b= b - math.floor(b/c) - math.floor(b/d)\ntmp_b += math.floor(b/(c*d/gcd(c, d)))\n\ntmp_a= a - math.floor(a/c) - math.floor(a/d)\ntmp_a += math.floor(a/(c*d/gcd(c, d)))\n\nprint(tmp_b-tmp_a+1)\n', '...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s414641995', 's797924392', 's623701842']
[3060.0, 3064.0, 5076.0]
[17.0, 17.0, 35.0]
[299, 318, 347]
p02995
u623036684
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['A,B,C,D = map(int, input().split())\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\n\nlcm=C*D/gcd(C,D)\ncon1=B//C - (A-1)//C\ncon2=B//D - (A-1)//D\ncon3=B//lcm - (A-1)//lcm\n\nprint(B-(A-1)-(con1+con2-con3))\n', 'A,B,C,D = map(int, input().split())\n\ndef gcd(a, b):\n if...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s080389548', 's330260843', 's922653784']
[3060.0, 3064.0, 3060.0]
[17.0, 17.0, 17.0]
[239, 226, 239]
p02995
u627234757
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import fractions\nA, B, C, D = map(int, input().split())\nCdiv = B // C - (A - 1) // C\nDdiv = B // D - (A - 1) // D\ngcd_CD = C * D / fractions.gcd(C, D)\nCDdiv = B // gcd_CD - (A - 1) // gcd_CD\nresult = int(B - (A - 1) - Cdiv - Ddiv + CDdiv)\nprint(result)', 'import fractions\nA, B, C, D = map(int, input().split()...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s602526605', 's696529376', 's923374417', 's559053010']
[5048.0, 5048.0, 2940.0, 9112.0]
[36.0, 35.0, 17.0, 29.0]
[252, 252, 208, 203]
p02995
u630511239
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['A, B, C, D = map(int, input().split())\ndef anti(A, B, m):\n ans = (B-A+1)//m\n mo = (B-A+1)%m\n if mo != 0 and mo > A%m:\n ans += 1\n return ans\n\nimport fractions\ng = fractions.gcd(C,D)\nh = int((C*D)//g)\nx = anti(A,B,C)\ny = anti(A,B,D)\nz = anti(A,B,h)\nans = B-A+1-x-y+z\nprint(ans)\n ', 'A, B, C, D = ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s552500468', 's750368498', 's441468792']
[5048.0, 5048.0, 9184.0]
[35.0, 36.0, 30.0]
[285, 286, 158]
p02995
u634159866
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['A, B, C, D = map(int, input().split())\n\nimport math\n\ninterval = B-A+1\n\nn1 = math.ceil(A/C)\nn2 = math.ceil(A/D)\nm1 = math.ceil(B/C)\nm2 = math.ceil(B/D)\n\narr1 = []\narr2 = []\n\nif B%C==0:\n for i in range(n1, m1+1):\n arr1.append(i*C)\nelse:\n for i in range(n1, m1):\n arr1.append(i*C)\n...
['Runtime Error', 'Accepted']
['s613635773', 's336204025']
[584496.0, 3060.0]
[2141.0, 17.0]
[571, 297]
p02995
u637170240
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import fractions, math\nA, B, C, D = map(int, input().split())\nU = B - A + 1\n\nMofD = 0\nMofCD = 0\n\ndef lcm(x, y):\n return (x * y) // fractions.gcd(x, y)\n\n\ndef sten(st, en, x):\n st = math.ceil(st/x)*x\n en = math.floor(en/x)*x\n if en >= st:\n n = (en - st) // x + 1\n else:\n n =...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s054104942', 's730600246', 's832491955', 's578012236']
[5076.0, 3064.0, 5076.0, 3064.0]
[35.0, 17.0, 35.0, 17.0]
[436, 380, 398, 568]
p02995
u652569315
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a,b,c,d = map(int,input().split())\nl = [c,d,c*d]\ncount = 0\nfor i in range(3):\n if a%l[i] == 0:\n if i < 2:\n count += (1+len(range(a+1,b+1))//l[i])\n else:\n count -= (1+len(range(a+1,b+1))//l[i])\n else:\n if i < 2:\n count += (1+len(range(a+l[i]-a%l[i]+1,b+1))//l[i])\n else:\n ...
['Wrong Answer', 'Accepted']
['s279814969', 's180033353']
[3064.0, 3188.0]
[17.0, 19.0]
[384, 496]
p02995
u653175574
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['A, B, C D = map(int, input())\nans = 0\nfor i in range(A, B):\n if i % C == 0 and i % D == 0:\n ans = ans\n else:\n ans = ans + 1\nprint(ans)', 'A, B, C D = map(int, input())\nans = 0\nfor i in range(A, B):\n if i % C == 0 and i % D == 0:\n ans = ans + 1\nprint(ans)', 'A, B, C D = map(int, input())\nans =...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s377639936', 's551937017', 's954514588', 's627657900']
[2940.0, 2940.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0, 17.0]
[142, 120, 109, 368]
p02995
u655048024
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a,b,c,d = map(int,input().split())\nh = a-b + 1\ne = c*d\nm = h//c + int(a%c==0)\nk = h//d + int(a%d==0) \nl = h//e + int(a%e==0)\nprint(h-(m+k-l))\n', 'a,b,c,d = map(int,input().split())\ne = c*d\nh = b-a+1\nprint(h-h//c+h//d+h//e)\n', 'a,b,c,d = map(int,input().split())\nans = 0\nfor i in range(a,b+1):\n if(i%c!=0...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s057924852', 's072507779', 's101133294', 's756045451', 's829320363', 's959573228', 's898488359']
[9052.0, 9052.0, 9104.0, 8908.0, 9064.0, 9080.0, 9140.0]
[28.0, 26.0, 2205.0, 26.0, 27.0, 29.0, 31.0]
[142, 77, 103, 103, 102, 74, 118]
p02995
u657541767
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['A, B, C, D = map(int, input().split())\n\ndef gcd(a, b):\n if a == 0:\n return b\n return gcd(b%a, a)\n\ng = gcd(C, D) if C < D else gcd(D, C)\nansB = B-B/C-B/D+B/(C*D/g)\nansA = A - 1 - (A-1)/C - (A-1)/D + (A-1)/(C*D/g)\nprint(ansB-ansA)', 'A, B, C, D = map(int, input().split())\n\ndef gcd(a, b):\n if a == 0:\...
['Wrong Answer', 'Accepted']
['s668137400', 's670293051']
[3064.0, 3064.0]
[18.0, 18.0]
[233, 241]
p02995
u666198201
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['\nA,B,C,D = map(int, input().split())\n\ndef gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\nE=C*D//gcd(C,D)\ntotal=0\nif A%C==0 and A>=C:\n total += B//C-A//C+1\nelse:\n total += B // C - A // C\n\nif A%D==0 and A>=D:\n total += B//D-A//D+1\nelse:\n total += B // D - A// D\n\nif A%E==0 and A>=...
['Runtime Error', 'Accepted']
['s660089470', 's264059734']
[3064.0, 3064.0]
[17.0, 17.0]
[386, 265]
p02995
u671861352
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['\ndef gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\nA, B, C, D = tuple(map(int, input().split()))\n\ns = -1\nc = C * (A // C + 1)\nif c <= B:\n s += (B - c) // C + 1\n \nd = D * (A // D + 1)\nif d <= B:\n s += (B - d) // D + 1\n...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s365932608', 's398370526', 's887224316', 's261810595']
[3064.0, 3064.0, 3064.0, 3064.0]
[18.0, 17.0, 17.0, 18.0]
[419, 365, 414, 496]
p02995
u672220554
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a,b,c,d = map(int,input().split())\n\nprint(int((b-a+1)-(b//c+b//d-a//c-a//d)+(b//(c*d)-a//(c*d))))', 'a,b,c,d = map(int,input().split())\ndef gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\ndef lcm(a,b):\n return a*b//gcd(a,b)\ncd = lcm(c,d)\nprint(int((b-a+1)-(b//c+b//d-(a-1)//c-(a-1)//d)+(b//(cd)-(...
['Wrong Answer', 'Accepted']
['s468783443', 's707498020']
[2940.0, 3060.0]
[17.0, 17.0]
[97, 220]
p02995
u672494157
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import sys\n\nsys.setrecursionlimit(4100000)\n\n\ndef inputs(num_of_input):\n ins = [input() for i in range(num_of_input)]\n return ins\n\n\ndef euclid(a, b):\n if a > b:\n large = a\n small = b\n else:\n large = b\n small = a\n\n while small != 0:\n r = large % small...
['Wrong Answer', 'Accepted']
['s842763357', 's917480103']
[3188.0, 3064.0]
[18.0, 18.0]
[919, 876]
p02995
u676496404
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a,b,c,d = map(int,input().split())\na1 = a//c\na2 = b//c\na3 = a2 - a1 - 1\n\nb1 = a//d\nb2 = b//d\nb3 = b2 - b1 - 1\n\nwidth = b - a + 1\n\nprint(a3,b3)\n\nprint(width - a3 - b3)', 'a,b,c,d = map(int,input().split())\na1 = a//c\na2 = b//c\na3 = a2 - a1 - 1\n\nb1 = a//d\nb2 = b//d\nb3 = b2 - b1 - 1\n\nwidth = b - a +...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s130080336', 's130266199', 's489033824', 's684816562', 's905493385', 's919439121', 's265485740']
[3060.0, 3060.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 19.0]
[166, 152, 224, 296, 245, 219, 309]
p02995
u677121387
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a,b,c,d = map(int,input().split())\nans = 0\n\nfor i in (a,b+1):\n if i%c != 0 and i%d != 0:\n ans += 1\n\nprint(ans)', 'def gcd(x,y):\n if y==0:\n return x\n else:\n return(gcd(y,x%y))\n \na,b,c,d = map(int,input().split())\ng = gcd(c,d)\nl = c*d//g\n\nans =(b-a+1)-( (b//c-(a-1)//c) ...
['Wrong Answer', 'Accepted']
['s426554806', 's168022690']
[2940.0, 3060.0]
[17.0, 18.0]
[120, 226]
p02995
u677267454
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a, b, c, d = map(int, input().split())\n\nfirst_c = c * a // c + a % c\nlast_c = c * b // c\nfirst_d = d * a // d + a % d\nlast_d = d * b // d\ncd = c * d\nfirst_cd = cd * a // cd + a % cd\nlast_cd = cd * b // cd\n\ncnum = (last_c - first_c) // c + 1\ndnum = (last_d - first_d) // d + 1\ncdnum = (last_cd - first_cd) /...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s309754740', 's971468885', 's499214308']
[3060.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[394, 620, 683]
p02995
u682467216
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\n\n\n\n# return n-(math.floor(n / c) +\n# math.floor(n / d) - math.floor(n / (c * d / math.gcd(c, d))))\ndef calc(n, c, d):\n return n-(n // c +\n n // d - n // (c * d / math.gcd(c, d)))\n\ndef main():\n a, b, c, d = map(int, input().split())\n\n print(calc(b, c, d)...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s255911615', 's705465711', 's742244116', 's912501865', 's425807833']
[9100.0, 9088.0, 9068.0, 9112.0, 9044.0]
[25.0, 23.0, 31.0, 27.0, 32.0]
[383, 376, 380, 381, 385]
p02995
u682730715
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['# coding: UTF-8\nimport sys\n\nimport heapq\nimport re\nimport bisect\nimport random\nimport math\nimport itertools\nfrom collections import defaultdict, deque\nfrom copy import deepcopy\nfrom decimal import *\nimport fractions\nreadl= lambda: list(map(int, sys.stdin.readline().split()))\nreadt= lambda: tuple(map(int...
['Wrong Answer', 'Accepted']
['s672467425', 's469277255']
[6224.0, 6036.0]
[54.0, 57.0]
[781, 801]
p02995
u688219499
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['from math import gcd\nfrom decimal import Decimal as dec \na, b, c, d = map(dec,input().split())\nif a % c ==0:\n c_explicit = b // c - a // c + 1\nelse:\n c_explicit = b // c - a // c \nif a % d ==0:\n d_explicit = b // d - a // d + 1\nelse:\n d_explicit = b // d - a // d \ne = gcd(int(c), int(d))\ne = d...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s200173550', 's240671120', 's610521264', 's353712695']
[10016.0, 9172.0, 9220.0, 9188.0]
[30.0, 28.0, 25.0, 28.0]
[549, 497, 258, 271]
p02995
u691446391
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\ndef gcd(a,b):\n\tif a==0:\n\t\treturn b\n\telse:\n\t\treturn gcd(b%a,a)\ndef lcm(a,b):\n\treturn (a*b)/gcd(a,b)\n\ndef main():\n\ta ,b,c,d = map(int,input().split())\n\tlc = lcm(c,d)\n\tcnt = (math.floor((b)/c)-math.floor((a)/c))+(math.floor((b)/d)-math.floor((a)/d))- (math.floor((b)/(lc))-math.floor((a)...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s189649263', 's467999825', 's698623823', 's464002664']
[3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0, 19.0]
[375, 338, 276, 328]
p02995
u691896522
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a, b, c, d = list(map(int, input().split()))\ndef euqlid(x,y):\n if x < y :\n temp = x\n x = y\n y = temp\n while x % y != 0:\n temp = x\n x = y\n y = temp % y\n return y\ndef searchCount(p,q,k):\n min = 0\n max = 0\n if a % k == 0:\n min = p\n els...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s249736468', 's362017067', 's599965777', 's931945922', 's999218660', 's844547768']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3192.0]
[18.0, 17.0, 18.0, 2104.0, 17.0, 18.0]
[492, 727, 497, 622, 501, 499]
p02995
u693048766
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import fractions\n\na,b,c,d=map(int,input().split())\n\ngcd = int(fractions.gcd(c,d))\n\ncc = (c//gcd * d)\n\n\nmm1 = b//c\nmm2 = b//d\nmmc = b//cc\nA1 = b - (mm2 + mm1 - mmc)\n# print(A1, b, mm2, mm1, mmc)\n\na-=1\nmm1 = a//c\nmm2 = a//d\nmmc = a//cc\nA2 = a - (mm2 + mm1 - mmc)\n# print(A2, a, mm2, mm1, mmc)\n\n\npr...
['Runtime Error', 'Accepted']
['s868898594', 's797572296']
[3060.0, 3064.0]
[17.0, 18.0]
[309, 360]
p02995
u694810977
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import fractions\nA,B,C,D = map(int,input().split())\nn = (C * D) // fractions.gcd(C,D)\nC_D = B / n\nc = B / C\nd = B / D\nm = c + d - C_D\nans = int((B - A + 1) - m)\nprint(ans)', 'import fractions\nA,B,C,D = map(int,input().split())\nn = C * D / fractions.gcd(C,D)\nC_D = (B - A + 1) / n\nc = (B - A + 1) / C\nd = (...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s816488563', 's836953186', 's834809146']
[5052.0, 5052.0, 3060.0]
[35.0, 35.0, 17.0]
[171, 198, 218]
p02995
u696684809
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\na,b,c,d = map(int,input().split())\ne = int(c*d/math.gcd(c,d))\nwa = 0\nc_seki = int(b/c)-int((a-1)/c)\nd_seki = int(b/d)-int((a-1)/d)\ne_seki = int(b/e)-int((a-1)/e)\nwa = c_seki+d_seki-e_seki\nprint(b-a+1-wa,c_seki,d_seki,e_seki)', 'import math\na,b,c,d = map(int,input().split())\ne = c*d//math.gcd(c,d...
['Wrong Answer', 'Accepted']
['s158451966', 's659479005']
[9088.0, 9168.0]
[29.0, 26.0]
[236, 187]
p02995
u696886537
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['from math import *\nfrom fractions import *\na,b,c,d=map(int,raw_input().split())\nlcm=lambda x,y: x*y//gcd(x,y)\n\nprint(b-a+1 - ((b-a+1)//c + (b-a+1)//d - (b-a+1)//lcm(c,d)))', 'import math\nfrom fractions import *\na,b,c,d=map(int,input().split())\n\ndef lcm(a,b):\n return a * b // math.gcd(a, b)\n\ndef f(a,b,c...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s409328481', 's471339607', 's922197128', 's089005289']
[5052.0, 5048.0, 3064.0, 5048.0]
[37.0, 36.0, 17.0, 36.0]
[171, 428, 346, 360]
p02995
u697690147
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\na, b, c, d = list(map(int, input().split()))\n\ncnt = 0\nnumc = math.floor(b/c) - math.ceil(a/c) + 1\nnumd = math.floor(b/d) - math.ceil(a/d) + 1\n\ndef gcd(a, b):\n if a == 0:\n return b\n elif b == 0:\n return a\n else:\n return gcd(b, a%b)\n\ncd = (c*d) // gcd(c, d)\nnumc...
['Wrong Answer', 'Accepted']
['s102351923', 's335438230']
[8876.0, 10080.0]
[24.0, 32.0]
[383, 444]
p02995
u698868214
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\nA,B,C,D = map(int,input().split())\n\nE = C*D / math.gcd(C,D)\n\ni = B//C\nj = B//D\nk = A//C\nn = A//D\nm = B//E\nl = A//E\n\nres = B-(A-1)-(i-k)-(j-n)+(m-l)\nprint(math.floor(res))', 'import math\nA,B,C,D = map(int,input().split())\n\nE = C*D\n\ni = B//C\nj = B//D\nk = A//C\nl = A//E\nn = A//D\nm = B//...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s473600774', 's805351092', 's172423020']
[9244.0, 9076.0, 9188.0]
[28.0, 26.0, 27.0]
[182, 166, 183]
p02995
u700477434
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def lcm(a, b):\n if b > a:\n a, b = b, a\n\n x = a * b\n r = b % a\n while r != 0:\n a = b\n b = r\n r = b % a\n\n return x / b\n\n\nA, B, C, D = map(int, input().split())\nCD = lcm(D, C)\nA -= 1\n\nn = (B // C) + (B // D) - (B // CD)\nn -= (A // C) + (A // D) - (A // CD)\np...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s080631893', 's688795147', 's400172338']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[313, 314, 314]
p02995
u706414019
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\nA,B,C,D = list(map(int,input().split()))\nC_bai = list(range(A-(A%C)+C,B,C+1))\nD_bai = list(range(A-(A%D)+D,B,D+1))\nE = lcm(C,D)\nCD_bai = list(range(A-(A%E)+E,B,E+1))\nprint(B-A+1-len(C_bai)-len(D_bai)+CD_bai)\n ', 'import math\ndef lcm(x, y):...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s372224978', 's452328331', 's944540501']
[2887464.0, 9196.0, 9164.0]
[2296.0, 26.0, 27.0]
[277, 307, 495]
p02995
u707030679
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\n\ndef getDivCount( a, b, x ):\n count=0\n if a==0 :\n count+=1\n count+=b//x-a//x\n return count\n\na,b,c,d = map(int, input().split())\n\ncount = b-a+1\ncount -= getDivCount(a,b,c)\ncount -= getDivCount(a,b,d)\ncount += getDivCount(a,b,c*d//math.gcd(c,d))\nprint(count)\n', 'import mat...
['Wrong Answer', 'Accepted']
['s614999298', 's420859074']
[9000.0, 9136.0]
[32.0, 28.0]
[288, 311]
p02995
u708255304
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(m, n):\n while n:\n m, n = n, m % n\n return m\n\n\nA, B, C, D = map(int, input().split())\n\nb_not_division = B - B//C - B//D + C*D//gcd(C, D)\na_mins_one_not_division = (A-1) - (A-1)//C - (A-1)//D + C*D//gcd(C, D)\nprint(b_not_division-a_mins_one_not_division)', 'def gcd(m, n):\n while n:\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s182500126', 's292413130', 's435771585', 's782351631']
[3060.0, 2940.0, 3060.0, 3060.0]
[17.0, 18.0, 17.0, 17.0]
[273, 486, 481, 634]
p02995
u716660050
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import fractions\ndef lcm(n,m): return n*m//fractions.gcd(n,m)\nA,B,C,D=map(int,input().split())\nX=B-A\nprint((X-((X//C)+(X//D)))+(X//lcm(C,D)))', 'import fractions\ndef lcm(n,m): return n*m//fractions.gcd(n,m)\nA,B,C,D=map(int,input().split())\nprint(((B-A)-(((B-A)//C)+((B-A)//D)))+((B-A)//lcm(C,D)))', 'import frac...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s809541237', 's835765639', 's963216475', 's290435346']
[5176.0, 5688.0, 5304.0, 9132.0]
[36.0, 48.0, 38.0, 29.0]
[141, 151, 146, 125]
p02995
u717993780
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\na,b,c,d = map(int,input().split())\nm = int(c*d/gcd(c,d))\nif a%c < b%c:\n xc = (b-a+1)//c\nelif a%c > b%c and b%c == 0 and a%c == 1:\n xc = (b-a+1)//c\nelif a%c > b%c:\n xc = (b-a+1)//c +1\nelif a%c == b%c and a%c == 0:\n xc = (b-a+1)//c +1\nelse:\n xc =...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s090772920', 's124622335', 's254975216', 's778419044', 's884700681', 's999669423', 's533560600']
[3064.0, 3064.0, 3192.0, 3188.0, 3064.0, 3064.0, 3060.0]
[18.0, 18.0, 17.0, 20.0, 17.0, 18.0, 17.0]
[749, 710, 986, 745, 749, 790, 196]
p02995
u723583932
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['#abc133 c\nfrom fractions import gcd\na,b,c,d=map(int,input().split())\n\n\ndef lcm(x,y):\n return (x*y)//gcd(x,y)\n\ne=lcm(c,d) \n\ndef kosu(num):\n z=num\n nc=int(num/c)\n nd=int(num/d)\n ne=int(num/e)\n return z-nc-nd+ne\n\nans=kosu(b)-kosu(a-1)\n\nprint(ans)\n', '#abc133 c\nfrom fractions import...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s459476694', 's641629850', 's944517895']
[5076.0, 2940.0, 3064.0]
[35.0, 18.0, 17.0]
[357, 341, 312]
p02995
u726615467
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import sys\n# input = sys.stdin.readline\n\nN = int(input())\nAB = [list(map(int, input().split())) for _ in range(N)]\n\n\nans = 0\nans += B // C\nans -= (A - 1) // C\n# print("#", ans)\nans += B // D\nans -= (A - 1) // D\n# print("#", ans)\n#\nans -= B // (C * D)\nans += (A - 1) // (C * D)\n# print("#", ans)\n\nans...
['Runtime Error', 'Accepted']
['s274195622', 's837910979']
[3064.0, 3064.0]
[18.0, 22.0]
[330, 458]
p02995
u735186902
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(a,b):\n if b==0:\n return a\n else:\n return gcd(b,a%b)\nA, B, C, D = map(int, input().split())\nX = B//C - A//C\nY = B//D - A//D\nE = (C*D)//gcd(C,D)\nZ = B//E - A//E\nprint(B-A-X-Y+Z+1)', 'def gcd(a,b):\n if b==0:\n return a\n else:\n return gcd(b,a%b)\nA, B, C, D = map(int, input().split())...
['Wrong Answer', 'Accepted']
['s892463974', 's328937100']
[3060.0, 3060.0]
[18.0, 18.0]
[193, 205]
p02995
u741495664
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\ndef Euclidean(x,y):\n if y == 0:\n return x\n else:\n return Euclidean(y,x%y)\n\nA,B,C,D = [int(x) for x in input().split()]\ncount = B - A + 1\nE = Euclidean(C,D)\nF = C*D/E\n\nC_ = math.floor(B/C) - math.ceil(A/C) + 1\nD_ = math.floor(B/D) - math.ceil(A/C) + 1\nC_and_D = math.floor(...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s173185772', 's228659367', 's267613992', 's046175252']
[3064.0, 3064.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0, 18.0]
[364, 355, 436, 307]
p02995
u746627216
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\n\nA, B, C ,D = map(int, input().split())\n\n\nC_multiple = B // C - A // C\nD_multiple = B // D - A // D \n\nif A % C == 0:\n C_multiple += 1\nif A % D == 0:\n D_multiple += 1\n \n\nCD_gcd = C * D / math.gcd(C,D) \nCD_multiple = B // CD_gcd - A// CD_gcd \nif A % CD_gcd == 0:\n CD_multiple...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s260912469', 's893072732', 's068774669']
[8904.0, 9044.0, 9188.0]
[26.0, 24.0, 27.0]
[461, 372, 388]
p02995
u750651325
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\nimport functools\ndef s(): return input()\ndef k(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef X(): return list(...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s619887946', 's951390995', 's228387149']
[10092.0, 10156.0, 10192.0]
[38.0, 36.0, 36.0]
[665, 767, 767]
p02995
u754727115
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a,b,c,d=map(int,input().split())\nq=[a,b]\nfor w in range(0,2):\n x=q[w]//c\n y=q[w]//d\n k,j=c,d\n g=c%d\n while g!=0:\n k,j=d,g\n g=k%j\n l=c*d//j\n z=q[w]//l\n q[w]=q[w]-x-y+z\nprint(int(q[1]-q[0]+1))', 'a,b,c,d=map(int,input().split())\nq=[a,b]\nfor w in range(0,2):\n x=q[...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s446350771', 's788275774', 's995618647', 's957297183']
[9208.0, 9100.0, 9040.0, 9124.0]
[29.0, 29.0, 2206.0, 30.0]
[228, 227, 111, 224]
p02995
u766510304
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\na,b,c,d=input().split(" ")\nA=int(a)\nB=int(b)\nC=int(c)\nD=int(d)\ndef nb_divisers(n,m):\n return n//m\ndef nb_d_btw(f,g,n):\n if f%n==0:\n print(nb_divisers(g,n)-nb_divisers(f,n)+1)\n return nb_divisers(g,n)-nb_divisers(f,n)+1\n else:\n print(nb_divisers(g,n)-nb_divisers(f...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s296117761', 's514592188', 's723850231', 's354559603']
[3064.0, 3064.0, 5692.0, 3064.0]
[18.0, 18.0, 49.0, 18.0]
[518, 500, 510, 457]
p02995
u780698286
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['from math import gcd\n\na, b, c, d = map(int, input().split())\nx = (b // c) - ((a-1) // c)\ny = (b // d) - ((a-1) // d)\nz = (b // gcd(c, d)) - ((a-1) // gcd(c, d))\nprint(b-a+1-(x+y-z))', 'from math import gcd\n\na, b, c, d = map(int, input().split())\nn = c * d // gcd(c,d)\nx = (b // c) - ((a-1) // c)\ny = (b // d...
['Wrong Answer', 'Accepted']
['s327425377', 's877046566']
[9164.0, 9144.0]
[26.0, 28.0]
[181, 187]
p02995
u785134189
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def GCD(a,b):\n if a<b:\n tmp = a\n a = b\n b = tmp\n \n r = a % b\n while (r!=0): \n a = b\n b = r\n r = a % b\n return b\n\n\nA,B,C,D = map(int,input().split())\n\nupperC = int(B / C)\nupperD = int(B / D)\nlowerC = int(A / C)\nlowerD = int(A / D)\n\nnumC = upperC - lowerC\nnumD = upperD - lowe...
['Wrong Answer', 'Accepted']
['s597742989', 's022494757']
[3064.0, 3064.0]
[17.0, 17.0]
[449, 458]
p02995
u785578220
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
[' if x==0:return y\n else:return gcd(y%x,x)\ndef lcm(x,y):\n return x*y//gcd(x,y)\n \na,b,c,d = map(int,input().split())\na -= 1\n# print(gcd(c,d),lcm(c,d))\nba = b - b//c - b//d + b//lcm(c,d)\naa = a - a//c - a//d + a//lcm(c,d)\nprint(ba - aa)', '#####################################\na,b,c,d = map(int,input...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s678968018', 's943679271', 's464538441']
[2940.0, 3064.0, 3060.0]
[17.0, 17.0, 17.0]
[242, 348, 256]
p02995
u790922244
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\ndef lcm(a, b):\n return a * b // gcd (a, b)\n\nA,B,C,D=map(int, input().split())\nCD = lcm(C, D)\n\nc_first = 0\nc_last = 0\nd_first = 0\nd_last = 0\ncd_first = 0\ncd_last = 0\n\nc_first = (A-1) // C\nc_last = B // C\nd_first = (A-1) // D\nd_last = B // ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s473811735', 's623098863', 's154103164']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 18.0]
[666, 680, 668]
p02995
u794910686
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import fractions\na,b,c,d=map(int,input().split())\nx=b-(b//c+b//d-b//(c*d/fractions.gcd(c,d)))\ny=(a-1)-((a-1)//c+(a-1)//d-(a-1)//(c*d/fractions.gcd(c,d)))\n\nprint(int(x-y))', 'def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\ndef lcm(a, b):\n return a * b // gcd (a, b)\n\na,b,c,d=map(int,in...
['Wrong Answer', 'Accepted']
['s424402856', 's124449728']
[5176.0, 3060.0]
[38.0, 18.0]
[170, 251]
p02995
u795323188
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\ndef baisu(x,a):\n return int(x//a)\na,b,c,d = map(int,input().split())\n\nto_a = a - baisu(a,c) - baisu(a,d) + baisu(a,c*d/gcd(c,d))\nto_b = b - baisu(b,c) - baisu(b,d) + baisu(b,c*d/gcd(c,d))\n\nprint(to_a)\nprint(to_b)\n\n\nif a%c == 0 or a%d == 0:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s031384516', 's227942183', 's512502742']
[3064.0, 3064.0, 3060.0]
[17.0, 17.0, 17.0]
[358, 358, 283]
p02995
u798818115
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['# coding: utf-8\n# Your code here!\nimport math\n\nA,B,C,D=map(int,input().split())\nA-=1\nprint(A)\nnum1=A-A//C-A//D+(A//(C*D//math.gcd(C, D)))\nnum2=B-B//C-B//D+(B//(C*D//math.gcd(C, D)))\n\nprint(num1)\nprint(num2)\n\nprint(num2-num1)', '# coding: utf-8\n# Your code here!\nA,B,C,D=map(int,input().split())\nA-=1\n\...
['Runtime Error', 'Accepted']
['s919370698', 's491851397']
[3060.0, 3064.0]
[17.0, 41.0]
[224, 409]
p02995
u801512570
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import fractions\nimport math\n\nA,B,C,D = map(int,input().split())\n\nC_ = len(range(math.ceil(A/C)*C,B+1,C))\nD_ = len(range(math.ceil(A/D)*D,B+1,D))\nCD = (C*D) // fractions.gcd(C, D)\nCD_ = len(range(math.ceil(A/CD)*CD,B+1,CD))\n\nprint(B-A+1-C_-D_+CD_)\n\n', '\ndef gcd(a, b):\n while b:\n a, b = b, a %...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s289999333', 's745328827', 's708180813']
[5044.0, 3064.0, 3064.0]
[35.0, 18.0, 17.0]
[249, 436, 420]
p02995
u807864121
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(m, n):\n while n:\n m, n = n, m % n\n return m\n\ndef lcm(m, n):\n return m * n // gcd(m, n)\n\nA, B, C, D = list(map(int, input().split()))\nlcm = lcm(max(C, D), min(C, D))\nprint((B - A + 1) - (B // C - A // C) - (B // D - A // D) + (B // lcm - A // lcm))', 'def gcd(m, n):\n while n:\n m, n = n, m...
['Wrong Answer', 'Accepted']
['s638874486', 's571467591']
[3064.0, 3064.0]
[18.0, 17.0]
[261, 392]
p02995
u814781830
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\ndef lcm(a, b):\n return a * b / gcd(a, b)\nA, B, C, D = map(int, input().split())\ndiff = B - A\nret = 0\nif C == 1 or D == 1:\n print(0)\nelse:\n ret += diff // C\n if A % C == 0:\n ret += 1\n ret += diff // D\n if...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s210396082', 's362252397', 's597630628']
[3064.0, 3188.0, 3064.0]
[17.0, 18.0, 18.0]
[388, 388, 334]
p02995
u817422853
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\n\nprint("test")', 'a,b,c,d=map(int,input().split())\ndef lcm(x,y):\n return (x*y)//math.gcd(x,y)\nlm=lcm(c,d)\nprint(lm)', 'def gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return(a)\n\na,b,c,d=map(int,input().split())\ncn1=0\ncn2=0\ncn3=0\nan1=0\nan2=0\nan3=0\ncnt=0\nans=0\nlm=(c*d)//gcd(c,d)\n\n\ncn1=...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s077964250', 's545356756', 's281366482']
[2940.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0]
[26, 100, 337]
p02995
u818724291
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a,b,c,d = map(int,input().split())\n\ndef gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\nlcm = c*d//gcd(c,d)\n\nb_num = b - b//c - b//d + b//lcm\na_num = a - a//c - a//d + a//lcm\n\nans = b_num - a_num + 1\n\nprint(ans)\n', 'import math\n\na,b,c,d = map(int,input().split())\n\nlcm = c*d//math.gcd(c,d)...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s019403486', 's183581482', 's455705053', 's814326137', 's232261089']
[2940.0, 3060.0, 3064.0, 3060.0, 3060.0]
[18.0, 18.0, 17.0, 17.0, 17.0]
[222, 182, 273, 262, 234]
p02995
u821432765
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\nA, B, C, D = map(int, input().split())\nL = C * D // gcd(C, D)\nc = B // C - (A - 1) // C\nd = B // D - (A - 1) // D\nl = B // L - (A - 1) // L\n\nprint(A - B + 1 - c - d + l)', 'def gcd(a,b):\n while b:\n a,b=b,a%b\n return a\n\ndef lcm(a,b):\n ret...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s677075852', 's811158343', 's641308972']
[3060.0, 3060.0, 3060.0]
[17.0, 18.0, 17.0]
[227, 187, 227]
p02995
u821712904
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a,b,c,d=map(int,input().split())\nif d>c:\n euclid2,euclid1=c,d\n e1,e2=euclid1,euclid2\n while not euclid2==0:\n euclid1=euclid1%euclid2\n euclid1,euclid2=euclid2,euclid1\n cd=c*d//euclid1\nif c>d:\n euclid2,euclid1=d,c\n e1,e2=euclid1,euclid2\n while not euclid2==0:\n euclid1=euclid1%euclid2\n ...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s367070614', 's370858584', 's546435973', 's881201156', 's126937975']
[3064.0, 3064.0, 3064.0, 3064.0, 3444.0]
[17.0, 17.0, 17.0, 17.0, 21.0]
[491, 316, 470, 416, 482]
p02995
u825378567
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(a,b):\n if a < b:\n a, b = b, a\n while a % b != 0:\n a, b = b, a % b\n return b\ndef main():\n A,B,C,D=map(int,input().split())\n if A%C!=0:\n C_min=A-A%C+C\n else:\n C_min=A\n C_max=B-B%C\n if A%D!=0:\n D_min=A-A%D+D\n else:\n D_min=A\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s134618769', 's215634082', 's274160711', 's321408619', 's531414960', 's542089892', 's715372279', 's876178365', 's945613519', 's947794537', 's984064865', 's755293241']
[3064.0, 3188.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[17.0, 21.0, 17.0, 17.0, 18.0, 17.0, 17.0, 18.0, 18.0, 18.0, 17.0, 18.0]
[577, 691, 575, 366, 665, 680, 611, 552, 614, 435, 594, 586]
p02995
u828261239
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import fractions\na,b,c,d = map(int,input().split())\nli=[]\nfor i in [a-1,b]:\n bc = i//c\n bd = i//d\n gc = c*d / fractions.gcd(c,d)\n cd = i//gc\n li.append(i-(bc+bd-cd))\nprint(int(li[1]-li[0]))', 'from fractions import gcd\na,b,c,d = map(int,input().split())\nli=[]\nfor i in [a-1,b]:\n bc = i//...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s038130054', 's942451926', 's684381612']
[5304.0, 5048.0, 3064.0]
[42.0, 35.0, 17.0]
[204, 203, 268]
p02995
u828766688
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\nimport fractions\nimport numpy\n\nnp.set_printoptions(suppress=True)\n\n\nA,B,C,D = map(int,input().split())\n\nG = C * D / fractions.gcd(C,D)\n\nans = int( B // C - (A-1) // C ) + int(B // D - (A-1) // D) - int(B // G - (A-1) // G)\n\nprint (B - A + 1 - ans)\n', 'import math\nimport fractions\n\n\nA,B,C...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s584998115', 's853135523', 's892054793']
[13608.0, 5428.0, 5076.0]
[157.0, 41.0, 34.0]
[260, 207, 439]
p02995
u832158848
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import math\ndef lcm(a,b):\n A,B=a,b\n while b!=0:\n a,b=b,a%b\n return A*B/a\n\ndef count(a,b,c):\n return b//c-(a-1)//c\n\nA,B,C,D=map(int,input().split())\nC_count = count(A,B,C)\nD_count = count(A,B,D)\nCD_count = count(A,B,lcm(C,D))\nans = B - (A - 1) - (C_count + D_count - CD_count)\nprint("{...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s630787206', 's917627986', 's865205834']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[319, 319, 321]
p02995
u839857256
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import fractions\n\ndef lcm(x, y):\n return (x * y) // fractions.gcd(x, y)\n\n\nif __name__ == "__main__":\n a, b, c, d = map(int, input().split())\n a -= 1\n cnt = b - a\n cnt -= int(b/c) - int(a/c)\n cnt -= int(b/d) - int(a/d)\n l = lcm(c, d)\n cnt += int(b/l) - int(a/l)\n print(cnt)\n', ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s126971520', 's883313421', 's029420672']
[5048.0, 3064.0, 3060.0]
[35.0, 17.0, 19.0]
[300, 422, 315]
p02995
u848427364
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['# coding: utf-8\na, b, c, d = [int(i) for i in input().split()]\nc1 = d if c < d else c\nd1 = c if c < d else d\nwhile d1 != 0:\n e = d1\n d1 = c1 % d1\n c1 = e\ne = c * d / e\na -= 1\ncnt = (b - a) + b // e - a // e - b // c + a // c - b // d + a // d\nprint(cnt)\n', '# coding: utf-8\na, b, c, d = [int(i) f...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s003162962', 's023370406', 's439578680', 's577006786']
[3060.0, 3060.0, 3064.0, 3060.0]
[18.0, 17.0, 17.0, 17.0]
[263, 285, 306, 300]
p02995
u852367841
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['A, B, C, D = map(int, input().split())\n\ndef multiple(X, Y, Z):\n min_z = X // Z + 1\n max_z = Y // Z \n num_z = max_z - min_z + 1\n return num_z \n\ndef gcd(X, Y):\n while Y!= 0:\n X, Y = Y, X % Y\n return X\n\nif C == 1 or D == 1:\n print(0)\nelse:\n num_c = multiple(A, B, C)\n pr...
['Wrong Answer', 'Accepted']
['s465502809', 's609589630']
[3064.0, 3064.0]
[18.0, 17.0]
[476, 597]
p02995
u859987056
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['A,B,C,D = map(int,input().split())\nX = max(C,D)\nY = min(C,D)\ndef gcd(a,b):\n while b!= 0:\n a,b = b,a%b\n return a\nl = C*D/ gcd(X,Y)\ndef f(x):\n return x - (x//C + x//D - x//l)\nans = f(B) - f(A-1)\nprint(ans)', 'A,B,C,D = map(int,input().split())\nX = max(C,D)\nY = min(C,D)\ndef gcd(a,b):\n while b!= 0:\...
['Wrong Answer', 'Accepted']
['s782202917', 's500906081']
[3064.0, 3060.0]
[18.0, 17.0]
[209, 219]
p02995
u860002137
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['A, B, C, D = map(int, input().split())\n\ndef gcd(a, b):\n if (b==0):\n return a\n else:\n return gcd(b, a % b)\n\na, b = map(int, input().split())\n\nprint(a*b // gcd(a, b))\n\nans_c = (B - A) // C\nans_d = (B - A) // D\ni = (B - A) // (C * D // gcd(C, D))\n\nprint(B - A - ans_c - ans_d + i)', 'A...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s176824939', 's711967174', 's881950450', 's194147587']
[3064.0, 3060.0, 3064.0, 3060.0]
[18.0, 18.0, 17.0, 17.0]
[297, 238, 272, 250]
p02995
u864273141
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['A,B,C,D=map(int,input().split())\nif C<D:\n c=C\n d=D\nelse:\n c=D\n d=C\nwhile d%c!=0:\n c,d=d%c,c\n\nout=B//C-(A-1)//C+B//D-(A-1)//D-B//(C*D/c)+(A-1)//(C*D/c)\nans=B-A-out+1\n\nprint(ans)\n', 'A,B,C,D=map(int,input().split())\nif C>D:\n c=D\n d=C\nelse:\n c=C\n d=D\n \nf=B//d\ng=(A-1)//d\nh=B//c\ni=(A-1)/...
['Wrong Answer', 'Accepted']
['s934869023', 's758907866']
[3060.0, 3316.0]
[17.0, 21.0]
[182, 190]
p02995
u866769581
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['#c.py\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n if b == 0:\n return a\n c = a % b\n return gcd(b, c)\ndef lcm(a, b):\n return a * b / gcd(a,b)\na,b,c,d = map(int,input().split())\ncanC = int(b//c) -int((a-1)//c)\ncanD = int(b//d) - int((a-1)//d))\ndbCD = int(b//lcm(c,d)) -int((a-1)//lcm...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s182403642', 's907070147', 's266998769']
[2940.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[347, 348, 347]
p02995
u868418093
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\ndef lcm(a,b):\n return a*b//gcd(a,b)\n\na,b,c,d = map(int,input().split())\ndiv = lcm(c,d)\n\nx_div = a//div\ny_div = b//div\nx_c = a//c\ny_c = b//c\nx_d = a//d\ny_d = b//d\nprint(b-a+1+(y_div-x_div)-(y_c-x_c)-(y_d-x_d))', 'def gcd(a,b):\n while...
['Wrong Answer', 'Accepted']
['s229878507', 's212544483']
[3064.0, 3064.0]
[17.0, 17.0]
[273, 417]
p02995
u879309973
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['def gcd(a, b):\n if a < b:\n a, b = b, a\n return b if a%b == 0 else gcd(b, a%b)\n\ndef solve(a, b, c, d):\n ans = b - a + 1\n for p in [c, d]:\n ans -= b // p - (a-1) // p\n for p in [c*d//gcd(c,d)]:\n ans += b // p - (a-1) // p\n return ans\n\nprint(24, 18, gcd(24, 18))\n\na, ...
['Wrong Answer', 'Accepted']
['s548442109', 's909775875']
[3064.0, 3064.0]
[17.0, 17.0]
[363, 335]
p02995
u882359130
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['A, B, C, D = [int(e) for e in input().split()]\n\nimport math\nG = math.gcd(C, D)\n\nA_B = []\nfor AB in [A-1, B]:\n AB_c = AB // C\n AB_d = AB // D\n AB_g = AB // G\n A_B.append(AB_c + AB_d - AB_g)\ncan_divide = A_B[1] - A_B[0]\nans = (B - (A-1)) - can_divide\nprint(ans)', 'A, B, C, D = [int(e) for e in input()....
['Runtime Error', 'Accepted']
['s984485612', 's919752191']
[3064.0, 3064.0]
[19.0, 17.0]
[263, 365]
p02995
u888337853
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['import sys\n import copy\n \n sys.setrecursionlimit(1000000)\n \n \n # input = sys.stdin.readline\n \n \n \n def GCD(x, y):\n return x if y == 0 else GCD(y, x % y)\n \n \n def LCM(x, y):\n return x // GCD(x, y) * y\n \n \n A, B, C, D = map(int, input().split())\n \n S = B - A + 1\n \n canC = B // C - (A - 1) ...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s006557644', 's105962922', 's110703062', 's921999252', 's763307749']
[2940.0, 14236.0, 5348.0, 13660.0, 13540.0]
[17.0, 172.0, 39.0, 154.0, 164.0]
[478, 1067, 1077, 1068, 1091]
p02995
u889344512
2,000
1,048,576
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.
['a, b, c, d = map(int,input().split())\nimport math\ndef divbyk(k):\n return b//k-(a-1)//k\n\ndef gcd(x,y):\n n = min(x,y)\n m = max(x,y)\n if n == 0:\n return m\n else:\n return gcd(n,m-(m//n)*n)\n\nans = b-a+1-divbyk(c)-divbyk(d)+divbyk(c*d/gcd(c,d))\nprint(ans)', 'a, b, c, d = map(...
['Wrong Answer', 'Accepted']
['s664503028', 's154890940']
[3064.0, 3064.0]
[18.0, 17.0]
[282, 291]