**Problem**: Given an even number ( greater than 2 ), return two prime numbers whose sum will be equal to given number.
Solution: Using sieve of eratosthenes find all prime numbers upto given number. Then find the pair of numbers whose sum is equal to given number.
Code:

```
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
void primesum(int A)
{
    std::vector<bool> primes(A + 1, 1);
    std::vector<int> arr, final;
    primes[0] = 0;
    primes[1] = 0;

    for (int i = 2; i <= int(sqrt(A)); i++)
    {
        if (primes[i] == 1)
        {
            for (int j = 2; i + j <= A; j++)
            {
                primes[i * j] = 0;
            }
        }
    }
    for (int i = 0; i < primes.size(); i++)
        if (primes[i])
            arr.push_back(i);

    /* for (auto x : primes)
        std::cout << x << " ";
       std::cout << "\n"; */
    std::vector<int>::iterator it;
    for (int i = 0; i < arr.size(); i++)
    {
        it = std::find(arr.begin(), arr.end(), A - arr[i]);
        if (it != arr.end())
        {
            final.push_back(arr[i]);
            final.push_back(A - arr[i]);
            break;
        }
    }
    std::cout << final[0] << " " << final[1] << "\n";
    return;
}
int main()
{
    int x = 184;
    primesum(x);
    return 0;
}

```

This code is working for most of the cases except for case like when x=184. Error in this case is:

```
a.out: malloc.c:2394: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
[1]    13944 abort (core dumped)  ./a.out

```

I'm not able to understand why this is happening and what's its solution?