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

#include <iostream>
#include <string>
using namespace std;
class data{
public:
  string words;  
  int page;
  bool operator < (const data&s)const{
    if(words < s.words) return true;
    else if(words > s.words) return false;
    else{
      if(page < s.page) return true;
      else return false;
    }
  }
};
int main(){
  int i=0;
  data in[1000];
  while(cin >> in[i].words){
    cin >> in[i].page;
    i++;
  }
  
  sort(in,in+i);

  cout << in[0].words << endl << in[0].page;
  for(int j=1;j<i;j++){
    if(in[j-1].words != in[j].words){
      cout << endl;
      cout << in[j].words << endl << in[j].page;
    }
    else{
      cout << ' ' << in[j].page;
    }
  }
  cout << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:3: error: reference to 'data' is ambiguous
   19 |   data in[1000];
      |   ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:4:7: note:                 'class data'
    4 | class data{
      |       ^~~~
a.cc:20:16: error: 'in' was not declared in this scope; did you mean 'i'?
   20 |   while(cin >> in[i].words){
      |                ^~
      |                i
a.cc:25:8: error: 'in' was not declared in this scope; did you mean 'i'?
   25 |   sort(in,in+i);
      |        ^~
      |        i
a.cc:25:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   25 |   sort(in,in+i);
      |   ^~~~
      |   short
Language: C++

#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<queue>

using namespace std;

#define PSI pair<string,int>

vector<PSI> book;

int main(void){
	int x;
	char tmp[1024];
	while(scanf("%s%d",tmp,&x)!=EOF){
		string a;
		a = tmp;
		book.push_back(PSI(a,x));
	}
	
	sort(book.begin(),book.end());
	
	for(int i = 0; i < book.size(); i++){
		vector<int> ans;
		puts(book[i].first.c_str());
		ans.push_back(book[i].second);
		while(i+1<book.size() && book[i+1].first==book[i].first){
			i++;
			ans.push_back(book[i].second);	
		}
		sort(ans.begin(),ans.end());
		for(int j = 0; j < ans.size(); j++){
			if(j != 0)printf(" ");
			printf("%d",ans[j]);
		}puts("");
		
	}
	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 'sqrt'?
   22 |         sort(book.begin(),book.end());
      |         ^~~~
      |         sqrt
Language: C++

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

class tWord{
public:
	friend tWord;
	string word;
	vector<int> page;
	tWord( string w );
	friend bool operator <( const tWord& l, const tWord& r ){
		return (strcmp(l.word.c_str(), r.word.c_str())<0);
	}
};
tWord::tWord( string w ){
	word = w;
	page.clear();
}

int main(){
	vector<tWord> words;
	string line;
	int n;
	char w[31];

	// input
	while(1){
		getline( cin, line );
		if( line.size()==0 ) break;
		sscanf(line.c_str(), "%s %d", w, &n);
		int i;
		for( i=0; i<words.size(); i++ ){
			if( words[i].word == w ){
				break;
			}
		}
		if( i == words.size() ){
			string ww = w;
			words.push_back(ww);
		}
		words[i].page.push_back(n);
	}

	// output
	sort( words.begin(), words.end() );
	for( int i=0; i<words.size(); i++ ){
		if( words[i].word != "" ){
			cout << words[i].word << endl;
			sort( words[i].page.begin(), words[i].page.end() );
			cout << words[i].page[0];
			for( int j=1; j<words[i].page.size(); j++ ){
				cout << " " << words[i].page[j];
			}
			cout << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc:8:16: warning: class 'tWord' is implicitly friends with itself
    8 |         friend tWord;
      |                ^~~~~
a.cc: In function 'bool operator<(const tWord&, const tWord&)':
a.cc:13:25: error: 'strcmp' was not declared in this scope
   13 |                 return (strcmp(l.word.c_str(), r.word.c_str())<0);
      |                         ^~~~~~
a.cc:4:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<vector>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc: In function 'int main()':
a.cc:46:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   46 |         sort( words.begin(), words.end() );
      |         ^~~~
      |         short
Language: C++

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

class tWord{
public:
	string word;
	vector<int> page;
	tWord( string w );
	bool operator <( const tWord& r ){
		return (strcmp(word.c_str(), r.word.c_str())<0);
	}
};
tWord::tWord( string w ){
	word = w;
	page.clear();
}

int main(){
	vector<tWord> words;
	string line;
	int n;
	char w[31];

	// input
	while(1){
		getline( cin, line );
		if( line.size()==0 ) break;
		sscanf(line.c_str(), "%s %d", w, &n);
		int i;
		for( i=0; i<words.size(); i++ ){
			if( words[i].word == w ){
				break;
			}
		}
		if( i == words.size() ){
			string ww = w;
			words.push_back(ww);
		}
		words[i].page.push_back(n);
	}

	// output
	sort( words.begin(), words.end() );
	for( int i=0; i<words.size(); i++ ){
		if( words[i].word != "" ){
			cout << words[i].word << endl;
			sort( words[i].page.begin(), words[i].page.end() );
			cout << words[i].page[0];
			for( int j=1; j<words[i].page.size(); j++ ){
				cout << " " << words[i].page[j];
			}
			cout << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In member function 'bool tWord::operator<(const tWord&)':
a.cc:13:25: error: 'strcmp' was not declared in this scope
   13 |                 return (strcmp(word.c_str(), r.word.c_str())<0);
      |                         ^~~~~~
a.cc:5:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

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

using namespace std;

string char_to_str(char *c) {
	string ret = "";

	for (; *c; ++c)
		ret += *c;

	return ret;
}

int main() {
	map<string, vector<int> > m;
	vector<string> words;

	char word[50]; int page;
	while (scanf("%s%d\n", word, &page) != EOF) {
		string str = char_to_str(word);
		m[str].push_back(page);
		words.push_back(str);
	}

	sort( words.begin(), words.end() );
	words.erase( unique( words.begin(), words.end() ), words.end() );

	for (int i = 0; i < words.size(); ++i) {
		vector<int> v = m[words[i]];
		sort( v.begin(), v.end() );

		cout << words[i] << endl;
		for (int j = 0; j < v.size(); ++j) {
			cout << v[j];
			if (j+1 < v.size()) cout << " ";
		}
		cout << endl;
	}
}

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

#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
#include<set>

using namespace std;

int main(void){

	string index;
	int page;
	map<string,set<int> >dic;
	
	while(cin >> index >> page)
		dic[index].insert(page);
	
	 map<string,set<int> >::iterator it = dic.begin();
    for(;it != dic.end();it++){
        cout << it->first << endl;
    	
        set<int>::iterator its = (it->second).begin();
    	
        while(its != (it->second).end()){
            cout << *its;
            cout << (++its != (it->second).end() ? " " : endl);
        }
    }
	
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:58: error: overloaded function with no contextual type information
   27 |             cout << (++its != (it->second).end() ? " " : endl);
      |                                                          ^~~~
Language: C++

int main(){
  string a;
  int b;
  map<string,set<int> > kok;
  map<string,set<int> >::iterator it;
  while(cin >> a >> b){
    it = kok.find(a);
    if(it != kok.end())
      it->second.insert(b);
    else{
      set<int> p;
      p.insert(b);
      kok[a] = p;
    }
  }
  for(it=kok.begin(); it!=kok.end(); ++it){
    cout << it->first << endl;
    set<int>::iterator i;
    int u = 0;
    for(i=it->second.begin(); i!=it->second.end(); ++i){
      cout << *i;
      if(u != it->second.size()-1)
	cout << " ";
      u++;
    }
    cout << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:3: error: 'string' was not declared in this scope
    2 |   string a;
      |   ^~~~~~
a.cc:4:3: error: 'map' was not declared in this scope
    4 |   map<string,set<int> > kok;
      |   ^~~
a.cc:4:14: error: 'set' was not declared in this scope
    4 |   map<string,set<int> > kok;
      |              ^~~
a.cc:4:18: error: expected primary-expression before 'int'
    4 |   map<string,set<int> > kok;
      |                  ^~~
a.cc:5:18: error: expected primary-expression before 'int'
    5 |   map<string,set<int> >::iterator it;
      |                  ^~~
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |   while(cin >> a >> b){
      |         ^~~
a.cc:6:16: error: 'a' was not declared in this scope
    6 |   while(cin >> a >> b){
      |                ^
a.cc:7:5: error: 'it' was not declared in this scope; did you mean 'int'?
    7 |     it = kok.find(a);
      |     ^~
      |     int
a.cc:7:10: error: 'kok' was not declared in this scope
    7 |     it = kok.find(a);
      |          ^~~
a.cc:11:11: error: expected primary-expression before 'int'
   11 |       set<int> p;
      |           ^~~
a.cc:12:7: error: 'p' was not declared in this scope
   12 |       p.insert(b);
      |       ^
a.cc:16:7: error: 'it' was not declared in this scope; did you mean 'int'?
   16 |   for(it=kok.begin(); it!=kok.end(); ++it){
      |       ^~
      |       int
a.cc:16:10: error: 'kok' was not declared in this scope
   16 |   for(it=kok.begin(); it!=kok.end(); ++it){
      |          ^~~
a.cc:17:5: error: 'cout' was not declared in this scope
   17 |     cout << it->first << endl;
      |     ^~~~
a.cc:17:26: error: 'endl' was not declared in this scope
   17 |     cout << it->first << endl;
      |                          ^~~~
a.cc:18:9: error: expected primary-expression before 'int'
   18 |     set<int>::iterator i;
      |         ^~~
a.cc:20:9: error: 'i' was not declared in this scope
   20 |     for(i=it->second.begin(); i!=it->second.end(); ++i){
      |         ^
Language: C++

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

map<string,set<int>> p;

int main()
{
    string str;
    int t;
    while (cin >> str >> t) p[str].insert(t);
    for (auto it = p.begin(); it != p.end(); it++) {
        cout << it->first  << endl << it->second[0];
        for (int j = 1; j < it->second.size(); j++)
            cout << " " << it->second[j];
        cout << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:49: error: no match for 'operator[]' (operand types are 'std::set<int>' and 'int')
   15 |         cout << it->first  << endl << it->second[0];
      |                                                 ^
a.cc:17:38: error: no match for 'operator[]' (operand types are 'std::set<int>' and 'int')
   17 |             cout << " " << it->second[j];
      |                                      ^
Language: C++

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

map<string,vector<int> > p;

int main()
{
    string str;
    int t;
    while (cin >> str >> t) p[str].insert(t);
    for (auto it = p.begin(); it != p.end(); it++) {
	auto s = it->second.bigen();
        cout << it->first  << endl << *s;
        for (++s; s != it->second.end(); s++)
            cout << " " << *s;
        cout << endl;
    }

    return 0;
}

Compiler output:
a.cc:7:12: error: 'vector' was not declared in this scope
    7 | map<string,vector<int> > p;
      |            ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <set>
  +++ |+#include <vector>
    4 | #include <string>
a.cc:7:22: error: template argument 2 is invalid
    7 | map<string,vector<int> > p;
      |                      ^
a.cc:7:22: error: template argument 4 is invalid
a.cc:7:24: error: expected unqualified-id before '>' token
    7 | map<string,vector<int> > p;
      |                        ^
a.cc: In function 'int main()':
a.cc:13:29: error: 'p' was not declared in this scope
   13 |     while (cin >> str >> t) p[str].insert(t);
      |                             ^
a.cc:14:20: error: 'p' was not declared in this scope
   14 |     for (auto it = p.begin(); it != p.end(); it++) {
      |                    ^
Language: C++

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

map<string,set<int>> p;

int main()
{
    string str;
    int t;
    while (cin >> str >> t) p[str].insert(t);
    for (auto it = p.begin(); it != p.end(); it++) {
        auto s = it->second.bigen();
        cout << it->first  << endl << *s;
        for (++s; s != it->second.end(); s++)
            cout << " " << *s;
        cout << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:29: error: 'class std::set<int>' has no member named 'bigen'
   15 |         auto s = it->second.bigen();
      |                             ^~~~~
Language: C++

#include<cstdio>
#include<map>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
int main(void)
{
	map<string,vector<int>　> index;
	vector<string> name;
	string key;
	int page;
	while((cin>>key>>page))
	{
		int flg=0;
		for(int f1=0;f1<name.size();f1++)
		{
			if(name[f1]==key)flg=1;
		}
		if(!flg)name.push_back(key);
		index[key].push_back(page);
	}
	sort(name.begin(),name.end());
	for(int f1=0;f1<name.size();f1++)
	{
		sort(index[name[f1]].begin(),index[name[f1]].end());
		cout<<name[f1]<<endl;
		for(int f2=0;f2<index[name[f1]].size();f2++)
		{
			cout<<index[name[f1]][f2]<<" ";
		}
		cout<<endl;
	}
	/*
	fflush(stdin);
	getchar();
	*/
	return 0;
}

Compiler output:
a.cc:10:31: error: extended character 　 is not valid in an identifier
   10 |         map<string,vector<int>　> index;
      |                               ^
a.cc: In function 'int main()':
a.cc:10:33: error: template argument 2 is invalid
   10 |         map<string,vector<int>　> index;
      |                                 ^
a.cc:10:33: error: template argument 4 is invalid
a.cc:22:22: error: no match for 'operator[]' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   22 |                 index[key].push_back(page);
      |                      ^
a.cc:27:27: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
   27 |                 sort(index[name[f1]].begin(),index[name[f1]].end());
      |                           ^
a.cc:27:51: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
   27 |                 sort(index[name[f1]].begin(),index[name[f1]].end());
      |                                                   ^
a.cc:29:38: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
   29 |                 for(int f2=0;f2<index[name[f1]].size();f2++)
      |                                      ^
a.cc:31:36: error: no match for 'operator[]' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'})
   31 |                         cout<<index[name[f1]][f2]<<" ";
      |                                    ^
Language: Java

/*
 * Copyright Narushima Hironori. All rights reserved.
 */
package aizuonlinejudge;

import java.io.*;
import java.util.*;

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0106
 */
public class Calculator {
	
	static class Shop {
		int price, volume, discountedPrice, discountedPer;
		
		public Shop(int volume, int price, double discount, int per) {
			this.volume = volume;
			this.price = price;
			
			discountedPrice = (int) (price * per - price * per * discount);
			discountedPer = per;
		}
		
		int calcPrice(int count) {
			int total = 0;
			while(count >= discountedPer) {
				total += discountedPrice;
				count -= discountedPer;
			}
			return total + price * count;
		}
		
		int maxBuyCount(int buyVolume) {
			return buyVolume / volume;
		}
		
	}

	public static void main(String[] args) throws IOException {
		Calculator calc = new Calculator();
		
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		for (String l; (l = r.readLine()) != null;) {
			int volume = Integer.parseInt(l);
			if(volume == 0) {
				break;
			}
			System.out.println(calc.calc(volume));
		}
		
	}

	Shop[] shops = {
			new Shop(200, 380, 0.20, 5),
			new Shop(300, 550, 0.15, 4),
			new Shop(500, 850, 0.12, 3),
	};
	
	public int calc(int volume) {
		if(volume % 100 != 0) {
			throw new IllegalArgumentException();
		}
		
		int[] buyCounts = new int[shops.length + 1];
		List<int[]> results = new ArrayList<int[]>();
		calc(results, buyCounts, 0, volume);
		
		Collections.sort(results, new Comparator<int[]>() {
			
			@Override
			public int compare(int[] a, int[] b) {
				int ap = a[shops.length];
				int bp = b[shops.length];
				return ap < bp ? -1 : ap == bp ? 0 : 1;
			};
			
		});
		/*
		System.out.println("Volume=" + volume + "-------------------------------------------------------");
		for (int[] r : results) {
			System.out.println(Arrays.toString(r));
		}
		
		int[] r = results.get(0);
		System.out.println("Best buy=" + Arrays.toString(r));
		for (int i = 0; i < r.length - 1; i++) {
			System.out.println( r[i] + " count buys from shop#" + i + " (" + (shops[i].volume * r[i]) + "g) " + shops[i].calcPrice(r[i]));
		}
		*/
		return results.get(0)[shops.length];
	}

	void calc(List<int[]> results, int[] count, int shopIndex, int buyVolume) {
		if(shops.length == shopIndex) {
			if(buyVolume == 0) {
				int total = 0;
				for (int i = 0; i < shops.length; i++) {
					total += shops[i].calcPrice(count[i]);
				}
				count[shopIndex] = total;
				results.add(count.clone());
			}
		} else {
			Shop shop = shops[shopIndex];
			int maxBuyCount = shop.maxBuyCount(buyVolume);
			for (int buyCount = 0; buyCount <= maxBuyCount; buyCount++) {
				count[shopIndex] = buyCount;
				int nextBuyVolume = buyVolume - shop.volume * buyCount;
				calc(results, count, shopIndex + 1, nextBuyVolume);
			}
		}
	}

}

Compiler output:
Main.java:12: error: class Calculator is public, should be declared in a file named Calculator.java
public class Calculator {
       ^
1 error
Language: Java

/*
 * Copyright Narushima Hironori. All rights reserved.
 */
import java.io.*;

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0106
 */
public class BuckwheatCalculator {
	
	static class Shop {
		
		int price, volume, discountedPrice, discountPer;
		
		Shop(int volume, int price, double discount, int per) {
			this.volume = volume;
			this.price = price;
			
			discountedPrice = (int) (price * per - price * per * discount);
			discountPer = per;
		}
		
		int calcPrice(int count) {
			int total = 0;
			while(count >= discountPer) {
				total += discountedPrice;
				count -= discountPer;
			}
			return total + price * count;
		}
		
		int maxBuyCount(int buyVolume) {
			return buyVolume / volume;
		}
		
	}

	Shop[] shops = {
			new Shop(200, 380, 0.20, 5),
			new Shop(300, 550, 0.15, 4),
			new Shop(500, 850, 0.12, 3)
	};
	
	public int calc(int volume) {
		if(volume % 100 != 0) {
			throw new IllegalArgumentException();
		}
		
		int[] buyCounts = new int[shops.length + 1];
		buyCounts[shops.length] = Integer.MAX_VALUE;
		calc(buyCounts, 0, volume);
		return buyCounts[shops.length];
	}

	void calc(int[] count, int shopIndex, int buyVolume) {
		if(shops.length == shopIndex) {
			if(buyVolume == 0) {
				int total = 0;
				for (int i = 0; i < shops.length; i++) {
					total += shops[i].calcPrice(count[i]);
				}
				if(count[shopIndex] > total) {
					count[shopIndex] = total;
				}
			}
		} else {
			Shop shop = shops[shopIndex];
			int maxBuyCount = shop.maxBuyCount(buyVolume);
			for (int buyCount = 0; buyCount <= maxBuyCount; buyCount++) {
				count[shopIndex] = buyCount;
				int nextBuyVolume = buyVolume - shop.volume * buyCount;
				calc(count, shopIndex + 1, nextBuyVolume);
			}
		}
	}

	public static void main(String[] args) throws IOException {
		BuckwheatCalculator calculator = new BuckwheatCalculator();
		
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		for (String l; (l = r.readLine()).length() > 0;) {
			int volume = Integer.parseInt(l);
			if(volume == 0) {
				break;
			}
			System.out.println(calculator.calc(volume));
		}
	}


}

Compiler output:
Main.java:9: error: class BuckwheatCalculator is public, should be declared in a file named BuckwheatCalculator.java
public class BuckwheatCalculator {
       ^
1 error
Language: Java

import java.io.IOException;
import java.util.Scanner;


public class AOJ0106 {
	public static int[] A={200,380,5,20};
	public static int[] B={300,550,4,15};
	public static int[] C={500,850,3,12};
	public static void main(String[] args)throws IOException{
		Scanner scan = null;
		try{
			scan = new Scanner(System.in);
			for(;;){
				int d =scan.nextInt();
				if(d ==0)break;
				System.out.println(Math.min(calc(d,A),Math.min(calc(d,B), calc(d,C))));
			}
		}finally{
			if(scan !=null)scan.close();
		}
	}
	public static int calc(int size,int[] data){
		int fukuro = size / data[0];
		if(size%data[0] !=0)fukuro++;
		int nokori = fukuro % data[2];
		int waribiki = fukuro -nokori;
		int nedan = waribiki * data[1] *(100 - data[3]) /100 + nokori * data[1];
		return nedan;
	}

}

Compiler output:
Main.java:5: error: class AOJ0106 is public, should be declared in a file named AOJ0106.java
public class AOJ0106 {
       ^
1 error
Language: C

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

int main(void)
{
    int cost[3] = {380, 550, 850};
    int weight[3] = {200, 300, 500};
    int i, j;
    int ans[5001];
    
    memset(ans, -1, sizeof(ans));
    ans[0] = 0;
    
    for (i = 0; i < 3; i++){
        for (j = 0; j + weight[i] <= 5000; j += 100){
            if (ans[j] != -1){
                if (ans[j + weight[i]] != -1){
                    if (min(ans[j + weight[i]], ans[j] + cost[i]) != ans[j + weight[i]]){
                        ans[j + weight[i]] = ans[j] + cost[i];
                    }
                }
                else {
                    ans[j + weight[i]] = ans[j] + cost[i];
                }
            }
        }
    }
    
    cost[0] = 380 * 5 * 0.8;
    cost[1] = 550 * 4 * 0.85;
    cost[2] = 850 * 3 * 0.88;
    
    for (i = 0; i < 3; i++){
        for (j = 0; j + weight[i] * (5 - i) <= 5000; j += 100){
            if (ans[j + weight[i] * (5 - i)] != -1){
                if (min(ans[j + weight[i] * (5 - i)], ans[j] + cost[i]) != ans[j + weight[i] * (5 - i)]){
                    ans[j + weight[i] * (5 - i)] = ans[j] + cost[i];
                }
            }
            else {
                ans[j + weight[i] * (5 - i)] = ans[j] + cost[i];
            }
        }
    }
    
    while (1){
        scanf("%d", &i);
        
        if (i == 0){
            break;
        }
        
        printf("%d\n", ans[i]);
    }
    
    return (0);
}

Compiler output:
main.c: In function 'main':
main.c:19:25: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
   19 |                     if (min(ans[j + weight[i]], ans[j] + cost[i]) != ans[j + weight[i]]){
      |                         ^~~
      |                         main
Language: C

#include <strings.h>
#include <stdio.h>
#include <sys/limits.h>

int min;

int calc(int a, int b, int c) {
    int ma = (a / 5) * 5 * 380 * 0.8 + (a % 5) * 380;
    int mb = (b / 4) * 4 * 550 * 0.85 + (b % 4) * 550;
    int mc = (c / 3) * 3 * 850 * 0.88 + (c % 3) * 850;
    return ma + mb + mc;
}

void shopping(int amount) {
    int a, b, total;
    for (a = 0;  a <= amount / 200; a++) {
        for (b = 0;  b <= (amount - a*200) / 300; b++) {
            int remain = amount - a*200 - b*300;
            if (remain % 500 == 0) {
                total = calc(a, b, remain /500);
                if (min > total)
                    min = total;
            }
        }
    }
}

int main(void) {
    int amount;

    while (scanf("%d", &amount), amount) {
        min = INT_MAX;
        shopping(amount);
        printf("%d\n", min);
    }

    return 0;
}

Compiler output:
main.c:3:10: fatal error: sys/limits.h: No such file or directory
    3 | #include <sys/limits.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
 
int minof(int min,int y){
  min=(min<y)?min:y;
  return min;
}
 
int main(){
  int min[51], g,i,j,k,l;
  while(1){
    scanf("%d",&g);
    if(g==0){
      break;
    };
    g/=100;
    for(l=0;l<51;l+=1){
      min[l]=100000;
    };
    for(i=0;i<26;i+=1){
      for(j=0;j<17;j+= 1){
        for(k=0;k<11;k+=1){
          if(2*i+3*j+5*k==g){
            min[2*i+3*j+5*k]=minof(min[2*i+3*j+5*k],(i/5)*1520+(i%5)*380+(j/4)*1870+(j%4)*550+(k/3)*2244+(k%3)*850);
          };
        };
      };
    };
    printf("%d\n", min[g]);
  };
  return 0;

Compiler output:
main.c: In function 'main':
main.c:30:3: error: expected declaration or statement at end of input
   30 |   return 0;
      |   ^~~~~~
Language: C++

#include <iostream>
#include <cstdio>
using namespace std;

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
	while(1) {
		int m;
		cin >> m;
		if(m == 0) break;
		m /= 100;
		int ret = INT_MAX;
		rep(i,m/2+1) {
			rep(j,m/3+1) {
				rep(k,m/5+1) {
					if(i * 2 + j * 3 + k * 5 == m) {
						int sum = 0;
						sum += i * 380 + j * 550 + k * 850;
						sum -= i / 5 * (int) (380 * 5 * 0.2) + j / 4 * (int) (550 * 4 * 0.15)
							+ k / 3 * (int) (850 * 3 * 0.12);
						if(sum < ret) {
							ret = sum;
						}
					}
				}
			}
		}
		cout << ret << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:27: error: 'INT_MAX' was not declared in this scope
   13 |                 int ret = INT_MAX;
      |                           ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cstdio>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

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

struct soba{
	double gram;
	double yen;
	soba(double g, double y){gram=g;yen=y;}
};

double n;
double min_y;
vector<soba> v;


void buy(double sum_g, double sum_y){
	int len = v.size();
	for(int i=0;i < len;i++){
		if(sum_g == n){
			min_y = min(min_y, sum_y);
			return;
		}else if(sum_g > n){
			break;
		}
		buy(sum_g+v[i].gram, sum_y+v[i].yen);
	}
	return;
}


int main(){
	int sum_g, sum_y;
	v.push_back(soba(200,380));
	v.push_back(soba(200*5, (380*5) * 0.8));
	v.push_back(soba(300,550));
	v.push_back(soba(300*4, (550*4) * 0.85));
	v.push_back(soba(500,850));
	v.push_back(soba(500*3, (850*3) * 0.88));
	while(true){
		cin>>n; if(n==0) break;
		min_y = DBL_MAX;
		buy(0,0);
		cout<<int(min_y)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:25: error: 'DBL_MAX' was not declared in this scope
   41 |                 min_y = DBL_MAX;
      |                         ^~~~~~~
a.cc:3:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
    2 | #include<vector>
  +++ |+#include <cfloat>
    3 | using namespace std;
Language: C++

#include<iostream>
using nameaspace std;

//?????????
#define AG 200
#define BG 300
#define CG 500
//?????????
#define AM 380
#define BM 550
#define CM 850
//??????????????????
#define AN 5
#define BN 4
#define CN 3
//??????????????????
#define AP 20
#define BP 15
#define BP 12

int main(){
	int g;
	int a,b,c;
	int total;
	int money,work;
	
	while(1){
	 cin>>g;
	 if(g==0){break;}
	 a=0;b=0;c=0;
	 total=0;money=0;
	 
	 for(c=0;c*CG<=g;c++){
	  for(b=0;c*CG+b*BG<=g;b++){
		total=c*CG+b*BG;
		a=(g-total)/200;
		total+=a*AG;
		if(total!=g){continue;}
		//???????¨????
		work=(a/AN)*AN*AM*AP/100+(a%AN)*AM + (b/BN)*BN*BM*BP/100+(b%BN)*BM + (c/CN)*CN*CM*CP/100+(c%CN)*CM;
		if(money<work){money=work;}
	  }
	 }
	 
	 cout<<money<<endl;
	}
	return 0;
}

Compiler output:
a.cc:19:9: warning: "BP" redefined
   19 | #define BP 12
      |         ^~
a.cc:18:9: note: this is the location of the previous definition
   18 | #define BP 15
      |         ^~
a.cc:2:7: error: expected nested-name-specifier before 'nameaspace'
    2 | using nameaspace std;
      |       ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:28:10: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   28 |          cin>>g;
      |          ^~~
      |          std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:40:99: error: 'CP' was not declared in this scope; did you mean 'CG'?
   40 |                 work=(a/AN)*AN*AM*AP/100+(a%AN)*AM + (b/BN)*BN*BM*BP/100+(b%BN)*BM + (c/CN)*CN*CM*CP/100+(c%CN)*CM;
      |                                                                                                   ^~
      |                                                                                                   CG
a.cc:45:10: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   45 |          cout<<money<<endl;
      |          ^~~~
      |          std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:45:23: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   45 |          cout<<money<<endl;
      |                       ^~~~
      |                       std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream>
using namespace std;

//?????????
#define AG 200
#define BG 300
#define CG 500
//?????????
#define AM 380
#define BM 550
#define CM 850
//??????????????????
#define AN 5
#define BN 4
#define CN 3
//??????????????????
#define AP 20
#define BP 15
#define BP 12

int main(){
	int g;
	int a,b,c;
	int total;
	int money,work;
	
	while(1){
	 cin>>g;
	 if(g==0){break;}
	 a=0;b=0;c=0;
	 total=0;money=0;
	 
	 for(c=0;c*CG<=g;c++){
	  for(b=0;c*CG+b*BG<=g;b++){
		total=c*CG+b*BG;
		a=(g-total)/200;
		total+=a*AG;
		if(total!=g){continue;}
		//???????¨????
		work=(a/AN)*AN*AM*AP/100+(a%AN)*AM + (b/BN)*BN*BM*BP/100+(b%BN)*BM + (c/CN)*CN*CM*CP/100+(c%CN)*CM;
		if(money<work){money=work;}
	  }
	 }
	 
	 cout<<money<<endl;
	}
	return 0;
}

Compiler output:
a.cc:19:9: warning: "BP" redefined
   19 | #define BP 12
      |         ^~
a.cc:18:9: note: this is the location of the previous definition
   18 | #define BP 15
      |         ^~
a.cc: In function 'int main()':
a.cc:40:99: error: 'CP' was not declared in this scope; did you mean 'CG'?
   40 |                 work=(a/AN)*AN*AM*AP/100+(a%AN)*AM + (b/BN)*BN*BM*BP/100+(b%BN)*BM + (c/CN)*CN*CM*CP/100+(c%CN)*CM;
      |                                                                                                   ^~
      |                                                                                                   CG
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
int n, ret;
int main() {
    while(true) {
        scanf("%d", &n);
        if(n == 0) break;
        ret = 999999999;
        for(int a = 0; a <= 13; a++) {
            for(int b = 0; b <= 9; b++) {
                for(int c = 0; c <= 5; c++) {
                    int value = a * 200 + b * 300 + c * 500;
                    if(n == value) {
                        ret = min(ret, (a / 5) * 1520 + (a % 5) * 380 + (b / 4) * 1870 * (b % 4) * 550 + (c / 3) * 2244 + (c % 3) * 850;
                    }
                }
            }
        }
        printf("%d\n", ret);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:136: error: expected ')' before ';' token
   15 |                         ret = min(ret, (a / 5) * 1520 + (a % 5) * 380 + (b / 4) * 1870 * (b % 4) * 550 + (c / 3) * 2244 + (c % 3) * 850;
      |                                  ~                                                                                                     ^
      |                                                                                                                                        )
Language: C++

??¶???????????°???????????°

Compiler output:
a.cc:1:3: error: extended character ¶ is not valid in an identifier
    1 | ??¶???????????°???????????°
      |   ^
a.cc:1:15: error: extended character ° is not valid in an identifier
    1 | ??¶???????????°???????????°
      |               ^
a.cc:1:27: error: extended character ° is not valid in an identifier
    1 | ??¶???????????°???????????°
      |                           ^
a.cc:1:1: error: expected unqualified-id before '?' token
    1 | ??¶???????????°???????????°
      | ^
Language: C++

5 8 105
8 5 105
1 2 24
99 98 24
12 13 26
1 22 23
1 13 201
13 16 112
2 24 50
1 82 61
1 84 125
1 99 999
99 1 999
98 99 999
1 99 11
99 1 12
0 0 0

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

#include <iostream>

int opts[6][2] = {{2, 380},   {3, 550},   {5, 850},
                  {10, 1520}, {12, 1870}, {15, 2244}};

int func(int qnt, int index, int subqnt, int subcost) {
    if (qnt == subqnt) return subcost;
    if (index < 0) return -1;
    int i = (qnt - subqnt) / opts[index][0];
    int min_cost = INT_MAX;
    while (i >= 0) {
        int res = func(qnt, index - 1, subqnt + opts[index][0] * i,
                       subcost + opts[index][1] * i);
        if (res > 0 && min_cost > res) min_cost = res;
        i--;
    }
    return min_cost;
}

int main() {
    int n;
    while (std::cin >> n && n > 0) {
        n /= 100;
        std::cout << func(n, 5, 0, 0) << std::endl;
    }
}

Compiler output:
a.cc: In function 'int func(int, int, int, int)':
a.cc:10:20: error: 'INT_MAX' was not declared in this scope
   10 |     int min_cost = INT_MAX;
      |                    ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 |
Language: C++

#include<iostream>

using namespace std;

int main() {
    while(1){
      int n;
      cin >> n;
      if(n==0) break;
      int min = 1000000;
      int fee;
      for(int a=0;a<=n/200+1;a++){
	for(int b=0;b<=n/300+1;b++){
	  for(int c=0;c<=n/500+1;c++){
	    if(a*200+b*300+c*500==n){
	      fee=a*380+b*550+c*850;
	    if(a>=5) fee+=((a/5)*5*380)*0.8-(a/5*5*380);
	  if(b>=4) fee+=((b/4)*4*550)*0.85-(b/4*4*550);
	if(c>=3) fee+=((c/3)*3*850)*0.88-(c/3*3*850);
      if(min>fee) min=fee;
	    }


Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: expected '}' at end of input
   21 |             }
      |              ^
a.cc:14:38: note: to match this '{'
   14 |           for(int c=0;c<=n/500+1;c++){
      |                                      ^
a.cc:21:14: error: expected '}' at end of input
   21 |             }
      |              ^
a.cc:13:36: note: to match this '{'
   13 |         for(int b=0;b<=n/300+1;b++){
      |                                    ^
a.cc:21:14: error: expected '}' at end of input
   21 |             }
      |              ^
a.cc:12:34: note: to match this '{'
   12 |       for(int a=0;a<=n/200+1;a++){
      |                                  ^
a.cc:21:14: error: expected '}' at end of input
   21 |             }
      |              ^
a.cc:6:13: note: to match this '{'
    6 |     while(1){
      |             ^
a.cc:21:14: error: expected '}' at end of input
   21 |             }
      |              ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include <stdio.h>
#define MIN(a,b) ((a>b)? b:a)
#define INT_MAX (1<<22)

int dp[61];
int data[61];

int search(int remains){
  if(dp[remains]) return data[remains];

  if(remains == 0) return 0;
  if(remains == 1) return INT_MAX;

  int k=INT_MAX;

  if(remains >= 15) k = MIN(k, search(remains-15)+2244);
  if(remains >= 12) k = MIN(k, search(remains-12)+1870);
  if(remains >= 10) k = MIN(k, search(remains-10)+1520);
  if(remains >= 5) k = MIN(k, search(remains-5)+850);
  if(remains >= 3) k = MIN(k, search(remains-3)+550);
  if(remains >= 2) k = MIN(k, search(remains-2)+380);

  dp[remains] = 1;
  return data[remains] = k;
}


int main(){
  int i;
  for(i=0;i<=60;i++) dp[i] = 0, data[i] = 0;

  search(60);
  
  int m = INT_MAX;
  /*for(i=60;i>=0;i--) {
    if(dp[i]) {
      m = data[i] = MIN(data[i], m);
    }else {
      data[i] = m;
    }
  }*/

  int n;
  while(1){
    scanf("%d", &n);
    if(n==0) break;

Compiler output:
a.cc: In function 'int main()':
a.cc:46:20: error: expected '}' at end of input
   46 |     if(n==0) break;
      |                    ^
a.cc:44:11: note: to match this '{'
   44 |   while(1){
      |           ^
a.cc:46:20: error: expected '}' at end of input
   46 |     if(n==0) break;
      |                    ^
a.cc:28:11: note: to match this '{'
   28 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main(){
	int weight;
	while(cin >> weight){
		if(weight == 0) break;
		int minimum_cost = INT_MAX;
		for(int i = 0; (i-1) * 200 < weight; i++){
			int w2 = weight - 200 * i;
			for(int j = 0; (j-1) * 300 < w2; j++){
				int w3 = w2 - 300 * j;
				int k = 0;
				while(k * 500 < w3) k++;
				int cost = (i / 5) * 1520 + (i % 5) * 380
					+ (j / 4) * 1870 + (j % 4) * 550
					+ (k / 3) * 2244 + (k % 3) * 850;
				minimum_cost = min(minimum_cost, cost);
			}
		}
		cout << minimum_cost << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:36: error: 'INT_MAX' was not declared in this scope
   10 |                 int minimum_cost = INT_MAX;
      |                                    ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <cstdlib>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include<iostream>
#define INF 10000000
using namespace std;
int main(){
	int m[]={380,550,850,1520,1870,2244},dp[100010],
	w[]={2,3,5,10,12,15};
	for(int i=0;i<=100000;i++)
		dp[i]=INF;
	dp[0]=0;
	for(int i=0;i<6;i++)
	for(int j=w[i];j<=100000;j++){
		//if(dp[j-w[i]]==INF)
		//dp[j]=min(m[i],dp[j]);
		//else
		dp[j]=min(dp[j],dp[j-w[i]]+m[i]);
		if(j==22)
		//cout<<i<<' '<<dp[j]<<endl;
	}
	//for(int i=0;i<=2500;i++)
	//cout<<' '<<dp[i]<<endl;
	int n;
	while(cin>>n,n){
		n/=100;
		int ans=INF;
		for(int i=n;i<=n+16;i++){
			if(dp[i]!=INF)
			ans=min(ans,dp[i]);
		}
		cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: expected primary-expression before '}' token
   18 |         }
      |         ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
#define NUM 6
#define MAX 5000
struct Data{int weight,cost;};
int main()
{
  int n;
  int dp[MAX+1]={0};
  Data item[NUM]={
    {200,380},{300,550},{500,850},{1000,1520},{1200,1870},{1500,2244}
  };
  for(int j=0;j<=MAX;j++)dp[j]=INT_MAX>>2;
  dp[0]=0;
  for(int i=0;i<NUM;i++){
    for(int j=item[i].weight;j<=MAX;j++){
      dp[j] = min( dp[j], dp[j-item[i].weight] + item[i].cost );
    }
  }

  while(cin>>n,n){
    cout<<dp[n]<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:32: error: 'INT_MAX' was not declared in this scope
   14 |   for(int j=0;j<=MAX;j++)dp[j]=INT_MAX>>2;
      |                                ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<algorithm>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <iostream>
using namespace std;

int main() {
  int combi[100000][3] = {0},m=0;
  int input,price[100000] = {0};
  int a,b,c,a1,b1,c1;

  while(cin >> input) {
    if(input = 0) break;
    for(int i=0;i<26;i++) {//generate combination of weight over input
      for(int j=0;j<17;j++) {
        for(int k=0;k<11;k++) {
          if(input <= 200*i + 300*j + 500*k) {
            combi[m][0] = i;
            combi[m][1] = j;
            combi[m][2] = k;
            m++;
          }
        }
      }
    }

    for(int i=0;i<m;i++) {//calculate price[i] from combi[i]
      a = combi[i][0] / 5;//sale
      a1 = combi[i][0] - a*5;//not sale
      b = combi[i][1] / 4;//sale
      b1 = combi[i][1] - b*4;//not sale
      c = combi[i][2] / 3;//sale
      c1 = combi[i][2] - c*3;//not sale
      price[i] = 1520 * a + 380 * a1 + 1870 * b + 550 * b1 + 2244 * c + 850 * c1;
    }

    sort(price,price+m);

    cout << price[0] << endl;
  }
}

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

#include <iostream>
using namespace std;

const int MAX_WEIGHT = 5000;
const int MIN_WEIGHT = 500;

struct Comodity{
	int weight, price, unit;
	double rate;
};

Comodity com_list[] = {
	{ 200, 380, 5, 0.8 },
	{ 300, 550, 4, 0.85 },
	{ 500, 850, 3, 0.88 },
};

enum{
	A,
	B,
	C,
};

int quantity( int remain, int unit_weight ){
	return remain > 0 ? remain / unit_weight + ( remain % unit_weight ? 1 : 0 ) : 0;
}

int calcPrice( int a, int b, int c ){
	int dis_a = a / com_list[ A ].unit * com_list[ A ].unit;
	int dis_b = b / com_list[ B ].unit * com_list[ B ].unit;
	int dis_c = c / com_list[ C ].unit * com_list[ C ].unit;
	a -= dis_a;
	b -= dis_b;
	c -= dis_c;
	return ( a * com_list[ A ].price ) + ( b * com_list[ B ].price ) + ( c * com_list[ C ].price )
		+ (int)( dis_a * com_list[ A ].price * com_list[ A ].rate )
		+ (int)( dis_b * com_list[ B ].price * com_list[ B ].rate )
		+ (int)( dis_c * com_list[ C ].price * com_list[ C ].rate );
}

int main()
{
	int weight;

	while( cin >> weight && weight ){
		int best_price = INT_MAX;
		int remain_a = weight;
		int a = quantity( remain_a, com_list[ A ].weight );
		for( ; a >= 0; --a ){
			int remain_b = remain_a - a * com_list[ A ].weight;
			int b = quantity( remain_b, com_list[ B ].weight );
			for( ; b >= 0; --b ){
				int remain_c = remain_b - b * com_list[ B ].weight;
				int c = quantity( remain_c, com_list[ C ].weight );
				best_price = min( best_price, calcPrice( a, b, c ) );
			}
		}
		cout << best_price << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:34: error: 'INT_MAX' was not declared in this scope
   46 |                 int best_price = INT_MAX;
      |                                  ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

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

const int MAX_WEIGHT = 5000;
const int MIN_WEIGHT = 500;

struct Comodity{
	int weight, price, unit;
	double rate;
};

Comodity com_list[] = {
	{ 200, 380, 5, 0.8 },
	{ 300, 550, 4, 0.85 },
	{ 500, 850, 3, 0.88 },
};

enum{
	A,
	B,
	C,
};

int quantity( int remain, int unit_weight ){
	return remain > 0 ? remain / unit_weight + ( remain % unit_weight ? 1 : 0 ) : 0;
}

int calcPrice( int a, int b, int c ){
	int dis_a = a / com_list[ A ].unit * com_list[ A ].unit;
	int dis_b = b / com_list[ B ].unit * com_list[ B ].unit;
	int dis_c = c / com_list[ C ].unit * com_list[ C ].unit;
	a -= dis_a;
	b -= dis_b;
	c -= dis_c;
	return ( a * com_list[ A ].price ) + ( b * com_list[ B ].price ) + ( c * com_list[ C ].price )
		+ (int)( dis_a * com_list[ A ].price * com_list[ A ].rate )
		+ (int)( dis_b * com_list[ B ].price * com_list[ B ].rate )
		+ (int)( dis_c * com_list[ C ].price * com_list[ C ].rate );
}

int main()
{
	int weight;

	while( cin >> weight && weight ){
		int best_price = INT_MAX;
		int remain_a = weight;
		int a = quantity( remain_a, com_list[ A ].weight );
		for( ; a >= 0; --a ){
			int remain_b = remain_a - a * com_list[ A ].weight;
			int b = quantity( remain_b, com_list[ B ].weight );
			for( ; b >= 0; --b ){
				int remain_c = remain_b - b * com_list[ B ].weight;
				int c = quantity( remain_c, com_list[ C ].weight );
				best_price = min( best_price, calcPrice( a, b, c ) );
			}
		}
		cout << best_price << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:34: error: 'INT_MAX' was not declared in this scope
   47 |                 int best_price = INT_MAX;
      |                                  ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cmath>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
 
using namespace std;
 
const int inf = 999999;
 
int main()
{
  int r = inf, w;
 
  for(int i = 0; i <= 25; i++){
    for(int j = 0; j <= 17; j++){
      for(int k = 0; k <= 10; k++){
    w = i*200+j*300+k*500;
    if(n == w){
      r = min(r, (i/5)*1520 + (i%5)*380 + 1870*(j/4) + (j%4)*550 + 2244*(k/3) + (k%3)*850);
    } else if(n < w){
      break;
    }
      }
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:16:8: error: 'n' was not declared in this scope
   16 |     if(n == w){
      |        ^
a.cc:23:4: error: expected '}' at end of input
   23 |   }
      |    ^
a.cc:9:1: note: to match this '{'
    9 | {
      | ^
Language: C++

#include <iostream>
#include <algorithm>
 
using namespace std;
 
const int inf = 999999;
 
int main()
{
  int n;
  int r = inf, w;
 
  for(int i = 0; i <= 25; i++){
    for(int j = 0; j <= 17; j++){
      for(int k = 0; k <= 10; k++){
    w = i*200+j*300+k*500;
    if(n == w){
      r = min(r, (i/5)*1520 + (i%5)*380 + 1870*(j/4) + (j%4)*550 + 2244*(k/3) + (k%3)*850);
    } else if(n < w){
      break;
    }
      }
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:24:4: error: expected '}' at end of input
   24 |   }
      |    ^
a.cc:9:1: note: to match this '{'
    9 | {
      | ^