criyle/codenet-compile-errors huggingface dataset:
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++) {
    		if(i%B==B-1) {
        		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++

using namespace std;
int main(){
  int A,B,N;
  cin>>A>>B>>N;
  int num=0;
  int num1=0;
  for(int i=1;i<=N;i++){
    int c=A*i/B;
    int d=i/B;
    num1=c-A*d;
    num=max(num,num1);
  }
  cout<<num<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin>>A>>B>>N;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:11:9: error: 'max' was not declared in this scope
   11 |     num=max(num,num1);
      |         ^~~
a.cc:13:3: error: 'cout' was not declared in this scope
   13 |   cout<<num<<endl;
      |   ^~~~
a.cc:13:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:14: error: 'endl' was not declared in this scope
   13 |   cout<<num<<endl;
      |              ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long a,b,n;f=0;  cin>>a>>b>>n;
  //vector<int>c;
 for(int i=min(a,b);i<=n;i++){
    int g=floor((a*i)/b)-(a*floor(i/b));
   f=max(g,f);
 
 }
 // sort(c.begin(),c.end());
   cout<<f<<endl; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:19: error: 'f' was not declared in this scope
    5 |   long long a,b,n;f=0;  cin>>a>>b>>n;
      |                   ^
Language: C++

#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

long long gcd(int a, int b){
  if (a%b == 0){
    return(b);
  }
  else{
    return(gcd(b, a%b));
  }
}

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

  double C = (double)abs(A-B)/B;
  int maxn = floor(A*C) - A*floor(C),D;
  
  int i=abs(A-B);
  if(N>100000000){
    while(i<N){
      i++;
      C = (double)i/B;
      D = floor(A*C) - A*floor(C);
      if(maxn < D){
	maxn = D;
	long long j=i;
      }
      else{
	if(j<i-5){
	  ans = maxn;
	  cout << ans << endl; 
	  return 0;
	}
      }
    }
  }
  
  C = (double)1/B;
  maxn = floor(A*C) - A*floor(C),D;

  for(int i=2;i<=N;i++){
    D = floor((double)A*(double)i/(double)B) - A*floor((double)i/(double)B);
    maxn = max(maxn,D);
  }
    
  
  cout << maxn << endl;
  
}
 


Compiler output:
a.cc: In function 'int main()':
a.cc:51:12: error: 'j' was not declared in this scope
   51 |         if(j<i-5){
      |            ^
Language: C++

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

Compiler output:
a.cc:24:6: error: expected unqualified-id before 'return'
   24 |      return 0;
      |      ^~~~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

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

int main()
{	

  long long A,B,N;  
  cin>> A >> B >> N;
  
  long long tmp =0;
  long long max_score = 0;
  
  long long maxC = floor(1.0*N/B);
  
if(B-1<=N){  
  N = B-1
}
  
  tmp = floor(1.0*A*N/B) - A * floor(N/B);
    if(tmp > max_score)
    {
     max_score = tmp; 
    } 
  
  
  cout << max_score;  
  
  return 0;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:10: error: expected ';' before '}' token
   17 |   N = B-1
      |          ^
      |          ;
   18 | }
      | ~
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 ans = 0, cur, t = n / max(1, abs(a - b));

            for(int i = 0; i <= 100; i++) {
                ll x;
                x = t + i;
                x = min(n, x);

                cur = (a * x / b) - (a * (x / b));

                ans = max(ans, cur);

                x = t - i;
                x = max(0LL, x);

                cur = (a * x / b) - (a * (x / b));

                ans = max(ans, cur);
            }

            cout << ans << endl;

        }
    }


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

import java.util.Scanner;

public class Main

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long N = sc.nextLong();
		sc.close();

		long answer = 0;
		double calculatedNumber = 0;
		for(long t = 0; t <= B+1 && t <= N; t++) {
			calculatedNumber = Math.floor(A*t/B) - A * Math.floor(t/B);
			if(calculatedNumber >= answer) {
				answer = (long) calculatedNumber;
			}
		}

		for(long t = N; t <= N-B-1 && t >= 0; t--) {
			calculatedNumber = Math.floor(A*t/B) - A * Math.floor(t/B);
			if(calculatedNumber >= answer) {
				answer = (long) calculatedNumber;
			}
		}

		System.out.println(answer);

	}

}


Compiler output:
Main.java:3: error: '{' expected
public class Main
                 ^
Main.java:5: error: unnamed classes are a preview feature and are disabled by default.
	public static void main(String[] args) {
	              ^
  (use --enable-preview to enable unnamed classes)
Main.java:33: error: class, interface, enum, or record expected
}
^
3 errors
Language: Java

import java.util.Scanner;

class Main {
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        long b = sc.nextLong();
         long c = sc.nextLong();

        int max = -1000000;

        long alpha = Math.max(1,long(b/a));



        for(double i=0;i<=c;i=(i+alpha))
        {
            int fc =(int)((a*i)/b) -(a*(int)(i/b));
            if(fc>max)
            {
                System.out.println(fc+" "+i);
                max=fc;
            }
        }
        System.out.print(max);
    }
}


Compiler output:
Main.java:13: error: '.class' expected
        long alpha = Math.max(1,long(b/a));
                                    ^
Main.java:13: error: not a statement
        long alpha = Math.max(1,long(b/a));
                                      ^
Main.java:13: error: ';' expected
        long alpha = Math.max(1,long(b/a));
                                        ^
3 errors
Language: C++

#include <stdio.h>
int i, j, n, m, k, a[1005], b[1005], N[1005][1005];
void dfs(int i){
 for(i=1; i<=n; i++){
  for(j=1; j<=m; j++){
  scanf("%d%d", &a, &b);
  scanf("%d", &N); 
  }
 }
int main(){
 scanf("%d%d", &n, &m);
 for(i=1; i<=n; i++){
  for(j=1; j<=m; j++){
   a[i] * b[i] = N;
  }
 }
 printf("%d\n", ans);
 return 0;
} 

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:10:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   10 | int main(){
      |         ^~
a.cc:10:9: note: remove parentheses to default-initialize a variable
   10 | int main(){
      |         ^~
      |         --
a.cc:10:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:10:11: error: a function-definition is not allowed here before '{' token
   10 | int main(){
      |           ^
a.cc:19:2: error: expected '}' at end of input
   19 | }
      |  ^
a.cc:3:16: note: to match this '{'
    3 | void dfs(int i){
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long b,n;int a,f=0;  cin>>a>>b>>n;
  //vector<int>c;
 for(int i=min(a,b);i<=n;i++){
    int g=floor((a*i)/b)-(a*floor(i/b));
   f=max(g,f);
  // c.push_back(g);
 }
 // sort(c.begin(),c.end());
   cout<<f<<endl; 
}


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

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

int main() {
    ll A, B, N;
    cin >> A >> B >> N;
    ll t = B * (N/B);
    ll ans=max((A*N/B)-A*(N/B), (A*t/B)-A*(t/B));
    ans = max(ans, A*(B-1)/B)
    cout << ans << endl;
}

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

#include <bits/stdc++.h>

using namespace std;
#define ll long long int 
int main()
{
    ll a,b,n;
    cin>>a>>b>>n;
    long long int  i,ans=0,max=0;
    
      
    
    for(i=n-1;i>=n-5*sqrt(n);--i)
      {
          ans=floor((a*i)/b)-a*floor(i/b);
          if(max<ans)
            max=ans;
      }
      
      cout<<max;
    }
     
     
     return 0;   
    
}

Compiler output:
a.cc:24:6: error: expected unqualified-id before 'return'
   24 |      return 0;
      |      ^~~~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

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

int a,b,n;
long long m,mm;
void cmp(int index,int m){
	if(m>mm){
		mm = max(m,mm);
	}
	if(index>n){
		return;
	}	
	m = floor(a*index/b) -a*floor(index/b);
//	cout<<m<<endl;
	cmp(index+1,m);
}
int main(){
	scanf("%d%d%d",&a,&b,&n);
	cmp(1,0);
	cout<<mm<<endl;
}

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

#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int A, B, N;
  cin>>A>>B>>N;

  auto calc=[&](Int x){return (A * x / B) - (A * (x/B));};

  Int ans = calc(N);
  if(B >= N) Max(ans, calc(B));

  cout<<ans<<endl;
  return 0;

  Int mx = -INF;
  for(Int i=0;i<=N;i++){
    Int a = A * i / B;
    Int b = A * (i / B);
    pr(a, b, a - b, i, A * i, i/B), mx = a - b;
  }



  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:35: error: expected primary-expression before ',' token
   64 |     pr(a, b, a - b, i, A * i, i/B), mx = a - 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 > 100000)
  {
  for(int64_t i = N-2A/B-1; i <= N;i++){
    int64_t x = A*i/B -A*(i/B);
    if(ans < x){
      ans = x;
    }
  }
  else
  {
  for(int64_t i = 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:10:21: error: unable to find numeric literal operator 'operator""A'
   10 |   for(int64_t i = N-2A/B-1; i <= N;i++){
      |                     ^~
a.cc:16:3: error: expected '}' before 'else'
   16 |   else
      |   ^~~~
a.cc:9:3: note: to match this '{'
    9 |   {
      |   ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	long long a, b, n;
	long long ma = 0;
	cin >> a >> b >> n;
	for (long long j = n; j >= n - 10000000; j--) {
		if (j < 0) {
			break;
		}
		if (ma < (a * j) / b - a * (j / b)) {
			ma = (a * j) / b - a * (j / b);
		}
	}
	for (long long j = 0; j < n - 10000000; j++) {
		if (j > n) {
			break;
		}
		if (ma < (a * j) / b - a * (j / b)) {
			ma = (a * j) / b - a * (j / b);
		}
	}
	if (ma<(a * (n / 2)) / b - a * ((n / 2) / b)) {
		ma = (a * (n / 2)) / b - a * ((n / 2) / b);
	}
	cout << ma << endl;
	return 0;
}
}

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

#include <iostream>
 
using namespace std;
 
int main(void) {
    int A,B,C,ans,max;
    cin >> A >> B >> N;
    for (int x=0;x<=N;x++){
        ans = int((A*x)/B)-A*int(x/B);
        if (max <= ans)
            max = ans;
        x ++;
    }
    printf("%d",max);
    return 0;
}

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

#include<stdio.h>

int main(void){
  
  int a;
  unsigned long long  b ,n;
  scanf("%d %lld %lld",&a,&b,&n);
 
  unsigned long long min =(b<n?b:n);
  
  for(int i = 2;i < min;i ++){
  while(b%i==0&&n%i==0){
    temp = b;
    b = temp/10;
    temp = n;
    n = temp/10;
  }
  }
  
  int max = 0;
  
  for(unsigned long long i = 0;i <= n;i++){
    int floor = (a*i/b)-a*(i/b);
    
    if(max<floor){
       max = floor;
    }
  }
  printf("%d",max);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:5: error: 'temp' undeclared (first use in this function)
   13 |     temp = b;
      |     ^~~~
main.c:13:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<bits/stdc++.h>
#include<vector>
#define fl(a,i,b) (floor((a*i)/b)-(a*floor(i/b))
using namespace std;
int main()
{
  long long a,b,n;int f=0;// its not working
  cin>>a>>b>>n;
  //vector<int>c;
 for(int i=1;i<=n;i++){
 //  int g=floor((a*i)/b)-(a*floor(i/b));
   f=max(fl(a,i,b),f);
  // c.push_back(g);
 }
 // sort(c.begin(),c.end());
   cout<<f<<endl; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:22: error: expected ')' before ';' token
   12 |    f=max(fl(a,i,b),f);
      |         ~            ^
      |                      )
Language: Java

import java.util.*;
class Main{
    static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        long A = sc.nextLong();
        long B = sc.nextLong();
        long N = sc.nextLong();
      	if(N<B)
        System.out.println(A-1);
      	else if(N%(a/b)!=0){
          long temp1=(A*N/B);
          long temp2=N/B;
          System.out.println(temp1-temp2);
        }
      	else{
          long temp1=(A*(N-1)/B);
          long temp2=(N-1)/B;
          System.out.println(temp1-temp2);
    }
}

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

#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
int bp(int pow, int n){
    int d = 1;
    while(n)
    {
        if(n%2==1)d=(d*pow)%mod;
        pow=(pow*pow)%mod;
        n/=2;
    }
    return d;
}
void solve(){
    long long double a, b, n;
    cin>>a>>b>>n;
    cout<<floor((a*n)/b)-a*floor(n/b);   
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:31:10: error: 'long long' specified with 'double'
   31 |     long long double a, b, n;
      |          ^~~~
a.cc:31:10: error: 'long long' specified with 'double'
a.cc:31:10: error: 'long long' specified with 'double'
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;

#define int long long

#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define rrep(i, n) for (int i=(int)n-1;i>=0;--i)
#define rrep1(i, n) for (int i=n;i>=1;--i)
#define range(i, l, r) for (int i=l;i<(int)r;++i)
#define rrange(i, l, r) for (int i=(int)r-1;i>=(int)l;--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}
constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}

int f(int a, int b)
{
	return a / b;
}

signed main()
{
	int A, B, N; cin >> A >> B >> N;
	int mx = 0;
	range(i, 0, 50*A) {
		if (N-i>=0)
			chmax(mx, f(A*(N-i),B)-A*f(N-i,B));
	}
	range(i, 0, 50*A) {
			chmax(mx, f(A*i),B)-A*f(i,B));
	}
	printf("%lld\n",mx);
}



Compiler output:
a.cc: In function 'int main()':
a.cc:56:36: error: too few arguments to function 'long long int f(long long int, long long int)'
   56 |                         chmax(mx, f(A*i),B)-A*f(i,B));
      |                                   ~^~~~~
a.cc:42:5: note: declared here
   42 | int f(int a, int b)
      |     ^
Language: C++


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a;
    long int b;
    long int k;
    cin>>a;
    cin>>b;
    cin>>k;
    long long n;
    long long int largenum=INT_MIN;
    for(long int i=0;i<=k;i++)
    {
           n=a*i;
           if(i<b)
           {
           largenum=max(largenum,(n/b);
           }
           else
           {
               largenum=max(largenum,(n/b)-(i/b)*a);
           }       
    }
    cout<<largenum<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:39: error: expected ')' before ';' token
   19 |            largenum=max(largenum,(n/b);
      |                        ~              ^
      |                                       )
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;

int32_t main() {
    FAST_IO;
    int a, b, n;
    cin >> a >> b >> n;
    int x = n;
    int x2 = n - 1;
    int a1 = max((floor((a * x) / b) - (a * floor(x / b))), (floor((a * x2) / b) - (a * floor(x2 / b))));
    int a2 = floor((a * x) / b) - (a * floor(x / b));
    int a3 = floor((a * (x2-1) / b) - (a * floor((x2-1) / b));
    cout << max(max(a2, a1), a3);
    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:31:62: error: expected ')' before ';' token
   31 |     int a3 = floor((a * (x2-1) / b) - (a * floor((x2-1) / b));
      |                   ~                                          ^
      |                                                              )
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: expected '}' before 'else'
   17 |     else if(D > ans) {
      |     ^~~~
a.cc:14:20: note: to match this '{'
   14 |     if(C % B == 0) {
      |                    ^
Language: C++

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

    int fb;

    ll cnt = n;
    for (ll i = n; i > 0; i--)
    {
        fb = i / b;

        if (fb < 1)
        {
            break;
        }
        cnt--;
    }

    cout << (cnt * a) / b - a * (cnt / b) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'll' was not declared in this scope
    3 |     ll a;
      |     ^~
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> a;
      |     ^~~
a.cc:4:12: error: 'a' was not declared in this scope
    4 |     cin >> a;
      |            ^
a.cc:5:7: error: expected ';' before 'b'
    5 |     ll b, n;
      |       ^~
      |       ;
a.cc:6:12: error: 'b' was not declared in this scope
    6 |     cin >> b >> n;
      |            ^
a.cc:6:17: error: 'n' was not declared in this scope
    6 |     cin >> b >> n;
      |                 ^
a.cc:10:7: error: expected ';' before 'cnt'
   10 |     ll cnt = n;
      |       ^~~~
      |       ;
a.cc:11:12: error: expected ';' before 'i'
   11 |     for (ll i = n; i > 0; i--)
      |            ^~
      |            ;
a.cc:11:20: error: 'i' was not declared in this scope
   11 |     for (ll i = n; i > 0; i--)
      |                    ^
a.cc:19:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   19 |         cnt--;
      |         ^~~
      |         int
a.cc:22:5: error: 'cout' was not declared in this scope
   22 |     cout << (cnt * a) / b - a * (cnt / b) << endl;
      |     ^~~~
a.cc:22:14: error: 'cnt' was not declared in this scope; did you mean 'int'?
   22 |     cout << (cnt * a) / b - a * (cnt / b) << endl;
      |              ^~~
      |              int
a.cc:22:46: error: 'endl' was not declared in this scope
   22 |     cout << (cnt * a) / b - a * (cnt / b) << endl;
      |                                              ^~~~
Language: C++

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


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

   ll a=B/N;

   if(a>0){
       cout << (A*N)/B-A*(N/B) << endl;
   } 
   else(a<=0){
       cout << (A*(B-1))/B << endl;
   }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: expected ';' before '{' token
   17 |    else(a<=0){
      |              ^
      |              ;
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: 'Bz' was not declared in this scope; did you mean 'B'?
   10 |     if(N > Bz){
      |            ^~
      |            B
Language: Java

import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	long a=sc.nextLong(),b=sc.nextLong(),n=sc.nextLong(),x=0,f=0;
  	if(b-1<=n){
  		if(n<100000){
  	for(long i=b-1;i<=n;i+=b-1){
  		x=(long)(a*i/b)-a*(long)(i/b);
  		f=Math.max(f,x);
  	}
  		}else{
  			for(long i=100000/b+b-1;i<=n;i+=b-1){
  		x=(long)(a*i/b)-a*(long)(i/b);
  		f=Math.max(f,x);
  	}
  		}
  	}
  	}else{
  		f=(long)(a*n/b)-a*(long)(n/b);
  	}
  	System.out.print(f);
  }
}

Compiler output:
Main.java:20: error: illegal start of type
  	}else{
  	 ^
Main.java:23: error: <identifier> expected
  	System.out.print(f);
  	                ^
Main.java:23: error: <identifier> expected
  	System.out.print(f);
  	                  ^
Main.java:25: error: class, interface, enum, or record expected
}
^
4 errors
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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

	if (b <= n) {
		n = b - 1;
	}
	cout << long long(a * n / b) << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: expected primary-expression before 'long'
   14 |         cout << long long(a * n / b) << endl;
      |                 ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
 
int main() {
  ULL A, B, N;
  cin >> A >> B >> N;
  ULL C = B - 1, ans = 0;
  if(B - 1 >= N) cout << (A * N) / B << endl;
  else {
  for(int i = 0; C * i <= N; i++) {
    if(N % B == 0) cout << (A * N) / B << endl
    int D = (A * C * i) / B - A * ((C * i) / B);
    if(C * i % B != 0) continue;
    else if(D > ans) {
      ans = D;
    }
  }
  cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:47: error: expected ';' before 'int'
   12 |     if(N % B == 0) cout << (A * N) / B << endl
      |                                               ^
      |                                               ;
   13 |     int D = (A * C * i) / B - A * ((C * i) / B);
      |     ~~~                                        
a.cc:15:13: error: 'D' was not declared in this scope
   15 |     else if(D > ans) {
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int so(int a,int b){
   while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}
int main(){
  int a,b,n;
  cin>>a>>b>>n;
  if(so(a,b)>1&&a*n>=b) cout<<a<<endl;
  else if(so(a,b)>1&&a*n<b) cout<<"0"<<endl;
  else if(so(a,b)==1&&n>b){
    int c=a-a/b;
    cout<<c<<emdl;
  }
  else if(so(a,b)==1&&n<=b){
    int d=a*n/b;
    cout<<d<<endl;
  }
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: 'emdl' was not declared in this scope
   18 |     cout<<c<<emdl;
      |              ^~~~
a.cc: At global scope:
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'll' was not declared in this scope
    6 |         ll a,b,n;
      |         ^~
a.cc:7:11: error: expected ';' before 'max_num'
    7 |         ll max_num = 0;
      |           ^~~~~~~~
      |           ;
a.cc:8:11: error: expected ';' before 'ans'
    8 |         ll ans;
      |           ^~~~
      |           ;
a.cc:9:14: error: 'a' was not declared in this scope
    9 |         cin>>a>>b>>n;
      |              ^
a.cc:9:17: error: 'b' was not declared in this scope
    9 |         cin>>a>>b>>n;
      |                 ^
a.cc:9:20: error: 'n' was not declared in this scope
    9 |         cin>>a>>b>>n;
      |                    ^
a.cc:10:15: error: expected ';' before 'i'
   10 |         for(ll i=1; i<= n;i++)
      |               ^~
      |               ;
a.cc:10:21: error: 'i' was not declared in this scope
   10 |         for(ll i=1; i<= n;i++)
      |                     ^
a.cc:12:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |                 ans = a*i/b - a*(i/b);
      |                 ^~~
      |                 abs
a.cc:13:27: error: 'max_num' was not declared in this scope
   13 |                 if( ans > max_num)
      |                           ^~~~~~~
a.cc:16:15: error: 'max_num' was not declared in this scope
   16 |         cout<<max_num;
      |               ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int so(int a,int b){
   while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}
int main(){
  int a,b,n;
  cin>>a>>b>>n;
  if(so(a,b)>1&&a*n>=b) cout<<a<<endl;
  else if(so(a,b)>1&&a*n<b) cout<<"0"<<endl;
  else if(so(a,b)==1&&n>b){
    int c=a-a/b
    cout<<c<<emdl;
  }
  else if(so(a,b)==1&&n<=b){
    int d=a*n/b;
    cout<<d<<endl;
  }
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: expected ',' or ';' before 'cout'
   18 |     cout<<c<<emdl;
      |     ^~~~
a.cc: At global scope:
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

long long gcd(int a, int b){
  if (a%b == 0){
    return(b);
  }
  else{
    return(gcd(b, a%b));
  }
}

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

  double C = (double)abs(A-B)/B;
  int maxn = floor(A*C) - A*floor(C),D;
  
  int i=abs(A-B);
  if(N>100000000){
    while(1){
      i++;
      C = (double)i/B;
      D = floor(A*C) - A*floor(C);
      if(maxn < D){
	maxn = D;
	long long j=i;
	if(j<i-10){
	  ans = maxn;
	  cout << ans << endl; 
	  return 0;
	}
      }
    }
  }
  double C = (double)1/B;
  int maxn = floor(A*C) - A*floor(C),D;

  else{
    for(int i=2;i<=N;i++){
      D = floor((double)A*(double)i/(double)B) - A*floor((double)i/(double)B);
      maxn = max(maxn,D);
    }
  }
  
  cout << maxn << endl;
  
}
 


Compiler output:
a.cc: In function 'int main()':
a.cc:57:10: error: redeclaration of 'double C'
   57 |   double C = (double)1/B;
      |          ^
a.cc:37:10: note: 'double C' previously declared here
   37 |   double C = (double)abs(A-B)/B;
      |          ^
a.cc:58:7: error: redeclaration of 'int maxn'
   58 |   int maxn = floor(A*C) - A*floor(C),D;
      |       ^~~~
a.cc:38:7: note: 'int maxn' previously declared here
   38 |   int maxn = floor(A*C) - A*floor(C),D;
      |       ^~~~
a.cc:58:38: error: redeclaration of 'int D'
   58 |   int maxn = floor(A*C) - A*floor(C),D;
      |                                      ^
a.cc:38:38: note: 'int D' previously declared here
   38 |   int maxn = floor(A*C) - A*floor(C),D;
      |                                      ^
a.cc:60:3: error: 'else' without a previous 'if'
   60 |   else{
      |   ^~~~
Language: C++

#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main()
{
  long long a,b,n,f=0;
  cin>>a>>b>>n;
  //vector<int>c;
 for(int i=1;i<=n;i++){
   int g=floor((a*i)/b)-(a*floor(i/b));
   f=max(g,f);
  // c.push_back(g);
 }
 // sort(c.begin(),c.end());
   cout<<f<<endl; 
}


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

#include <bits/stdc++.h>

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	ll a, b, n;
	cin >>a >>b >>n;
	if(n < 100000){
		ll ans = 0;
		rep2(i, 1, n+1){
			ll w = (i * a )/b - a * (i/b);
			ll w2 = (i * a +b-1)/b - a * ((i+b-1)/b);
			//ll w2 = (i * a )/(b*a) - (i/b);
			ans = max(ans, w);
			//printf("%lld:%lld ",w,w2);
		}
		cout << ans <<"\n";
		retunr 0;
	}
	ll w2 = (1 * a +b-1)/b - a * ((1+b-1)/b);
	
	cout << abs(w2) <<"\n";
	return 0;
}


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

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main(){
	long long a, b, n;
	long long ma = 0;
	cin >> a >> b >> n;
	for (long long j = n; j >= max(n - 1000000, long long(0)); j--) {
		if (ma < (a * j) / b - a * (j / b)) {
			ma = (a * j) / b - a * (j / b);
		}
	}
	if (ma < (a * 0) / b - a * (0 / b)) {
		ma = (a * 0) / b - a * (0 / b);
	}
	cout << ma << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:53: error: expected primary-expression before 'long'
   21 |         for (long long j = n; j >= max(n - 1000000, long long(0)); j--) {
      |                                                     ^~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    ll A,B,N;
    cin >> A >> B >> N;
    ll p1 = (A*N)/B;
    ll p2 = A*(N/B);
    cout << p1 - p2 << endl;
}

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

#include<iostream>
#define ll long long
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:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |         cin>>a>>b>>n;
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:16: error: 'min' was not declared in this scope; did you mean 'std::min'?
    8 |         ll kk= min(n, b-1);
      |                ^~~
      |                std::min
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:
/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)
      |     ^~~
a.cc:12:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   12 |         cout<<ans;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<stdio.h>
int main()
{
    long long a,b,n,i,r,max=0;
    scanf("%lld%lld%lld",&a,&b,&n);
    for(i=1;i<=n;i++){
        r=floor(a*i/b)-a*floor(i/b);
        if(r>max)
            max=r;
    }
    printf("%lld",r);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: 'floor' was not declared in this scope
    7 |         r=floor(a*i/b)-a*floor(i/b);
      |           ^~~~~
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

class Main {
    public static void main(final String[] args) throws Exception {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            List<String> inputString = Arrays.asList(br.readLine().split(" "));
            long A = Integer.parseInt(inputString.get(0));
            long B = Integer.parseInt(inputString.get(1));
            long N = Integer.parseInt(inputString.get(2));

            List<Integer> ansList = new ArrayList<>();
            for (long i = N; i >= 0; i--) {
                ansList.add((int)(Math.floor(A * i / B) - (A * Math.floor(i / B)));
            }

            sortNatualOrder(ansList);
            int ans = ansList.get(ansList.size() - 1);
            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }

    private static void sortNatualOrder(List<Integer> targetList) {
        for (int i = 0; i < targetList.size() - 1; i++) {
            for (int j = targetList.size() - 1; j > i ; j--) {
                if (targetList.get(j - 1) > targetList.get(j)) {
                    Integer tmp = targetList.get(j - 1);
                    targetList.set(j - 1, targetList.get(j));
                    targetList.set(j, tmp);
                }
            }
        }
    }
}

Compiler output:
Main.java:19: error: ')' or ',' expected
                ansList.add((int)(Math.floor(A * i / B) - (A * Math.floor(i / B)));
                                                                                  ^
1 error
Language: C

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

ll A, B;

ll func(ll x){
    return floor(A*x/B) - A * floor(x/B);
}

int main(){
    ll N; cin >> A >> B >> N;
    double ok = min(N+1, B);
    double ng = 0;
    for (int i = 0; i < 10000; i++)
    {
        double mid = (ng + ok)/2.;
        double mid1 = (ng * 2 + ok)/3;
        double mid2 = (ng + ok * 2)/3;
        if(func(mid1)>=func(mid2)) ok = mid;
        else ng = mid;
    }

    ll ans = 0;
    for (ll i = max(0LL, (ll)ok-10000000), M = min((ll)ok+10000000, N); i <= M; i++)
    {
        ans = max(ans, (ll)(A*i/B) - A * (ll)(i/B));
    }
    
    cout << ans  << endl;
}

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