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

#include<stdio.h>
#include<math.h>
#include<bits/stdc++.h>
int main()
{
long long  n,k,s,p;
   cin>>n>>k

s=n%k;
p=abs(s-k);
if(p>s)
{
printf("%lld\n",s);
}
else
{
printf("%lld\n",p);
}


}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:4: 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:3:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    int N,K;
    cin>>N>>K;
  	int a=min(abs(N-N/K*K),abs(N-N/K*K-K));
    cout<<min(a,(abs(N-N/K*K+K))<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:33: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   10 |     cout<<min(a,(abs(N-N/K*K+K))<<endl;
      |                 ~~~~~~~~~~~~~~~~^~~~~~
Language: C

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

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

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

#include<iostream>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: expected ';' before '}' token
   11 |       ans = ans-K
      |                  ^
      |                  ;
   12 |     }
      |     ~
Language: C

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

int main(){
  long long n, k;
  scanf("%lld %lld", &n, &k);
  printf("%lld\n", min(n%k, abs(k-n%k));
}

Compiler output:
main.c: In function 'main':
main.c:7:20: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
    7 |   printf("%lld\n", min(n%k, abs(k-n%k));
      |                    ^~~
      |                    main
main.c:7:29: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
    7 |   printf("%lld\n", min(n%k, abs(k-n%k));
      |                             ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:7:34: warning: 'abs' argument 1 type is 'long long int' where 'int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
    7 |   printf("%lld\n", min(n%k, abs(k-n%k));
      |                                 ~^~~~
<built-in>: note: built-in 'abs' declared here
main.c:7:40: error: expected ')' before ';' token
    7 |   printf("%lld\n", min(n%k, abs(k-n%k));
      |         ~                              ^
      |                                        )
main.c:7:41: error: expected ';' before '}' token
    7 |   printf("%lld\n", min(n%k, abs(k-n%k));
      |                                         ^
      |                                         ;
    8 | }
      | ~
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
  int n,k,i,ans,p,f;
  scanf("%d %d",&n,&k);
  p=n;
  while(1){
    f=abs(p-k);
    if(p=<f)printf("%d",p);break;
    p=f;
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:10:10: error: expected expression before '<' token
   10 |     if(p=<f)printf("%d",p);break;
      |          ^
Language: C

#include<stdio.h>
#include<math.h>
int main(){
  int n,k,i,ans,p,f;
  scanf("%d %d",&n,&k);
  p=n;
  while(1){
    f=abs(p-k);
    if(p=<f)printf("%d",p);break;
    p=f;
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:7: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
    8 |     f=abs(p-k);
      |       ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include<math.h>
  +++ |+#include <stdlib.h>
    3 | int main(){
main.c:9:10: error: expected expression before '<' token
    9 |     if(p=<f)printf("%d",p);break;
      |          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
          long long int n,m,i,j,c=0,s=0;
          cin>>n>>m;
          c=min(n%m,m-n%m)
            cout<<c;

 }


Compiler output:
a.cc: In function 'int main()':
a.cc:7:27: error: expected ';' before 'cout'
    7 |           c=min(n%m,m-n%m)
      |                           ^
      |                           ;
    8 |             cout<<c;
      |             ~~~~
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int N, K, R, ans;
  cin >> N >> K;
  R=N%K;
  ans=min(R,(K-R));

Compiler output:
a.cc: In function 'int main()':
a.cc:24:20: error: expected '}' at end of input
   24 |   ans=min(R,(K-R));
      |                    ^
a.cc:20:12: note: to match this '{'
   20 | int main() {
      |            ^
Language: C++

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

int main() {
    int a,b;
    cin >> a >> b;
    int c = a/b;
    cout << min(abs(a-b*c),abs(a-b*(c+1))) <, endl;
}

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'll' was not declared in this scope
    5 |   ll n,k;
      |   ^~
a.cc:6:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |   cin>>n>>k;
      |        ^
      |        yn
a.cc:6:11: error: 'k' was not declared in this scope
    6 |   cin>>n>>k;
      |           ^
Language: C++

#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
unsigned long long int n,k,n1;
cin>>n>>k;
//long long int mn=INT_MAX,d;
while(1)
{
	
	n1=abs(n-k);
     if(n1<n)
     n=n1;
     else
     break;
	
}
cout<<n<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: call of overloaded 'abs(long long unsigned int)' is ambiguous
   12 |         n1=abs(n-k);
      |            ~~~^~~~~
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<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	long long x,k;
	long long l,s,c,a,b;
	scanf("%lld %lld",&x,&k);
	l=0; s=0; c=0; a=0; b=0;
	if(x<0){
		x=x*-1;
	}
	l=x-((x/d)*d);
	s=(x-((x/d+1)*d))*-1;
	if(s<l){
		printf("%lld\n",s);
	}
	else{
		printf("%lld\n",l);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'd' was not declared in this scope
   13 |         l=x-((x/d)*d);
      |                 ^
Language: C++

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

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

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

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'longlong' was not declared in this scope
    7 |     longlong ans = min(N&K,abs(N%K-K));
      |     ^~~~~~~~
a.cc:8:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
    8 |     cout << ans  << endl;
      |             ^~~
      |             abs
Language: C++

#include <iostream>

using namespace std;

int main() {

  unsigned long long n, m, k = 1000000000000000001;
  cin >> n >> m;
  for(int i = 1;i <= 4;i++){
    k = min(n, k);
    n = abs(n - k);
  }
  k = min(n, k);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: call of overloaded 'abs(long long unsigned int)' is ambiguous
   11 |     n = abs(n - k);
      |         ~~~^~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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: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 ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	ll n,k;
	int ans=0;
	cin >>n>>k;
	n=n%k
	cout<<min(n,k-n)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:14: error: expected ';' before 'cout'
   32 |         n=n%k
      |              ^
      |              ;
   33 |         cout<<min(n,k-n)<<endl;
      |         ~~~~
Language: C++

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


int main() {
    ll n,k;
    cin>>n>>k;
    ll now=1001001

    for(int i=0; i<1001001; i++){
        if(n>=k){
            n%=k;
            now=min(now,n);
            if(now==0){
                cout<<0<<endl;
                return 0;
            }
        }
        else{
            n=abs(n-k);
            now=min(now,n);
        }
    }
    cout<<now<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: expected ',' or ';' before 'for'
   14 |     for(int i=0; i<1001001; i++){
      |     ^~~
a.cc:14:18: error: 'i' was not declared in this scope
   14 |     for(int i=0; i<1001001; i++){
      |                  ^
Language: C++

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


int main() {
    ll n,k;
    cin>>n>>k;
    ll now=1001001

    rep(i,1001001){
        if(n>=k){
            n%=k;
            now=min(now,n);
            if(now==0){
                cout<<0<<endl;
                return 0;
            }
        }
        else{
            n=abs(n-k);
            now=min(now,n);
        }
    }
    cout<<now<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:19: error: expected ',' or ';' before 'for'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                   ^~~
a.cc:14:5: note: in expansion of macro 'rep'
   14 |     rep(i,1001001){
      |     ^~~
a.cc:14:9: error: 'i' was not declared in this scope
   14 |     rep(i,1001001){
      |         ^
a.cc:3:35: note: in definition of macro 'rep'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
Language: C++

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


int main() {
    ll n,k;
    cin>>n>>k;
    ll now=1001001

    rep(i,1001001){
        if(n>=k){
            n%=k;
            now=min(now,n);
            if(now==0){
                cout<<0<<endl;
                return 0;
            }
        }
        else{
            n=abs(n-k);
            now=min(now,n);
        }
    }
    cout<<now<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:19: error: expected ',' or ';' before 'for'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                   ^~~
a.cc:15:5: note: in expansion of macro 'rep'
   15 |     rep(i,1001001){
      |     ^~~
a.cc:15:9: error: 'i' was not declared in this scope
   15 |     rep(i,1001001){
      |         ^
a.cc:3:35: note: in definition of macro 'rep'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                   ^
Language: C

#include<stdio.h>
int main() {
    int x, y, z, swap;
    scanf("%d %d %d", &x, &y, &z);
    
    swap = x;
    x = y;
    y = swap;
    
    swap = x;
    x = z;
    z = swap;
    
    printf("%d %d %d\n", x, y, z);
    return 0;

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t a,b;
  cin >> a >> b;
  while(a>0){
    k=abs(a-b);
    a=k;
  }
  cout << a << endl;
}

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

#include<iostream>
using namespace std;
int main()
{
        unsigned long long int n,k,factor;
        cin>>n>>k;
	if(k>n)
	{
		if(k-n<n)
			cout<<(k-n);
		else
			cout<<n;
	}
	else
	{
		factor=n/k;
		n=n-factor*k;
	        n=min(n,abs(n-k));
		cout<<n;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:28: error: call of overloaded 'abs(long long unsigned int)' is ambiguous
   18 |                 n=min(n,abs(n-k));
      |                         ~~~^~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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: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<iostream>
#include<algorithm>
using namespace std;
int main() {
	long long n, k; cin >> n >> k;
	if (n == k) cout << "0" << endl;
	else if (n < k) cout << min(n, k - n) << endl;
	else cout << min(n % k, k - (n % k) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:45: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<<'
    8 |         else cout << min(n % k, k - (n % k) << endl;
      |                                 ~~~~~~~~~~~~^~~~~~~
Language: C

#include <stdio.h>

int main(void) {
    int N,K;
    scanf("%d" ,&N);
    scanf("%d" ,&K);
    N -= K;
    printf("%d" ,N)
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:20: error: expected ';' before 'return'
    8 |     printf("%d" ,N)
      |                    ^
      |                    ;
    9 |     return 0;
      |     ~~~~~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:11:27: error: 'a' was not declared in this scope
   11 |         int ans = min(m,k-a);
      |                           ^
Language: C++

#include<bits/stdc++.h>
#define int  long long int
using namespac std;
int32_t main(){
  int n,k; cin>>n>>k;
  int ans = 0;
  if(n<k){
    ans = min(n, abs(n-k));
  }
  else if(n%k==0){
    ans = 0;
  }
  else{
    int x = n/k;
    n = n - (x*k);
    ans = min(n, abs(n-k));
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namespac'
    3 | using namespac std;
      |       ^~~~~~~~
a.cc: In function 'int32_t main()':
a.cc:5:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   int n,k; 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:11: error: 'min' was not declared in this scope; did you mean 'std::min'?
    8 |     ans = min(n, abs(n-k));
      |           ^~~
      |           std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:16:11: error: 'min' was not declared in this scope; did you mean 'std::min'?
   16 |     ans = min(n, abs(n-k));
      |           ^~~
      |           std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:18:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   18 |   cout << ans << 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:18:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   18 |   cout << ans << endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
#define int  long long int
using namespac std;
int32_t main(){
  int n,k; cin>>n>>k;
  int ans = 0;
  if(n<k){
    ans = min(n, abs(n-k));
  }
  else if(n%k==0){
    ans = 0;
  }
  else{
    int x = n/k;
    n = n - (x*k);
    ans = min(n, abs(n-k));
  }
  cout << ans << endl;
  return 0;


Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namespac'
    3 | using namespac std;
      |       ^~~~~~~~
a.cc: In function 'int32_t main()':
a.cc:5:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   int n,k; 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:11: error: 'min' was not declared in this scope; did you mean 'std::min'?
    8 |     ans = min(n, abs(n-k));
      |           ^~~
      |           std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:16:11: error: 'min' was not declared in this scope; did you mean 'std::min'?
   16 |     ans = min(n, abs(n-k));
      |           ^~~
      |           std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:18:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   18 |   cout << ans << 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:18:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   18 |   cout << ans << endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:19:12: error: expected '}' at end of input
   19 |   return 0;
      |            ^
a.cc:4:15: note: to match this '{'
    4 | int32_t main(){
      |               ^
Language: C

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

using sll = signed long long;

int main(){

	sll N, K;
	std::cin >> N >> K;

	const sll r{ N%K };

	std::cout << 
		std::min( r, std::abs( r - K ) ) 
		<< "\n";

	return 0;
}

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

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

int main(){
  long int n, k, i;
  scanf("%ld %ld", &n, &k);
  
  if (n < k)
    printf("%ld", n);
    
  i = n / k;
  if (labs(n - i*k) <= labs(n - (i+1)*k))
    n = labs(n - i*k);
    printf("%ld", n);
  else if (labs(n - i*k) > labs(n - (i+1)*k))
    n = labs(n - (i+1)*k);
    printf("%ld", n);
  
  return(0);
}

Compiler output:
main.c: In function 'main':
main.c:15:3: error: 'else' without a previous 'if'
   15 |   else if (labs(n - i*k) > labs(n - (i+1)*k))
      |   ^~~~
Language: C

#include<stdio.h>
int main(){
  int n,k;
  int amari, sa, c;
  scanf("%d %d", &n, &k);
  amari = n % k;
  sa = k-amari;
  if(amari <= sa){
    c = amari;
  }else{
    c = sa;
  }
　printf("%d", c);
  
  return 0;
}    

Compiler output:
main.c: In function 'main':
main.c:13:1: error: stray '\343' in program
   13 | <U+3000>printf("%d", c);
      | ^~~~~~~~
Language: C

#include <stdio.h>
int main(void)
{
  int n,k,t,a,min; 
  scanf("%d",&n);
  scanf("%d",&k);
  t=n%k;
  a=k-t;
  if(t<a)
    min=t;
  else
    min=a;
  printf("%d",min)
}

Compiler output:
main.c: In function 'main':
main.c:13:19: error: expected ';' before '}' token
   13 |   printf("%d",min)
      |                   ^
      |                   ;
   14 | }
      | ~
Language: C

#include<stdio.h>
int main(){
  int n,k;
  int amari, sa, c;
  scanf("%d %d", &n, &k);
  amari = n % k;
  if(n>=k){
  sa = n-k;
  }else{
   sa = k-n;
  }
  if(amari <= sa){
    c = amari;
  }else{
    c = sa;
  }
　printf("%d", c);
  
  return 0;
}     

Compiler output:
main.c: In function 'main':
main.c:17:1: error: stray '\343' in program
   17 | <U+3000>printf("%d", c);
      | ^~~~~~~~
Language: C

#include <string.h>
#include <stdio.h>
int main(void){
  int n=-1;
  int k=-1;
  while(n<0 || n>1000000000000000000){scanf("%d",&n);}
  while(k<1 || k>1000000000000000000){scanf("%d",&k);}
  while(1){
    if(n>k) n=n-k;
    else {printf("%d",n); break;}
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:12:1: error: expected declaration or statement at end of input
   12 | }
      | ^
Language: C++

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


int main() {
  int n,k;
  rep(i,100){
    ans=min(n,abs(n-k));
    n=abs(n-k);
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |     ans=min(n,abs(n-k));
      |     ^~~
      |     abs
a.cc:15:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		//入力表示

		long N = sc.nextLong();
		long K = sc.nextLong();

		long a = N % K;
		System.out.println(Math.min(a, K - a));

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

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

int main (){
  long long N,N_2,K;
  cin >> N >> K;
  while (true) {
    N_2 = abs(N - K);
    if (N < N_2){
      cout << N << endl;
      break;
    }
    else {
      N = N_2
    }
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: expected ';' before '}' token
   14 |       N = N_2
      |              ^
      |              ;
   15 |     }
      |     ~
Language: C++

#include <iostream>

using namespace std;

int main() {
  long long n, k;
  cin >> n >> k;
  long long ans = 2e18 + 5;
  if (n % k == 0)
    cout << 0;
  else
  cout << abs(n % k - k, n);

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: no matching function for call to 'abs(long long int, long long int&)'
   12 |   cout << abs(n % k - k, n);
      |           ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
/usr/include/stdlib.h:980:12: note:   candidate expects 1 argument, 2 provided
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:137:3: note:   candidate expects 1 argument, 2 provided
/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:85:3: note:   candidate expects 1 argument, 2 provided
/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:79:3: note:   candidate expects 1 argument, 2 provided
/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:75:3: note:   candidate expects 1 argument, 2 provided
/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:71:3: note:   candidate expects 1 argument, 2 provided
/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:61:3: note:   candidate expects 1 argument, 2 provided
/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); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note:   candidate expects 1 argument, 2 provided
Language: C++

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

signed main(){
  unsigned long long int N,K,U;
  cin >> N >> K;
  U=N;
  int ans1=0;
  int ans2=0;
  int ans3=0;
  for(unsigned long long int i=0;i<N/K+2;i++){
    N-=K;
    if(i==(U/K)-1)(
      ans1=N;
    }
    else if(i==U/K){
      if(0>N){
        N=-N;
      }
      ans2=N;
    }
    else if(i==(U/K)+1){
      if(0>N){
        N=-N;
      }
      ans3=N;
    }
  }
  cout << min(min(ans1,ans2),ans3) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected ')' before ';' token
   14 |       ans1=N;
      |             ^
      |             )
a.cc:13:19: note: to match this '('
   13 |     if(i==(U/K)-1)(
      |                   ^
a.cc:16:5: error: 'else' without a previous 'if'
   16 |     else if(i==U/K){
      |     ^~~~
a.cc:16:13: error: 'i' was not declared in this scope
   16 |     else if(i==U/K){
      |             ^
a.cc: At global scope:
a.cc:29:3: error: 'cout' does not name a type
   29 |   cout << min(min(ans1,ans2),ans3) << endl;
      |   ^~~~
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法
#define JUUHATI 1000000000000000000 
#define JUUHATIPLUS 1000000000000000001 

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    ll N,K,minx=JUUHATIPLUS,modK,ans;
    cin >> N  >> K;

    if(K == 1)
        ans = 0;
    else{
        if(N != K){
            modK = abs(N - K);
            ans = N % modK;
        }
        else if(N == 0 or N == K){
            ans = 0;
    }

    cout << ans << endl;

    

}

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

import java.util.Scanner;

public class Main79 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();

        double c = (double)n / k;
        long d = (long) Math.floor(c);
        long e = Math.abs(n - (k * d));
        long f = Math.abs(n - (k * (d +1)));
        System.out.println(Math.min(e, f));
    }
}

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

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



int main(){
  int64_t N,K;
  cin>>N>>K;
  
  int x=N%K;
  int y=abs(x-K);
  
  if(x<y) cout<<x<<endl;
  else cout<<y<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: expected '}' at end of input
   14 |   else cout<<y<<endl;
      |                      ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
ll n, k;
	cin >> n >> k;
 
	ll modulo = n % k;
 
	ll ans = min(modulo, k-modulo);
 
	cout << ans << "\n";

    return 0 ;
}

Compiler output:
a.cc:13:9: error: 'cin' does not name a type
   13 |         cin >> n >> k;
      |         ^~~
a.cc:19:9: error: 'cout' does not name a type
   19 |         cout << ans << "\n";
      |         ^~~~
a.cc:21:5: error: expected unqualified-id before 'return'
   21 |     return 0 ;
      |     ^~~~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef ll long long;
int main(){
  ll N,K;
  cin>>N>>K;
  ll ans=N;
  while(true){
    if(abs(ans-K)>=ans){
      break;
    }
    ans=abs(ans-K);
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc:3:9: error: 'll' does not name a type
    3 | typedef ll long long;
      |         ^~
a.cc: In function 'int main()':
a.cc:5:3: error: 'll' was not declared in this scope
    5 |   ll N,K;
      |   ^~
a.cc:6:8: error: 'N' was not declared in this scope
    6 |   cin>>N>>K;
      |        ^
a.cc:6:11: error: 'K' was not declared in this scope
    6 |   cin>>N>>K;
      |           ^
a.cc:7:5: error: expected ';' before 'ans'
    7 |   ll ans=N;
      |     ^~~~
      |     ;
a.cc:9:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |     if(abs(ans-K)>=ans){
      |            ^~~
      |            abs
a.cc:12:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |     ans=abs(ans-K);
      |     ^~~
      |     abs
a.cc:14:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |   cout<<ans<<endl;
      |         ^~~
      |         abs
Language: C++

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  || N,K;
  cin >> N >> K;
  N %= K;
  cout << min(N, abs(N - K)) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected primary-expression before '||' token
    7 |   || N,K;
      |   ^~
a.cc:7:6: error: 'N' was not declared in this scope
    7 |   || N,K;
      |      ^
a.cc:7:8: error: 'K' was not declared in this scope
    7 |   || N,K;
      |        ^
Language: C++

#include<iostream>
using namespace std;
 
int main(void){
	long long a,b,c;
  	cin>>a>>b;
  	c=a%b;
  	c=max(c,abs(c-b));
  
  	cout<<ans<<endl;
  
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |         cout<<ans<<endl;
      |               ^~~
      |               abs
Language: Java

public static void Main(args[]){
  result=N%K
  if(result==0){
      System.out.println(result);
  }else{
      if(result<=N){
          System.out.print(result);
      }else{
          System.out.print(N);
      }
  }
}


Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void Main(args[]){
              ^
  (use --enable-preview to enable unnamed classes)
Main.java:1: error: <identifier> expected
public static void Main(args[]){
                              ^
Main.java:2: error: ';' expected
  result=N%K
            ^
3 errors
Language: C++

#include<iostream>

int main(void){
	long long a,b,c;
  	cin>>a>>b;
  	c=a%b;
  	c=max(c,abs(c-b));
  
  	cout<<ans<<endl;
  
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |         cin>>a>>b;
      |         ^~~
      |         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:11: error: 'max' was not declared in this scope; did you mean 'std::max'?
    7 |         c=max(c,abs(c-b));
      |           ^~~
      |           std::max
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
a.cc:9:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    9 |         cout<<ans<<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:9:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |         cout<<ans<<endl;
      |               ^~~
      |               abs
a.cc:9:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    9 |         cout<<ans<<endl;
      |                    ^~~~
      |                    std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<stdarg.h>
#include<math.h>
using ll = long long;

using namespace std;




int main()
{/*7日目*/
//少数も使いたい割り算はしない方がいい
// 数値の大きさ
//for文で0代入する場所はforの一文下
//オーバーフローする一手手前を分解して作る・ 割り算で減らしていく
//for文いつも間違える/ i<nなら最後はa[n-1]
	ll n, k; cin >> n >> k;
	ll am = n % k;
	ll ma = am - k;
	if (am > -ma)
		cout << -ma;
	else
		cout << am;
	

	



Compiler output:
a.cc: In function 'int main()':
a.cc:31:28: error: expected '}' at end of input
   31 |                 cout << am;
      |                            ^
a.cc:19:1: note: to match this '{'
   19 | {/*7日目*/
      | ^
Language: C++

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

int main() {

    int n , k;
    cin >> n >> k;

    int a = n % k;

    cout << min(t,k-a);


}

   

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 't' was not declared in this scope
   11 |     cout << min(t,k-a);
      |                 ^
Language: C++

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

int main() {
  int64_t n,k;
  cin >> n >> k;
  
  int64_t di = n / k;
  int7\64_t result = n - di * k;
  if (abs(result - k) < result) {
   cout << abs(result - k);}
  else {
  cout << n % k;
  }
  
}

Compiler output:
a.cc:12:7: error: stray '\' in program
   12 |   int7\64_t result = n - di * k;
      |       ^
a.cc: In function 'int main()':
a.cc:12:3: error: 'int7' was not declared in this scope; did you mean 'int'?
   12 |   int7\64_t result = n - di * k;
      |   ^~~~
      |   int
a.cc:13:11: error: 'result' was not declared in this scope
   13 |   if (abs(result - k) < result) {
      |           ^~~~~~
Language: C++

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

int main() {
	
	int n;
	cin>>n;
	int k;
	cin>>k;
	
	if(n<k)
	cout<<n<<endl;
	else
	{
	    int Min=INT_MAX;
	    
	    while(1)
	    {
	        n = abs(n-k);
	        int temp = Min;
	        Min = min(Min,n);
	        
	        if(Min==temp)
	        {
	            break;
	        }
	    }
	    cout<<n<<endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:21: error: 'INT_MAX' was not declared in this scope
   16 |             int Min=INT_MAX;
      |                     ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<algorithm>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

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

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


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

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

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:59:15: error: 'tmp' was not declared in this scope; did you mean 'tmp2'?
   59 |   ll tmp2 = k%tmp;
      |               ^~~
      |               tmp2
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int N,K;
 cin>>N>>K;
 int X;
 X=N%K;
 int Y;
 Y=K-X;
 if(X>Y){
   cout<<Y<<endl;
 }
 else{
   cout<<X<<endl;
}

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