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

/*-----------Author: Araz Jabrayilov---------*/
/*------------@araz17----(~~)#5371-----------*/

#include <bits/stdc++.h>

#define ll long long
#define endl '\n'

using namespace std;

//int a[105];


int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    ll n = 0;
    ll m = 0;

    cin >> n >> m;
    n  = n % m;


    res = min(n, n-m);


    cout << res << endl;


    return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'res' was not declared in this scope
   25 |     res = min(n, n-m);
      |     ^~~
Language: C++

/*-----------Author: Araz Jabrayilov---------*/
/*------------@araz17----(~~)#5371-----------*/

#include <bits/stdc++.h>

#define ll long long
#define endl '\n'

using namespace std;

//int a[105];


int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n = 0;
    int k = 0;
    int dif = 0;
    cin >> n >> k;
    n  = n % k;

    int res = 0;

    res = min(n abs(n-k));


    cout << res << endl;


    return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: expected ')' before 'abs'
   26 |     res = min(n abs(n-k));
      |              ~ ^~~~
      |                )
a.cc:26:14: error: no matching function for call to 'min(int&)'
   26 |     res = min(n abs(n-k));
      |           ~~~^~~~~~
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:4:
/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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
a.cc:26:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   26 |     res = min(n abs(n-k));
      |           ~~~^~~~~~
/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:   candidate expects 2 arguments, 1 provided
Language: C++

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

int64_t zetttaichi(int64_t x){
  if(x >= 0){
    return x;
  }
  else{
    x *= -1;
    return x;
  }
}

int main()
{
  int64_t n,k;
  cin >> n >> k;
  int64_t min = 0;

  if(n == 0){
    min = k;
  }
  else if(n < k){
    int64_t a,b;
    a = n;
    b = zettaichi(a-k);
    if(a >= b){
      min = b;
    }
    else{
      min = a;
    }
  }
  else if(n == k){
    min = 0;
  }
  else if(n > k){
    int64_t c,d;
    c = n % k;
    cout << c << endl;
    d = zettaichi(c-k);

    if(c >= d){
      min = d;
    }
    else{
      min = c;
    }

  }




  cout << min << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'zettaichi' was not declared in this scope; did you mean 'zetttaichi'?
   27 |     b = zettaichi(a-k);
      |         ^~~~~~~~~
      |         zetttaichi
a.cc:42:9: error: 'zettaichi' was not declared in this scope; did you mean 'zetttaichi'?
   42 |     d = zettaichi(c-k);
      |         ^~~~~~~~~
      |         zetttaichi
Language: Java

import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		long n=scanner.nextLong();
		long k=scanner.nextLong();
		long a=n%k;
		long b=k-a;
		if(a>b)a=b;
		System.out.println(a);
	}



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

#include<bits/stdc++.h>
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define f q.front()
#define SIZE (ll)(1e3)
#define mod (ll)(1e9+7)
using namespace std;
int main(){
	IOS
 ll a,b;
 cin>>a>>b;
 ll h=a%b;ll y =b-h;
 cout<<min(h,y);
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:2: error: 'll' was not declared in this scope
   12 |  ll a,b;
      |  ^~
a.cc:13:7: error: 'a' was not declared in this scope
   13 |  cin>>a>>b;
      |       ^
a.cc:13:10: error: 'b' was not declared in this scope; did you mean 'pb'?
   13 |  cin>>a>>b;
      |          ^
      |          pb
a.cc:14:4: error: expected ';' before 'h'
   14 |  ll h=a%b;ll y =b-h;
      |    ^~
      |    ;
a.cc:14:13: error: expected ';' before 'y'
   14 |  ll h=a%b;ll y =b-h;
      |             ^~
      |             ;
a.cc:15:12: error: 'h' was not declared in this scope
   15 |  cout<<min(h,y);
      |            ^
a.cc:5:19: note: in definition of macro 'min'
    5 | #define min(a,b) (a<b?a:b)
      |                   ^
a.cc:15:14: error: 'y' was not declared in this scope; did you mean 'yn'?
   15 |  cout<<min(h,y);
      |              ^
a.cc:5:21: note: in definition of macro 'min'
    5 | #define min(a,b) (a<b?a:b)
      |                     ^
Language: C++

#include<bits/stdc++.h>
#define min(a,b) (a<b?a:b)
using namespace std;
typedef long long int ll;
int main(){
ll a.b;
  cin>>a>>b;
  ll h=a%b;ll y=b-h;
  cout<<min(h,y);return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: expected initializer before '.' token
    6 | ll a.b;
      |     ^
a.cc:7:8: error: 'a' was not declared in this scope
    7 |   cin>>a>>b;
      |        ^
a.cc:7:11: error: 'b' was not declared in this scope
    7 |   cin>>a>>b;
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 10;
int main () {
    ios::sync_with_stdio(0), cin.tie(0);
	ll n, k;
	cin >> n >> k;
	ll t = n % k;
	cout << min(t, k - t);
    return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'll' was not declared in this scope
    6 |         ll n, k;
      |         ^~
a.cc:7:16: error: 'n' was not declared in this scope
    7 |         cin >> n >> k;
      |                ^
a.cc:7:21: error: 'k' was not declared in this scope
    7 |         cin >> n >> k;
      |                     ^
a.cc:8:11: error: expected ';' before 't'
    8 |         ll t = n % k;
      |           ^~
      |           ;
a.cc:9:21: error: 't' was not declared in this scope; did you mean 'tm'?
    9 |         cout << min(t, k - t);
      |                     ^
      |                     tm
Language: C

#include <stdio.h>

int main(void)
{
    int N, K, A;

    scanf("%d", &N);
    scanf("%d", &K);
    A = (N % K) - K / 2.0;

    if (A < 0)
        printf("%d\n", A);
    else
        printf("%d\n", K - (N % K));
    
    return 0;

Compiler output:
main.c: In function 'main':
main.c:16:5: error: expected declaration or statement at end of input
   16 |     return 0;
      |     ^~~~~~
Language: C

#include <stdio.h>

int main(void)
{
    int N, K, A;
    A = (N % K) - k / 2.0;

    if (A < 0)
        printf("%d\n", A);
    else
        printf("%d\n", K - (N % K));
    
    return 0;
     
    
}

Compiler output:
main.c: In function 'main':
main.c:6:19: error: 'k' undeclared (first use in this function)
    6 |     A = (N % K) - k / 2.0;
      |                   ^
main.c:6:19: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

#define pb push_back
#define ff first
#define ss second
#define N 200005
#define mod 1000000007
#define fo(n) for(int i=1;i<=n;i++)
typedef pair<int,int> pii;
typedef long long int ll;
typedef long int li;
int mod1 = 998244353;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    unsigned ll n,k;
    cin>>n>>k;
    n = n%k;
    cout<<min(n,k-n);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: expected initializer before 'n'
   19 |     unsigned ll n,k;
      |                 ^
a.cc:20:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   20 |     cin>>n>>k;
      |          ^
      |          yn
a.cc:20:13: error: 'k' was not declared in this scope
   20 |     cin>>n>>k;
      |             ^
Language: C++

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

int main() {
  int N,K,a=0,ans=0;
  cin >> N >> K;
  a = N % K;
  ans = min(a,K-a)
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:19: error: expected ';' before 'cout'
    8 |   ans = min(a,K-a)
      |                   ^
      |                   ;
    9 |   cout << ans << endl;
      |   ~~~~
Language: C++

#include<iostream>
int main(){
  long Ans1;
  long Ans2;
  long N;
  long  K;
  cin>>N>>K;
  Ans2=N;
  while(Ans2>=Ans1){
    Ans1=Ans2;
    Ans2=abs(Ans1-K);
    if(Ans2>=Ans1)break;
  }
cout<<Ans1<<endl;
}

Compiler output:
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 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:14:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   14 | cout<<Ans1<<endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:14:13: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   14 | cout<<Ans1<<endl;
      |             ^~~~
      |             std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream.h>
int main(){
  long Ans1;
  long Ans2;
  long N;
  long  K;
  cin>>N>>K;
  Ans2=N;
  while(Ans2>=Ans1){
    Ans1=Ans2;
    Ans2=abs(Ans1-K);
    if(Ans2>=Ans1)break;
  }
cout<<Ans1<<endl;
}

Compiler output:
a.cc:1:9: fatal error: iostream.h: No such file or directory
    1 | #include<iostream.h>
      |         ^~~~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
#include<stdlib.h>
int main(){
  long Ans1;
  long Ans2;
  long N;
  long  K;
  cin>>N>>K;
  Ans2=N;
  while(Ans2>=Ans1){
    Ans1=Ans2;
    Ans2=abs(Ans1-K);
    if(Ans2>=Ans1)break;
  }
cout<<Ans1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope
    8 |   cin>>N>>K;
      |   ^~~
a.cc:15:1: error: 'cout' was not declared in this scope
   15 | cout<<Ans1<<endl;
      | ^~~~
a.cc:15:13: error: 'endl' was not declared in this scope
   15 | cout<<Ans1<<endl;
      |             ^~~~
Language: C++

#include<stdio.h>
#include<stdlib.h>
int main(){
  int Ans1;
  int Ans2;
  int N;
  int K;
  scanf("%d",&N);
   scanf("%d",&K);
  Ans2=N;
  while(Ans2>Ans1){
    Ans1=Ans2;
    Ans2=abs(Ans1-K);
  }
}
printf("%d",Ans1);
}

Compiler output:
a.cc:16:7: error: expected constructor, destructor, or type conversion before '(' token
   16 | printf("%d",Ans1);
      |       ^
a.cc:17:1: error: expected declaration before '}' token
   17 | }
      | ^
Language: C++

#include<iostream>

using namespace std;

//Kよりも小さい数字がN%KかK-(N%K)のどちらかなのでそのうちで小さいほうが答えとなる最小値になる。
//このコード↓のままだとサンプルケースの3つ目が出力が出てこない。

int main(void) {
	long long int N, K;
	cin >> N >> K;
	//----------------
	
	for (long long int i = 0;i < (pow(10,18) + 10); i++) {
		long long int zettaiti = N - K;
		if ((N - K) < 0) {
			zettaiti = zettaiti * -1;
		}
		if (N < zettaiti) {
			cout << N << endl;
			break;
		}
		else if (N == zettaiti) {
			cout << "0" << endl;
			break;
		}
		else if (N > zettaiti) {
			N = zettaiti;
		}
	}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:39: error: 'pow' was not declared in this scope
   13 |         for (long long int i = 0;i < (pow(10,18) + 10); i++) {
      |                                       ^~~
Language: C++

#include<iostream>

using namespace std;

//Kよりも小さい数字がN%KかK-(N%K)のどちらかなのでそのうちで小さいほうが答えとなる最小値になる。
//このコード↓のままだとサンプルケースの3つ目が出力が出てこない。

int main(void) {
	long long int N, K;
	cin >> N >> K;
	//----------------
	
	for (long long int i = 0;i < pow(10,18) + 10; i++) {
		long long int zettaiti = N - K;
		if ((N - K) < 0) {
			zettaiti = zettaiti * -1;
		}
		if (N < zettaiti) {
			cout << N << endl;
			break;
		}
		else if (N == zettaiti) {
			cout << "0" << endl;
			break;
		}
		else if (N > zettaiti) {
			N = zettaiti;
		}
	}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:38: error: 'pow' was not declared in this scope
   13 |         for (long long int i = 0;i < pow(10,18) + 10; i++) {
      |                                      ^~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fit(x) for(auto it=x.begin();it!=x.end();++it)
#define se second
#define mp make_pair
#define ALP "abcdefghijklmnopqrstuvwxyz"
#define nline cout<<"\n"
#define rep(i,x) for(i=0;i<x;++i)
#define repr(i,a,b) for(i=a;i<=b;++i)
#define mi2 500000004
#define mi3 333333336
#define MOD 1000000007
#define N 1000005
#define pll pair<ll,ll>
#define Vll vector<ll>
#define W(t) while(t--)
#define modsum(a,b,M) (a%M + b%M)%M
#define modsub(a,b,M) (a%M - b%M + M)%M
#define modmul(a,b,M) (a%M * b%M)%M
#define moddiv(a,b,M) (a%M * modinv(b,M)%M)%M
using namespace std;
ll powermod(ll x,ll n,ll M)
{
	ll result=1;
	while(n>0)
	{
	  if(n % 2 ==1)
	    result=(result * x)%M;
	  x=(x*x)%M;
	  n=n/2;
	}
	return result;
}
vector<ll> readll() {
	cin>>ws;
	vector<ll> v;
	string input;
	getline(cin, input);
	cout<<input;
	istringstream is(input);
	ll num;
	while(is>>num) v.pb(num);
	return v;
}
ll modinv(ll n,ll p) {
	return powermod(n,p-2,p);
}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll fact[1000005],invf[1000005];
void facmod(ll n,ll M) {
	ll i;
	fact[0]=fact[1]=1;
	for(i=2;i<=n;++i) {
		fact[i]=((fact[i-1])%M * (i%M))%M;
	}
	invf[n]=modinv(fact[n],M);
	for (i=n-1;i>=0;--i){
		invf[i]=invf[i+1]*(i+1);
		invf[i]%=M;
	}
}
/*****
ll T=0;
ll p[200005], d[200005];
ll tin[200005], tout[200005];
vector<ll> g[200005];

void dfs(ll v, ll par = 1, ll dep = 0) {
	p[v] = par;
	d[v] = dep;
	tin[v] = T++;
	for (auto to : g[v]) {
		if (to == par) continue;
		dfs(to, v, dep + 1);
	}
	tout[v] = T++;
}
****/
void solve() {
	ll n,m,i,sm=0;
	cin>>n>>k;
	if(k<=n) {
		cout<<n%k;
	}
	else {
		cout<<k%n;
	}
}
int main() {
  	fastio;
	ll t=1;
	//cin>>t;
	W(t) {
		solve();
	}
	
  	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:84:17: error: 'k' was not declared in this scope
   84 |         cin>>n>>k;
      |                 ^
Language: C++

#include <iostream>

using namespace std;

int main() {
  long long n,k;
  cin >> n >> k;
  auto it = [](long long x, long long y) {
  	if (y==0) return x;
    else return [](y, y%x);
  }
  long temp = it(n,k);
  if (k==temp) cout << 0 << endl;
  else cout << temp << endl;
  return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:10:20: error: 'y' is not a type
   10 |     else return [](y, y%x);
      |                    ^
a.cc:10:23: error: 'y' is not a type
   10 |     else return [](y, y%x);
      |                       ^
a.cc:10:24: error: expected ',' or '...' before '%' token
   10 |     else return [](y, y%x);
      |                        ^
a.cc: In lambda function:
a.cc:10:27: error: expected '{' before ';' token
   10 |     else return [](y, y%x);
      |                           ^
a.cc: In lambda function:
a.cc:10:17: error: inconsistent types 'long long int' and 'main()::<lambda(long long int, long long int)>::<lambda(int, int)>' deduced for lambda return type
   10 |     else return [](y, y%x);
      |                 ^~~~~~~~~~
a.cc:10:17: error: invalid user-defined conversion from 'main()::<lambda(long long int, long long int)>::<lambda(int, int)>' to 'long long int' [-fpermissive]
a.cc:10:17: note: candidate is: 'constexpr main()::<lambda(long long int, long long int)>::<lambda(int, int)>::operator void (*)(int, int)() const' (near match)
   10 |     else return [](y, y%x);
      |                 ^
a.cc:10:17: note:   no known conversion from 'void (*)(int, int)' to 'long long int'
a.cc: In function 'int main()':
a.cc:12:3: error: expected ',' or ';' before 'long'
   12 |   long temp = it(n,k);
      |   ^~~~
a.cc:13:10: error: 'temp' was not declared in this scope; did you mean 'tm'?
   13 |   if (k==temp) cout << 0 << endl;
      |          ^~~~
      |          tm
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() {

  ll x,K;
  cin >> x >> K;

  ll a = N % K;
  ll ans = min(a, K-a);

  cout << ans <<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: 'N' was not declared in this scope
   13 |   ll a = N % K;
      |          ^
Language: C++

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

using ll = long long; 
using P = pair<int,int>;

int main() {

  int x,K;
  cin >> x >> K;

  ll a = N % K;
  ll ans = min(a, K-a);

  cout << ans <<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: 'N' was not declared in this scope
   13 |   ll a = N % K;
      |          ^
Language: C++

#include "stdafx.h"
#include <iostream>
#include <vector>

using namespace std;
int main() {
    int N,K;
    cin >> N>>K;
    std::vector<int> vec;
    int min = -1;
    while(1){
        N = abs(N-K);
        if(min==-1 || N<min){
            min = N;
        }
        if(std::count(vec.begin(),vec.end(),N)>0)break;
        vec.push_back(N);
    }
    cout<< min <<endl;

    return 0;
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
int main(void){
  long int n,k;
  scanf("%ld%ld", &n, &k);
  t=n%k;
  if(2*t<k){
    printf("%ld", t);
  }
  else{
    printf("%ld", k-t);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:3: error: 't' undeclared (first use in this function)
    5 |   t=n%k;
      |   ^
main.c:5:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <vector>

using namespace std;
int main() {
    int N,K;
    cin >> N>>K;
    std::vector<int> vec;
    int min = -1;
    while(1){
        N = abs(N-K);
        if(min==-1 || N<min){
            min = N;
        }
        if(std::count(vec.begin(),vec.end(),N)>0)break;
        vec.push_back(N);
    }
    cout<< min <<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'count' is not a member of 'std'; did you mean 'cout'?
   15 |         if(std::count(vec.begin(),vec.end(),N)>0)break;
      |                 ^~~~~
      |                 cout
Language: C++

#include <iostream>
#include <vector>

using namespace std;
int main() {
    int N,K;
    cin >> N>>K;
    std::vector<int> vec;
    int min = -1;
    while(1){
        N = abs(N-K);
        if(min==-1 || N<min){
            min = N;
        }
        if(count(vec.begin(),vec.end(),N)>0)break;
        vec.push_back(N);
    }
    cout<< min <<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: 'count' was not declared in this scope
   15 |         if(count(vec.begin(),vec.end(),N)>0)break;
      |            ^~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
 int main(void) {
  long int n,k;
    scanf("%ld %ld",&n,&k );
   if (n%k>(n%k-k)) {
    printf("%ld",labs(n%k-k) ;)
   }
else{
  printf("%ld",labs(n%k) );
}
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:29: error: expected ')' before ';' token
    7 |     printf("%ld",labs(n%k-k) ;)
      |           ~                 ^~
      |                             )
main.c:7:32: error: expected ';' before '}' token
    7 |     printf("%ld",labs(n%k-k) ;)
      |                                ^
      |                                ;
    8 |    }
      |    ~
Language: C

#include<stdio.h>
 int main(void) {
   intn,k,;
      scanf("%d %d",&n,&k );
   printf("%d",n%k );

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:3:4: error: 'intn' undeclared (first use in this function); did you mean 'int'?
    3 |    intn,k,;
      |    ^~~~
      |    int
main.c:3:4: note: each undeclared identifier is reported only once for each function it appears in
main.c:3:9: error: 'k' undeclared (first use in this function)
    3 |    intn,k,;
      |         ^
main.c:3:11: error: expected expression before ';' token
    3 |    intn,k,;
      |           ^
main.c:4:22: error: 'n' undeclared (first use in this function)
    4 |       scanf("%d %d",&n,&k );
      |                      ^
Language: C

#include<stdio.h>
#include<stdlib.h>
int main()
{
    unsigned long long int N,K,x;
    long long int y;



    scanf("%llu%llu",&N,&K);
    if(N==0)
        printf("%d",k);


        x=N%K;

        y=abs(x-K);
        if(y<x)
            printf("%d\n",y);
        else
            printf("%d\n",x);

    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:12:21: error: 'k' undeclared (first use in this function)
   12 |         printf("%d",k);
      |                     ^
main.c:12:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main() {
  
  vector<int64_t> N;
  int64_t K;
  cin >> N.at(0) >> K;
  
  int64_t i = 0;
  
  while (true) {
    N.at(i + 1) = N.at(i) - K;
    if (N.at(i + 1) < 0) {
      N.at(i + 1) *= (-1);
      if (N.at(i + 1) < N.at(i)) {
        cout << N.at(i + 1) << endl;
      }
      else {
        cout << N.at(i) << endl;
      }
      break;
    }
  　i++
  }
}


Compiler output:
a.cc:24:3: error: extended character 　 is not valid in an identifier
   24 |   　i++
      |   ^
a.cc: In function 'int main()':
a.cc:24:3: error: '\U00003000i' was not declared in this scope
   24 |   　i++
      |   ^~~
Language: C++

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

int main() {
  int64_t N, K;
  cin >> N >> K;
  int64_t m = min(N % K, abs(N % K - K))
  cout << m << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N, K; cin >> N >> K;
  
  long long amari = N % K;
  
  long long ans = min(amari, K - amari));
  cout << ans ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:40: error: expected ',' or ';' before ')' token
    8 |   long long ans = min(amari, K - amari));
      |                                        ^
Language: C++

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

int main () {
	int N, K, x;
  	cin >> N >> K;
  	x = N % K;
  	int minimum = min(x, K-x)
    cout << minimum << endl;
}


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

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

int main () {
	int N, K, x;
  	cin >> N >> K;
  	x = N % K;
  	int minimum = min(x, K-x)
    cout << minimum << endl;
}

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: expected ';' before 'cout'
   12 | n = min(n,k-n)
      |               ^
      |               ;
   13 | cout << n << endl;
      | ~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
int main()
{
	ll N,K,x,y;
	cin >> N >> K;
	
	x = N%K;
	y = (x - K)*(-1);

	cout << min(x,y);

	cin >> N;
	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: Java

import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();

		int res = getCommonDevider(n, m);
		System.out.println(res);
	}

	int static getCommonDevider(int n, int m) {
		int maxNum = Math.max(n, m);
		int minNum = Math.min(n, m);

		int surplus = maxNum % minNum;
		if (surplus == 0) {
			return minNum;
		}

		surplus = getCommonDevider(surplus, minNum);

		return surplus;
	}
}

Compiler output:
Main.java:12: error: <identifier> expected
	int static getCommonDevider(int n, int m) {
	   ^
Main.java:12: error: invalid method declaration; return type required
	int static getCommonDevider(int n, int m) {
	           ^
2 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();

		int res = getCommonDevider(n, m);
		if (res == 1) {
			System.out.println(0);
		}
		System.out.println(res);
	}

	int getCommonDevider(int n, int m) {
		int maxNum = Math.max(n,m);
		int minNum = Math.min(n,m);

		int surplus = maxNum % minNum;
		if (surplus == 0) {
			return minNum;
		}

		surplus = getCommonDevider(surplus, minNum);

		return surplus;
	}
}

Compiler output:
Main.java:8: error: non-static method getCommonDevider(int,int) cannot be referenced from a static context
		int res = getCommonDevider(n, m);
		          ^
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args) {
	    Scanner s = new Scanner(System.in);
	    int n = s.nextInt();
	    int m = s.nextInt();
	    
    int res = getCommonDevider(n, m);
      if (res == 1) {
        return 0;
      }
      return res;
	}
}

int getCommonDevider(int n, int m) {
  int maxNum = Math.max(n,m);
  int minNum = Math.min(n,m);
  
  int surplus = maxNum % minNum;
  if (surplus == 0) {
    return minNum;
  }
  
  surplus = getCommonDevider(int surplus, int minNum);
  
  return surplus;
}

Compiler output:
Main.java:25: error: not a statement
  surplus = getCommonDevider(int surplus, int minNum);
                                 ^
Main.java:16: error: unnamed classes are a preview feature and are disabled by default.
int getCommonDevider(int n, int m) {
^
  (use --enable-preview to enable unnamed classes)
Main.java:25: error: ';' expected
  surplus = getCommonDevider(int surplus, int minNum);
                                        ^
Main.java:25: error: ';' expected
  surplus = getCommonDevider(int surplus, int minNum);
                                                    ^
4 errors
Language: C++

#include<iostrea#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	long long n, m;
	int f = 0;
	cin >> n >> m;
	if (n == 0) { cout << m; return 0; }
	int p = n % m;
	if (p == 0) { cout << 0; return 0; }
	if (n >= m)
	{
		int t = n / m;
		while (t != 0) {
			n = n - t * m;
			t = n / m;
		}
		long long ans;
		ans = min(abs(n - m), abs(m - n));
		cout << ans;
	}
	else {
		int ans;
		ans = min(m - n, n);
		cout << ans;
	}

}

Compiler output:
a.cc:1:9: fatal error: iostrea#include<iostream: No such file or directory
    1 | #include<iostrea#include<iostream>
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long  n,k;
  cin>>n>>k;
  if(n>k)
  long long  n=n%k;
  long long a=abs(k-c);
  int x=min(a,n);
  cout<<x<<"\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: 'c' was not declared in this scope
    9 |   long long a=abs(k-c);
      |                     ^
Language: C++

#include<bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define pb push_back

using namespace std;

ll n,k;

int main()
{
    cin >> n >> k;
    if (n<k)n=min(n,abs(n-k));
    else
    {
        ll tmp=n/k;
        n-=tmp*k;
        n=min(n,abs(n-k));
    }
    cout << n << endl;
}
#include<bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define pb push_back

using namespace std;

ll n,k;

int main()
{
    cin >> n >> k;
    if (n<k)n=min(n,abs(n-k));
    else
    {
        ll tmp=n/k;
        n-=tmp*k;
        n=min(n,abs(n-k));
    }
    cout << n << endl;
}


Compiler output:
a.cc:31:4: error: redefinition of 'long long int n'
   31 | ll n,k;
      |    ^
a.cc:9:4: note: 'long long int n' previously declared here
    9 | ll n,k;
      |    ^
a.cc:31:6: error: redefinition of 'long long int k'
   31 | ll n,k;
      |      ^
a.cc:9:6: note: 'long long int k' previously declared here
    9 | ll n,k;
      |      ^
a.cc:33:5: error: redefinition of 'int main()'
   33 | int main()
      |     ^~~~
a.cc:11:5: note: 'int main()' previously defined here
   11 | int main()
      |     ^~~~
Language: C++

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

int main(){
    unsigned long long n;
    unsigned long long k;
    cin>>n>>k;

    unsigned long long min1=n;
    if(k>n){
        if(k-n<n)
        cout<<k-n;
        else cout<<n;
        return 0;
    }

        if(n>=k)
        n=n%k;
        if(k>n)
        if(k-n<n)
        cout<<k-n; 4
        else cout<<n;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: expected ';' before 'else'
   21 |         cout<<k-n; 4
      |                     ^
      |                     ;
   22 |         else cout<<n;
      |         ~~~~
Language: C++

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

int main(){
  ll n,k,ans;
  cin>>n>>k;
  ans=mod(n,k);
  ans=min(ans,abs(ans-k));
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: 'mod' was not declared in this scope; did you mean 'modf'?
   10 |   ans=mod(n,k);
      |       ^~~
      |       modf
Language: C

#include<stdio.h>

int main(){
  int N,K,x,y;
  scanf("%d %d\n",&N,&K);
    x=N%K;
    y=K-x;
    if(x>y){
      printf("%d\n",y);
    }else{
      printf("%d\n",x);
    }
  }
  return 0;
}


Compiler output:
main.c:14:3: error: expected identifier or '(' before 'return'
   14 |   return 0;
      |   ^~~~~~
main.c:15:1: error: expected identifier or '(' before '}' token
   15 | }
      | ^
Language: C++

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

int main(){
  int n,k,a,b,c;
  cin>>n>>k;
  a=n%k;
  b=min(a,k-a);
    cout<<b<<endl;
  }
}


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

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

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

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: expected ';' before 'if'
    7 |   a=n%k
      |        ^
      |        ;
    8 |   if(n>k){
      |   ~~    
a.cc:11:3: error: 'else' without a previous 'if'
   11 |   else{
      |   ^~~~
Language: C++

//
//  replacing_integer.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>

int main(int argc, const char* argv[]) {
  long long n, k;
  std::cin >> n >> k;
  long long result = n%k;

  // if(abs(result-k) < result) {
  //     result = abs(result-k);
  // }
  std::cout << std::min(result, abs(result-k)) << std::endl;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:19:24: error: no matching function for call to 'min(long long int&, int)'
   19 |   std::cout << std::min(result, abs(result-k)) << std::endl;
      |                ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:9:
/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:19:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   19 |   std::cout << std::min(result, abs(result-k)) << std::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
Language: C++

//
//  replacing_integer.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>

int main(int argc, const char* argv[]) {
  long long n, k;
  std::cin >> n >> k;
  long long result = n%k;

  // if(abs(result-k) < result) {
  //     result = abs(result-k);
  // }
  std::cout << min(result, abs(result-k)) << std::endl;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:19:16: error: 'min' was not declared in this scope; did you mean 'std::min'?
   19 |   std::cout << min(result, abs(result-k)) << std::endl;
      |                ^~~
      |                std::min
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:9:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
Language: C++

#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{ 
  ll n,k;
  cin>>n>>k;
  if(n<k)
  {
    cout<<min(n,abs(n-k));
    return 0;
  }
  ll res=n%k;
  ll n=n%k;
  res=min(res,abs(n-k));
  cout<<res;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:14:6: error: redeclaration of 'long long int n'
   14 |   ll n=n%k;
      |      ^
a.cc:6:6: note: 'long long int n' previously declared here
    6 |   ll n,k;
      |      ^
Language: C++

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

int main(){
  long int X, K;
  cin >> X >> K;
  
  if(X > K){
    X = K - X % K;
  }
  
  if(X <= K / 2){
    break;
  }else{
    X = K - X;
    break;
  }
      
  cout << X << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: break statement not within loop or switch
   13 |     break;
      |     ^~~~~
a.cc:16:5: error: break statement not within loop or switch
   16 |     break;
      |     ^~~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
	int n, k;
	cin >> n >> k;
	cout << min(n % k, k - n % k) << endl;

	}
	

	return 0;
}

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

#include <bits/stdc++.h>
#define REP(i,n) for((int)(i)=0;(i)<(int)(n);(i)++)
#define ll long long
 
using namespace std;
  
int main(){
  int N,K,diff;
  cin >> N >> K;
  
  if(N == K){
    cout << 0 << endl;
  }else if(N < K){
    cout << N <<endl;
  }else{
    diff = N % K;
    if(diff > abs(diff - K)){
      cout << abs(diff - K) << endl;
    }else{
      cout << diff << endl;
    }

  
    return 0;
}


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

import java.util.*;

public class Original {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long K = sc.nextLong();
    sc.close();

    long q = N / K; // 0方向に丸め込む
    long ans = Math.min(Math.abs(N - (K * (q + 1))), Math.abs(N - (K * q)));
    System.out.println(ans);
  }
}


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

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

int main() {
    int n,k;
    cin >> n >> k;
    int a = n / k;
    int b1 = n - K*a;
    int b2 = k*(a+1) - n;
    cout << min(b1,b2) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:18: error: 'K' was not declared in this scope
    8 |     int b1 = n - K*a;
      |                  ^
Language: C++

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

int main(){
    ll N,K;
    cin>>N>>K;
    
    ll ans=min(N%K,K-(N%K));
    cout<<ans<<endl;
}

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

#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;
long long int delete11(long long  a, long long b){
     long long int c = (long 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||n%k==0){
	printf("0\n");
}
else{
	long long int min=n;
//	*n=a;
	//*k=b;
	long long int c=delete11(n,k);
	if(min>c){
		printf("%lld\n",c);
	}
		else{
			printf("%lld\n",min);
		}	
	}

}


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

#include<stdio.h>
#include <stdlib.h>
int main()
{
    int N,K;
    int min,x,bx,fl;
  
  	scanf("%d %d",&N,&K);
  
	min=N%K;
  	x=min;
  	
  	while(xb!=x&&fl<3)
    {
      	fl++;
      	bx=x;
      	x=abs(K-x);
        if(x<min){
        	min=x;
      		fl=0;
        }
    }

    printf("%d",min);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: 'xb' was not declared in this scope; did you mean 'bx'?
   13 |         while(xb!=x&&fl<3)
      |               ^~
      |               bx
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  double a,b,c,i,d;
  cin >> a >> b;
  
  if(b == 0)
    c= a;
  else if(a<b){
    c = a;}
  else if(a==b){
    c = 0;}
  else if(a==0){
    c = 0;}
 else if(a > b){
  //  for(i=1;;i++){
      d = a%b ;
   	c= min(abs(d-b),d);
 
      //if((abs(a - b*i)) > (abs(a - b*(i+1)))){
        //c = abs(a - b*(i+1));
     // else{
     //   break;}
 //  }
//  }
//  else{
 //   c = a;
  }
  
  cout << c ;
 
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   19 |       d = a%b ;
      |           ~^~
      |           | |
      |           | double
      |           double
Language: C++

#include<stdio.h>
#include <stdlib.h>
int main()
{
    int N,K;
    int min,x,bx;
  
  	scanf("%d %d",&N,&K);
  
	min=N%K;
  	x=min;
  	
  	while(xb!=x&&fl<3)
    {
      	fl++;
      	bx=x;
      	x=abs(K-x);
        if(x<min){
        	min=x;
      		fl=0;
        }
    }

    printf("%d",min);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: 'xb' was not declared in this scope; did you mean 'bx'?
   13 |         while(xb!=x&&fl<3)
      |               ^~
      |               bx
a.cc:13:22: error: 'fl' was not declared in this scope
   13 |         while(xb!=x&&fl<3)
      |                      ^~
Language: C

#include <stdio.h>
#include <math.h>
void A(void);
void B(void);
void C(void);
void C2(void);
void D(void);
void E(void);

int main(void){
    C2();
    return 0;
}

void A(void){
    int a,b,c,k;
    scanf("%d %d %d",&a,&b,&c);
    printf("%d %d %d",c,a,b);
}

void B(void){
    int n,m,i,k=0;
    double sum=0;
    int array[1000];
    scanf("%d %d",&n,&m);
    for(i=0;i<n;i++){
        scanf("%d",&array[i]);
        sum+=array[i];
    }
    for(i=0;i<n;i++){
        if(array[i]>=sum/(4*m))k++;
    }
    if(k>=m){printf("Yes");
    }else{printf("No");}
}

void C(void){
    long long a,b,min1,min2,min;
    scanf("%lld %llf",&a,&b);
    min1=fmod(a,b);
    min2=fabs(fmod(a,b)-b);
    if(min1<min2){
        min=min1;
    }else{
        min=min2;
    }
    printf("%lld",min);
}


Compiler output:
/usr/bin/ld: /tmp/ccbW4rn4.o: in function `main':
main.c:(.text+0x5): undefined reference to `C2'
/usr/bin/ld: /tmp/ccbW4rn4.o: in function `C':
main.c:(.text+0x1c8): undefined reference to `fmod'
/usr/bin/ld: main.c:(.text+0x1fe): undefined reference to `fmod'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    double n,k;
    cin >> n >> k;
    double tmp = 0;
    tmp = n%k;
    cout << min(tmp, k - tmp) << endl;

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:12: error: invalid operands of types 'double' and 'double' to binary 'operator%'
    8 |     tmp = n%k;
      |           ~^~
      |           | |
      |           | double
      |           double
Language: C++

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

int N,K;
cin>>N,K;

int abs(int x){
  if(x>=0){
    return x;
  }
  else{
    x=-x;
    return x;
  }
}

int main(){
  int a,b;
  a=N%K;
  b=abs(a-K);
  int result=min(a,b);
  cout<<result<<endl;
}

Compiler output:
a.cc:5:1: error: 'cin' does not name a type
    5 | cin>>N,K;
      | ^~~
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>'
a.cc:10:34: error: 'endl' was not declared in this scope
   10 |     cout<<min(x%k,abs((x%k)-k))<<endl;
      |                                  ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include<math.h>
  +++ |+#include <ostream>
    4 | using namespace std;
Language: C

#include<stdio.h>
int main()
{
unsigned int a,b,c;
  scanf_s("%d %d",&a,&b);
unsigned int d=a%b;
if (b%2==1)
   {
      if(d<=(b-1)/2)
      {
      printf("%d",d);
      }
     else {c=b-d;
            printf("%d",c);
            }
    }
  
else
   {
      if(d<b/2) 
       {c=d;
        printf("%d",c);
        }
      else {c=b-d;
            printf("%d",c);
            }
    }
return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:3: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    5 |   scanf_s("%d %d",&a,&b);
      |   ^~~~~~~
      |   scanf
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#include <math.h> 
#include<stdio.h>
#include<string.h> //strcmp、strncmp関数を使うために必要
#include <stdlib.h>

int main(){
    int N,K;
    //bool j = true;
    //vector<int> vec(N);
    cin >> N >> K;
    //int n = N;
    int t = n;
    
    /*if(N==0 || K==1 || N==K){
        cout << 0 << endl;
        j = false;
    }*/
    
        t = N%K;
        cout << min(t,K-t) << endl;
    
    

    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'n' was not declared in this scope
   19 |     int t = n;
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
​
int main()
{
    double n,k;
    cin >> n >> k;
    //double min1 = max(n,k);
    double tmp = 0;
/*    if (n == 1 || k == 1 || fmod(n, k) == 0)
    {
        cout << 0 << endl;
        return 0;
    }*/
    tmp = fmod(n,k);
    cout << min(tmp, k - tmp) << endl;
    /*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:3:1: error: '\U0000200b' does not name a type
    3 | ​
      |