Language: C++

#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
int n;

struct item{
    string name[256];
    int cost;
    vector<string> used;
    int size;
} ;

item list[100];
int memo[100];

int getCost(int v)
{
    if(memo[v]!=-1)return memo[v];
    int i, j;
    int ans;
    
    if (list[v].size == 0){
        return (list[v].cost);
    }
    else {
        ans = 0;
        for (i = 0; i < list[v].size; i++){
            for (j = 0; j < n; j++){
                if (list[v].used[i]== list[j].name){
                    ans += getCost(j);
                }
            }
        }
        list[v].cost = min(list[v].cost,ans);
    }
    return (list[vertex].cost);
}

int main(void)
{
    int i, j, k;
    int m, kk;
    char key[256], temp[256];
    int look, sum;
    
    while (1){
        scanf("%d", &n);
        
        if (n == 0){
            break;
        }
        for(i=0;i<n;i++)memo[i]=-1;
        for (i = 0; i < n; i++){
            scanf("%s%d", list[i].name, &list[i].cost);
            list[i].size = 0;
        }
        
        scanf("%d", &m);
        for (i = 0; i < m; i++){
            scanf("%s", key);
            for (j = 0; j < n; j++){
                if (strcmp(key, list[j].name) == 0){
                    look = j;
                }
            }
            scanf("%d", &kk);
            list[look].size = kk;
            for (j = 0; j < kk; j++){
                scanf("%s", temp);
                for (k = 0; k < n; k++){
                    if (strcmp(temp, list[k].name) == 0){
                        strcpy(list[look].used[j], temp);
                    }
                }
            }
        }
        scanf("%s", key);
        for (j = 0; j < n; j++){
            if (strcmp(key, list[j].name) == 0){
                look = j;
            }
        }
        
        printf("%d\n", getCost(look));
        
    }
    
    return (0);
}

Compiler output:
a.cc:9:5: error: 'string' does not name a type; did you mean 'stdin'?
    9 |     string name[256];
      |     ^~~~~~
      |     stdin
a.cc:11:5: error: 'vector' does not name a type
   11 |     vector<string> used;
      |     ^~~~~~
a.cc: In function 'int getCost(int)':
a.cc:31:29: error: 'struct item' has no member named 'used'
   31 |                 if (list[v].used[i]== list[j].name){
      |                             ^~~~
a.cc:31:47: error: 'struct item' has no member named 'name'
   31 |                 if (list[v].used[i]== list[j].name){
      |                                               ^~~~
a.cc:36:24: error: 'min' was not declared in this scope; did you mean 'std::min'?
   36 |         list[v].cost = min(list[v].cost,ans);
      |                        ^~~
      |                        std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:38:18: error: 'vertex' was not declared in this scope
   38 |     return (list[vertex].cost);
      |                  ^~~~~~
a.cc: In function 'int main()':
a.cc:56:35: error: 'struct item' has no member named 'name'
   56 |             scanf("%s%d", list[i].name, &list[i].cost);
      |                                   ^~~~
a.cc:64:41: error: 'struct item' has no member named 'name'
   64 |                 if (strcmp(key, list[j].name) == 0){
      |                                         ^~~~
a.cc:73:46: error: 'struct item' has no member named 'name'
   73 |                     if (strcmp(temp, list[k].name) == 0){
      |                                              ^~~~
a.cc:74:43: error: 'struct item' has no member named 'used'
   74 |                         strcpy(list[look].used[j], temp);
      |                                           ^~~~
a.cc:81:37: error: 'struct item' has no member named 'name'
   81 |             if (strcmp(key, list[j].name) == 0){
      |                                     ^~~~