Advertisement
gruslan

Artur_3

Apr 18th, 2023 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. n, m = map(int, input().split())
  2. a = list(map(int, input().split()))
  3.  
  4. count = 0
  5. for i in range(n - 1):
  6.     a_i = a[i]
  7.     a_j = m - a_i
  8.     if 0 <= a_j < a_i:
  9.         count += a[i + 1:].count(a_j)
  10.  
  11. print(count)
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement