s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s169277116 | p00009 | u706217959 | 1530692856 | Python | Python3 | py | Runtime Error | 0 | 0 | 535 | import
def prime_calc(n):
if n < 2:
return False
else:
i = 2
while n > i:
if n % i == 0:
return False
else:
i += 1
return True
def prime(n):
cnt = 0
for i in range(0, n+1):
ans = prime_calc(i)
if ans is... |
s139759054 | p00009 | u706217959 | 1530693185 | Python | Python3 | py | Runtime Error | 0 | 0 | 788 | import argparse
def prime_calc(n):
if n < 2:
return False
else:
i = 2
while n > i:
if n % i == 0:
return False
else:
i += 1
return True
def prime(n):
cnt = 0
for i in range(0, n+1):
ans = prime_calc(i)
... |
s350167879 | p00009 | u894941280 | 1344960124 | Python | Python | py | Runtime Error | 0 | 1008 | 272 | t =[]
for n in range(2,10000):
for x in range(2,n):
if n % x == 0:
break
else:
t.append(n)
while True:
try:
b=0
a = int(input())
for b in range(10000):
if t[b] > a:
print len(t[0:b])
break
except EOFError:
break |
s133269875 | p00009 | u894941280 | 1345048556 | Python | Python | py | Runtime Error | 0 | 6040 | 262 | t = []
for a in range(2,10000):
for n in range(2,a):
if a % n == 0:
break
else:
t.append(a)
while True:
try:
z = int(input())
for w in range(1000000):
if t[w] > z:
break
print len(t[0:w])
except EOFError:
break |
s678806407 | p00009 | u894941280 | 1345122451 | Python | Python | py | Runtime Error | 0 | 1004 | 266 | t =[]
for n in range(2,10000):
for x in range(2,n):
if n % x == 0:
break
else:
t.append(n)
while True:
try:
a = int(input())
for b in range(100000):
if t[b] >= a:
break
print len((t[0:b]))
except EOFError:
break |
s575702993 | p00009 | u891318575 | 1346517229 | Python | Python | py | Runtime Error | 0 | 5020 | 423 | # -*- coding: utf-8 -*-
while True:
try:
n = int(raw_input())
list1 = range(2, n)
list2 = []
while True:
i = list1.pop(0)
list2.append(i)
for x in list1:
if x % i == 0:
list1.remove(x)
if i**2 > list... |
s637527336 | p00009 | u891318575 | 1346517347 | Python | Python | py | Runtime Error | 0 | 5020 | 482 | # -*- coding: utf-8 -*-
while True:
try:
n = int(raw_input())
if n < 3:
print(0)
continue
list1 = range(2, n)
list2 = []
while True:
i = list1.pop(0)
list2.append(i)
for x in list1:
if x % i == 0:
... |
s991199099 | p00009 | u647766105 | 1350991138 | Python | Python | py | Runtime Error | 0 | 5012 | 288 | import sys
n=10**5
s=[True]*n
s[0]=False
s[1]=False
for x in xrange(2, int(n**0.5)+1):
if s[x]:
for i in xrange(x+x,n,x):
s[i]=False
for x in sys.stdin.readlines():
x=int(x)
cnt=0
for i in xrange(x):
if s[i]:
cnt=cnt+1
print cnt |
s477330240 | p00009 | u647766105 | 1350991886 | Python | Python | py | Runtime Error | 0 | 5012 | 288 | import sys
n=10**5
s=[True]*n
s[0]=False
s[1]=False
for x in xrange(2, int(n**0.5)+1):
if s[x]:
for i in xrange(x+x,n,x):
s[i]=False
for x in sys.stdin.readlines():
a=int(x)
cnt=0
for i in xrange(a):
if s[i]:
cnt=cnt+1
print cnt |
s417080556 | p00009 | u647766105 | 1350991922 | Python | Python | py | Runtime Error | 0 | 5012 | 290 | import sys
n=10**5+1
s=[True]*n
s[0]=False
s[1]=False
for x in xrange(2, int(n**0.5)+1):
if s[x]:
for i in xrange(x+x,n,x):
s[i]=False
for x in sys.stdin.readlines():
a=int(x)
cnt=0
for i in xrange(a):
if s[i]:
cnt=cnt+1
print cnt |
s273490293 | p00009 | u647766105 | 1355063082 | Python | Python | py | Runtime Error | 0 | 5076 | 241 | import sys
n=10**5
p=[1]*n
p[0],p[1]=0,0
for i in xrange(2,int(n**0.5)+1):
if p[i]==1:
for j in xrange(i**2,n,i):
p[j]=0
for i in xrange(2,n):
p[i]+=p[i-1]
for line in sys.stdin.readlines():
print p[int(line)] |
s499220680 | p00009 | u585414111 | 1365444557 | Python | Python | py | Runtime Error | 0 | 0 | 238 | import sys
def f(n):
li = [x for x in range(2,n+1)]
pr = []
while True:
pr.append(li[0])
li = [x for x in li if x%li[0]!=0]
if li[-1]<pr[-1]**2: return pr+li
for n in sys.stdin:
print len(f(int(n))) |
s752816637 | p00009 | u912237403 | 1376789235 | Python | Python | py | Runtime Error | 0 | 0 | 849 | import math
def get_primes(max_number):#return prime list smaller than max_number
if max_number == 2:
return [2]
elif max_number < 3:
return []
numbers=range(1, max_number + 2, 2)
nroot=math.floor(max_number ** 0.5)
n=len(numbers)
numbers[0]=0
for i in range(1, n):... |
s003345443 | p00009 | u511257811 | 1381947632 | Python | Python | py | Runtime Error | 0 | 0 | 299 | import sys
for line in sys.stdin:
count = 0
n = int(line)
nums = range(2, n+1)
while True:
if len(nums) == 1:
count += 1
break
else:
count += 1
nums = [ for x in nums[1:] if x % nums[0] != 0 ]
print count |
s988187479 | p00009 | u511257811 | 1381947922 | Python | Python | py | Runtime Error | 0 | 0 | 355 | import sys
for line in sys.stdin:
count = 0
n = int(line)
nums = range(2, n+1)
while True:
if len(nums) == 1:
count += 1
break
else:
count += 1
m = nums[0]
numsCandidate = [1:]
nums = [ for x in numsCandid... |
s157717712 | p00009 | u511257811 | 1381948494 | Python | Python | py | Runtime Error | 0 | 0 | 404 | import sys
for line in sys.stdin:
count = 0
n = int(line)
nums = range(2, n+1)
while True:
if len(nums) == 0:
break
if len(nums) == 1:
count += 1
break
else:
count += 1
m = nums[0]
numsCandidate = ... |
s216715347 | p00009 | u511257811 | 1382032655 | Python | Python | py | Runtime Error | 0 | 0 | 307 | import math
import sys
nums = [1] * 1000000
nums[:2] = [0,0]
cnt = 0
while cnt <= math.sqrt(n):
flg = nums[cnt]
if flg == 1:
k = 2
while k*cnt <= n:
nums[k*cnt] = 0
k += 1
cnt += 1
for line in sys.stdin:
n = int(line)
print sum(nums[:n+1]) |
s328361170 | p00009 | u674319057 | 1382322805 | Python | Python | py | Runtime Error | 0 | 0 | 415 | #!/usr/bin/env python
def get_pn(num, result):
if num == 1:
return result
else:
for i in range(2,num-1):
if (num % i) == 0:
break
else:
result.append(num)
return get_pn(num-1, result)
if __name__ == "__main__":
while True:
try... |
s102008727 | p00009 | u674319057 | 1382322858 | Python | Python | py | Runtime Error | 0 | 0 | 423 | #!/usr/bin/env python
def get_pn(num, result):
if num == 1:
return result
else:
for i in range(2,num-1):
if (num % i) == 0:
break
else:
result.append(num)
return get_pn(num-1, result)
if __name__ == "__main__":
for i in range(30):
... |
s606990577 | p00009 | u674319057 | 1382322946 | Python | Python | py | Runtime Error | 0 | 0 | 437 | #!/usr/bin/env python
def get_pn(num, result):
if (num == 1 or num == 0):
return result
else:
for i in range(2,num-1):
if (num % i) == 0:
break
else:
result.append(num)
return get_pn(num-1, result)
if __name__ == "__main__":
for i in ... |
s411382551 | p00009 | u674319057 | 1382323028 | Python | Python | py | Runtime Error | 0 | 0 | 425 | #!/usr/bin/env python
def get_pn(num, result):
if (num <= 1):
return result
else:
for i in range(2,num-1):
if (num % i) == 0:
break
else:
result.append(num)
return get_pn(num-1, result)
if __name__ == "__main__":
for i in range(30):
... |
s135046721 | p00009 | u674319057 | 1382323117 | Python | Python | py | Runtime Error | 0 | 0 | 423 | #!/usr/bin/env python
def get_pn(num, result):
if (num <= 1):
return result
else:
for i in range(2,num):
if (num % i) == 0:
break
else:
result.append(num)
return get_pn(num-1, result)
if __name__ == "__main__":
for i in range(30):
... |
s362151391 | p00009 | u245286435 | 1384412860 | Python | Python | py | Runtime Error | 0 | 0 | 350 | def isPrime(num):
flag = True
for i in range(2, num):
if num % i == 0:
flag = False
break
return flag
def countPrime(num):
count = 0
for i in range(2, num+1):
if isPrime(i):
count += 1
return count
if __name__ == '__main__':
nums = []
for num in sys.stdin:
nums.append(int(num))
for num in... |
s802963582 | p00009 | u093607836 | 1384690275 | Python | Python | py | Runtime Error | 0 | 0 | 239 | import sys
rand = random.randint
def prime(n):
if n == 2: return True
if n < 2 or n & 1 == 0: return False
return pow(2, n-1, n) == 1
a = [prime(i) for i in range(1000000)]
for s in sys.stdin:
i = int(s)
print(a[:i+1].count(True)) |
s932853278 | p00009 | u124909914 | 1392355175 | Python | Python | py | Runtime Error | 0 | 0 | 362 | import math
ans = []
while True:
try:
n = int(raw_input())
isPrime = [-1] * (n + 1)
isPrime[0], isPrime[1] = False, False
i = 2
while i * i < n:
for j in range(i, n+i, i):
isPrime[j] = False
isPrime[i] = True
i = isPrime.index(-1)
ans.append(isPrime.count(True) + isPrime.count(-1))
except EO... |
s243087366 | p00009 | u633068244 | 1393352464 | Python | Python | py | Runtime Error | 0 | 0 | 262 | while True:
n = int(raw_input())
filter = [1 for i in range(n)]
filter[0] = 0
for i in range(1:n):
j = 2
while k < n:
k = i*j
filter[k-1] = 0
count = 0
do i in filter:
sum += i
print sum |
s242894424 | p00009 | u633068244 | 1393352522 | Python | Python | py | Runtime Error | 0 | 0 | 368 | while True:
try:
n = int(raw_input())
filter = [1 for i in range(n)]
filter[0] = 0
for i in range(1:n):
j = 2
while k < n:
k = i*j
filter[k-1] = 0
j += 1
count = 0
do i in filter:
sum ... |
s650455368 | p00009 | u633068244 | 1393353410 | Python | Python | py | Runtime Error | 0 | 0 | 423 | while True:
while True:
try:
n = int(raw_input())
filter = [1 for i in range(n)]
filter[0] = 0
for i in range(2,n//2):
j = 2
k = i*j
while k < n:
filter[k-1] = 0
j += 1
k = i*j
print filter
... |
s103520941 | p00009 | u633068244 | 1393353804 | Python | Python | py | Runtime Error | 0 | 0 | 473 | while True:
try:
n = int(raw_input())
filter = [1 for i in range(n)]
filter[0] = 0
for i in range(2,n//2):
if filter[i] = 1
j = 2
k = i*j
while k < n:
filter[k-1] = 0
j += 1
... |
s245054720 | p00009 | u633068244 | 1393353821 | Python | Python | py | Runtime Error | 0 | 0 | 475 | while True:
try:
n = int(raw_input())
filter = [1 for i in range(n)]
filter[0] = 0
for i in range(2,n//2):
if filter[i] == 1:
j = 2
k = i*j
while k < n:
filter[k-1] = 0
j += 1
... |
s749105086 | p00009 | u633068244 | 1393353872 | Python | Python | py | Runtime Error | 0 | 0 | 471 | while True:
try:
n = int(raw_input())
filter = [1 for i in range(n)]
filter[0] = 0
for i in range(2,n//2):
if filter[i] == 1:
j = 2
k = i*j
while k < n:
filter[k-1] = 0
j += 1
... |
s641878696 | p00009 | u633068244 | 1393572657 | Python | Python | py | Runtime Error | 0 | 0 | 316 | import math
r = 999999
sqrt = int(math.sqrt(r))
prime = [1 for i in range(r)]
prime[0] = 0
for i in range(2,r/2):
prime[2*i-1] = 0
for i in range(3,sqrt,2):
for j in range(2*i,r,i)
prime[j] = 0
while True:
try:
n = int(raw_input())
print sum(prime[:n])
except:
break |
s096343074 | p00009 | u633068244 | 1393572945 | Python | Python | py | Runtime Error | 0 | 0 | 305 | import math
r = 999999
sqrt = int(math.sqrt(r))
prime = "1"*r
prime[0] = 0
for i in range(2,r/2):
prime[2*i-1] = 0
for i in range(3,sqrt,2):
for j in range(2*i,r+1,i):
prime[j-1] = 0
while True:
try:
n = int(raw_input())
print sum(prime[:n])
except:
break |
s832941235 | p00009 | u633068244 | 1393572965 | Python | Python | py | Runtime Error | 0 | 0 | 309 | import math
r = 999999
sqrt = int(math.sqrt(r))
prime = "1"*r
prime[0] = 0
for i in range(2,r/2):
prime[2*i-1] = "0"
for i in range(3,sqrt,2):
for j in range(2*i,r+1,i):
prime[j-1] = "0"
while True:
try:
n = int(raw_input())
print sum(prime[:n])
except:
break |
s494548464 | p00009 | u633068244 | 1393572977 | Python | Python | py | Runtime Error | 0 | 0 | 311 | import math
r = 999999
sqrt = int(math.sqrt(r))
prime = "1"*r
prime[0] = "0"
for i in range(2,r/2):
prime[2*i-1] = "0"
for i in range(3,sqrt,2):
for j in range(2*i,r+1,i):
prime[j-1] = "0"
while True:
try:
n = int(raw_input())
print sum(prime[:n])
except:
break |
s520063673 | p00009 | u633068244 | 1393574104 | Python | Python | py | Runtime Error | 0 | 0 | 445 | ----:---F1 *scratch* All L1 (Fundamental)------------------------------------------------------------------------------------
Loading subst-jis...done
import math
r = 999999
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*(i+1)-1,r,i+1... |
s625227796 | p00009 | u633068244 | 1393672642 | Python | Python | py | Runtime Error | 0 | 0 | 283 | import math
while True:
try:
n.append(int(raw_input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
for i in n:
print sum(p[:i]) |
s080727649 | p00009 | u633068244 | 1393676445 | Python | Python | py | Runtime Error | 0 | 0 | 288 | import math
n = []
while True:
try:
n.append(int(raw_input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
p[2*i+1::i+1] = range(2*i+1,r,i+1):
for i in n:
print sum(p[:i]) |
s970051253 | p00009 | u633068244 | 1393676473 | Python | Python | py | Runtime Error | 0 | 0 | 296 | import math
n = []
while True:
try:
n.append(int(raw_input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
p[2*i+1::i+1] = [0 for range(2*i+1,r,i+1)]:
for i in n:
print sum(p[:i]) |
s820984870 | p00009 | u633068244 | 1393676508 | Python | Python | py | Runtime Error | 0 | 0 | 293 | import math
n = []
while True:
try:
n.append(int(raw_input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
p[2*i+1::i+1] = [0 for range(2*i+1,r,i+1)]
for i in n:
print sum(p[:i]) |
s383093190 | p00009 | u633068244 | 1393676580 | Python | Python | py | Runtime Error | 0 | 0 | 289 | import math
n = []
while True:
try:
n.append(int(raw_input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
p[2*i+1::i+1] = [0]*range(2*i+1,r,i+1)
for i in n:
print sum(p[:i]) |
s060395458 | p00009 | u858885710 | 1393855129 | Python | Python | py | Runtime Error | 0 | 0 | 239 | import sys
ifprime = [1]*(1000000)
ifprime[0] = ifprime[1] = 0
a = 2
while a <= num:
if ifprime[a]:
ans += 1
b = a*a
while b <= num:
ifprime[b] = 0
b += a
a += 1
for n in sys.stdin:
print sum(ifprime[:int(n)]) |
s702221446 | p00009 | u193025715 | 1395307556 | Python | Python | py | Runtime Error | 0 | 0 | 389 | import math
val = []
max_prime = 0
while True:
num = int(raw_input())
tmp = [i+1 for i in range(1, num)]
x = math.sqrt(num)
if len(val) != 0:
max_prime = val[-1]
tmp = tmp[max_prime-1:]
print tmp
for i in tmp:
if i > x: break
for j in range(2,num):
if i*j > num: break
if i*j in tmp: tmp.remove(i*... |
s455093910 | p00009 | u633068244 | 1395996155 | Python | Python | py | Runtime Error | 0 | 0 | 177 | def isPrime(p):
if p == 2: return 1
if p < 2 or p&1 == 0: return 0
return 1 if pow(2,p-1,p) == 1 else 0
n = int(raw_input())
print sum(isPrime(int(i) for i in range(1,n+1)) |
s567473364 | p00009 | u633068244 | 1395996236 | Python | Python | py | Runtime Error | 0 | 0 | 194 | def isPrime(p):
if p == 2: return 1
if p < 2 or p&1 == 0: return 0
return 1 if pow(2,p-1,p) == 1 else 0
while True:
try:
n = int(raw_input())
print sum(isPrime(i) for i in range(1,n+1)) |
s578211264 | p00009 | u992434746 | 1401842270 | Python | Python3 | py | Runtime Error | 0 | 0 | 616 | # coding: utf-8
import sys
import math
if __name__ == '__main__':
input_list = sys.stdin.readlines()
for num in input_list:
target_number = int(num.replace('\n', ''))
serial_number_list = [r for r in range(2, target_number + 1)]
multiple_list = []
while math.sqrt(target_number) >= serial_number_list[0]:
... |
s588522487 | p00009 | u992434746 | 1401842458 | Python | Python3 | py | Runtime Error | 0 | 0 | 637 | # coding: utf-8
import sys
import math
if __name__ == '__main__':
input_list = sys.stdin.readlines()
for num in input_list:
target_number = int(num.replace('\n', ''))
serial_number_list = [r for r in range(2, target_number + 1)]
multiple_list = []
while math.sqrt(target_number) >= serial_number_list[0]:
... |
s737736396 | p00009 | u992434746 | 1401842611 | Python | Python3 | py | Runtime Error | 0 | 0 | 642 | # coding: utf-8
import sys
import math
if __name__ == '__main__':
input_list = sys.stdin.readlines()
for num in input_list:
target_number = int(num.replace('\n', ''))
serial_number_list = [r for r in range(2, target_number + 1)]
multiple_list = []
while math.sqrt(target_number) >= serial_number_list[0]:
... |
s541923543 | p00009 | u992434746 | 1401875803 | Python | Python3 | py | Runtime Error | 0 | 0 | 761 | import math
def sieve_of_erastosthenes(target_list):
for num in target_list:
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)... |
s169099360 | p00009 | u992434746 | 1401876232 | Python | Python3 | py | Runtime Error | 0 | 0 | 697 | import math
def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)
for serial in range(3, num, 2):
... |
s598956866 | p00009 | u992434746 | 1401958316 | Python | Python3 | py | Runtime Error | 0 | 0 | 666 | import math
def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)
for serial in range(3, num, 2):
... |
s326236620 | p00009 | u992434746 | 1401958508 | Python | Python3 | py | Runtime Error | 0 | 0 | 701 | import math
def sieve_of_erastosthenes(num):
if 2 >= num:
return 1
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)
for... |
s988089281 | p00009 | u992434746 | 1401958831 | Python | Python3 | py | Runtime Error | 0 | 0 | 721 | import math
def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)
for serial in range(3, num, 2):
... |
s963301506 | p00009 | u992434746 | 1401959881 | Python | Python3 | py | Runtime Error | 0 | 0 | 456 | input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)
for serial in range(3, num, 2):
if serial >= sqrt:
return input_... |
s772256971 | p00009 | u992434746 | 1402111184 | Python | Python3 | py | Runtime Error | 0 | 0 | 690 | def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
for serial in range(3, int(num ** 0.5) + 1, 2):
if input_list[serial]... |
s648969203 | p00010 | u995990363 | 1530789227 | Python | Python3 | py | Runtime Error | 0 | 0 | 588 | import math
def run():
n = int(input())
for _ in range(n):
x1, y1, x2, y2, x3, y3 = list(map(float, input().split()))
u1 = (x1-x3)*(x2-x1)*(x3-x2)
u2 = (x2-x1)*(y3-y2)*(y3+y2)
u3 = (x3-x2)*(y2-y1)*(y2+y1)
v = x1*x2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 + x3*y2
Py = (-u... |
s701534005 | p00010 | u319725914 | 1534986400 | Python | Python3 | py | Runtime Error | 0 | 0 | 1070 | #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#includ... |
s521544017 | p00010 | u244742296 | 1409819739 | Python | Python3 | py | Runtime Error | 0 | 0 | 1599 | import cmath
class Point(object):
def __init__(self, x, y):
self.point = complex(x, y)
def __str__(self):
return "x = {0}, y = {1}".format(self.point.real, self.point.imag)
class Triangle(Point):
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
... |
s065758709 | p00010 | u244742296 | 1409819859 | Python | Python3 | py | Runtime Error | 0 | 0 | 1624 | # -*- coding: utf-8 -*-
import cmath
class Point(object):
def __init__(self, x, y):
self.point = complex(x, y)
def __str__(self):
return "x = {0}, y = {1}".format(self.point.real, self.point.imag)
class Triangle(Point):
def __init__(self, a, b, c):
self.a = a
self.b = b
... |
s557884869 | p00010 | u244742296 | 1409819942 | Python | Python3 | py | Runtime Error | 0 | 0 | 1511 | # -*- coding: utf-8 -*-
import cmath
class Point(object):
def __init__(self, x, y):
self.point = complex(x, y)
def __str__(self):
return "x = {0}, y = {1}".format(self.point.real, self.point.imag)
class Triangle(Point):
def __init__(self, a, b, c):
self.a = a
self.b = b
... |
s033707512 | p00010 | u244742296 | 1409824731 | Python | Python3 | py | Runtime Error | 0 | 0 | 1624 | # -*- coding: utf-8 -*-
import cmath
class Point(object):
def __init__(self, x, y):
self.point = complex(x, y)
def __str__(self):
return "x = {0}, y = {1}".format(self.point.real, self.point.imag)
class Triangle(Point):
def __init__(self, a, b, c):
self.a = a
self.b = b
... |
s988774061 | p00010 | u772921135 | 1417035034 | Python | Python | py | Runtime Error | 0 | 0 | 412 | # coding: UTF-8
# main.py
import math
t = map(int,raw_input().split())
for i in xrange(0,t[0]):
x1,x2,x3,y1,y2,y3 = map(float,raw_input().split())
a = x1-x2
b = y1-y2
c = -(x1*x1 + y1*y1 - x2*x2 - y2*y2)
d = x2-x3
e = y2-y3
f = -(x2*x2 + y2*y2 - x3*x3 - y3*y3)
l = (c*e - b*f)/(a*e - b*d)
m = (d*c - a*f)/(d*b ... |
s911095464 | p00010 | u567380442 | 1424177241 | Python | Python3 | py | Runtime Error | 0 | 0 | 729 | import sys
def take2(iterable):
while True:
yield next(iterable), next(iterable)
#外積
def cross(v1, v2):
return v1.real * v2.imag - v1.imag * v2.real
# 線分13と線分24の交点を求める
def get_intersection(p1,p2,p3,p4):
a1 = p4 - p2
b1 = p2 - p3
b2 = p1 - p2
s1 = cross(a1, b2) / 2
s2 = cross(a1, b1)... |
s314705763 | p00010 | u540744789 | 1425718881 | Python | Python | py | Runtime Error | 0 | 0 | 706 | import math
for i in range(input()):
x1,y1,x2,y2,x3,y3=map(float,raw_input().split(" "))
if y2==y1 or y3==y1:
if y2==y1:
a2=-(x2-x1)/(y3-y1)
b2=((y3+y1)-a2*(x1+x3))/2
a,b,c,d,e,f,=1,0,(x1+x2)/2,1,-a2,b2
else:
a1=-(x2-x1)/(y2-y1)
b1=((y2... |
s508923881 | p00010 | u540744789 | 1425719262 | Python | Python | py | Runtime Error | 0 | 0 | 706 | import math
for i in range(input()):
x1,y1,x2,y2,x3,y3=map(float,raw_input().split(" "))
if y2==y1 or y3==y1:
if y2==y1:
a2=-(x3-x1)/(y3-y1)
b2=((y3+y1)-a2*(x1+x3))/2
a,b,c,d,e,f,=0,1,(x1+x2)/2,-a2,1,b2
else:
a1=-(x2-x1)/(y2-y1)
b1=((y2... |
s585418388 | p00010 | u540744789 | 1425719649 | Python | Python | py | Runtime Error | 0 | 0 | 703 | import math
for i in range(input()):
x1,y1,x2,y2,x3,y3=map(float,raw_input().split(" "))
if y2==y1 or y3==y1:
if y2==y1:
a2=-(x3-x1)/(y3-y1)
b2=((y3+y1)-a2*(x1+x3))/2
a,b,c,d,e,f=0,1,(x1+x2)/2,-a2,1,b2
else:
a1=-(x2-x1)/(y2-y1)
b1=((y2+... |
s784666888 | p00010 | u379956761 | 1434726644 | Python | Python3 | py | Runtime Error | 0 | 0 | 568 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
import math
n = int(input())
for data in sys.stdin:
if n <= 0:
break
n--
x1, y1, x2, y2, x3, y3 = map(float, data.split())
a1 = x2 - x1
b1 = y2 - y1
a2 = x3 - x1
b2 = y3 - y1
px = (b2 * (a1 * a1 + b1 * b1) - b1 * (a2 * a2 ... |
s322827297 | p00010 | u722431421 | 1439541980 | Python | Python | py | Runtime Error | 0 | 0 | 494 | # coding: utf-8
#Problem Name: Circumscrived Circle of a Triangle
#ID: tabris
#Mail: t123037@kaiyodai.ac.jp
n = int(raw_input())
data = [0 for _ in range(n)]
for i in range(n):
data[i] = map(float,raw_input().split(' '))
for (x1,y1,x2,y2,x3,y3) in data:
det = 4*x2*y3 - 4*y2*x3
px = ((x2**2 + y2**2)*2*y3 - ... |
s955385463 | p00010 | u560214129 | 1450423270 | Python | Python3 | py | Runtime Error | 0 | 0 | 476 | import math
n = int(input())
i = 0
while i < n:
x1, y1, x2, y2, x3, y3 = map(float,input().split())
a = x2 - x1
b = y2 - y1
c = x3 - x1
d = y3 - y1
e = a * (x1 + x2) + b * (y1 + y3)
f = c * (x1 + x2) + d * (y1 + y3)
g = 2.0 * (a * (y3 - y2) - b * (x3 - x2))
if g == 0:
exit()
px = (d... |
s748816088 | p00010 | u650459696 | 1456727214 | Python | Python3 | py | Runtime Error | 0 | 0 | 578 | def circum(x1,x2,x3,y1,y2,y3):
a1 = 2 * (x2 - x1)
b1 = 2 * (y2 - y1)
c1 = x1 ** 2 - x2 ** 2 + y1 **2 - y2 ** 2
a2 = 2 * (x3 - x1)
b2 = 2 * (y3 - y1)
c2 = x1 ** 2 - x3 ** 2 + y1 **2 - y3 ** 2
X = (b1 * c2 - b2 * c1)/(a1 * b2 - a2 * b1)
Y = (c1 * a2 - c2 * a1)/(a1 * b2 - a2 * b1)
R = (... |
s564589367 | p00010 | u915343634 | 1459349526 | Python | Python3 | py | Runtime Error | 0 | 0 | 485 | import sys
import math
if sys.version_info[0] >= 3:
raw_input = input
N = int(raw_input())
for i in range(N):
x1, y1, x2, y2, x3, y3 = [float(e) for e in raw_input().split()]
a1 = 2*x2 - 2*x1
b1 = 2*y2 - 2*y1
c1 = x1**2 - x2**2 + y1**2 - y2**2
a2 = 2 * x3 - 2 * y1
b2 = 2 * y3 - 2 * y1
c... |
s745746882 | p00010 | u966364923 | 1460036436 | Python | Python3 | py | Runtime Error | 0 | 0 | 1629 | def perpendicular_bisector(p, q):
x = (q[0] - p[0])
y = (q[1] - p[1])
return (2 * x, 2 * y, -x**2 - y**2)
def gauss_jordan_elimination(Array):
# N???M??????Array
N = len(Array)
if N == 0:
return (True, Array)
else:
M = len(Array[0])
A = []
for i in range(len(Array)... |
s465297109 | p00010 | u146816547 | 1469285189 | Python | Python | py | Runtime Error | 0 | 0 | 488 | import math
n = int(raw_input())
for i in range(n):
x1, y1, x2, y2, x3, y3 = map(int, raw_input().split())
px = ((y2 - y3)*(x1*x1 + y1*y1) + (y3 - y1)*(x2*x2 + y2*y2) + (y1 - y2)*(x3*x3 + y3*y3))/(2*(x1*(y2 - y3) + x2*(y3 - y1) + x3*(y1 - y2)))
py = ((x2 - x3)*(x1*x1 + y1*y1) + (x3 - x1)*(x2*x2 + y2*y2) + (x1... |
s976251197 | p00010 | u146816547 | 1469285290 | Python | Python | py | Runtime Error | 0 | 0 | 488 | import math
n = int(raw_input())
for i in range(n):
x1, y1, x2, y2, x3, y3 = map(int, raw_input().split())
px = ((y2 - y3)*(x1*x1 + y1*y1) + (y3 - y1)*(x2*x2 + y2*y2) + (y1 - y2)*(x3*x3 + y3*y3))/(2*(x1*(y2 - y3) + x2*(y3 - y1) + x3*(y1 - y2)))
py = ((x2 - x3)*(x1*x1 + y1*y1) + (x3 - x1)*(x2*x2 + y2*y2) + (x1... |
s518084268 | p00010 | u813534019 | 1477494834 | Python | Python | py | Runtime Error | 0 | 0 | 494 | import math
x1=0
y1=1
x2=2
y2=3
x3=4
y3=5
n = input()
for _ in xrange(n):
p = map(float, raw_input().split())
A = p[x1]**2 - p[x2]**2 + p[y1]**2 - p[y2]**2
B = 2*p[x1] - 2*p[x2]
C = 2*p[y1] - 2*p[y2]
D = p[x1]**2 - p[x3]**2 + p[y1]**2 - p[y3]**2
E = 2*p[x1] - 2*p[x3]
F = 2*p[y1] - 2*p[y3]
... |
s841143812 | p00010 | u776559258 | 1477560284 | Python | Python3 | py | Runtime Error | 0 | 0 | 211 | import math
n=int(input())
for i in range(n):
x1,y1,x2,y2,x3,y3=[int(i) for i in input().split()]
px=(x1+x2+x3)/3
py=(y1+y2+y3)/3
r=math.sqrt((x1-px)**2+(y1-py)**2)
print(round(px,3),round(py,3),round(r,3)) |
s412278712 | p00010 | u776559258 | 1477560503 | Python | Python3 | py | Runtime Error | 0 | 0 | 220 | import math
n=int(input())
for i in range(n):
x1,y1,x2,y2,x3,y3=[int(i) for i in input().split()]
p_x=(x1+x2+x3)/3
p_y=(y1+y2+y3)/3
r=math.sqrt((x1-p_x)**2+(y1-p_y)**2)
print(round(p_x,3),round(p_y,3),round(r,3)) |
s899926985 | p00010 | u776559258 | 1477560544 | Python | Python3 | py | Runtime Error | 0 | 0 | 220 | import math
n=int(input())
for i in range(n):
x1,y1,x2,y2,x3,y3=[int(j) for j in input().split()]
p_x=(x1+x2+x3)/3
p_y=(y1+y2+y3)/3
r=math.sqrt((x1-p_x)**2+(y1-p_y)**2)
print(round(p_x,3),round(p_y,3),round(r,3)) |
s115789405 | p00010 | u776559258 | 1477560612 | Python | Python3 | py | Runtime Error | 0 | 0 | 222 | import math
n=int(input())
for i in range(n):
(x1,y1,x2,y2,x3,y3)=[int(j) for j in input().split()]
p_x=(x1+x2+x3)/3
p_y=(y1+y2+y3)/3
r=math.sqrt((x1-p_x)**2+(y1-p_y)**2)
print(round(p_x,3),round(p_y,3),round(r,3)) |
s226022657 | p00010 | u776559258 | 1477560717 | Python | Python3 | py | Runtime Error | 0 | 0 | 222 | import math
n=int(input())
for i in range(n):
x1,y1,x2,y2,x3,y3=[float(i) for i in input().split()]
p_x=(x1+x2+x3)/3
p_y=(y1+y2+y3)/3
r=math.sqrt((x1-p_x)**2+(y1-p_y)**2)
print(round(p_x,3),round(p_y,3),round(r,3)) |
s416847749 | p00010 | u776559258 | 1477560755 | Python | Python3 | py | Runtime Error | 0 | 0 | 226 | import math
n=int(input())
for i in range(n):
x1,y1,x2,y2,x3,y3=[float(i) for i in input().split()]
p_x=(x1+x2+x3)/3.0
p_y=(y1+y2+y3)/3.0
r=math.sqrt((x1-p_x)**2+(y1-p_y)**2)
print(round(p_x,3),round(p_y,3),round(r,3)) |
s325666559 | p00010 | u149199817 | 1478146799 | Python | Python3 | py | Runtime Error | 0 | 0 | 1425 | # -*- coding: utf-8 -*-
import sys
def length(a, b):
return ((a[0] - b[0])**2 + (a[1] - b[1])**2)**0.5
def solve_sim_equ(a, b, c, d, e, f):
'''
From Problem 0004.
This function solves following equation.
ax + by = c
dx + ey = f
'''
if a==0 and d==0:
if b==0 and e==0:
... |
s305419532 | p00010 | u149199817 | 1478146830 | Python | Python3 | py | Runtime Error | 0 | 0 | 1425 | # -*- coding: utf-8 -*-
import sys
def length(a, b):
return ((a[0] - b[0])**2 + (a[1] - b[1])**2)**0.5
def solve_sim_equ(a, b, c, d, e, f):
'''
From Problem 0004.
This function solves following equation.
ax + by = c
dx + ey = f
'''
if a==0 and d==0:
if b==0 and e==0:
... |
s110186981 | p00010 | u252368621 | 1479000112 | Python | Python3 | py | Runtime Error | 0 | 0 | 591 | import math
deta=[float(i) for i in input().split()]
h1=math.sqrt((deta[2]-deta[0])**2+(deta[3]-deta[1])**2)
h2=math.sqrt((deta[4]-deta[2])**2+(deta[5]-deta[3])**2)
h3=math.sqrt((deta[0]-deta[4])**2+(deta[1]-deta[5])**2)
sub=(h1+h2+h3)/2
s=math.sqrt(sub*(sub-h1)*(sub-h2)*(sub-h3))
sum=((h1*h2*h3)/s)/4
a=2*deta[2]-2*de... |
s024682548 | p00010 | u011621222 | 1490023512 | Python | Python | py | Runtime Error | 0 | 0 | 413 | from math import sqrt
n=input()
for i in range(n):
x1,y1,x2,y2,x3,y3=map(float,raw_input().split())
A1=2*(x2-x1)
B1=2*(y2-y1)
C1=x2**2+y2**2-x1**2-y1**2
x=((C1*B2)-(C2*B1))/((A1*B2)-(A2*B1))
y=((A1*C2)-(A2*C1))/((A1*B2)-(A2*B1))
a=sqrt((x2-x1)**2+(y2-y1)**2)
b=sqrt((x3-x1)**2+(y3-y1)**2)
c=sqrt((x3-x2)**2+(y3-... |
s742648167 | p00010 | u011621222 | 1490023638 | Python | Python | py | Runtime Error | 0 | 0 | 234 | from math import sqrt
n=input()
for i in range(n):
x1,y1,x2,y2,x3,y3=map(float,raw_input().split())
A1=2*(x2-x1)
B1=2*(y2-y1)
C1=x2**2+y2**2-x1**2-y1**2
x=((C1*B2)-(C2*B1))/((A1*B2)-(A2*B1))
y=((A1*C2)-(A2*C1))/((A1*B2)-(A2*B1)) |
s424874268 | p00010 | u011621222 | 1490023736 | Python | Python | py | Runtime Error | 0 | 0 | 218 | from math import sqrt
n=input()
for i in range(n):
x1,y1,x2,y2,x3,y3=map(float,raw_input().split())
A1=2*(x2-x1)
B1=2*(y2-y1)
C1=x2**2+y2**2-x1**2-y1**2
A2=2*(x3-x2)
B2=2*(y3-y2)
C2=x3**2+y3**2-x2**2-y2**2 |
s372109148 | p00010 | u797673668 | 1490620798 | Python | Python3 | py | Runtime Error | 0 | 0 | 623 | import fractions
def calc(x1, y1, x2, y2):
return 2 * (x2 - x1), 2 * (y2 - y1), x2 ** 2 + y2 ** 2 - x1 ** 2 - y1 ** 2
n = int(input())
for _ in range(n):
x1, y1, x2, y2, x3, y3 = map(float, input().split())
cx1, cy1, z1 = calc(x1, y1, x2, y2)
cx2, cy2, z2 = calc(x1, y1, x3, y3)
print(cx1, cy1, z... |
s765675391 | p00010 | u797673668 | 1490620884 | Python | Python3 | py | Runtime Error | 0 | 0 | 585 | import fractions
def calc(x1, y1, x2, y2):
return 2 * (x2 - x1), 2 * (y2 - y1), x2 ** 2 + y2 ** 2 - x1 ** 2 - y1 ** 2
n = int(input())
for _ in range(n):
x1, y1, x2, y2, x3, y3 = map(float, input().split())
cx1, cy1, z1 = calc(x1, y1, x2, y2)
cx2, cy2, z2 = calc(x1, y1, x3, y3)
gcd = fractions.g... |
s066672060 | p00010 | u868716420 | 1493773116 | Python | Python3 | py | Runtime Error | 0 | 0 | 706 | from math import sqrt
for _ in range(int(input())) :
x1, y1, x2, y2, x3, y3 = [float(temp) for temp in input().split()]
a = [x1, y1, (x1 ** 2) + (y1 ** 2)]
b = [x2, y2, (x2 ** 2) + (y2 ** 2)]
c = [x3, y3, (x3 ** 2) + (y3 ** 2)]
a1 = [(b[0] - a[0]), (b[1] - a[1]), (b[2] - a[2])]
b1 = [(c[0] - a[... |
s655692986 | p00010 | u957021183 | 1504763070 | Python | Python3 | py | Runtime Error | 0 | 0 | 985 | # Aizu Problem 0010: Circumscribed Circle of a Triangle
#
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
def circumscribed_circle(x1, y1, x2, y2, x3, y3):
d = 2 * (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2))
px = ( (x1... |
s842545166 | p00010 | u395334793 | 1505643997 | Python | Python | py | Runtime Error | 0 | 0 | 305 | for _ in [0]*int(input()):
a,d,b,e,c,f=map(float,input().split())
z=2*(b*f-c*e+c*d-a*f+a*e-b*d)
x=((e-f)*(a**2+d**2)+(f-d)*(b**2+e**2)+(d-e)*(c**2+f**2))/z
y=((c-b)*(a**2+d**2)+(a-c)*(b**2+e**2)+(b-a)*(c**2+f**2))/z
print('{0:.3f} {1:.3f} {2:.3f}'.format(x,y,((a-x)**2+(d-y)**2)**0.5)) |
s386945215 | p00010 | u933096856 | 1505825731 | Python | Python3 | py | Runtime Error | 0 | 0 | 235 | for i in range(n):
x1,y1,x2,y2,x3,y3=map(float, input().split())
x4,y4=0.5*(x2+x3), 0.5*(y2+y3)
xg,yg=2/3*(2*x1+x4), 2/3*(2*y1+y4)
xo,yo=(x1+x2+x3)/3, (y1+y2+y3)/3
r=((xo-x1)**2+(yo-y1)**2)**0.5
print(xg, yg, r) |
s456535820 | p00010 | u548155360 | 1512388589 | Python | Python3 | py | Runtime Error | 0 | 0 | 1911 | # coding=utf-8
import math
if __name__ == '__main__':
n = int(input())
for i in range(n):
x1, y1, x2, y2, x3, y3 = map(float, input().split())
points_list = [[x1, y1], [x2, y2], [x3, y3]]
points_list.sort()
print(points_list)
if points_list[0][0] == points_list[1][0]:
... |
s815708549 | p00010 | u548155360 | 1512388703 | Python | Python3 | py | Runtime Error | 0 | 0 | 1909 | # coding=utf-8
import math
if __name__ == '__main__':
n = int(input())
for i in range(n):
x1, y1, x2, y2, x3, y3 = map(float, input().split())
points_list = [[x1, y1], [x2, y2], [x3, y3]]
points_list.sort()
print(points_list)
if points_list[0][0] == points_list[1][0]:
... |
s856122872 | p00010 | u548155360 | 1512388745 | Python | Python3 | py | Runtime Error | 0 | 0 | 1882 | # coding=utf-8
import math
if __name__ == '__main__':
n = int(input())
for i in range(n):
x1, y1, x2, y2, x3, y3 = map(float, input().split())
points_list = [[x1, y1], [x2, y2], [x3, y3]]
points_list.sort()
if points_list[0][0] == points_list[1][0]:
py = (points_li... |
s024542183 | p00010 | u548155360 | 1512394837 | Python | Python3 | py | Runtime Error | 0 | 0 | 2200 | # coding=utf-8
import math
if __name__ == '__main__':
n = int(input())
for i in range(n):
x1, y1, x2, y2, x3, y3 = map(float, input().split())
points_list = [[x1, y1], [x2, y2], [x3, y3]]
points_list.sort()
if points_list[0][0] == points_list[1][0]:
py = (points_li... |
s209276934 | p00010 | u150984829 | 1516781312 | Python | Python3 | py | Runtime Error | 0 | 0 | 270 | for _ in[0]*int(input()):
a,b,c,d,e,f=map(int,input().split())
x=((a*a+b*b)*(d-f)+(c*c+d*d)*(f-b)+(e*e+f*f)*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
y=((a*a+b*b)*(c-d)+(c*c+d*d)*(e-a)+(e*e+f*f)*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
print(f"{x:.4} {y:.4} {(x*x+y*y)**.5:.4}")
|
s645411869 | p00010 | u150984829 | 1516782443 | Python | Python3 | py | Runtime Error | 0 | 0 | 282 | for _ in[0]*int(input()):
a,b,c,d,e,f=map(float,input().split())
x=((a*a+b*b)*(d-f)+(c*c+d*d)*(f-b)+(e*e+f*f)*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
y=((a*a+b*b)*(c-e)+(c*c+d*d)*(e-a)+(e*e+f*f)*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
print('.3f %.3f %.3f'%(x,y,((x-a)**2+(y-b)**2)**.5))
|
s493329395 | p00010 | u150984829 | 1516782714 | Python | Python3 | py | Runtime Error | 0 | 0 | 275 | import math
for _ in[0]*int(input()):
a,b,c,d,e,f=map(float,input().split())
s,t,u=a*a+b*b,c*c+d*d,e*e+f*f
x=(s*(d-f)+t*(f-b)+u*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
y=(s*(c-e)+t*(e-a)+u*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
print('%.3f %.3f %.3f'%(x,y,math.hypot(x-a,y-b)))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.