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
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor, co...
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify import math import bisect import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from math import factorial, ceil, floor, co...
[["-", 0, 677, 12, 634, 0, 660, 0, 657, 17, 72], ["-", 0, 677, 12, 634, 0, 660, 0, 657, 12, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["-", 0, 1, 0, 652, 3, 4, 0, 653, 51, 146]]
5
491
#include <algorithm> #include <array> #include <iostream> #include <queue> #include <tuple> #include <utility> #include <vector> constexpr int MAX_N = 200'000; std::array<std::array<int, 2>, MAX_N + 1> L; std::array<std::array<int, 2>, MAX_N + 1> R; void solve(void) { int n; std::cin >> n; long long int sum = 0...
#include <algorithm> #include <array> #include <iostream> #include <queue> #include <tuple> #include <utility> #include <vector> constexpr int MAX_N = 200'000; std::array<std::array<int, 2>, MAX_N + 1> L; std::array<std::array<int, 2>, MAX_N + 1> R; void solve(void) { int n; std::cin >> n; long long int sum = 0...
[["-", 8, 9, 0, 57, 64, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 7, 15, 16, 12, 22]]
1
559
import heapq T = int(input()) Ns = [] cases = []*T for i in range(T): Ns.append(int(input())) cases.append([list(map(int, input().split())) for _ in range(Ns[-1])]) for i in [1]: answer = 0 N = Ns[i] case = cases[i] sa = [case[j][2]-case[j][1] for j in range(N)] pluss = [] minuss ...
import heapq T = int(input()) Ns = [] cases = []*T for i in range(T): Ns.append(int(input())) cases.append([list(map(int, input().split())) for _ in range(Ns[-1])]) for i in range(T): answer = 0 N = Ns[i] case = cases[i] sa = [case[j][2]-case[j][1] for j in range(N)] pluss = [] mi...
[["-", 36, 36, 0, 656, 0, 7, 12, 634, 0, 70], ["-", 36, 36, 0, 656, 0, 7, 12, 634, 0, 612], ["-", 36, 36, 0, 656, 0, 7, 12, 634, 0, 73], ["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25]]
5
632
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a = 1000 - (n % 1000); cout << a << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a = (1000 - n % 1000) % 1000; cout << a << endl; }
[["+", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["-", 0, 43, 49, 50, 51, 16, 12, 23, 0, 24], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
36
import sys n = int(input()) if n % 1000 == 0: print(0) sys.exit() while n > 1000: n -= 1000 print(n)
import sys n = int(input()) if n % 1000 == 0: print(0) sys.exit() while n > 1000: n -= 1000 print(1000 - n)
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33]]
5
38
import java.io.*; import java.util.*; public class Main { private static final boolean N_CASE = false; private void solve() { int n = sc.nextInt(); out.println(1000 - (n % 1000)); } private void run() { int T = N_CASE ? sc.nextInt() : 1; for (int t = 0; t < T; ++t) { solve(); } }...
import java.io.*; import java.util.*; public class Main { private static final boolean N_CASE = false; private void solve() { int n = sc.nextInt(); out.println((1000 - (n % 1000)) % 1000); } private void run() { int T = N_CASE ? sc.nextInt() : 1; for (int t = 0; t < T; ++t) { solve(); ...
[["+", 0, 492, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 109], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 499]]
3
1,108
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower) using namespace std; using ll = long long; int INF = 1001001001; int main() { int n; cin >> n; if (n % 1000 > 0) { cout << n / 1000 + 1 << endl; } else { cout <<...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower) using namespace std; using ll = long long; int INF = 1001001001; int main() { int n; cin >> n; if (n % 1000 > 0) { cout << 1000 - n % 1000 << endl; } else { cout...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["-", 0, 16, 31, 16, 12, 16, 31, 16, 17, 85], ["+", 0, 16, 31, 16, 12, 16, 12, 16, 17, 109], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
76
i = int(input()) while (i >= 0): i -= 1000 print(abs(i))
i = int(input()) while (i > 0): i -= 1000 print(abs(i))
[["-", 0, 656, 0, 52, 15, 23, 0, 666, 667, 20], ["+", 0, 656, 0, 52, 15, 23, 0, 666, 667, 47]]
5
25
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int k = n % 1000; if (n == 0) cout << 0 << endl; else cout << 1000 - k << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int k = n % 1000; if (k == 0) cout << 0 << endl; else cout << 1000 - k << endl; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
47
// Template begins #include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; #define fio \...
// Template begins #include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; #define fio \...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
432
#include <bits/stdc++.h> using namespace std; int main() { int n = 0; cin >> n; int m = n % 1000; if (n == 0) { cout << 0; } int v = 1000 - m; cout << v; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n = 0; cin >> n; int m = n % 1000; if (m == 0) { cout << 0; return 0; } int v = 1000 - m; cout << v; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38]]
1
54
n = gets.chomp.to_i #p n ans = n % 1000 ans == 0 ? 0 : 1000 - ans p ans
n = gets.chomp.to_i #p n ans = n % 1000 ans = ans == 0 ? 0 : 1000 - ans p ans
[["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 0, 493, 0, 662, 12, 754, 15, 738, 31, 22]]
4
24
#include <bits/stdc++.h> using namespace std; int main(void) { int N; cin >> N; cout << 1000 - N % 1000 << endl; }
#include <bits/stdc++.h> using namespace std; int main(void) { int N; cin >> N; cout << (1000 - N % 1000) % 1000 << endl; }
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 109], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25]]
1
30
#include <iostream> using namespace std; int main() { int N; cin >> N; cout << 1000 - (N % 1000) << endl; return 0; }
#include <iostream> using namespace std; int main() { int N; cin >> N; cout << (1000 - (N % 1000)) % 1000 << endl; return 0; }
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
34
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mk make_pair int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int t; cin >> t; if (t % 1000) cout << 0 << endl; else cout << 1000 - t % 1000; }
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mk make_pair int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int t; cin >> t; if (t % 1000 == 0) cout << 0 << endl; else cout << 1000 - t % 1000; }
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
79
n = int(input()) mod = n%1000 print(1000-mod if mod == 0 else 0)
n = int(input()) mod = n%1000 print(1000-mod if mod !=0 else 0)
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 60], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 79]]
5
25
// https://atcoder.jp/contests/abc175/tasks/abc175_c #include <algorithm> #include <climits> #include <deque> #include <iostream> #include <iterator> // std::back_inserter #include <sstream> #include <tuple> #include <vector> using namespace std; typedef unsigned long ll; ll n; int main() { cin >> n; cout << 10...
// https://atcoder.jp/contests/abc175/tasks/abc175_c #include <algorithm> #include <climits> #include <deque> #include <iostream> #include <iterator> // std::back_inserter #include <sstream> #include <tuple> #include <vector> using namespace std; typedef unsigned long ll; ll n; int main() { cin >> n; cout << (1...
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
52
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; if (N % 1000 == 0) { cout << 0 << endl; } int pay = (N / 1000 + 1) * 1000; cout << pay - N << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; if (N % 1000 == 0) { cout << 0 << endl; } else { int pay = (N / 1000 + 1) * 1000; cout << pay - N << endl; } }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
56
#include <bits/stdc++.h> #define N 1000005 using namespace std; int n, m; inline int qr() { int x = 0, w = 1; char a = 0; while (a < '0' || a > '9') { if (a == '-') w = -1; a = getchar(); } while (a <= '9' && a >= '0') { x = (x << 3) + (x << 1) + (a ^ 48); a = getchar(); } return x...
#include <bits/stdc++.h> #define N 1000005 using namespace std; int n, m; inline int qr() { int x = 0, w = 1; char a = 0; while (a < '0' || a > '9') { if (a == '-') w = -1; a = getchar(); } while (a <= '9' && a >= '0') { x = (x << 3) + (x << 1) + (a ^ 48); a = getchar(); } return x...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47]]
1
152
rest = gets.to_i % 1000 p rest == 0 ? 0 : rest
rest = gets.to_i % 1000 p rest == 0 ? 0 : 1000-rest
[["+", 0, 652, 3, 4, 0, 754, 75, 738, 31, 612], ["+", 0, 652, 3, 4, 0, 754, 75, 738, 17, 33]]
4
15
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define speed \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define ll l...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #define speed \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define ll l...
[["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 24], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 31, 13], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 109], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 25]]
1
45
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #includ...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 31, 13], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25], ["-", 0, 16, 31, 16, 12, 16, 12, 23, 0, 25]]
1
192
N=int(input()) if N%1000!=0: print(1000-N%1000) else: print(1000-N)
N=int(input()) if N%1000!=0: print(1000-N%1000) else: print(0)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 612]]
5
31
#include <bits/stdc++.h> using namespace std; /* 提出前に確認! - setとmultisetを間違えない */ int main(void) { int n; cin >> n; cout << n % 1000 << endl; return (0); }
#include <bits/stdc++.h> using namespace std; /* 提出前に確認! - setとmultisetを間違えない */ int main(void) { int n; cin >> n; cout << (1000 - n % 1000) % 1000 << endl; return (0); }
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 31, 13], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 109], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25]]
1
34
// g++ -std=c++11 test.cpp && ./a.out // g++ -std=c++11 bfs.cpp && cat bfs.txt | ./a.out #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <s...
// g++ -std=c++11 test.cpp && ./a.out // g++ -std=c++11 bfs.cpp && cat bfs.txt | ./a.out #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <s...
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
186
#include <stdio.h> int main() { int n, a, b; scanf("%d", &n); a = n % 1000; b = 1000 - a; if (b == 1000) { printf("0"); } printf("%d", b); return 0; }
#include <stdio.h> int main() { int n, a, b; scanf("%d", &n); a = n % 1000; b = 1000 - a; if (b == 1000) { printf("0"); } else { printf("%d", b); } return 0; }
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
64
print(int(input()) % 1000)
print(-int(input())%1000)
[["+", 0, 652, 3, 4, 0, 657, 31, 664, 17, 33]]
5
11
#include <bits/stdc++.h> using namespace std; #define endl '\n' int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int k = n / 1000 + (n % 1000 > 1); cout << 1000 * k - n << endl; return 0; }
#include <bits/stdc++.h> using namespace std; #define endl '\n' int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int k = n / 1000 + (n % 1000 > 0); cout << 1000 * k - n << endl; return 0; }
[["-", 49, 50, 51, 16, 12, 23, 0, 16, 12, 13], ["+", 49, 50, 51, 16, 12, 23, 0, 16, 12, 13]]
1
71
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int x = N / 1000; if (x % 1000 > 0) x++; cout << (x * 1000 - N) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int x = N / 1000; if (N % 1000 > 0) x++; cout << (x * 1000 - N) << endl; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22]]
1
49
// list index out of rangeエラー表示用 #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep1(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() { int n; cin >> n; cout << 1000 - n % 1000; }
// list index out of rangeエラー表示用 #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep1(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() { int n; cin >> n; cout << (1000 - n % 1000) % 1000; }
[["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 109], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 25]]
1
48
n=int(input()) if n%1000==0: print('0') else: k = n k += 1000 k %= 1000 cha = k*1000-n print(cha)
n=int(input()) if n%1000==0: print('0') else: k = n k += 1000 k //= 1000 cha = k*1000-n print(cha)
[["-", 75, 76, 8, 196, 0, 1, 0, 677, 17, 132], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 691]]
5
43
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); final int MOD = (int)1e9 + 7; final int MAX = Integer.MAX_VALUE; final long LMAX = Long.MAX_VALUE; int len = (int)1e7; void doIt() { int N = sc.nextInt(); System.out.println(1000 - (N % 1000)); } public static void m...
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); final int MOD = (int)1e9 + 7; final int MAX = Integer.MAX_VALUE; final long LMAX = Long.MAX_VALUE; int len = (int)1e7; void doIt() { int N = sc.nextInt(); System.out.println((1000 - (N % 1000)) % 1000); } public stat...
[["+", 0, 492, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 109], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 499]]
3
109
function Main(input) { input = input.split("\n"); const N = parseInt(input[0]); let answer; if (N % 1000 === 0) { answer = 0; } else { answer = N % 1000; } console.log(answer); } // デバッグ用 function debug() { var input = document.getElementById("input").value; Main(input); } //* この行以降は編集しないでく...
function Main(input) { input = input.split("\n"); const N = parseInt(input[0]); let answer; if (N % 1000 === 0) { answer = 0; } else { answer = 1000 - N % 1000; } console.log(answer); } // デバッグ用 function debug() { var input = document.getElementById("input").value; Main(input); } //* この行以降は...
[["+", 0, 556, 0, 1, 0, 11, 12, 16, 31, 555], ["+", 0, 556, 0, 1, 0, 11, 12, 16, 17, 33]]
2
110
def main(): M = int(input()) n, r = M // 1000, M % 1000 if r == 0: print(0) print((n+1)*1000-M) if __name__ == '__main__': main()
def main(): M = int(input()) n, r = M // 1000, M % 1000 if r == 0: print(0) return print((n+1)*1000-M) if __name__ == '__main__': main()
[["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]]
5
55
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPS(i, a, b) for (int i = (a); i < (b); ++i) using namespace std; using ll = long long; int main() { int n; cin >> n; int q = n % 1000; cout << q << endl; }
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPS(i, a, b) for (int i = (a); i < (b); ++i) using namespace std; using ll = long long; int main() { int n; cin >> n; int q = n % 1000; cout << (1000 - q) % 1000 << endl; }
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 31, 13], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
56
n = int(input()) if n%1000 == 0: print (0) else: print (n-1000)
n = int(input()) if n%1000 == 0: print (0) else: print (1000-n%1000)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 31, 612], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 17, 109]]
5
27
#include <bits/stdc++.h> using namespace std; typedef long long ll; const static ll INF = 1e15; #define rep(i, n) for (int i = 0; i < (int)(n); i++) // __uint128_t const ll MOD = 1e9 + 7; int main() { ll N; cin >> N; cout << 1000 - N % 1000 << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; const static ll INF = 1e15; #define rep(i, n) for (int i = 0; i < (int)(n); i++) // __uint128_t const ll MOD = 1e9 + 7; int main() { ll N; cin >> N; cout << (1000 - N % 1000) % 1000 << endl; }
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 109], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25]]
1
58
n = int(input()) if n % 1000 == 0: print(0) else: tmp = n // 1000 + 1 print(tmp - n)
n = int(input()) if n % 1000 == 0: print(0) else: tmp = n // 1000 + 1 print(tmp * 1000 - n)
[["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 48], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 612]]
5
34
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long double pi = acos(-1.0); typedef long long ll; struct Node { int parent, left, right; }; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; cout << 1000 - n % 1000 << endl; }
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long double pi = acos(-1.0); typedef long long ll; struct Node { int parent, left, right; }; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; cout << (1000 - n % 1000) % 1000 << endl; }
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 109], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25]]
1
79
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; cout << (10000 - N % 10000) % 10000 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; cout << (1000 - N % 1000) % 1000 << endl; }
[["-", 31, 16, 12, 16, 31, 23, 0, 16, 31, 13], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 31, 13], ["-", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
33
N=int(input()) print(1000-N%1000)
N=int(input()) print(-N%1000)
[["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 612]]
5
16
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define pb push_back #define pp pop_back #define f first #define s second #define sz(a) (int)((a).size()) #define NoType ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL) #define mp make_pair ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define pb push_back #define pp pop_back #define f first #define s second #define sz(a) (int)((a).size()) #define NoType ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL) #define mp make_pair ...
[["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
130
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <map> #include <memory> #include <numeric> #includ...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <iterator> #include <limits> #include <map> #include <memory> #include <numeric> #includ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
2,393
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <chrono> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include...
#include <algorithm> #include <array> #include <assert.h> #include <bitset> #include <chrono> #include <cmath> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include...
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
706
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define REP(i, k, n) for (long long i = k; i < (long long)(n); i++) #define all(a) a.begin(), a.end() #define pb emplace_back #define eb emplace_back #define lb(v, k) (lower_bound(all(v), k) - v.begin()) #defi...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) #define REP(i, k, n) for (long long i = k; i < (long long)(n); i++) #define all(a) a.begin(), a.end() #define pb emplace_back #define eb emplace_back #define lb(v, k) (lower_bound(all(v), k) - v.begin()) #defi...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
1,202
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define F first #define S second #define int long long #define ll long long //#define int unsigned long long #define pb push_back //#define double long double using namespace std; using namespace __gnu_pbds; typedef tree<...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define F first #define S second #define int long long #define ll long long //#define int unsigned long long #define pb push_back //#define double long double using namespace std; using namespace __gnu_pbds; typedef tree<...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
432
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T, class U> inline bool chmin(T &x, U y) { if (x > y) { x = y; return true; } return false; } template <class T, class U> inline bool chmax(T &x, U y) { if (x < y) { x = y; return true; } return false; } #def...
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T, class U> inline bool chmin(T &x, U y) { if (x > y) { x = y; return true; } return false; } template <class T, class U> inline bool chmax(T &x, U y) { if (x < y) { x = y; return true; } return false; } #def...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22]]
1
2,489
#include <bits/stdc++.h> using namespace std; using int64 = long long; constexpr int DEBUG = 0; constexpr int64 P = 1000000007; struct FiniteField { private: int64 x; public: FiniteField(int64 x) : x(x) { if (x >= P || x < 0) { x %= P; if (x < 0) x += P; } } FiniteField() : x(0)...
#include <bits/stdc++.h> using namespace std; using int64 = long long; constexpr int DEBUG = 0; constexpr int64 P = 1000000007; struct FiniteField { private: int64 x; public: FiniteField(int64 raw_x) : x(raw_x) { if (x >= P || x < 0) { x %= P; if (x < 0) x += P; } } FiniteField(...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["-", 0, 14, 0, 357, 0, 358, 0, 4, 0, 22], ["+", 0, 14, 0, 357, 0, 358, 0, 4, 0, 22]]
1
775
#include <bits/stdc++.h> using namespace std; const int maxn = 109; const int P = 1000000007; long long ksm(long long a, int k) { long long ret = 1; a = (a % P + P) % P; for (; k; k >>= 1, a = a * a % P) { if (k & 1) ret = ret * a % P; } return ret; } long long INV(long long x) { return ksm(x, P - ...
#include <bits/stdc++.h> using namespace std; const int maxn = 109; const int P = 1000000007; long long ksm(long long a, int k) { long long ret = 1; a = (a % P + P) % P; for (; k; k >>= 1, a = a * a % P) { if (k & 1) ret = ret * a % P; } return ret; } long long INV(long long x) { return ksm(x, P - ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
605
#include <algorithm> #include <cctype> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <stack> #include <string> #include <unordered_map> using namespace std; typedef long long ll; const ll INF = 1000000007; const ll mod = 1000000007...
#include <algorithm> #include <cctype> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <stack> #include <string> #include <unordered_map> using namespace std; typedef long long ll; const ll INF = 1000000007; const ll mod = 1000000007...
[["-", 49, 50, 51, 2, 3, 4, 0, 16, 12, 22], ["+", 49, 50, 51, 2, 3, 4, 0, 16, 12, 13]]
1
548
#include "bits/stdc++.h" using namespace std; #define dbg(var) cout << #var << "=" << var << " " #define nl cout << "\n" #define fr(i, n) for (int i = 0; i < n; i++) #define rep(i, a, n) for (int i = a; i <= n; i++) #define vi vector<int> #define vvi vector<vi> #define pb push_back #define fa(v) for (auto &i : v) #defi...
#include "bits/stdc++.h" using namespace std; #define dbg(var) cout << #var << "=" << var << " " #define nl cout << "\n" #define fr(i, n) for (int i = 0; i < n; i++) #define rep(i, a, n) for (int i = a; i <= n; i++) #define vi vector<int> #define vvi vector<vi> #define pb push_back #define fa(v) for (auto &i : v) #defi...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
443
/*/ Author: kal013 /*/ // #pragma GCC optimize ("O3") #include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" using namespace std; using namespace __gnu_pbds; template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_up...
/*/ Author: kal013 /*/ // #pragma GCC optimize ("O3") #include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" #include "ext/pb_ds/tree_policy.hpp" using namespace std; using namespace __gnu_pbds; template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_up...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
3,455
#include <cstdio> constexpr int mod = 1000000007; int t; int inv[16]; int binom(int n, int k) { long long int r = n; for (int i = 1; i < k; i++) { r = r * (n - i) % mod; r = r * inv[i + 1] % mod; } return r; } /* [x^N] 1 / [(1-x)^16(1+x)^5] [x^N] 1 / [(1-x)^11(1-x^2)^5] [x^N] (1+x)^11 / (1-x^2)^16 *...
#include <cstdio> constexpr int mod = 1000000007; int t; int inv[16]; int binom(int n, int k) { long long int r = 1; for (int i = 0; i < k; i++) { r = r * (n - i) % mod; r = r * inv[i + 1] % mod; } return r; } /* [x^N] 1 / [(1-x)^16(1+x)^5] [x^N] 1 / [(1-x)^11(1-x^2)^5] [x^N] (1+x)^11 / (1-x^2)^16 *...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
260
#include <bits/stdc++.h> int ri() { int n; scanf("%d", &n); return n; } #define MOD 1000000007 template <int mod> struct ModInt { int x; ModInt() : x(0) {} ModInt(int64_t x) : x(x >= 0 ? x % mod : (mod - -x % mod) % mod) {} ModInt &operator+=(const ModInt &p) { if ((x += p.x) >= mod) x -= mod;...
#include <bits/stdc++.h> int ri() { int n; scanf("%d", &n); return n; } #define MOD 1000000007 template <int mod> struct ModInt { int x; ModInt() : x(0) {} ModInt(int64_t x) : x(x >= 0 ? x % mod : (mod - -x % mod) % mod) {} ModInt &operator+=(const ModInt &p) { if ((x += p.x) >= mod) x -= mod;...
[["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 21]]
1
1,063
t,*n=map(int,open(0)) for k in n:print(sum(k**j*[0,765144583,346175634,347662323,5655049,184117322,927321758,444014759,542573865,237315285,417297686,471090892,183023413,660103155,727008098,869418286,539588932,729548371,700407153,404391958,962779130,184117322,927321758,444014759,542573865,237315285,417297686,471090892,1...
t,*n=map(int,open(0)) for k in n:print(sum(k**j*[0,765144583,346175634,347662323,5655049,184117322,927321758,444014759,542573865,237315285,417297686,471090892,183023413,660103155,727008098,869418286,539588932,729548371,700407153,404391958,962779130,184117322,927321758,444014759,542573865,237315285,417297686,471090892,1...
[["-", 206, 657, 31, 23, 0, 657, 12, 657, 17, 151], ["-", 206, 657, 31, 23, 0, 657, 12, 657, 12, 612], ["+", 8, 657, 12, 206, 206, 657, 31, 657, 17, 48], ["+", 8, 657, 12, 206, 206, 657, 31, 657, 12, 612]]
5
120
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define MAX 510000 #define rrep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep(i, n) for (ll i = 1; i <= (ll)(n); i++) #define dcout cout << fixed << setprecision(15); #define mp make_pair #define pb push_back using namespace std; typedef long long int ll;...
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define MAX 510000 #define rrep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep(i, n) for (ll i = 1; i <= (ll)(n); i++) #define dcout cout << fixed << setprecision(15); #define mp make_pair #define pb push_back using namespace std; typedef long long int ll;...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
1,027
T = int(input()) for _ in range(T): n = int(input()) if n < 5: print(0) elif n % 2 == 0: x = n // 2 - 2 ans = (37476432000*(x) + 187243792560*(x**2) + 399117903732*(x**3) + 485269948800*(x**4) + 379718819935*(x**5) + 204017288475*(x**6) + 78161197114*(x**7) + 21814113750*(x**8) + 4477585255*(x**9) + 675269595*...
T = int(input()) for _ in range(T): n = int(input()) if n < 5: print(0) elif n % 2 == 0: x = n // 2 - 2 ans = (37476432000*(x) + 187243792560*(x**2) + 399117903732*(x**3) + 485269948800*(x**4) + 379718819935*(x**5) + 204017288475*(x**6) + 78161197114*(x**7) + 21814113750*(x**8) + 4477585255*(x**9) + 675269595*...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
317
/*{{{*/ #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> #define SZ(X) ((int)(X).size()) #defin...
/*{{{*/ #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> #define SZ(X) ((int)(X).size()) #defin...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
1,396
from functools import lru_cache @lru_cache(102400) def t(n, u): if u <= 0: return 1 ans = 0 for k1 in range(0, n + 1): for k2 in range(k1 + 1, (n - k1) + 1): ans += (k2 - k1) * t(n - k1 - k2, u - 1) return ans def tl(n, u): return list(map(lambda x: t(x, u), range(n))) ...
from functools import lru_cache @lru_cache(102400) def t(n, u): if u <= 0: return 1 ans = 0 for k1 in range(0, n + 1): for k2 in range(k1 + 1, (n - k1) + 1): ans += (k2 - k1) * t(n - k1 - k2, u - 1) return ans def tl(n, u): return list(map(lambda x: t(x, u), range(n))) ...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 14, 8, 196, 0, 299, 0, 636], ["+", 0, 656, 0, 14, 8, 196, 0, 299, 0, 22], ["-", 0, 656, 0, 14, 8, 196, 0, 299, 0, 636], ["+", 0, 57, 64, 196, 0, 37, 0, 657, 17, 109]]
5
383
#include <cmath> #include <iostream> using namespace std; int main() { int n; cin >> n; cout << ceil(n / 1000) * 1000 - n << endl; return 0; }
#include <cmath> #include <iostream> using namespace std; int main() { float n; cin >> n; cout << ceil(n / 1000) * 1000 - n << endl; return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
39
pay = int(input()) while(pay >=0): pay -= 1000 otu = abs(pay) print(otu)
pay = int(input()) while(pay >0): pay -= 1000 otu = abs(pay) print(otu)
[["-", 0, 656, 0, 52, 15, 23, 0, 666, 667, 20], ["+", 0, 656, 0, 52, 15, 23, 0, 666, 667, 47]]
5
28
#include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int N; cin >> N; cout << 1000 - (N % 1000); }
#include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int N; cin >> N; cout << (1000 - (N % 1000)) % 1000; }
[["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
39
#include <iostream> using namespace std; int main() { int N; cin >> N; cout << 1000 - (N % 1000) << '\n'; return 0; }
#include <iostream> using namespace std; int main() { int N; cin >> N; cout << (1000 - (N % 1000)) % 1000 << '\n'; return 0; }
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
36
N = int(input()) print(1000*math.ceil(N/1000)-N)
import math N = int(input()) print(1000*math.ceil(N/1000)-N)
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
23
#include <bits/stdc++.h> using namespace std; ; int main() { int n; cin >> n; n %= 1000; cout << 1000 - n << endl; }
#include <bits/stdc++.h> using namespace std; ; int main() { int n; cin >> n; n %= 1000; cout << (1000 - n) % 1000 << endl; }
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
32
N = input() N = int(N) for X in range(0,11): a = N-1000*X if a < 0: break; C=1000*(X)-N print(C)
N = input() N = int(N) for X in range(0,11): a = N-1000*X if a <= 0: break; C=1000*(X)-N print(C)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
48
#include <bits/stdc++.h> using namespace std; #define fast() \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long...
#include <bits/stdc++.h> using namespace std; #define fast() \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long...
[["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
239
#include <iostream> using namespace std; int main() { int n, r; cin >> n; r = n / 1000; if (r > 0) { int ans; ans = 1000 - r; cout << ans << endl; } else if (r == 0) { cout << "0" << endl; } return 0; }
#include <iostream> using namespace std; int main() { int n, r; cin >> n; r = n % 1000; if (r > 0) { int ans; ans = 1000 - r; cout << ans << endl; } else if (r == 0) { cout << "0" << endl; } return 0; }
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109]]
1
70
#include <stdio.h> int main() { int N; scanf("%d", &N); int ans = N % 1000; if (ans = 0) { printf("%d", 0); } else { printf("%d", 1000 - ans); } return 0; }
#include <stdio.h> int main() { int N; scanf("%d", &N); int amari = N % 1000; if (amari == 0) { printf("%d", 0); } else { printf("%d", 1000 - amari); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 11, 31, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 1, 0, 2, 3, ...
0
62
N = int(input('>>')) for i in range(11): b = i * 1000 c = b - N if c >= 0: break print(c)
N = int(input()) for i in range(11): b = i * 1000 c = b - N if c >= 0: break print(c)
[["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655]]
5
39
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 1000 == 0) cout << "0" << endl; else cout << n - (n / 1000) * 1000 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 1000 == 0) cout << "0" << endl; else cout << (n / 1000 + 1) * 1000 - n << endl; }
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
50
N=int(input('N=')) if N%1000==0: Q=N//1000 else: Q=N//1000+1 W=Q*1000-N print(W)
N=int(input()) if N%1000==0: Q=N//1000 else: Q=N//1000+1 W=Q*1000-N print(W)
[["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655]]
5
43
N = int(input()) if N == 10000: print("0") elif N <= 1000: print(1000-N) else: n = list(str(N)) print(1000*(1+int(n[0]))-N)
N = int(input()) if N % 1000 == 0: print("0") elif N < 1000: print(1000-N) else: n = list(str(N)) print(1000*(1+int(n[0]))-N)
[["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 109], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["-", 0, 656, 0, 57, 75, 665, 15, 666, 667, 19], ["+", 0, 656, 0, 57, 75, 665, 15, 666, 667, 18]]
5
59
#include <iostream> using namespace std; int main() { int N; cin >> N; while (N >= 1000) { N -= 1000; } cout << N << endl; }
#include <iostream> using namespace std; int main() { int N; cin >> N; while (N > 0) { N -= 1000; } cout << abs(N) << endl; }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
37
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (n); ++i) int N; int main() { cin >> N; if (N % 1000 == 0) cout << N / 1000 << endl; else { cout << (N / 1000 + 1) * 1000 - N << endl; } }
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (n); ++i) int N; int main() { cin >> N; if (N % 1000 == 0) cout << 0 << endl; else { cout << (N / 1000 + 1) * 1000 - N << endl; } }
[["-", 64, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 64, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["-", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13]]
1
78
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define intll int long long const int INF = 1e9; const int MOD = 1e9 + 7; int main() { int x; cin >> x; cout << 1000 - (x % 1000); }
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define intll int long long const int INF = 1e9; const int MOD = 1e9 + 7; int main() { int x; cin >> x; cout << (1000 - (x % 1000)) % 1000; }
[["+", 0, 1, 0, 16, 12, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
60
N = int(input()) a = math.ceil(N / 1000) b = 1000*a - N print(b)
import math N = int(input()) a = math.ceil(N / 1000) b = 1000*a - N print(b)
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
29
#include <iostream> using namespace std; int main() { int a; cin >> a; cout << (1000 - a % 1000); return 0; }
#include <iostream> using namespace std; int main() { int a; cin >> a; cout << (1000 - a % 1000) % 1000; return 0; }
[["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
32
#include <stdio.h> int shop(int); int main(void) { int N, hold; scanf("%d", &N); hold = shop(N); switch (hold) { case 0: printf("%d", 0); break; case 1: printf("%d", N - (N / 1000) * 1000); break; } return 0; } int shop(int N) { if (N % 1000 == 0) { return 0; } else { return...
#include <stdio.h> int shop(int); int main(void) { int N, hold; scanf("%d", &N); hold = shop(N); switch (hold) { case 0: printf("%d", 0); break; case 1: printf("%d", (N / 1000 + 1) * 1000 - N); break; } return 0; } int shop(int N) { if (N % 1000 == 0) { return 0; } else { re...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
109
#include <bits/stdc++.h> using namespace std; int main() { int x; cin >> x; cout << (x - (x % 1000)) % 1000; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int x; cin >> x; cout << (1000 - (x % 1000)) % 1000; return 0; }
[["-", 0, 16, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 31, 13]]
1
36
x=int(input()) if x//1000==0: print(0) else: print(1000-(x%1000))
x=int(input()) if x%1000==0: print(0) else: print(1000-(x%1000))
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 676], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 109]]
5
31
s = int(input()) print(1000-(s%1000)%1000)
s = int(input()) print((1000-s%1000)%1000)
[["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["-", 3, 4, 0, 657, 12, 657, 31, 23, 0, 24]]
5
20
#include <stdio.h> int main() { int n, a, b, c; scanf("%d", &n); if ((n % 1000) != 0) { a = n % 1000; b = 1000 - a; printf("%d", b); } else { printf("no change"); } return 0; }
#include <stdio.h> int main() { int n, a, b, c; scanf("%d", &n); if ((n % 1000) != 0) { a = n % 1000; b = 1000 - a; printf("%d", b); } else { printf("0"); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
73
#include <stdio.h> int main() { int n; scanf("%d", &n); int a = n % 1000; int b = 1000 - a; printf("%d", b); return 0; }
#include <stdio.h> int main() { int n; scanf("%d", &n); int a = n % 1000; int b = 1000 - a; printf("%d", b % 1000); return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 109], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
47
n = gets.chomp.to_i puts 1000*(n/1000).ceil - n
n = gets.chomp.to_i puts 1000*(n/1000.0).ceil - n
[["-", 31, 738, 12, 652, 486, 739, 0, 738, 12, 612], ["+", 31, 738, 12, 652, 486, 739, 0, 738, 12, 531]]
4
19
#include <bits/stdc++.h> #define rep(i, N) for (int i = 0; i < (N); ++i) #define all(v) v.begin(), v.end() using namespace std; using ll = long long; using P = pair<int, int>; int main(void) { int n; cin >> n; cout << ceil(n / 1000.0) - n << endl; }
#include <bits/stdc++.h> #define rep(i, N) for (int i = 0; i < (N); ++i) #define all(v) v.begin(), v.end() using namespace std; using ll = long long; using P = pair<int, int>; int main(void) { int n; cin >> n; cout << 1000 * ceil(n / 1000.0) - n << endl; }
[["+", 0, 16, 31, 16, 12, 16, 31, 16, 31, 13], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 17, 48]]
1
63
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); for (int i = 0; i < 1000; i++) { int cal = 1000 * i - N; if (cal >= 0) { System.out.println(cal); } else { continue; ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); for (int i = 0; i < 1000; i++) { int cal = 1000 * i - N; if (cal >= 0) { System.out.println(cal); break; } else { c...
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 35]]
3
91
N = int(input()) ans = N % 1000 print(ans)
N = int(input()) ans = -1 * N % 1000 print(ans)
[["+", 0, 662, 12, 657, 31, 657, 31, 664, 17, 33], ["+", 0, 662, 12, 657, 31, 657, 31, 664, 28, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 48]]
5
17
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define irep(i, a, b) for (ll i = ll(a); i >= ll(b); i--) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define irep(i, a, b) for (ll i = ll(a); i >= ll(b); i--) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
[["+", 12, 16, 31, 23, 0, 16, 31, 2, 63, 22], ["-", 0, 16, 31, 23, 0, 16, 31, 16, 12, 13], ["-", 31, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["-", 31, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 12, 13]]
1
195
#include <algorithm> #include <cctype> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <sstream> #include <stdexcept> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; int main() { int N; ...
#include <algorithm> #include <cctype> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <set> #include <sstream> #include <stdexcept> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; int main() { int N; ...
[["+", 31, 16, 12, 16, 31, 23, 0, 16, 31, 13], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 12, 16, 31, 23, 0, 16, 12, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 109], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
57
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) const long long INF = 1LL << 60; // 仮想的な無限大の値; using namespace std; using ll = long long; using P = pair<int, int>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) const long long INF = 1LL << 60; // 仮想的な無限大の値; using namespace std; using ll = long long; using P = pair<int, int>; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
165
#include <bits/stdc++.h> using ll = long long; using namespace std; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i ...
#include <bits/stdc++.h> using ll = long long; using namespace std; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i ...
[["-", 0, 11, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 31, 22]]
1
314
print(1000 - (int(input()) % 1000)) % 1000
print((1000 - (int(input()) % 1000)) % 1000)
[["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
17
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(0); int n; int ans = (1000 - n % 1000) % 1000; cout << ans << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(0); int n; cin >> n; int ans = (1000 - n % 1000) % 1000; cout << ans << "\n"; return 0; }
[["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
53
#include <iostream> using namespace std; int main() { int N; cin >> N; cout << 1000 % (1000 - (N % 1000)); }
#include <iostream> using namespace std; int main() { int N; cin >> N; cout << (1000 - (N % 1000)) % 1000; }
[["-", 8, 9, 0, 1, 0, 16, 12, 16, 31, 13], ["-", 8, 9, 0, 1, 0, 16, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 16, 12, 16, 12, 13]]
1
33
#include <bits/stdc++.h> using namespace std; using ll = long long; // print(fixed << setprecision(10)); #define rep(i, n) for (ll i = 0; i < (n); i++) #define repk(i, n, k) for (ll i = k; i < (n); i++) #define all(n) n.begin(), n.end() #define print(n) cout << n << endl double PI = acos(-1.0); int INF = 1e9; ll LINF ...
#include <bits/stdc++.h> using namespace std; using ll = long long; // print(fixed << setprecision(10)); #define rep(i, n) for (ll i = 0; i < (n); i++) #define repk(i, n, k) for (ll i = k; i < (n); i++) #define all(n) n.begin(), n.end() #define print(n) cout << n << endl double PI = acos(-1.0); int INF = 1e9; ll LINF ...
[["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 12, 16, 17, 109], ["+", 0, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 16, 31, 23, 0, 25]]
1
104
#include <iostream> using namespace std; int main() { int N; cin >> N; if (N / 1000 != 0) { cout << 1000 - N % 1000 << endl; } else { cout << 0 << endl; } }
#include <iostream> using namespace std; int main() { int N; cin >> N; if (N % 1000 != 0) { cout << 1000 - N % 1000 << endl; } else { cout << 0 << endl; } }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109]]
1
48
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++) #define INF 10000000000 #define MOD 1000000007 using ll = long long; using Graph = vector<vector<int>>; int main() { int N; cin >> N; cout << N % 1000 << endl; }
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++) #define INF 10000000000 #define MOD 1000000007 using ll = long long; using Graph = vector<vector<int>>; int main() { int N; cin >> N; cout << (1000 - N % 1000) % ...
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 31, 13], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 109], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 13], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25]]
1
66
#include <iostream> using namespace std; int main() { int n; int x = 0; cin >> n; while (n >= x) x = x + 1000; cout << x - n << endl; }
#include <iostream> using namespace std; int main() { int n; int x = 0; cin >> n; while (n > x) x = x + 1000; cout << x - n << endl; }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47]]
1
44
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n; cin >> n; if (n % 1000 == 0) cout << n / 1000 << endl; else cout << 1000 - (n % 1000) << endl; }
#include <algorithm> #include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n; cin >> n; if (n % 1000 == 0) cout << 0 << endl; else cout << 1000 - (n % 1000) << endl; }
[["-", 64, 1, 0, 16, 31, 16, 12, 16, 31, 22], ["-", 64, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["-", 64, 1, 0, 16, 31, 16, 12, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13]]
1
60