{"raw_statement":[{"iden":"statement","content":"Pay attention to the *memory limit* for this problem!\n\nYou are given an array A of size N and a positive integer S. You need to find the number of ways W in which you can chose 5 elements with distinct positions such that their sum is equal to S.\n\nThe first line contains two positive integer N,  S (1 ≤ N ≤ 103,  0 ≤ S ≤ 2 * 109) - the size of the array and the queried sum.\n\n The next line contains N numbers Ai (0 ≤ Ai ≤ 4 * 108,  1 ≤ i ≤ N).\n\nPrint the only integer W (0 ≤ W < 231) - the number of ways to chose the elements.\n\n"},{"iden":"input","content":"The first line contains two positive integer N,  S (1 ≤ N ≤ 103,  0 ≤ S ≤ 2 * 109) - the size of the array and the queried sum. The next line contains N numbers Ai (0 ≤ Ai ≤ 4 * 108,  1 ≤ i ≤ N)."},{"iden":"output","content":"Print the only integer W (0 ≤ W < 231) - the number of ways to chose the elements."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ N \\in \\mathbb{Z}^+ $, $ S \\in \\mathbb{Z}_{\\geq 0} $.  \nLet $ A = (a_1, a_2, \\dots, a_N) $ be a sequence of integers with $ a_i \\in \\mathbb{Z}_{\\geq 0} $.\n\n**Constraints**  \n1. $ 1 \\leq N \\leq 10^3 $  \n2. $ 0 \\leq S \\leq 2 \\cdot 10^9 $  \n3. $ 0 \\leq a_i \\leq 4 \\cdot 10^8 $ for all $ i \\in \\{1, \\dots, N\\} $\n\n**Objective**  \nCompute the number of 5-element subsets $ \\{i_1, i_2, i_3, i_4, i_5\\} \\subseteq \\{1, \\dots, N\\} $ with $ i_1 < i_2 < i_3 < i_4 < i_5 $ such that:  \n$$\na_{i_1} + a_{i_2} + a_{i_3} + a_{i_4} + a_{i_5} = S\n$$","simple_statement":"Given an array of N numbers and a target sum S, count how many ways you can pick exactly 5 distinct elements whose sum equals S.","has_page_source":false}