using
System;
using
System.Collections.Generic;
class
GFG
{
static
void
numberOfPairs(
int
[] a,
int
[] b,
int
[] c,
int
N)
{
int
count = 0;
int
Tot = 0;
Dictionary<
string
, HashSet<
int
> > LineMap
=
new
Dictionary<
string
, HashSet<
int
> >();
for
(
int
i = 0; i < N; i++) {
string
Slope = Convert.ToString(a[i]) +
"#"
+ Convert.ToString(b[i]);
if
(!LineMap.ContainsKey(Slope)
|| !LineMap[Slope].Contains(c[i])) {
Tot = Tot + 1;
if
(!LineMap.ContainsKey(Slope)) {
HashSet<
int
> h1 =
new
HashSet<
int
>();
h1.Add(c[i]);
LineMap[Slope] = h1;
}
else
{
HashSet<
int
> h1 = LineMap[Slope];
h1.Add(c[i]);
LineMap[Slope] = h1;
}
count = count + Tot - LineMap[Slope].Count;
}
}
Console.WriteLine(count);
}
public
static
void
Main(
string
[] args)
{
int
N = 5;
int
[] a = { 1, 1, 1, 1, 0 };
int
[] b = { 1, 1, 0, -1, 1 };
int
[] c = { 2, 4, 1, 2, 3 };
numberOfPairs(a, b, c, N);
}
}