Finding decreasing sequences in an array of numbers
Some general remarks:


Don't use namespace std;, see for example Why is “using namespace std;” considered bad practice?.
Define variables at the narrowest possible scope. In particular, avoid
global variables.
Use better variable names. It is unclear what each variable in

int n,i,v[100001],nr,j,s;


stands for.
return 0; at the end of the main program can be omitted.
The range of integer types is implementation defined, the C++ standard only
guarantees that a (signed) int can hold values from -32767 to 32767,
which is too small for your numbers. Many compilers define int as a 32-bit
integer, but you can use long to be on the safe side, or use fixed-size
types like int32_t.


With respect to readability, I recommend to leave more (horizontal) space,
e.g. around operators and parentheses.

There are two places with identical code to count the divisors
of a number. This should be done in a separate function.

Your code uses a nested loop where the inner loop updates the index of the
outer loop. That is difficult to understand and error-prone. And it is 
not necessary: Instead of starting a nested loop when the start of a 
decreasing subsequence is found, set a flag instead and continue with the 
main loop.

You store all numbers from the input file in an array, which is not necessary:
each loop iteration only needs the previous number to decide if the subsequence
is (still) decreasing. It suffices to store the previously processed number
in a variable.

Summarizing the suggestions so far, the code could look like this:

#include &lt;fstream&gt;
#include &lt;cmath&gt;

long numberOfDivisors(long n) {
    long count = 0;
    for (long j = 2; j &lt;= sqrt(n); j++) {
        if (n % j == 0) {
            count++;
            if (j != n/j)
                count++;
        }
    }
    return count;
}

int main()
{
    std::ifstream inFile("furnici.in");
    std::ofstream outFile("furnici.out");

    long decreasingSequences = 0;
    bool isDescending = false;
    long lastDivisorCount = 0;
    long numDays;
    inFile &gt;&gt; numDays;
    for (long i = 1; i &lt;= numDays; i++) {
        long numAnts;
        inFile &gt;&gt; numAnts;
        long divisorCount = numberOfDivisors(numAnts);
        if (divisorCount &gt;= lastDivisorCount) {
            // No longer decreasing.
            isDescending = false;
        } else if (!isDescending) {
            // A decreasing subsequence started right here.
            isDescending = true;
            decreasingSequences += 1;
        }
        lastDivisorCount = divisorCount;
    }
    outFile &lt;&lt; decreasingSequences;
}


Now you can start to improve the performance, and the prime candidate is
of course the numberOfDivisors() function. 

An efficient method (and I'm repeating arguments from Getting all divisors from an integer now) is to use the prime factorization:  If
$$
 n = p_1^{e_1} \, p_2^{e_2} \cdots p_k^{e_k}
$$
is the factorization of \$ n \$ into prime numbers \$ p_i \$
with exponents \$ e_i \$, then 
$$
 \sigma_0(n) = (e_1+1)(e_2+1) \cdots (e_k+1)
$$
is the number of divisors of \$ n \$, see for example
Wikipedia: Divisor function. Example:
$$
 720 = 2^4 \cdot 3^2 \cdot 5^1 \Longrightarrow
  \sigma_0(720) = (4+1)(2+1)(1+1) = 30 \, .
$$

Here is a possible implementation in C:

long numberOfDivisors(long n){

    long numDivisors = 1;
    long factor = 2; // Candidate for prime factor of `n`

    // If `n` is not a prime number then it must have one factor
    // which is &lt;= `sqrt(n)`, so we try these first:
    while (factor * factor &lt;= n) {
        if (n % factor == 0) {
            // `factor` is a prime factor of `n`, determine the exponent:
            long exponent = 0;
            do {
                n /= factor;
                exponent++;
            } while (n % factor == 0);
                // `factor^exponent` is one term in the prime factorization of n,
                // this contributes as factor `exponent + 1`:
                numDivisors *= exponent + 1;
        }
        // Next possible prime factor:
        factor = factor == 2 ? 3 : factor + 2;
    }

    // Now `n` is either 1 or a prime number. In the latter case,
    // it contributes a factor 2:
    if (n &gt; 1) {
        numDivisors *= 2;
    }

    return numDivisors;
}


As a further improvement you can pre-compute the prime numbers with a 
sieving method. Note that it sufficient to pre-compute the primes in the
range \$ 2 \ldots \sqrt{N} \$ where \$ N = 10^9 \$ is the upper bound for the given input.  That should help to stay within the given memory
limit of 64 MB.