Language: C

#include <stdio.h>
#include <stdlib.h>

typedef struct SArray {
 int num;
 int quant;
 SArray* next;
} SArray;

SArray* GetAdd(SArray* arr, int a);
void PutNode(SArray* arr, int a, int b);
void FreeArr(SArray* arr);

int main(void)
{
 int n, k, i, a, b, temp;
 scanf("%d %d", &n, &k);
 SArray* arr = (SArray*)malloc(sizeof(SArray));
 SArray* asTemp;

 arr->num = 0;
 arr->quant = 0;
 arr->next = NULL; 

 for (i = 0; i < n; i++) {
  scanf("%d %d", &a, &b);
  asTemp = GetAdd(arr, a);
  if(asTemp != NULL) {
   asTemp->quant += b;
  }
  else {
   PutNode(arr, a, b);
  }
 }

 temp = 0;
 asTemp = arr->next;
 while (1) {
  temp += asTemp->quant;
  if (k <= temp) {
   printf("%d", asTemp->num);
   break;
  }
  asTemp = asTemp->next;
 }

 FreeArr(arr);
 return 0;
}

SArray* GetAdd(SArray* arr, int a) {
 SArray* asTemp = arr;
 while(asTemp->next != NULL) {
  if (asTemp->next->num == a) {
   return asTemp->next;
  }
  asTemp = asTemp->next;
 }
 return NULL;
}

void PutNode(SArray* arr, int a, int b) {
 SArray* asTemp = arr;
 SArray* asPut;
 while (asTemp->next != NULL) {
  if(asTemp->next->num > a) {
   asPut = (SArray*)malloc(sizeof(SArray));
   asPut->num = a;
   asPut->quant = b;
   asPut->next = asTemp->next;
   asTemp->next = asPut;
   return;
  }
  asTemp = asTemp->next;
 }
 asPut = (SArray*)malloc(sizeof(SArray));
 asPut->num = a;
 asPut->quant = b;
 asPut->next = NULL;
 asTemp->next = asPut;
}

void FreeArr(SArray* arr) {
 SArray* asTemp = arr;
 SArray* asFree;
 while(asTemp->next != NULL) {
  asFree = asTemp;
  asTemp = asTemp->next;
  free(asFree);
 }
 free(asTemp);
}

Compiler output:
main.c:7:2: error: unknown type name 'SArray'
    7 |  SArray* next;
      |  ^~~~~~
main.c: In function 'main':
main.c:37:9: error: assignment to 'SArray *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
   37 |  asTemp = arr->next;
      |         ^
main.c:44:10: error: assignment to 'SArray *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
   44 |   asTemp = asTemp->next;
      |          ^
main.c: In function 'GetAdd':
main.c:54:19: error: request for member 'num' in something not a structure or union
   54 |   if (asTemp->next->num == a) {
      |                   ^~
main.c:55:17: error: returning 'int *' from a function with incompatible return type 'SArray *' [-Wincompatible-pointer-types]
   55 |    return asTemp->next;
      |           ~~~~~~^~~~~~
main.c:57:10: error: assignment to 'SArray *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
   57 |   asTemp = asTemp->next;
      |          ^
main.c: In function 'PutNode':
main.c:66:18: error: request for member 'num' in something not a structure or union
   66 |   if(asTemp->next->num > a) {
      |                  ^~
main.c:71:17: error: assignment to 'int *' from incompatible pointer type 'SArray *' [-Wincompatible-pointer-types]
   71 |    asTemp->next = asPut;
      |                 ^
main.c:74:10: error: assignment to 'SArray *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
   74 |   asTemp = asTemp->next;
      |          ^
main.c:80:15: error: assignment to 'int *' from incompatible pointer type 'SArray *' [-Wincompatible-pointer-types]
   80 |  asTemp->next = asPut;
      |               ^
main.c: In function 'FreeArr':
main.c:88:10: error: assignment to 'SArray *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
   88 |   asTemp = asTemp->next;
      |          ^