criyle/codenet-compile-errors huggingface dataset:
Language: C

#include<stdio.h>
#include<stdlib.h>
struct DAta{
  char s[21];
  double a;
}d[50];

int cmp(const void *a,const void *b){
  struct DAta f,e;
  f=*(struct DAta *)a;
  e=*(struct DAta *)b;
  if(f.a==e.a)return strcmp(f.s,e.s);
    return f.a=e.a;
}


int main(void){
  int n,i,j;
  int p,s,m,a,b,c,d,e,f;
  
  while(scanf("%d",&n),n){
  for(i=0;i<n;i++){
    scanf("%s%d%d%d%d%d%d%d%d%d",d[i].s,&p,&a,&b,&c,&d,&e,&f,&s,&m);
    d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
  }
  qsort(d,n,sizeof(struct DAta),cmp);
  for(i=0;i<n;i++){
    printf("%s\n",d[i].s);
  }
  puts("#");
  }
  return 0;}

Compiler output:
main.c: In function 'cmp':
main.c:12:22: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   12 |   if(f.a==e.a)return strcmp(f.s,e.s);
      |                      ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    2 | #include<stdlib.h>
  +++ |+#include <string.h>
    3 | struct DAta{
main.c: In function 'main':
main.c:23:35: error: subscripted value is neither array nor pointer nor vector
   23 |     scanf("%s%d%d%d%d%d%d%d%d%d",d[i].s,&p,&a,&b,&c,&d,&e,&f,&s,&m);
      |                                   ^
main.c:24:6: error: subscripted value is neither array nor pointer nor vector
   24 |     d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
      |      ^
main.c:26:9: error: passing argument 1 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
   26 |   qsort(d,n,sizeof(struct DAta),cmp);
      |         ^
      |         |
      |         int
In file included from main.c:2:
/usr/include/stdlib.h:970:26: note: expected 'void *' but argument is of type 'int'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
main.c:28:20: error: subscripted value is neither array nor pointer nor vector
   28 |     printf("%s\n",d[i].s);
      |                    ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct DAta{
  char s[21];
  double a;
}d[50];

int cmp(const void *a,const void *b){
  struct DAta f,e;
  f=*(struct DAta *)a;
  e=*(struct DAta *)b;
  if(f.a==e.a)return strcmp(f.s,e.s);
    return f.a=e.a;
}


int main(void){
  int n,i,j;
  int p,s,m,a,b,c,d,e,f;
  
  while(scanf("%d",&n),n){
  for(i=0;i<n;i++){
    scanf("%s%d%d%d%d%d%d%d%d%d",d[i].s,&p,&a,&b,&c,&d,&e,&f,&s,&m);
    d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
  }
  qsort(d,n,sizeof(struct DAta),cmp);
  for(i=0;i<n;i++){
    printf("%s\n",d[i].s);
  }
  puts("#");
  }
  return 0;}

Compiler output:
main.c: In function 'main':
main.c:24:35: error: subscripted value is neither array nor pointer nor vector
   24 |     scanf("%s%d%d%d%d%d%d%d%d%d",d[i].s,&p,&a,&b,&c,&d,&e,&f,&s,&m);
      |                                   ^
main.c:25:6: error: subscripted value is neither array nor pointer nor vector
   25 |     d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
      |      ^
main.c:27:9: error: passing argument 1 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
   27 |   qsort(d,n,sizeof(struct DAta),cmp);
      |         ^
      |         |
      |         int
In file included from main.c:2:
/usr/include/stdlib.h:970:26: note: expected 'void *' but argument is of type 'int'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
main.c:29:20: error: subscripted value is neither array nor pointer nor vector
   29 |     printf("%s\n",d[i].s);
      |                    ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct DAta{
  char s[21];
  double a;
}d[50];

int cmp(const void *a,const void *b){
  struct DAta f,e;
  f=*(struct DAta *)a;
  e=*(struct DAta *)b;
  if(f.a==e.a)return strcmp(f.s,e.s);
    return f.a-e.a;
}


int main(void){
  int n,i,j;
  int p,s,m,a,b,c,d,e,f;
  
  while(scanf("%d",&n),n){
  for(i=0;i<n;i++){
    scanf("%s%d%d%d%d%d%d%d%d%d",d[i].s,&p,&a,&b,&c,&d,&e,&f,&s,&m);
    d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
  }
  qsort(d,n,sizeof(struct DAta),cmp);
  for(i=0;i<n;i++){
    printf("%s\n",d[i].s);
  }
  puts("#");
  }
  return 0;}

Compiler output:
main.c: In function 'main':
main.c:24:35: error: subscripted value is neither array nor pointer nor vector
   24 |     scanf("%s%d%d%d%d%d%d%d%d%d",d[i].s,&p,&a,&b,&c,&d,&e,&f,&s,&m);
      |                                   ^
main.c:25:6: error: subscripted value is neither array nor pointer nor vector
   25 |     d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
      |      ^
main.c:27:9: error: passing argument 1 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
   27 |   qsort(d,n,sizeof(struct DAta),cmp);
      |         ^
      |         |
      |         int
In file included from main.c:2:
/usr/include/stdlib.h:970:26: note: expected 'void *' but argument is of type 'int'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
main.c:29:20: error: subscripted value is neither array nor pointer nor vector
   29 |     printf("%s\n",d[i].s);
      |                    ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct DAta{
  char s[21];
  double a;
}d[50];

int cmp(const void *a,const void *b){
  struct DAta f,e;
  f=*(struct DAta *)a;
  e=*(struct DAta *)b;
  if(f.a==e.a)return strcmp(f.s,e.s);
    return f.a-e.a;
}


int main(void){
  int n,i,j;
  int p,s,m,a,b,c,d,e,f;
  
  while(scanf("%d",&n),n){
  for(i=0;i<n;i++){
    scanf("%s %d%d%d%d%d%d%d%d%d",d[i].s,&p,&a,&b,&c,&d,&e,&f,&s,&m);
    d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
  }
  qsort(d,n,sizeof(struct DAta),cmp);
  for(i=0;i<n;i++){
    printf("%s\n",d[i].s);
  }
  puts("#");
  }
  return 0;}

Compiler output:
main.c: In function 'main':
main.c:24:36: error: subscripted value is neither array nor pointer nor vector
   24 |     scanf("%s %d%d%d%d%d%d%d%d%d",d[i].s,&p,&a,&b,&c,&d,&e,&f,&s,&m);
      |                                    ^
main.c:25:6: error: subscripted value is neither array nor pointer nor vector
   25 |     d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
      |      ^
main.c:27:9: error: passing argument 1 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
   27 |   qsort(d,n,sizeof(struct DAta),cmp);
      |         ^
      |         |
      |         int
In file included from main.c:2:
/usr/include/stdlib.h:970:26: note: expected 'void *' but argument is of type 'int'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
main.c:29:20: error: subscripted value is neither array nor pointer nor vector
   29 |     printf("%s\n",d[i].s);
      |                    ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct DAta{
  char s[21];
  double a;
}d[50];

int cmp(const void *a,const void *b){
  struct DAta f,e;
  f=*(struct DAta *)a;
  e=*(struct DAta *)b;
  if(f.a==e.a)return strcmp(f.s,e.s);
    return f.a-e.a;
}


int main(void){
  int n,i,j;
  int p,s,m,a,b,c,d,e,f;
  
  while(scanf("%d",&n),n){
  for(i=0;i<n;i++){
    scanf("%s %d%d%d%d",d[i].s,&p,&a,&b,&c);
scanf("%d%d%d%d%d",&d,&e,&f,&s,&m);
    d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
  }
  qsort(d,n,sizeof(struct DAta),cmp);
  for(i=0;i<n;i++){
    printf("%s\n",d[i].s);
  }
  puts("#");
  }
  return 0;}

Compiler output:
main.c: In function 'main':
main.c:24:26: error: subscripted value is neither array nor pointer nor vector
   24 |     scanf("%s %d%d%d%d",d[i].s,&p,&a,&b,&c);
      |                          ^
main.c:26:6: error: subscripted value is neither array nor pointer nor vector
   26 |     d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
      |      ^
main.c:28:9: error: passing argument 1 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
   28 |   qsort(d,n,sizeof(struct DAta),cmp);
      |         ^
      |         |
      |         int
In file included from main.c:2:
/usr/include/stdlib.h:970:26: note: expected 'void *' but argument is of type 'int'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
main.c:30:20: error: subscripted value is neither array nor pointer nor vector
   30 |     printf("%s\n",d[i].s);
      |                    ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct DAta{
  char s[21];
  double a;
}d[50];

int cmp(const void *a,const void *b){
  struct DAta f,e;
  f=*(struct DAta *)a;
  e=*(struct DAta *)b;
  if(f.a==e.a)return strcmp(f.s,e.s);
    return f.a-e.a;
}


int main(void){
  int n,i,j;
  int p,s,m,a,b,c,d,e,f;
  
  while(scanf("%d",&n),n){
  for(i=0;i<n;i++){
scanf("%s",d[i].s);
    scanf(" %d%d%d%d",&p,&a,&b,&c);
scanf("%d%d%d%d%d",&d,&e,&f,&s,&m);
    d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
  }
  qsort(d,n,sizeof(struct DAta),cmp);
  for(i=0;i<n;i++){
    printf("%s\n",d[i].s);
  }
  puts("#");
  }
  return 0;}

Compiler output:
main.c: In function 'main':
main.c:24:13: error: subscripted value is neither array nor pointer nor vector
   24 | scanf("%s",d[i].s);
      |             ^
main.c:27:6: error: subscripted value is neither array nor pointer nor vector
   27 |     d[i].a=((double)f*m*s-p)/(a+b+c+d+e);
      |      ^
main.c:29:9: error: passing argument 1 of 'qsort' makes pointer from integer without a cast [-Wint-conversion]
   29 |   qsort(d,n,sizeof(struct DAta),cmp);
      |         ^
      |         |
      |         int
In file included from main.c:2:
/usr/include/stdlib.h:970:26: note: expected 'void *' but argument is of type 'int'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
main.c:31:20: error: subscripted value is neither array nor pointer nor vector
   31 |     printf("%s\n",d[i].s);
      |                    ^
Language: C++

#include<iostream>
#include<vector>
#include<string>
using namespace std;

class crop{
public:
  string name;
  int price,seeding,youngL,L,flower,
    fruit,numFruit,fruitPrice,times;
  int StoL,sum,LtoFruit,totaltime;
  crop();
  crop(string name,int price,int seeding,int youngL,
       int L,int flower,int fruit,
       int numFruit,int fruitPrice,
       int times):name(name),price(price),
		  seeding(seeding),youngL(youngL),L(L),
		  flower(flower),fruit(fruit),numFruit(numFruit),
		  fruitPrice(fruitPrice),times(times){
    StoL= seeding + youngL;
    LtoFruit = L + flower + fruit;
    totaltime=StoL + LtoFruit * times;
    sum = (times * numFruit  * fruitPrice - price) / totaltime;
  }

  // crop& copy(const crop &a){
  //   if(this == &a)return *this;
  //   name = a.name;
  //   price=a.price;
  //   seeding=a.seeding;
  //   youngL=a.youngL;
  //   L=a.L;
  //   flower=a.flower;
  //   fruit=a.fruit;
  //   numFruit=a.numFruit;
  //   fruitPrice=a.fruitPrice;
  //   times=a.times;
  //   StoL=a.StoL;
  //   LtoFruit=a.LtoFruit;
  //   totaltime=a.totaltime;
  //   sum=a.sum;
  //   return *this;
  // }
  ~crop(){}

  // crop& operator=(const crop &a){
  //   return copy(a);
  // }

  bool operator<(const crop &a)const{
    if(sum != a.sum){
      return sum > a.sum;
    }else{
      return name < a.name;
    }
  }
};

void printCrop(crop &a){
  cout << a.name << " " << a.price << " " << a.sum << " "<< a.totaltime<< endl;
}
int main(){
  int n;
  while(cin>>n,n){
    vector<crop> C;
    for(int i=0;i<n;i++){
      string l;
      int p,a,b,c,d,e,f,s,m;
      cin>>l>>p>>a>>b>>c>>d>>e>>f>>s>>m;
      C.push_back(crop(l,p,a,b,c,d,e,f,s,m));
      //printCrop(C[i]);
    }
    sort(C.begin(), C.end());

    for(int i=0;i<n;i++){
      cout << C[i].name << endl;
    }
    cout << "#" << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   73 |     sort(C.begin(), C.end());
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<vector>
#include<string>
using namespace std;

class crop{
public:
  string name;
  int price,seeding,youngL,L,flower,
    fruit,numFruit,fruitPrice,times;
  int StoL,sum,LtoFruit,totaltime;
  crop();
  crop(string name,int price,int seeding,int youngL,
       int L,int flower,int fruit,
       int numFruit,int fruitPrice,
       int times):name(name),price(price),
		  seeding(seeding),youngL(youngL),L(L),
		  flower(flower),fruit(fruit),numFruit(numFruit),
		  fruitPrice(fruitPrice),times(times){
    this->StoL= seeding + youngL;
    this->LtoFruit = L + flower + fruit;
    this->totaltime=StoL + LtoFruit * times;
    this->sum = (times * numFruit  * fruitPrice - price) / totaltime;
  }
  ~crop(){}

  bool operator<(const crop &a)const{
    if(this->sum != a.sum){
      return this->sum > a.sum;
    }else{
      return this->name < a.name;
    }
  }
};

void printCrop(crop &a){
  cout << a.name << " " << a.price << " " << a.sum << " "<< a.totaltime<< endl;
}
int main(){
  int n;
  while(cin>>n,n){
    vector<crop> C;
    for(int i=0;i<n;i++){
      string l;
      int p,a,b,c,d,e,f,s,m;
      cin>>l>>p>>a>>b>>c>>d>>e>>f>>s>>m;
      C.push_back(crop(l,p,a,b,c,d,e,f,s,m));
    }
    sort(C.begin(), C.end());

    for(int i=0;i<n;i++){
      cout << C[i].name << endl;
    }
    cout << "#" << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   49 |     sort(C.begin(), C.end());
      |     ^~~~
      |     short
Language: C++

#include "bits/stdc++.h"
#pragma warning(disable:4996)
using namespace std;



int main() {
	while(1) {
		int N; cin >> N;
		vector<pair<string, long double>>pls;
		for (int i = 0; i < N; ++i) {
			string st;
			int p, a, b, c, d, e, f, s, m; cin >> st>>p >> a >> b >> c >> d >> e >> f >> s >> m;
			int initime = a + b + c;
			int rooptime = d + e;
			int money = m*s*f-p;
			long double eff = long double(money) / long double(initime + rooptime*(m - 1));
			pls.push_back(make_pair(st, eff));
		}
		sort(pls.begin(), pls.end(), [](const pair<string, long double>&l, const pair<string, long double>&r) {return abs(l.second-r.second)<1e-9?l.first<r.first:l.second > r.second; });
		for (int i = 0; i < pls.size(); ++i) {
			cout << pls[i].first << endl;
		}
		cout << "#" << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:43: error: expected primary-expression before 'long'
   17 |                         long double eff = long double(money) / long double(initime + rooptime*(m - 1));
      |                                           ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef pair<double, string> P;
const double EPS = 1.0e9;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    while(cin >> N && N){
        vector<P> L;
        vector<double> F(9);
        string s;
        rep(i, N){
            cin >> s;
            rep(j, 9) cin >> F[j];
            double time = F[1] + F[2] + F[3];
            double money = 0.0;
            rep(i, F[8]){
                time += F[4] + F[5];
                money += F[6] * F[7];
            }
            money -= F[0];
            L.push_back(P(money / time, s));
        }
        sort(L.begin(), L.end(), [](P a, P b){
            return a.first == b.first ? a.second < b.second : a.first > b.first;
        });
        for(P k : L) cout << k.second << endl;
        cout << "#" << endl;
    }
    

Compiler output:
a.cc: In function 'int main()':
a.cc:34:6: error: expected '}' at end of input
   34 |     }
      |      ^
a.cc:9:11: note: to match this '{'
    9 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
  string st;
  vector<pair<double,string> >v;
  while(n--){
    int p,a,b,c,d,e,f,s,m;
    cin>>str>>p>>a>>b>>c>>d>>e>>f>>s>>m;
    v.push_back(make_pair(-(double)(s*f*m-p)/(a+b+c+(d+e)*m),str));
  }sort(v.begin(),v.end());
  for(int i=0;i<v.size();i++){
    cout<<v[i].second<<endl;
  }
  cout<<"#"<<endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: 'str' was not declared in this scope; did you mean 'st'?
   10 |     cin>>str>>p>>a>>b>>c>>d>>e>>f>>s>>m;
      |          ^~~
      |          st
Language: C++

#include <iostream>
#include <utility>
#include <string>
#include <vector>
using namespace std;
int main(){
  int N, p, a, b, c, d, e, f, s, m;
  string l;
  double t;
  while (cin >> N, N){
    vector< pair<double, string> > V;
    for (int i = 0; i < N; ++i){
      cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;
      t = (double)(s*f*m-p)/(a+b+c+(d+e)*m);
      V.push_back(make_pair(-t, l));
    }
    sort(V.begin(),V.end());
    for (int i = 0; i < N; ++i){
      cout << V[i].second << endl;
    }
    cout << "#" << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |     sort(V.begin(),V.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <string>
using namespace std;

int main(){
    while(true){
        int n;
        cin >> n;
        if(n == 0)
            break;
        
        vector< pair<double, string> > v(n);
        for(int i=0; i<n; i++){
            string l;
            int p, a, b, c, d, e, f, s, m;
            cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;
            v[i].first = -(m * f * s -p) / (a + b + c + m*(d + e));
            v[i].second = l;
        }
        sort(v.begin(), v.end());
        for(int i=0; i<n; i++){
            cout << v[i].second << endl;
        }
        cout << '#' << endl;
    }
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |         sort(v.begin(), v.end());
      |         ^~~~
      |         short
Language: C++

#include<iostream>
#include<string>
#include<vector>

using namespace std;

#define REP(i, n) for(int i=0; i<n; i++)

string L[100];
double P[100];
int A[100];
int B[100];
int C[100];
int D[100];
int E[100];
int F[100];
double S[100];
int M[100];

int t[100];
double profit[100];
double eff[100];

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;

        REP(i, n){
            cin >> L[i] >> P[i] >> A[i];
            cin >> B[i] >> C[i] >> D[i];
            cin >> E[i] >> F[i] >> S[i] >> M[i];
            t[i] = A[i]+B[i]+C[i]+D[i]+E[i];
            profit[i] = F[i]*S[i]*M[i]-P[i];
            if(M[i]>=2){
                t[i] += (D[i]+E[i])*(M[i]-1);
            }
            eff[i] = profit[i] / t[i];
        }
        
        vector<pair<double, string> > output(n);
        REP(i, n){
            output[i] = make_pair(-eff[i], L[i]);
        }
        sort(output.begin(), output.end());

        REP(i, n){
            cout << output[i].second << endl;
        }
        cout << "#" << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   46 |         sort(output.begin(), output.end());
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;

int main() {

    int n;

    while(cin >> n, n) {
        vector< pair< int, string > > ans;
        for(int i = 0; i < n; i++) {
            string str;
            int p, a, b, c, d, e, f, s, m;
            cin >> str >> p >> a >> b >> c >> d >> e >> f >> s >> m;
            int t = a + b + c + (d + e) * m;
            int cnt = f * m;
            ans.push_back(make_pair(-(cnt * s - p) / t, str));
        }

        sort(ans.begin(), ans.end());
        for(int i = 0; i < n; i++) {
            cout << ans[i].second << endl;
        } cout << "#" << endl;
    }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |         sort(ans.begin(), ans.end());
      |         ^~~~
      |         short
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, string> P;

vector<pair<int, string> > v;

bool comp(P lhs, P rhs){
	if(lhs.first != rhs.first) return lhs.first > rhs.first;
	return lhs.second < rhs.second;
}

int main(){
while(1){	strt
	int n;
	cin >> n;
	if(n == 0) break;
	for(int i = 0; i < n; i++){
		string l;
		int a, b, c, d, e, f, s, m, p;
		cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;
		int T = a + b + c + m * (d + e);
		int money = m * f * s - p;
		//小数点以下を使用したいので倍した
		int Er = (money * 100000) / T;

		v.push_back(make_pair(Er, l));
	}

	sort(v.begin(), v.end(), comp);

	for(int i = 0; i < n; i++){
		cout << v[i].second << endl;
	}
	v.clear();
}//end
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'strt' was not declared in this scope; did you mean 'sqrt'?
   13 | while(1){       strt
      |                 ^~~~
      |                 sqrt
a.cc:15:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   15 |         cin >> n;
      |                ^
      |                yn
Language: C++

#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool cmp(pair<double,string> a, pair<double,string> b){
	if( a.first > b.first ) return true;
	else if( a.first < b.first ) return false;
	return a.second < b.second;
}
int main(){
	int n,A,B,C,D,E,F,S,M,P;
	string name;
	
	while(cin>>n,n){
		vector< pair<double,string> > vp;
		for(int i=0; i<n; i++){
			cin>>name>>P>>A>>B>>C>>D>>E>>F>>S>>M;
			double d = (double)(F*M*S-P)/((double)A+B+C+(D+E)*M);
			vp.push_back( make_pair( d, name) );
		}
		sort(vp.begin(),vp.end(),cmp);
		for(int i=0; i<vp.size(); i++){
			cout << vp[i].second << endl;
		}
		puts("#");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   21 |                 sort(vp.begin(),vp.end(),cmp);
      |                 ^~~~
      |                 short
Language: C++

#include<iostream>
#include<functional>
#include<string>
#include<vector>
#include<map>
using namespace std;
typedef pair<double,string> P;
struct edge{
	double cost;
	string st;
};
int cmp(const edge &a,const edge &b){
	if(a.cost!=b.cost)
	return a.cost>b.cost;
	else return a.st<b.st;
}
int main(){
	string str;
	int n,a,b,c,d,p,e,f,s,m;
	double pre;
	vector<edge> mp;
	while(cin>>n,n){
		edge temp;
		for(int i=0;i<n;i++){
			cin>>str>>p>>a>>b>>c>>d>>e>>f>>s>>m;
			pre=(double)(f*m*s-p)/(a+b+c+(d+e)*m);
			temp.cost=pre;
			temp.st=str;
			mp.push_back(temp);
		}
		sort(mp.begin(),mp.end(),cmp);
		for(int i=0;i<mp.size();i++)
			cout<<mp[i].st<<endl;
		cout<<'#'<<endl;
		mp.clear();
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   31 |                 sort(mp.begin(),mp.end(),cmp);
      |                 ^~~~
      |                 short
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;

#define EPS 1e-9

typedef pair<string, double> PD;

bool compare(PD a, PD b){
  double c = a.second - b.second;
  if(abs(c) < EPS){
    if(a.first < b.first) return true;
    else return false;
  }
  if(c < -EPS) return false;
  return true;
}

int main(){
  int N;
  while(cin >> N, N){
    vector<PD> fruits;
    string L;
    int P, A, B, C, D, E, F, S, M;
    while(N--){
      cin >> L >> P >> A >> B >> C >> D >> E >> F >> S >> M;
      int ABC = A+B+C;
      int DE = D+E;
      int total_value = S * F * M - P;
      int total_time = ABC + (DE*M);
      double v = (double)(total_value / total_time);
      fruits.push_back(PD(L, v));
    }
    sort(fruits.begin(), fruits.end(), compare);
    
    for(int i = 0 ; i < fruits.size() ; i++){
      cout << fruits[i].first << endl;
    }
    cout << "#" << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   37 |     sort(fruits.begin(), fruits.end(), compare);
      |     ^~~~
      |     sqrt
Language: C++

#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <string>

using namespace std;

typedef pair<double, string> crop;

class lesser {
public:
    bool operator()(const crop r, const crop l) {
        if (r.first > l.first)
            return true;
        else if (r.first < l.first)
            return false;
        else
            return r.second < l.second;
    }
};

int main()
{
    for (;;) {
        int n;

        scanf("%d", &n);
        if (n == 0)
            break;

        vector<crop> l(n, make_pair(0, string(20, 0)));
        for (int i = 0; i < n; ++i) {
            int p, a, b, c, d, e, f, s, m;
            cin >> l[i].second;
            scanf("%d %d %d %d %d %d %d %d %d",
                    &p, &a, &b, &c, &d, &e, &f, &s, &m);
            l[i].first = double(f * s * m - p) / ((a + b + c) + (d + e) * m);
        }

        sort(l.begin(), l.end(), lesser());

        for (int i = 0; i < n; ++i)
            printf("%s\n", l[i].second.c_str());
        printf("#\n");
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   41 |         sort(l.begin(), l.end(), lesser());
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

inline int adj(int x) {
  return min(max(x, 0), 255);
}
#define SQ(x) ((x)*(x))
int main() {
  int N, M, INF=1<<28;
  while(cin >> N >> M && (N|M)) {
    int C[M];
    for(int i=0; i<M; i++) cin >> C[i];
    int dp[2][256]; fill(dp[0], dp[0]+512, INF);
    dp[128] = 0;
    for(int k=0; k<N; k++) {
      for(int i=0; i<256; i++) dp[(k+1)%2][i] = INF;
      int in; cin >> in;
      for(int i=0; i<256; i++) {
        if(dp[i]>=INF) continue;
        for(int j=0; j<M; j++) {
          dp[(k+1)%2][adj(i+C[j])] = min(dp[(k+1)%2][adj(i+C[j])], dp[k%2][i]+SQ(in-adj(i+C[j])));
        }
      }
    }
    cout << *min_element(dp[N%2], dp[(N%2)+1]) << endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: incompatible types in assignment of 'int' to 'int [256]'
   16 |     dp[128] = 0;
      |     ~~~~~~~~^~~
a.cc:21:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   21 |         if(dp[i]>=INF) continue;
      |            ~~~~~^~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

inline int adj(int x) {
  return min(max(x, 0), 255);
}
#define SQ(x) ((x)*(x))
int main() {
  int N, M, INF=1<<28;
  while(cin >> N >> M && (N|M)) {
    int C[M];
    for(int i=0; i<M; i++) cin >> C[i];
    int dp[2][256]; fill(dp[0], dp[0]+512, INF);
    dp[0][128] = 0;
    for(int k=0; k<N; k++) {
      for(int i=0; i<256; i++) dp[(k+1)%2][i] = INF;
      int in; cin >> in;
      for(int i=0; i<256; i++) {
        if(dp[i]>=INF) continue;
        for(int j=0; j<M; j++) {
          dp[(k+1)%2][adj(i+C[j])] = min(dp[(k+1)%2][adj(i+C[j])], dp[k%2][i]+SQ(in-adj(i+C[j])));
        }
      }
    }
    cout << *min_element(dp[N%2], dp[(N%2)+1]) << endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   21 |         if(dp[i]>=INF) continue;
      |            ~~~~~^~~~~
Language: C++

2 7
4
2
1
0
-1
-2
-4
131
137
2 7
4
2
1
0
-1
-2
-4
131
123
10 7
-4
-2
-1
0
1
2
4
132
134
135
134
132
128
124
122
121
122
5 1
255
0
0
0
0
0
4 1
0
255
0
255
0
0 0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 2 7
      | ^
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int c[30],x[30000];
int dp[300000][256];

int sq(int x) {
    return x*x;
}
int add(int x, int y) {
    return max(0, min(255, x+y));
}
int main(void) {
    while(1) {
        int n,m;
        scanf("%d%d",&n,&m);
        if(!n) break;
        memset(dp, 0x6F, sizeof(dp));

        for(int i=0; i<m; i++)
            scanf("%d",&c[i]);
        for(int i=0; i<n; i++)
            scanf("%d",&x[i]);

        for(int i=0; i<256; i++)
            dp[0][i] = 0xFFFFFF;
        dp[0][128] = 0;

        for(int i=0; i<n; i++)
            for(int j=0; j<256; j++)
                for(int k=0; k<m; k++)
                    dp[i+1][add(j,c[k])] = min(dp[i+1][add(j,c[k])], dp[i][j] + sq(x[i]-add(j,c[k])));

        int res=0xFFFFFF;
        for(int j=0; j<256; j++)
            res = min(res, dp[n][j]);

        printf("%d\n", res);

    }
    return 0;
}
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int c[30],x[30000];
int dp[300000][256];

int sq(int x) {
    return x*x;
}
int add(int x, int y) {
    return max(0, min(255, x+y));
}
int main(void) {
    while(1) {
        int n,m;
        scanf("%d%d",&n,&m);
        if(!n) break;
        memset(dp, 0x6F, sizeof(dp));

        for(int i=0; i<m; i++)
            scanf("%d",&c[i]);
        for(int i=0; i<n; i++)
            scanf("%d",&x[i]);

        for(int i=0; i<256; i++)
            dp[0][i] = 0xFFFFFF;
        dp[0][128] = 0;

        for(int i=0; i<n; i++)
            for(int j=0; j<256; j++)
                for(int k=0; k<m; k++)
                    dp[i+1][add(j,c[k])] = min(dp[i+1][add(j,c[k])], dp[i][j] + sq(x[i]-add(j,c[k])));

        int res=0xFFFFFF;
        for(int j=0; j<256; j++)
            res = min(res, dp[n][j]);

        printf("%d\n", res);

    }
    return 0;
}

Compiler output:
a.cc:50:5: error: redefinition of 'int c [30]'
   50 | int c[30],x[30000];
      |     ^
a.cc:6:5: note: 'int c [30]' previously declared here
    6 | int c[30],x[30000];
      |     ^
a.cc:50:11: error: redefinition of 'int x [30000]'
   50 | int c[30],x[30000];
      |           ^
a.cc:6:11: note: 'int x [30000]' previously declared here
    6 | int c[30],x[30000];
      |           ^
a.cc:51:5: error: redefinition of 'int dp [300000][256]'
   51 | int dp[300000][256];
      |     ^~
a.cc:7:5: note: 'int dp [300000][256]' previously declared here
    7 | int dp[300000][256];
      |     ^~
a.cc:53:5: error: redefinition of 'int sq(int)'
   53 | int sq(int x) {
      |     ^~
a.cc:9:5: note: 'int sq(int)' previously defined here
    9 | int sq(int x) {
      |     ^~
a.cc:56:5: error: redefinition of 'int add(int, int)'
   56 | int add(int x, int y) {
      |     ^~~
a.cc:12:5: note: 'int add(int, int)' previously defined here
   12 | int add(int x, int y) {
      |     ^~~
a.cc:59:5: error: redefinition of 'int main()'
   59 | int main(void) {
      |     ^~~~
a.cc:15:5: note: 'int main()' previously defined here
   15 | int main(void) {
      |     ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#define INF INT32_MAX

using namespace std;

int main(void) {
	cout << INF << endl;
	int N,M;
	while (cin >> N >> M, N) {
		vector<int> C(M);
		for (int i = 0; i < M; ++i) {
			cin >> C[i];
		}
		vector<int> x(N);
		for (int i = 0; i < N; ++i) {
			cin >> x[i];
		}

		vector< vector<int> > dp(256,vector<int>(N+1));
		for (int i = 0; i < 256; ++i) {
			for (int j = 0; j < N+1; ++j) {
				dp[i][j] = INF;
			}
		}
		dp[128][0] = 0;

		for (int j = 0; j < N; ++j) {
			for (int i = 0; i < 256; ++i) {
				if (dp[i][j] != INF) {
					for (int k = 0; k < M; ++k) {
						if (C[k]+i > 255) {
							dp[255][j+1] = min(dp[255][j+1],dp[i][j]+(int)pow(x[j]-255,2));
						}
						else if (C[k]+i < 0) {
							dp[0][j+1] = min(dp[0][j+1],dp[i][j]+(int)pow(x[j]-0,2));
						}
						else {
							dp[C[k]+i][j+1] = min(dp[C[k]+i][j+1],dp[i][j]+(int)pow(x[j]-C[k]-i,2));
						}
					}
				}
			}
		}

		int res = INF;
		for (int i = 0; i < 256; ++i) {
			if (dp[i][N] < res) {
				res = dp[i][N];
			}
		}
		cout << res << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:13: error: 'INT32_MAX' was not declared in this scope
    4 | #define INF INT32_MAX
      |             ^~~~~~~~~
a.cc:9:17: note: in expansion of macro 'INF'
    9 |         cout << INF << endl;
      |                 ^~~
a.cc:4:1: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    3 | #include <cmath>
  +++ |+#include <cstdint>
    4 | #define INF INT32_MAX
Language: C++

#include <iostream>
#include <algorithm>
#include <climits>

int c[16];
int x[20001];
int dp[256][20001];

int main() {
	int n, m;
	while (std::cin >> n >> m && (n || m)) {
		std::memset(dp, 0xff, sizeof(dp));
		for (int i = 0; i < m; i++) std::cin >> c[i];
		for (int i = 0; i < n; i++) std::cin >> x[i + 1];

		dp[128][0] = 0;
		for (int i = 1; i <= n; i++) { //????????????????????????
			for (int j = 0; j < 256; j++) { //?????????0~255??¨???????????????
				if (dp[j][i - 1] < 0) continue; //??????????????????
				for (int k = 0; k < m; k++) { //??¨?????????????????????????????????????????????
					int ny = j + c[k];
					if (ny < 0) ny = 0;
					else if (ny > 255) ny = 255;

					int v = (x[i] - ny) * (x[i] - ny);
					if (dp[ny][i] < 0) dp[ny][i] = dp[j][i - 1] + v;
					else {
						dp[ny][i] = std::min(dp[j][i - 1] + v, dp[ny][i]);
					}
				}
			}
		}
		int min = INT_MAX;
		for (int i = 0; i < 256; i++) if (dp[i][n] >= 0) min = std::min(dp[i][n], min);
		std::cout << min << std::endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:22: error: 'memset' is not a member of 'std'; did you mean 'wmemset'?
   12 |                 std::memset(dp, 0xff, sizeof(dp));
      |                      ^~~~~~
      |                      wmemset
Language: C++

#include<cstdlib>
#include<algorithm>

using namespace std;

const long long inf=1LL<<60;
long long memo[20000][256];

int main()
{
	for(int n,m;scanf("%d%d",&n,&m),n;){
		int c[16];
		static int x[20001];
		for(int i=0;i<m;i++)	scanf("%d",c+i);
		for(int i=0;i<n;i++)	scanf("%d",x+i);

		for(int i=0;i<=n;i++)for(int j=0;j<256;j++)	memo[i][j]=inf;

		memo[0][128]=0;
		for(int i=1;i<=n;i++){
			for(int j=0;j<256;j++){
				if(memo[i-1][j]==inf)	continue;
				for(int k=0;k<m;k++){
					int next=min(255,max(0,j+c[k]));
					memo[i][next]=min(memo[i][next],
						memo[i-1][j]+(next-x[i-1])*(next-x[i-1]));
				}
			}
		}

		long long emin=inf;
		for(int j=0;j<256;j++)	emin=min(emin,memo[n][j]);
		printf("%lld\n",emin);
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: 'scanf' was not declared in this scope
   11 |         for(int n,m;scanf("%d%d",&n,&m),n;){
      |                     ^~~~~
a.cc:33:17: error: 'printf' was not declared in this scope
   33 |                 printf("%lld\n",emin);
      |                 ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include<algorithm>
  +++ |+#include <cstdio>
    3 |
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

unsigned int errorSum[2][256];
bool concerning[2][256];

short samples[20001];
int codeBook[16];

int main() {
	int n, m;
	while(true) {

		cin >> n >> m;

		if (n == 0 && m == 0) {
			break;
		}

		for (int i = 0; i < m; i++) {
			cin >> codeBook[i];
		}
		for (int i = 1; i <= n; i++) {
			cin >> samples[i];
		}

		for (int i = 0; i < 256; i++) {
			errorSum[0][i] = errorSum[1][i] = INT32_MAX;
			concerning[0][i] = concerning[1][i] = false;
		}
		concerning[0][128] = true;

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 256; j++) {
				if(concerning[i % 2][j]) {
					concerning[i % 2][j] = false;
					for (int k = 0; k < m; k++) {
						int next = min(max(0, j + codeBook[k]), 255);
						unsigned int error = (errorSum[i % 2][j] == INT32_MAX ?
								0 : errorSum[i % 2][j])
								+ (next - samples[i+1]) * (next - samples[i+1]);

						if(error <= errorSum[(i+1) % 2][next]) {
							concerning[(i+1) % 2][next] = true;
							errorSum[(i+1) % 2][next] = error;
						}
					}
				}
				errorSum[i % 2][j] = INT32_MAX;
			}
		}

		unsigned int minError = INT32_MAX;
		int lastIndex = n % 2;
		for (int i = 0; i < 256; i++) {
			if(concerning[lastIndex][i]
			        && errorSum[lastIndex][i] < minError) {
				minError = errorSum[lastIndex][i];
			}
		}
		cout << minError << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:59: error: 'INT32_MAX' was not declared in this scope
   30 |                         errorSum[0][i] = errorSum[1][i] = INT32_MAX;
      |                                                           ^~~~~~~~~
a.cc:4:1: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    3 | #include <cmath>
  +++ |+#include <cstdint>
    4 | using namespace std;
a.cc:41:93: error: 'INT32_MAX' was not declared in this scope
   41 |                                                 unsigned int error = (errorSum[i % 2][j] == INT32_MAX ?
      |                                                                                             ^~~~~~~~~
a.cc:41:93: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:51:54: error: 'INT32_MAX' was not declared in this scope
   51 |                                 errorSum[i % 2][j] = INT32_MAX;
      |                                                      ^~~~~~~~~
a.cc:51:54: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:55:41: error: 'INT32_MAX' was not declared in this scope
   55 |                 unsigned int minError = INT32_MAX;
      |                                         ^~~~~~~~~
a.cc:55:41: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
Language: C++

#include<iostream>
#include<algorithm>
#define INF 100000000
using namespace std;
int main(){
	int n,m,dp[20][260],cb[20],input[20001];//now,now
	int temp;
	while(cin>>n>>m,n||m){
		memset(dp,-1,sizeof(dp));
		for(int i=0;i<m;i++)
			cin>>cb[i];
		for(int i=0;i<n;i++){
			cin>>input[i];
		}
		for(int i=0;i<=n;i++)
			fill(dp[i],dp[i]+256,INF);
		dp[0][128]=0;
		for(int i=0;i<n;i++)
		for(int j=0;j<=255;j++){
				if(dp[i][j]!=INF){
					for(int k=0;k<m;k++){
						temp=j+cb[k];
						if(temp>255)
						temp=255;
						else if(temp<0)
						temp=0;
						dp[i+1][temp]=min(dp[i+1][temp],dp[i][j]+(temp-input[i])*(temp-input[i]));
					}
				}
		}
		int ans=INF;
		for(int i=0;i<=255;i++){
		if(ans>dp[n][i])
		ans=dp[n][i];
		}
		cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'memset' was not declared in this scope
    9 |                 memset(dp,-1,sizeof(dp));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 | #define INF 100000000
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define REP(i,n) FOR(i,0,n)
typedef vector<int> vi;
typedef vector<vi> vii;

int main(){
	int n,m;
	while(cin>>n>>m,n&&m){
		vi c(m),x(n);
		REP(i,m){
			cin>>c[i];
		}
		REP(i,n){
			cin>>x[i];
		}

		vii dp(n+1,vi(256,INT_MAX));
		dp[0][128]=0;
		REP(i,n){
			REP(j,256){
				if(dp[i][j]==INT_MAX)continue;
				REP(k,m){
					int y=j+c[k];
					if(y<0)y=0;
					if(y>255)y=255;
					dp[i+1][y]=min(dp[i+1][y],dp[i][j]+(int)pow((double)y-x[i],2));
				}
			}
		}
		int ans=INT_MAX;
		REP(i,256){
			ans=min(ans,dp[n][i]);
		}
		cout<<ans<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:35: error: 'INT_MAX' was not declared in this scope
   22 |                 vii dp(n+1,vi(256,INT_MAX));
      |                                   ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <cmath>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include<string>
#include <vector>
#include <stack>
#include <map>
#include<iostream>
#include <algorithm>
#include <functional>

using namespace std;
int n;
int m;
int price;
int a;
int b;

struct G{
	string name;
	double value;
};
bool operator>(const G& left, const G& right)
{
	if(left.value>right.value){
		return true;
	}else if(left.value<right.value){
		return false; 
	}else{
		return left.name<right.name;
	}
}

bool operator<(const G& left, const G& right)
{
  	if(left.value>right.value){
		return false;
	}else if(left.value<right.value){
		return true; 
	}else{
		return left.name>right.name;
	}
}



int main(){
	while(true){
		cin >>n;
		cin >>m;

		if(n==0){
			break;
		}
		vector<int> codebook;
		vector<int> data;
		for(int i=0;i<m;i++){
			cin >> a;
			codebook.push_back(a);
		}
		for(int i=0;i<n;i++){
			cin >> a;
			data.push_back(a);
		}
		//値,誤差値でハッシュ。
		map<int,int> hash;
		hash[128]=0;

		for(int i=0;i<n;i++){
			int d=data[i];//次のデータ
			map<int,int>::iterator it = hash.begin();		
			map<int,int> next_hash;
			while( it != hash.end() )
			{
				for(int k=0;k<m;k++){
					int f=max(min((*it).first+codebook[k],255),0);
					int div=f-d;
					int s=(*it).second+div*div;
					if(next_hash.find(f)!= next_hash.end()){
						next_hash[f]=min(next_hash[f],s);
					}else{
						next_hash[f]=s;
					}
				}
				++it;
			}
			hash=next_hash;
		}
		int mi=INT_MAX;
		map<int,int>::iterator it = hash.begin();
		while( it != hash.end() )
		{
			mi=min((*it).second,mi);
			it++;
		}
		cout << mi <<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:86:24: error: 'INT_MAX' was not declared in this scope
   86 |                 int mi=INT_MAX;
      |                        ^~~~~~~
a.cc:8:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include <functional>
  +++ |+#include <climits>
    8 |
Language: C++

#include <iostream>
#include <string.h>
#include <algorithm>

#define N 50000
#define M 20
#define lengthof(x) (sizeof(x)/sizeof(*(x)))

int c[M];
int sum[256];
int bsum[256];

using namespace std;

int main(void)
{
	int n,m;
	int x;
	int i1,i2,i3;
	int minn;
	int temp;

	while(1){
		cin>>n>>m;
		if(n+m==0) break;

		memset(bsum,-1,sizeof(bsum));
		bsum[128]=0;

		for(i1=0;i1<m;i1++){
			cin>>c[i1];
		}

		for(i1=0;i1<n;i1++){
			cin>>x;
			fill((int*)sum,(int*)(sum+lengthof(sum)),INT_MAX);
			for(i2=0;i2<256;i2++){
				if(bsum[i2]!=-1){
					for(i3=0;i3<m;i3++){
						temp=i2+c[i3];
						if(temp<0) temp=0;
						if(255<temp) temp=255;

						sum[temp]=min(sum[temp],bsum[i2]+(temp-x)*(temp-x));
					}
				}
			}

			for(i2=0;i2<256;i2++){
				if(sum[i2]<INT_MAX) bsum[i2]=sum[i2];
				else bsum[i2]=-1;
			}
		}

		minn=sum[0];
		for(i1=0;i1<256;i1++){
			if(minn>sum[i1]) minn=sum[i1];
		}

		cout<<minn<<endl;

	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:66: error: 'INT_MAX' was not declared in this scope
   36 |                         fill((int*)sum,(int*)(sum+lengthof(sum)),INT_MAX);
      |                                                                  ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 |
Language: C++

#include <iostream>

using namespace std;

int main() {
 int n,m;
 while(cin >> n >> m, n) {
  vector<int> code(m), value(n);
  for (int i = 0; i < m; i++)
   cin >> code[i];
  for (int i = 0; i < n; i++)
   cin >> value[i];
  vector<vector<int> > dp(256, vector<int>(n + 1, 1000000000));
  dp[0][128] = 0;
  for (int i = 0; i < n; i++) {
   for (int j = 0; j < 256; j++) {
    for (int k = 0; k < m; k++) {
     int val = min(255,max(0,j+code[k]));
     dp[i+1][val] = min(dp[i+1][val], dp[i][j] + (val -value[i]) * (val - value[i]));
    }
   }
  }
  int ans = 1000000000;
  for (int i = 0; i < 256; i++) {
   ans = min(ans, dp[n][val]);
  }
  cout << ans << endl;
 }
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> code(m), value(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | 
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> code(m), value(n);
      |          ^~~
a.cc:10:11: error: 'code' was not declared in this scope
   10 |    cin >> code[i];
      |           ^~~~
a.cc:12:11: error: 'value' was not declared in this scope
   12 |    cin >> value[i];
      |           ^~~~~
a.cc:13:17: error: expected primary-expression before 'int'
   13 |   vector<vector<int> > dp(256, vector<int>(n + 1, 1000000000));
      |                 ^~~
a.cc:14:3: error: 'dp' was not declared in this scope
   14 |   dp[0][128] = 0;
      |   ^~
a.cc:18:32: error: 'code' was not declared in this scope
   18 |      int val = min(255,max(0,j+code[k]));
      |                                ^~~~
a.cc:19:56: error: 'value' was not declared in this scope; did you mean 'val'?
   19 |      dp[i+1][val] = min(dp[i+1][val], dp[i][j] + (val -value[i]) * (val - value[i]));
      |                                                        ^~~~~
      |                                                        val
a.cc:25:25: error: 'val' was not declared in this scope
   25 |    ans = min(ans, dp[n][val]);
      |                         ^~~
Language: C++

#include <iostream>
#include <vector>
 
using namespace std;
 
int main() {
 int n,m;
 while(cin >> n >> m, n) {
  vector<int> code(m), value(n);
  for (int i = 0; i < m; i++)
   cin >> code[i];
  for (int i = 0; i < n; i++)
   cin >> value[i];
  vector<vector<int> > dp(256, vector<int>(n + 1, 1000000000));
  dp[0][128] = 0;
  for (int i = 0; i < n; i++) {
   for (int j = 0; j < 256; j++) {
    for (int k = 0; k < m; k++) {
     int val = min(255,max(0,j+code[k]));
     dp[i+1][val] = min(dp[i+1][val], dp[i][j] + (val -value[i]) * (val - value[i]));
    }
   }
  }
  int ans = 1000000000;
  for (int i = 0; i < 256; i++) {
   ans = min(ans, dp[n][val]);
  }
  cout << ans << endl;
 }
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:25: error: 'val' was not declared in this scope; did you mean 'value'?
   26 |    ans = min(ans, dp[n][val]);
      |                         ^~~
      |                         value
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
int main() {
 int n,m;
 while(cin >> n >> m, n) {
  vector<int> code(m), value(n);
  for (int i = 0; i < m; i++)
   cin >> code[i];
  for (int i = 0; i < n; i++)
   cin >> value[i];
  vector<vector<int> > dp(256, vector<int>(n + 1, 1000000000));
  dp[0][128] = 0;
  for (int i = 0; i < n; i++) {
   for (int j = 0; j < 256; j++) {
    for (int k = 0; k < m; k++) {
     int val = min(255,max(0,j+code[k]));
     dp[i+1][val] = min(dp[i+1][val], dp[i][j] + (val -value[i]) * (val - value[i]));
    }
   }
  }
  int ans = 1000000000;
  for (int i = 0; i < 256; i++) {
   ans = min(ans, dp[n][val]);
  }
  cout << ans << endl;
 }
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:25: error: 'val' was not declared in this scope; did you mean 'value'?
   27 |    ans = min(ans, dp[n][val]);
      |                         ^~~
      |                         value
Language: C++

#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

const int INF = 1<<29;

int main(){
  int n, m;
  while(cin >> n >> m && (n|m)){
    vector<int> C(m);
    for(int i=0; i<m; i++) cin >> C[i];
    
    vector<int> dp(256, INF);
    dp[128] = 0;
    while(n--) {
      vector<int> next(256, INF);
      int in; cin >> in;
      for(int i=0; i<=255; i++){
	if(dp[i] < INF) {
	  for(int j=0; j<m; j++){
	    int now = i + C[j];
	    if(now < 0)   { now = 0;   }
	    if(now > 255) { now = 255; }
	    int diff = (in - now) * (in - now);
	    next[now] = min(next[now], dp[i] + diff );
	  }
	}
      }
      dp = next;
    }
    
    cout << *min_element(dp.begin(), dp.end()) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:14: error: 'min_element' was not declared in this scope
   34 |     cout << *min_element(dp.begin(), dp.end()) << endl;
      |              ^~~~~~~~~~~