Language: C++

#include <cstdio>
#include <algorithm>
#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;
    string key, temp;
    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++){
            cin >> list[i].name >> list[i].cost;
            list[i].size = 0;
        }
        
        cin >> m;
        for (i = 0; i < m; i++){
            cin >> key;
            for (j = 0; j < n; j++){
                if (key==list[j].name){
                    look = j;
                }
            }
            cin >> kk;
            list[look].size = kk;
            for (j = 0; j < kk; j++){
                cin >> temp;
                for (k = 0; k < n; k++){
                    if (temp==list[k].name){
                        list[look].used[j]=temp;
                    }
                }
            }
        }
        cin >> key;
        for (j = 0; j < n; j++){
            if (strcmp(key, list[j].name) == 0){
                look = j;
            }
        }
        
        cout << 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:2:
/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:45:5: error: 'string' was not declared in this scope
   45 |     string key, temp;
      |     ^~~~~~
a.cc:45:5: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from a.cc:3:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:56:13: error: 'cin' was not declared in this scope
   56 |             cin >> list[i].name >> list[i].cost;
      |             ^~~
a.cc:56:28: error: 'struct item' has no member named 'name'
   56 |             cin >> list[i].name >> list[i].cost;
      |                            ^~~~
a.cc:60:9: error: 'cin' was not declared in this scope
   60 |         cin >> m;
      |         ^~~
a.cc:62:20: error: 'key' was not declared in this scope
   62 |             cin >> key;
      |                    ^~~
a.cc:64:34: error: 'struct item' has no member named 'name'
   64 |                 if (key==list[j].name){
      |                                  ^~~~
a.cc:71:24: error: 'temp' was not declared in this scope; did you mean 'tm'?
   71 |                 cin >> temp;
      |                        ^~~~
      |                        tm
a.cc:73:39: error: 'struct item' has no member named 'name'
   73 |                     if (temp==list[k].name){
      |                                       ^~~~
a.cc:74:36: error: 'struct item' has no member named 'used'
   74 |                         list[look].used[j]=temp;
      |                                    ^~~~
a.cc:79:16: error: 'key' was not declared in this scope
   79 |         cin >> key;
      |                ^~~
a.cc:81:37: error: 'struct item' has no member named 'name'
   81 |             if (strcmp(key, list[j].name) == 0){
      |                                     ^~~~
a.cc:81:17: error: 'strcmp' was not declared in this scope
   81 |             if (strcmp(key, list[j].name) == 0){
      |                 ^~~~~~
a.cc:5:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <vector>
  +++ |+#include <cstring>
    5 | #include <algorithm>
a.cc:86:9: error: 'cout' was not declared in this scope
   86 |         cout << getCost(look);
      |         ^~~~