Language: C++

import java.util.Scanner;

class PenSet{
        int number;
        int value;

        PenSet(int x,int y){
                number = x;
                value = y;
        }
}

class Pencils{
        public static void main(String[] args){
                int val,num,setNum,i,j,min=0;

                Scanner scn = new Scanner(System.in);
                num = scn.nextInt();
                setNum = scn.nextInt();
                val = scn.nextInt();
                PenSet x = new PenSet(setNum,val);
                setNum = scn.nextInt();
                val = scn.nextInt();
                PenSet y = new PenSet(setNum,val);

                for(i=-1;i*x.number<num;i++){
                        for(j=0;(i+1)*x.number+j*y.number<num;j++);
                        if(i==-1||((i+1)*x.value + j*y.value)<min)
                                min=((i+1)*x.value + j*y.value);
                }

                System.out.println(min);

        }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:11:2: error: expected ';' after class definition
   11 | }
      |  ^
      |  ;
a.cc:14:15: error: expected ':' before 'static'
   14 |         public static void main(String[] args){
      |               ^~~~~~~
      |               :
a.cc:14:33: error: 'String' has not been declared
   14 |         public static void main(String[] args){
      |                                 ^~~~~~
a.cc:14:42: error: expected ',' or '...' before 'args'
   14 |         public static void main(String[] args){
      |                                          ^~~~
a.cc:35:2: error: expected ';' after class definition
   35 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Pencils::main(int*)':
a.cc:17:17: error: 'Scanner' was not declared in this scope
   17 |                 Scanner scn = new Scanner(System.in);
      |                 ^~~~~~~
a.cc:18:23: error: 'scn' was not declared in this scope
   18 |                 num = scn.nextInt();
      |                       ^~~
a.cc:21:49: error: 'PenSet::PenSet(int, int)' is private within this context
   21 |                 PenSet x = new PenSet(setNum,val);
      |                                                 ^
a.cc:7:9: note: declared private here
    7 |         PenSet(int x,int y){
      |         ^~~~~~
a.cc:21:28: error: conversion from 'PenSet*' to non-scalar type 'PenSet' requested
   21 |                 PenSet x = new PenSet(setNum,val);
      |                            ^~~~~~~~~~~~~~~~~~~~~~
a.cc:24:49: error: 'PenSet::PenSet(int, int)' is private within this context
   24 |                 PenSet y = new PenSet(setNum,val);
      |                                                 ^
a.cc:7:9: note: declared private here
    7 |         PenSet(int x,int y){
      |         ^~~~~~
a.cc:24:28: error: conversion from 'PenSet*' to non-scalar type 'PenSet' requested
   24 |                 PenSet y = new PenSet(setNum,val);
      |                            ^~~~~~~~~~~~~~~~~~~~~~
a.cc:26:30: error: 'int PenSet::number' is private within this context
   26 |                 for(i=-1;i*x.number<num;i++){
      |                              ^~~~~~
a.cc:4:13: note: declared private here
    4 |         int number;
      |             ^~~~~~
a.cc:27:41: error: 'int PenSet::number' is private within this context
   27 |                         for(j=0;(i+1)*x.number+j*y.number<num;j++);
      |                                         ^~~~~~
a.cc:4:13: note: declared private here
    4 |         int number;
      |             ^~~~~~
a.cc:27:52: error: 'int PenSet::number' is private within this context
   27 |                         for(j=0;(i+1)*x.number+j*y.number<num;j++);
      |                                                    ^~~~~~
a.cc:4:13: note: declared private here
    4 |         int number;
      |             ^~~~~~
a.cc:28:44: error: 'int PenSet::value' is private within this context
   28 |                         if(i==-1||((i+1)*x.value + j*y.value)<min)
      |                                            ^~~~~
a.cc:5:13: note: declared private here
    5 |         int value;
      |             ^~~~~
a.cc:28:56: error: 'int PenSet::value' is private within this context
   28 |                         if(i==-1||((i+1)*x.value + j*y.value)<min)
      |                                                        ^~~~~
a.cc:5:13: note: declared private here
    5 |         int value;
      |             ^~~~~
a.cc:29:46: error: 'int PenSet::value' is private within this context
   29 |                                 min=((i+1)*x.value + j*y.value);
      |                                              ^~~~~
a.cc:5:13: note: declared private here
    5 |         int value;
      |             ^~~~~
a.cc:29:58: error: 'int PenSet::value' is private within this context
   29 |                                 min=((i+1)*x.value + j*y.value);
      |                                                          ^~~~~
a.cc:5:13: note: declared private here
    5 |         int value;
      |             ^~~~~
a.cc:32:17: error: 'System' was not declared in this scope
   32 |                 System.out.println(min);
      |                 ^~~~~~