problem_id stringlengths 6 6 | language stringclasses 2
values | original_status stringclasses 3
values | original_src stringlengths 19 243k | changed_src stringlengths 19 243k | change stringclasses 3
values | i1 int64 0 8.44k | i2 int64 0 8.44k | j1 int64 0 8.44k | j2 int64 0 8.44k | error stringclasses 270
values | stderr stringlengths 0 226k |
|---|---|---|---|---|---|---|---|---|---|---|---|
p02719 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
long n, k;
cin >> n >> k;
while (n > abs(n - k)) {
n = abs(n - k);
}
cout << n << endl;
return 0;
}
| #include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
cout << min(N % K, K - N % K) << endl;
return 0;
}
| replace | 9 | 15 | 9 | 12 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
// sengen
int n, k;
// nyuryoku
cin >> n >> k;
// keisan
if (n % k == abs(n % k - k)) {
cout << n % k;
} else {
cout << min(n % k, abs(n % k - k));
}
} | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
// sengen
long n, k;
// nyuryoku
cin >> n >> k;
// keisan
if (n % k == abs(n % k - k)) {
cout << n % k;
} else {
cout << min(n % k, abs(n % k - k));
}
} | replace | 6 | 7 | 6 | 7 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
ll N, K;
cin >> N >> K;
N = N % K;
l... | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
ll N, K;
cin >> N >> K;
N = N % K;
l... | replace | 15 | 16 | 15 | 16 | TLE | |
p02719 | C++ | Time Limit Exceeded | /**
* Created by hiramekun at 20:50 on 2020-04-04.
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template <typename T> using pq = priority_queue<T>;
template <typename T> using minpq = priority_q... | /**
* Created by hiramekun at 20:50 on 2020-04-04.
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template <typename T> using pq = priority_queue<T>;
template <typename T> using minpq = priority_q... | replace | 73 | 75 | 73 | 79 | TLE | |
p02719 | C++ | Runtime Error | #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() {
long long n, k;
cin >> n >> k;
cout << min(n % k, k - n % k);
}
| replace | 4 | 5 | 4 | 5 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, k;
cin >> n >> k;
while (n > abs(n - k)) {
n %= k;
}
cout << n << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, k;
cin >> n >> k;
n = n % k;
n = min(n, k - n);
cout << n << endl;
} | replace | 6 | 9 | 6 | 10 | TLE | |
p02719 | C++ | Time Limit Exceeded | //...Bismillahir Rahmanir Rahim...
// Code by Asad Bin Saber
// 04 04 2020
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;
void task() {
long long n, k, i;
cin >> n >> k;
if (n % k == 0) {
cout << '0' << endl;
... | //...Bismillahir Rahmanir Rahim...
// Code by Asad Bin Saber
// 04 04 2020
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
using namespace std;
void task() {
long long n, k, i;
cin >> n >> k;
n = n % k;
while (1) {
if (n == 0)
... | replace | 18 | 29 | 18 | 20 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cassert>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <stdlib.h>
#include <string>
#include <vector>
typedef long long int ll;
using namespace std;
int main() {
ll N, M, a, b;
cin >> N >> M;
if (M == 1) {
cout << 0 <... | #include <algorithm>
#include <cassert>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <stdlib.h>
#include <string>
#include <vector>
typedef long long int ll;
using namespace std;
int main() {
ll N, M, a, b;
cin >> N >> M;
a = N % M;
cout << min(a, a... | replace | 16 | 29 | 16 | 18 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll N, K;
cin >> N >> K;
if (K == 0) {
cout << N << endl;
} else if (K == 1) {
cout << 0 << endl;
} else {
ll ab = abs(N - K);
while (ab < N) {
N = ab;
ab = abs(N - K);
}
cout << N << endl;
}... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll N, K;
cin >> N >> K;
if (K == 0) {
cout << N << endl;
} else if (K == 1) {
cout << 0 << endl;
} else if (N % K == 0) {
cout << 0 << endl;
} else if (N > K) {
ll a = N % K;
if (abs(a - K) < abs(a)) {
... | insert | 11 | 11 | 11 | 20 | TLE | |
p02719 | C++ | Runtime Error | #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;
} | replace | 3 | 4 | 3 | 4 | 0 | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int n, k;
int main() {
cin >> n >> k;
cout << min(n % k, k - n % k) << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
long long n, k;
int main() {
cin >> n >> k;
cout << min(n % k, k - n % k) << endl;
return 0;
} | replace | 4 | 5 | 4 | 5 | 0 | |
p02719 | C++ | Runtime Error | #include <cmath>
#include <iostream>
using namespace std;
int main() {
int x, k, min;
cin >> x >> k;
int a = x % k;
min = fabs(a - k);
if (min > a)
min = a;
cout << min;
}
| #include <cmath>
#include <iostream>
using namespace std;
int main() {
unsigned long int x, k, min, a;
cin >> x;
cin >> k;
a = x % k;
min = k - a;
if (min > a)
min = a;
cout << min;
}
| replace | 5 | 9 | 5 | 10 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ll a = 0, b = 0, n, k;
cin >> n >> k;
if (n > k && n % k == 0) {
cout << 0;
return 0;
} else {
while (b <= a) {
a = n;
n = abs(n - k);
b = n;
}
cout << a;
return 0;
}
}
| #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ll a = 0, b = 0, n, k;
cin >> n >> k;
if (n > k && n % k == 0) {
cout << 0;
return 0;
} else if (n > k && n % k != 0) {
ll t;
t = n % k;
cout << k - t;
return 0;
} else {
while (b <= a) {
a = n;
... | insert | 8 | 8 | 8 | 13 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
int X;
X = N % K;
X = K % X;
cout << X << 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);
}
| replace | 4 | 11 | 4 | 7 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
long long n, k;
int main(void) {
long long ans, t;
scanf("%lld%lld", &n, &k);
if (n % k == 0) {
cout << "0";
return 0;
}
ans = min(n, k);
t = n / k;
t++;
for (int i = 0; i < t; i++) {
n = abs(n - k);
ans = min(ans, n);
}
cout << ans;
} | #include <bits/stdc++.h>
using namespace std;
long long n, k;
int main(void) {
long long ans, t;
scanf("%lld%lld", &n, &k);
if (n % k == 0) {
cout << "0";
return 0;
}
if (n > k)
n %= k;
n = min(n, abs(n - k));
cout << n;
return 0;
} | replace | 11 | 19 | 11 | 16 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
// for getting input from input.txt
freopen("input.txt", "r", stdin);
// for writing output to output.txt
freopen("output.tx... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n, k;
cin >> n >> k;
ll rem = n % k;
cout << min(rem, abs(rem - k));
} | delete | 9 | 16 | 9 | 9 | 0 | |
p02719 | C++ | Runtime Error | #include <iostream>
#include <stdlib.h>
using namespace std;
int N, K, mod, n, a, b;
int main() {
cin >> N >> K;
mod = N % K;
n = (N - mod) / K;
a = abs(N - n * K);
b = abs(N - (n + 1) * K);
if (a < b) {
cout << a;
} else {
cout << b;
}
} | #include <iostream>
#include <stdlib.h>
using namespace std;
long long int N, K, mod, n, a, b;
int main() {
cin >> N >> K;
mod = N % K;
n = (N - mod) / K;
a = abs(N - n * K);
b = abs(N - (n + 1) * K);
if (a < b) {
cout << a;
} else {
cout << b;
}
} | replace | 4 | 5 | 4 | 5 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <cmath>
#include <iostream>
using namespace std;
int main() {
long long n, k, sol;
cin >> n >> k;
if (n % k == 0) {
cout << 0 << '\n';
} else {
sol = abs(n - k);
while (true) {
if (abs(sol - k) < sol) {
sol = abs(sol - k);
continue;
}
break;
}
cout... | #include <cmath>
#include <iostream>
using namespace std;
int main() {
long long n, k, sol;
cin >> n >> k;
if (n % k == 0) {
cout << 0 << '\n';
} else {
if (n > k) {
n -= n / k * k;
}
sol = abs(n - k);
while (true) {
if (abs(sol - k) < sol) {
sol = abs(sol - k);
... | insert | 10 | 10 | 10 | 13 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
while (n > abs(n - k)) {
n = abs(n - k);
}
cout << n << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
long long a = n % k;
long long ans = min(a, k - a);
cout << ans << endl;
}
| replace | 6 | 10 | 6 | 9 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
while (true) {
N = N - K;
if (N <= 0) {
if (0 - N < N + K) {
cout << 0 - N << endl;
break;
} else {
cout << N + K << endl;
break;... | #include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
long long N, K;
cin >> N >> K;
while (true) {
N = N % K - K;
if (N <= 0) {
if (0 - N < N + K) {
cout << 0 - N << endl;
break;
} else {
cout << N + K << endl;
br... | replace | 10 | 11 | 10 | 11 | TLE | |
p02719 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define ill long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
using namespace std;
int main() {
ill n, k;
cin >> n >> k;
if (k != 1) {
cout << n % min(n - k, k);
} else {
cout << 0;
}
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define ill long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
using namespace std;
int main() {
ill n, k;
cin >> n >> k;
ill m = n % k;
cout << min(m, k - m);
} | replace | 12 | 17 | 12 | 14 | 0 | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fo(i, n) for (i = 0; i < n; i++)
#define fok(i, k, n) for (i = k; i < n; i++)
#define ci(x) cin >> x;
#define ci2(x, y) cin >> x >> y;
#define co(x) cout << x << "\n";
#define co2(x, y) cout << x << " " << y << "\n";
#define pb push_back
#d... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fo(i, n) for (i = 0; i < n; i++)
#define fok(i, k, n) for (i = k; i < n; i++)
#define ci(x) cin >> x;
#define ci2(x, y) cin >> x >> y;
#define co(x) cout << x << "\n";
#define co2(x, y) cout << x << " " << y << "\n";
#define pb push_back
#d... | replace | 27 | 34 | 27 | 28 | 0 | |
p02719 | C++ | Runtime Error | #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... | replace | 53 | 54 | 53 | 54 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define INF LLONG_MAX
#define mod 1000000007
typedef long long ll;
int main(void) {
ll N, K;
cin >> N >> K;
if (N % K == 0) {
cout << 0 << end... | #include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define INF LLONG_MAX
#define mod 1000000007
typedef long long ll;
int main(void) {
ll N, K;
cin >> N >> K;
if (N % K == 0) {
cout << 0 << end... | replace | 16 | 22 | 16 | 20 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define um unordered_map
#define F first
#define S second
#define MOD 1000000007
#define TC ... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define um unordered_map
#define F first
#define S second
#define MOD 1000000007
#define TC ... | replace | 23 | 27 | 23 | 27 | 0 | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (N == 0) {
cout << 0 << endl;
return 0;
}
if (N % K < K - N % K)
cout << N % K << endl;
else
cout << K - N % K << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N, K;
cin >> N >> K;
if (N == 0) {
cout << 0 << endl;
return 0;
}
if (N % K < K - N % K)
cout << N % K << endl;
else
cout << K - N % K << endl;
}
| replace | 4 | 5 | 4 | 5 | 0 | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cer... | #include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cer... | replace | 59 | 60 | 59 | 60 | 0 | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;
void solve() {
ll n, k;
cin >> n >> k;
if (k % n != 0) {
ll q = (n + k - 1) / k;
n = abs(n - k * q);
}
cout << n;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
... | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;
void solve() {
ll n, k;
cin >> n >> k;
n %= k;
cout << min(n, k - n);
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
solve();
return 0;
}
| replace | 11 | 16 | 11 | 13 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
int main() {
ll n, k;
cin >> n >> k;
if (k == 1)... | #include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
int main() {
ll n, k;
cin >> n >> k;
if (n > k *... | replace | 14 | 17 | 14 | 16 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
int main() {
ll n, k;
cin >> n >> k;
while (abs(n - k) < n)
n = abs(n - k);
cout << n;
return 0;
} | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
int main() {
ll n, k;
cin >> n >> k;
n = n - k * (n / k);
while (abs(n - k) < n)
n = abs(n - k);
cout << n;
return 0;
} | insert | 13 | 13 | 13 | 14 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n, k;
cin >> n >> k;
ll a = n % k;
ll x = min(a, k - a);
cout << x << endl;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n, k;
cin >> n >> k;
ll a = n % k;
ll x = min(a, k - a);
cout << x << endl;
}
| replace | 5 | 6 | 5 | 6 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
typedef map<int, int> MPII;
typedef set<int> ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
typedef map<int, int> MPII;
typedef set<int> ... | replace | 45 | 49 | 45 | 46 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a, b) make_pair((a), (b))
#define MT(...) make_tuple(__VA_ARGS__)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, x) for (... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a, b) make_pair((a), (b))
#define MT(...) make_tuple(__VA_ARGS__)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, x) for (... | replace | 27 | 29 | 27 | 29 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main() {
long long n, m;
cin >> n >> m;
if (n % m == 0) {
cout << 0 << endl;
return 0;
}
long long fff = n % m;
long long ans = n;
for (int i = 0; i < n % m; i++) {
fff = fff - m;
if (fff < 0)
fff = fff * -1;
ans = min(ans, fff);
}
... | #include <iostream>
using namespace std;
int main() {
long long n, m;
cin >> n >> m;
long long k = n % m;
long long j = m - k;
if (k < 0)
k = k * -1;
if (j < 0)
j = j + -1;
cout << min(k, j) << endl;
}
| replace | 6 | 19 | 6 | 13 | TLE | |
p02719 | C++ | Runtime Error | #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;
} | replace | 6 | 7 | 6 | 7 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int abs(int a, int b) {
if (a < b) {
return b - a;
} else {
return a - b;
}
}
int main() {
long long n, k;
cin >> n >> k;
set<int> S;
long long f;
if (k == 1) {
cout << 0 << endl;... | #include <bits/stdc++.h>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int abs(int a, int b) {
if (a < b) {
return b - a;
} else {
return a - b;
}
}
int main() {
long long n, k;
cin >> n >> k;
set<int> S;
long long f;
if (k == 1) {
cout << 0 << endl;... | replace | 23 | 26 | 23 | 24 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
ll n, k;
cin >> n >> k;
set<ll> S;
if (n % k == 0)
cout << 0 << "\n";
else {
int mi = n;
while (1) {
n = min(n, abs(n - k));
if (S.count(n)) ... | #include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
ll n, k;
cin >> n >> k;
set<ll> S;
if (n > k) {
if (n % k == 0) {
cout << 0 << "\n";
return 0;
}
n = n % k;
cout << k - n << "\n";
} els... | replace | 12 | 16 | 12 | 21 | TLE | |
p02719 | C++ | Runtime Error | #include <algorithm>
#include <array>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
long long int n, k;
cin >>... | #include <algorithm>
#include <array>
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
long long int n, k;
cin >> n >> k;
n = n % k;
if (abs(n - k) >= n) {
cout << n << endl;
} else {
cout << abs(n - k... | delete | 12 | 16 | 12 | 12 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m;
cin >> n >> m;
if (n == m || n % m == 0) {
cout << '0';
} else {
n = n % m;
vector<long long> v;
for (long long i = 0; i < n; i++) {
n = abs(n - m);
v.push_back(n);
}
sort(v.begin(), v.end());
cout... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m;
cin >> n >> m;
if (n == m || n % m == 0) {
cout << '0';
} else {
n = n % m;
vector<long long> v;
for (long long i = 0; i < 2; i++) {
n = abs(n - m);
v.push_back(n);
}
sort(v.begin(), v.end());
cout... | replace | 10 | 11 | 10 | 11 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
long long a, b;
cin >> n >> k;
a = n % k;
b = min(a, k - a);
cout << b << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, k, a, b;
cin >> n >> k;
a = n % k;
b = min(a, k - a);
cout << b << endl;
}
| replace | 4 | 6 | 4 | 5 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, N_2, K;
cin >> N >> K;
if (N % K == 0) {
cout << 0 << endl;
return 0;
}
while (true) {
N_2 = abs(N - K);
if (N < N_2) {
cout << N << endl;
break;
} else {
N = N_2;
}
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, N_2, K;
cin >> N >> K;
N_2 = N % K;
long long K_2 = K - N_2;
cout << min(N_2, K_2) << endl;
} | replace | 6 | 19 | 6 | 9 | TLE | |
p02719 | C++ | Time Limit Exceeded | #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 >>... | replace | 12 | 18 | 12 | 13 | TLE | |
p02719 | C++ | Time Limit Exceeded |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n, m, x, y, z, q;
cin >> n >> m;
if (n == m || n % m == 0)
cout << n % m;
else if (n > m) {
while (n > m)
n -= m;
x = abs(n - m), y = abs(x - m), z = abs(y - m);
cout << min(min(x, y), z);
} else {
... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n, m, x, y, z, q;
cin >> n >> m;
if (n == m || n % m == 0)
cout << n % m;
else if (n > m) {
n %= m;
x = abs(n - m), y = abs(x - m), z = abs(y - m);
cout << min(min(x, y), z);
} else {
x = abs(n - m), y = ... | replace | 11 | 13 | 11 | 12 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, k;
cin >> n >> k;
if (n % k == 0)
cout << 0;
else if (abs(n % k - k) <= abs(n % k))
cout << abs(n % k - k);
else
cout << (abs(n % k));
}
| #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long int n, k;
cin >> n >> k;
if (n % k == 0)
cout << 0;
else if (abs(n % k - k) <= abs(n % k))
cout << abs(n % k - k);
else
cout << (abs(n % k));
}
| replace | 7 | 8 | 7 | 8 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int main(void) {
long long n, k;
cin >> n >> k;
long long min = n;
long long tmp = 0;
while (true) {
tmp = abs(min - k);
if (min > tmp)
min = tmp;
else
break;
}
cout << min << endl;
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int main(void) {
long long n, k;
cin >> n >> k;
long long min = n % k;
long long tmp = 0;
while (true) {
tmp = abs(min - k);
if (min > tmp)
min = tmp;
else
break;
}
cout << min << endl... | replace | 9 | 10 | 9 | 10 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll m, n;
cin >> n >> m;
ll t = n;
// cout << n%m;
n = n % m;
m = m % t;
set<ll> st;
while (max(n, m)) {
if (st.find(n) != st.end())
break;
st.insert(n);
n = abs(n - m);
}
ll min = 1000000000000000000;... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll m, n;
cin >> n >> m;
ll a = n / m;
ll b = a + 1;
cout << min(abs(n - (a * m)), abs(n - (b * m)));
} | replace | 7 | 23 | 7 | 10 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N, K;
cin >> N >> K;
if (N % K == 0)
N = 0;
while (N > abs(N - K)) {
N = abs(N - K);
}
cout << N << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N, K;
cin >> N >> K;
N %= K;
while (N > abs(N - K)) {
N = abs(N - K);
}
cout << N << endl;
} | replace | 6 | 8 | 6 | 7 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
n -= (n / k) * k;
cout << min(n, k - n) << '\n';
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
ll n, k;
cin >> n >> k;
n -= (n / k) * k;
cout << min(n, k - n) << '\n';
return 0;
} | replace | 9 | 10 | 9 | 10 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) { return b ? GCD(b, a % b) : a; }
long long LCM(long long a, long long b) { return a / GCD(a, b) * b; }
int main() {
long long int N;
long long int K;
cin >> N >> K;
long long int res = 1000000000000000001;
while (N < res) ... | #include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) { return b ? GCD(b, a % b) : a; }
long long LCM(long long a, long long b) { return a / GCD(a, b) * b; }
int main() {
long long int N;
long long int K;
cin >> N >> K;
long long int res = 1000000000000000001;
if (N > K)
N... | insert | 10 | 10 | 10 | 12 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;
typedef long long ll;
int main() {
ll N, K;
cin >> N >> K;
ll x = min(K, abs(N - K));
ll y = max(K, abs(N - K));
cout << y ... | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;
typedef long long ll;
int main() {
ll N, K;
cin >> N >> K;
ll x = N % K;
ll y = K - x;
cout << min(x, y) << endl;
}
| replace | 10 | 13 | 10 | 13 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main() {
long long n, k, m, temp;
int cnt = 3;
cin >> n >> k;
m = n;
if (m > 0) {
while (1) {
temp = n - k;
if (temp < 0) {
--cnt;
if (cnt < 0) {
break;
}
... | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main() {
long long n, k, m, temp;
int cnt = 3;
cin >> n >> k;
m = n;
if (m > 0) {
if (n > k) {
n = n % k;
m = min(m, n);
}
for (int i = 0; i < 2; ++i) {
n = abs(n - k);
m... | replace | 12 | 21 | 12 | 19 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K, n, k, ans;
cin >> N >> K;
n = N % K;
k = K - n;
ans = min(n, k);
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
long long N, K, n, k, ans;
cin >> N >> K;
n = N % K;
k = K - n;
ans = min(n, k);
cout << ans << endl;
}
| replace | 4 | 5 | 4 | 5 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <iostream>
using namespace std;
int main(void) {
long n, k;
long b, a, temp = 0;
cin >> n >> k;
b = n;
while (1) {
a = b - k;
// cout<<a<< " " << b << endl;
if (a < 0) {
break;
}
b = a;
}
// cout << a << " "<< b<<endl;
a = a * -1;
temp = min(a, b);
cout << temp <<... | #include <iostream>
using namespace std;
int main(void) {
long n, k;
long b, a, temp = 0;
cin >> n >> k;
temp = n / k;
b = n - k * temp;
a = b - k;
// cout << a << " "<< b<<endl;
a = a * -1;
temp = min(a, b);
cout << temp << "\n";
return 0;
} | replace | 7 | 16 | 7 | 10 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265359
// 素数判定
bool isPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false;
dou... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265359
// 素数判定
bool isPrime(int num) {
if (num < 2)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false;
dou... | replace | 27 | 32 | 27 | 28 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
long long m, n, y, x;
int main() {
scanf("%lld%lld", &m, &n);
x %= y;
printf("%lld", min(y - x, x));
return 0;
} | #include <bits/stdc++.h>
using namespace std;
long long m, n, y, x;
int main() {
scanf("%lld%lld", &x, &y);
if (y == 0)
printf("%lld", x);
else {
x %= y;
printf("%lld", min(y - x, x));
}
return 0;
} | replace | 6 | 9 | 6 | 15 | -8 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
void printVec(std::vector<int> &vec) {
std::cout << "";
for (auto it = vec.begin(); it != vec.end(); ++it) {
std::cout << *it << " ";
}
std::cout << std::endl;
}
int main() {
ll n, k;
cin >> n >> k;
ll min... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
void printVec(std::vector<int> &vec) {
std::cout << "";
for (auto it = vec.begin(); it != vec.end(); ++it) {
std::cout << *it << " ";
}
std::cout << std::endl;
}
int main() {
ll n, k;
cin >> n >> k;
ll min... | replace | 24 | 32 | 24 | 32 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int main() {
int n, k, x, y;
cin >> n >> k;
if (n >= k) {
x = n % k;
y = min(x, k - x);
} else {
x = k - n;
y = min(x, n);
}
cout << y << 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, x, y;
cin >> n >> k;
if (n >= k) {
x = n % k;
y = min(x, k - x);
} else {
x = k - n;
y = min(x, n);
}
cout << y << endl;
return 0;
}
| replace | 7 | 8 | 7 | 8 | 0 | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, a, b;
cin >> n >> k;
a = n % k;
b = k - a;
if (b < a) {
cout << b;
} else {
cout << a;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, k, a, b;
cin >> n >> k;
a = n % k;
b = k - a;
if (b < a) {
cout << b;
} else {
cout << a;
}
return 0;
} | replace | 4 | 5 | 4 | 5 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define ll long long
int main() {
fastio;
ll n, k;
cin >> n >> k;
if (n % k == 0)
... | #include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define ll long long
int main() {
fastio;
ll n, k;
cin >> n >> k;
cout << min(n % k,... | replace | 13 | 28 | 13 | 15 | TLE | |
p02719 | C++ | Runtime Error | #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#define endl '\n'
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n, k;
cin >> n >> k;
cout << n % (abs(n - k)) << endl;
return 0;
} | #include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#define endl '\n'
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long n, k;
cin >> n >> k;
cout << min(n % k, k - (n % k)) << endl;
return 0;
} | replace | 17 | 18 | 17 | 18 | 0 | |
p02719 | C++ | Time Limit Exceeded | /******************************************
* Author : sinon.su96@gmail.com
* Or : ahafid96@gmail.com
* Username : SINON
* Date : April 2020
* Civil and Structural engineering student
* at Ecole des Ponts ParisTech
* ***************************************/
// Import usefull library :
#include <algorithm>
#incl... | /******************************************
* Author : sinon.su96@gmail.com
* Or : ahafid96@gmail.com
* Username : SINON
* Date : April 2020
* Civil and Structural engineering student
* at Ecole des Ponts ParisTech
* ***************************************/
// Import usefull library :
#include <algorithm>
#incl... | replace | 48 | 49 | 48 | 49 | TLE | |
p02719 | C++ | Time Limit Exceeded |
#include <bits/stdc++.h>
using namespace std;
int main() {
long n, k;
cin >> n >> k;
long last_n;
do {
last_n = n;
n = abs(n - k);
} while (n < last_n);
cout << last_n << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long n, k;
cin >> n >> k;
long option1, option2;
option1 = n - n / k * k;
option2 = abs(option1 - k);
if (option1 > option2)
cout << option2 << endl;
else
cout << option1 << endl;
return 0;
}
| replace | 8 | 14 | 8 | 16 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef complex<int> ci;
typedef complex<double> cd;
#define fi first
#define se second
#define ALL(x) ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef complex<int> ci;
typedef complex<double> cd;
#define fi first
#define se second
#define ALL(x) ... | replace | 49 | 50 | 49 | 50 | 0 | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define N 200005
#define mod 1000000007
#define fo(n) for (int i = 1; i <= n; i++)
typedef pair<int, int> pii;
typedef long long int ll;
typedef long int li;
int mod1 = 998244353;
int main() {
ios_base::sync_with_s... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define N 200005
#define mod 1000000007
#define fo(n) for (int i = 1; i <= n; i++)
typedef pair<int, int> pii;
typedef long long int ll;
typedef long int li;
int mod1 = 998244353;
int main() {
ios_base::sync_with_s... | replace | 19 | 20 | 19 | 20 | 0 | |
p02719 | C++ | Runtime Error | #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;
}
} | replace | 4 | 5 | 4 | 5 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <cmath>
#include <iostream>
typedef long long ll;
using namespace std;
int main(void) {
ll N, K;
cin >> N >> K;
if (N % K == 0) {
cout << 0 << endl;
return 0;
}
while (true) {
ll N_tmp = abs(N - K);
if (N_tmp > N) {
cout << N << endl;
return 0;
}
N = N_tmp;
}
... | #include <cmath>
#include <iostream>
typedef long long ll;
using namespace std;
int main(void) {
ll N, K;
cin >> N >> K;
if (N >= K) {
N = N % K;
}
while (true) {
ll N_tmp = abs(N - K);
if (N_tmp > N) {
cout << N << endl;
return 0;
}
N = N_tmp;
}
return 0;
} | replace | 8 | 11 | 8 | 10 | TLE | |
p02719 | C++ | Runtime Error | #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... | replace | 25 | 26 | 25 | 26 | 0 | |
p02719 | Python | Time Limit Exceeded | N, K = map(int, input().split())
while abs(N - K) < N:
N = abs(N - K)
print(N)
| N, K = map(int, input().split())
N %= K
while abs(N - K) < N:
N = abs(N - K)
print(N)
| insert | 1 | 1 | 1 | 3 | TLE | |
p02719 | Python | Runtime Error | import sys
# 未解決(最後だけREになる)
def get():
return list(map(int, input().split()))
a = get()
b = a[0]
c = a[1]
if b < c:
if abs(b - c) < b:
print(abs(b - a))
sys.exit(0)
else:
print(b)
sys.exit(0)
else:
if a[0] % a[1] == a[1] or a[0] % a[1] == 0:
print(0)
... | import sys
# 未解決(最後だけREになる)
def get():
return list(map(int, input().split()))
a = get()
b = a[0]
c = a[1]
if b < c:
if abs(b - c) < b:
print(abs(b - c))
sys.exit(0)
else:
print(b)
sys.exit(0)
else:
if a[0] % a[1] == a[1] or a[0] % a[1] == 0:
print(0)
... | replace | 14 | 15 | 14 | 15 | 0 | |
p02719 | Python | Time Limit Exceeded | n, k = map(int, input().split())
r = []
if n % k == 0:
print(0)
exit()
while True:
n = abs(n - k)
r.append(n)
if r.count(n) >= 2:
break
print(min(r))
| n, k = map(int, input().split())
r = []
n = n % k
if n == 0:
print(0)
exit()
while True:
n = abs(n - k)
r.append(n)
if r.count(n) >= 2:
break
print(min(r))
| replace | 3 | 4 | 3 | 5 | TLE | |
p02719 | Python | Runtime Error | 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))))
| replace | 2 | 3 | 2 | 3 | TypeError: 'int' object is not iterable | Traceback (most recent call last):
File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02719/Python/s891781735.py", line 3, in <module>
print(min(n % k), (k - (n % k)))
TypeError: 'int' object is not iterable
|
p02719 | Python | Time Limit Exceeded | def resolve():
N, K = list(map(int, input().split()))
if K == 1:
print(0)
return
if N % K == 0:
print(0)
return
x = N
memo = [N]
while True:
x = min(abs(x - K), x)
if x in memo:
print(min(memo))
return
memo.append(x)... | def resolve():
N, K = list(map(int, input().split()))
print(min(N % K, K - (N % K)))
return
resolve()
| replace | 2 | 16 | 2 | 3 | TLE | |
p02719 | Python | Time Limit Exceeded | list_input = [int(n) for n in input().split()]
N = list_input[0]
K = list_input[1]
while N > abs(N - K):
N = abs(N - K)
print(N)
| list_input = [int(n) for n in input().split()]
N = list_input[0]
K = list_input[1]
while N > abs(N - K):
if N >= K:
N = N % K
else:
N = K - N
print(N)
| replace | 6 | 8 | 6 | 10 | TLE | |
p02719 | Python | Time Limit Exceeded | import sys
a = [int(i) for i in input().split()]
N = a[0]
K = a[1]
if K == 1:
print(0)
sys.exit()
def resZ(i, K):
return abs(i - K)
while True:
ab = resZ(N, K)
# print(ab)
if N < ab:
print(N)
# print('end')
sys.exit()
N = ab
# def
| import sys
a = [int(i) for i in input().split()]
N = a[0]
K = a[1]
if K == 1:
print(0)
sys.exit()
def resZ(i, K):
return abs(i - K)
ab = resZ(N, K)
# print(ab)
if N < ab:
print(N)
# print('end')
sys.exit()
N = N % K
while True:
ab = resZ(N, K)
# print(ab)
if N < ab:
pr... | insert | 15 | 15 | 15 | 23 | TLE | |
p02719 | Python | Time Limit Exceeded | n, k = list(map(int, input().split()))
n_prev = n
while True:
n = abs(n - k)
if n > n_prev:
print(n_prev)
exit()
else:
n_prev = n
| n, k = list(map(int, input().split()))
print(min(n % k, abs(k - n % k)))
| replace | 2 | 11 | 2 | 3 | TLE | |
p02719 | Python | Time Limit Exceeded | N, K = map(int, input().split())
tmp1 = abs(N - K)
while True:
if K == 1:
print(0)
break
tmp2 = abs(tmp1 - K)
if tmp1 < tmp2:
print(tmp1)
break
else:
tmp1 = tmp2
| N, K = map(int, input().split())
print(min(N % K, K - (N % K)))
| replace | 1 | 14 | 1 | 2 | TLE | |
p02719 | Python | Time Limit Exceeded | N, K = map(int, input().split())
Nj = N
while True:
Ni = Nj
Nj = abs(Ni - K)
if Ni > N:
print(N)
break
elif Nj > Ni:
print(Ni)
break
elif K == 1 or Nj == K:
print(0)
break
else:
continue
| n, k = map(int, input().split())
if n % k == 0:
print(0)
else:
l = [n]
p = n // k
c = n - (p * k)
half = k // 2
while c > half:
c = abs(c - k)
l.append(c)
print(min(l))
| replace | 0 | 16 | 0 | 12 | TLE | |
p02719 | Python | Time Limit Exceeded | #!python3
# input
N, K = list(map(int, input().split()))
def main():
x = N
while True:
y = max(x - K, K - x)
if y < x:
x = y
else:
break
print(x)
if __name__ == "__main__":
main()
| #!python3
# input
N, K = list(map(int, input().split()))
def main():
s = N % K
ans = min(s, K - s)
print(ans)
if __name__ == "__main__":
main()
| replace | 7 | 15 | 7 | 10 | TLE | |
p02719 | Python | Runtime Error | N, K = list(map(int, input().split()))
if N >= K:
print(N % K)
else:
print(K % N)
| N, K = list(map(int, input().split()))
print(min(N % K, K - (N % K)))
| replace | 2 | 6 | 2 | 3 | 0 | |
p02719 | Python | Time Limit Exceeded | import sys
N, K = map(int, input().split())
first = N
list_a = []
if N % K == 0:
print(0)
sys.exit()
else:
while N > 0:
N = N - K
second = N + K
N = abs(N)
list_a.append(N)
list_a.append(second)
list_a.append(first)
list_a = sorted(list_a)
print(list_a[0])
| import sys
N, K = map(int, input().split())
first = N
list_a = []
if N % K == 0:
print(0)
sys.exit()
else:
X = N // K
N = N - (K * (X + 1))
second = N + K
N = abs(N)
list_a.append(N)
list_a.append(second)
list_a.append(first)
list_a = sorted(list_a)
print(list_a[0])
| replace | 10 | 12 | 10 | 12 | TLE | |
p02719 | Python | Time Limit Exceeded | import sys
N, K = map(int, input().split())
if K == 1:
print(0)
sys.exit()
current = N
while True:
prev = current
current = abs(current - K)
next = abs(current - K)
if prev == next:
print(min(current, next))
break
| import sys
N, K = map(int, input().split())
if K == 1:
print(0)
sys.exit()
a = abs(N - K * (N // K + 1))
print(min(a, abs(a - K)))
| replace | 8 | 17 | 8 | 10 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
int main() {
ull n, k;
cin >> n >> k;
if (n % k == 0)
cout << 0 << endl;
else {
while (abs((ll)(n - k)) <= n && n != 0) {
n = abs((ll)(n - k));
}
cout << n << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
int main() {
ull n, k;
cin >> n >> k;
if (n % k == 0)
cout << 0 << endl;
else {
n = n - ((n / k) * k);
while (abs((ll)(n - k)) <= n && n != 0) {
n = abs((ll)(n - k));
}
cout << n << endl... | insert | 10 | 10 | 10 | 11 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <algorithm>
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long int n, k;
cin >> n >> k;
bool check = 0;
if (n % k == 0) ... | #include <algorithm>
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long int n, k;
cin >> n >> k;
bool check = 0;
if (n % k == 0) ... | replace | 25 | 48 | 25 | 28 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main() {
long long ... | #include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
int main() {
long long ... | insert | 23 | 23 | 23 | 25 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
long long int n, i = 0;
long long int a, b, c = 0, k = 0;
cin >> n >>... | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
long long int n, i = 0;
long long int a, b, c = 0, k = 0;
cin >> n >>... | replace | 19 | 21 | 19 | 28 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
if (k == 1 || n == k) {
cout << 0 << endl;
return 0;
}
long long tmp = abs(n - k);
do {
n = tmp;
tmp = abs(n - k);
} while (n > tmp);
cout << n << endl;
... | #include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
long long n, k;
cin >> n >> k;
if (k == 1 || n == k) {
cout << 0 << endl;
return 0;
}
long long tmp = abs(n - k);
if (n % k == 0) {
cout << 0 << endl;
} else {
long long dev = n % k;
i... | replace | 17 | 23 | 17 | 27 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repA(i, a, b) for (int i = a; i <= b; i++)
#define repD(i, b, a) for (int i = b; i >= a; i--)
#define fill(a) memset(a, 0, sizeof(a))
#define f first
#define s second
typedef ... | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repA(i, a, b) for (int i = a; i <= b; i++)
#define repD(i, b, a) for (int i = b; i >= a; i--)
#define fill(a) memset(a, 0, sizeof(a))
#define f first
#define s second
typedef ... | replace | 17 | 25 | 17 | 21 | TLE | |
p02719 | C++ | Time Limit Exceeded | /// Updated! https://www.youtube.com/watch?v=U07_n9xGIlM
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbug printf("I am here\n");
#define fast \
ios_base::sync_with_stdio(false); ... | /// Updated! https://www.youtube.com/watch?v=U07_n9xGIlM
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbug printf("I am here\n");
#define fast \
ios_base::sync_with_stdio(false); ... | replace | 18 | 19 | 18 | 19 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<int64_t> N;
int64_t K;
cin >> N.at(0) >> K;
int64_t i = 0;
while (true) {
N.at(i + 1) = N.at(i) - K;
if (N.at(i + 1) < 0) {
N.at(i + 1) *= (-1);
if (N.at(i + 1) < N.at(i)) {
cout << N.at(i + 1) << endl;
} e... | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t N, K;
cin >> N >> K;
int64_t m = min(N % K, abs(N % K - K));
cout << m << endl;
}
| replace | 4 | 23 | 4 | 8 | -6 | terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
|
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define endl "\n"
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define endl "\n"
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); ... | replace | 13 | 18 | 13 | 19 | 0 | |
p02719 | C++ | Runtime Error | #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;
}
| replace | 6 | 7 | 6 | 7 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ll n, k;
cin >> n >> k;
ll n1;
if (n - k < 0)
n1 = -(n - k);
else
n1 = (n - k);
int flag = 0;
while (!flag) {
if (n < n1)
flag = 1;
else {
n = n1;
if (n - k < 0)
n1 = -(n - k);
... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ll n, k;
cin >> n >> k;
ll p = n / k;
ll q = n - (k * p);
n = q;
ll n1;
if (n - k < 0)
n1 = -(n - k);
else
n1 = (n - k);
int flag = 0;
while (!flag) {
if (n < n1)
flag = 1;
else {
n = n1;... | insert | 6 | 6 | 6 | 9 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <string>
using namespace std;
int main() {
int N, K, W;
cin >> N >> K;
W = N % K;
if (W < K - W) {
cout << W;
} else {
cout << K - W;
}
return 0;
}
| #include <bits/stdc++.h>
#include <string>
using namespace std;
int main() {
long long N, K, W;
cin >> N >> K;
W = N % K;
if (W < K - W) {
cout << W;
} else {
cout << K - W;
}
return 0;
}
| replace | 6 | 7 | 6 | 7 | 0 | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b;
c = a % b;
if (c > b / 2) {
cout << b - c << endl;
} else {
cout << c << endl;
}
}
| #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
long long int a, b, c;
cin >> a >> b;
c = a % b;
if (c > b / 2) {
cout << b - c << endl;
} else {
cout << c << endl;
}
}
| replace | 6 | 7 | 6 | 7 | 0 | |
p02719 | C++ | Time Limit Exceeded | #include <algorithm>
#include <iostream>
#include <math.h>
using namespace std;
long long a, b;
long long out;
int main() {
cin >> a >> b;
out = labs(a - b);
while (out > labs(out - b))
out = labs(out - b);
cout << out;
}
| #include <algorithm>
#include <iostream>
#include <math.h>
using namespace std;
long long a, b;
long long out;
int main() {
cin >> a >> b;
long long x = 0;
if (a >= b) {
if (a % b)
x = min(a % b, llabs(a % b - b));
else
x = 0;
} else
x = min(a, llabs(a - b));
cout << x << endl;
}
| replace | 8 | 12 | 8 | 17 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long ... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long ... | insert | 29 | 29 | 29 | 32 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long LINF = 1LL << 60;
const long long LMINF = 1LL << 63;
const int INF = 1 << 30;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long LINF = 1LL << 60;
const long long LMINF = 1LL << 63;
const int INF = 1 << 30;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i... | replace | 53 | 54 | 53 | 54 | TLE | |
p02719 | C++ | Time Limit Exceeded | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, x, n) for (int i = x; i < (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VS = vector<string>;
using graph = vector<vector<int>>;
int main() {... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, x, n) for (int i = x; i < (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VS = vector<string>;
using graph = vector<vector<int>>;
int main() {... | insert | 13 | 13 | 13 | 17 | TLE | |
p02719 | C++ | Time Limit Exceeded | #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 temp = abs(n - k);
while (temp > 0) {
temp = temp - k;
}
ll ans = min(temp + k, abs(temp));
cout << ans << 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 temp = abs(n - k);
// while(temp > 0) {
// temp = temp - k;
// }
ll temp = n % k;
// for(int i = 0; i < n; i++){
// temp = temp - k;
... | replace | 9 | 14 | 9 | 20 | TLE | |
p02719 | C++ | Runtime Error | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define vii vector<int>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pdd pair<double, double>
#define pldld pair<long long double, long long double>
#define ff first
#define ss second
#define ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define vii vector<int>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pdd pair<double, double>
#define pldld pair<long long double, long long double>
#define ff first
#define ss second
#define ... | replace | 30 | 31 | 30 | 37 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.