1+ #!usr/bin/env python3
2+ from collections import defaultdict , deque , Counter , OrderedDict
3+ from bisect import bisect_left , bisect_right
4+ from functools import reduce , lru_cache
5+ from heapq import heappush , heappop , heapify
6+
7+ import itertools
8+ import math , fractions
9+ import sys , copy
10+
11+ def L (): return sys .stdin .readline ().split ()
12+ def I (): return int (sys .stdin .readline ().rstrip ())
13+ def SL (): return list (sys .stdin .readline ().rstrip ())
14+ def LI (): return [int (x ) for x in sys .stdin .readline ().split ()]
15+ def LI1 (): return [int (x ) - 1 for x in sys .stdin .readline ().split ()]
16+ def LS (): return [list (x ) for x in sys .stdin .readline ().split ()]
17+ def R (n ): return [sys .stdin .readline ().strip () for _ in range (n )]
18+ def LR (n ): return [L () for _ in range (n )]
19+ def IR (n ): return [I () for _ in range (n )]
20+ def LIR (n ): return [LI () for _ in range (n )]
21+ def LIR1 (n ): return [LI1 () for _ in range (n )]
22+ def SLR (n ): return [SL () for _ in range (n )]
23+ def LSR (n ): return [LS () for _ in range (n )]
24+
25+ def perm (n , r ): return math .factorial (n ) // math .factorial (r )
26+ def comb (n , r ): return math .factorial (n ) // (math .factorial (r ) * math .factorial (n - r ))
27+
28+ def make_list (n , * args , default = 0 ): return [make_list (* args , default = default ) for _ in range (n )] if args else [default for _ in range (n )]
29+
30+ dire = [[1 , 0 ], [0 , 1 ], [- 1 , 0 ], [0 , - 1 ]]
31+ dire8 = [[1 , 0 ], [1 , 1 ], [0 , 1 ], [- 1 , 1 ], [- 1 , 0 ], [- 1 , - 1 ], [0 , - 1 ], [1 , - 1 ]]
32+ alphabets = "abcdefghijklmnopqrstuvwxyz"
33+ ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
34+ MOD = 1000000007
35+ INF = float ("inf" )
36+
37+ sys .setrecursionlimit (1000000 )
38+
39+ def main ():
40+ N = I ()
41+ XY = LIR (N )
42+
43+ right_angled , obtuse = 0 , 0
44+ epsilon = pow (10 , - 10 )
45+
46+ total_acute , total_right_angled = 0 , 0
47+ for x , y in XY :
48+ theta1 = sorted ([math .atan2 (yi - y , xi - x ) for xi , yi in XY if (x != xi ) or (y != yi )])
49+ theta2 = [x + 2 * math .pi for x in theta1 ]
50+ theta = theta1 + theta2
51+
52+ acute , right_angled = 0 , 0
53+ left = 0
54+ for right in range (len (theta1 ), len (theta )):
55+ while theta [right ] - theta [left ] - math .pi / 2 > epsilon :
56+ left += 1
57+ acute += right - left
58+ if abs ((theta [right ] - theta [left ]) - math .pi / 2 ) < epsilon :
59+ right_angled += 1
60+ total_acute += acute
61+ total_right_angled += right_angled
62+
63+ print (N * (N - 1 )* (N - 2 )// 6 - (N * (N - 1 )* (N - 2 )// 2 - total_acute ) - total_right_angled , total_right_angled , N * (N - 1 )* (N - 2 )// 2 - total_acute )
64+
65+ if __name__ == '__main__' :
66+ main ()
0 commit comments