Simple Arrangement problem(est case not passing giving run time error help)

you are given two integers A and B. You will create a line of boys and girls in the following manner: First A girls, then B boys, then A girls, then B boys, and so on. You will also be given an integer N. Find the number of girls in the first N people of the row.
Input
The first and the only line of input contains 3 integers N, A, B.

Constraints
1 < N, A, B <= 10^18 (1000000000000000000)
A+B <= 10^18
Output
Output a singer integer, the number of girls in the first N people in the queue.
Sample Input
8 3 4

Sample Output
4

my code
#include <bits/stdc++.h>
using namespace std;

int main()
{
vector C;
long long int n,n2,n1,n3,num;
n3=0; num=0;
cin >> n; cin >> n1; cin >> n2;
for(long long int i=0;i<n;i=i+n1+n2){
for(long long int j=1;j<=n1; j++)
{
n3++; //cout << n3<<" ";
if(n3>n)
break;
C.push_back(0); //0 for girls

}
for(long long int k=1;k<=n2; k++)
{
n3++; ///cout << n3<<" ";
if(n3>n)
break;
C.push_back(1); //1 for boys

}
}
//for(long long int k=0;k < C.size(); k++)
//cout << C[k]<<" ";
for(long long int k=0;k < C.size(); k++)
{
if(C[k]==0)
num++;
}
cout << num << endl;
return 0;
}
but test case not passing giving run time error

Comments (1)