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

#include <iostream>
#include <bits/stdc++.h>
#define long long int lld

int main(){
  lld a,b,n;
  lld temp1;
  lld temp2;
    temp1 = ((b-1)*a)/b;
  	temp2 = (a*n)/b - a*(n/b);
  cout << min(temp1,temp2);
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'lld' was not declared in this scope
    6 |   lld a,b,n;
      |   ^~~
a.cc:7:6: error: expected ';' before 'temp1'
    7 |   lld temp1;
      |      ^~~~~~
      |      ;
a.cc:8:6: error: expected ';' before 'temp2'
    8 |   lld temp2;
      |      ^~~~~~
      |      ;
a.cc:9:5: error: 'temp1' was not declared in this scope
    9 |     temp1 = ((b-1)*a)/b;
      |     ^~~~~
a.cc:9:15: error: 'b' was not declared in this scope
    9 |     temp1 = ((b-1)*a)/b;
      |               ^
a.cc:9:20: error: 'a' was not declared in this scope
    9 |     temp1 = ((b-1)*a)/b;
      |                    ^
a.cc:10:9: error: 'temp2' was not declared in this scope
   10 |         temp2 = (a*n)/b - a*(n/b);
      |         ^~~~~
a.cc:10:20: error: 'n' was not declared in this scope; did you mean 'yn'?
   10 |         temp2 = (a*n)/b - a*(n/b);
      |                    ^
      |                    yn
a.cc:11:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 |   cout << min(temp1,temp2);
      |   ^~~~
      |   std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:11:11: error: 'min' was not declared in this scope; did you mean 'std::min'?
   11 |   cout << min(temp1,temp2);
      |           ^~~
      |           std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include <bits/stdc++.h>
#define ll long long 
#define rep(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define endl "\n"
#define dd double
#define mp make_pair
#define fi first
#define se second
#define ull unsigned int long long
const int INF = INT_MAX;
#define all(x) x.begin(),x.end()
#define mod 1000000007
#define deci(n) fixed << setprecision(n)
using namespace std;
int main(){
    ll a,b,n;
    cin>>a>>b>>n;
    vector <ll>v;
    ll n=min(b,n); 
    for(ll i=0;i<=n;i++)
    {
        ll res = floor((a*i)/b)-a*(floor(i/b));
        v.pb(res);
    }
    ll f = *max_element(all(v));
    cout<<f<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:8: error: redeclaration of 'long long int n'
   20 |     ll n=min(b,n);
      |        ^
a.cc:17:12: note: 'long long int n' previously declared here
   17 |     ll a,b,n;
      |            ^
Language: C++

#include <bits/stdc++.h>
#define ll long long 
#define rep(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define endl "\n"
#define dd double
#define mp make_pair
#define fi first
#define se second
#define ull unsigned int long long
const int INF = INT_MAX;
#define all(x) x.begin(),x.end()
#define mod 1000000007
#define deci(n) fixed << setprecision(n)
using namespace std;
int main(){
    ll a,b,n;
    cin>>a>>b>>n;
    vector <ll>v;
    ll n=min(b,n); 
    for(ll i=1;i<=n;i++)
    {
        ll res = floor((a*i)/b)-a*(floor(i/b));
        v.pb(res);
    }
    ll f = *max_element(all(v));
    cout<<f<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:8: error: redeclaration of 'long long int n'
   20 |     ll n=min(b,n);
      |        ^
a.cc:17:12: note: 'long long int n' previously declared here
   17 |     ll a,b,n;
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long A,B,N;
	cin>>A>>B>>N;
	long long y=B-1;
	if (N<B)  y=N;
	cout<<((y%B)*A)/B; 
	re 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 're' was not declared in this scope
   10 |         re 0;
      |         ^~
Language: C++

#include<bits/stdc++.h>

int main(){
	long long a, b, n; cin >> a >> b >> n;
  	long i = 0;
  long long max1;
  long long max2;
  	while(1){
    	if(i * b -1>n) {
          max1 = a*((i-1)*b - 1)/b;
          max2 = ((i-1)*b - 1)/b;
          max2 *= a;
          cout << max1 - max2 << endl;
          return 0;
        }
    }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:28: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    4 |         long long a, b, n; cin >> a >> b >> n;
      |                            ^~~
      |                            std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 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:13:11: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   13 |           cout << max1 - max2 << 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:13:34: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   13 |           cout << max1 - max2 << endl;
      |                                  ^~~~
      |                                  std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<bits/stdc++>

int main(){
	long long a, b, n; cin >> a >> b >> n;
  	long i = 0;
  long long max1;
  long long max2;
  	while(1){
    	if(i * b -1>n) {
          max1 = a*((i-1)*b - 1)/b;
          max2 = ((i-1)*b - 1)/b;
          max2 *= a;
          cout << max1 - max2 << endl;
          return 0;
        }
    }
  return 0;
}

Compiler output:
a.cc:1:9: fatal error: bits/stdc++: No such file or directory
    1 | #include<bits/stdc++>
      |         ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  int a,b,N;
  cin>>a>>b>>N;
  int =min(N,b-1);
  cout<<(a*x)/b-a*(x/b)<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: expected unqualified-id before '=' token
    6 |   int =min(N,b-1);
      |       ^
a.cc:7:12: error: 'x' was not declared in this scope
    7 |   cout<<(a*x)/b-a*(x/b)<<endl;
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,n;
  cin>>a>>b>>n;
  long long x=0;
  vector<int> ans; 
  while(((a*x)/b)-(a*(x/b))<a && x<=n && x<=B-1){
    ans.push_back(((a*x)/b)-(a*(x/b)));
    x++;
  }
  sort(ans.begin(),ans.end());
  reverse(ans.begin(),ans.end());
  cout<<ans.at(0)<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:45: error: 'B' was not declared in this scope
    8 |   while(((a*x)/b)-(a*(x/b))<a && x<=n && x<=B-1){
      |                                             ^
Language: C++

#include <iostream >
#include<cstdio>
using namespace std;
typedef long long LL;
int main()
{
    LL a,b,n,d;
    scanf("%lld%lld%lld",&a,&b,&n);
    if(n>b) d = b-1;
    else d = n;
    printf("%lld\n",a*d/b);
    return 0;
}


Compiler output:
a.cc:1:10: fatal error: iostream : No such file or directory
    1 | #include <iostream >
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream >
using namespace std;
typedef long long LL; 
int main()
{
    LL a,b,n,d;
    cin>>a>>b>>n;
    if(n>b) d = b-1;
    else d = n;
    printf("%lld\n",a*d/b);
    return 0;
}


Compiler output:
a.cc:1:10: fatal error: iostream : No such file or directory
    1 | #include <iostream >
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int A B N;
  cin >> A >> B >> N;
  int i = min(B,N);
  cout << floor((A * i) / B) - A * floor(i / B) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: expected initializer before 'B'
    4 |   int A B N;
      |         ^
a.cc:5:10: error: 'A' was not declared in this scope
    5 |   cin >> A >> B >> N;
      |          ^
a.cc:5:15: error: 'B' was not declared in this scope
    5 |   cin >> A >> B >> N;
      |               ^
a.cc:5:20: error: 'N' was not declared in this scope
    5 |   cin >> A >> B >> N;
      |                    ^
Language: C++

int main(int argc, const char * argv[]) {
    long long A, B, N, max=0;
    std::cin >> A >> B >> N;
    
    for(long long i=1;i<=N;i++){
        long long temp=i+B;
        if(max<temp){
            max=temp;
        }
    }
    
    // insert code here...
    std::cout << max;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:3:10: error: 'cin' is not a member of 'std'
    3 |     std::cin >> A >> B >> N;
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int main(int argc, const char * argv[]) {
a.cc:13:10: error: 'cout' is not a member of 'std'
   13 |     std::cout << max;
      |          ^~~~
a.cc:13:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main(){
    cin >>a>>b>>n;
    n=min(b-1,n);
    cout << a*n/b; <<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: 'a' was not declared in this scope
    7 |     cin >>a>>b>>n;
      |           ^
a.cc:7:14: error: 'b' was not declared in this scope
    7 |     cin >>a>>b>>n;
      |              ^
a.cc:7:17: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |     cin >>a>>b>>n;
      |                 ^
      |                 yn
a.cc:9:20: error: expected primary-expression before '<<' token
    9 |     cout << a*n/b; <<endl;
      |                    ^~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;

ll a,b,n;
ll f(int x){
    ll ans (a*x)/b;
    return ans;
}

int main(){
    int ans;
    cin >>a>>b>>n;
    
    cout << f(min(b-1,n)) <<endl;
    return 0;
}

Compiler output:
a.cc: In function 'll f(int)':
a.cc:8:17: error: expected ',' or ';' before '/' token
    8 |     ll ans (a*x)/b;
      |                 ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;

ll a,b,n;
ll f(int x){
    ll ans (a*x)/b
    return ans;
}

int main(){
    int ans;
    cin >>a>>b>>n;
    
    cout << f(min(b-1,n)) <<endl;
    return 0;
}

Compiler output:
a.cc: In function 'll f(int)':
a.cc:8:17: error: expected ',' or ';' before '/' token
    8 |     ll ans (a*x)/b
      |                 ^
a.cc:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
Language: C

#include<stdio.h>

int main(){
  long long a,b,c,ans;
  scanf("%d%d%d",&a,&b,&n);
  if(n>=b){
    ans=(a*(b-1)-(a*(b-1))%b)/b;
  }else{ans=(a*n-(a*n)%b)/b;}
  printf("%lld",ans);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:25: error: 'n' undeclared (first use in this function)
    5 |   scanf("%d%d%d",&a,&b,&n);
      |                         ^
main.c:5:25: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int main(){
  long long a,b,c,ans;
  scanf("%d%d%d",&a,&b,&n);
  if(n>=b){
    ans=((a*(b-1))-((a*(b-1))%b))/b;
  }else{ans=(a*(n))-((a*(n))%b))/b;}
  printf("%lld",ans);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:25: error: 'n' undeclared (first use in this function)
    5 |   scanf("%d%d%d",&a,&b,&n);
      |                         ^
main.c:5:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:32: error: expected ';' before ')' token
    8 |   }else{ans=(a*(n))-((a*(n))%b))/b;}
      |                                ^
      |                                ;
main.c:8:32: error: expected statement before ')' token
main.c:8:33: error: expected expression before '/' token
    8 |   }else{ans=(a*(n))-((a*(n))%b))/b;}
      |                                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll A,B,N;
  cin>>A>>B>>N;
  ll x=N;
  if(N>=B-1){
    x=B-1;
  }
    ll ans = A(x%B)-A*x%B;
    cout<<ans<<endl;
  
  
}
    
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: 'A' cannot be used as a function
   11 |     ll ans = A(x%B)-A*x%B;
      |              ~^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll A,B,N;
  cin>>A>>B>>N;
  ll x=N;
  if(x>=B-1){
    N%B=B-1;
  }
    ll ans = A(x%B)-A*x%B;
    cout<<ans<<endl;
  
  
}
    
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:9:6: error: lvalue required as left operand of assignment
    9 |     N%B=B-1;
      |     ~^~
a.cc:11:15: error: 'A' cannot be used as a function
   11 |     ll ans = A(x%B)-A*x%B;
      |              ~^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll A,B,N;
  cin>>A>>B>>N;
  ll x%B=N;
  if(x>=B-1){
    x=B-1;
  }
    ll ans = A(x%B)-A*x%B;
    cout<<ans<<endl;
  
  
}
    
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: expected initializer before '%' token
    7 |   ll x%B=N;
      |       ^
a.cc:8:6: error: 'x' was not declared in this scope
    8 |   if(x>=B-1){
      |      ^
a.cc:11:16: error: 'x' was not declared in this scope
   11 |     ll ans = A(x%B)-A*x%B;
      |                ^
a.cc:11:19: error: 'A' cannot be used as a function
   11 |     ll ans = A(x%B)-A*x%B;
      |                   ^
Language: C++

#include <bits/stdc++.h>

#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(int i=1; i<= (int)n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,l,r) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define ri(n) scanf("%d",&n)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<char,int> pci;
typedef tuple<int, int, int> tiii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cout<< setprecision(20)<< fixed;
  double a, b;
  ll n;
  cin>> a>> b>> n;
  ll ans = min(n, b-1);
  ans = floor(a*ans/b) - ll(a)*floor(double(ans)/b);
  cout<< ans<<el;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:31:15: error: no matching function for call to 'min(ll&, double)'
   31 |   ll ans = min(n, b-1);
      |            ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:31:15: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double')
   31 |   ll ans = min(n, b-1);
      |            ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:31:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   31 |   ll ans = min(n, b-1);
      |            ~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main(){
    ll a, b, n, res = 0;
    cin >> a >> b >> n;
    for(ll i=b-1; i<=n; i+=b){
        res = max(res, (ll)floor((double)a * (double)i / (double) b) - a * (ll)floor((double)i / (double) b));
    }
    if(res == 0){
        res = max(res, (ll)floor((double)a * (double)n / (double) b) - a * (ll)floor((double)n / (double) b))
    }
    cout << res;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:110: error: expected ';' before '}' token
   15 |         res = max(res, (ll)floor((double)a * (double)n / (double) b) - a * (ll)floor((double)n / (double) b))
      |                                                                                                              ^
      |                                                                                                              ;
   16 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main(){
    ll a, b, n, res = 0;
    cin >> a >> b >> n;
    for(ll i=b-1; i<=n; i+=b){
        res = max(res, floor((double)a * (double)b / (double) b) - a * floor((double)b / (double) b));
    }
    cout << res;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:18: error: no matching function for call to 'max(ll&, double)'
   12 |         res = max(res, floor((double)a * (double)b / (double) b) - a * floor((double)b / (double) b));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:12:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double')
   12 |         res = max(res, floor((double)a * (double)b / (double) b) - a * floor((double)b / (double) b));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:12:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   12 |         res = max(res, floor((double)a * (double)b / (double) b) - a * floor((double)b / (double) b));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll A,B,N;
  cin>>A>>B>>N;
  ll N=x;
  if(x>=B-1){
    x=B-1;
  }
    ll ans = A(x%B)-A*x%B;
    cout<<ans<<endl;
  
  
}
    
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:7:6: error: redeclaration of 'long long int N'
    7 |   ll N=x;
      |      ^
a.cc:5:10: note: 'long long int N' previously declared here
    5 |   ll A,B,N;
      |          ^
a.cc:7:8: error: 'x' was not declared in this scope
    7 |   ll N=x;
      |        ^
a.cc:11:19: error: 'A' cannot be used as a function
   11 |     ll ans = A(x%B)-A*x%B;
      |                   ^
Language: Java

import java.util.*;
class Main{
    static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        long A = sc.nextLong();
        long B = sc.nextLong();
        long N = sc.nextLong();
        long i =Math.min(B-1,N);
        System.out.println((A*i/B)-A*(i/B))
        }
    }
}

Compiler output:
Main.java:9: error: ';' expected
        System.out.println((A*i/B)-A*(i/B))
                                           ^
Main.java:12: error: class, interface, enum, or record expected
}
^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int a, b, n;
    cin >> a >> B >> n;

    cout << max(n, (b - 1));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: 'B' was not declared in this scope
    7 |     cin >> a >> B >> n;
      |                 ^
Language: C++

#include<stdio.h>
using namespace std;

int main()
{
    long long int a,b,c,x;
    cin >> a >> b >> c;
    if(b-1<c)
    {
        x = b-1;
    }
    else
    {
        x = c;
    }
    cout << x * a / b << endl;
    

}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> a >> b >> c;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:16:5: error: 'cout' was not declared in this scope
   16 |     cout << x * a / b << endl;
      |     ^~~~
a.cc:16:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:26: error: 'endl' was not declared in this scope
   16 |     cout << x * a / b << endl;
      |                          ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<stdio.h>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int main(){
  int a,b,n;
  cin >> a >> b >> n;
  int ans=0;
  int count =0;
  rep(i,n) {
    int c=(a*i)%b;
    int d=i%b;
    int anss=(a*i-c) - a*((i-d)/b);
    if(count>=2) break;
    else if(anss > ans) ans=anss;
    else ccount++;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'ccount' was not declared in this scope; did you mean 'count'?
   15 |     else ccount++;
      |          ^~~~~~
      |          count
Language: C++

#include <bits/stdc++.h>
using namespace std;
#difine rep(i,n) for(int i=0;i<(int)(n);i++)
int main(){
  int a,b,n;
  cin >> a >> b >> n;
  int ans=0;
  int count =0;
  rep(i,n) {
    int c=(a*i)%b;
    int d=i%b;
    int anss=(a*i-c) - a*((i-d)/b);
    if(count>=2) break;
    else if(anss > ans) ans=anss;
    else ccount++;
  }
  cout << ans << endl;
}

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #difine; did you mean #define?
    3 | #difine rep(i,n) for(int i=0;i<(int)(n);i++)
      |  ^~~~~~
      |  define
a.cc: In function 'int main()':
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   rep(i,n) {
      |       ^
a.cc:9:3: error: 'rep' was not declared in this scope
    9 |   rep(i,n) {
      |   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  ll a,b,n;
  cin>>a>>b>>n;
  auto f = [&)(ll x){return a*x/b-a*(x/b);};
  cout<<f(min(b-1,n))<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: expected ',' before ')' token
   29 |   auto f = [&)(ll x){return a*x/b-a*(x/b);};
      |              ^
      |              ,
a.cc:29:14: error: expected identifier before ')' token
a.cc:29:15: error: expected ']' before '(' token
   29 |   auto f = [&)(ll x){return a*x/b-a*(x/b);};
      |               ^
      |               ]
Language: C++

#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  ll a,b,n;
  cin>>a>>b>>n;
  auto f = [&)(ll x){return a*x/b-a*(x/b)};
  cout<<f(min(b-1,n))<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: expected ',' before ')' token
   29 |   auto f = [&)(ll x){return a*x/b-a*(x/b)};
      |              ^
      |              ,
a.cc:29:14: error: expected identifier before ')' token
a.cc:29:15: error: expected ']' before '(' token
   29 |   auto f = [&)(ll x){return a*x/b-a*(x/b)};
      |               ^
      |               ]
a.cc: In lambda function:
a.cc:29:42: error: expected ';' before '}' token
   29 |   auto f = [&)(ll x){return a*x/b-a*(x/b)};
      |                                          ^
      |                                          ;
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)


using namespace std;
using ll = long long;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    ll a,b,n;
    cin >> a >> b >> n;
    ll x=n;
    if(n >= b-1) x = b-1;
    ll ans = a*x%/b;
    cout << ans << endl;
   

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:18: error: expected primary-expression before '/' token
   32 |     ll ans = a*x%/b;
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long a , b , n ;
  cin >> a >> b >> n ;
  long long max = 0;
  for (int i = n - 1 ; i >= 1 ; i-- )
  {
    long long ans = ( floor(a*i / b) )- ( (a ) * floor(i/ b) ) ;
     if(max < ans)
     {
       max = ans ;
     }
  }

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

a,b,n = map(int, input().split())
def func(x):
    return int(a*x/b) - a*int(x/b)

if n < b-1:
    print(func(n))
else :
    print(func(b-1))

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | a,b,n = map(int, input().split())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
    1 | a,b,n = map(int, input().split())
      |   ^
main.c:1:5: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    1 | a,b,n = map(int, input().split())
      |     ^
main.c:1:9: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | a,b,n = map(int, input().split())
      |         ^~~
main.c:1:13: error: expected expression before 'int'
    1 | a,b,n = map(int, input().split())
      |             ^~~
main.c:2:1: error: expected ',' or ';' before 'def'
    2 | def func(x):
      | ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;

int main() {
	ll a, b, n;
	cin >> a >> b >> n;
	
	ll ans = 0;
	
	rep(i, n+1) {
		ll c = a*i/b;
		ll d = i/b;
		ll e = c - a*d;
		if (ans < e)) {
			ans = e;
		}
      //cout << ans << endl;
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:29: error: expected primary-expression before ')' token
   16 |                 if (ans < e)) {
      |                             ^
Language: C

#include <stdio.h>

int main()
{
  int a, b, n;
  int i, max, temp;
  scanf("%d %d %d", &a, &b, &n);
  for (i = 0; i <= n; i++) {
    temp = (a*i/b)-a*(i/b);
    if (temp > max)
      max = temp;
  }
  puts(max)
  
}

Compiler output:
main.c: In function 'main':
main.c:13:8: error: passing argument 1 of 'puts' makes pointer from integer without a cast [-Wint-conversion]
   13 |   puts(max)
      |        ^~~
      |        |
      |        int
In file included from main.c:1:
/usr/include/stdio.h:714:30: note: expected 'const char *' but argument is of type 'int'
  714 | extern int puts (const char *__s);
      |                  ~~~~~~~~~~~~^~~
main.c:13:12: error: expected ';' before '}' token
   13 |   puts(max)
      |            ^
      |            ;
   14 | 
   15 | }
      | ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int A,B,N,x;
  cin >> A >> B >> N;
  if(A==1||B==1){
    count << 0 << endl;
  }else if(N<B){
    cout << A*N/B<< endl;
  }else{
    cout << A*(B-1)/B<< endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
    7 |     count << 0 << endl;
      |     ~~~~~~^~~~
Language: C++

#include <bits/stdc++.h>
#define int long long

using namespace std;


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> a >> b;
    cout << a * min(b - 1, n) / b;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   11 |     cin >> n >> a >> b;
      |            ^
      |            yn
a.cc:11:17: error: 'a' was not declared in this scope
   11 |     cin >> n >> a >> b;
      |                 ^
a.cc:11:22: error: 'b' was not declared in this scope
   11 |     cin >> n >> a >> b;
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int64_t A, B, N;
  cin >> A >> B >> N;
  if(N <= B-1){
    cout << A*N/B << endl
  }else{
    cout << A*(B-1)/B << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:26: error: expected ';' before '}' token
    8 |     cout << A*N/B << endl
      |                          ^
      |                          ;
    9 |   }else{
      |   ~
Language: C

#include<stdio.h>
#include<math.h>
int main(void){
  int a,b,c,d;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&c);
  int e[c];
  for(int x=c;x>0;x--){
    e[c-x]=floor(a*x/b)-a*floor(x/b);
  }
  d=e[0];
  for(int i=0;i<x;i++){
      if(e[i]>=d){
          d-e[i];
      }else{
          d=d;
      }
  }
  printf("%d",d);
}

Compiler output:
main.c: In function 'main':
main.c:13:17: error: 'x' undeclared (first use in this function)
   13 |   for(int i=0;i<x;i++){
      |                 ^
main.c:13:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <assert.h>
#include <climits>
using namespace std;
#define ll long long int
int main(){
    ll A,B , N;
    cin >> A >> B >> N;
    ll ans;
    ll r;
    if(N<B)
       r=N;
    else
        r=B-1;
    ans = (A/B)*r+floor((Double(A%B)/B)*r);
    cout << ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:26: error: 'Double' was not declared in this scope; did you mean 'double'?
   19 |     ans = (A/B)*r+floor((Double(A%B)/B)*r);
      |                          ^~~~~~
      |                          double
Language: C++

#include<bits/stdc++.h>
#define GO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
const int N = 1e5 + 2;
const int M = 1e3 + 5;
const int Mod = 1e9 + 7;

ll a, b, n;

int main()
{
	GO;
	cin >> a >> b >> n;
	cout << a * min(n, max(1,b - 1)) / b << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:31: error: no matching function for call to 'max(int, ll)'
   16 |         cout << a * min(n, max(1,b - 1)) / b << endl;
      |                            ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:16:31: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   16 |         cout << a * min(n, max(1,b - 1)) / b << endl;
      |                            ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:16:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |         cout << a * min(n, max(1,b - 1)) / b << endl;
      |                            ~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

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

int main() {
  int64_t A,B,N;
  int64_t maxt=0;
  cin >> A >> B >> N;
  
  maxt=max(B-1,N)
  cout << (A*maxt)/B-A*(maxt/B) << endl;
      
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: expected ';' before 'cout'
   11 |   maxt=max(B-1,N)
      |                  ^
      |                  ;
   12 |   cout << (A*maxt)/B-A*(maxt/B) << endl;
      |   ~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int A,B,N
  cin >> A >> B >> N;
cout << A * min(B - 1,N) / B << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'cin'
    6 |   cin >> A >> B >> N;
      |   ^~~
a.cc:7:23: error: 'N' was not declared in this scope
    7 | cout << A * min(B - 1,N) / B << endl;
      |                       ^
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;

int main(){
    int a, b, n;
    ll ans;
    cin >> a >> b >> n;
    ll x;
    x = min(n, b-1);
    ans = (a*(x%b) - (a*x)%b)/b
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:32: error: expected ';' before 'cout'
   13 |     ans = (a*(x%b) - (a*x)%b)/b
      |                                ^
      |                                ;
   14 |     cout << ans << endl;
      |     ~~~~
Language: C++

#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    long long a,b,n,an,m,i;
    cin>>a>>b>>n;
    /for(i=a;i<n;i++)
    //{
        m=min(b-1,n);
        an=floor(a*m/b)-(a*floor(m/b));
       // ma=max(ma,an);
    //}
   /* else
    {
        an=floor(a*(b-1)/b)-(a*floor(b-1/b));
    }*/
    cout<<an<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: expected primary-expression before '/' token
    8 |     /for(i=a;i<n;i++)
      |     ^
a.cc:8:6: error: expected primary-expression before 'for'
    8 |     /for(i=a;i<n;i++)
      |      ^~~
a.cc:8:21: error: expected ';' before ')' token
    8 |     /for(i=a;i<n;i++)
      |                     ^
      |                     ;
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,a,b;
  cin>>a>>b>>>n;
  if(n>=b) n = b-1;
  ll ans = (a*n)/b;
  cout<<ans;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:14: error: expected primary-expression before '>' token
   31 |   cin>>a>>b>>>n;
      |              ^
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;



int main(){
    int a, b, n;
    int ans;
    cin >> a >> b >> n;
    if (b<=n) ans =  (a*(b-1)-(a*(b-1))%b)/b;
    else ans = (a*n-(a*n)%b)/b;5 7 4
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:33: error: expected ';' before numeric constant
   14 |     else ans = (a*n-(a*n)%b)/b;5 7 4
      |                                 ^~
      |                                 ;
Language: C++

using namespace std;
int main(){
	long long a,b,n;
	cin>>a>>b>>n;
	long long x;
	x=(n/b)*b-1;
	long long ans=((a*x)/b)-a*(x/b);
	long long ans1=((a*n)/b)-a*(n/b);
	ans=max(ans,ans1);
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin>>a>>b>>n;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:9:13: error: 'max' was not declared in this scope
    9 |         ans=max(ans,ans1);
      |             ^~~
a.cc:10:9: error: 'cout' was not declared in this scope
   10 |         cout<<ans;
      |         ^~~~
a.cc:10:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: Java

import java.util.*;
public class Main
{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    long a=sc.nextLong();
    long b=sc.nextLong();
    long n=sc.nextLong();
    long d=0,c=n;
    if(b-1<=n)
    {
      c=b-1;
    }
    d=a*c/d - a*(c/b)
      System.out.println(d);
     
  }
}
    

Compiler output:
Main.java:15: error: ';' expected
    d=a*c/d - a*(c/b)
                     ^
1 error
Language: Java

import java.util.*;
public class Main
{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    long a=sc.nextlong();
    long b=sc.nextlong();
    long n=sc.nextlong();
    long d=0,c=n;
    if(b-1<=n)
    {
      c=b-1;
    }
    d=a*c/d - a*(c/b);
      System.out.println(d);
     
  }
}
    

Compiler output:
Main.java:7: error: cannot find symbol
    long a=sc.nextlong();
             ^
  symbol:   method nextlong()
  location: variable sc of type Scanner
Main.java:8: error: cannot find symbol
    long b=sc.nextlong();
             ^
  symbol:   method nextlong()
  location: variable sc of type Scanner
Main.java:9: error: cannot find symbol
    long n=sc.nextlong();
             ^
  symbol:   method nextlong()
  location: variable sc of type Scanner
3 errors
Language: Java

import java.util.*;
public class Main
{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    long a=sc.nextlong();
    long b=sc.nextlong();
    long n=sc.nextlong();
    long d=0,c=n;
    if(b-1<=n)
    {
      c=b-1;
    }
    d=a*c/d - a*(c/b)
      System.out.println(d);
     
  }
}
    

Compiler output:
Main.java:15: error: ';' expected
    d=a*c/d - a*(c/b)
                     ^
1 error
Language: C++

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

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#define pb push_back
#define ld long double
#define int long long
#define mp make_pair

mt19937 rnd(51);

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
    int a, b, n, ans = 0;
    cin >> a >> b >> n;
    for (int x = n; x >= max(0ll, n - (int)3e6 - 100); x--){
        ans = max(ans, (a * x / b) - a * (x / b));
    }
    for (int x = 0; x <= min(3e6, n); x++){
        ans = max(ans, (a * x / b) - a * (x / b));
    }
    cout << ans;
	return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:35:29: error: no matching function for call to 'min(double, long long int&)'
   35 |     for (int x = 0; x <= min(3e6, n); x++){
      |                          ~~~^~~~~~~~
In file included from /usr/include/c++/14/vector:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:35:29: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'long long int')
   35 |     for (int x = 0; x <= min(3e6, n); x++){
      |                          ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:35:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   35 |     for (int x = 0; x <= min(3e6, n); x++){
      |                          ~~~^~~~~~~~
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    double a, b, n;
    int f ;
    cin >> a >> b >> n;

    if (n < b)
    {
        f = floor(a * n/ b);
    }
    else
    {
        f = floor(a * (b-1.0) / b);
    }

    cout << f << endl;
    return 0;
}#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    double a, b, n;
    int f ;
    cin >> a >> b >> n;

    if (n < b)
    {
        f = floor(a * n/ b);
    }
    else
    {
        f = floor(a * (b-1.0) / b);
    }

    cout << f << endl;
    return 0;
}

Compiler output:
a.cc:23:2: error: stray '#' in program
   23 | }#include <iostream>
      |  ^
a.cc:23:3: error: 'include' does not name a type
   23 | }#include <iostream>
      |   ^~~~~~~
a.cc:28:5: error: redefinition of 'int main()'
   28 | int main()
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main()
      |     ^~~~
Language: Java

import java.util.*;
public class Main
{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int n=sc.nextInt();
    int c=n;
    if(b-1<=n)
    {
      c=b-1;
    }
    
      System.out.println(Math.floor(a*c/b)-a*Math.floor(c/b));
     
  }

Compiler output:
Main.java:18: error: reached end of file while parsing
  }
   ^
1 error