criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.Scanner;
public class sum
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int a,b,n,i,val=0,max=0;
      a=sc.nextInt();
    b=sc.nextInt();
    n=sc.nextInt();
    for(i=1;i<=n;i++)
    {
      val=(a*i/b)-(a*(i/b));
      if(val>max)
      {
        max=val;
      }
      val=0;
    }
    System.out.println(max);
  }
}
    

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

#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
  int i;
  int K,A,B;
  long cnt = 0;
  scanf("%d", &K);
  scanf("%d %d", &A, &B);
  if (K == 1) {
    printf("OK\n");
    return 0;
  }
  if (A == B) {
    if ((A / K )*K == A) {
      printf("OK\n");
    } else {
      printf("NG\n");
    }
    return 0;
  }
    if(A%K == 0){
      int c = (A / K);
    }
    else{
    int c = (A / K) + 1;
    }
    int d = B / K;
    if (c <= d) {
      printf("OK\n");
    } else {
      printf("NG\n");
    }
    return 0;
  }


Compiler output:
main.c: In function 'main':
main.c:31:9: error: 'c' undeclared (first use in this function)
   31 |     if (c <= d) {
      |         ^
main.c:31:9: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.*;
public class sum
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int a,b,n,i,val=0,max=0;
      a=sc.nextInt();
    b=sc.nextInt();
    n=sc.nextInt();
    for(i=1;i<=n;i++)
    {
      val=(a*i/b)-(a*(i/b));
      if(val>max)
      {
        max=val;
      }
      val=0;
    }
    System.out.println(max);
  }
}
    

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

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


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

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

int main() {
  int32_t A,B,N,l;
  int32_t max = 0;
  cin >> A >> B >> N;
  l=0;
  for( int32_t i = B-1 ; i <= N ; i+=B){
    int32_t k;
    k = (A*i)/B - A*(l);
    if(N < i){
      break;
    }
    l++;
    if( k > max ){
      max = k;
    }
  }
  cout << max << 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 <bits/stdc++.h>
using namespace std;
int main(){
    long long A,B,N;
    cin>>A>>B>>N;
    long long counter=0;
    counter=((A*N)/B)-A*(N/B);
    long long i=N;
    for(i; i>0;i--){
    if(i%B==0){
    i--;
    break;}
    }
    counter=max(counter,((A*i)/B)-A*(i/B));
    }
    cout<<counter<<endl;
    
  return 0;
    }

    


Compiler output:
a.cc:16:5: error: 'cout' does not name a type
   16 |     cout<<counter<<endl;
      |     ^~~~
a.cc:18:3: error: expected unqualified-id before 'return'
   18 |   return 0;
      |   ^~~~~~
a.cc:19:5: error: expected declaration before '}' token
   19 |     }
      |     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repX(i, n, x) for (int i = x; i < (int)(n); i++)
#define repBack(i, n) for (int i = n; i >= 0; i--)
#define dup(x, y) (((x) + (y)-1) / (y))

//TLE
//全て見てるはずだよ
int main()
{
    ll A, B, N;
    cin >> A >> B >> N;
    ll ans = -1223372036854775807;
    repBack(x, N)
    {
        ll now = floor((A * x / B) - A * floor(x / B);
        ans = max(ans, now);
    }
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:54: error: expected ')' before ';' token
   20 |         ll now = floor((A * x / B) - A * floor(x / B);
      |                       ~                              ^
      |                                                      )
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
typedef long long ll;
typedef long double ld;
#define M(x,y) ((x)>(y)?(x):(y))
#define m(x,y) ((x)<(y)?(x):(y))

int main() {
	ll a,b,n,ans=0;
	scanf("%lld %lld %lld", &a,&b,&n);
	
	Rep(i,1,a+1) {
		ll x=floorl(i*b/a);
		if (x > n) break;
		ans = M(ans,floorl(a*(x%b)/b));
		ll x = floorl(1+i * b / a);
		if (x > n) break;
		ans = M(ans, floorl(a * (x % b) / b));
	}
	ans = M(ans, floorl(a*(n % b)/b));
	ll Ans = ans;
	printf("%lld", Ans);
}

Compiler output:
main.c: In function 'main':
main.c:20:20: error: redefinition of 'x'
   20 |                 ll x = floorl(1+i * b / a);
      |                    ^
main.c:17:20: note: previous definition of 'x' with type 'll' {aka 'long long int'}
   17 |                 ll x=floorl(i*b/a);
      |                    ^
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{
    if(a<b){
    cout<<a-1;
    
  
  }
  

}

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

#include<iostream>
#include int long long int
#include<cmath>
using namespace std;
 
int32_t main(){
  int a,b,n;
  cin>>a>>b>>n;
   int x=min(b-1,n);
   int r=floor((a*x)/b);
    cout<<r<<endl;
    return 0;
}

Compiler output:
a.cc:2:10: error: #include expects "FILENAME" or <FILENAME>
    2 | #include int long long int
      |          ^~~
Language: C++

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int long long  i = 0; i < (int long long)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  intll a , b , n ; 
  cin >> a >> b >> n ;
  intll ans = 0 ;
  
  if(b <= 1000000){
    for(int i=0; i<1000000 && i<=n ; i++){
      intll k = floor(a*i/b) - a*floor(i/b) ;
      ans = max(ans, k);
    }
  }
  
  else {
    ans = floor(a*n/b) - a*floor(n/b)
    for(int i=0; i<=1000000 && b*i <= n; i++){
      intll k =  floor(a*i*b/b) - a*floor(i*b/b);
      ans = max(ans,k);
    }
  }
                
                
  
  cout << ans ;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:38: error: expected ';' before 'for'
   23 |     ans = floor(a*n/b) - a*floor(n/b)
      |                                      ^
      |                                      ;
   24 |     for(int i=0; i<=1000000 && b*i <= n; i++){
      |     ~~~                               
a.cc:24:18: error: 'i' was not declared in this scope
   24 |     for(int i=0; i<=1000000 && b*i <= n; i++){
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int a;
  long long b,n;
  cin >> a >> b >> n;
  long long ans =0;
  if(a == b){
    cout << x << endl;
    return 0;
  }
  
  for(long long i=n-100000000;i<=n;i++){
  long long left=0,right=0;
  left = a*i/b;
  right = i/b;
  ans = max(left - a*right,ans);
  }
  cout << ans << endl; 
}

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

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

int main(){
    long int a, b, n;
    cin >> a >> b >> n;
    long int c=floor(a*n/b);
    lonf int d=c+2;
    long int f[c];
    long int max=0;
    for(long int i=0; i<=d; i++){
        f[i]=i-floor(i/a);
        if(max-f[i]<=0){
            max=f[i];
        }
        else{}
    }
    cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'lonf' was not declared in this scope; did you mean 'long'?
    8 |     lonf int d=c+2;
      |     ^~~~
      |     long
a.cc:11:26: error: 'd' was not declared in this scope
   11 |     for(long int i=0; i<=d; i++){
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const ll dy[4] = {1, 0, -1, 0};
const ll dx[4] = {0, 1, 0, -1};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, n;
	cin >> a >> b >> n;
	ll l = -1, r = n;
	while (r - l > 2) {
		ll c1 = (2 * l + r) / 3, c2 = (l + 2 * r) / 3;
		if (a * c1 / b - c1 / b * a > a * c2 / b + c2 / b * a)
			r = c2;
		else
			l = c1;
	}
	ll ans = 1e12;
	ans = max(ans, a * r / b - r / b * a);
	ans = max(ans, a * (r - 1) / b - (r - 1) / b * a) cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:58: error: expected ';' before 'cout'
   34 |         ans = max(ans, a * (r - 1) / b - (r - 1) / b * a) cout << ans << endl;
      |                                                          ^~~~~
      |                                                          ;
Language: C

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

int main() {
  int32_t A,B,N,l;
  int32_t max = 0;
  cin >> A >> B >> N;
  l=0;
  for( int32_t i = B-1 ; i <= N ; i+=B){
    int32_t k;
    k = (A*i)/B - A*(l);
    if(N < i){
      break;
    }
    l++;
    if( k > max ){
      max = k;
    }
  }
  cout << max << 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: Java

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

Compiler output:
Main.java:12: error: incompatible types: possible lossy conversion from long to int
      int x = b-1;
               ^
1 error
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include <bitset>
using namespace std;
const int mod=1e9+7;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,x,n) for(int i= x;i<n;i++)
#define all(v) v.begin(), v.end()
#define nepe(v) next_permutation(all(v))
#define F first 
#define S second
#define PB push_back 
#define MP make_pair
using ll = long long;
using vi = vector<int>; 
using vvi = vector<vi>;
using vl=vector<long long>;
using vp =vector<pair<int,int>>;

typedef pair<int,int> P;
string s;
int k; 
ll INF = 10000000000000000;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:43:9: error: expected ',' or ';' before 'cout'
   43 |         cout <<floor(k)<<endl;;
      |         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,n;
    cin>>a>>b>>n;
    float max=INT_MIN;
    for(int x=0;x<=n;x++){
        (float)value=floor((float)(a*x)/(float)b)-(float)(a*floor(x/b));
        if(value>max){
         max=value;
        }
    }
    cout<<(int)max<<endl;
    
    
    return 0;
}

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

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
 
using namespace std;
 
int main(void) {
 
  long long a,b, n;
  cin >> a >> b >> n;
  long long ans = 0;
  
  if (a == 1) {
  	cout << 0 << endl;
  } else {
    
    double z = n/b;
    
    if (n >= b) {
      double y = (n/b*10);
      long long Y = y % 10;
      y = a/10;
      ans = y*n;
    } else {
      double z = n/b;
      ans = a*z;
    }
  
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:23: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   22 |       long long Y = y % 10;
      |                     ~ ^ ~~
      |                     |   |
      |                     |   int
      |                     double
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a,b,n;
  if(n < b) cout << (a*n)/b;
  else (n>=2*b) cout << a;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:16: error: expected ';' before 'cout'
    6 |   else (n>=2*b) cout << a;
      |                ^~~~~
      |                ;
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() {
  ios::sync_with_stdio(false);
  cin.tie(0);

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

  ll ans = 0;

  for(ll i = min(ll(sqrt(n)*100000), n) i <= n; ++i) {
    ll y = (a*n/b) - (a*(n/b));
    ans = max(ans, y);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:40: error: expected ';' before 'i'
   18 |   for(ll i = min(ll(sqrt(n)*100000), n) i <= n; ++i) {
      |                                        ^~
      |                                        ;
Language: C++

#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define ull unsigned long long int
#define forn(i,n)for(ll i=0;i<(n);i++)
#define forn_rev(i,n)for(ll i=(n)-1;i>=0;i--)
#define for1n(i,n) for(ll i=1;i<=(n);i++)
#define ARRAY_SIZE(a) sizeof(a)/sizeof(*a)
#define MOD 1000000007
#define MAXN 1000005

using namespace std;

long double cal(ld A,ld B,long double x){
    return (floor(A*x/B) - (A*floor(x/B)));

}

ll findval(long double A,long double B,long double N){
    ll low=cal(A,B,N,0),high=cal(A,B,N,N),l=0,h=N,m,mid;
    if(high<low) swap(high,low);
    while(low<high){
        m=(h+l)/2;
        mid=cal(A,B,N,m);
        if(mid<high){
            low=mid;
            l=m;
        }
        else if(mid<low){
            high=mid;
            h=m-1;
        }
        else break;



    }
    return mid;


}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    ll T=1;
    //cin>>T;
    while(T--)
    {
        long double A,B,N;
        cin>>A>>B>>N;
        cout<<findval(A,B,N);











    }



    return 0;
}






Compiler output:
a.cc: In function 'long long int findval(long double, long double, long double)':
a.cc:20:15: error: too many arguments to function 'long double cal(long double, long double, long double)'
   20 |     ll low=cal(A,B,N,0),high=cal(A,B,N,N),l=0,h=N,m,mid;
      |            ~~~^~~~~~~~~
a.cc:14:13: note: declared here
   14 | long double cal(ld A,ld B,long double x){
      |             ^~~
a.cc:20:33: error: too many arguments to function 'long double cal(long double, long double, long double)'
   20 |     ll low=cal(A,B,N,0),high=cal(A,B,N,N),l=0,h=N,m,mid;
      |                              ~~~^~~~~~~~~
a.cc:14:13: note: declared here
   14 | long double cal(ld A,ld B,long double x){
      |             ^~~
a.cc:24:16: error: too many arguments to function 'long double cal(long double, long double, long double)'
   24 |         mid=cal(A,B,N,m);
      |             ~~~^~~~~~~~~
a.cc:14:13: note: declared here
   14 | long double cal(ld A,ld B,long double x){
      |             ^~~
Language: C++

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

typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll a,b,n;
    cin >> a >> b >> n;
    ll ans = (a*n)/b-a*(n/b);
    if(n-1>=0){
        ll ans1 = (a*(n-1))/b-a*((n-1)/b);
        ans = max(ans,ans1);
    }
    if(n-2>=0){
        ll ans2 = (a*(n-2))/b-a*((n-2)/b);
        ans = max(ans,ans2);
    }
    if(n-3>=0){
        ll ans3 = (a*(n-3))/b-a*((n-3)/b);
        ans = max(ans,ans3);
    }
    if(b<=n){
        ll ans4 = (a*b)/b-a*(b/b);
        ans = max(ans,ans4);
    }
    ll ans5 = (a*1)/b -a*(1/b);
    ans = max(ans,ans5);
    if(2<=n){
        ll ans6 = (a*2)/b-a*(2/b);
        ans = max(ans,ans6);
    }
    if(3<=n){
        ll ans7 = (a*3)/b-a*(3/b);
        ans = max(ans,ans7);
    }
    ll ans = (a*n)/b;
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:8: error: redeclaration of 'll ans'
   39 |     ll ans = (a*n)/b;
      |        ^~~
a.cc:12:8: note: 'll ans' previously declared here
   12 |     ll ans = (a*n)/b-a*(n/b);
      |        ^~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ld long double
#define set setprecision　//小数点以下何位まで知りたいか
#define mod 1000000007
#define pi 3.14159265
#include<numeric>
using namespace std;
int gcd(int a, int b)//最大公約数
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
int lcm(int a, int b)//最小公倍数
{
	return a * b / gcd(a, b);
}
ll pow(ll a, ll b) {
	ll k = b % 30000, h = b / 30000, s = 1;
	rip(i, 30000)s = (s * a) % mod; ll j = 1;
	if (h != 0)rip(i, h)j = j * s % mod;
	if (k != 0)rip(i, k)j = j * a % mod;;
	return(j);
}
int main(){
	ll a, b, n;
cin >> a >> b >> n;
if (n / b > 100000000) {
	ll p = n / b;
	cout << ((floor(a * n / b)) - a * (floor(n / b)))
}
else {
	ll k = n / b;
	ll s;
	ll maxx = 0;
	for (int i = 0; i <= k; i++) {
		s = (i + 1) * b - 1;
		if (i == k)s = n;
		if (maxx < ((floor(a * s / b)) - a * (floor(s / b)))) {
			maxx = ((floor(a * s / b)) - a * (floor(s / b)));
		}
	}
	cout << maxx << endl;
}
}


Compiler output:
a.cc:11:13: error: extended character 　 is not valid in an identifier
   11 | #define set setprecision　//小数点以下何位まで知りたいか
      |             ^
a.cc: In function 'int main()':
a.cc:37:58: error: expected ';' before '}' token
   37 |         cout << ((floor(a * n / b)) - a * (floor(n / b)))
      |                                                          ^
      |                                                          ;
   38 | }
      | ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long A,B,N,maxi=0;
    
    cin >> A >> B >> N;
    
    long long a[N],aaa;
    
    for(long long i=0;i<=N;i++){
        a[i] = (A*i/B)-A*(i/B);
    }
    aaa = *std::max_element(a.begin(),a.end());
    
    cout << aaa << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:31: error: request for member 'begin' in 'a', which is of non-class type 'long long int [N]'
   13 |     aaa = *std::max_element(a.begin(),a.end());
      |                               ^~~~~
a.cc:13:41: error: request for member 'end' in 'a', which is of non-class type 'long long int [N]'
   13 |     aaa = *std::max_element(a.begin(),a.end());
      |                                         ^~~
Language: C

#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;

const double pi=3.1415;
ll f(ll a,ll b,ll x){return ll(a*x/b)-a*(ll(x/b));}
int main()
{
   ll a,b,n,maxi=-100100100,k=0;
   cin>>a>>b>>n;
   ll x =sqrt(n);
   bool flag=false;
   if(f(a,b,x)>f(a,b,x+1)){
   		flag=false;
   	}else flag=true;
   while(true)
   {
   	if(flag==false&&f(a,b,x)>f(a,b,x-1)){x=sqrt(n);k++;flag=true;}
   	else if(flag==true&&f(a,b,x)>f(a,b,x+1)){x=sqrt(n);flag=false;k++;}
   	else if(x>=n||x<0){x=sqrt(n);flag=false;k++;}
   	if(flag)x++;
   	else x--;
   	if(maxi<f(a,b,x))
   	{
   		maxi=f(a,b,x);
   	}
   	if(k==2)break;
   }
   cout<<maxi;
}


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

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class D {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final long a = in.nextLong();
        final long b = in.nextLong();
        final long n = in.nextLong();
        in.nextLine();
        long lo = 1;
        long hi = n;
//        while (lo < hi) {
//            long mid = lo + hi >>> 1;
//            long f = f(a, mid, b);
//            long f1 = f(a, mid + 1, b);
//            if (f <= f1) {
//                lo = mid + 1;
//            } else {
//                hi = mid;
//            }
//        }
        System.out.println(f(a, Math.min(n, b-1), b));
    }

    private static long f(long a, long mid, long b) {
        return Math.floorDiv(a * mid, b) - a * Math.floorDiv(mid, b);
    }
}


Compiler output:
Main.java:5: error: class D is public, should be declared in a file named D.java
public final class D {
             ^
1 error
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*B)%A)==0){
            long temp1=(A*N/B);
            long temp2=N/B;
            System.out.println(temp1-temp2-1);
        }
        else{
            long temp1=(A*N/B);
            long temp2=N/B;
            System.out.println(temp1-temp2);
        }
    }
}

Compiler output:
Main.java:10: error: illegal start of expression
        else if((N*B)%A)==0){
                        ^
Main.java:10: error: ';' expected
        else if((N*B)%A)==0){
                           ^
Main.java:15: error: 'else' without 'if'
        else{
        ^
3 errors
Language: C++

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

int main() {
    long long A, B, N;
    cin >> A >> B >> N;
    long long ans = 0;
    for (long long i = 0; i < N+1; i++) {
        if ((i % B) = 0) {
            continue;
        }
        
        long long ag = ((A*i)/B) - A*(i/B);
        ans = max(ans, ag);
    }
    cout << ans << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: lvalue required as left operand of assignment
    9 |         if ((i % B) = 0) {
      |             ~~~^~~~
Language: C

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

int main(){
    long int a,b,n,max;
    long int x,y,m = 0, n = 0;
    int cnt = 0;

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

    for(long int i = n; i > 0; i--){
        x = a * i / b - a * (i / b);
    
        if(x >= 0 && x >= m){
            m = x;
            cnt++;
            if(cnt >= 100) break;
        }
    }

    for(int j = 0; j <= n; j++){
        y = a * j / b - a * (j / b);

        if(y >= 0 && x >= n){
            n = y;
            cnt++;
            if(cnt >= 100)break;
        }
    }

    max = fmax(m,n);
    
    printf("%ld", max);

}

Compiler output:
main.c: In function 'main':
main.c:6:25: error: redeclaration of 'n' with no linkage
    6 |     long int x,y,m = 0, n = 0;
      |                         ^
main.c:5:18: note: previous declaration of 'n' with type 'long int'
    5 |     long int a,b,n,max;
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long A,B,N,maxi=0;
    
    cin >> A >> B >> N;
    
    long long a[N];
    
    for(long long i=0;i<=N;i++){
        a[i] = (A*i/B)-A*(i/B);
    }
    
    cout << max(a.begin(),a.end()) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: request for member 'begin' in 'a', which is of non-class type 'long long int [N]'
   14 |     cout << max(a.begin(),a.end()) << endl;
      |                   ^~~~~
a.cc:14:29: error: request for member 'end' in 'a', which is of non-class type 'long long int [N]'
   14 |     cout << max(a.begin(),a.end()) << endl;
      |                             ^~~
Language: Java

import java.util.*;
public class Main{
  public stati 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){
      System.out.println(n);
    }
    else{
      System.out.println(n-1);
    }
  }
}

Compiler output:
Main.java:3: error: <identifier> expected
  public stati void main(String[] args){
              ^
1 error
Language: C++

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

int main() {
  long a,b,n;
  cin >>a>>b>>n;
  long www=0;
  for(long i=1;i <= n;i++){
    long result = floor(a*i/b)-a*floor(i/b)
    www = max(result,www);
  }
  cout << www << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: expected ',' or ';' before 'www'
   10 |     www = max(result,www);
      |     ^~~
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:21: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   10 |   else cout<<(A*N-(A%B)*(N%B))/B;
      |                    ~^~
      |                    | |
      |                    | double
      |                    double
a.cc:10:27: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   10 |   else cout<<(A*N-(A%B)*(N%B))/B;
      |                          ~^~
      |                          | |
      |                          | double
      |                          double
Language: C++

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

 
int main() {

    ll a,b,n;
    cin >> a >> b >> n;
    ll ans = 0;
    if(n%b == 0)    n--;
    ans = max(ans,((a*n)/b)-a*(n/b));
    for(int i =1;i<=n;i++) {
        ans = max(ans,((a*i)/b)-a*(i/b))
        if(i>1000000)   break;
    }
    
    cout<<ans<<endl;

 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:41: error: expected ';' before 'if'
   19 |         ans = max(ans,((a*i)/b)-a*(i/b))
      |                                         ^
      |                                         ;
   20 |         if(i>1000000)   break;
      |         ~~
Language: C

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

int main()
{
    double a,b,n;
    cin >> a >> b >>n;
    cout<<floorf(a * (n) / b)-floorf((n)/b);
    return 0;
}


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<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&&n>=b/so(a,b)) cout<<a<<endl;
  else if(so(a,b)>1&&n<b/so(a,b)) {
    int y=a*n/b;
    cout<<y<<endl;
  else if(so(a,b)==1&&n>b){
    cout<<a-1<<endl;  
  }
  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:3: error: expected '}' before 'else'
   18 |   else if(so(a,b)==1&&n>b){
      |   ^~~~
a.cc:15:35: note: to match this '{'
   15 |   else if(so(a,b)>1&&n<b/so(a,b)) {
      |                                   ^
Language: C++

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

int main() {
  long a,b,n;
  cin >>a>>b>>n;
  long www=0;
  for(long i=1;i <= n;i++){
    int aaa = floor(a*i/b)-a*floor(i/b)
    www = max(aaa,www)
  }
  cout << www << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: expected ',' or ';' before 'www'
   10 |     www = max(aaa,www)
      |     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
  
int main(){
  int a,b,n;
  int f1,f2;
  int now;
  int ans = 0;
  cin >> a >> b >> n;
  for(int x = 1;x <= N;x++){
    double t = a*x/b
    f1 = int(floor(t));
    t = x/b;
    f2 = int(floor(t));
    now = f1 - a*f2;
    ans = max(ans,now);
  }
  cout << ans << endl;
  return 0;
}
    
    
    
      
  

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: 'N' was not declared in this scope
   10 |   for(int x = 1;x <= N;x++){
      |                      ^
a.cc:12:5: error: expected ',' or ';' before 'f1'
   12 |     f1 = int(floor(t));
      |     ^~
Language: C++

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



  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:71: error: expected ')' before ';' token
   15 |   else if(B <= N) { cout << max(s / B - A * (N / B) ,max(ans, (A - 1)); return 0; }
      |                                ~                                      ^
      |                                                                       )
Language: C++

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

int main(){
    ll a,b,n;cin>>a>>b>>n;
    ll left=0;
    ll right=0;
    ll max = 0;
    for(ll i = n; i > 0 ; i--){
        left = a*i/b;
        tmp  = i/b;
        right = a*tmp;
        if(left-right > max){
            max = left-right;
            break;
        }
    }
    cout << max << endl;
    return 0;
}

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

#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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;
}

//想定解答との絶対誤差または相対誤差が 10−6以下の場合+1以上だしておく。適当に15とかでもおｋ．
//cout << fixed << setprecision(15);

int main() {
    string s;
    ll A, B, N;
    cin >> A >> B >> N;
    ll mx = -1;
    count = 0;
    rep(i, 1, N+1) {
        ll temp = float(A*i/B) - float(A*(i/B));
        mx = max(mx, temp);
        count += 1;
        if (count == 1000000000) {
            break;
        }
    }
    cout << mx << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:13: error: overloaded function with no contextual type information
   67 |     count = 0;
      |             ^
a.cc:71:18: error: overloaded function with no contextual type information
   71 |         count += 1;
      |                  ^
a.cc:72:19: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator=='
   72 |         if (count == 1000000000) {
      |             ~~~~~~^~~~~~~~~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:26: error: expected '}' at end of input
    5 |            cout<<x<<endl;
      |                          ^
a.cc:3:11: note: to match this '{'
    3 | int main(){long long A,B,N,x;cin>>A>>B>>N;
      |           ^
Language: C++

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

int main(){
    ll a,b,n;cin>>a>>b>>n;
    ll left=0;
    ll right=0;                                                                  ll max = 0;
    for(ll i = n; i > 0 ; i--){                                                      left = a*i/b;                                                                tmp  = i/b;                                                                  right = a*tmp;                                                               if(left-right > max){
            max = left-right;
            break;
        }
    }
    cout << max << endl;
    return 0;                                                                }

Compiler output:
a.cc: In function 'int main()':
a.cc:10:163: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   10 |     for(ll i = n; i > 0 ; i--){                                                      left = a*i/b;                                                                tmp  = i/b;                                                                  right = a*tmp;                                                               if(left-right > max){
      |                                                                                                                                                                   ^~~
      |                                                                                                                                                                   tm
Language: C++

> Executing task: cd /Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d && rm -f /Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d/main && g++ -std=c++11 main.cpp -o main && oj test -c "/Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d/main" -d /Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d/tests/ <

[!] update available: 9.0.0 -> 9.2.2
[*] run: $ pip3 install -U online-judge-tools
[*] see: https://github.com/kmyk/online-judge-tools/blob/master/CHANGELOG.md
[*] 2 cases found
time: illegal option -- f
usage: time [-lp] command.
[!] GNU time is not available: time

[*] sample-1
[x] time: 0.066091 sec
[+] AC

[*] sample-2
[x] time: 0.006388 sec
[+] AC

[x] slowest: 0.066091 sec  (for sample-1)
[+] test success: 2 cases

Terminal will be reused by tasks, press any key to close it.

> Executing task: clang++ -std=c++14 -stdlib=libc++ -x c++ -Wall /Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d/main.cpp -o /Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d/main --debug <


Terminal will be reused by tasks, press any key to close it.

> Executing task: cd /Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d && rm -f /Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d/main && g++ -std=c++11 main.cpp -o main && oj test -c "/Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d/main" -d /Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d/tests/ <

[!] update available: 9.0.0 -> 9.2.2
[*] run: $ pip3 install -U online-judge-tools
[*] see: https://github.com/kmyk/online-judge-tools/blob/master/CHANGELOG.md
[*] 2 cases found
time: illegal option -- f
usage: time [-lp] command.
[!] GNU time is not available: time

[*] sample-1
[x] time: 0.196797 sec
[+] AC

[*] sample-2
[x] time: 0.006307 sec
[+] AC

[x] slowest: 0.196797 sec  (for sample-1)
[+] test success: 2 cases

Terminal will be reused by tasks, press any key to close it.


Compiler output:
a.cc:3:23: error: too many decimal points in number
    3 | [!] update available: 9.0.0 -> 9.2.2
      |                       ^~~~~
a.cc:3:32: error: too many decimal points in number
    3 | [!] update available: 9.0.0 -> 9.2.2
      |                                ^~~~~
a.cc:31:23: error: too many decimal points in number
   31 | [!] update available: 9.0.0 -> 9.2.2
      |                       ^~~~~
a.cc:31:32: error: too many decimal points in number
   31 | [!] update available: 9.0.0 -> 9.2.2
      |                                ^~~~~
a.cc:1:1: error: expected unqualified-id before '>' token
    1 | > Executing task: cd /Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d && rm -f /Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d/main && g++ -std=c++11 main.cpp -o main && oj test -c "/Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d/main" -d /Users/stomita/algorithmstudy/atcoder/Bigginer/abc165/d/tests/ <
      | ^
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 = sc.nextInt();
    long b = sc.nextLong();
    long n = sc.nextLong();
    long maxNumber = 0;
    for (long x = 1; x <= n; x++) {
      if (a * x <= b) {
        continue;
      }
      long fx = (long) (a * x / b) - a * (long) (x / b);
      if (fx > maxNumber) {
        maxNumber = fx;
      }
      if ((long) x / b >= 1)
        return;
    }
    System.out.println(maxNumber);
  }

}

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();
  }

  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());
  }


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

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

Compiler output:
a.cc:6:10: error: extended character 　 is not valid in an identifier
    6 |   if(n<b)　m=(a*n)/b;
      |          ^
a.cc: In function 'int main()':
a.cc:6:10: error: '\U00003000m' was not declared in this scope
    6 |   if(n<b)　m=(a*n)/b;
      |          ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    long long A,B,N;
    cin>>A>>B>>N;
    long long counter=0;
    counter=((A*N)/B)-A*(N/B);
    for(long long i=N-1 i>N/2;i--){
    counter=max(counter,((A*i)/B)-A*(i/B));
    }
    cout<<counter<<endl;
    
  return 0;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:8:24: error: expected ';' before 'i'
    8 |     for(long long i=N-1 i>N/2;i--){
      |                        ^~
      |                        ;
Language: C++

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

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


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

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

Compiler output:
main.c: In function 'main':
main.c:6:7: error: array size missing in 'c'
    6 |   int c[];
      |       ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:11: error: 'ba' was not declared in this scope; did you mean 'b'?
   15 |     if(a!=ba||b!=bb){
      |           ^~
      |           b
a.cc:15:18: error: 'bb' was not declared in this scope; did you mean 'b'?
   15 |     if(a!=ba||b!=bb){
      |                  ^~
      |                  b
Language: C++

#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    ll a,b,n;
    cin >> a >> b >> n;
    if(b<=n){
        cout<<(b-1)*a/b<<endl;
    }else{
        
        cout << n*a/b<<endl;
    }
  return 0;
}

Compiler output:
a.cc:4:9: error: 'pair' does not name a type
    4 | typedef pair <int,int> P;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     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 | #define MOD 1000000007
a.cc:9:9: error: 'cout' was not declared in this scope
    9 |         cout<<(b-1)*a/b<<endl;
      |         ^~~~
a.cc:9:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:9:26: error: 'endl' was not declared in this scope
    9 |         cout<<(b-1)*a/b<<endl;
      |                          ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define MOD 1000000007
a.cc:12:9: error: 'cout' was not declared in this scope
   12 |         cout << n*a/b<<endl;
      |         ^~~~
a.cc:12:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:12:24: error: 'endl' was not declared in this scope
   12 |         cout << n*a/b<<endl;
      |                        ^~~~
a.cc:12:24: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

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

int main(){
  int a, b, n;
  cin >> a >> b >> n;
  p = min(n,b)
  if(p % b == 0)
      cout << a*(p-1)/b << "\n";
  else
      cout << a*(p)/b << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'p' was not declared in this scope
    8 |   p = min(n,b)
      |   ^
a.cc:11:3: error: 'else' without a previous 'if'
   11 |   else
      |   ^~~~
Language: C++

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

long long int f(long long int a,long long int b,long long int n)
{
    long long int r = n%b;
    return a*r/b;
}

int main(){
    long long int a,b,n;
    cin >> a >> b >> n;
    long long int q = n/b;
    long long int r = n%q;
    long long int ans=0;
    if(n%b==0){
        ans = max(f(a,b,n-1),f(a,b,n/2));
    else{
        ans = f(a,b,n);
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: expected '}' before 'else'
   18 |     else{
      |     ^~~~
a.cc:16:15: note: to match this '{'
   16 |     if(n%b==0){
      |               ^
Language: C++

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

int main() {
  int long long a,b,n;
  cin>>a>>b>>n;
  int bk=(a*n)/b;
  int ck=a*(n/b);
   int na=bk-ck;
  for(int i=n-1;i>n-b;i--){
  int sb=(a*i)/b;
  int sc=a*(i/b));
   int sa=sb-sc;
  if(sa>=na){
    na=sa;
  }
  else{
   break;
  }
  }
  cout<<na<<endl;
}
 


Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: expected ',' or ';' before ')' token
   12 |   int sc=a*(i/b));
      |                 ^
Language: C++


int main(){
  int a, b, n;
  cin >> a >> b >> n;
  p = min(n,b)
  if(p % b == 0)
      cout << a*(p-1)/b << "\n";
  else
      cout << a*(p)/b << "\n";
}

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:5:3: error: 'p' was not declared in this scope
    5 |   p = min(n,b)
      |   ^
a.cc:5:7: error: 'min' was not declared in this scope; did you mean 'main'?
    5 |   p = min(n,b)
      |       ^~~
      |       main
a.cc:8:3: error: 'else' without a previous 'if'
    8 |   else
      |   ^~~~
a.cc:9:7: error: 'cout' was not declared in this scope
    9 |       cout << a*(p)/b << "\n";
      |       ^~~~
Language: C++

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

int main() {
    ll A, B, N, max = 0, x, y, ans;
    cin >> A >> B >> N;



    if(N < 1000000){
        REP(i, N + 1){
            y = i;
            ans = (A * y / B) - (A * (y / B));
            if(ans >= max) {
                max = ans;
            }
        }
    } else {

    REP(i, 1000000000000000000){
        x = B * pow(10, i);
        y = x - 1;

        if(y > N){
            break;
        }

        ans = (A * y / B) - (A * (y / B));

        if(ans >= max){
            max = ans;
        }
    }


    cout << max << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:2: error: expected '}' at end of input
   40 | }
      |  ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^