eolymp
bolt
Try our new interface for solving problems
Problems

Good pairs

Good pairs

Two arrays \textbf{А} and \textbf{B} with $n$ integers are given. Pair of indexes $i$ and $j~(i < j)$ are \textbf{good}, if $a_i + a_j > b_i + b_j$. Find the number of pairs of good indexes. \InputFile First line contains number $n~(n \le 10^5)$. Second line contains $n$ integers of array \textbf{А}. Third line contains $n$ integers of array \textbf{B}. \OutputFile Print the number of pairs of good indexes.
Time limit 1 second
Memory limit 128 MiB
Input example #1
6 
6 5 8 4 7 0 
3 5 1 5 2 3
Output example #1
11