CodeChef Chewing challenge
Do not use namespace std; It is a bad practice that you should stop as soon as possible.
Do not trust magic macros like speedup. For such small code fragments that are repeated only few time it is often way better to write it out.
use std::size_t instead of unsigned long long int
You already know the maximum number of chewing gums, So reserve space for your vector early to avoid reallocations. You can always later call shrink_to_fit to free the unneded memory.
Use descriptive names even in challenges that only call them N or K. N is the number of gums so call it numGums or whatever you want. This improves readability quite a bit. This also goes for example hardness, which is a vector so it should be plural e.g. hardnesses.
Declare variables when you need them. This creates more or less independent code paths that might late be put into functions more easily.
In your loop you use it++. This requires a copy of it before the increment. Especially for iterators and friends ++it is more efficient as it does not involve the copy.
Try to separate command flow with a whitespace, e.g. for (). This helps to discriminate it from normal functions.
EDIT C++11 knows the language construct nullptr, use it rather than NULL


The early portion of our code would then look like this

std::ios::sync_with_stdio(false); 
std::cin.tie(nullptr);
std::size_t numGums, chewingThreshold;
std::cin &gt;&gt; numGums &gt;&gt; chewingThreshold;

std::vector&lt;std::size_t&gt; hardnesses;
hardness.reserve(numGums);
for (std::size_t gum = 0; gum &lt; numGums; ++gum) {
    std::size_t hardness;
    std::cin &gt;&gt; hardness;
    if (hardness &lt; chewingThreshold) {
        hardnesses.push_back(hardness);
    }
}
hardnesses.shrink_to_fit();


If you look at this code in a year, you will still understand most of its meaning, without having to search for documentation.


Avoid single line command flow statements like if (*it+*it2 &lt; K) numPairs+=1; as much as possible. This completely breaks readability of your code as you know have to check every for and if statement if it has a coomplicated condition or hidden code or nothing at all. 
Your code does work, but it is highly inefficient from a mathematical point of view. As a hint I would suggest you think about how to utilize a std::map for this problem.