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

#include <iostream>

using namespace std;

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

    if (n >= b)
    {
        f = celi(a * (b-1)/ b);
    }
    else
    {
        f = celi(a * n / b);
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'celi' was not declared in this scope
   13 |         f = celi(a * (b-1)/ b);
      |             ^~~~
a.cc:17:13: error: 'celi' was not declared in this scope
   17 |         f = celi(a * n / b);
      |             ^~~~
Language: C++

#include <iostream>

using namespace std;

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

    if(n>=b){
        f = (a * b-1 / b)
    }else{
        f = (a * n / b
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: error: expected ';' before '}' token
   11 |         f = (a * b-1 / b)
      |                          ^
      |                          ;
   12 |     }else{
      |     ~                     
a.cc:13:23: error: expected ')' before '}' token
   13 |         f = (a * n / b
      |             ~         ^
      |                       )
   14 |     }
      |     ~                  
a.cc:13:23: error: expected ';' before '}' token
   13 |         f = (a * n / b
      |                       ^
      |                       ;
   14 |     }
      |     ~
Language: Java

import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
    public  static void main(String[] args) {
        FastScanner sc = new FastScanner();

        int A = Integer.parseInt(sc.next());
        long B = Long.parseLong(sc.next());
        long N = Long.parseLong(sc.next());
        long max = 0;
        long sum;

        if(B-1 <= N) {
        	long num1 = (A * N) / B;
        	long num2 = A * (N / B);
        	sum = num1 - num2;
        } else if(N < B-1) {
        	long num1 = (A * N) / B;
        	long num2 = A * (N / B);
        	sum = num1 - num2;
        }
        System.out.println(sum);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
}

Compiler output:
Main.java:24: error: variable sum might not have been initialized
        System.out.println(sum);
                           ^
1 error
Language: C

#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define all(x) x.begin(),x.end()
#define fast  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
signed main(){
    fast;
    int k;
    cin>>k;
    int a,b;
    cin>>a>>b;
    int q1 = a/k;
    int q2 = b/k;
    if(q1!=q2)
        cout<<"OK";
    else{
        if(a%k == 0){
            cout<<"OK";
        }
        else cout<<"NG";
    }
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
    LL a, b, n;
    scanf("%lld%lld%lld", &a, &b, &n);
    LL x = min(b-1, n);
    ans = max(ans, a*x/b - a*(x/b));
    printf("%lld\n", ans);
}

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

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

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

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

ll solove(ll a, ll b, ll x){
    ll res = int((a*x)/b) - a* int(x/b);
    return res;
}

int main(int argc, char const *argv[]) {
    ll a,b,n; std::cin >> a >> b >> n;
    ll ans = 0;
    // if (n < b) {
    //     ans = solove(a,b,n);
    //     ll temp = solove(a,b,min(b-1,n));
    //     ans = max(ans,temp);
    //
    // } else {
    //     //とりあえずnを試す
    //     ll temp_1 = solove(a,b,n);
    //     // x%b=b-1をのxの最大値を試す
    //     // ll syo = n/b;
    //     // ll kari = b*syo - 1;
    //     // ll temp_2 = solove(a,b,kari);
    //     // 最後に試しにb-1を試す
    //     ll temp_3 = solove(a,b,b-1);
    //     ans = max(temp_3,temp_1);
    //
    // }
    ll ans = max(solove(a,b,n),solove(a,b,min(b-1,n)));
    std::cout << ans << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:47:8: error: redeclaration of 'll ans'
   47 |     ll ans = max(solove(a,b,n),solove(a,b,min(b-1,n)));
      |        ^~~
a.cc:29:8: note: 'll ans' previously declared here
   29 |     ll ans = 0;
      |        ^~~
Language: C++

#include <bits/stdc++.h>
#define ff { ios_base::sync_with_stdio(false);cin.tie(NULL);}
using namespace std;

typedef long long int ll;
 ll  p=1e9+7; 

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


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

#include<iostream>
#include<cmath>
#include <iomanip>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;
using LL = long long;

LL a, b, n;

double aa, bb, nn;

LL res1, res2, res3;

int main() {

	cin >> a >> b >> n;

	if (b != 1) {
		if (n / b >= 1) {
			if (a <= b) {
				res1 = a - 1;
			}
			else {
				aa = a;
				bb = b;
				nn = n;
				for (double i = aa - 1; i >= 0; i--) {
					if (((bb / aa) * i <= floor((bb / aa) * i) && floor((bb / aa) * i) < (bb / aa) * (i + 1.0)) ||
						((bb / aa) * i <= ceil((bb / aa) * i) && ceil((bb / aa) * i) < (bb / aa) * (i + 1.0))) {
						res1 = i;
						break;
					}
				}
			}
		}
		else {
			if (a <= b)
				res1 = floor(n * a / b);
			else {
				aa = a;
				bb = b;
				nn = n;
				for (double i = floor(nn / bb * aa + 1) - 1; i >= 0; i--) {
					if (((bb / aa) * i <= floor((bb / aa) * i) && floor((bb / aa) * i) < (bb / aa) * (i + 1.0)) ||
						((bb / aa) * i <= ceil((bb / aa) * i) && ceil((bb / aa) * i) < (bb / aa) * (i + 1.0))) {
						res1 = i;
						break;
					}
				}
			}
		}
	}
	if (b == 1)res1 = 0;]

	cout << res1 << endl;

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:29: error: expected primary-expression before ']' token
   56 |         if (b == 1)res1 = 0;]
      |                             ^
Language: C

#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
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++)

int main(){
    int a , b , n;
    cin >> a >> b >> n;
    long long k[n];
    long long max = 0;
    rep2(i,1,n+1){
        int s = (a*i)/b;
        int t = (i/b);
        k[i] = s - a*t;
        if(max < k[i]){
                max = k[i];
        }
    }
    cout << max << endl;
}


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

#include <stdio.h>
#include <math.h>

int main(void){
    long long int A,B,N,max=0,i,c,d;
    
    scanf("%lld",&A);
    scanf("%lld",&B);
    scanf("%lld",&N);
    
    if(A>=B){
        i=N;
    }
    }else if(A<B && B<=N){
        i=B-1;
    }else if(A<B){
        i=N;
    }
    
    c=floor(A*i/B);
    d=floor(i/B);
    max=c-A*d;
    
    printf("%lld\n",max);
    
    return 0;
}

Compiler output:
main.c:14:6: error: expected identifier or '(' before 'else'
   14 |     }else if(A<B && B<=N){
      |      ^~~~
main.c:16:6: error: expected identifier or '(' before 'else'
   16 |     }else if(A<B){
      |      ^~~~
main.c:20:5: warning: data definition has no type or storage class
   20 |     c=floor(A*i/B);
      |     ^
main.c:20:5: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
main.c:20:13: error: 'A' undeclared here (not in a function)
   20 |     c=floor(A*i/B);
      |             ^
main.c:20:15: error: 'i' undeclared here (not in a function)
   20 |     c=floor(A*i/B);
      |               ^
main.c:20:17: error: 'B' undeclared here (not in a function)
   20 |     c=floor(A*i/B);
      |                 ^
main.c:21:5: warning: data definition has no type or storage class
   21 |     d=floor(i/B);
      |     ^
main.c:21:5: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int]
main.c:22:5: warning: data definition has no type or storage class
   22 |     max=c-A*d;
      |     ^~~
main.c:22:5: error: type defaults to 'int' in declaration of 'max' [-Wimplicit-int]
main.c:24:12: error: expected declaration specifiers or '...' before string constant
   24 |     printf("%lld\n",max);
      |            ^~~~~~~~
main.c:24:21: error: expected declaration specifiers or '...' before 'max'
   24 |     printf("%lld\n",max);
      |                     ^~~
main.c:26:5: error: expected identifier or '(' before 'return'
   26 |     return 0;
      |     ^~~~~~
main.c:27:1: error: expected identifier or '(' before '}' token
   27 | }
      | ^
Language: C

#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;
using namespace __gnu_pbds;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> order_set;

int main() {
    LL A, B, N;
    scanf("%lld %lld %lld", &A, &B, &N);
    LL q1 = N / B, r1 = N % B;
    if (q1 == 0) printf("%lld\n", (r1 * A) / B);
    else printf("%lld\n", ((B - 1) * A) / B);
    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
by Benq;
*/


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

#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<map>
#include<set>
//#include <Eigen/Dense>
//#include <Eigen/Geometry>
//using namespace Eigen;

using namespace std;

int main() 
{
	
	long long a,b,n;
	cin >> a >> b >> n;
	long long ans = 0;
	for(int i  = 1;i<=n;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:24:32: error: expected primary-expression before 'long'
   24 |                 ans = max(ans, long long(floor(a*i / b) - a * floor(i / b)));
      |                                ^~~~
Language: C++

#include <math.h>
using namespace std;

long long func(long long a,long long b,long long x){
  long long ans;
  ans = floor((a*x)/b) + a*floor(x/b);
  return ans;
}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'cin' was not declared in this scope
   12 |   cin >> a >> b >> n;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <math.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:14:3: error: 'cout' was not declared in this scope
   14 |   cout << f(a,b,n) << endl;
      |   ^~~~
a.cc:14:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:11: error: 'f' was not declared in this scope
   14 |   cout << f(a,b,n) << endl;
      |           ^
a.cc:14:23: error: 'endl' was not declared in this scope
   14 |   cout << f(a,b,n) << endl;
      |                       ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <math.h>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 165, task D, 2020/05/02
//ms,
/*
講評
内側のif文はelseの方しか走らない。

*/

int f(int64_t x, int64_t A, int64_t B){
  return (A*x)/B - A*(x/B);
}

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

  if(N<B) cout<<f(N,A,B);
  else{
    if(f(B,A,B)<f(0,A,B)) cout <<f(B-1,A,B);
    else cout <<max(f((N/B)B-1,A,B),f(N,A,B));
  }

  return 0;
}
/*
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:23:28: error: expected ')' before 'B'
   23 |     else cout <<max(f((N/B)B-1,A,B),f(N,A,B));
      |                      ~     ^
      |                            )
Language: Java

import java.util.*;

public class Main0 {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int A = Integer.parseInt(sc.next());
      int B = Integer.parseInt(sc.next());
      int N = Integer.parseInt(sc.next());
      double ans = 0;
      if(N > B){
        ans = Math.floor(A*(B-1)/B) - A * Math.floor((B-1)/B);
        System.out.println((int)ans);

      }else{
        ans = Math.floor(A*N/B) - A * Math.floor(N/B);
        System.out.println((int)ans);

      }
  }
}


Compiler output:
Main.java:3: error: class Main0 is public, should be declared in a file named Main0.java
public class Main0 {
       ^
1 error
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((n*k)/n1-n*(k/n1););
			else out((n*(n1-1))/n1-n*((n1-1)/n1););
			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:65:57: error: expected ')' before ';' token
   65 |                         if(k<=n1-1)out((n*k)/n1-n*(k/n1););
      |                                       ~                 ^
      |                                                         )
a.cc:65:58: error: expected primary-expression before ')' token
   65 |                         if(k<=n1-1)out((n*k)/n1-n*(k/n1););
      |                                                          ^
a.cc:66:25: error: 'else' without a previous 'if'
   66 |                         else out((n*(n1-1))/n1-n*((n1-1)/n1););
      |                         ^~~~
a.cc:66:61: error: expected ')' before ';' token
   66 |                         else out((n*(n1-1))/n1-n*((n1-1)/n1););
      |                                 ~                           ^
      |                                                             )
a.cc:66:62: error: expected primary-expression before ')' token
   66 |                         else out((n*(n1-1))/n1-n*((n1-1)/n1););
      |                                                              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,x,d,e;
  cin>>a>>b>>x;
  d=a*x/b;
  e=a*(b-1)/b;
  if(x>=b-1)cout<<e<<endl; 
  else coue<<d<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: 'coue' was not declared in this scope
    9 |   else coue<<d<<endl;
      |        ^~~~
Language: C++

#include <math.h>
using namespace std;

long long func(long long a,long long b,long long x){
  long long ans;
  ans = floor((a*x)/b) + a*floor(x/b);
  return ans;
}

int main(){
  long long a,b,n,ans=0;
  cin >> a >> b >> n;
  for(long long i=n;i>0;i--){
    ans = max(ans,func(a,b,i));
  }
  cout << ans << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'cin' was not declared in this scope
   12 |   cin >> a >> b >> n;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <math.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:16:3: error: 'cout' was not declared in this scope
   16 |   cout << ans << endl;
      |   ^~~~
a.cc:16:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:18: error: 'endl' was not declared in this scope
   16 |   cout << ans << endl;
      |                  ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <math.h>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

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

long long func(long long a,long long b,long long x){
  long long ans;
  ans = floor((a*x)/b) + a*floor(x/b);
  return ans;
}

int main(){
  long long a,b,x,ans=0;
  cin >> a >> b;
  for(long long i=b;a*i >= b;i--){
    ans = max(ans,f(a,b,i));
  }
  cout << ans << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: 'f' was not declared in this scope
   15 |     ans = max(ans,f(a,b,i));
      |                   ^
Language: C++

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

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

cin >> A >> B >> N ;

int ans1=0;
int ans2=0;

int n , m , l ;

  n=(A*((N))/B);
  m=((N)/B);
  ans2=n-A*m;

  if((B*i)<=N){
  n=(A*((B)-1)/B);
  m=(((B)-1)/B);
  ans1=n-A*m;
}



/*for(int i=0;i<B+1;i++){
  n=(A*(((B+1)*l)-(B/2)+i)/B);
  m=((((B+1)*l)-(B/2)+i)/B);
  if((((B+1)*l)-(B/2)+i)>N)
  break;
  ans1=n-A*m;
  if(ans1<ans2)
  break;
  ans2 = ans1 ;
}*/

cout << max(ans2,ans1) << endl;


return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'i' was not declared in this scope
   19 |   if((B*i)<=N){
      |         ^
Language: C++

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

int main() {
  #define int long long
  int a, b, n;
  cin >> a >> b >> n;
  cout << min(n, b - 1); << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:26: error: expected primary-expression before '<<' token
    8 |   cout << min(n, b - 1); << endl;
      |                          ^~
Language: C++

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

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

cin >> A >> B >> N ;

int ans1=0;
int ans2=0;

int n , m , l ;

  n=(A*((N))/B);
  m=(((N))/B);
  ans2=n-A*m;

  n=(A*((B*i)-1)/B);
  m=(((B*i)-1)/B);
  ans1=n-A*m;
  ans2 = ans1 ;


/*for(int i=0;i<B+1;i++){
  n=(A*(((B+1)*l)-(B/2)+i)/B);
  m=((((B+1)*l)-(B/2)+i)/B);
  if((((B+1)*l)-(B/2)+i)>N)
  break;
  ans1=n-A*m;
  if(ans1<ans2)
  break;
  ans2 = ans1 ;
}*/

cout << ans2 << endl;


return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: 'i' was not declared in this scope
   19 |   n=(A*((B*i)-1)/B);
      |            ^
Language: C++

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

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

cin >> A >> B >> N ;

int ans1=0;
int ans2=0;

int n , m , l ;

  n=(A*((N))/B);
  m=(((N))/B);
  ans2=n-A*m;

  n=(A*((B*i)-1)/B);
  m=(((B*i)-1)/B);
  ans1=n-A*m;
  ans2 = ans1 ;
}

/*for(int i=0;i<B+1;i++){
  n=(A*(((B+1)*l)-(B/2)+i)/B);
  m=((((B+1)*l)-(B/2)+i)/B);
  if((((B+1)*l)-(B/2)+i)>N)
  break;
  ans1=n-A*m;
  if(ans1<ans2)
  break;
  ans2 = ans1 ;
}*/

cout << ans2 << endl;


return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: 'i' was not declared in this scope
   19 |   n=(A*((B*i)-1)/B);
      |            ^
a.cc: At global scope:
a.cc:36:1: error: 'cout' does not name a type
   36 | cout << ans2 << endl;
      | ^~~~
a.cc:39:1: error: expected unqualified-id before 'return'
   39 | return 0;
      | ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define speedX ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T>
void __f(const char* s, T t) { cout << s << " : "; __p(t); }
template<typename T>
void __t(const char* s, const T &x) { cout << s << " : { "; for (auto it : x) __p(it); cout << "} ";}
template<typename T, typename ... F>
void __f(const char* s, T t, F ... f) {
	int i = 0; for (;; ++i) if (s[i] == ',') break;
	cout.write(s, i) << " : "; __p(t); cout << " | "; __f(s + i + 1, f...);
}
#define trace(...) { cout<<"LINE: "<<__LINE__<<" || "; __f(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
#define debug(...) { cout<<"LINE: "<<__LINE__<<" || "; __t(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
int begtime = clock();
#define end_time() cout << "\n\nTime of execution: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define trace(...)
#define debug(...) 
#define end_time()
#endif
 
 
#define int long long 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

inline bool equals(ld a, ld b) {return fabs(a - b) < 1e-9;}
inline int gcd(int a, int b) { a=abs(a); b=abs(b); while(a>0 && b>0) (a>b?a%=b:b%=a); return (a==0?b:a); } 
inline int power(int x, int n, int m = LLONG_MAX)
    {  int res=1; x = (x%m + m)%m;
       while(n) { if(n&1) res=(res*x)%m;  x=(x*x)%m;  n >>= 1; }  return res;
    }
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define mod 1000000007
int go(int n){
	if(n<0) return 0;
	return (((a*n)/b)-(a*(n/b)))
}
void solve(){
	int a,b,n;
	cin>>a>>b>>n;
	int ans = max(go(n),go(n-1));
	ans = max(ans, go(n/2));
	ans = max(ans, go((n/2)+1));
	ans = max(ans, go((n/2)-1));
	cout<<max(ans,(int)0)<<"\n";
}
signed main(){
	speedX;
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int t=1;
	//cin>>t;
	for(int i=1;i<=t;++i) {
		//cout<<"Case #"<<i<<": ";
		solve();
	}
	end_time();
	return 0;
}


Compiler output:
a.cc: In function 'long long int go(long long int)':
a.cc:57:19: error: 'a' was not declared in this scope
   57 |         return (((a*n)/b)-(a*(n/b)))
      |                   ^
a.cc:57:24: error: 'b' was not declared in this scope
   57 |         return (((a*n)/b)-(a*(n/b)))
      |                        ^
a.cc:57:37: error: expected ';' before '}' token
   57 |         return (((a*n)/b)-(a*(n/b)))
      |                                     ^
      |                                     ;
   58 | }
      | ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,x,d,e;
  cin>>a>>b>>x;
  d=a/b;
  e=a*x/b
  if(x>=b-1)
    cout<<a-d<<endl;
  else
    cout<<e<<endl;    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: expected ';' before 'if'
    7 |   e=a*x/b
      |          ^
      |          ;
    8 |   if(x>=b-1)
      |   ~~      
a.cc:10:3: error: 'else' without a previous 'if'
   10 |   else
      |   ^~~~
Language: Java

    import java.util.*;
    import java.math.*;
         
    class Main{
        public static void main(String[] args) {
            
            try(Scanner sc = new Scanner(System.in)){
     
                double a = sc.nextLong();
                double b = sc.nextLong();
                double n = sc.nextLong();
     
                long ans = 0;
     
                if(n == 1){
                    ans = Math.floor(a*(1/b)) - a*Math.floor(1/b);
                }else if(b > n){
                    ans = Math.floor(a*(n/b)) - a*Math.floor(n/b);
                }else{
                    ans = Math.floor(a*((n-1)/b)) - a*Math.floor((n-1)/b);
                }
     
                System.out.println(ans);
     
            }catch(Exception e){
                e.printStackTrace();
            }        
        }
    }

Compiler output:
Main.java:16: error: incompatible types: possible lossy conversion from double to long
                    ans = Math.floor(a*(1/b)) - a*Math.floor(1/b);
                                              ^
Main.java:18: error: incompatible types: possible lossy conversion from double to long
                    ans = Math.floor(a*(n/b)) - a*Math.floor(n/b);
                                              ^
Main.java:20: error: incompatible types: possible lossy conversion from double to long
                    ans = Math.floor(a*((n-1)/b)) - a*Math.floor((n-1)/b);
                                                  ^
3 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,x,d,e;
  cin>>a>>b>>x;
  d=a/b;
  e=a*x/b
  if(x>=b-1)
    cout<<a-d;<<endl;
  else
    cout<<e<<endl;    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: expected ';' before 'if'
    7 |   e=a*x/b
      |          ^
      |          ;
    8 |   if(x>=b-1)
      |   ~~      
a.cc:9:15: error: expected primary-expression before '<<' token
    9 |     cout<<a-d;<<endl;
      |               ^~
a.cc:10:3: error: 'else' without a previous 'if'
   10 |   else
      |   ^~~~
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
using namespace std;
#define rep(N) for(int i=0;i<N;i++)
#define rep2(N1,N2) for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)for(int k=0;k<N3;k++)
#define For(i,N) for(int i=0;i<N;i++)
void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int main() {
	long long int A, B, N;
	cin >> A >> B >> N;
	int x = 0;
	int flag = 0;
	int flag2 = 0;
	int k = 1;
	vector<double>kk;
	if (N >= B) {
		x = B - 1;
	
	}
	else {
		x = N;
		

	}
	long long int ans;
	ans = floor((A*x / B)) - A * floor(x / B));
	cout << ans;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:50: error: expected ';' before ')' token
   45 |         ans = floor((A*x / B)) - A * floor(x / B));
      |                                                  ^
      |                                                  ;
Language: C

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long int floor_(float x){
 return (long long int)x/1;}

int main(){
 long long a,b,n;
 scanf("%lld%lld%lld",&a,&b,&n);
 
 if(n<b){
  printf("%lld\n",floor_(a*(float)n/(float)b));
  return 0;}
 
 if(n==b){
  printf("%lld\n",floor_(a*(float)(n-1)/(float)b));
  return 0;}
  
 else{
   int x=n/b;
   x=x*b-1;
   printf("lld\n",loor_(a*x/b)-a*floor_(x/b));
  return 0;}

} 

Compiler output:
main.c: In function 'main':
main.c:24:19: error: implicit declaration of function 'loor_'; did you mean 'floor_'? [-Wimplicit-function-declaration]
   24 |    printf("lld\n",loor_(a*x/b)-a*floor_(x/b));
      |                   ^~~~~
      |                   floor_
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>

using namespace std;

unsigned long long a, b, n, r1, r2;

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

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

#include <bits/stdc++.h>
#define ff first
#define ss second
#define vi vector<int>
#define pb emplace_back
#define ll long long int
#define vll vector<long long int>
#define vpi vector<pair<ll,ll>>
#define bit(x) __builtin_popcount(x)
#define all(x) (x).begin(), (x).end()
#define mem(a) memset(a , 0 ,sizeof a)
#define rep(i,n) for(int i=0 ; i<n ; ++i)
#define deb(x) cout << #x << " - " << x << endl;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll MOD = 1e9 + 7;
const ll INF = 10000000000000000;
const ll MAX_N = 1e5 + 7;


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: expected '}' before 'else'
    8 |     else{
      |     ^~~~
a.cc:6:13: note: to match this '{'
    6 |   if (B = 1){
      |             ^
a.cc: At global scope:
a.cc:19:1: error: expected declaration before '}' token
   19 | }
      | ^
Language: C++

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

int main(){
    ll a,b,n,ans;
    scanf("%lld %lld %lld",&a,&b,&n);

    ans=0;
    if(b>n){
        if(ans<(a*n)/b) ans=(a*n)/b;
    }else{
        if(ans<(a*(b-1))/b) ans=(a*(b-1))/b;
    }
    printf("%lld",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'll' was not declared in this scope
    5 |     ll a,b,n,ans;
      |     ^~
a.cc:6:29: error: 'a' was not declared in this scope
    6 |     scanf("%lld %lld %lld",&a,&b,&n);
      |                             ^
a.cc:6:32: error: 'b' was not declared in this scope
    6 |     scanf("%lld %lld %lld",&a,&b,&n);
      |                                ^
a.cc:6:35: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |     scanf("%lld %lld %lld",&a,&b,&n);
      |                                   ^
      |                                   yn
a.cc:8:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
    8 |     ans=0;
      |     ^~~
      |     abs
Language: C++

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


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++

// AtCoder Beginners Contest 165
// D - Floor Function

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    unsigned long A, B, N, i,m, value0, value1;

    cin >> A >> B >> N;

    if (A < 1 && 1000000 < A)  {
        cout << "Aは条件を満たしていません!\n";
        return 0;
    }

    if (B < 1 && 1000000000000 < B)  {
        cout << "Bは条件を満たしていません!\n";
        return 0;
    }

    if (N < 1 && 1000000000000 < N)  {
        cout << "Nは条件を満たしていません!\n";
        return 0;
    }
    
    m = 1;
    value0 = floor(A*m/B) - A*floor(m/B);
    if value0 
    for (i = 1; i <= B-1; i++) {
	value1 = floor(A*i/B) - A*floor(i/B);
	if (value1 > value0) {
	    value0 = value1;
	}
    }
    cout << value0 << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:8: error: expected '(' before 'value0'
   32 |     if value0
      |        ^~~~~~
      |        (
a.cc:33:30: error: expected ';' before ')' token
   33 |     for (i = 1; i <= B-1; i++) {
      |                              ^
      |                              ;
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>
#include<map>
#include<deque>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,n) for(ll i=1;i<=n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=1000000007;
const ll INF=10e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}


int main(void){
    ll A,B,N;
    cin>>A>>B>>N;
    ll ans=min(B-1,N);
    cout<<a*ans/b<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:11: error: 'a' was not declared in this scope
   33 |     cout<<a*ans/b<<endl;
      |           ^
a.cc:33:17: error: 'b' was not declared in this scope
   33 |     cout<<a*ans/b<<endl;
      |                 ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>
#include<map>
#include<deque>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,n) for(ll i=1;i<=n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=1000000007;
const ll INF=10e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}


int main(void){
    ll A,B,N;
    cin>>A>>B>>N;
    ll ans=min(B-1,N)
    cout<<a*ans/b<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: expected ',' or ';' before 'cout'
   33 |     cout<<a*ans/b<<endl;
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  long long int a,b,x;
  cin>>a>>b>>x;
  if(x<b){
  cout<<(a*x)/b;
  
  }else{
    
      cout<<(a*(b-1))/b;
    }
  
  }
  

}

Compiler output:
a.cc:19:1: error: expected declaration before '}' token
   19 | }
      | ^
Language: C++

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

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<29;
//const ll INF = (ll)1e18 + 1;


int main(){
  ll A, B, N; cin >> A >> B >> N;
  ll x;
  if (N >= B) 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:29:15: error: 'X' was not declared in this scope
   29 |   if (N >= B) X = B - 1;
      |               ^
a.cc:30:8: error: 'X' was not declared in this scope
   30 |   else X = N;
      |        ^
a.cc:31:22: error: 'X' was not declared in this scope
   31 |   ll ans = floor(A * X / B) - A * floor(X / B);
      |                      ^
Language: C

#include <stdio.h>
#include <math.h>
typedef unsigned long int uint36_t;
typedef unsigned long long int uint64_t;

int main(void){
	uint32_t a;
	uint64_t b, n, temp;
	scanf("%lu %lu %lu", &a, &b, &n);
	temp = 0;
	for(int i = 1; i <= n; i++){
		if(temp < floor(a*i/b))
		  temp = floor(a*i/b);
	}
	printf("%lu\n", temp);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:9: error: unknown type name 'uint32_t'
    7 |         uint32_t a;
      |         ^~~~~~~~
main.c:3:1: note: 'uint32_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'
    2 | #include <math.h>
  +++ |+#include <stdint.h>
    3 | typedef unsigned long int uint36_t;
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>

typedef long long int64;
typedef unsigned long long uint64;


int main()
{

	uint64 a, b, n;

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

	printf("%llu", (uint64)floor(a * min(b - 1, n) / b));

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:42: error: 'min' was not declared in this scope; did you mean 'std::min'?
   17 |         printf("%llu", (uint64)floor(a * min(b - 1, n) / b));
      |                                          ^~~
      |                                          std::min
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from /usr/include/c++/14/math.h:36,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
Language: C++

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

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<29;
//const ll INF = (ll)1e18 + 1;


int main(){
  ll A, B, N; cin >> A >> B >> N;
  ll x;
  if (N >= B) 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:29:15: error: 'X' was not declared in this scope
   29 |   if (N >= B) X = B - 1;
      |               ^
a.cc:30:8: error: 'X' was not declared in this scope
   30 |   else X = N;
      |        ^
a.cc:31:22: error: 'X' was not declared in this scope
   31 |   ll ans = floor(A * X / B) - a * floor(X / B);
      |                      ^
a.cc:31:31: error: 'a' was not declared in this scope
   31 |   ll ans = floor(A * X / B) - a * floor(X / B);
      |                               ^
Language: C

#include <stdio.h>
#include <math.h>

int main(void){
	uint32_t a;
	uint64_t b, n, temp;
	scanf("%lu %lu %lu", &a, &b, &n);
	temp = 0;
	for(int i = 1; i <= n; i++){
		if(temp < floor(a*i/b))
		  temp = floor(a*i/b);
	}
	printf("%lu\n", temp);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: unknown type name 'uint32_t'
    5 |         uint32_t a;
      |         ^~~~~~~~
main.c:3:1: note: 'uint32_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'
    2 | #include <math.h>
  +++ |+#include <stdint.h>
    3 | 
main.c:6:9: error: unknown type name 'uint64_t'
    6 |         uint64_t b, n, temp;
      |         ^~~~~~~~
main.c:6:9: note: 'uint64_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'
Language: C++

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

int main(){
    int A,B,N;
    cin>>A>>B>>N;
    int x;
    int f;
    if (N>B-1){
        x=B-1;
    }else{
        x=N;
    }
    f=int(floor(A*x/B)-A*int(floor(x/B));
    cout<<f<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:7: error: expected primary-expression before 'int'
   15 |     f=int(floor(A*x/B)-A*int(floor(x/B));
      |       ^~~
Language: C++

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

int main(){
  int64_t A, B, N, ans;
  cin >>A >> B >> N;
  ans = 0;
  if(N*A < B){
    ans =0;
  }
  if(N>10000000 && B > 10000000 && A<100000){
    
    for(int64_t i = N-1000*A/B-1; i <= N;i++){
    int64_t x = A*i/B -A*(i/B);
    if(ans < x){
      ans = x;
    }
    
      
  }
    
  else
  {
  for(int64_t i = N-2*A/B-1; i <= N;i++){
    int64_t x = A*i/B -A*(i/B);
    if(ans < x){
      ans = x;
    }
  }
  }
  cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: expected '}' before 'else'
   22 |   else
      |   ^~~~
a.cc:11:45: note: to match this '{'
   11 |   if(N>10000000 && B > 10000000 && A<100000){
      |                                             ^
Language: Java

import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	static Scanner sc = new Scanner(System.in);

	static class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		public FastScanner(InputStream source) {
			in = source;
		}

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte()) return buffer[ptr++];
			else return -1;
		}

		private static boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

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

	public static void main(String[] args){

		solve_abc166_d();
	}
  
  	public static void solve_abc166_d(){

		FastScanner sc = new FastScanner(System.in);
		
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		long n = sc.nextLong();
		long max = 0;
		
		max = solve_abc166_d_func(a, b, n);

		System.out.println(max);
	}
}

Compiler output:
Main.java:128: error: cannot find symbol
		max = solve_abc166_d_func(a, b, n);
		      ^
  symbol:   method solve_abc166_d_func(double,double,long)
  location: class Main
1 error