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

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

int main()
{
    long long int x,k,x3=0,x4=0;
    cin>>x>>k;
    cout<<min(x%k,abs((x%k)-k)))<<endl;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlcude; did you mean #include?
    1 | #inlcude<iostream>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin>>x>>k;
      |     ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<math.h>
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:10:5: error: 'cout' was not declared in this scope
   10 |     cout<<min(x%k,abs((x%k)-k)))<<endl;
      |     ^~~~
a.cc:10:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	unsigned long long int n, k;
	cin >> n >> k;
	cout << min(n%k, abs(k-n%k)) << "\n";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: call of overloaded 'abs(long long unsigned int)' is ambiguous
   10 |         cout << min(n%k, abs(k-n%k)) << "\n";
      |                          ~~~^~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
Language: Java

import java.math.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
            long tmp = 0;
            if (n > k)
                tmp = Math.abs(n % k);
            else
                tmp = Math.abs(n - k);
            if (tmp < n) {
                n = tmp;
            } else {
                break;
            }
        
        System.out.println(n);
    }
}


Compiler output:
Main.java:18: error: break outside switch or loop
                break;
                ^
1 error
Language: C

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

int main()
{
	long long N = 0;
    long long K = 0;
	scanf("%lld %lld", &N, &K);

    N %= K;

        if(abs(N - K) >= N){
            break;
        }
        N = abs(N - K);


    printf("%lld", N);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:13: error: break statement not within loop or switch
   13 |             break;
      |             ^~~~~
Language: C++

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++ )

int main(void){
    unsigned long long N = 0, K = 0;
    cin >> N >> K;
    long long x = N % K;
    long long y = K - x;

    if(x <= y){
        cout << x << endl;
    }else{
        cout << y << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> N >> K;
      |     ^~~
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:12:9: error: 'cout' was not declared in this scope
   12 |         cout << x << endl;
      |         ^~~~
a.cc:12:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:12:22: error: 'endl' was not declared in this scope
   12 |         cout << x << 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;
a.cc:14:9: error: 'cout' was not declared in this scope
   14 |         cout << y << endl;
      |         ^~~~
a.cc:14:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:22: error: 'endl' was not declared in this scope
   14 |         cout << y << endl;
      |                      ^~~~
a.cc:14:22: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

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

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define mod 1000000007
#define endl "\n"
#define all(a) (a).begin(),(a).end()
#define lp(i,a,b) for(i=a;i<b;i++)
#define lpr(i,a,b) for(i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair

typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;

int main(){

  /*#ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif*/

  fast;
  int i,j,q,x,m,a,b,tc;
  ll n,k;
  cin>>n>>k;
  ll a1=n/k;
  ll a2=a1+1;
  ll ans1=abs( n-(d1*k) );
  ll ans2=abs( n-(d2*k) );
  cout<<min(ans1,ans2)<<endl;
  return 0;
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:35:19: error: 'd1' was not declared in this scope; did you mean 'a1'?
   35 |   ll ans1=abs( n-(d1*k) );
      |                   ^~
      |                   a1
a.cc:36:19: error: 'd2' was not declared in this scope; did you mean 'a2'?
   36 |   ll ans2=abs( n-(d2*k) );
      |                   ^~
      |                   a2
Language: C++

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	unsigned long long int n, k;
	cin >> n >> k;
	cout << min(n%k, abs(k-n%k)) << "\n";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: call of overloaded 'abs(long long unsigned int)' is ambiguous
   10 |         cout << min(n%k, abs(k-n%k)) << "\n";
      |                          ~~~^~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  int k;
  cin>>n>>k;
  int d = n%k;
  int e = abs(d-k);
  if(d<e) cout<<d<<"\n";
  else cout<<e<<"\n;
  return 0;
}

Compiler output:
a.cc:11:17: warning: missing terminating " character
   11 |   else cout<<e<<"\n;
      |                 ^
a.cc:11:17: error: missing terminating " character
   11 |   else cout<<e<<"\n;
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:12:3: error: expected primary-expression before 'return'
   12 |   return 0;
      |   ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namesapce std;
#define int long long
signed main(){
  int n;
  int k;
  cin>>n>>k;
  int d = n%k;
  int e = abs(d-k);
  if(d<e) cout<<d<<"\n";
  else cout<<e<<"\n";
  return 0;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namesapce'
    2 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin>>n>>k;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 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:10:11: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |   if(d<e) cout<<d<<"\n";
      |           ^~~~
      |           std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:11:8: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 |   else cout<<e<<"\n";
      |        ^~~~
      |        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<bits/stdc++.h>
using namesapce std;
#define int long long
signed main(){
  int n;
  int k;
  cin>>n>>k;
  int d = n%k;
  int e = abs(d-k);
  if(d<e) cout<<d<<"\n";
  else cout<<e<<"\n;
  return 0;
}

Compiler output:
a.cc:11:17: warning: missing terminating " character
   11 |   else cout<<e<<"\n;
      |                 ^
a.cc:11:17: error: missing terminating " character
   11 |   else cout<<e<<"\n;
      |                 ^~~~
a.cc:2:7: error: expected nested-name-specifier before 'namesapce'
    2 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin>>n>>k;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 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:10:11: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |   if(d<e) cout<<d<<"\n";
      |           ^~~~
      |           std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:11:8: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 |   else cout<<e<<"\n;
      |        ^~~~
      |        std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:12:3: error: expected primary-expression before 'return'
   12 |   return 0;
      |   ^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
  long long n,k;
  cin >> n >> k;
  
  if(n<k){
    cout << n;
    return 0;
  }
  
  if(n%k == 0){
    cout << "0";
    return 0;
  }
  
  long long ans1 = llabs(k*(((n-1)/k)+1) - n);
  long long ans2 = llasb(n - k*(n/k));
  
  cout << min(ans1,ans2);
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:20: error: 'llasb' was not declared in this scope; did you mean 'llabs'?
   21 |   long long ans2 = llasb(n - k*(n/k));
      |                    ^~~~~
      |                    llabs
Language: Java

import java.util.Scanner;
import java.lang.Math;
public class Main{
  public static void main(String[] args){
	Scanner a = new Scanner(System.in);
    long x = a.nextLong();
    long y = a.nextLong();
    long z = x%y;
    System.out.println(Math.min(z,Math.abs(y-z)));

Compiler output:
Main.java:9: error: reached end of file while parsing
    System.out.println(Math.min(z,Math.abs(y-z)));
                                                  ^
1 error
Language: C++

#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

void Main()
{
	int N;
    int K;
    int S;
  
  	cin >> N;
    cin >> K;
  
  if(N == K){
    S = 0;
  }
  
  else if(2 * N < K){
    S = N;
  }
  else if(N < K && 2 * N > K){
    S = K - N;
  }
  else if(N % K == 0){
    S = 0;
  }
  else{
    S = N % K;
  }
  
  printf("%d", S);
    
  
    
	
	
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Compiler output:
a.cc:2:9: fatal error: boost/multi_array.hpp: No such file or directory
    2 | #include<boost/multi_array.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int main () {
  long long n,k,answer;
  cin >> n >> k;
  
  if (n%k == 0) answer = 0;
  else {
    if (k%(n%k) == 0) answer = n;
    else if (k%(n%k) <= (long long double)k /2) answer = k%(n%k);
    else answer = k-(k%(n%k));
  }
  
  cout << answer << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:31: error: 'long long' specified with 'double'
   11 |     else if (k%(n%k) <= (long long double)k /2) answer = k%(n%k);
      |                               ^~~~
Language: C++

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

int main () {
  long long double n,k,answer;
  cin >> n >> k;
  
  if (n%k == 0) answer = 0;
  else {
    if (k%(n%k) == 0) answer = n;
    else if (k%(n%k) <= k /2) answer = k%(n%k);
    else answer = k-(k%(n%k));
  }
  
  cout << answer << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:8: error: 'long long' specified with 'double'
    5 |   long long double n,k,answer;
      |        ^~~~
a.cc:5:8: error: 'long long' specified with 'double'
a.cc:5:8: error: 'long long' specified with 'double'
a.cc:8:8: error: invalid operands of types 'double' and 'double' to binary 'operator%'
    8 |   if (n%k == 0) answer = 0;
      |       ~^~
      |       | |
      |       | double
      |       double
a.cc:10:13: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   10 |     if (k%(n%k) == 0) answer = n;
      |            ~^~
      |            | |
      |            | double
      |            double
a.cc:11:18: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   11 |     else if (k%(n%k) <= k /2) answer = k%(n%k);
      |                 ~^~
      |                 | |
      |                 | double
      |                 double
a.cc:11:44: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   11 |     else if (k%(n%k) <= k /2) answer = k%(n%k);
      |                                           ~^~
      |                                           | |
      |                                           | double
      |                                           double
a.cc:12:26: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   12 |     else answer = k-(k%(n%k));
      |                         ~^~
      |                         | |
      |                         | double
      |                         double
Language: C++

#include<bits/stdc++.h>
using namesapce std;
#define int long long
signed main(){
  int n;
  int k;
  cin>>n>>k;
  cout<<(n%k)<<"\n";
  return 0;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namesapce'
    2 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin>>n>>k;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 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:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |   cout<<(n%k)<<"\n";
      |   ^~~~
      |   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 <bits/stdc++.h>
using namespace std;
 
int main() {
  int shoki, hiku;
   cin >> shoki >> hiku;
   
   int kekkaitchi;
   kekkaichi = shoki % hiku;
   
   int kekkani;
   kekkani = kekkani - hiku;
   kekkani = abs(kekkani)
   
   if(shoki <= kekkaichi && shoki <= kekkani){
   cout <<shoki << endl;
   }
   else if (kekkaichi <= shoki && kekkaichi <= kekkani){
   cout << kekkani << endl;
   }
   else{
   cout << kekkani << endl;}
   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:4: error: 'kekkaichi' was not declared in this scope; did you mean 'kekkaitchi'?
    9 |    kekkaichi = shoki % hiku;
      |    ^~~~~~~~~
      |    kekkaitchi
a.cc:13:26: error: expected ';' before 'if'
   13 |    kekkani = abs(kekkani)
      |                          ^
      |                          ;
   14 | 
   15 |    if(shoki <= kekkaichi && shoki <= kekkani){
      |    ~~                     
a.cc:18:4: error: 'else' without a previous 'if'
   18 |    else if (kekkaichi <= shoki && kekkaichi <= kekkani){
      |    ^~~~
Language: C++

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	unsigned long long int n, k;
	cin >> n >> k;
	if(!n)
		cout << "0\n";
	else if(n < k)
		cout << n << "\n";
	else if(k == 1)
		cout << "0\n";
	else if(n%k == 0)
		cout << "0\n";
	else {
		int rem = n%k;
		if(res <= k/2){
			cout << res << "\n";
		}
		else {
			cout << k%res << "\n";
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:20: error: 'res' was not declared in this scope; did you mean 'rem'?
   20 |                 if(res <= k/2){
      |                    ^~~
      |                    rem
Language: C++

#include<iostream>
#define int long long
using namesapce std;
signed main(){
  int n,k;
  cin>>n>>k;
  cout<<(n%k)<<"\n";
  return 0;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namesapce'
    3 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin>>n>>k;
      |   ^~~
      |   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:7:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    7 |   cout<<(n%k)<<"\n";
      |   ^~~~
      |   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 <bits/stdc++.h>
using namespace std;
//useful library
int long long gcd(int long long a, int long long b){
    return b?gcd(b,a%b):a;
} //最大公約数
int long long lcm(int long long a, int long long b){
    return a/gcd(a,b)*b;
} //最小公倍数
int long long GetDigit(int long long num){
    int long long digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
} //桁数
int long long GetDigitN(int long long num, int long long N){
    int long long digit=0;
    while(num!=0){
        num /= N;
        digit++;
    }
    return digit;
} //十進数でnumの際のN進数における桁数

int main(){
    int long long N, K, A;
    cin >> N >> K;
    int t = N % K;
    A = min(t, (K - t));
    cout << A << endl;
    return 0;
}

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

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

int main(){
    ios_base::sync_with_stdio(false);
    int64 n , k; cin >> n >> k;
    int64 min1;
            if( n == 0 ){
                min1 = k;
            } else if( k == 1 ){
                min1 = 0;
            } else {
                if( n == k ) min1 = 0;
                else if( n%k == 0) min1 = 0;
                else {
                    min1 = min( n % k , abs((n % k) - k);
                    if(n <= min1) min1 = n;
                }
            }    
    cout << min1 << endl;    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:57: error: expected ')' before ';' token
   19 |                     min1 = min( n % k , abs((n % k) - k);
      |                               ~                         ^
      |                                                         )
Language: C

#include<stdio.h>
#include<conio.h>

int main()
{
    int a,b,c,d;
    scanf("%d %d",&a,&b);
    c=(a-b);
    if(c<0)
        c=-c;
    d=(c-b);
    if(d<0)
        d=-d;
    printf("%d",d);
}


Compiler output:
main.c:2:9: fatal error: conio.h: No such file or directory
    2 | #include<conio.h>
      |         ^~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<math.h>
int main(void){
long long int n,k,ans1=0,m,s,sum=0;
  scanf("%lld%lld",&n,&k);
  ans1=n;
  if(k==1||(n%2==0&&k%2==0)){
    printf("0");
    return 0;
    
  }
  if(n%2==1&&k%2==0){
    printf("1");
    return 0;
  }
  if(n%2==0&&k%2==1){
    print("2");
    return 0;
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:5: error: implicit declaration of function 'print'; did you mean 'lrint'? [-Wimplicit-function-declaration]
   17 |     print("2");
      |     ^~~~~
      |     lrint
Language: C

#include<stdio.h>
#include<conio.h>

int main()
{
    double a,b,c,d;
    scanf("%lf %lf",&a,&b);
    c=(a-b);
    if(c<0)
        c=-c;
    d=(c-b);
    if(d<0)
        d=-d;
    printf("%lf",d);
}


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

#include<stdio.h>
#include <bits/stdc++.h>
using namespace std;
#include <stdlib.h>
 
int main()
{
    int N,K;
    int min,x,bx;
  
  	scanf("%d %d",&N,&K);
  
	min=N%K;
  x=min;
  
    while(min>x)
    {
      x=abs(x-K);
      if(x<min)
        min=x;
    }
    printf("%d",min);
  }
    return 0;
}

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

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

int main() {
 long long int N, K;
 cin >> N >> K;
  
if (N < K){
cout << N << endl;
}
  
else if (N % K == 0){
cout << 0 << endl;
}
  
else{
 int L = N / K;
 N -= L * K;
 
 cout << min(N, K-N) << endl;
  
}

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

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

int main() {
 long long int N, K;
 cin >> N >> K;
  
if (N < K){
cout << N << endl;
}
  
else if (N % K == 0){
cout << 0 << endl;
}
  
else{
 int L = N / K;
 N -= L * K;
 
 cout << min(N, K-N)
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:21: error: expected ';' before '}' token
   20 |  cout << min(N, K-N)
      |                     ^
      |                     ;
   21 | 
   22 | }
      | ~                    
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main() {
  int N, K;
  cin >> N >> K;
  if(K != 1) {
  while(1) {
    if(N < K) {
      if(K - N < N) {
        N =  K - N;
      }
      if(K - N > N) {
        break;
      }
    }
    else if(N > K) {
      if(N - K < N) {
        N = N - K;
      }
      if(N - K > N) {
        break;
      }
    }
  }
  cout << N << endl;
  }
  else {
    cout << 0 << endl;
}

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

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

int main()
{
    long a, b,c;
    scanf("%ld %ld", &a, &b);
    if(b==1){
        a = 1;
    }
    while (1)
    {
        c＝labs(a-b);
    
                if(c>=a)
                    break;
      
                a = c;
    }

    if(a==b)
        a = 0;
    printf("%ld\n", a);
}

Compiler output:
main.c: In function 'main':
main.c:13:9: error: implicit declaration of function 'c\U0000ff1dlabs' [-Wimplicit-function-declaration]
   13 |         c＝labs(a-b);
      |         ^~~~~~~
Language: C++

#include <iostream>
using namespace std;
int main()
{
	float N,K;
	cin >> N >> K;

	int n,k;

	n = N/10000000000;
	k = K/10000000000;

	int y = n - k;
	y = y * (-1);

	if(y > x){
		cout << x;
	}
	else{
		cout << y;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: 'x' was not declared in this scope
   16 |         if(y > x){
      |                ^
Language: Java

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


public class C {
    private static int MOD = 1000000007;


    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String str = br.readLine();
        String[] split = str.split(" ");
        long n = Long.parseLong(split[0]);
        int k = Integer.parseInt(split[1]);

        long multiple = n / k;
        long now = n - (multiple * k);
        while(true) {
            long abs = Math.abs(now - k);
            if(now <= abs || now <= k) { // 100000 : 1000 
                System.out.println(now);
                return;
            } else {
                now = abs;
            }
        }

    }
}


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

#include <iostream>
using namespace std;
int main()
{
	float N,K;
	cin >> N >> K;

	int n,k;

	n = N/10000000000;
	k = K/10000000000;

	int y = x - k;
	y = y * (-1);

	if(y > x){
		cout << x;
	}
	else{
		cout << y;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'x' was not declared in this scope
   13 |         int y = x - k;
      |                 ^
Language: Java

import java.util.Scanner;
public class Main{
 public static void main(String[] args) {
   Scanner kbd = new Scanner(System.in);
   long n =kbd.nextLong();
   long k =kbd.nextLong();
   long x=0;
   long y=0;
   if(n%k==0){
     x=0;
   }else if(n>=k){
   y=n/k;
   int p=k*y-n;
   x=k-p;
 }else{
    x=n;
 }
  System.out.println(x);
}
 }


Compiler output:
Main.java:13: error: incompatible types: possible lossy conversion from long to int
   int p=k*y-n;
            ^
1 error
Language: C++

V#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
int main() {
  int n, k;
  cin >> n >> k;
  int mod = n % k;
  if(n <= k){
    int m = k-n;
    int ans = min(n, m);
    cout << ans << endl;
  }
  else if(mod == 0){
    cout << 0 << endl;
  }
int ams = gcd(n, k);
  if(n > k && mod != 0){
    cout << ams << endl;
  }
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | V#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'V' does not name a type
    1 | V#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope
    9 |   cin >> n >> k;
      |   ^~~
a.cc:13:15: error: 'min' was not declared in this scope; did you mean 'main'?
   13 |     int ans = min(n, m);
      |               ^~~
      |               main
a.cc:14:5: error: 'cout' was not declared in this scope
   14 |     cout << ans << endl;
      |     ^~~~
a.cc:14:20: error: 'endl' was not declared in this scope
   14 |     cout << ans << endl;
      |                    ^~~~
a.cc:17:5: error: 'cout' was not declared in this scope
   17 |     cout << 0 << endl;
      |     ^~~~
a.cc:17:18: error: 'endl' was not declared in this scope
   17 |     cout << 0 << endl;
      |                  ^~~~
a.cc:21:5: error: 'cout' was not declared in this scope
   21 |     cout << ams << endl;
      |     ^~~~
a.cc:21:20: error: 'endl' was not declared in this scope
   21 |     cout << ams << endl;
      |                    ^~~~
Language: C++

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

int main(void)
{
  int n, k;
  cin >> n >> k;
  
  cout << n % k << endl;
  
  return 0;
}

Compiler output:
a.cc:5:1: error: expected initializer before 'int'
    5 | int main(void)
      | ^~~
Language: C++

#include<stdio.h>
#include<algorithm>
#include<cmath>
using namespace std;
long long int delete(long long int a, long long int b){
	a=ong long abs( a-b );
	return long long abs( a-b );
}
int main(){
	long long int *n,*k;
	scanf("%lld %lld",&n,&k);
if(n==k){
	printf("0\n");
}
else{
	long long int min=n;
//	*n=a;
	//*k=b;
	long long int c=delete(n,k);
	if(min>c){
		printf("%lld\n",c);
	}
		else{
			printf("%lld\n",min);
		}
	}

}


Compiler output:
a.cc:5:15: error: expected unqualified-id before 'delete'
    5 | long long int delete(long long int a, long long int b){
      |               ^~~~~~
a.cc: In function 'int main()':
a.cc:16:27: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   16 |         long long int min=n;
      |                           ^
      |                           |
      |                           long long int*
a.cc:19:25: error: void value not ignored as it ought to be
   19 |         long long int c=delete(n,k);
      |                         ^~~~~~~~~~~
Language: C++

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

long long check(long long n;long long k)
{
    while(n>abs(n-k))
    {
        n=abs(n-k);
    }
    
    cout<<n;
    return 0;
}
int main()
{
    long long n;
    long long k;
    
    cin>>n>>k;
    
    check(n,k);
    
    return 0;
}

Compiler output:
a.cc:5:28: error: expected ')' before ';' token
    5 | long long check(long long n;long long k)
      |                ~           ^
      |                            )
a.cc:5:40: error: expected initializer before ')' token
    5 | long long check(long long n;long long k)
      |                                        ^
a.cc: In function 'int main()':
a.cc:22:10: error: too many arguments to function 'long long int check(long long int)'
   22 |     check(n,k);
      |     ~~~~~^~~~~
a.cc:5:11: note: declared here
    5 | long long check(long long n;long long k)
      |           ^~~~~
Language: C++

#include<iostream>
using namespace std;
long long int ab(long long int a,long long int b)
{
	if(a >= b) return a-b;
	else return b-a;
}

int main()
{
	long long int a, b, c;
	cin>>a>>b;
	do{
		c = a;
		a = ab(a,b);
		if(ab(a,c) == 1){
			cout<<0<<endl;
			return 0;
		}
	}while(a < c);
	else cout<<c<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'else' without a previous 'if'
   21 |         else cout<<c<<endl;
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
int main() {
  int n, k;
  cin >> n >> k;
  int mod = n % k;
  if(n <= k){
    int m = k-n;
    int ans = min(n, m);
    cout << ans << endl;
  }
  else if(mod == 0){
    cout << 0 << endl;
  }

  if(n > k && mod != 0)
    int ams = gcd(n, k);
    cout << ams << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: 'ams' was not declared in this scope; did you mean 'abs'?
   22 |     cout << ams << endl;
      |             ^~~
      |             abs
a.cc: At global scope:
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define OUT(s) cout << s << "\n";

using namespace std;
// https://atcoder.jp/contests/abc161

long N,K;

void Main()
{
    if (N ==0 || K ==0) {
        OUT(0);
    } else {
        long w = abs(N-K);
        if (w > abs(w-K)) {
            long a = k % w;
            OUT(a);
        } else {
            OUT(w);
        }
    }
}

int main()
{
	cin.tie(0);
    ios::sync_with_stdio(false);
	// cout << fixed << setprecision(15);
    cin >> N >> K;
	Main();
    return 0;
}

Compiler output:
a.cc: In function 'void Main()':
a.cc:19:22: error: 'k' was not declared in this scope
   19 |             long a = k % w;
      |                      ^
Language: C++

#include  <bits/stdc++.h>
using namespace std; 
int n,m,a[n],sum,f;
int main()
{
	cin>>n>>m;
	for(int i=0;i<=n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	for(int i=0;i<=n;i++)
	{
		if(a[i]<1/(4*m)*sum)
		f=1;
		break;
	}
	if(f==1)
    {
    	cout<<"No";
	}
	else
	{
		cout<<"Yes";
	}
	return 0;
}

Compiler output:
a.cc:3:11: error: size of array 'a' is not an integral constant-expression
    3 | int n,m,a[n],sum,f;
      |           ^
Language: Java

import java.util.Scanner;
public class Main{
 public static void main(String[] args) {
   Scanner kbd = new Scanner(System.in);
   long n =kbd.nextLong();
   long k =kbd.nextLong();
   long x=0;
   long y=0;
   if(n%k==0){
     x=0;
   }else if(n>=k){
   y=n/k;
   x=k*(y+1)-n;
 }else{
    x=n;
 }
}
  System.out.println(x);
}
 }


Compiler output:
Main.java:18: error: <identifier> expected
  System.out.println(x);
                    ^
Main.java:18: error: <identifier> expected
  System.out.println(x);
                      ^
Main.java:20: error: class, interface, enum, or record expected
 }
 ^
3 errors
Language: C++

int main() {
  long long int n,k,min;
  cin>>n>>k;
  min=n;
  
  while(1){
    n=abs(n-k);
    if(min>n){
      min=n;
    }else{
      break;
    }
  }
    cout<<min;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope; did you mean 'min'?
    3 |   cin>>n>>k;
      |   ^~~
      |   min
a.cc:7:7: error: 'abs' was not declared in this scope
    7 |     n=abs(n-k);
      |       ^~~
a.cc:14:5: error: 'cout' was not declared in this scope
   14 |     cout<<min;
      |     ^~~~
a.cc: At global scope:
a.cc:16:3: error: expected unqualified-id before 'return'
   16 |   return 0;
      |   ^~~~~~
a.cc:17:1: error: expected declaration before '}' token
   17 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define OUT(s) cout << s << "\n";

using namespace std;
// https://atcoder.jp/contests/abc161

long N,K;

void Main()
{
    long a,a1,a2;
    if (N ==0 || K ==0) {
        OUT(0);
    } else {
        long w = abs(N-K);
        if (w > abs(w-K);) {
            long a = k % w
            OUT(a);
        } else {
            OUT(w);
        }
    }
}

int main()
{
	cin.tie(0);
    ios::sync_with_stdio(false);
	// cout << fixed << setprecision(15);
    cin >> N >> K;
	Main();
    return 0;
}

Compiler output:
a.cc: In function 'void Main()':
a.cc:19:26: error: expected primary-expression before ')' token
   19 |         if (w > abs(w-K);) {
      |                          ^
a.cc:20:22: error: 'k' was not declared in this scope
   20 |             long a = k % w
      |                      ^
Language: C++

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

int main(){
  int N, K;
  cin >> N >> K;
  
  while (N < K) {
    N = |N - K|;
  }
  N1 = N;
  N2 = |N - K|;
  
  if (N1 < N2) {
  cout << N1 << endl;
  }
  else {
  cout << N2 << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: expected primary-expression before '|' token
    9 |     N = |N - K|;
      |         ^
a.cc:9:16: error: expected primary-expression before ';' token
    9 |     N = |N - K|;
      |                ^
a.cc:11:3: error: 'N1' was not declared in this scope; did you mean 'N'?
   11 |   N1 = N;
      |   ^~
      |   N
a.cc:12:3: error: 'N2' was not declared in this scope; did you mean 'N'?
   12 |   N2 = |N - K|;
      |   ^~
      |   N
a.cc:12:8: error: expected primary-expression before '|' token
   12 |   N2 = |N - K|;
      |        ^
a.cc:12:15: error: expected primary-expression before ';' token
   12 |   N2 = |N - K|;
      |               ^
Language: Java

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
  public static void main (String[] args) throws java.lang.Exception
   {
	try{
	    Scanner sc=new Scanner(System.in);
		  long n=sc.nextLong();
		  long k=sc.nextLong();
      if(n==0)
         System.out.println("0);
      else
      {long m=n%k;
		 if(m==0)
		  System.out.println("0");  
         
		 else if(m==n)
		   System.out.println(m);
		 else if(k-m>0)
		 System.out.println(k-m);
		       
      }   
	   }     
	catch(Exception e)
		 {}
 	}
}


Compiler output:
Main.java:17: error: unclosed string literal
         System.out.println("0);
                            ^
Main.java:18: error: 'else' without 'if'
      else
      ^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
int sum(int n,int k) {
    return n;
 
  // sum関数の中でsum関数を呼び出している
  int s = sum(n - 1);
  return s - k;
  if (s<0){s*(-1);}
}

int main() {
  int n,k;
  cin >>n>>k;
  vector<int>a(100000000);
  for(int i=0;i<100000000;i++){
    a.at(i)==sum(i);
  }
  sort(a.begin(),a.end());
  cout<<a.at(0)<<endl;
  
}


Compiler output:
a.cc: In function 'int sum(int, int)':
a.cc:7:14: error: too few arguments to function 'int sum(int, int)'
    7 |   int s = sum(n - 1);
      |           ~~~^~~~~~~
a.cc:3:5: note: declared here
    3 | int sum(int n,int k) {
      |     ^~~
a.cc: In function 'int main()':
a.cc:17:17: error: too few arguments to function 'int sum(int, int)'
   17 |     a.at(i)==sum(i);
      |              ~~~^~~
a.cc:3:5: note: declared here
    3 | int sum(int n,int k) {
      |     ^~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: expected ';' before 'd'
    9 |     c=abs(a-b*e)
      |                 ^
      |                 ;
   10 |     d=abs(c-b);
      |     ~
Language: Java

import java.util.*;
public class Main
{
public static void main(String args[])
{
  Scanner in=new Scanner(System.in);
  int N=in.nextInt();
  int K=in.nextInt();
  int p=-1;int u;
  p=Math.abs(N-K);
  while(1)
  {
    N=Math.abs(p-K);
    u=N;
    N=Math.abs(N-K);
    if(N>=u)
    {
      System.out.println(u);break;
    }
    else
    {
      p=N;
    }
  }
}
}
   
    
    


Compiler output:
Main.java:11: error: incompatible types: int cannot be converted to boolean
  while(1)
        ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
int sum(int n) {
    return n;
 
  // sum関数の中でsum関数を呼び出している
  int s = sum(n - 1);
  return s - k;
  if (s<0){s*(-1)}
}

int main() {
  int n,k;
  cin >>n>>k;
  vector<int>a(100000000);
  for(int i=0;i<100000000;i++){
    a.at(i)==sum(i);
  }
  sort(a.begin(),a.end());
  cout<<a.at(0)<<endl;
  
}


Compiler output:
a.cc: In function 'int sum(int)':
a.cc:8:14: error: 'k' was not declared in this scope
    8 |   return s - k;
      |              ^
a.cc:9:18: error: expected ';' before '}' token
    9 |   if (s<0){s*(-1)}
      |                  ^
      |                  ;
Language: Java

import java.util.*;
public static void main(String args[])
{
  Scanner in=new Scanner(System.in);
  int N=in.nextInt();
  int K=in.nextInt();
  int p=-1;int u;
  p=Math.abs(N-K);
  while(true)
  {
    N=Math.abs(p-K);
    u=N;
    N=Math.abs(N-K);
    if(N>=u)
    {
      System.out.println(u);break;
    }
    else
    {
      p=N;
    }
  }
}
}
   
    
    

Compiler output:
Main.java:2: 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:24: error: class, interface, enum, or record expected
}
^
2 errors
Language: C++

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

int main(void)
{
  int n, k;
  cin >> n >> k;
  
  int a=n, b=n+1;
  while (a<b){
    b = a;
    n = abs(n-k);
    a = abs(n-k);
  }
  
  cout << b << endl;
  
  return 0;
}

Compiler output:
a.cc:5:1: error: expected initializer before 'int'
    5 | int main(void)
      | ^~~
Language: C++

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

int main()
{
    double n,k;
    cin >> n >> k;
    double min = max(n,k);
    double tmp = 0;
    if (n == 1 || k == 1 || n % k == 0)
    {
        cout << 0 << endl;
        return 0;
    }
    while (min >= tmp)
    {
        tmp = abs(n - k);
        if (min >= tmp)
        {
            min = tmp;
            n = tmp;
        }
        else
        {
            cout << min << endl;
            return 0;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:31: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   10 |     if (n == 1 || k == 1 || n % k == 0)
      |                             ~ ^ ~
      |                             |   |
      |                             |   double
      |                             double
Language: C++

#include <iostream>
using namespace std;
 
int main(){
	long long N,K;
	long long min;
	cin >> N >> K;
  	if ( N%K == 0){
      	cout << "0" << endl;
      	return 0;
    }
	min = N;
	for( int i = 0; i < 10000000; i++){
		N = llabs(N - K);
		if(min > N) min = N;
        if ( N%K == 0){
      		cout << "0" << endl;
      		return 0;
        }
    }
	}
	if (min > N){
		cout << N << endl;
	}else{
		cout << min << endl;
	}
	return 0;
}

Compiler output:
a.cc:22:9: error: expected unqualified-id before 'if'
   22 |         if (min > N){
      |         ^~
a.cc:24:10: error: expected unqualified-id before 'else'
   24 |         }else{
      |          ^~~~
a.cc:27:9: error: expected unqualified-id before 'return'
   27 |         return 0;
      |         ^~~~~~
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
Language: C++

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

int main() {
  
  long long n, k;
  cin >> n >> k;
  
  if (n>k) {
    int s=n%k;
    cout << min(s, k-s) << endl;
  }
  
  else cout << min(n, k-n) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: no matching function for call to 'min(int&, long long int)'
   11 |     cout << min(s, k-s) << endl;
      |             ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: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:11:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   11 |     cout << min(s, k-s) << endl;
      |             ~~~^~~~~~~~
/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:11:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   11 |     cout << min(s, k-s) << endl;
      |             ~~~^~~~~~~~