class Solution {

public:

vector<int> distributeCandies(int candies, int num_people) {

vector<int> answer(num_people,0);

int i=0;

int count=1;

while(candies!=0){

if(candies<=count){ // Checking if we have less candies than required

answer[i]+=candies;

break;

}

answer[i]+=count;

candies-=count;

count++;

i++;

if(i>num_people-1)i=0; // starting again

}

return answer;

}

};