buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k |
|---|---|---|---|---|
n, k = map(int, input().split())
max_i = max(n, k)
if n>=k:
n = n%k
if n==0 or n==1 or k==1:
print(0)
else:
for _ in range(max_i):
tmp = abs(n-k)
if tmp >= n:
break
else :
n = tmp
print(n)
| n, k = map(int, input().split())
max_i = max(n, k)
if n>=k:
n = n%k
if n==0 or k==1:
print(0)
else:
for _ in range(max_i):
tmp = abs(n-k)
if tmp >= n:
break
else :
n = tmp
print(n)
| [["-", 0, 57, 15, 679, 31, 679, 12, 666, 0, 22], ["-", 0, 57, 15, 679, 31, 679, 12, 666, 667, 60], ["-", 0, 57, 15, 679, 31, 679, 12, 666, 0, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354]] | 5 | 84 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FastRead \
ios_base::sync_with_stdio(false); \
cin... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FastRead \
ios_base::sync_with_stdio(false); \
cin... | [["+", 0, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22]] | 1 | 88 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, s, ans;
cin >> n >> k;
s = n % k;
if (s > k / 2)
ans = abs(s - k);
else
ans = s;
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n, k, s, ans;
cin >> n >> k;
s = n % k;
if (s > k / 2)
ans = abs(s - k);
else
ans = s;
cout << ans << endl;
}
| [["+", 36, 36, 36, 36, 0, 30, 0, 134, 0, 157], ["+", 36, 36, 0, 30, 0, 134, 39, 86, 0, 96], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 49, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 134, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 61 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int N, K, min;
cin >> N >> K;
min = N;
if (N >= K)
min = N % K;
if (abs(N - K) < min) {
min = abs(N - K);
}
cout << min << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int N, K, min;
cin >> N >> K;
min = N;
if (N >= K) {
min = N % K;
N = min;
}
if (abs(N - K) < min) {
min = abs(N - K);
}
cout << min << endl;
} | [["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]] | 1 | 71 |
n, k = list(map(int, input().split()))
counter = 0
x_min = n
x = n
while not counter == 3:
x = x % k
if x_min > x:
x_min = x
counter = 1
elif x_min == x:
counter = counter + 1
print(x_min)
| n, k = list(map(int, input().split()))
counter = 0
x_min = n
x = n
while not counter == 3:
x = x % k
if x_min > x:
x_min = x
counter = 1
elif x_min == x:
counter = counter + 1
x = k - x
print(x_min)
| [["+", 0, 52, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]] | 5 | 64 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
cout << min(N % K, K - N % K) << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int N, K;
cin >> N >> K;
cout << min(N % K, K - N % K) << endl;
} | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 40 |
N, K = map(int, input().split())
min(N % K, K - N % K) | N, K = map(int, input().split())
print(min(N % K, K - N % K)) | [["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 28 |
/* Author - thiolhub */
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define db double
#define pi 3.1415926535897932384626
#define PI acos(-1.0)
#define endl "\n"
#define mod 1000000007
#define mk make_pair
#define pb push_back
#define pii pair<int, int>
#define vi ve... | /* Author - thiolhub */
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define db double
#define pi 3.1415926535897932384626
#define PI acos(-1.0)
#define endl "\n"
#define mod 1000000007
#define mk make_pair
#define pb push_back
#define pii pair<int, int>
#define vi ve... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 147 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int t = n % k;
cout << min(t, k - t) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
long long t = n % k;
cout << min(t, k - t) << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 43 |
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define repe1(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
#define eb(k, v) emplace_back... | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define repe1(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
#define eb(k, v) emplace_back... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 403 |
N,K=map(int,input().split())
n_b=N
a=N%K
if(K/2<a):
print(a-K)
else:
print(a)
| N,K=map(int,input().split())
n_b=N
a=N%K
if(K/2<a):
print(abs(a-K))
else:
print(a)
| [["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 45 |
n,k=map(int,input().split())
print(min(n%k,n%k-k)) | n,k=map(int,input().split())
print(min(n,n%k,abs(n%k-k))) | [["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 31 |
#include <stdio.h>
#include <stdlib.h>
int main() {
long int m, k, n, tmp;
scanf("%ld%ld", &n, &k);
tmp = n % k;
m = abs(k - tmp);
if (m > tmp) {
tmp = m;
}
printf("%ld\n", tmp);
return 0;
} | #include <stdio.h>
#include <stdlib.h>
int main() {
long int m, k, n, tmp;
scanf("%ld%ld", &n, &k);
tmp = n % k;
m = labs(k - tmp);
if (m < tmp) {
tmp = m;
}
printf("%ld\n", tmp);
return 0;
} | [["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18]] | 0 | 73 |
#include <algorithm>
#include <array>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stac... | #include <algorithm>
#include <array>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stac... | [["-", 0, 43, 49, 50, 51, 16, 31, 16, 31, 22], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72]] | 1 | 7,244 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K, t;
cin >> N >> K;
t = N % K;
cout << min(K - t, t) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N, K, t;
cin >> N >> K;
t = N % K;
cout << min(K - t, t) << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]] | 1 | 44 |
nk = list(map(int,input().split()))
n = nk[0]
k = nk[1]
amari = n % k
if amari == 0:
ans = k
else:
if amari <= k/2:
ans = amari
else:
ans = -(amari - k)
print(ans) | nk = list(map(int,input().split()))
n = nk[0]
k = nk[1]
amari = n % k
if amari == 0:
ans = 0
else:
if amari <= k/2:
ans = amari
else:
ans = -(amari - k)
print(ans)
| [["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]] | 5 | 68 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ll n, k;
cin >> n >> k;
if (n >= k) {
ll t = n % k;
cout << min(t, abs(t - k));
} else
cout << min(k, abs(n - k));
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ll n, k;
cin >> n >> k;
if (n >= k) {
ll t = n % k;
cout << min(t, abs(t - k));
} else
cout << min(n, abs(n - k));
}
| [["-", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 22]] | 1 | 73 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int k = sc.nextInt();
boolean flag = true;
int d = 0;
x = x % k;
d = Math.min(x, Math.abs(x - k));
System.out.println(d);
}
}
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long x = sc.nextLong();
long k = sc.nextLong();
boolean flag = true;
long d = 0;
x = x % k;
d = Math.min(x, Math.abs(x - k));
System.out.println(d);
}
}
| [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]] | 3 | 96 |
n,k = map(int,input().split())
d = n//k
n = n - d*n
if abs(n-k)>n:
print(n)
else:
print(abs(n-k))
| n,k = map(int,input().split())
d = n//k
n = n - d*k
if abs(n-k)>n:
print(n)
else:
print(abs(n-k))
| [["-", 0, 1, 0, 662, 12, 657, 12, 657, 12, 22], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 12, 22]] | 5 | 53 |
N, K = input().split();
N = int(N);
K = int(K);
amari = N % K;
hu = -1* (amari - K);
max_N = max(amari,hu);
print(max_N);
| N, K = input().split();
N = int(N);
K = int(K);
amari = N % K;
hu = -1* (amari - K);
max_N = min(amari,hu);
print(max_N);
| [["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]] | 5 | 57 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
cout << min(n % k, k - (n % k));
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
cout << min(n % k, k - (n % k));
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 43 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ll N;
ll K;
cin >> N >> K;
// int prev = N;
/*while(abs(N-K) < N){
//prev = abs(N-K);
N = abs(N-K);
}*/
ll t = N % K;
ll s = N - t;
cout << min(t, s) << endl;
// cout << N << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ll N;
ll K;
cin >> N >> K;
// int prev = N;
/*while(abs(N-K) < N){
//prev = abs(N-K);
N = abs(N-K);
}*/
ll t = N % K;
ll s = K - t;
cout << min(t, s) << endl;
// cout << N << endl;
} | [["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22]] | 1 | 58 |
#include <bits/stdc++.h>
#define MOD % 1000000007
#define md % 998244353
#define INF 2e9
#define INFI 1e9 + 7
#define EPS 1e-9
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define endl "\n"
#define FOR(i, a, b) for (long ... |
#include <bits/stdc++.h>
#define MOD % 1000000007
#define md % 998244353
#define INF 2e9
#define INFI 1e9 + 7
#define EPS 1e-9
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define endl "\n"
#define FOR(i, a, b) for (long ... | [["+", 64, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 22], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 21]] | 1 | 316 |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
long long K = 0;
long long f(long long x) { return llabs(x - K); }
int main() {
char in[1000];
fgets(in, 1000, stdin);
long long x = atoll(strtok(in, " "));
K = atoll(strtok(NULL, " "));
if (x == 0) {
printf("%lld", K);
... | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
long long K = 0;
long long f(long long x) { return llabs(x - K); }
int main() {
char in[1000];
fgets(in, 1000, stdin);
long long x = atoll(strtok(in, " "));
K = atoll(strtok(NULL, " "));
if (x == 0) {
printf("0");
return... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 0 | 178 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
cout << min(n % k, k - (n % k));
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, k;
cin >> n >> k;
cout << min(n % k, k - (n % k));
return 0;
}
| [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 43 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
int ans = min(N % K, K - N % K);
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long int N, K;
cin >> N >> K;
long int ans = min(N % K, K - N % K);
cout << ans << endl;
} | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 45 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int N, K;
cin >> N >> K;
N %= K;
cout << min(N, K) << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long int N, K;
cin >> N >> K;
N %= K;
cout << min(N, K - N) << endl;
return 0;
}
| [["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 22]] | 1 | 43 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
int a = N % K;
cout << min(a, K - a) << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long N, K;
cin >> N >> K;
long a = N % K;
cout << min(a, K - a) << endl;
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 46 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (a % b == 0) {
cout << 0 << endl;
} else if (a % b <= b - a % b) {
cout << a % b << endl;
} else
cout << b - a % b << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b;
cin >> a >> b;
if (a % b == 0) {
cout << 0 << endl;
} else if (a % b <= b - a % b) {
cout << a % b << endl;
} else
cout << b - a % b << endl;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 73 |
def main():
n,k = (int(x) for x in input().split())
min = n
n = n % k
while True:
n = abs(n - k)
if(n < min):
min = n
else:
break
print(min)
if __name__ == '__main__':
main()
| def main():
n,k = (int(x) for x in input().split())
n = n % k
min = n
while True:
n = abs(n - k)
if(n < min):
min = n
else:
break
print(min)
if __name__ == '__main__':
main()
| [["-", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 22]] | 5 | 71 |
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
long long int N, K, ans, tmp;
cin >> N >> K;
if (N == 1 || K == 1)
ans = 0;
else {
if (N > K) {
tmp = N % K;
ans = min(abs(tmp - K), tmp);
} else {
ans = min(abs(N - K), N);
}
}
co... | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
long long int N, K, ans, tmp;
cin >> N >> K;
if (K == 1)
ans = 0;
else {
if (N > K) {
tmp = N % K;
ans = min(abs(tmp - K), tmp);
} else {
ans = min(abs(N - K), N);
}
}
cout << ans ... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106]] | 1 | 104 |
#include <iostream>
using namespace std;
int main(void) {
int n, k;
cin >> n >> k;
int t = n % k;
int t2 = k - t;
t2 = (t2 < 0) ? -t2 : t2;
if (t2 < t) {
cout << t2 << endl;
} else {
cout << t << endl;
}
return 0;
} | #include <iostream>
using namespace std;
int main(void) {
long long n, k;
cin >> n >> k;
long long t = n % k;
long long t2 = k - t;
t2 = (t2 < 0) ? -t2 : t2;
if (t2 < t) {
cout << t2 << endl;
} else {
cout << t << endl;
}
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 77 |
N, K = int(input().split())
# N = 1000000000000000000
# K = 1
amari = N%K
bmari = abs(amari-K)
if amari >= bmari:
print(bmari)
else:
print(amari) | N, K = map(int, input().split())
amari = N%K
bmari = abs(amari-K)
if amari >= bmari:
print(bmari)
else:
print(amari) | [["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21]] | 5 | 44 |
l = input()
m = l.split(" ")
n = int(m[0])
k = int(m[1])
if n > k:
n = n % k
if n < k:
if n < (k-n):
print(n)
else:
print(k-n)
| l = input()
m = l.split(" ")
n = int(m[0])
k = int(m[1])
if n > k:
n = n % k
if n < (k-n):
print(n)
else:
print(k-n)
| [["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 102], ["-", 0, 656, 0, 57, 64, 196, 0, 57, 0, 121], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 57, 64, 196, 0, 57, 15, 666, 667, 18]] | 5 | 69 |
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq imp... | # -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq imp... | [["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 109], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 634 |
#include <iostream>
#include <stdlib.h>
using namespace std;
int main(void) {
int N, K, t, answer;
cin >> N >> K;
t = N % K;
if (t <= abs(t - K)) {
answer = t;
} else {
answer = abs(t - K);
}
cout << answer;
} | #include <iostream>
#include <stdlib.h>
using namespace std;
int main(void) {
long N, K, t, answer;
cin >> N >> K;
t = N % K; // tは正の値での最小値,|t-K|に操作をしたらtに戻る
// tと|t-K|の大小比較
if (t <= abs(t - K)) {
answer = t;
} else {
answer = abs(t - K);
}
cout << answer;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 69 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
cout << min(N % K, K - (N % K));
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N, K;
cin >> N >> K;
cout << min(N % K, K - (N % K));
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]] | 1 | 40 |
#include <iostream>
using namespace std;
int main() {
long N, K;
cin >> N >> K;
N %= K;
if (N)
N = N < K % N ? N : K % N;
cout << N;
return 0;
} | #include <iostream>
using namespace std;
int main() {
long N, K;
cin >> N >> K;
N %= K;
if (N)
N = N < K - N ? N : K - N;
cout << N;
return 0;
} | [["-", 0, 11, 12, 41, 15, 16, 12, 16, 17, 109], ["+", 0, 11, 12, 41, 15, 16, 12, 16, 17, 33], ["-", 64, 1, 0, 11, 12, 41, 75, 16, 17, 109], ["+", 64, 1, 0, 11, 12, 41, 75, 16, 17, 33]] | 1 | 52 |
#include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define LL long long
#define inf INT_MAX / 3
#define mod 1000000007ll
#define PI acos(-1.0)
#define linf (1ll << 60) - 1
#define FOR(I, A, B) for (int I = (A); I < (B); ++I)
#define REP(I, N) FOR... | #include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define LL long long
#define inf INT_MAX / 3
#define mod 1000000007ll
#define PI acos(-1.0)
#define linf (1ll << 60) - 1
#define FOR(I, A, B) for (int I = (A); I < (B); ++I)
#define REP(I, N) FOR... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 334 |
// omajinai c++ atcoder
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define itn int
typedef long long ll;
constexpr auto mod = 1000000007;
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int ans = min(n % k, k - n % k);
cout << ... | // omajinai c++ atcoder
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define itn int
typedef long long ll;
constexpr auto mod = 1000000007;
using namespace std;
int main() {
long long int n, k;
cin >> n >> k;
long int ans = min(n % k, k - n %... | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 72 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
cout << min(n % k, k - n % k) << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll n, k;
cin >> n >> k;
cout << min(n % k, k - n % k) << endl;
}
| [["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 40 |
#include <iostream>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
cout << max(n - (n / k) * k, (n / k + 1) * k - n) << endl;
} | #include <iostream>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
cout << min(n - (n / k) * k, (n / k + 1) * k - n) << endl;
}
| [["-", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22]] | 1 | 53 |
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
#define MAXH 101
#define MAXW 101
#define INF 1000
#define MAXN 100001
int N, M;
int A[MAXN];
int main() {
cin >> N >> M;
printf("%d\n", min(N % M, abs(N % M - M)))... | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
#define MAXH 101
#define MAXW 101
#define INF 1000
#define MAXN 100001
long long N, M;
int A[MAXN];
int main() {
cin >> N >> M;
printf("%lld\n", min(N % M, abs(N % ... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 80 |
#include <stdio.h>
int main() {
int n, k;
scanf("%d%d", &n, &k);
printf("%d", n % k < k - (n % k) ? n % k : k - (n % k));
return 0;
} | #include <stdio.h>
int main() {
long long int n, k;
scanf("%lld%lld", &n, &k);
printf("%lld", n % k < k - (n % k) ? n % k : k - (n % k));
return 0;
}
| [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 60 |
#include <stdio.h>
long long int main(void) {
int n, k;
scanf("%lld%lld", &n, &k);
printf("%lld", (n % k) > (k - n % k) ? (k - n % k) : (n % k));
return 0;
} | #include <stdio.h>
long long int main(void) {
long long int n, k;
scanf("%lld%lld", &n, &k);
printf("%lld", (n % k) > (k - n % k) ? (k - n % k) : (n % k));
return 0;
} | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 0 | 67 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
cout << min(n % k, abs(k - n % k));
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, k;
cin >> n >> k;
cout << min(n % k, abs(k - n % k));
} | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 41 |
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define pi 3.14
using namespace std;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef pair<int, long long> pil;
const int INF = 1000000007;
const int MOD = 1000000007;
const int nmax = 101234;... | #include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define pi 3.14
using namespace std;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef pair<int, long long> pil;
const int INF = 1000000007;
const int MOD = 1000000007;
const int nmax = 101234;... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 128 |
#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;
int x = N % K;
int y = K - x;
cout << min(x, y) << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
long N, K;
cin >> N >> K;
long x = N % K;
long y = K - x;
cout << min(x, y) << endl;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 56 |
import static java.lang.Math.min;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner get = new Scanner(System.in);
int n = get.nextInt(), k = get.nextInt();
System.out.println(Math.min((n % k), k - (n % k)));
}
}
| import static java.lang.Math.min;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner get = new Scanner(System.in);
long n = get.nextLong(), k = get.nextLong();
System.out.println(Math.min((n % k), k - (n % k)));
}
}
| [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]] | 3 | 88 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, ans;
cin >> n >> m;
n = n % m;
ans = m - n;
if (n > ans) {
cout << ans << endl;
} else {
cout << n << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, m, ans;
cin >> n >> m;
n = n % m;
ans = m - n;
if (n > ans) {
cout << ans << endl;
} else {
cout << n;
}
} | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151], ["-", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22]] | 1 | 60 |
n, k = map(int, input().split())
if n == k:
print(0)
exit()
l = k%n
print(min(l, k-l)) | n, k = map(int, input().split())
if n == k:
print(0)
exit()
l = n%k
print(min(l, k-l)) | [["-", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]] | 5 | 44 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
long long x = (n % k);
cout << min(n - x, x) << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
long long x = (n % k);
cout << min(k - x, x) << endl;
return 0;
}
| [["-", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22]] | 1 | 50 |
// Ruthless Coding
#include <bits/stdc++.h>
#define uni(x) (x).resize(unique(all(x)) - (x).begin())
#define fprint(v) \
for (auto x : v) \
cout << x << ' '
#define ALL(x) (x).begin(), (x).end()
... | // Ruthless Coding
#include <bits/stdc++.h>
#define uni(x) (x).resize(unique(all(x)) - (x).begin())
#define fprint(v) \
for (auto x : v) \
cout << x << ' '
#define ALL(x) (x).begin(), (x).end()
... | [["-", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 75, 76, 0, 9, 0, 43, 39, 78], ["+", 75, 76, 0, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 12, 22], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 12, 22], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 12, 22]] | 1 | 551 |
n, k = gets.split.map(&:to_i)
puts [n % k, k % (n % k)].min | n, k = gets.split.map(&:to_i)
puts [n % k, k - (n % k)].min | [["-", 3, 4, 0, 652, 486, 516, 0, 738, 17, 109], ["+", 3, 4, 0, 652, 486, 516, 0, 738, 17, 33]] | 4 | 29 |
n,k = gets.split,map(&:to_i)
min = n % k
min = (min - k).abs if min > (min - k).abs
puts min | n,k = gets.split.map(&:to_i)
min = n % k
min = (min - k).abs if min > (min - k).abs
puts min | [["-", 36, 36, 0, 493, 0, 662, 12, 762, 0, 21], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131]] | 4 | 39 |
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
int a, b;
cin >> a >> b;
if (a % b == 0)
cout << 0;
else if (a < b)
cout << min(b - a, a);
else
cout << min(abs(b - (a % b)), a % b);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int32_t main() {
long long a, b;
cin >> a >> b;
if (a % b == 0)
cout << 0;
else if (a < b)
cout << min(b - a, a);
else
cout << min(abs(b - (a % b)), a % b);
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 77 |
// Mahir Ratanpara (DA-IICT)
#include <bits/stdc++.h>
using namespace std;
#define Ff(i, a, n) for (i = a; i < n; i++)
#define Fr(i, a, n) for (i = a; i > n; i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#defi... | // Mahir Ratanpara (DA-IICT)
#include <bits/stdc++.h>
using namespace std;
#define Ff(i, a, n) for (i = a; i < n; i++)
#define Fr(i, a, n) for (i = a; i > n; i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#defi... | [["-", 0, 16, 12, 2, 3, 4, 0, 2, 63, 22], ["-", 12, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 12, 22], ["-", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["+", 12, 2, 3, 4, 0, 16, 12, 16, 31, 22], ["+", 12, 2, 3, 4, 0, 16, 12, 16, 1... | 1 | 379 |
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#define LINE_BUF_SIZE 1024
int main(void) {
int i;
long long int N, K;
long long int t = 0;
scanf("%d %d", &N, &K);
t = N % K;
if (t >= K - t) {
printf("%d", K - t);
} else {
printf("%d", t);
}
return 0;
} | #include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#define LINE_BUF_SIZE 1024
int main(void) {
int i;
long long int N, K;
long long int t = 0;
scanf("%lld %lld", &N, &K);
t = N % K;
if (t >= K - t) {
printf("%lld", K - t);
} else {
printf("%lld", t);
}
return 0;
} | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 90 |
N, K = map(int, input().split())
ans = N
x = abs(x - K * max(x // K, 1))
while ans > x:
ans = x
x = abs(x - K * max(x // K, 1))
print(ans) | N, K = map(int, input().split())
ans = N
x = abs(N - K * max(N // K, 1))
while ans > x:
ans = x
x = abs(x - K * max(x // K, 1))
print(ans) | [["-", 0, 662, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 12, 657, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 12, 657, 12, 652, 3, 4, 0, 657, 31, 22]] | 5 | 65 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K, x, y;
cin >> N >> K;
x = N % K;
y = K - x;
if (x > y)
cout << y << endl;
else
cout << x << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N, K, x, y;
cin >> N >> K;
x = N % K;
y = K - x;
if (x > y)
cout << y << endl;
else
cout << x << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]] | 1 | 58 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
final long N = in.nextLong();
final long K = in.nextLong();
if (N < K)
System.out.println(Math.min(N, N - K));
else {
long mod = N % K;
System.out.println((mod ==... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
final long N = in.nextLong();
final long K = in.nextLong();
if (N < K)
System.out.println(Math.min(N, K - N));
else {
long mod = N % K;
System.out.println((mod ==... | [["-", 3, 4, 0, 492, 3, 4, 0, 16, 31, 22], ["-", 3, 4, 0, 492, 3, 4, 0, 16, 17, 33], ["+", 3, 4, 0, 492, 3, 4, 0, 16, 17, 33], ["+", 3, 4, 0, 492, 3, 4, 0, 16, 12, 22]] | 3 | 122 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
if (n > k) {
if (n % k > k - n % k)
cout << k - n % k << endl;
else
cout << n % k << endl;
} else if (n == k)
cout << n << endl;
else {
if (k - n < n)
cout << k - n << endl;
else
... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
if (n > k) {
if (n % k > k - n % k)
cout << k - n % k << endl;
else
cout << n % k << endl;
} else if (n == k)
cout << 0 << endl;
else {
if (k - n < n)
cout << k - n << endl;
else
... | [["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13]] | 1 | 102 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (n >= k) {
int amari;
amari = n % k;
if (abs(amari - k) < amari)
cout << abs(amari - k) << endl;
else
cout << amari << endl;
} else {
if (k - n < n)
cout << k - n << endl;
else
... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
if (n >= k) {
long long amari;
amari = n % k;
if (abs(amari - k) < amari)
cout << abs(amari - k) << endl;
else
cout << amari << endl;
} else {
if (k - n < n)
cout << k - n << endl;
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 64, 9, 0, 43, 39, 40], ["+", 0, 57, 64, 9, 0, 43, 39, 86, 0, 96]] | 1 | 95 |
inp=[int(x) for x in input().split()]
n,k=inp[0],inp[1]
if n>k:
print(n%k,k-n%k)
elif n<k:
print(min(n,k-n))
else:
print(0) | inp=[int(x) for x in input().split()]
n,k=inp[0],inp[1]
if n>k:
print(min(n%k,k-n%k))
elif n<k:
print(min(n,k-n))
else:
print(0) | [["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 70 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (a > b) {
a %= b;
}
if (a > b / 2) {
a = b - a;
}
cout << a;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b;
cin >> a >> b;
if (a > b) {
a %= b;
}
if (a > b / 2) {
a = b - a;
}
cout << a;
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 58 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
int ans = min(N % K, K - (N % K));
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
long long ans = min(N % K, K - (N % K));
cout << ans << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 47 |
import java.io.*;
import java.util.*;
public class Main implements Runnable {
long m = (int)1e9 + 7;
PrintWriter rw;
ArrayList<Integer> prime;
boolean is_prime[];
InputReader sc;
public void run() {
sc = new InputReader(System.in);
rw = new PrintWriter(System.out);
long n = sc.nextInt();
... | import java.io.*;
import java.util.*;
public class Main implements Runnable {
long m = (int)1e9 + 7;
PrintWriter rw;
ArrayList<Integer> prime;
boolean is_prime[];
InputReader sc;
public void run() {
sc = new InputReader(System.in);
rw = new PrintWriter(System.out);
long n = sc.nextLong();
... | [["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]] | 3 | 2,081 |
#include <cmath>
#include <iostream>
int main() {
using namespace std;
int N, K;
cin >> N >> K;
int t = N % K;
// cout << t;
int tmp = abs(t - K);
if (tmp <= t)
cout << tmp;
else
cout << t;
return 0;
} | #include <cmath>
#include <iostream>
int main() {
using namespace std;
long long int N, K;
cin >> N >> K;
long long int t = N % K;
// cout << t;
long long int tmp = abs(t - K);
if (tmp <= t)
cout << tmp;
else
cout << t;
return 0;
} | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 61 |
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, k;
cin >> n >> k;
cout << min(k - n % k, n % k) << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main(void) {
long long n, k;
cin >> n >> k;
cout << min(k - n % k, n % k) << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 41 |
#include <iostream>
using namespace std;
int main() {
int n;
int k;
cin >> n >> k;
cout << min(n % k, k - n % k);
}
| #include <iostream>
using namespace std;
int main() {
long long n;
long long k;
cin >> n >> k;
cout << min(n % k, k - n % k);
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 39 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
if (n > k)
n %= k;
cout << max(k - n, n);
}
| #include <algorithm>
#include <iostream>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
if (n > k)
n %= k;
cout << min(k - n, n);
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 2, 63, 22]] | 1 | 46 |
import java.io.IOException;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
long n = in.nextInt();
long k = in.nextInt();
if (n > k) {
n = n % k;
}
System.out.println(k - n > n ? n : k - n);
}
} | import java.io.IOException;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
long n = in.nextLong();
long k = in.nextLong();
if (n > k) {
n = n % k;
}
System.out.println(k - n > n ? n : k - n);
}
... | [["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]] | 3 | 95 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, t;
cin >> n >> k;
t = n % k;
cout << min(t, k - t);
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, k, t;
cin >> n >> k;
t = n % k;
cout << min(t, k - t);
} | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 42 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
int main() {
int N, K;
cin >> N >> K;
int a = N % K;
cout << min(a, K - a) << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
int main() {
long long N, K;
cin >> N >> K;
long long a = N % K;
cout << min(a, K - a) << endl;
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 54 |
n,k=map(int,input().split())
m=n%k
d=abs(m-k)
if m<k:
print(m)
else:
print(k)
| n,k=map(int,input().split())
m=n%k
d=abs(m-k)
if d<m:
print(d)
else:
print(m)
| [["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 44 |
N,K=map(int,input().split())
if K==1:
if N==0:
print("1")
else:
print("0")
if N > K :
N-=(N//K)*K
if abs(K-N) < N:
print(abs(K-N))
else:
print(N) | N,K=map(int,input().split())
if K==1:
if N==0:
print("1")
exit()
else:
print("0")
exit()
if N > K :
N-=(N//K)*K
if abs(K-N) < N:
print(abs(K-N))
else:
print(N) | [["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24]] | 5 | 79 |
import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n, k, i, t;
n = sc.nextInt();
k = sc.nextInt();
i = n % k;
t = Math.abs(k - i);
if (i > t) {
i = t;
}
System.out.println(i);
}
}
| import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
long n, k, i, t;
n = sc.nextLong();
k = sc.nextLong();
i = n % k;
t = Math.abs(k - i);
if (i > t) {
i = t;
}
System.out.println(i);
}
}
| [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 492, 141, 22]] | 3 | 97 |
N,K=map(int,input().split())
po=(N//K+1)*N-N
ne=N//K
print(min(po,ne))
| N,K=map(int,input().split())
po=(N//K+1)*K-N
ne=N%K
print(min(po,ne))
| [["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 22], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 12, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 676], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109]] | 5 | 43 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int sup = n % k;
cout << min(sup, k - sup) << endl;
return (0);
}
| #include <algorithm>
#include <iostream>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
long long sup = n % k;
cout << min(sup, k - sup) << endl;
return (0);
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 50 |
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt(), k = scan.nextInt();
if (n == 0 || k == 0) {
System.out.println(n);
} else if (n < k) {
System.out.println(Math.min(n, k - n));
} els... | import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
long n = scan.nextLong(), k = scan.nextLong();
if (n == 0 || k == 0) {
System.out.println(n);
} else if (n < k) {
System.out.println(Math.min(n, k - n));
} ... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]] | 3 | 127 |
#include <cmath>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
int N, K;
cin >> N >> K;
if (N % K == 0) {
cout << 0 << endl;
} else {
cout << min(N % K, K - N % K) << endl;
}
return 0;
} | #include <cmath>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
long long N, K;
cin >> N >> K;
if (N % K == 0) {
cout << 0 << endl;
} else {
cout << min(N % K, K - N % K) << endl;
}
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 72 |
// Replacing Integer
// xとxをKの差の絶対値で置き換える
//最小かどうかの判断が難しい
//どのタイミングで止めればいい?
//自力で解くのに失敗
//得たもの->答えを絞り込めたら、どうにかして数式化できないか
//考察する
#include <iostream>
using namespace std;
int main() {
int x, k;
cin >> x;
cin >> k;
int ans = 0;
ans = min(x % k, k - (x % k));
cout << ans;
}
| // Replacing Integer
// xとxをKの差の絶対値で置き換える
//最小かどうかの判断が難しい
//どのタイミングで止めればいい?
//自力で解くのに失敗
//得たもの->答えを絞り込めたら、どうにかして数式化できないか
//考察する
#include <iostream>
using namespace std;
int main() {
long long x, k;
cin >> x;
cin >> k;
long long ans = 0;
ans = min(x % k, k - (x % k));
cout << ans;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 58 |
// https://codeforces.com/contest/988/problem/A
// BROWNIE TK
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define pb pu... | // https://codeforces.com/contest/988/problem/A
// BROWNIE TK
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define pb pu... | [["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 421 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N = sc.nextInt();
long K = sc.nextInt();
if (N % K < K - N % K) {
System.out.println(N % K);
} else {
System.out.println(K - N % K);
}
}
} | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N = sc.nextLong();
long K = sc.nextLong();
if (N % K < K - N % K) {
System.out.println(N % K);
} else {
System.out.println(K - N % K);
}
}
} | [["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]] | 3 | 94 |
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
int a, b;
a = N % K;
b = K - a;
if (a < b) {
cout << a << endl;
} else {
cout << b << endl;
}
}
| #include <algorithm>
#include <iostream>
using namespace std;
int main() {
long N, K;
cin >> N >> K;
long a, b;
a = N % K;
b = K - a;
if (a < b) {
cout << a << endl;
} else {
cout << b << endl;
}
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 65 |
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
//#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a), i##formax = (b); i < i##formax; i++)
typedef long long ll;
int main() {
int N, K;
cin >> N >> K;
int mod = N % K;
i... | #include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
//#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a), i##formax = (b); i < i##formax; i++)
typedef long long ll;
int main() {
ll N, K;
cin >> N >> K;
ll mod = N % K;
if ... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 85], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]] | 1 | 81 |
n,k = map(int,input().split())
if n<=(k/2):
print(n)
n = n - (n//k)*k
if n<= k/2:
print(n)
else:
print(abs(n-k))
| n,k = map(int,input().split())
if n<=(k/2):
print(n)
else:
n = n - (n//k)*k
if n<= k/2:
print(n)
else:
print(abs(n-k))
| [["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]] | 5 | 62 |
##161 C
N,M= map(int, input().split())
amari= N % M
if(amari<=(N/2)):
print(amari)
else:
amari = amari-M
print(amari)
| ##161 C
N,M= map(int, input().split())
amari= N % M
if(amari<=(M/2)):
print(amari)
else:
amari = abs(amari-M)
print(amari)
| [["-", 15, 23, 0, 666, 0, 23, 0, 657, 31, 22], ["+", 15, 23, 0, 666, 0, 23, 0, 657, 31, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 48 |
#include <algorithm>
#include <iostream>
#include <numeric>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
int t, t2;
if (N > K) {
t = N % K;
t2 = K - t;
} else {
t = N;
t2 = K - N;
}
if (t > t2) {
cout << t2 << endl;
}... | #include <algorithm>
#include <iostream>
#include <numeric>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
long t, t2;
if (N > K) {
t = N % K;
t2 = K - t;
} else {
t = N;
t2 = K - N;
}
if (t > t2) {
cout << t2 << en... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 95 |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ll n, k;
scanf("%d %d", &n, &k);
if (n > k) {
ll ans = n - k;
ll ans1 = ans / k;
n = n - (ans1 * k);
for (int i = 0; i < 100000; i++) {
n = min(n, abs(n - k));
}
} else {
for (int i = 0; i < 100000; i... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ll n, k;
scanf("%lld %lld", &n, &k);
if (n > k) {
ll ans = n - k;
ll ans1 = ans / k;
n = n - (ans1 * k);
for (int i = 0; i < 100000; i++) {
n = min(n, abs(n - k));
}
} else {
for (int i = 0; i < 10000... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 141 |
n,k =[int(x) for x in input().split()]
pre_value = n+1
tmp = n
a = n / k
tmp = n - a*k
while tmp < pre_value:
pre_value = tmp
tmp = abs( tmp - k)
print(pre_value) | n,k =[int(x) for x in input().split()]
pre_value = n+1
tmp = n
a = n // k
tmp = n - a*k
while tmp < pre_value:
pre_value = tmp
tmp = abs( tmp - k)
print(pre_value) | [["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 676]] | 5 | 60 |
#include <bits/stdc++.h>
using namespace std;
using uli = unsigned long int;
using lli = long long int;
#define rep(i, x) for (int i = 0; i < x; i++)
#define repn(i, x) for (int i = 1; i <= x; i++)
#define repa(a, i, x) for (int i = a; i <= x; i++)
int main() {
lli N, K;
cin >> N >> K;
if (N < K) {
if (N... | #include <bits/stdc++.h>
using namespace std;
using uli = unsigned long int;
using lli = long long int;
#define rep(i, x) for (int i = 0; i < x; i++)
#define repn(i, x) for (int i = 1; i <= x; i++)
#define repa(a, i, x) for (int i = a; i <= x; i++)
int main() {
lli N, K;
cin >> N >> K;
if (N < K) {
if (N... | [["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33]] | 1 | 141 |
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
class func {
private:
long long int c;
long long int d;
public:
long long int kei(long long int a, long long int b);
long long int ans;
func();
};
inline func::func() {
c = 0;
d = 0;
ans = 0;
}
inline long long int func::k... | #include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
class func {
private:
long long int c;
long long int d;
public:
long long int kei(long long int a, long long int b);
long long int ans;
func();
};
inline func::func() {
c = 0;
d = 0;
ans = 0;
}
inline long long int func::k... | [["-", 8, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]] | 1 | 160 |
N,K=mapp(int,input().split())
print(min(N%K,abs(N%K-K)))
| N,K=map(int,input().split())
print(min(N%K,abs(N%K-K))) | [["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22]] | 5 | 34 |
#include <stdio.h>
int main() {
int n, k, a;
scanf("%d%d", &n, &k);
a = n % k;
if (a < k - a) {
printf("%d\n", a);
} else {
printf("%d\n", (k - a));
}
return 0;
}
| #include <stdio.h>
int main() {
long long n, k, a;
scanf("%lld%lld", &n, &k);
a = n % k;
if (a < k - a) {
printf("%lld\n", a);
} else {
printf("%lld\n", (k - a));
}
return 0;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 74 |
// By Atul Rathore
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(n) for (int i = 0; i < n; i++)
#define p(x) cout << x << endl;
#define fastio \
ios::sync_with_stdio(false); ... | // By Atul Rathore
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(n) for (int i = 0; i < n; i++)
#define p(x) cout << x << endl;
#define fastio \
ios::sync_with_stdio(false); ... | [["-", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22]] | 1 | 65 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main(void) {
int N, K;
cin >> N >> K;
int ans = min(N % K, abs(N % K - K));
cout << ans << endl;
return 0;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main(void) {
long N, K;
cin >> N >> K;
long ans = min(N % K, abs(N % K - K));
cout << ans << endl;
return 0;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 60 |
n,k = map(int,input().split())
print(min(n%k,(k-(n&k))%k)) | n,k = map(int,input().split())
print(min(n%k,(k-(n%k))%k)) | [["-", 31, 23, 0, 657, 12, 23, 0, 657, 17, 67], ["+", 31, 23, 0, 657, 12, 23, 0, 657, 17, 109]] | 5 | 37 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K, a;
cin >> N >> K;
a = min(N % K, K - (N % K));
cout << a << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K, a;
cin >> N >> K;
a = min(N % K, K - (N % K));
cout << a << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 48 |
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef priority_queue... | #include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef priority_queue... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78]] | 1 | 502 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.