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

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

int main()
{

    int A, B, N ;
    cin >> A >> B >> N ;

    if (N > 1){
        ans = floor((A*i)/B) - A*floor(i/B) ;
        if (N < B)
            cout << floor((A*N)/B) - A*floor(N/B) ;
        else
            cout << floor((A*(N-1))/B) - A*floor((N-1)/B) ;
    }
    else
        cout << floor((A*N)/B) - A*floor(N/B) ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |         ans = floor((A*i)/B) - A*floor(i/B) ;
      |         ^~~
      |         abs
a.cc:13:24: error: 'i' was not declared in this scope
   13 |         ans = floor((A*i)/B) - A*floor(i/B) ;
      |                        ^
Language: C++

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

int main(){
 ll a,b,n;
 cin >> a >> b >> n;
 vector < ll> v;
// for(ll i=1;i<=n;i++){
     ll ans=floor((a*i)/b)-(a*floor(i/b));
    // v.push_back(ans);
 //}
 cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: 'i' was not declared in this scope
   10 |      ll ans=floor((a*i)/b)-(a*floor(i/b));
      |                      ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  ll n, i, j, m,  k, a, b;

	cin>>a>>b>>n;

	ll kk= min(n, b-1);

	ll ans= a*kk/b - a*(kk/b);

	cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'll' was not declared in this scope
    4 |   ll n, i, j, m,  k, a, b;
      |   ^~
a.cc:6:14: error: 'a' was not declared in this scope
    6 |         cin>>a>>b>>n;
      |              ^
a.cc:6:17: error: 'b' was not declared in this scope
    6 |         cin>>a>>b>>n;
      |                 ^
a.cc:6:20: error: 'n' was not declared in this scope
    6 |         cin>>a>>b>>n;
      |                    ^
a.cc:8:11: error: expected ';' before 'kk'
    8 |         ll kk= min(n, b-1);
      |           ^~~
      |           ;
a.cc:10:11: error: expected ';' before 'ans'
   10 |         ll ans= a*kk/b - a*(kk/b);
      |           ^~~~
      |           ;
a.cc:12:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |         cout<<ans;
      |               ^~~
      |               abs
Language: C++

#include<iostream>
using namespace std;
int main(){
    long long int A,B,N,max;
    cin>>A>>B>>N;
    max=floor(A*0/B)-A*floor(0/B);
    for(int i=1;i<=N;i++){
        if(floor(A*i/B)-A*floor(i/B)<max){
            cout<<max<<endl;
            return 0;
        }
        max=floor(A*i/B)-A*floor(i/B);
    }
    cout<<max<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'floor' was not declared in this scope
    6 |     max=floor(A*0/B)-A*floor(0/B);
      |         ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define d1(x) cout<<#x<<" "<<x<<endl;
#define d2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define d2i(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;

#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
#define  mat vector<vector<ll>>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void solve(){
   ll n,a,b;
   cin>>a>>b>>n;
   ll m;
   if((n)%b==0)
    m=max((ll)0,n-1);
    else m=n;




    ll f=(a*m)/b;
    ll s=a*(m/b);
    if(((a*m)%b)!=0)
        f++;
    if((m%b)!=0)
    s++;
    cout<<max(0,f-s);

}


int main(){
   ll t=1;
   //cin>>t;
   while(t--){
    solve();
    cout<<endl;
   }
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:39:14: error: no matching function for call to 'max(int, ll)'
   39 |     cout<<max(0,f-s);
      |           ~~~^~~~~~~
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:39:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   39 |     cout<<max(0,f-s);
      |           ~~~^~~~~~~
/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:39:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   39 |     cout<<max(0,f-s);
      |           ~~~^~~~~~~
Language: C++

#include <iostream>
#include <math.h>
using namespace std;

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

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

#include <bits/stdc++.h>
using namespace std;
int gcd(long long int a, long long int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int lcm(long long int a, long long int b)
{
   return a * b / gcd(a, b);
}
int main(){
	int a;
	long long int b,n;
	cin >> a >> b >> n;
	long long int l=lcm(a,b);
	long long int k=l-1;
	int p= (a*k)/b;
	int q=k/b;
	if(n>=l){
		cout << p-a*q << endl;
	}
	int r=n/b;
	else if(n<l&&r>0){
		int s=r*b-1;
		int c=(a*s)/b;
		int d=s/b;
		cout << c-a*d << endl;
		}
	else{
	    cout << (a*n)/b << endl;
	}

	

}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'else' without a previous 'if'
   30 |         else if(n<l&&r>0){
      |         ^~~~
Language: C

#include<stdio.h>
#include<math.h>
int main(void){

    int a,b,n;

    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&n);

    if(n < b){
        int d = (a * n )  /b;
        printf("%d",d);
    } if( n >= b){
        int d = (a * (b-1))/b);
        printf("%d",d);
    }

    return 0;



}

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

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<bitset>
#define lson node<<1,st,mid
#define rson node<<1|1,mid+1,ed
#define mem(a,x) memset(a,x,sizeof(a))
#define me(a) memset(a,0,sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define lowbit(x) x&(-x)
#define up(i,x,y) for(long long i=x;i<y;i++)
#define down(i,x,y) for(long long i=x;i>=y;i--)
#define in freopen("in.txt","r",stdin)
#define out freopen("out.txt","w",stdout)   
typedef long long ll;
const ll mod = 1e9+7;
const ll INF = 0x3f3f3f3f;
const ll maxn = 1e6 + 5;
const ll N=1e3+5;
const double pi = acos(-1.0);
const double eps=1e-9;
using namespace std;

int main(){
	// in;
	// out;
	ll a,b,n;
	cin>>a>>b>>n;
	ll x,y,z;
	x=(ll) floor(n*a*1.0/b)-a*floor(n*1.0/b);
	y=(ll) floor((n-1)*a*1.0/b)-a*floor((n-1)*1.0/b);
	res=max(x,y);
	for(int i=2;i<=10000000;i++){
		res=max(res,floor((n-i)*a*1.0/b)-a*floor((n-i)*1.0/b));
	}
	cout<<res<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: 'res' was not declared in this scope
   41 |         res=max(x,y);
      |         ^~~
Language: C++

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

int main() {
  int A;
  int64_t B,N;
  cin>>A>>B>>N;
  int64_t max=0;
  int64_t val=0;
  int64_t a=A/B;
  N++;
  for(int64_t x=1;x<N;x++){
    b=x/B;
    val=a*x-A*b;
    if(val>max)max=val;
  }
  cout<<max<<endl;
}






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

#include <iostream>
#include <string>
#include <array>
#include <sstream>
#include <iostream>

using namespace std;


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

	cin >> A >> B >> N;
	long long result = 0;
	long long count = 0;
	long long x = 1;
	long long tmp = 0;
	while (1)
	{
		tmp = floor((A * x) / B) - A * floor(x / B);

		if (tmp >= result)
		{
			result = tmp;
		}
		else {
			break;
		}

		if (N <= x)
		{
			break;
		}


		x++;
	}

	cout << result << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:23: error: 'floor' was not declared in this scope
   21 |                 tmp = floor((A * x) / B) - A * floor(x / B);
      |                       ^~~~~
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

 
int main() {

    ll a,b,n;
    cin >> a >> b >> n;

    cout<<max(((a*(n-1))/b)-a*((n-1)/b),max(((a*n)/b)-a*(n/b)),0)<<endl;

 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:44: error: no matching function for call to 'max(ll)'
   16 |     cout<<max(((a*(n-1))/b)-a*((n-1)/b),max(((a*n)/b)-a*(n/b)),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:   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:16:44: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   16 |     cout<<max(((a*(n-1))/b)-a*((n-1)/b),max(((a*n)/b)-a*(n/b)),0)<<endl;
      |                                         ~~~^~~~~~~~~~~~~~~~~~~
/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: Java

public class Main {
    public static void main(String[] args) {
        //コード
    	Scanner sc = new Scanner(System.in);
//    	File file = new File("src/in.txt");
//    	Scanner sc = new Scanner(file);
    	int A = sc.nextInt();
    	long B = sc.nextLong();
    	long N = sc.nextLong();
    	long max = 0;

    	for(int i=1;i<=N;i++) {
    		long tmp = (long) (Math.floor(A*i/B)-A*Math.floor(i/B));
    		if(tmp>=max) {
    			max=tmp;
    		}
    	}
    	System.out.print(max);
    }
}

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

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


Compiler output:
a.cc:14:1: error: 'cout' does not name a type
   14 | cout<<ans;
      | ^~~~
Language: Java

import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		double A = stdIn.nextDouble();
		double B = stdIn.nextDouble();
		long N = stdIn.nextLong();
		
		long max = 0;
		
		for(int i = (int)B - 1; i <= N; i += (int) B) {
			if(max < sub(A, B, i)) {
				max = sub(A, B, i);
			}else {
				break;
			}
		}
		System.out.println(max);
	}
	
	public static long sub(double A, double B, long x) {
		long ret = (long) (Math.floor(A * x / B) - A * Math.floor(x / B));
//		System.out.println(x + ":" + ret);
		return ret;
	}

Compiler output:
Main.java:27: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

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

#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;

ll gcd (ll a, ll b) {
return b ? gcd (b, a % b) : a;
}


int main()
{
    IOS
 	// freopen("input.txt","r",stdin);
 	// freopen("output.txt","w",stdout);
 	// freopen("error.txt","w",stderr);
 	ll a,b,n;
 	cin>>a>>b>>n;
 	ll ta=a;
 	ll tb=b;
 	ll gc = gcd(b,a);
 	ta/=gc;
 	tb/=gc;
 	ll ans=0;
 	for(ll i=1;i*i<=n;i++)
 	{
 		if(i%b==0)continue;
 		vector<ll>p;
 		p.push_back(i);
 		p.push_back(i+1);
 		p.push_back(i-1);
 		p.push_back(b/i);
 		p.push_back(b/i+1);
 		p.push_back(b/i-1);

 		for(ll tt:p)
 		{
 			if(!(1<=tt && tt<=n))continue;
 			ll flr = (tt/b);
	 		flr*=a;
	 		ll val = ((a*tt)/b) - flr;
	 		ans=max(ans,val); 
 			// cout<<tt<<" "<<val<<endl;	
 		}			
 	}
 	cout<<ans<<endl;
    return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:6:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<long long int, std::allocator<long long int> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = long long int]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~
Language: C++

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

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);

    ll a, b, n;
    while(cin >> a >> b >> n) {

        ll cur = 0, ans = 0, idx = 0;

        for(ll x = n; x >= max(0LL, n - 10000000); x--) {
            cur = (a * x / b) - (a * (x / b));

            if(cur > ans) {
                ans = cur;
                idx = x;
            }
        }

        for(ll x = 0; x <= min(n, 10000000); x++) {
            cur = (a * x / b) - (a * (x / b));

            if(cur > ans) {
                ans = cur;
                idx = x;
            }
        }


        cerr << "x = " << idx << endl;
        cout << ans << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:31: error: no matching function for call to 'min(ll&, int)'
   23 |         for(ll x = 0; x <= min(n, 10000000); x++) {
      |                            ~~~^~~~~~~~~~~~~
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:23:31: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   23 |         for(ll x = 0; x <= min(n, 10000000); 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:
/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:23:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   23 |         for(ll x = 0; x <= min(n, 10000000); x++) {
      |                            ~~~^~~~~~~~~~~~~
Language: Java

11 10 import java.util.*;

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

    double a = sc.nextDouble();
    double b = sc.nextDouble();
    double n = sc.nextDouble();
    double tmp = 0;
    int ans = 0;

    for(int x = 1; x <= n; x++){
      tmp = Math.floor(a * x / b) - a * Math.floor(x / b);

      if(tmp > ans){
        ans = (int)tmp;
      }
    }

    System.out.println(ans);
  }
}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
11 10 import java.util.*;
^
1 error
Language: C++

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

int main(){
  int a,b,n;
  cin>>a>>b>>n;
  vector<int> data(n+1);
  for(int i=0;i<n+1;i++){
    data.at(i)=a*i/b-a*(x/b);
  }
  sort (data.begin(),data.end());
  cout<<data.at(n+1)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:25: error: 'x' was not declared in this scope
    9 |     data.at(i)=a*i/b-a*(x/b);
      |                         ^
Language: C++

//https://atcoder.jp/contests/abc165/tasks/abc165_d
//2020-05-02
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:26:23: error: redeclaration of 'long long int tmp'
   26 |             long long tmp = ((N/B)*B)-1;
      |                       ^~~
a.cc:25:19: note: 'long long int tmp' previously declared here
   25 |         long long tmp = B-1;
      |                   ^~~
Language: C++

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

int floor(int A, int B, int N);
int main() {
  int a, b, n;
  cin >> a >> b >> n;
  int x = floor(a, b, n);
  cout << x << endl;
    
} 

int floor(int A, int B, int N) {
  int x = 0;
  vector<int> y(N);
  while(x < N) {
    y.at(x) = (A * x) / B - A * (x / B)
    x++;
  }
  
  sort(y.begin(), y.end());
  reverse(y.begin(), y.end());
  
  return y.at(0);
}

Compiler output:
a.cc: In function 'int floor(int, int, int)':
a.cc:17:40: error: expected ';' before 'x'
   17 |     y.at(x) = (A * x) / B - A * (x / B)
      |                                        ^
      |                                        ;
   18 |     x++;
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if(a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if(a > b) { a = b; return true; } return false; }
const ll IMF = 1LL << 60;
int main() {
  ll A, B, N;
  cin >> A >> B >> N;
  ll s = A * N;
  ll t = A * (N - 1);
  
  ll ans = (A * (B - 1)) / B;
  if(B > N) { cout << s / B; return 0; }
  else if(B == N) { cout << max(s / B - 1, t / B); return 0; }
  else if(B < N) {
    cout << t / B; return 0;
    }
  } 

  cout << ans;

  return 0;
}

Compiler output:
a.cc:21:3: error: 'cout' does not name a type
   21 |   cout << ans;
      |   ^~~~
a.cc:23:3: error: expected unqualified-id before 'return'
   23 |   return 0;
      |   ^~~~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long  a,b,n;
  cin>>a>>b>>n;
 for(int i=0;i<=n;i++){
  float y=((a*i)/b);
  float z=(i/b);
  float c=floor(y)-(a*floor(z));
 }
  cout<<c<<endl;
 
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'c' was not declared in this scope
   12 |   cout<<c<<endl;
      |         ^
Language: C++

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

int floor(int A, int B, int N);
int main() {
  int a, b, n;
  cin >> a >> b >> n;
  int x = floor(a, b, n);
  cout << x << endl;
    
} 

int floor(int A, int B, int N) {
  int x = 0, vector<int> y(N);
  while(x < N) {
    y.at(x) = (A * x) / B - A * (x / B)
    x++;
  }
  
  sort(y.begin(), y.end());
  reverse(y.begin(), y.end());
  
  return y.at(0);
}

Compiler output:
a.cc: In function 'int floor(int, int, int)':
a.cc:14:26: error: invalid declarator before 'y'
   14 |   int x = 0, vector<int> y(N);
      |                          ^
a.cc:16:5: error: 'y' was not declared in this scope
   16 |     y.at(x) = (A * x) / B - A * (x / B)
      |     ^
a.cc:20:8: error: 'y' was not declared in this scope
   20 |   sort(y.begin(), y.end());
      |        ^
Language: C++


#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main()
{
	ll A,B,N,i;
	double now,max=0;
	cin >> A >> B >> N;
	rep_b(i, N) {
		now = floor((A*i) / B) - A * floor(i / B);
		if (max < now)
			max = now;
	}
	cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'rep_b' was not declared in this scope
   11 |         rep_b(i, N) {
      |         ^~~~~
Language: C++

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

int main() {
  uint64_t B, N;
  int A;
  int value;
  cin >> A >> B >> N;
  
  value = (uint64_t)(1.0*A*1/B)-A*(uint64_t)(1.0*1/B);
  for(int i=2; i<=N; i++){
    uint64_t tmp;
    tmp = (uint64_t)(1.0*A*i/B)-A*(uint64_t)(1.0*i/B);
    value = max(tmp, value);
  }
  cout << value << endl;
}


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

#include<iostream>
#include<math.h>
using namespace std;

int main(){
	long A, B, N;
	cin >> A >> B >> N;
	long tmp = 0, maxi = 0;
	if(B > N){
		tmp = floor(A * N / B) - A * floor(N / B);
		cout << tmp << endl; 
	}else{
		for(int i = B; i <= N; i++){
			int tmp_maxi = maxi;
			tmp = floor(A * i / B) - A * floor(i / B);
			maxi = max(tmp_maxi, tmp);
		}
		cout << maxi << endl;
	}
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:16:35: error: no matching function for call to 'max(int&, long int&)'
   16 |                         maxi = max(tmp_maxi, tmp);
      |                                ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/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:35: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   16 |                         maxi = max(tmp_maxi, tmp);
      |                                ~~~^~~~~~~~~~~~~~~
/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
Language: C++

#include<iostream>
#include<math.h>
using namespace std;

int main(){
	long A, B, N;
	cin >> A >> B >> N;
	long tmp = 0, maxi = 0;
	if(B > N){
		tmp = floor(A * N / B) - A * floor(N / B);
		cout << tmp << endl; 
	}else{
		for(int i = B; i <= N; i++){
			int tmp_maxi = maxi;
			tmp = floor(A * i / B) - A * floor(i / B);
			maxi = max(tmp_maxi, tmp)
		}
		cout << maxi << endl;
	}
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:16:35: error: no matching function for call to 'max(int&, long int&)'
   16 |                         maxi = max(tmp_maxi, tmp)
      |                                ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/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:35: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   16 |                         maxi = max(tmp_maxi, tmp)
      |                                ~~~^~~~~~~~~~~~~~~
/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
Language: C++

#include "bits/stdc++.h"
using namespace std;
using ll = long long;

/*int floor(float num) 
{
	int re = (int)(num / (num - 1));
	return re;
}*/

int main()
{
	ll A,B,N,i,max=0;
	int now;
	cin >> A >> B >> N;
	rep_b(i, N) {
		now = floor((A*i) / B) - A * floor(i / B);
		if (max < now)
			max = now;
	}
	cout << max << endl;
}
/*int mai

Compiler output:
a.cc:23:1: error: unterminated comment
   23 | /*int mai
      | ^
a.cc: In function 'int main()':
a.cc:16:9: error: 'rep_b' was not declared in this scope
   16 |         rep_b(i, N) {
      |         ^~~~~
Language: C++

#include"bits/stdc++.h"
#define endl '\n'

using namespace std;

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

    if(N > B)
        cout << A*(B-1)/B - A*(((B-1)/B));
    else
        if(A*N/B- A*(N/B) > 0);
            cout << A*N/B- A*(N/B);
        else
            cout << 0;        

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'else' without a previous 'if'
   17 |         else
      |         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int floor1(long long a,long long b,long long x){
  return (a*x)/b;
}
long long floor2(long long b,long long x) {
  return x/b;
}
long long main() {
  long long a,b,N;
  cin>>a>>b>>N;

  long long ma=0;
  for(long long i=0;i<=N;i++) {
    ma=max(ma,floor1(a,b,i)-a*floor2(b,i));
  }
  cout<<ma<<endl;
  return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: Java

import java.util.Scanner;

public class Main165 {
	public static void main(String[] args) {
		try (Scanner scn = new Scanner(System.in)) {
			long A = scn.nextLong();
			long B = scn.nextLong();
			long N = scn.nextLong();

			long max = 0;
			for(int x = 1; x <= N; x++) {
				long ax = A * x / B;
				long ab = A * (x/B);
				if(ab > 0) break;
				long tmp = ax - ab;

				if(max < tmp) {
					max = tmp;
				}
			}
			System.out.println(max);
		}
	}
}

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

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

int main(){
  int a, b, n;
  int ans = 0;
  cin >> a >> b >> n;
  for(int i = 1; i <= n; i++){
    int tmp = floor(a * i / b) - a * floor(x / b);
    ans = max(tmp, ans);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:44: error: 'x' was not declared in this scope
    9 |     int tmp = floor(a * i / b) - a * floor(x / b);
      |                                            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)

/*
bool isprime(int x){
	for(int i = 2;i*i<=x;i++){
		if(x%i == 0)return false;
	}
	return x!=1;
}
int gcd(int a, int b) 
{ 
    if (a == 0) 
       return b; 
    if (b == 0) 
       return a; 
   
    if (a == b) 
        return a; 
   
    if (a > b) 
        return gcd(a-b, b); 
    return gcd(a, b-a); 
} 
*/


//3111111111111111111111111111111






	void solve(){
		
		ini(n);
		ini(n1);
		ini(k);
		int ma= 0;
		if(k<1000){
			FOR(i,1,k+1){
				int tmp = (n*i)/n1-n*(i/n1);
				ma = max(ma,tmp);
			}
			return out(ma);
		}
		else{
			if(k<=n1-1)out(k);
			else{
				int rick = (n*k)/n1-n*(k/n1);
				int rick1 = (n*(n1-1))/n1-n*((n1-1)/n1);
				out(max{rick,rick1,0});
			}
			return;
		}
	}









































int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:69:40: error: expected ')' before '{' token
   69 |                                 out(max{rick,rick1,0});
      |                                    ~   ^
      |                                        )
a.cc:69:36: error: no matching function for call to 'out(<unresolved overloaded function type>)'
   69 |                                 out(max{rick,rick1,0});
      |                                 ~~~^~~~~
a.cc:12:65: note: candidate: 'template<class T, class ... U> void out(const T&, const U& ...)'
   12 | void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
      |                                                                 ^~~
a.cc:12:65: note:   template argument deduction/substitution failed:
a.cc:69:36: note:   couldn't deduce template parameter 'T'
   69 |                                 out(max{rick,rick1,0});
      |                                 ~~~^~~~~
a.cc:12:6: note: candidate: 'void out()'
   12 | void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
      |      ^~~
a.cc:12:6: note:   candidate expects 0 arguments, 1 provided
Language: C++

#include<iostream>
#include<math.h>
using namespace std;
int main(){
int a;
int b;
int n;
cin>>a>>b>>n;
double max=-2;
for(int i=1;i<n+1;i++){
    double s=int(a*i/b)-a*int(i/b);
    if(max<s){
        max=s;
    }
}
cout<<max;
return 0}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: expected ';' before '}' token
   17 | return 0}
      |         ^
      |         ;
Language: C++

#include<iostream>
using namespace std;

int main(){
  int a,b,n;cin>>a>>b>>n;
  int mx=-1;
  for(int x=1;x<=n;x++){
    int s=(int)(a*x/b)-A*((int)(x/b));
    if(s>mx){
      mx=s;
    }
  }
  cout << mx << endl;
  return 0;
}  


Compiler output:
a.cc: In function 'int main()':
a.cc:8:24: error: 'A' was not declared in this scope
    8 |     int s=(int)(a*x/b)-A*((int)(x/b));
      |                        ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.*;

public class Solution {

    //private static Object InputStream;

    public static void main(String args[]) throws IOException {
        // Object input;
       Scanner scan=new Scanner(System.in);
       long A=scan.nextLong();
       long B= scan.nextLong();
       long N=scan.nextLong();
       long x=0;
       if(N<B){
           x=N;
       }
       else if(N==B){
           x=N-1;
       }
       else if(N>B){
           x=B-1;
       }
        System.out.println((int)Math.ceil(A*x/B));
    }

}


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

#include <iostream>
using namespace std;
int main(){
int a,b,n;
  cin>>a>>b>>n;
  int i=1;
 while (i<n){
 if (floor((a*i)/b.0)-a*floor(i/b.0)>ans)
   ans=floor((a*i)/b.0)-a*floor(i/b.0);
 }
  i++;
}
cout<<ans;

Compiler output:
a.cc: In function 'int main()':
a.cc:8:19: error: expected ')' before numeric constant
    8 |  if (floor((a*i)/b.0)-a*floor(i/b.0)>ans)
      |           ~       ^~
      |                   )
a.cc:8:6: error: 'floor' was not declared in this scope
    8 |  if (floor((a*i)/b.0)-a*floor(i/b.0)>ans)
      |      ^~~~~
a.cc:8:34: error: expected ')' before numeric constant
    8 |  if (floor((a*i)/b.0)-a*floor(i/b.0)>ans)
      |                              ~   ^~
      |                                  )
a.cc:8:38: error: 'ans' was not declared in this scope; did you mean 'abs'?
    8 |  if (floor((a*i)/b.0)-a*floor(i/b.0)>ans)
      |                                      ^~~
      |                                      abs
a.cc:9:21: error: expected ')' before numeric constant
    9 |    ans=floor((a*i)/b.0)-a*floor(i/b.0);
      |             ~       ^~
      |                     )
a.cc:9:36: error: expected ')' before numeric constant
    9 |    ans=floor((a*i)/b.0)-a*floor(i/b.0);
      |                                ~   ^~
      |                                    )
a.cc: At global scope:
a.cc:13:1: error: 'cout' does not name a type
   13 | cout<<ans;
      | ^~~~
Language: Java

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

public class ProblemC {
    public static void main(String[] args) {
        FastReader s = new FastReader();
        long a=s.nextLong();
        long b=s.nextLong();
        long n=s.nextLong();
        System.out.println((a*Math.min(n,b-1))/b);
    }

    private static boolean isPrime(int n) {
        if (n == 2)
            return true;
        else if ((n % 2 == 0 && n > 2) || n < 2)
            return false;
        else {
            for (int i = 3; i <= (int) Math.sqrt(n); i += 2) {
                if (n % i == 0)
                    return false;
            }
            return true;
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

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

#include"bits/stdc++.h"
#define endl '\n'

using namespace std;

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

    if(N > B)
        cout << A*(B-1)/B - A*(((B-1)/B);
    else
        cout << A*N/B- A*(N/B);


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:41: error: expected ')' before ';' token
   13 |         cout << A*(B-1)/B - A*(((B-1)/B);
      |                               ~         ^
      |                                         )
Language: C++

#include<iostream>
using namespace std;

long long a,b,n,x;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: expected ';' before 'return'
   10 |     cout<<(a*x)/b-a*(x/b);11
      |                             ^
      |                             ;
   11 |     return 0;
      |     ~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <utility>
#include <map>
#include <climits>
#include <vector>
#include <set>
#include <string>
#include <numeric>

#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define int unsigned long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
const int N = 1e5 + 2;
const int INF = 1e9 + 5;
const int MOD = 1e9 + 7;

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

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main(){
  fastIO;
  ll a, b, n;
  cin >> a >> b >> n;
  ll ans = 0;
  ll y;
  for(ll i = 1; i <= min(n,(ll)2e6); i ++ ){
    ans = max(ans, (a*i)/b - a*(i/b));
    y = min(n,(b/i));
    ans = max(ans, (a*y)/b - a*(y/b));
    y = min(n,(a/i));
    ans = max(ans, (a*y)/b - a*(y/b));
    y = max(n-i,1);
    ans = max(ans, (a*y)/b - a*(y/b));
  }
  cout << ans << "\n";
  return 0;
}

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

void d(std::istream& in)
{
    unsigned long long A, B, N;
    in >> A >> B >> N;

    unsigned long long max = 0;
    for (unsigned long long x = 1; x <= N; ++x)
    {
        const double x_B = static_cast<double>(x) / B;
        //        const unsigned long long n = static_cast<unsigned long long>(static_cast<double>(A) * x_B) - A * static_cast<unsigned long long>(x_B);
        const unsigned long long n = A * (x_B - static_cast<unsigned long long>(x_B));
        if (max < n) max = n;
    }

    std::cout << max;
}

Compiler output:
a.cc:1:6: error: variable or field 'd' declared void
    1 | void d(std::istream& in)
      |      ^
a.cc:1:13: error: 'istream' is not a member of 'std'
    1 | void d(std::istream& in)
      |             ^~~~~~~
a.cc:1:1: note: 'std::istream' is defined in header '<istream>'; this is probably fixable by adding '#include <istream>'
  +++ |+#include <istream>
    1 | void d(std::istream& in)
a.cc:1:22: error: 'in' was not declared in this scope; did you mean 'int'?
    1 | void d(std::istream& in)
      |                      ^~
      |                      int
Language: C++

#include <iostream>
#include <numeric>

using namespace std;
using ll = long long;

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

  ll g = gcd(A,B);
  ll a = A/g;
  ll b = B/g;

  ll r;
  if (N >= b-1) {
    r = B-1;
  } else {
    r = N;
  }

  ll ans = floor((double)a*(double)r/(double)b);
  cout << ans << endl;

  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: 'floor' was not declared in this scope
   22 |   ll ans = floor((double)a*(double)r/(double)b);
      |            ^~~~~