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 |
|---|---|---|---|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
if (N >= K) {
if (abs(N % K - N) < N % K) {
cout << abs(N % K - K) << endl;
} else {
cout << N % K << endl;
}
}
if (N < K && K <= 2 * N) {
cout << K - N << endl;
}
if (K > 2 * N) {
c... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
if (N >= K) {
if (abs(N % K - K) < N % K) {
cout << abs(N % K - K) << endl;
} else {
cout << N % K << endl;
}
}
if (N < K && K <= 2 * N) {
cout << K - N << endl;
}
if (K > 2 * N) {
c... | [["-", 51, 16, 31, 2, 3, 4, 0, 16, 12, 22], ["+", 51, 16, 31, 2, 3, 4, 0, 16, 12, 22]] | 1 | 111 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define Rep(i, n) for (int i = 1; i <= n; i++)
const ll MOD = 1000000007;
long long modinv(long long a, long long m = MOD) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define Rep(i, n) for (int i = 1; i <= n; i++)
const ll MOD = 1000000007;
long long modinv(long long a, long long m = MOD) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= ... | [["-", 12, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 31, 22], ["-", 3, 4, 0, 16, 12, 23, 0, 16, 17, 33], ["-", 12, 2, 3, 4, 0, 16, 12, 23, 0, 25], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33]] | 1 | 195 |
#include <stdio.h>
int main() {
int n, k;
scanf("%lld%lld", &n, &k);
n = n % k;
if (k - n < n)
printf("%lld", k - n);
else
printf("%lld", n);
} | #include <stdio.h>
int main() {
long long n, k;
scanf("%lld%lld", &n, &k);
n = n % k;
if (k - n < n)
printf("%lld", k - n);
else
printf("%lld", n);
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 0 | 61 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, c;
cin >> n >> k;
c = n % k;
cout << min(c, k - c) << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t n, k, c;
cin >> n >> k;
c = n % k;
cout << min(c, k - c) << endl;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]] | 1 | 44 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, k;
cin >> x >> k;
int ans = min(x % k, abs(k - x % k));
cout << ans << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long x, k;
cin >> x >> k;
long long ans = min(x % k, abs(k - x % 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 | 48 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
long long ans = min(N & K, abs(N % K - 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;
} | [["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 67], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 109], ["-", 49, 50, 51, 2, 3, 4, 0, 2, 63, 22], ["-", 51, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["-", 0, 2, 3, 4, 0, 16, 31, 16, 17, 109], ["+", 51, 2, 3, 4, 0, 16, 12, 16, 31, 22], ["+", 51, 2, 3, 4, 0, 1... | 1 | 50 |
#include <iostream>
using namespace std;
int main() {
long long n, m, k = 1000000000000000001;
cin >> n >> m;
for (int i = 1; i <= 4; i++) {
k = min(n, k);
n = abs(n - m);
}
k = min(n, k);
cout << k;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
long long n, m, k = 1000000000000000001;
cin >> n >> m;
n = n % m;
for (int i = 1; i <= 4; i++) {
k = min(n, k);
n = abs(n - m);
}
k = min(n, k);
cout << k;
return 0;
}
| [["+", 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 | 78 |
// IN THE NAME OF "ALLAH".......
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll n, k;
cin >> n >> k;
ll ans = n % k;
int value = (ans, abs(ans - k));
cout << value << endl;
}
| // IN THE NAME OF "ALLAH".......
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll n, k;
cin >> n >> k;
ll ans = n % k;
ll value = min(ans, abs(ans - k));
cout << value << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22]] | 1 | 54 |
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil
def main():
n, k = map(int, input().split())
if k == 1:
print(0)
sys.exit()
r1 = k % n
r2 = abs(r1 - k)
r = min(r1, r2)
print(r)
if __name__ == '__main__':
main() | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil
def main():
n, k = map(int, input().split())
if k == 1:
print(0)
sys.exit()
r1 = n % k
r2 = abs(r1 - k)
r = min(r1, r2)
print(r)
if __name__ == '__main__':
main()
| [["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 109], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]] | 5 | 90 |
N, K = map(int, input().split())
print(min[N%K,K-N%K]) | N, K = map(int, input().split())
print(min([N%K,K-N%K]))
| [["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 31 |
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,avx2,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
typedef... | #pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,avx2,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
typedef... | [["-", 0, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 31, 22]] | 1 | 126 |
n, k = map(int, input().split())
if n > k:
n %= 4
print(min(n, k - n)) | n, k = map(int, input().split())
if n > k:
n %= k
print(min(n, k - n)) | [["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 22]] | 5 | 35 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
int main(void) {
ll N, K;
cin >> N >> K;
if (K <= N)
N = N / K;
N = min(N, K - N);
cout << N << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
int main(void) {
ll N, K;
cin >> N >> K;
if (K <= N)
N = N % K;
N = min(N, K - N);
cout << N << endl;
return 0;
}
| [["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 85], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 109]] | 1 | 70 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, k;
int c = 0;
scanf("%lli%lli", &n, &k);
if (abs(n % k - k) > k)
printf("%lli\n", k);
else
cout << abs(n % k - k) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, k;
int c = 0;
scanf("%lli%lli", &n, &k);
if (abs(n % k - k) > n % k)
printf("%lli\n", n % k);
else
cout << abs(n % k - k) << endl;
}
| [["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 109], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 17, 109]] | 1 | 74 |
#include <bits/stdc++.h>
using namespace std;
#define maxn (int)1e5 + 1000
typedef long long ll;
int main() {
ll n, k;
cin >> n >> k;
if (n > k)
n %= k;
ll minn = n;
int t = 100000;
while (t--) {
n = abs(n - k);
minn = min(minn, n);
}
cout << n << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define maxn (int)1e5 + 1000
typedef long long ll;
int main() {
ll n, k;
cin >> n >> k;
if (n > k)
n %= k;
ll minn = n;
int t = 100000;
while (t--) {
n = abs(n - k);
minn = min(minn, n);
}
cout << minn << endl;
}
| [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 82 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, s, m, t;
cin >> n >> k;
if (k == 0) {
cout << n << "\n";
} else if (n >= k && k != 0) {
s = n / k;
t = n - (s * k);
m = abs(t - k);
if (m < t) {
cout << m << "\n";
} else
cout << t << "\n";
} else if (k >=... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k, s, m, t;
cin >> n >> k;
if (k == 0) {
cout << n << "\n";
} else if (n >= k && k != 0) {
s = n / k;
t = n - (s * k);
m = abs(t - k);
if (m < t) {
cout << m << "\n";
} else
cout << t << "\n";
} else if... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 154 |
N,K=map(int,input().split())
if N==K:
print(0)
elif N<K:
lis1=[N,abs(N-K)]
print(min(lis))
else:
lis2=[N%K,abs(N%K-K)]
print(min(lis2))
| N,K=map(int,input().split())
if N==K:
print(0)
elif N<K:
lis1=[N,abs(N-K)]
print(min(lis1))
else:
lis2=[N%K,abs(N%K-K)]
print(min(lis2))
| [["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]] | 5 | 74 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
long long n, k;
cin >> n >> k;
cout << min(n - k, k - (n % k));
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
long long n, k;
cin >> n >> k;
cout << min(n % k, k - (n % k));
} | [["-", 0, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 17, 109]] | 1 | 49 |
N,K = map(int,input().split())
print(min(N % K,K-t)) | N,K = map(int,input().split())
print(min(N % K,K-N % K)) | [["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 17, 109], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 12, 22]] | 5 | 29 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define PI 3.14159265358979323846264338327950L
using namespace std;
using P = pair<int, int>;
using ll = long long;
using namespace std;
char in[120];
pair<pair<string, int>, int> p[110];
int main() {
int n, k;
cin >> n >> k;
int mini;
mi... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define PI 3.14159265358979323846264338327950L
using namespace std;
using P = pair<int, int>;
using ll = long long;
using namespace std;
char in[120];
pair<pair<string, int>, int> p[110];
int main() {
ll n, k;
cin >> n >> k;
ll mini;
mini... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 103 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b;
cout << min(b - (a % b), a % b) << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b;
cin >> a >> b;
cout << min(b - (a % b), a % b) << endl;
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22]] | 1 | 47 |
n, k = map(int,input().split())
x1 = n%k
x2 = k - x1
print(min[x1, x2]) | n, k = map(int,input().split())
x1 = n%k
x2 = k - x1
print(min(x1, x2))
| [["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 35 |
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
int mod;
cin >> mod;
int remainder = N % mod;
cout << to_string(min(remainder, abs(remainder - mod))) << endl;
} | #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
long long int N;
cin >> N;
long long int mod;
cin >> mod;
long long int remainder = N % mod;
cout << to_string(min(remainder, abs(remainder - mod))) << endl;
} | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 56 |
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = a; i < (ll)(b); i++)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
using namespace std;
u... | #include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = a; i < (ll)(b); i++)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
using namespace std;
u... | [["-", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22]] | 1 | 402 |
#include <algorithm>
#include <bits/stdc++.h>
#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.141592653589... | #include <algorithm>
#include <bits/stdc++.h>
#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.141592653589... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]] | 1 | 85 |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void swap(int *x, int *y) {
int temp;
temp = *x;
*x = *y;
*y = temp;
}
int gcd(int a, int b) {
if (a < b) {
swap(&a, &b);
}
if (b == 0) {
return a;
}
int r = a % b;
while (r != 0) {
a = b;
b = r;
r ... | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void swap(int *x, int *y) {
int temp;
temp = *x;
*x = *y;
*y = temp;
}
int gcd(int a, int b) {
if (a < b) {
swap(&a, &b);
}
if (b == 0) {
return a;
}
int r = a % b;
while (r != 0) {
a = b;
b = r;
r ... | [["-", 0, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 0, 9, 0, 57, 15, 23, 0, 16, 17, 18], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 416 |
#include <stdio.h>
int main() {
long long int n, k, a;
scanf("%lld%lld", &n, &k);
if (n > k) {
a = n % k;
if (a >= k - a)
n = a;
else
n = k - a;
} else if (n < k) {
if (n > k - n)
n = k - n;
} else {
n = 0;
}
printf("%lld", n);
return 0;
} | #include <stdio.h>
int main() {
long long int n, k, a;
scanf("%lld%lld", &n, &k);
if (n > k) {
a = n % k;
if (a <= k - a)
n = a;
else
n = k - a;
} else if (n < k) {
if (n > k - n)
n = k - n;
} else {
n = 0;
}
printf("%lld", n);
return 0;
} | [["-", 64, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 64, 9, 0, 57, 15, 23, 0, 16, 17, 19]] | 0 | 105 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#pragma warning(disable : 4996)
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
int main() {
int N, K;
cin >> N >> K;
int a = N % K;
int b = fabs(a - K);... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#pragma warning(disable : 4996)
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
int main() {
ll N, K;
cin >> N >> K;
ll a = N % K;
ll b = fabs(a - K);
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 92 |
N, K = map(int, input().split())
ans = min(N % K, N - N % K) | N, K = map(int, input().split())
ans = min(N % K, K - N % K)
print(ans) | [["-", 0, 662, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 30 |
#include <stdio.h>
int main() {
long long x, N, K;
scanf("%d %d", &N, &K);
x = N % K;
if (x > K - x)
x = K - x;
printf("%d\n", x);
return 0;
} | #include <stdio.h>
int main() {
long long x, N, K;
scanf("%lld %lld", &N, &K);
x = N % K;
if (x > K - x)
x = K - x;
printf("%lld\n", x);
return 0;
} | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 62 |
#include <stdio.h>
int main(void) {
int N, K;
scanf("%d%d", &N, &K);
if (N % K < (K - N % K))
printf("%d\n", N % K);
else
printf("%d\n", K - N % K);
return 0;
} | #include <stdio.h>
int main(void) {
long int N, K;
scanf("%ld%ld", &N, &K);
if (N % K < (K - N % K))
printf("%ld\n", N % K);
else
printf("%ld\n", 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], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 71 |
//#pragma GCC optimize "trapv"
//-D_GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define ii pair<int, int>
#define Max 100000 + 5
#define IO ... | //#pragma GCC optimize "trapv"
//-D_GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define ii pair<int, int>
#define Max 100000 + 5
#define IO ... | [["-", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 109], ["-", 0, 57, 64, 1, 0, 2, 3, 4, 0, 25]] | 1 | 760 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unorde... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unorde... | [["-", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22]] | 1 | 447 |
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main() {
int N, K;
scanf("%d%d", &N, ... | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main() {
long long N, K;
scanf("%ld%l... | [["-", 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]] | 1 | 85 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#incl... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#incl... | [["-", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22]] | 1 | 1,583 |
n, k = map(int, input().split())
ans = min(n % k, k - abs(n - k))
print(ans) | n, k = map(int, input().split())
ans = min(n % k, k - n % k)
print(ans) | [["-", 12, 652, 3, 4, 0, 657, 12, 652, 63, 22], ["-", 3, 4, 0, 657, 12, 652, 3, 4, 0, 24], ["-", 0, 657, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 12, 652, 3, 4, 0, 657, 12, 657, 17, 109], ["-", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25]] | 5 | 37 |
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T = 1;
// cin >> T;
while (T--) {
int n, k;
cin >> n >> k;
int ans = min(n / k, k - n / k);
cout << ans << '\n';
}
return 0;... | // Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T = 1;
// cin >> T;
while (T--) {
int n, k;
cin >> n >> k;
int ans = min(n % k, k - n % k);
cout << ans << '\n';
}
return 0;... | [["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 85], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 17, 109], ["-", 51, 2, 3, 4, 0, 16, 12, 16, 17, 85], ["+", 51, 2, 3, 4, 0, 16, 12, 16, 17, 109]] | 1 | 88 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (N % K > K - N % K) {
cout << K - N % K << endl;
} else {
cout << N % K << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
if (N % K > K - N % K) {
cout << K - N % K << endl;
} else {
cout << N % K << endl;
}
} | [["-", 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() {
long long N, K;
cin >> N >> K;
long long NNN;
if (N == 0 || N % K == 0) {
cout << 0 << endl;
} else {
NNN = N % K;
cout << min(K, abs(NNN - K)) << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
long long NNN;
if (N == 0 || N % K == 0) {
cout << 0 << endl;
} else {
NNN = N % K;
cout << min(NNN, abs(NNN - K)) << endl;
}
} | [["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 22]] | 1 | 73 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
const double PI = 3.14159265359;
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define INF 1000000000000
#define pb push_back
#define pf push_front
#d... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int mod = 1000000007;
const double PI = 3.14159265359;
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define INF 1000000000000
#define pb push_back
#define pf push_front
#d... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22]] | 1 | 355 |
N, K = map(int, input().split())
if N >= K:
A = N//K
B = N - A*K
print(min([B, abs(B-K)]))
else:
if K >= 2:
print(N)
else:
print(abs(N-K)) | N, K = map(int, input().split())
if N >= K:
A = N//K
B = N - A*K
print(min([B, abs(B-K)]))
else:
if K >= 2*N:
print(N)
else:
print(abs(N-K)) | [["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 48], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22]] | 5 | 71 |
#include <bits/stdc++.h>
typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;
using namespace std;
#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)
int main() {
i64 n, k;
cin >> n >> k;
i64... | #include <bits/stdc++.h>
typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;
using namespace std;
#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)
int main() {
i64 n, k;
cin >> n >> k;
i64... | [["+", 64, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 16, 12, 16, 12, 16, 17, 85], ["-", 0, 1, 0, 16, 12, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]] | 1 | 98 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k, x;
cin >> n >> k;
if (n < k)
x = k % n;
else
x = n % k;
if (n != k)
cout << min(x, k - x) << endl;
else
cout << 0 << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k, x;
cin >> n >> k;
if (n < k)
x = n;
else
x = n % k;
if (n != k)
cout << min(x, k - x) << endl;
else
cout << 0 << endl;
} | [["-", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 109]] | 1 | 71 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
typedef long long ll;
typedef long double ld;
#define PI 3.14159265358979... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
typedef long long ll;
typedef long double ld;
#define PI 3.14159265358979... | [["-", 49, 50, 51, 16, 12, 23, 0, 2, 63, 22], ["-", 51, 16, 12, 23, 0, 2, 3, 4, 0, 24], ["-", 12, 23, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 12, 23, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 51, 16, 12, 23, 0, 2, 3, 4, 0, 25]] | 1 | 136 |
#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;
typedef long long ll;
int main() {
ll N, K;
cin >> N >> K;
cout << min(N % K, K - N % K) << 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 | 40 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fo(a, b) for (int a = 0; a < b; a++)
#define Sort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#defin... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fo(a, b) for (int a = 0; a < b; a++)
#define Sort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#defin... | [["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 67], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109]] | 1 | 3,083 |
#include <algorithm>
#include <iostream>
#define ll long long int
using namespace std;
int main() {
ll n, k;
cin >> n >> k;
cout << max(k - n % k, n % k);
}
| #include <algorithm>
#include <iostream>
#define ll long long int
using namespace std;
int main() {
ll n, k;
cin >> n >> k;
cout << min(k - n % k, n % k);
}
| [["-", 8, 9, 0, 1, 0, 16, 12, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 2, 63, 22]] | 1 | 43 |
N, K = map(int, input().split())
"""
while N > K:
N = abs(N - K)
#print(N)
print(min(N, abs(N-K)))
"""
m = -(-N//K)
print(min(N - m*K, -(N - (m+1)*K)))
"""
print(min(N%K, abs(N%K - K)))
""" | N, K = map(int, input().split())
"""
while N > K:
N = abs(N - K)
#print(N)
print(min(N, abs(N-K)))
"""
m = N//K
print(min(N - m*K, -(N - (m+1)*K)))
"""
print(min(N%K, abs(N%K - K)))
""" | [["-", 0, 656, 0, 1, 0, 662, 12, 664, 17, 33], ["-", 0, 1, 0, 662, 12, 664, 28, 23, 0, 24], ["-", 12, 664, 28, 23, 0, 657, 31, 664, 17, 33], ["-", 0, 1, 0, 662, 12, 664, 28, 23, 0, 25]] | 5 | 55 |
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
int main() {
int n, k;
cin >> n >> k;
int a;
a = n % k;
if ((k - a) <= a) {
a = k - a... | #include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
int main() {
long long n, k;
cin >> n >> k;
long long a;
a = n % k;
if ((k - a) < a) {
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 80 |
// 200520_16:40-
#include <bits/stdc++.h>
using namespace std;
void solve(long long &N, long long &K) {
long long n0;
long long n1;
long long a_n0, a_n1;
n0 = floor(N / K + 1);
n1 = n0 + 1;
a_n0 = N - K * (n0 - 1);
a_n1 = abs(N - K * (n1 - 1));
cout << ((a_n0 <= a_n1) ? a_n0 : a_n1) << endl;
}
// Gen... | // 200520_16:40-
#include <bits/stdc++.h>
using namespace std;
void solve(long long &N, long long &K) {
long long n0;
long long n1;
long long a_n0, a_n1;
n0 = N / K + 1;
n1 = n0 + 1;
a_n0 = N - K * (n0 - 1);
a_n1 = abs(N - K * (n1 - 1));
cout << ((a_n0 <= a_n1) ? a_n0 : a_n1) << endl;
}
// Generated ... | [["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25]] | 1 | 143 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
cout << min(n % k, k - n % k) << endl;
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) << endl;
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;
int main() {
int a, b;
cin >> a >> b;
cout << min(a % b, b - a % b);
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long a, b;
cin >> a >> b;
cout << min(a % b, b - a % b);
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 38 |
N, K = map(int, input().split())
res = 0
if N % K == 0:
res = 0
elif N % K > 2 / K:
res = K - (N % K)
else:
res = N % K
print(res)
| N, K = map(int, input().split())
res = 0
if N % K == 0:
res = 0
elif N % K > K / 2:
res = K - (N % K)
else:
res = N % K
print(res)
| [["-", 0, 57, 75, 665, 15, 666, 0, 657, 31, 612], ["-", 0, 57, 75, 665, 15, 666, 0, 657, 17, 85], ["+", 0, 57, 75, 665, 15, 666, 0, 657, 17, 85], ["+", 0, 57, 75, 665, 15, 666, 0, 657, 12, 612]] | 5 | 58 |
#include <bits/stdc++.h>
using namespace std;
using p = pair<int, int>;
int main() {
long long n, k, ans;
cin >> n >> k;
ans = n % k;
ans = min(ans, k - n);
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using p = pair<int, int>;
int main() {
long long n, k, ans;
cin >> n >> k;
ans = n % k;
ans = min(ans, k - ans);
cout << ans << endl;
return 0;
} | [["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22]] | 1 | 62 |
N, K = gets.chomp.split(" ").map(&:to_i)
one = N % K
another = one % K
puts [one, another].min | N, K = gets.chomp.split(" ").map(&:to_i)
one = N % K
another = (one - K).abs
puts [one, another].min | [["+", 0, 493, 0, 662, 12, 652, 486, 739, 0, 24], ["-", 36, 36, 0, 493, 0, 662, 12, 738, 17, 109], ["+", 0, 662, 12, 652, 486, 739, 0, 738, 17, 33], ["+", 0, 493, 0, 662, 12, 652, 486, 739, 0, 25], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]] | 4 | 38 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define all(x) x.begin(), x.end()
#define rep(i, j, n) for (int i = j; i < (int)(n); i++... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define all(x) x.begin(), x.end()
#define rep(i, j, n) for (int i = j; i < (int)(n); i++... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]] | 1 | 191 |
n,m=map(int,input().split())
ans=0
n%=m
ans=(min(n,k-n))
print(ans)
| n,m=map(int,input().split())
ans=0
n%=m
#print(n,m)
ans=min(n,(m-n))
print(ans) | [["-", 0, 656, 0, 1, 0, 662, 12, 23, 0, 24], ["-", 12, 23, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 23, 0, 24], ["+", 12, 652, 3, 4, 0, 23, 0, 657, 31, 22]] | 5 | 38 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K, sa;
cin >> N >> K;
N %= K;
sa = abs(N - K);
cout << min(N, sa) << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K, sa;
cin >> N >> K;
N %= K;
sa = abs(N - K);
cout << min(N, sa) << endl;
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 52 |
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
retu... | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
retu... | [["+", 0, 11, 12, 2, 3, 4, 0, 2, 63, 22], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["-", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25]] | 1 | 208 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int64_t n, k;
cin >> n >> k;
int64_t p = n / k;
int64_t q = abs(p - k);
cout << min(p, q);
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t n, k;
cin >> n >> k;
int64_t p = n % k;
int64_t q = abs(p - k);
cout << min(p, q);
}
| [["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 85], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109]] | 1 | 49 |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <forward_list>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#define ll long long int... | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <forward_list>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#incl... | [["+", 49, 50, 51, 2, 3, 4, 0, 2, 63, 22], ["+", 51, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["-", 49, 50, 51, 2, 3, 4, 0, 16, 17, 109], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 2, 3, 4, 0, 2, 3, 4, 0, 25]] | 1 | 201 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, x;
cin >> n >> k;
x = min(n % k, k - n % k);
cout << x << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, k, x;
cin >> n >> k;
x = min(n % k, k - n % k);
cout << x << endl;
} | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 46 |
#include <stdio.h>
int main() {
int n, k;
char buff[1000];
if (fgets(buff, sizeof(buff), stdin) != NULL) {
sscanf(buff, "%d%d", &n, &k);
}
n = n % k;
if (k - n >= n) {
printf("%d", n);
return 0;
} else {
printf("%d", k - n);
return 0;
}
}
| #include <stdio.h>
int main() {
long int n, k;
char buff[1000];
if (fgets(buff, sizeof(buff), stdin) != NULL) {
sscanf(buff, "%ld%ld", &n, &k);
}
n = n % k;
if (k - n >= n) {
printf("%ld", n);
return 0;
} else {
printf("%ld", k - n);
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 | 97 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define scd(x) scanf("%lf", &x)
#define l0(i, n) for (ll i = 0; i < n; i++)
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
// CODE TONOY
int n, k;
cin >> n >> k;
cout << min... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define scd(x) scanf("%lf", &x)
#define l0(i, n) for (ll i = 0; i < n; i++)
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
// CODE TONOY
ll n, k;
cin >> n >> k;
cout << (ll)... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 24], ["+", 0, 1, 0, 16, 12, 74, 39, 77, 39, 78], ["+", 8, 9, 0, 1, 0, 16, 12, 74, 0, 25]] | 1 | 87 |
#K = int(input())
N,K = map(int,input().split())
#N = int(input())
#A = list(map(int,input().split()))
flag=True
c=N
if N%K==0:
print(0)
else:
l=N//K
N=l*N
while flag==True:
N=abs(N-K)
if c <= N:
flag=False
else:
c=N
print(c)
| #K = int(input())
N,K = map(int,input().split())
#N = int(input())
#A = list(map(int,input().split()))
flag=True
c=N
if N%K==0:
print(0)
exit()
else:
l=N//K
N-=l*K
while flag==True:
N=abs(N-K)
if c <= N:
flag=False
else:
c=N
print(c)
| [["+", 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], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 110], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22]] | 5 | 78 |
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
int n, k;
cin >> n >> k;
int res = min(n % k, abs(n % k - k));
cout << res << endl;
} | #include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
ll n, k;
cin >> n >> k;
ll res = min(n % k, abs(n % k - k));
cout << res << endl;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 71 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K, a, b;
cin >> N >> K;
a = N % K;
b = -a + K;
cout << min(a, b) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K, a, b;
cin >> N >> K;
a = N % K;
b = -a + K;
cout << min(a, b) << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 51 |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
long int n, k;
scanf("%ld%ld", &n, &k);
if (n % k >= k / 2)
printf("%ld", k - n % k);
else
printf("%ld", n % k);
return 0;
} | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
long int n, k;
scanf("%ld%ld", &n, &k);
if (n % k > k / 2)
printf("%ld", k - n % k);
else
printf("%ld", n % k);
return 0;
} | [["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47]] | 0 | 72 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
int main() {
ll n, k;
cin >> n >> k;
ll a = n % k;
ll b = abs(a - k);
if (a < b)
cout << min(a, b) << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
int main() {
ll n, k;
cin >> n >> k;
ll a = n % k;
ll b = abs(a - k);
cout << min(a, b) << endl;
return 0;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 25]] | 1 | 74 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1000000000; // 10^9
int main(void) {
int N, K;
cin >> N >> K;
ll a = N % K;
ll b = abs(K - a);
cout << min(a, b) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1000000000; // 10^9
int main(void) {
ll N, K;
cin >> N >> K;
ll a = N % K;
ll b = abs(K - a);
cout << min(a, b) << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 64 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; // intじゃ扱えないことに注意!
#define mod 1000000007
#define rep(i, n) \
for (int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意!
int main() {
ll N, K;
cin >> N >> ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; // intじゃ扱えないことに注意!
#define mod 1000000007
#define rep(i, n) \
for (int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意!
int main() {
ll N, K;
cin >> N >> ... | [["-", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 12, 2, 3, 4, 0, 16, 12, 16, 31, 22]] | 1 | 67 |
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
#define MOD (1000000007)
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
ll maxv = max(a, b);
ll minv = min(a, b)... | #include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
#define MOD (1000000007)
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
ll maxv = max(a, b);
ll minv = min(a, b)... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 124 |
#include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int r = n % k;
cout << (k - r > r ? r : k - r) << endl;
return 0;
}
| #include <iostream>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
long long r = n % k;
cout << (k - r > r ? r : k - r) << endl;
return 0;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 51 |
N, K = input().split()
N = int(N)
K = int(K)
middle = N % K
answer = middle
while True:
if abs(answer-k) > N:
answer = N
break
if abs(answer - K) < answer:
answer = abs(answer-K)
else:
break
print(str(answer)) | N, K = input().split()
N = int(N)
K = int(K)
middle = N % K
answer = middle
while True:
if abs(answer-K) > N:
answer = N
break
if abs(answer - K) < answer:
answer = abs(answer-K)
else:
break
print(str(answer)) | [["-", 15, 666, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 15, 666, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 76 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, k;
cin >> n >> k;
min(n % k, k - n % k);
} | #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;
} | [["+", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 38 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long k = sc.nextLong();
long diff = Math.abs(n - k);
if (diff == 0) {
System.out.println("0");
return;
}
long a = n % diff;
... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long k = sc.nextLong();
long diff = Math.abs(n - k);
if (diff == 0) {
System.out.println("0");
return;
}
long a = n % k;
lon... | [["-", 8, 196, 0, 503, 49, 200, 51, 16, 12, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 16, 12, 22], ["-", 8, 196, 0, 503, 49, 200, 51, 16, 31, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 16, 31, 22]] | 3 | 116 |
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static void solve() {
long N = ni();
long K = ni();
long t = N ... | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static void solve() {
long N = nl();
long K = nl();
long t = N ... | [["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]] | 3 | 1,807 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
long N = scan.nextInt();
long K = scan.nextInt();
Long m = new Long(N % K);
Long x = new Long(K - m);
if (m.compareTo(x) == 1) {
System.out.println(x);
... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Long N = scan.nextLong();
Long K = scan.nextLong();
Long m = new Long(N % K);
Long x = new Long(K - m);
if (m.compareTo(x) == 1) {
System.out.println(x);
... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["+", 8, 498, 0, 195, 8, 196, 0, 503, 39, 78], ["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]] | 3 | 109 |
#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 a = n % k;
cout << min(a, k - a) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
long long n, k;
cin >> n >> k;
long long a = n % k;
cout << min(a, k - a) << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 51 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Long N, K;
Scanner sc = new Scanner(System.in);
N = sc.nextLong();
K = sc.nextLong();
Long check = Math.min((N % K), Math.abs(-N % K));
System.out.println(check);
}
}
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Long N, K;
Scanner sc = new Scanner(System.in);
N = sc.nextLong();
K = sc.nextLong();
Long check = Math.min((N % K), (-N % K) + K);
System.out.println(check);
}
}
| [["-", 49, 200, 51, 492, 3, 4, 0, 492, 500, 22], ["-", 49, 200, 51, 492, 3, 4, 0, 492, 0, 131], ["-", 49, 200, 51, 492, 3, 4, 0, 492, 141, 22], ["+", 49, 200, 51, 492, 3, 4, 0, 16, 17, 72], ["+", 49, 200, 51, 492, 3, 4, 0, 16, 12, 22]] | 3 | 89 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Long N, K;
Scanner sc = new Scanner(System.in);
N = sc.nextLong();
K = sc.nextLong();
Long check = Math.min((N % K), ((K - N) % K));
System.out.println(check);
}
}
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Long N, K;
Scanner sc = new Scanner(System.in);
N = sc.nextLong();
K = sc.nextLong();
Long check = Math.min((N % K), (K - N % K));
System.out.println(check);
}
}
| [["-", 3, 4, 0, 23, 0, 16, 31, 23, 0, 24], ["-", 3, 4, 0, 23, 0, 16, 31, 23, 0, 25]] | 3 | 89 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N, K;
N = sc.nextLong();
K = sc.nextLong();
System.out.println(Math.min(N % K, (N + K) % K));
}
} | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N, K;
N = sc.nextLong();
K = sc.nextLong();
System.out.println(Math.min(N % K, K - N % K));
}
} | [["-", 0, 492, 3, 4, 0, 16, 31, 23, 0, 24], ["-", 3, 4, 0, 16, 31, 23, 0, 16, 31, 22], ["-", 3, 4, 0, 16, 31, 23, 0, 16, 17, 72], ["-", 0, 492, 3, 4, 0, 16, 31, 23, 0, 25], ["+", 3, 4, 0, 492, 3, 4, 0, 16, 17, 33], ["+", 0, 492, 3, 4, 0, 16, 12, 16, 31, 22]] | 3 | 80 |
n, k = map(int, input().split())
print(min(n % k), (k - (n % k)))
| n, k = map(int, input().split())
print(min((n % k), (k - (n % k))))
| [["+", 3, 4, 0, 652, 3, 4, 0, 23, 0, 24], ["+", 3, 4, 0, 23, 0, 657, 12, 23, 0, 25]] | 5 | 35 |
n,k=map(int,input().split())
a=set()
for i in range(1,100000):
n=n%k
a.add(n)
n=abs(n-k)
a=list(a)
print(a[0]) | n,k=map(int,input().split())
a=set()
for i in range(1,100000):
n=n%k
a.add(n)
n=abs(n-k)
a=list(a)
a.sort()
print(a[0]) | [["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 63 |
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main(void) {
long long N, K;
cin >> N >> K;
N %= K;
while (abs(N - K) < N) {
cout << "N";
N = abs(N - K);
}
cout << N << "\n";
} | #include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main(void) {
long long N, K;
cin >> N >> K;
N %= K;
while (abs(N - K) < N) {
N = abs(N - K);
}
cout << N << "\n";
} | [["-", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 75 |
// INCLUDES
#include <assert.h>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define c1 __builtin_popcount
#define F first
#define S second
#define all(s) begin(s), end(s)
#define MIN3POS(a, b, c) ... | // INCLUDES
#include <assert.h>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define c1 __builtin_popcount
#define F first
#define S second
#define all(s) begin(s), end(s)
#define MIN3POS(a, b, c) ... | [["-", 0, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 31, 22]] | 1 | 411 |
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define maxN 200005
#define mod 1000000007
#define pi 3.14159265358979323846264338327950
void solve() {
ll n, m;
cin >> n >> m;
if (n < m) {
cout << min(n, n % m) << endl;
return;
}
ll temp = n % m;
cout << min(temp, m - temp) ... | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define maxN 200005
#define mod 1000000007
#define pi 3.14159265358979323846264338327950
void solve() {
ll n, m;
cin >> n >> m;
if (n < m) {
cout << min(n, m - n % m) << endl;
return;
}
ll temp = n % m;
cout << min(temp, m - te... | [["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33]] | 1 | 105 |
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ll = long long;
using ld = long double;
using d = double;
int main() {
int t = 1;
// cin>>t;
while (t--) {
lli n;
lli k;
cin >> n >> k;
lli p = n % k;
if (abs(p - k) < k) {
cout << abs(p - k);
} else
... | #include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ll = long long;
using ld = long double;
using d = double;
int main() {
int t = 1;
// cin>>t;
while (t--) {
lli n;
lli k;
cin >> n >> k;
lli p = n % k;
if (abs(p - k) < p) {
cout << abs(p - k);
} else
... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]] | 1 | 98 |
#define _GLIBCXX_DEBUG
#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++)
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
int ans = N % K;
int ans1 = (-1 * N) % K + K;
cout << min(ans, ans1) << endl;
}
| #define _GLIBCXX_DEBUG
#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++)
#include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
long ans = N % K;
long ans1 = (-1 * N) % K + K;
cout << min(ans, ans1) << endl;
}
| [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 74 |
#include <stdio.h>
int main(void) {
long N, K, sa;
scanf("%l %l", &N, &K);
sa = N % K;
if (K - sa > sa)
printf("%l\n", sa);
else
printf("%l\n", K - sa);
return 0;
} | #include <stdio.h>
int main(void) {
long N, K, sa;
scanf("%ld %ld", &N, &K);
sa = N % K;
if (K - sa > sa)
printf("%ld\n", sa);
else
printf("%ld\n", K - sa);
return 0;
} | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 69 |
#include <stdio.h>
int main(void) {
int n, k, s, p;
scanf("%d %d", &n, &k);
s = n % k;
p = k - s;
if (s < p)
printf("%d", s);
else
printf("%d", p);
return 0;
}
| #include <stdio.h>
int main(void) {
long long int n, k, s, p;
scanf("%lld %lld", &n, &k);
s = n % k;
p = k - s;
if (s < p)
printf("%lld", s);
else
printf("%lld", p);
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], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 71 |
n, k = map(int, input().split())
n = n % k
print(min(abs(n - k)), n) | n, k = map(int, input().split())
n = n % k
print(min(abs(n - k), n)) | [["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 35 |
N, K = list(map(int, input().split()))
if N == 0 or N < K:
print(N)
elif N % K == 0:
print("0")
else:
print(min(N % K, K - (N % K)))
| N, K = list(map(int, input().split()))
if N == 0:
print(N)
elif N % K == 0:
print("0")
else:
print(min(N % K, K - (N % K)))
| [["-", 36, 36, 0, 656, 0, 57, 15, 679, 17, 354], ["-", 0, 656, 0, 57, 15, 679, 12, 666, 0, 22], ["-", 0, 656, 0, 57, 15, 679, 12, 666, 667, 18]] | 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 N, K;
cin >> N >> K;
cout << min(N % K, 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 | 42 |
N, K = map(int, input().split())
amari%=K
print(min(amari,abs(amari-k)))
|
N, K = map(int, input().split())
amari=N%K
print(min(amari,abs(amari-K)))
| [["-", 36, 36, 0, 656, 0, 1, 0, 677, 17, 132], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 33 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (N % K == K - (N % K)) {
cout << N % K << endl;
}
if (N % K > K - (N % K)) {
cout << K - (N % K) << endl;
}
if (N % K < K - (N % K)) {
cout << N % K << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
if (N % K == K - (N % K)) {
cout << N % K << endl;
}
if (N % K > K - (N % K)) {
cout << K - (N % K) << endl;
}
if (N % K < K - (N % K)) {
cout << N % K << endl;
}
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 99 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
cout << min(n % k, abs(n % k - k)) << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
cout << min(n % k, abs(n % k - 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 | 46 |
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long ll;
int main(int argc, char *argv[]) {
int n, k;
int left, right;
cin >> n >> k;
... | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long ll;
int main(int argc, char *argv[]) {
ll n, k;
ll left, right;
cin >> n >> k;
le... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 89 |
n,k=map(int,input().split())
print(max(n%k,(k-n%k)%k)) | n,k=map(int,input().split())
print(min(n%k,(k-n%k)%k)) | [["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22]] | 5 | 35 |
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <string>
#include <vector>
using ll = long long;
using namespace std;
typedef std::pair<int, int> ipair;
bool lessPair(const ipair &l, const ipair &r) { return l.second < r.second; }
bool greater... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <string>
#include <vector>
using ll = long long;
using namespace std;
typedef std::pair<int, int> ipair;
bool lessPair(const ipair &l, const ipair &r) { return l.second < r.second; }
bool greater... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 560 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.