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

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a,b,c;
  ll d=0;
  for(ll i=0;i<=N;i++){
    d=max(a*i/b-a*(i/b));
  }
  cout<<d<<endl;
}
  
  
    
    
  


Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: 'N' was not declared in this scope
    7 |   for(ll i=0;i<=N;i++){
      |                 ^
a.cc:8:10: error: no matching function for call to 'max(ll)'
    8 |     d=max(a*i/b-a*(i/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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
a.cc:8:10: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
    8 |     d=max(a*i/b-a*(i/b));
      |       ~~~^~~~~~~~~~~~~~~
/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:   candidate expects 2 arguments, 1 provided
Language: C++

int main(){
  ll A,B,N;
  cin >> A >> B >> N;
  ll res = (A*N)/B - A*(N/B);
  cout << (res>0? res:0) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:3: error: 'll' was not declared in this scope
    2 |   ll A,B,N;
      |   ^~
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> A >> B >> N;
      |   ^~~
a.cc:3:10: error: 'A' was not declared in this scope
    3 |   cin >> A >> B >> N;
      |          ^
a.cc:3:15: error: 'B' was not declared in this scope
    3 |   cin >> A >> B >> N;
      |               ^
a.cc:3:20: error: 'N' was not declared in this scope
    3 |   cin >> A >> B >> N;
      |                    ^
a.cc:4:5: error: expected ';' before 'res'
    4 |   ll res = (A*N)/B - A*(N/B);
      |     ^~~~
      |     ;
a.cc:5:3: error: 'cout' was not declared in this scope
    5 |   cout << (res>0? res:0) << endl;
      |   ^~~~
a.cc:5:12: error: 'res' was not declared in this scope
    5 |   cout << (res>0? res:0) << endl;
      |            ^~~
a.cc:5:29: error: 'endl' was not declared in this scope
    5 |   cout << (res>0? res:0) << endl;
      |                             ^~~~
Language: Java

public class Main {

	static long mod = 1000000007;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String[] t = sc.nextLine().split(" ");
		long a = Long.parseLong(t[0]);
		long b = Long.parseLong(t[1]);
		long c = Long.parseLong(t[2]);

		long ans = 0;

		double d = Math.floorDiv(a, b) - a * Math.floorDiv(1, b);


			ans = (long) Math.floor(a * c / b) - a * Math.floorDiv(c, b);
			ans = Math.max(ans, (long) Math.floor(a * 1 / b) - a * Math.floorDiv(1, b));


		System.out.println(ans);
	}
}


Compiler output:
Main.java:7: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:7: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

a,b,n = map(int,input().split())

k = max(0,(n - b + 1) // b)
k = min(n,k * b + b - 1)

print((a * k) // b - a * (k // b))

Compiler output:
a.cc:1:1: error: 'a' does not name a type
    1 | a,b,n = map(int,input().split())
      | ^
Language: C++

#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

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



Compiler output:
a.cc: In function 'int main()':
a.cc:14:29: error: declaration does not declare anything [-fpermissive]
   14 |         cin >> a >> b >> n; ll;
      |                             ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main ()
{
	ll a, b, c;
	cin>>a>>b>>c;
	if(a == 0 && b == 0 && c = 0)
	{
		cout<<0<<endl;
	}
	else if(a>b)
	{
		cout<<floor(a*c/b)-a*floor(c/b)<<endl;
	}
	else
	{
		cout<<floor(a*(c-1)/b)-a*floor((c-1)/b)<<endl;
	}
	return 0;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:29: error: lvalue required as left operand of assignment
    8 |         if(a == 0 && b == 0 && c = 0)
      |            ~~~~~~~~~~~~~~~~~^~~~
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:18: error: no matching function for call to 'max(int&, __gnu_cxx::__enable_if<true, double>::__type)'
    8 |         mx = max (mx, floor(a * i) / b - a * floor(i / 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:8:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'})
    8 |         mx = max (mx, floor(a * i) / b - a * floor(i / 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:8:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    8 |         mx = max (mx, floor(a * i) / b - a * floor(i / b));
      |              ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <stdio.h>
#include <bits/stdc++.h>
#include <ctime>

using namespace std;
typedef string STR;
typedef long long LL;

// variables()
/*int N, min_r = 1000001, max_c = -1000001, mn = 1000001, mx = -1000001;
pair <int, int> pr;
vector <pair <int, int> > vc;*/
///int plank, T, n, l, r, ans, sq, rct;
///STR op;
///vector <int> vc;
long A, B, N, mx = -1;
// variables(NULL)

int main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(0); cout.tie(0);
    srand(time(0));
    /// start_main()
	/*cin >> N;
	int grid[N][N];
	for (int i = 0 ; i < N ; i ++) {
        for (int j = 0 ; j < N ; j ++) {
            cin >> grid[i][j];
        }
	}
	for (int i = 0 ; i < N ; i ++) {
        for (int j = 0 ; j < N ; j ++) {
            min_r = min(min_r, grid[i][j]);
            max_c = max(max_c, grid[j][i]);
        }
        pr.first = min_r;
        pr.second = max_c;
        vc.push_back(pr);
        min_r = 1000001;
        max_c = -1000001;
	}
	for (int i = 0 ; i < N ; i ++) {
        mx = max(mx, vc[i].first);
        mn = min(mn, vc[i].second);
	}
	if (mx == mn) cout << 0;
	else {
        if (mx < mn) cout << 1;
        else cout << 2;
        multiset
	}
	cin >> plank;
	int arr[plank];
	for (int i = 0 ; i < plank ; i ++) {
        cin >> n;
        vc.push_back(n);
	}
	sort (vc.begin(), vc.end());
	r = vc.size() - 1;
	while (T --) {
        cin >> op >> n;
        if (op == '+') {
            vc.push_back(n);
            sort (vc.begin(), vc.end());
        }
        else {
            while (l <= r) {
                int m = l + (r - l) / 2;
                if (vc[m] == n) {
                    ans = m;
                    break;
                }
                if (vc[m] < n) l = m + 1;
                else r = m - 1;
            }
            vc.pop(m);
        }
        for (int i = 0 ; i < vc.size() ; i ++) {
            for (int j = i + 1 ; j < vc.size() ; j ++) {
                if (vc[i] == vc[j]) {

                }
            }
        }
	}*/
    cin >> A >> B >> N;
    //if (A == B && B == N || A == B && N > A) cout << floor(A * (N - 1) / B) - A * floor((N - 1) / B);
    //else cout << floor(A * N / B) - A * floor(N / B);
    else cout << floor(A * (B - 1) / B) - A * floor((B - 1) / B);
    /// end_main()
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:89:5: error: 'else' without a previous 'if'
   89 |     else cout << floor(A * (B - 1) / B) - A * floor((B - 1) / B);
      |     ^~~~
Language: C++

#include <iostream>
using namespace std;
int ans = -100000;
int nibun(int y) { return ans < y; }
int main() {
  int a;
  long long b, n, ok, ng, mid;
  cin >> a >> b >> n;
  int t;
  ok = 0;
  ng = n;
  while (ng - ok > 1) {
    x = (ok + ng) / 2;
    t = (a * x / b) - a * (x / b);
    if (nibun(t)) {
      ans = t;
      ok = x;
    } else {
      ng = x;
    }
  }
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'x' was not declared in this scope
   13 |     x = (ok + ng) / 2;
      |     ^
Language: C++

#include <iostream>
using namespace std;
int main(){
  int a, b, n, ans;
  cin >> a >> b >> n;
  ans = -1;
  int t;
  for(int x=0;x<n;x++){
    t = (a*x/b) - a*(x/b);
    if(ans < t){
      ans = t;
    }else{
      break;
  }
  cout << ans;
}


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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'll' was not declared in this scope
    4 |   ll a,b,n; cin>>a>>b>>n;
      |   ^~
a.cc:4:18: error: 'a' was not declared in this scope
    4 |   ll a,b,n; cin>>a>>b>>n;
      |                  ^
a.cc:4:21: error: 'b' was not declared in this scope
    4 |   ll a,b,n; cin>>a>>b>>n;
      |                     ^
a.cc:4:24: error: 'n' was not declared in this scope; did you mean 'yn'?
    4 |   ll a,b,n; cin>>a>>b>>n;
      |                        ^
      |                        yn
Language: C++

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

int main() {
  long long a, b, n;
  cin >> a >> b >> n;
  
  
  int ans = 0;
  for(long long x=n;x>=n;x--){
    long long g = ans;
    ans = floor(a*x / b) - a*floor(x/b);
    ans = max(ans,g);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: no matching function for call to 'max(int&, long long int&)'
   13 |     ans = max(ans,g);
      |           ~~~^~~~~~~
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:13:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   13 |     ans = max(ans,g);
      |           ~~~^~~~~~~
/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:13:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   13 |     ans = max(ans,g);
      |           ~~~^~~~~~~
Language: C++

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


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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |         ans=ll(a*n/b)-a*ll(n/b);
      |         ^~~
      |         abs
a.cc:22:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |         ans=ll(a*x/b)-a*ll(x/b);
      |         ^~~
      |         abs
Language: C++

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


int main() {
    ll a,b,n;
    cin>>a>>b>>n;
    ll now=0;
    vector<ll> ps(1);
    if(n<=b){
        rep3(i,n+1){
            ll p=ll(a*i/b)-a*ll(i/b);
            ps.push_back(p);
            now=max(now,p);
        }
        rep3(i,n+2){
            if(i==0){
                continue;
            }
            if(now==ps[i]){
                cout<<i-1<<endl;
                return 0;
            }
        }
    }
    else if(n>b){
        ll i=b-1;
        while(i<n+1){
            i+=b;
            ll p=ll(a*i/b)-a*ll(i/b);
            ps/push_back(p);
            now=max(now,p);
        }
        rep3(j,n/b+1){
            if(j==0){
                continue;
            }
            if(now==ps[j]){
                cout<<b-1+b*(j-1)<<endl;
                return 0;
            }
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:16: error: 'push_back' was not declared in this scope
   36 |             ps/push_back(p);
      |                ^~~~~~~~~
Language: C++

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


int main() {
    ll a,b,n;
    cin>>a>>b>>n;
    ll now=0;
    vector<ll> ps(1);
    if(n<=b){
        rep3(i,n+1){
            p=ll(a*i/b)-a*ll(i/b);
            ps.push_back(p);
            now=max(now,p);
        }
        rep3(i,n+2){
            if(i==0){
                continue;
            }
            if(now==ps[i]){
                cout<<i-1<<endl;
                return 0;
            }
        }
    }
    else if(n>b){
        ll i=b-1;
        while(i<n+1){
            i+=b;
            p=ll(a*i/b)-a*ll(i/b);
            ps/push_back(p);
            now=max(now,p);
        }
        rep3(j,n/b+1){
            if(j==0){
                continue;
            }
            if(now==ps[j]){
                cout<<b-1+b*(j-1)<<endl;
                return 0;
            }
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: 'p' was not declared in this scope
   17 |             p=ll(a*i/b)-a*ll(i/b);
      |             ^
a.cc:35:13: error: 'p' was not declared in this scope
   35 |             p=ll(a*i/b)-a*ll(i/b);
      |             ^
a.cc:36:16: error: 'push_back' was not declared in this scope
   36 |             ps/push_back(p);
      |                ^~~~~~~~~
Language: C++

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


int main() {
    ll a,b,n;
    cin>>a>>b>>n;
    ll maxn=0;
    vector<ll> nums(1);
    rep3(i,n+1){
        ll now=ll(a*i/b)-a*ll(i/b);
        nums.push_back(now);
        maxn=max(now,maxn);
    }
    rep3(i,nums.size()){
        if(max==nums[1]){
            cout<<i-1<<endl;
            return 0;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: invalid operands of types '<unresolved overloaded function type>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to binary 'operator=='
   21 |         if(max==nums[1]){
Language: C++

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


int main() {
    ll a,b,n;
    cin>>a>>b>>n;
    ll max=0;
    vector<ll> nums(1);
    rep3(i,n+1){
        ll now=ll(a*i/b)-a*ll(i/b);
        nums.push_back(now);
        max=max(now,max);
    }
    rep3(i,nums.size()){
        if(max==nums[1]){
            cout<<i-1<<endl;
            return 0;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: 'max' cannot be used as a function
   18 |         max=max(now,max);
      |             ~~~^~~~~~~~~
Language: C++

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


int main() {
    ll a,b,n;
    cin>>a>>b>>n;
    ll max=0;
    vector<ll> nums(1);
    rep3(i,n+1){
        ll now=ll(a*i/b)-a*ll(i/b);
        nums.push_back(now)
        max=max(now,max);
    }
    rep3(i,nums.size()){
        if(max==nums[1]){
            cout<<i-1<<endl;
            return 0;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:28: error: expected ';' before 'max'
   17 |         nums.push_back(now)
      |                            ^
      |                            ;
   18 |         max=max(now,max);
      |         ~~~
Language: C++

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


int main() {
    ll a,b,n;
    cin>>a>>b>>n;
    ll max=0;
    vector<ll> nums(1);
    rep3(i,n+1){
        now=ll(a*i/b)-a*ll(i/b);
        nums.push_back(now)
        max=max(now,max);
    }
    rep3(i,nums.size()){
        if(max==nums[1]){
            cout<<i-1<<endl;
            return 0;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'now' was not declared in this scope; did you mean 'pow'?
   16 |         now=ll(a*i/b)-a*ll(i/b);
      |         ^~~
      |         pow
Language: C++

#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
const double PI = 3.14159265358979323846;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"

int main() {
	long long A, B, N;
	cin >> A >> B >> N;

	long long ans = 0;
	for (long long i = N; 0 <= i; --i) {
		ans = max(ans, long long(floor(A * i / B) - A * floor(i / B)));
	}

	cout << ans << endl;

	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:27:32: error: expected primary-expression before 'long'
   27 |                 ans = max(ans, long long(floor(A * i / B) - A * floor(i / B)));
      |                                ^~~~
Language: C++

#include<bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)

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

    int tmp1 = (a*b-1)/b - a*((b-1))/b);
    int tmp2 = (a*n)/b - a*(n/b);
    cout << min(tmp1, tmp2) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:39: error: expected ',' or ';' before ')' token
   15 |     int tmp1 = (a*b-1)/b - a*((b-1))/b);
      |                                       ^
Language: C++


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

int main() {
    ll a,b,n; cin >> a >> b >> n;
    ll x;
    if(n >= b-1) x = b-1;
    else x = n;
    ll ans = floor(a*x/b) - a*floor(x/b);
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'll' was not declared in this scope
    7 |     ll a,b,n; cin >> a >> b >> n;
      |     ^~
a.cc:7:22: error: 'a' was not declared in this scope
    7 |     ll a,b,n; cin >> a >> b >> n;
      |                      ^
a.cc:7:27: error: 'b' was not declared in this scope
    7 |     ll a,b,n; cin >> a >> b >> n;
      |                           ^
a.cc:7:32: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |     ll a,b,n; cin >> a >> b >> n;
      |                                ^
      |                                yn
a.cc:8:7: error: expected ';' before 'x'
    8 |     ll x;
      |       ^~
      |       ;
a.cc:9:18: error: 'x' was not declared in this scope
    9 |     if(n >= b-1) x = b-1;
      |                  ^
a.cc:10:10: error: 'x' was not declared in this scope
   10 |     else x = n;
      |          ^
a.cc:11:7: error: expected ';' before 'ans'
   11 |     ll ans = floor(a*x/b) - a*floor(x/b);
      |       ^~~~
      |       ;
a.cc:12:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(ll n,ll m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];

int main() {
    FAST;
    ll t, i, j, k, p, q, r, x, y, u, v, m;
	ll a,b,n;
	cin>>a>>b>>n;
	ll val;
	x=n;
	if(n<b)
	{	
		val=(a*x)/b;
	}
	else{
		val=(a*x)/b-a*(x/b);
	}
	
	cout<<ans;
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(ll n, ll m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |         cout<<ans;
      |               ^~~
      |               abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:22:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |   COUT(ans);
      |        ^~~
a.cc:4:24: note: in definition of macro 'COUT'
    4 | #define COUT(x) cout<<(x)<<endl
      |                        ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll A,B,N; cin >> A >> B >> N;
  ll ans = 0;
  ll tmp;
  for(ll i = 0,i < N+1; i++){
    tmp = A * i / B - A * (i / B);
    ans = max(ans,tmp);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: expected ';' before '<' token
   14 |   for(ll i = 0,i < N+1; i++){
      |                 ^~
      |                 ;
a.cc:14:18: error: expected primary-expression before '<' token
   14 |   for(ll i = 0,i < N+1; i++){
      |                  ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class D165N {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		long a = sc.nextLong(), b = sc.nextLong(), n = sc.nextLong();
		
		long x = Math.min(n, b-1);
		System.out.println(a*x/b-a*(x/b));
	}
	
	static class FastScanner {
			private BufferedReader reader = null;
		    private StringTokenizer tokenizer = null;
		    public FastScanner(InputStream in) {
		        reader = new BufferedReader(new InputStreamReader(in));
		        tokenizer = null;
		    }

		    public String next() {
		        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
		            try {
		                tokenizer = new StringTokenizer(reader.readLine());
		            } catch (IOException e) {
		                throw new RuntimeException(e);
		            }
		        }
		        return tokenizer.nextToken();
		    }

		    public String nextLine() {
		        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
		            try {
		                return reader.readLine();
		            } catch (IOException e) {
		                throw new RuntimeException(e);
		            }
		        }

		        return tokenizer.nextToken("\n");
		    }

		    public long nextLong() {
		        return Long.parseLong(next());
		    }

		    public int nextInt() {
		        return Integer.parseInt(next());
		    }

		    public double nextDouble() {
		         return Double.parseDouble(next());
		     }

		    public int[] nextIntArray(int n) {
		        int[] a = new int[n];
		        for (int i = 0; i < n; i++)
		            a[i] = nextInt();
		        return a;
		    }

		    public long[] nextLongArray(int n) {
		        long[] a = new long[n];
		        for (int i = 0; i < n; i++)
		            a[i] = nextLong();
		        return a;
		    }
		}
}


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

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>
#define DBL_MIN 0.000000000000001

// 多倍長テンプレ
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */


//ちゃんとlong型でやってる？
using namespace std;
int main(void){
    Real A,B,N;
    cin >> A >> B >> N;
    
    Real pA = floor(A*N/B) - A*floor(N/B) << endl;
    Real pB = floor(A*(B-1)/B) - A*floor((B-1)/B) << endl;
    cout << min(pA,pB) << endl;
    return 0;
}

Compiler output:
a.cc:18:10: fatal error: boost/multiprecision/cpp_dec_float.hpp: No such file or directory
   18 | #include <boost/multiprecision/cpp_dec_float.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class D165 {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		long a = sc.nextLong(), b = sc.nextLong(), n = sc.nextLong();
		long ans = 0l;
		int c = 0;
		for(long i = n; i > 0; i--) {
			long x = (a*i/b) - a*(i/b);
			if(x > ans) {
				ans = x;
				c++;
			}else if(c == 1 && x <= ans) {
				break;
			}
		}
		System.out.println(ans);
	}
	
	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define INF 1000000000
#define pi 3.14159265358979323846264338327950L
#define FOR(i,a,b) for(int i=a;i<=b;i++)

ll A,B;

ll f(ll x)
{
    ll ans=floor((A*x)/B)-(A*floor(x/B));
    return ans;
}

int main()
{
    //freopen("contest.txt","r",stdin);
    //freopen("contest.txt","w",stdout);
    IOS
    ll N;
    cin>>A>>B>>N;
    ll sum_1=0,sum_2=0;
    ll sum_1=max(f(B-1),f(N));
    cout<<sum_1<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:8: error: redeclaration of 'll sum_1'
   27 |     ll sum_1=max(f(B-1),f(N));
      |        ^~~~~
a.cc:26:8: note: 'll sum_1' previously declared here
   26 |     ll sum_1=0,sum_2=0;
      |        ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define xrep(i, a, b) for (int i = int(a); i < int(b); ++i)
using ll = long long;
int main() {
    ll A, B, N;
    cin >> A >> B >> N;
    vector<ll> Nums;
    rep(x, N+1) {
        Nums.push_back(((A*x)/B)-A*(x/B));
    }

    ll max = -100000000000000000;
    rep(i, Nums.size()) {
        if(max<Nums[i]) {
            max = Nums[i];
        }
    }

    cout << max << endl;

    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: expected '}' at end of input
   23 |     return 0;
      |              ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: Java

import java.util.Scanner;
public class MainD {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int A = s.nextInt();
		long B = s.nextLong();
		long N = s.nextLong();
	
		long ans =0;
		for(int k=0; k<=(A*N)/B; k++) {
			int minn = (int)(Math.ceil((double)(B*k/A))); 
			if( k - ((A*minn)/B) > ans) {
				ans = k -((A*minn)/B);
			}
			
		}
		System.out.println(ans);
	
	}
}


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

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

Compiler output:
a.cc: In function 'void solveD()':
a.cc:3:5: error: 'll' was not declared in this scope
    3 |     ll ans=INT_MIN;
      |     ^~
a.cc:4:7: error: expected ';' before 'a'
    4 |     ll a,b,n;
      |       ^~
      |       ;
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin>>a>>b>>n;
      |     ^~~
a.cc:5:10: error: 'a' was not declared in this scope
    5 |     cin>>a>>b>>n;
      |          ^
a.cc:5:13: error: 'b' was not declared in this scope
    5 |     cin>>a>>b>>n;
      |             ^
a.cc:5:16: error: 'n' was not declared in this scope
    5 |     cin>>a>>b>>n;
      |                ^
a.cc:6:11: error: expected ';' before 'i'
    6 |     for(ll i=1;i<=n;i++)
      |           ^~
      |           ;
a.cc:6:16: error: 'i' was not declared in this scope
    6 |     for(ll i=1;i<=n;i++)
      |                ^
a.cc:8:11: error: expected ';' before 't'
    8 |         ll t=floor(a*i/b)-a*floor(i/b);
      |           ^~
      |           ;
a.cc:9:9: error: 'ans' was not declared in this scope
    9 |         ans=max(ans,t);
      |         ^~~
a.cc:9:21: error: 't' was not declared in this scope
    9 |         ans=max(ans,t);
      |                     ^
a.cc:9:13: error: 'max' was not declared in this scope
    9 |         ans=max(ans,t);
      |             ^~~
a.cc:11:5: error: 'cout' was not declared in this scope
   11 |     cout<<ans;
      |     ^~~~
a.cc:11:11: error: 'ans' was not declared in this scope
   11 |     cout<<ans;
      |           ^~~
Language: C++

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:1024000000,1024000000")

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

int main()
{
    long long a ,b ,n;
    cin >> a >> b >> n; a *= 100;
    long long ans = 0;
    for(int x=0; x<=min( ,n); x++)
        ans = max(ans ,a*x/b - a*(x/b));
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:26: error: expected primary-expression before ',' token
   14 |     for(int x=0; x<=min( ,n); x++)
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second

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

Compiler output:
a.cc:30:3: error: 'cout' does not name a type
   30 |   cout<<ans<<endl;
      |   ^~~~
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
ll f(ll a,ll b,ll x){
  ll p=(a*x-(a*(x%b)%b))/b;
  ll q=(x-x%b)/b;
  return p-a*q;
}
int main()	{
  ll a,b,n;
  cin>>a>>b>>n;
  ll c;
  if(n>b) c=n-b;
  else c=n;
  ll ans=-1;
  for(ll x=1;x<=c;x++){
    ll f=f(a,b,x);
    ans=max(f,ans);
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:11: error: 'f' cannot be used as a function
   31 |     ll f=f(a,b,x);
      |          ~^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
ll f(ll a,ll b,ll x){
  ll p=(a*x-(a*(x%b)%b))/b;
  ll q=(x-x%b)/b;
  return p-a*q;
}
int main()	{
  ll a,b,n;
  cin>>a>>b>>n;
  if(n>b) ll c=n-b;
  else ll c=n;
  ll ans=-1;
  for(ll x=1;x<=c;x++){
    ll f=f(a,b,x);
    ans=max(f,ans);
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: 'c' was not declared in this scope
   29 |   for(ll x=1;x<=c;x++){
      |                 ^
a.cc:30:11: error: 'f' cannot be used as a function
   30 |     ll f=f(a,b,x);
      |          ~^~~~~~~
Language: Java

import java.util.Scanner;
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 max = 0;
    for(Long i = 1; i < n; i++){
      Long ans = a*i/b - a*(i/b);
      if(ans > max) max =ans;
    }
    System.out.println(max);
  }
}

Compiler output:
Main.java:8: error: incompatible types: int cannot be converted to Long
    Long max = 0;
               ^
Main.java:9: error: incompatible types: int cannot be converted to Long
    for(Long i = 1; i < n; i++){
                 ^
2 errors
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: no matching function for call to 'max(const long long int&, int)'
    9 |   cout << max(min(n, b - 1), 0) << 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:9:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
    9 |   cout << max(min(n, b - 1), 0) << 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:9:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
    9 |   cout << max(min(n, b - 1), 0) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: no matching function for call to 'max(long long int, int)'
    9 |   cout << max(min({n, b - 1}), 0) << 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:9:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
    9 |   cout << max(min({n, b - 1}), 0) << 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:9:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
    9 |   cout << max(min({n, b - 1}), 0) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include<math.h>
using ll = long long;
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: expected ';' before 'a'
    8 |  cin a >> b >> n;
      |     ^~
      |     ;
Language: Java

import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        long B = sc.nextLong();
        long N = sc.nextLong();

        sc.close();

        int MAX = 0;

        for (int i = 0; i <= N; i++) {
            int F = Math.floor(A*i/B);
            int G = A * Math.floor(x/B);
            int FG = F - G;
            MAX = Math.max(MAX, FG);
        }

        System.out.println(MAX);
    }
}


Compiler output:
Main.java:16: error: incompatible types: possible lossy conversion from double to int
            int F = Math.floor(A*i/B);
                              ^
Main.java:17: error: cannot find symbol
            int G = A * Math.floor(x/B);
                                   ^
  symbol:   variable x
  location: class Main
2 errors
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
    8 |   ans = (a*x)/b - a*(x/b);
      |   ^~~
      |   abs