Perfect Hiring - Hacker Rank Problem

Problem Statement
You are the hiring manager of a startup and you are interviewing N candidates, each having an ID numbered from 1 to N. Each candidate has a score Ai calculated from their HackerRank tests. You start with patience P and lose patience X after each interview.
One by one candidates enter your room in the sequence of their ID numbers. To save time you decide to give a rating of (P×Ai). In the end you hire the candidate with maximum rating. Print the ID of this candidate.
NOTE: It is guaranteed that a unique ID gets selected.
Input Format
The first line begins with 3 space-separated integers, NP, and X.
The next line contains an array A[], containing the scores of the N candidates.
Constraints
1N105
1P109
1X100
1Ai109
Output Format
Output the ID of the Applicant who get selected.
NOTE: ID's are numbered from 1 to N.
Sample Input
4 94 8
8 6 4 6
Sample Output
1
Explanation
Rating for Applicant 1 is 94×8=752
Chance for Applicant 2 is 86×6=516
Chance for Applicant 3 is 78×4=312
Chance for Applicant 4 is 70×6=420
So ID 1 gets selected.

MY SOLUTION:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main() {

   unsigned long int n,p;
   unsigned int x,i;
    scanf("%ld %ld %d",&n,&p,&x);
    unsigned long int ans,pos;
    for(i=0;i<n;i++)
    {
        unsigned long int value;
        scanf("%ld",&value);
        value=value*p;
        p=p-x;
        if(i==0)
        {
        ans=value;
        pos=i+1;
        }
        else if(ans<value)
        {
        ans=value;
            pos=i+1;
        }
    }
    printf("%ld",pos);
    return 0;
}

Convert resultset object to list of map

Convert the resultset object to list of map In some cases, while we doing API automation, we need to fetch the value from the DB and hav...