buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #include ...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdint> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #include ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
1,386
#include <bits/stdc++.h> using namespace std; #define int long long #define debug(x) cout << #x << " " << x << endl; const int N = 1e6 + 5; const double eps = 1e-9; const int INF = 1e18; const int P = 1e9 + 7; int n; int a[N]; int cnt[N]; int p[N]; //质数数组 bool mpf[N]; // vis数组 int ind[N], d[N]; //最小...
#include <bits/stdc++.h> using namespace std; #define int long long #define debug(x) cout << #x << " " << x << endl; const int N = 1e6 + 5; const double eps = 1e-9; const int INF = 1e18; const int P = 1e9 + 7; int n; int a[N]; int cnt[N]; int p[N]; //质数数组 bool mpf[N]; // vis数组 int ind[N], d[N]; //最小...
[["+", 0, 27, 28, 69, 341, 342, 0, 69, 28, 22], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["+", 28, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
759
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define vi vector<int> #define vvi vector<vector<int>> #define pb push_back #define pii pair<ll, ll> #define tii tuple<ll, ll, ll> #define all(v) (v).begin(), (v).end() #define ll long long #define deb(x) cout << #x <...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define vi vector<int> #define vvi vector<vector<int>> #define pb push_back #define pii pair<ll, ll> #define tii tuple<ll, ll, ll> #define all(v) (v).begin(), (v).end() #define ll long long #define deb(x) cout << #x <...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["+", 0, 57, 15, 339, 51, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
399
#include <bits/stdc++.h> using namespace std; typedef long long int ll; void solve() { ll n; cin >> n; ll a[n]; ll g; for (int i = 0; i < n; ++i) { cin >> a[i]; /* code */ if (i) g = __gcd(g, a[i]); else g = a[i]; } if (g != 1) { cout << "not coprime" << endl; return; ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; void solve() { ll n; cin >> n; ll a[n]; ll g; for (int i = 0; i < n; ++i) { cin >> a[i]; /* code */ if (i) g = __gcd(g, a[i]); else g = a[i]; } if (g != 1) { cout << "not coprime" << endl; return; ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22]]
1
271
#include <bits/stdc++.h> #define ll long long #define db double using namespace std; const int M = 1e6 + 10; bool vis[M], in[M]; int a[M], n; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]), in[a[i]] = 1; bool flag = 1; for (int i = 2; i < M; i++) if (!vis[i]) { int cn...
#include <bits/stdc++.h> #define ll long long #define db double using namespace std; const int M = 1e6 + 10; bool vis[M]; int in[M]; int a[M], n; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]), in[a[i]]++; bool flag = 1; for (int i = 2; i < M; i++) if (!vis[i]) { int ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 0, 7, 8, 1, 0, 34, 12, 11, 17, 32], ["-", 0, 7, 8, 1, 0, 34, 12, 11, 12, 13], ["+", 0, 7, 8, 1, 0, 34, 12, 27, 17, 29]]
1
243
#include <algorithm> #include <cctype> #include <chrono> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <unordered_map> #define fast ...
#include <algorithm> #include <cctype> #include <chrono> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <limits.h> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <unordered_map> #define fast ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 48]]
1
1,479
// ____ ____ // /@@@@\ |@@@@| ____ // /@@@@@@\ |@@@@| |@@@@| // /@@@@@@@@\ |@@@@| __|@@@@|___ ____ ____ ___ // _________ ____ ____ ____________ ___ _________ // ____ ____ // ...
// ____ ____ // /@@@@\ |@@@@| ____ // /@@@@@@\ |@@@@| |@@@@| // /@@@@@@@@\ |@@@@| __|@@@@|___ ____ ____ ___ // _________ ____ ____ ____________ ___ _________ // ____ ____ // ...
[["+", 31, 66, 28, 2, 3, 4, 0, 16, 17, 72], ["+", 31, 66, 28, 2, 3, 4, 0, 16, 12, 13]]
1
404
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma comment(linker, "/STACK:526000000") #include "bits/stdc++.h" #define int ll using namespace std; typedef string::const_iterator State; #define eps 1e-8L #defin...
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma comment(linker, "/STACK:526000000") #include "bits/stdc++.h" #define int ll using namespace std; typedef string::const_iterator State; #define eps 1e-8L #defin...
[["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46]]
1
7,921
#include <bits/stdc++.h> #pragma GCC optimize 03 #pragma GCC optimize("unroll-loops") #define int long long #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() using namespace std; const int N = 2e6 + 2e5; const int inf = 2e9; const int MOD = 998244353; const int LogN = 30; st...
#include <bits/stdc++.h> #pragma GCC optimize 03 #pragma GCC optimize("unroll-loops") #define int long long #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() using namespace std; const int N = 2e6 + 2e5; const int inf = 2e9; const int MOD = 998244353; const int LogN = 30; st...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
1
843
#include <bits/stdc++.h> const int N = 200010; struct Edge { int start, end; bool operator<(const Edge &e) const { return end < e.end; } }; int a[N], b[N]; int main() { int h, w; scanf("%d%d", &h, &w); for (int i = 0; i < h; ++i) { scanf("%d%d", &a[i], &b[i]); } std::set<Edge> set; for (int i =...
#include <bits/stdc++.h> const int N = 200010; struct Edge { int start, end; bool operator<(const Edge &e) const { return end < e.end; } }; int a[N], b[N]; int main() { int h, w; scanf("%d%d", &h, &w); for (int i = 0; i < h; ++i) { scanf("%d%d", &a[i], &b[i]); } std::set<Edge> set; for (int i =...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
368
N, X, T = map(int, input().split()) if N % X == 0: print(N / X * T) else: print((N / X + 1) * T)
N, X, T = map(int, input().split()) if N % X == 0: print(int(N / X) * T) else: print(int(N / X + 1) * T)
[["+", 0, 652, 3, 4, 0, 657, 31, 652, 63, 22], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 657, 31, 652, 3, 4, 0, 25]]
5
47
#include <bits/stdc++.h> using namespace std; int main() { int x, n, t, ans; cin >> n >> x >> t; ans = (n + x - 1) * x; cout << ans * t << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int x, n, t, ans; cin >> n >> x >> t; ans = (n + x - 1) / x; cout << ans * t << endl; }
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 85]]
1
49
#include <bits/stdc++.h> using namespace std; int N, X, T; int main() { cin >> N >> X >> T; int ans = N / X * T; if (N % X != 0) { ans += T; cout << ans; } }
#include <bits/stdc++.h> using namespace std; int N, X, T; int main() { cin >> N >> X >> T; int ans = N / X * T; if (N % X != 0) { ans += T; } cout << ans; }
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
54
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cmath> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <i...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cmath> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <i...
[["+", 0, 1, 0, 16, 12, 16, 31, 74, 0, 24], ["+", 0, 16, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 1, 0, 16, 12, 16, 31, 74, 0, 25], ["+", 51, 2, 3, 4, 0, 16, 12, 74, 0, 24], ["+", 3, 4, 0, 16, 12, 74, 39, 77, 39, 40], ["+", 51, 2, 3, 4, 0, 16, 12, 74, 0, 25]]
1
92
using namespace std; #include <bits/stdc++.h> int main() { int n, x, t, a = 0; cin >> n >> x >> t; while (n >= 0) { n -= x; a++; } std::cout << a * t << std::endl; }
using namespace std; #include <bits/stdc++.h> int main() { int n, x, t, a = 0; cin >> n >> x >> t; while (n > 0) { n -= x; a++; } std::cout << a * t << std::endl; }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47]]
1
58
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int n = in.nextInt(); int x = in.nextInt(); int t = in.nextI...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int n = in.nextInt(); int x = in.nextInt(); int t = in.nextI...
[["+", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 195, 8, 196, 0, 1, 0, 11, 17, 108], ["+", 0, 195, 8, 196, 0, 1, 0, 11, 12, 22], ["+", 8, 498, 0, 195, 8, 196, 0, 1, 0, 35]]
3
111
#include <bits/stdc++.h> using namespace std; int main() { int n, x, t; cin >> n >> x >> t; for (int i = 1; i > 0; i++) { if (i * x > n) { cout << i * t; break; } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, x, t; cin >> n >> x >> t; for (int i = 1; i > 0; i++) { if (i * x >= n) { cout << i * t; break; } } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
64
line = gets.chomp.map(&:to_i) #line = [1000, 1, 1000] N, X, T = line shortest_time = 0 if N <= X shortest_time = T elsif N > X burn_time = N / X # 1 if N % X != 0 # 8 shortest_time = (burn_time * T) + T else shortest_time = T * burn_time end end p shortest_time
line = gets.chomp.split(" ").map(&:to_i) # line = [1000, 1, 1000] N, X, T = line shortest_time = 0 if N <= X shortest_time = T elsif N > X burn_time = N / X # 1 if N % X != 0 # 8 shortest_time = (burn_time * T) + T else shortest_time = T * burn_time end end p shortest_time
[["+", 0, 493, 0, 662, 12, 652, 486, 652, 735, 22], ["+", 0, 662, 12, 652, 486, 652, 3, 4, 0, 24], ["+", 12, 652, 486, 652, 3, 4, 0, 557, 0, 62], ["+", 12, 652, 486, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 662, 12, 652, 486, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131]]
4
65
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define x first #define y second #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define sz(v) (int)v.size() #define up_b upper_bound #define low_b lower_bound #define nl '\n' using namespace std; using namespace __gnu_pbds; ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define x first #define y second #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define sz(v) (int)v.size() #define up_b upper_bound #define low_b lower_bound #define nl '\n' using namespace std; using namespace __gnu_pbds; ...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
477
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; const int maxn = 1000050; int prime[maxn]; int a[maxn]; bo...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; const int maxn = 1000050; int prime[maxn]; int a[maxn]; bo...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
387
// g++ t.cpp -o t && t < p.txt // d>p.txt&&t<p.txt&&t2<p.txt #include <algorithm> // みんな大好きソートと二分探索 #include <bitset> #include <ctime> #include <functional> // 関数を変数に入れる子 #include <iostream> // プログラムの耳と口 #include <map> // setの妹 これまた優秀 #include <queue> // きゅーちゃん、だいすき #include <random> // 乱択さん #include...
// g++ t.cpp -o t && t < p.txt // d>p.txt&&t<p.txt&&t2<p.txt #include <algorithm> // みんな大好きソートと二分探索 #include <bitset> #include <ctime> #include <functional> // 関数を変数に入れる子 #include <iostream> // プログラムの耳と口 #include <map> // setの妹 これまた優秀 #include <queue> // きゅーちゃん、だいすき #include <random> // 乱択さん #include...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 48]]
1
769
#include <bits/stdc++.h> #define f(i, a, b) for (ll i = a; i < b; i++) #define af(i, a, b) for (ll i = a; i >= b; i--) #define rep(i, a, b, k) for (ll i = a; i < b; i += k) #define arep(i, a, b, k) for (ll i = a; i >= b; i -= k) #define ff first #define ss second #define pb push_back #define mp make_pair #define sz(a)...
#include <bits/stdc++.h> #define f(i, a, b) for (ll i = a; i < b; i++) #define af(i, a, b) for (ll i = a; i >= b; i--) #define rep(i, a, b, k) for (ll i = a; i < b; i += k) #define arep(i, a, b, k) for (ll i = a; i >= b; i -= k) #define ff first #define ss second #define pb push_back #define mp make_pair #define sz(a)...
[["-", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 1, 0, 16, 12, 5, 0, 6]]
1
341
#include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #ifdef on_linux #include <sys/resource.h> #endif #ifdef dobby_is_a_free_elf #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) #else #define trace(...) 0; #endif using namespace std; using namespace __gnu_pbds; #de...
#include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #ifdef on_linux #include <sys/resource.h> #endif #ifdef dobby_is_a_free_elf #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) #else #define trace(...) 0; #endif using namespace std; using namespace __gnu_pbds; #de...
[["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
2,871
#include <bits/stdc++.h> #define int long long using namespace std; long long power(long long a, long long b, long long m) { long long res = 1; while (b > 0) { if (b & 1) res = res * a % m; a = a * a % m; b >>= 1; } return res; } int pr[1000005]; vector<int> divi[1000005]; void bin() { for ...
#include <bits/stdc++.h> #define int long long using namespace std; long long power(long long a, long long b, long long m) { long long res = 1; while (b > 0) { if (b & 1) res = res * a % m; a = a * a % m; b >>= 1; } return res; } int pr[1000005]; vector<int> divi[1000005]; void bin() { for ...
[["-", 0, 57, 64, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 57, 64, 9, 0, 7, 26, 11, 17, 107], ["+", 0, 57, 64, 9, 0, 7, 26, 11, 12, 22]]
1
382
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; template <class c, class cmp = less<c>> using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>; #define IOS ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; template <class c, class cmp = less<c>> using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>; #define IOS ...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107]]
1
615
import sys sys.setrecursionlimit(500005) stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().strip() n = ni() a = na() f = [0] * 1000001 for v in a: f[v] += 1 for i in range(500000, 1, -1): for j in range(i*2, 1000001, i): f[i]...
import sys sys.setrecursionlimit(500005) stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().strip() n = ni() a = na() f = [0] * 1000001 for v in a: f[v] += 1 for i in range(2, 500001): for j in range(i*2, 1000001, i): f[i] += ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 7, 12, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 664, 28, 612]]
5
202
from math import gcd N=int(input()) A=list(map(int,input().split())) data = [0]*(10**6+1) for a in A: data[a] += 1 pair = True for i in range(1,10**6+1): check = 0 for j in range(1,(10**6)//i+1): check += data[i*j] if check>1: pair = False if pair: print("pairwise coprime") els...
from math import gcd N=int(input()) A=list(map(int,input().split())) data = [0]*(10**6+1) for a in A: data[a] += 1 pair = True for i in range(2,10**6+1): check = 0 for j in range(1,(10**6)//i+1): check += data[i*j] if check>1: pair = False if pair: print("pairwise coprime") el...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
164
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> #define mkp make_pair #define mkt make_tuple #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(v) v.begin(), v.end() using namespace ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> #define mkp make_pair #define mkt make_tuple #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(v) v.begin(), v.end() using namespace ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
431
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(a) a.begin(), a.end() #define rrng(a) a.rbegin()...
#include <bits/stdc++.h> #define fi first #define se second #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define srep(i, s, t) for (int i = s; i < t; ++i) #define rng(a) a.begin(), a.end() #define rrng(a) a.rbegin()...
[["+", 64, 9, 0, 57, 15, 339, 51, 16, 31, 13], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
1,262
#include <bits/stdc++.h> using namespace std; int h, w; map<int, int> available; multiset<int> minDist; int main() { scanf("%d%d", &h, &w); for (int i = 1; i <= w; i++) available[i] = i, minDist.insert(0); for (int i = 0; i < h; i++) { int a, b; scanf("%d%d", &a, &b); auto cur = available.lower_...
#include <bits/stdc++.h> using namespace std; int h, w; map<int, int> available; multiset<int> minDist; int main() { scanf("%d%d", &h, &w); for (int i = 1; i <= w; i++) available[i] = i, minDist.insert(0); for (int i = 0; i < h; i++) { int a, b; scanf("%d%d", &a, &b); auto cur = available.lower_...
[["+", 15, 339, 51, 16, 12, 16, 12, 16, 17, 72], ["+", 15, 339, 51, 16, 12, 16, 12, 16, 12, 13]]
1
240
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using namespace std; template <typename T> using vec = std::vector<T>; int main() { int H, W; cin >> H >> W; map<int, int> mp; multiset<int> ms; rep(i, W) mp[i] = i; rep(_, ...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using namespace std; template <typename T> using vec = std::vector<T>; int main() { int H, W; cin >> H >> W; map<int, int> mp; multiset<int> ms; rep(i, W) mp[i] = i; rep(_, ...
[["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 19]]
1
261
#include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); typedef long long ll; typedef long...
#include <bits/stdc++.h> #define FAST \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); typedef long long ll; typedef long...
[["+", 15, 339, 51, 16, 31, 16, 31, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 17, 79], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 98], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
656
// hail to jwalaji #include <bits/stdc++.h> using namespace std; typedef long long int lli; lli h, w, a, b, f, t, e; set<pair<lli, lli>> st; multiset<lli> ms; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin >> h >> w; for (lli i = 0; i < h; i++) { st.insert({i, i}); ms.insert(0); } for ...
// hail to jwalaji #include <bits/stdc++.h> using namespace std; typedef long long int lli; lli h, w, a, b, f, t, e; set<pair<lli, lli>> st; multiset<lli> ms; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin >> h >> w; for (lli i = 0; i < w; i++) { st.insert({i, i}); ms.insert(0); } for ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
268
// thuanqvbn03 #include <bits/stdc++.h> using namespace std; const int oo = 1e9; struct SegmentTree { vector<long long> IT, Lazy; vector<int> Low, High; void InitTree(int x, int Left, int Right, int type) { Low[x] = Left; High[x] = Right; Lazy[x] = 0; if (Left == Right) { IT[x] = type; ...
// thuanqvbn03 #include <bits/stdc++.h> using namespace std; const int oo = 1e9; struct SegmentTree { vector<long long> IT, Lazy; vector<int> Low, High; void InitTree(int x, int Left, int Right, int type) { Low[x] = Left; High[x] = Right; Lazy[x] = 0; if (Left == Right) { IT[x] = type * L...
[["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
764
#include <bits/stdc++.h> using namespace std; int main(void) { int n, k; scanf("%d %d", &n, &k); map<int, int> m; multiset<int> s; for (int i = 1; i <= n; ++i) m[i] = 0, s.insert(0); for (int i = 1; i <= k; ++i) { int l, r; scanf("%d %d", &l, &r); int x = 0, y = n + 1; auto it = m.lower...
#include <bits/stdc++.h> using namespace std; int main(void) { int n, k; scanf("%d %d", &k, &n); map<int, int> m; multiset<int> s; for (int i = 1; i <= n; ++i) m[i] = 0, s.insert(0); for (int i = 1; i <= k; ++i) { int l, r; scanf("%d %d", &l, &r); int x = 0, y = n + 1; auto it = m.lower...
[["-", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22]]
1
248
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; typedef pair<int, int> P; const int INF = 0x3f3f3f3f; template <class T, class U> class LazySegtree { int n; vector<T> dat; vector<U> lazy; T INIT; T E0; U E1; function<T(T, U, int)> F0; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; typedef pair<int, int> P; const int INF = 0x3f3f3f3f; template <class T, class U> class LazySegtree { int n; vector<T> dat; vector<U> lazy; T INIT; T E0; U E1; function<T(T, U, int)> F0; ...
[["-", 51, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 51, 2, 3, 4, 0, 2, 63, 118, 28, 22], ["+", 3, 4, 0, 16, 31, 69, 341, 342, 0, 73], ["-", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
1,496
from collections import defaultdict def gcd(a, b): if a < b: return gcd(b, a) while b > 0: a, b = b, a % b return a def sieve_of_eratosthenes_max(n): sieve = [0] * (n+1) sieve[0] = 1 #素数でない sieve[1] = 1 #素数でない for i in range(2, n): if sieve[i] == 0: for ...
from collections import defaultdict def gcd(a, b): if a < b: return gcd(b, a) while b > 0: a, b = b, a % b return a def sieve_of_eratosthenes_max(n): sieve = [0] * (n+1) sieve[0] = 0 #素数でない sieve[1] = 1 #素数でない for i in range(2, n+1): if sieve[i] == 0: fo...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
293
class Sieve: """ N以下の素数を列挙するエラトステネスのふるいです。 O(NloglogN)でできます。 Attributes sieveList : その数の素因数のうち最小のものの配列 primes : N以下の素因数のリスト """ def __init__(self, N): self.sieveList = [-1 for _ in range(N+1)] self.sieveList[1] = 1 self.primes = [] for i in range(2, N+1)...
class Sieve: """ N以下の素数を列挙するエラトステネスのふるいです。 O(NloglogN)でできます。 Attributes sieveList : その数の素因数のうち最小のものの配列 primes : N以下の素因数のリスト """ def __init__(self, N): self.sieveList = [-1 for _ in range(N+1)] self.sieveList[1] = 1 self.primes = [] for i in range(2, N+1)...
[["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
384
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using LL = long long; using P = pair<int, int>; const int Max_A = 1e6; const int INF = 1e8; bool prime[Max_A]; int main() { int N; cin >> N; vector<int> A(N); rep(i, N) cin >> A[i]; vector<int> p; rep(i, Ma...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using LL = long long; using P = pair<int, int>; const int Max_A = 1e6; const int INF = 1e8; bool prime[Max_A]; int main() { int N; cin >> N; vector<int> A(N); rep(i, N) cin >> A[i]; vector<int> p; rep(i, Ma...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 48], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 22]]
1
349
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; using graph = vector<vector<int>>; const ll mod = 1000000007; const int INF = 1001001001; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { cin.tie(0); ios::s...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; using graph = vector<vector<int>>; const ll mod = 1000000007; const int INF = 1001001001; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { cin.tie(0); ios::s...
[["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 12, 22], ["-", 15, 339, 51, 2, 3, 4, 0, 16, 31, 22], ["-", 15, 339, 51, 2, 3, 4, 0, 16, 17, 48], ["-", 15, 339, 51, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 2, 3, 4, 0, 22]]
1
379
#include <bits/stdc++.h> using namespace std; template <class INT> std::vector<INT> get_min_prime_fact_table(INT n) { std::vector<INT> lp(n + 1), P; for (INT i = 2; i <= n; i++) { if (lp[i] == 0) { lp[i] = i; P.push_back(i); } for (INT j = 0; j <= P.size() and P[j] <= lp[i] and i * P[j] <=...
#include <bits/stdc++.h> using namespace std; template <class INT> std::vector<INT> get_min_prime_fact_table(INT n) { std::vector<INT> lp(n + 1), P; for (INT i = 2; i <= n; i++) { if (lp[i] == 0) { lp[i] = i; P.push_back(i); } for (INT j = 0; j <= P.size() and P[j] <= lp[i] and i * P[j] <=...
[["+", 8, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
1
436
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define LL long long const int MAXN = 10000000 + 5; const LL MOD = 1000000000 + 7; int c[MAXN], a[MAXN]; void divide(int m) { for (int i = 2; i * i <= m; i++) { ...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <queue> #include <string> #include <vector> using namespace std; #define LL long long const int MAXN = 10000000 + 5; const LL MOD = 1000000000 + 7; int c[MAXN], a[MAXN]; void divide(int m) { for (int i = 2; i * i <= m; i++) { ...
[["-", 341, 342, 0, 118, 28, 69, 341, 342, 0, 13], ["+", 341, 342, 0, 118, 28, 69, 341, 342, 0, 22]]
1
556
#include <bits/stdc++.h> using namespace std; #define d(x) cerr << #x ":" << x << endl; #define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl #define rep(i, n) for (int i = (int)(0); i < (int)(n); i++) #define all(v) v.begin(), v.end() #define dump(v) ...
#include <bits/stdc++.h> using namespace std; #define d(x) cerr << #x ":" << x << endl; #define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl #define rep(i, n) for (int i = (int)(0); i < (int)(n); i++) #define all(v) v.begin(), v.end() #define dump(v) ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
318
#include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using P = pair<int, int>; #include <algorithm> #include <map> #include <math.h> #include <queue> #include <set> //素因数分解  // pair<ll,ll>型 // auto pf=prime_factorize(ll N);で呼ぶ // for(auto p:pf...
#include <iostream> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using P = pair<int, int>; #include <algorithm> #include <map> #include <math.h> #include <queue> #include <set> //素因数分解  // pair<ll,ll>型 // auto pf=prime_factorize(ll N);で呼ぶ // for(auto p:pf...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 57, 64, 1, 0, 16, 12, 5, 0, 6]]
1
273
// wtrl,everybody hangbeat me #include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stri...
// wtrl,everybody hangbeat me #include <algorithm> #include <bits/stdc++.h> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <stri...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]]
1
1,459
import sys import math from collections import deque from collections import defaultdict sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(int, input().split()) NLI = lambda: list(NMI()) SI = lambda: input() def make_grid(h, w, n...
import sys import math from collections import deque from collections import defaultdict sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(int, input().split()) NLI = lambda: list(NMI()) SI = lambda: input() def make_grid(h, w, n...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
545
N = int(input()) A = list(map(int, input().split())) max_A = 10**6+1 dp = [0] * (max_A) for i in range(N): dp[A[i]] += 1 pairwize = True for i in range(2, max_A): cnt = 0 # 素数の倍数がdp配列に存在するか。自分以外にあれば2以上になる for j in range(i, max_A, i): cnt += dp[j] if cnt > 1: pairwize = False if p...
N = int(input()) A = list(map(int, input().split())) max_A = 10**6+1 dp = [0] * (max_A) for i in range(N): dp[A[i]] += 1 pairwise = True for i in range(2, max_A): cnt = 0 # 素数の倍数がdp配列に存在するか。自分以外にあれば2以上になる for j in range(i, max_A, i): cnt += dp[j] if cnt > 1: pairwise = False if p...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 57, 15, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 15, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", ...
5
158
def main(): n, *a, = map(int, open(0).read().split()) m = max(a) d = [0] * (m + 1) d[1] = 1 for i in range(2, m + 1): for j in range(i, m + 1, i): if d[j] == 0: d[j] = i def primes(x): ps = set() while x != 1: p = d[x] ...
def main(): n, *a, = map(int, open(0).read().split()) m = max(a) d = [0] * (m + 1) d[1] = 1 for i in range(2, m + 1): for j in range(i, m + 1, i): if d[j] == 0: d[j] = i def primes(x): ps = set() while x != 1: p = d[x] ...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
223
def main(): from math import gcd _ = int(input()) A = [int(i) for i in input().split()] def prime_factorize(n): for i in range(2, n+1): if i*i > n: break if n % i != 0: continue while n % i == 0: n //= i ...
def main(): from math import gcd _ = int(input()) A = [int(i) for i in input().split()] def prime_factorize(n): for i in range(2, n+1): if i*i > n: break if n % i != 0: continue while n % i == 0: n //= i ...
[["+", 8, 196, 0, 14, 8, 196, 0, 57, 0, 121], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 79], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 8, 196, 0, 14, 8, 196, 0, 57, 0, 102]]
5
204
#require 'pp' require 'prime' MAX = 10 ** 6 n = gets.to_i a_n = gets.split.map(&:to_i) memo = Array.new(10 ** 6 + 1, 0) primes = Array.new(10 ** 6 + 1, 0) Prime.each(MAX) do |i| primes[i] = 1 end #pp primes.tally all_gcd = a_n[0] 1.upto(n-1) do |i| all_gcd = all_gcd.gcd(a_n[i]) end # 全GCDが1でない場合どちらでもない if a...
#require 'pp' require 'prime' MAX = 10 ** 6 n = gets.to_i a_n = gets.split.map(&:to_i) memo = Array.new(10 ** 6 + 1, 0) primes = Array.new(10 ** 6 + 1, 0) Prime.each(MAX) do |i| primes[i] = 1 end #pp primes.tally all_gcd = a_n[0] 1.upto(n-1) do |i| all_gcd = all_gcd.gcd(a_n[i]) end # 全GCDが1でない場合どちらでもない if a...
[["+", 196, 737, 8, 736, 0, 121, 15, 738, 17, 98], ["+", 8, 736, 0, 121, 15, 738, 12, 738, 31, 22], ["+", 8, 736, 0, 121, 15, 738, 12, 738, 17, 79], ["+", 8, 736, 0, 121, 15, 738, 12, 738, 12, 612]]
4
224
#include <bits/stdc++.h> #define pb emplace_back #define LOCAL using namespace std; const int inf = 0x3f3f3f3f; const int maxn = 1e6 + 5; typedef long long ll; typedef pair<int, int> Pii; template <typename T> inline void read(T &t) { char c = getchar(); t = 0; int f = 1; while (!isdigit(c)) { if (c == '...
#include <bits/stdc++.h> #define pb emplace_back #define LOCAL using namespace std; const int inf = 0x3f3f3f3f; const int maxn = 1e6 + 5; typedef long long ll; typedef pair<int, int> Pii; template <typename T> inline void read(T &t) { char c = getchar(); t = 0; int f = 1; while (!isdigit(c)) { if (c == '...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 48]]
1
504
// https://atcoder.jp/contests/abc177/tasks/abc177_e #include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, n) FOR(i, 0, n) #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define ALL(obj) (obj).begin(), (obj).end() #define ALLR(obj) (obj).rbegin(), (obj).rend() #defi...
// https://atcoder.jp/contests/abc177/tasks/abc177_e #include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, n) FOR(i, 0, n) #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define ALL(obj) (obj).begin(), (obj).end() #define ALLR(obj) (obj).rbegin(), (obj).rend() #defi...
[["+", 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, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
393
import sys import math N_MAX = 200000 + 5 INF = 10**9 + 7 sys.setrecursionlimit(N_MAX) MOD = 10**9 + 7 def eatosthenes(N): prime = [] D = [1] * (N + 1) for i in range(2, N + 1): if D[i] != 1: continue for j in range(N // i + 1): if D[i * j] == 1: ...
import sys import math N_MAX = 200000 + 5 INF = 10**9 + 7 sys.setrecursionlimit(N_MAX) MOD = 10**9 + 7 def eatosthenes(N): prime = [] D = [1] * (N + 1) for i in range(2, N + 1): if D[i] != 1: continue for j in range(N // i + 1): if D[i * j] == 1: ...
[["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 38], ["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 22]]
5
290
import sys import math N_MAX = 200000 + 5 INF = 10**9 + 7 sys.setrecursionlimit(N_MAX) MOD = 10**9 + 7 def main(): N = int(sys.stdin.readline().rstrip()) A = [int(x) for x in sys.stdin.readline().rstrip().split()] maxA = max(A) # 1 <= a <= maxA までの、要素の登場回数 C = [0] * (maxA + 1) for a in A: ...
import sys import math N_MAX = 200000 + 5 INF = 10**9 + 7 sys.setrecursionlimit(N_MAX) MOD = 10**9 + 7 def main(): N = int(sys.stdin.readline().rstrip()) A = [int(x) for x in sys.stdin.readline().rstrip().split()] maxA = max(A) # 1 <= a <= maxA までの、要素の登場回数 C = [0] * (maxA + 1) for a in A: ...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
213
def sieve(n): is_prime = [True for _ in range(n+1)] is_prime[0] = False for i in range(2, n+1): if is_prime[i-1]: j = 2 * i while j <= n: is_prime[j-1] = False j += i table = [i for i in range(1, n+1) if is_prime[i-1]] return table N = int(input()) A = list(map(int, input().sp...
def sieve(n): is_prime = [True for _ in range(n+1)] is_prime[0] = False for i in range(2, n+1): if is_prime[i-1]: j = 2 * i while j <= n: is_prime[j-1] = False j += i table = [i for i in range(1, n+1) if is_prime[i-1]] return table N = int(input()) A = list(map(int, input().sp...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
228
def resolve(): import sys from math import gcd input = sys.stdin.readline n=int(input()) a=list(map(int,input().split())) m=10**6+5 chk=[0]*m for i in a: chk[i]+=1 pw=1 for i in range(2,m): cnt=0 for j in range(i,m,i): cnt+=chk[j] if cnt>1: ...
def resolve(): import sys from math import gcd input = sys.stdin.readline n=int(input()) a=list(map(int,input().split())) m=10**6+5 chk=[0]*m for i in a: chk[i]+=1 pw=1 for i in range(2,m): cnt=0 for j in range(i,m,i): cnt+=chk[j] if cnt>1: ...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612]]
5
174
#include <algorithm> #include <bitset> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unordered_map> #include <vector> long long mod = 1e9 + 7; class Mint { public: long long ...
#include <algorithm> #include <bitset> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unordered_map> #include <vector> long long mod = 1e9 + 7; class Mint { public: long long ...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
1,025
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<ll, ll> P; 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...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; typedef pair<ll, ll> P; 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...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 64, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
1,479
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include ...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include ...
[["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6]]
1
355
import sys,math n=int(input()) a=list(map(int,input().split())) numbers={} flag=0 for i in range(n): if a[i] in numbers: numbers[a[i]]+=1 else: numbers[a[i]]=1 while pointer in range(2,10**6+1): count=0 pointer2=pointer while pointer2<10**6+1: if pointer2 in numbers: count+=numbers[pointer2]...
import sys,math n=int(input()) a=list(map(int,input().split())) numbers={} flag=0 for i in range(n): if a[i] in numbers: numbers[a[i]]+=1 else: numbers[a[i]]=1 for pointer in range(2,10**6+1): count=0 pointer2=pointer while pointer2<10**6+1: if pointer2 in numbers: count+=numbers[pointer2] ...
[["-", 36, 36, 36, 36, 0, 656, 0, 52, 0, 89], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88]]
5
188
// // main.cpp // ervb // // Created by Kanak Gautam on 21/04/20. // Copyright © 2020 Kanak Gautam. All rights reserved. // #include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #includ...
// // main.cpp // ervb // // Created by Kanak Gautam on 21/04/20. // Copyright © 2020 Kanak Gautam. All rights reserved. // #include <algorithm> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #includ...
[["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
701
from collections import Counter N = int(input()) A = list(map(int, input().split())) x = max(A) hurui = [x]*(x+1) for i in range(2, x+1): for j in range(i, x, i): hurui[j] = min(i, hurui[j]) cnt = Counter() for i in range(N): num = A[i] while num > 1: x = hurui[num] while num%x == ...
from collections import Counter N = int(input()) A = list(map(int, input().split())) x = max(A) hurui = [x]*(x+1) for i in range(2, x+1): for j in range(i, x+1, i): hurui[j] = min(i, hurui[j]) cnt = Counter([1]) for i in range(N): num = A[i] while num > 1: x = hurui[num] while num%...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 662, 12, 652, 3, 4, 0, 634, 0, 70], ["+", 0, 662, 12, 652, 3, 4, 0, 634, 0, 612], ["+", 0, 662, 12, 652, 3, 4, 0, 634, 0, 73]]
5
174
#include <bits/stdc++.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define ordered_set tree<int, null_type,less<int>, // rb_tree_tag,tree_order_statistics_node_update> #define ll long long #define fill fill_n #define pf ...
#include <bits/stdc++.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define ordered_set tree<int, null_type,less<int>, // rb_tree_tag,tree_order_statistics_node_update> #define ll long long #define fill fill_n #define pf ...
[["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
536
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <set> #include <stdio.h> #include <string.h> #include <vector> using namespace std; int gcd(int a, int b) { int mi = std::min(a, b); int ma = std::max(a, b); if (mi == 0) { return ma; } else { return gcd(ma % mi, mi); ...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <set> #include <stdio.h> #include <string.h> #include <vector> using namespace std; int gcd(int a, int b) { int mi = std::min(a, b); int ma = std::max(a, b); if (mi == 0) { return ma; } else { return gcd(ma % mi, mi); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
470
#include <bits/stdc++.h> using namespace std; using ll = long long; const int sz = 1e6 + 1; vector<bool> p(sz); vector<int> g(sz); void solve() { // INPUT int n; cin >> n; set<int> st; bool pairwise = true; int cp = 0; for (int i = 0; i < n; ++i) { int a; cin >> a; if (st.count(a)) pai...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int sz = 1e6 + 1; vector<bool> p(sz); vector<int> g(sz); void solve() { // INPUT int n; cin >> n; set<int> st; bool pairwise = true; int cp = 0; for (int i = 0; i < n; ++i) { int a; cin >> a; if (st.count(a) && a != 1)...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
382
#include <bits/stdc++.h> using namespace std; using ll = long long; const int L = 1e6 + 1; vector<bool> p(L); vector<int> g(L); void solve() { // INPUT int n; cin >> n; set<int> st; bool pairwise = true; int cp = 0; for (int i = 0; i < n; ++i) { int a; cin >> a; if (st.count(a)) pairwi...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int L = 1e6 + 1; vector<bool> p(L); vector<int> g(L); void solve() { // INPUT int n; cin >> n; set<int> st; bool pairwise = true; int cp = 0; for (int i = 0; i < n; ++i) { int a; cin >> a; if (st.count(a) && a != 1) ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
261
#include <bits/stdc++.h> using namespace std; #define int long long #define mod 1000000007 int32_t main() { int n; cin >> n; vector<int> a(n), s(1000005); int flag1 = 0, GCD = 1; for (int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); for (int i = 0; i < n; i++) { int j = 2; fo...
#include <bits/stdc++.h> using namespace std; #define int long long #define mod 1000000007 int32_t main() { int n; cin >> n; vector<int> a(n), s(1000005); int flag1 = 0, GCD = 1; for (int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); for (int i = 0; i < n; i++) { int j = 2; fo...
[["-", 64, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 106]]
1
284
/*------------------------------------ ........Bismillahir Rahmanir Rahim.... ..........created by Abdul Aziz....... ------------------------------------*/ #include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #includ...
/*------------------------------------ ........Bismillahir Rahmanir Rahim.... ..........created by Abdul Aziz....... ------------------------------------*/ #include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #includ...
[["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22]]
1
282
# E N=int(input()) A=list(map(int,input().split())) def gcd(a,b): if a>b: a,b=b,a while a%b: a,b=b,(a%b) return b def fast_factorization_init(N): res=list(range(N)) for i in range(2,N): if i*i>N: break for j in range(i*i,N,i): if res[j]==j: ...
# E N=int(input()) A=list(map(int,input().split())) def gcd(a,b): if a>b: a,b=b,a while a%b: a,b=b,(a%b) return b def fast_factorization_init(N): res=list(range(N)) for i in range(2,N): if i*i>N: break for j in range(i*i,N,i): if res[j]==j: ...
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 72], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 18], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
281
// {{{ by unolight #include <bits/stdc++.h> #include <unistd.h> #pragma GCC diagnostic ignored "-Wunused-result" #pragma GCC diagnostic ignored "-Wunused-function" #define SZ(x) ((int)(x).size()) #define ALL(x) begin(x), end(x) #define RALL(x) rbegin(x), rend(x) #define REP(i, n) for (int i = 0; i < int(n); i++) #defin...
// {{{ by unolight #include <bits/stdc++.h> #include <unistd.h> #pragma GCC diagnostic ignored "-Wunused-result" #pragma GCC diagnostic ignored "-Wunused-function" #define SZ(x) ((int)(x).size()) #define ALL(x) begin(x), end(x) #define RALL(x) rbegin(x), rend(x) #define REP(i, n) for (int i = 0; i < int(n); i++) #defin...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
903
#include <bits/stdc++.h> using namespace std; const int nax = 1e6 + 6; int val[nax]; int main() { int n; cin >> n; vector<int> a(n); for (int &x : a) cin >> x, val[x]++; int gcd = a[0]; for (int x : a) gcd = __gcd(gcd, x); if (gcd != 1) { cout << "not coprime"; return 0; } for (int i...
#include <bits/stdc++.h> using namespace std; const int nax = 1e6 + 6; int val[nax]; int main() { int n; cin >> n; vector<int> a(n); for (int &x : a) cin >> x, val[x]++; int gcd = a[0]; for (int x : a) gcd = __gcd(gcd, x); if (gcd != 1) { cout << "not coprime"; return 0; } for (int i...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 48]]
1
171
require 'prime' def max(a,b); a > b ? a : b; end N = gets.to_i A = gets.split.map(&:to_i) Amax = A.max dp = Array.new(Amax + 1, 0) A.each do |a| dp[a] += 1 end ans = Prime.each(Amax).inject(-1) do |s, i| cnt = 0 j = i while j <= Amax cnt += dp[j] j += i end max(s, cnt) end if ans <= 1 puts "pai...
require 'prime' def max(a,b); a > b ? a : b; end N = gets.to_i A = gets.split.map(&:to_i) Amax = A.max dp = Array.new(Amax + 1, 0) A.each do |a| dp[a] += 1 end ans = Prime.each(Amax).inject(-1) do |s, i| cnt = 0 j = i while j <= Amax cnt += dp[j] j += i end max(s, cnt) end if ans <= 1 puts "pai...
[["-", 75, 95, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 75, 95, 0, 652, 3, 4, 0, 557, 0, 6]]
4
137
from math import gcd N = int(input()) A = list(map(int, input().split())) # setwise validation tmp = 0 for a in A: tmp = gcd(tmp, a) isSetwise = (tmp == 1) # pairwise validation # M = 10 ** 6 # A = set(A) # isPairwise = True # for i in range(2, M): # cnt = 0 # ni = 0 # while ni <= M: # cnt ...
from math import gcd N = int(input()) A = list(map(int, input().split())) # setwise validation tmp = 0 for a in A: tmp = gcd(tmp, a) isSetwise = (tmp == 1) # pairwise validation M = 10 ** 6 sieve = [0] * (M + 1) for a in A: sieve[a] += 1 cnt = 0 for i in range(2, M + 1): cnt = max(cnt, sum(sieve[j] fo...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["-", 3, 4, 0, 652, 3, 668, 8, 666, 667, 60], ["-", 3, 4, 0, 652, 3, 668, 8, 666, 0, 612]]
5
170
from math import gcd N = int(input()) a = list(map(int, input().split())) am = max(a) memo = [1] * (am+1) memo[0] = 0 memo[1] = 0 d = set([]) for ai in range(2, am+1): for j in range(2, am // ai + 1): memo[ai * j] = 0 cs = set([]) for i, memoi in enumerate(memo): if memoi: cs.add(i) # pri...
from math import gcd N = int(input()) a = list(map(int, input().split())) am = max(a) memo = [1] * (am+1) memo[0] = 0 memo[1] = 0 d = set([]) for ai in range(2, am+1): for j in range(2, am // ai + 1): memo[ai * j] = 0 cs = set([]) for i, memoi in enumerate(memo): if memoi: cs.add(i) # pri...
[["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
278
from math import gcd N = int(input()) A = list(map(int, input().split())) g_all = A[0] for a in A[1:]: g_all = gcd(g_all, a) if g_all > 1: print('not coprime') quit() def sieve(n): is_prime = [True for _ in range(n+1)] is_prime[0] = False for i in range(2, n+1): if is_prime[i-1]: ...
from math import gcd N = int(input()) A = list(map(int, input().split())) g_all = A[0] for a in A[1:]: g_all = gcd(g_all, a) if g_all > 1: print('not coprime') quit() def sieve(n): is_prime = [True for _ in range(n+1)] is_prime[0] = False for i in range(2, n+1): if is_prime[i-1]: ...
[["+", 0, 656, 0, 1, 0, 662, 12, 206, 0, 70], ["+", 0, 656, 0, 1, 0, 662, 12, 206, 206, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 206, 0, 73]]
5
267
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); i++) using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { ll n, g = 0; ll cnt[1000005]; cin >> n; rep(i, n) { ll a; cin >> a; cnt[a]++; g = gcd(g, a); } bool ok = tr...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < (n); i++) using namespace std; typedef long long ll; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { ll n, g = 0, cnt[1000005] = {}; cin >> n; rep(i, n) { ll a; cin >> a; cnt[a]++; g = gcd(g, a); } bool ok = tr...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
1
182
def gcd(x, y): if x < y: x, y = y, x while x % y != 0: x, y = y, x % y return y def gcd3(ll): ans = ll[0] for i in range(1, len(ll)): ans = gcd(ans, ll[i]) return ans D = {} def prime_div(n, A): if len(D) == 0: for a in range(2, A + 1, 2): D[a]...
def gcd(x, y): if x < y: x, y = y, x while x % y != 0: x, y = y, x % y return y def gcd3(ll): ans = ll[0] for i in range(1, len(ll)): ans = gcd(ans, ll[i]) return ans D = {} def prime_div(n, A): if len(D) == 0: for a in range(2, A + 1, 2): D[a]...
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
319
#include <bits/stdc++.h> using namespace std; int a[1000005], cnt[1000005], cnt2[1000005]; int main() { int n, g = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]), cnt[a[i]]++, g = __gcd(a[i], g); bool ok = 1; for (int i = 2; i <= 1000000; i++) { for (int j = i + i; j <= 1000000; j...
#include <bits/stdc++.h> using namespace std; int a[1000005], cnt[1000005], cnt2[1000005]; int main() { int n, g = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]), cnt[a[i]]++, g = __gcd(a[i], g); bool ok = 1; for (int i = 2; i <= 1000000; i++) { for (int j = i; j <= 1000000; j += ...
[["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 22]]
1
192
#include <bits/stdc++.h> using namespace std; #define ll long long #define print(r) cout << r << endl #define prints(r) cout << r << " " #define printline cout << endl #define lim (ll)(1e6 + 1) int main() { ll n; cin >> n; vector<ll> arr(lim, 0); int pc = 1, sc = 1; ll t; for (ll i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define print(r) cout << r << endl #define prints(r) cout << r << " " #define printline cout << endl #define lim (ll)(1e6 + 1) int main() { ll n; cin >> n; vector<ll> arr(lim, 0); int pc = 1, sc = 1; ll t; for (ll i = 0; i < n; i++) { ...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 29]]
1
269
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MX = 1e6 + 5; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<int> a(n); vector<int> cnt(MX); int tot_gcd = 0; for (i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MX = 1e6 + 5; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<int> a(n); vector<int> cnt(MX); int tot_gcd = 0; for (i...
[["-", 0, 7, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 7, 8, 9, 0, 7, 26, 11, 17, 107], ["+", 0, 7, 8, 9, 0, 7, 26, 11, 12, 22]]
1
374
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cmath> //sqrt pow #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // dequef #includ...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cmath> //sqrt pow #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // dequef #includ...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
317
#include <iostream> using namespace std; int main(void) { // Your code here! int N, X, T; cin >> N >> X >> T; int count = N / X; if (N % T != 0) { count++; } cout << count * T; }
#include <iostream> using namespace std; int main(void) { // Your code here! int N, X, T; cin >> N >> X >> T; int count = N / X; if (N % X != 0) { count++; } cout << count * T; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
55
N, X, T = map(int, input().split()) time = (N+X)//X print(T * time)
N, X, T = map(int, input().split()) time = (N+X-1)//X print(T * time)
[["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612]]
5
33
N, X, T = map(int, input().split()) import math number_of_times = math.ceil(N/X) total_time = T * number_of_times print(number_of_times)
N, X, T = map(int, input().split()) import math number_of_times = math.ceil(N/X) total_time = T * number_of_times print(total_time)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
39
N,X,T=map(int,input().split) if N//X<N/X<N//x+1: print((N//X+1)*T) else: print(N/X*T)
N,X,T=map(int,input().split()) if N//X<N/X<N//X+1: print((N//X+1)*T) else: print(N//X*T)
[["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 0, 57, 15, 666, 0, 657, 31, 657, 12, 22], ["+", 0, 57, 15, 666, 0, 657, 31, 657, 12, 22], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 85], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 676]]
5
53
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) #define per1(i, n) for (int i = n; i > 0; i--) #define all(v) v.begin(), v.end() typedef long long ll; typedef pair<ll, ll> P; typ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) #define per1(i, n) for (int i = n; i > 0; i--) #define all(v) v.begin(), v.end() typedef long long ll; typedef pair<ll, ll> P; typ...
[["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 1, 0, 16, 12, 2, 3, 4, 0, 25]]
1
141
#include <bits/stdc++.h> #include <cstdio> using namespace std; typedef long long int ll; int main() { int n, x, t; cin >> n >> x >> t; int ans = (n / x + 1) * t; cout << ans << endl; }
#include <bits/stdc++.h> #include <cstdio> using namespace std; typedef long long int ll; int main() { double n, x, t; cin >> n >> x >> t; int ans = ceil(n / x) * t; cout << ans << endl; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 43, 49, 50, 51, 16, 31, 2, 63, 22], ["-", 49, 50, 51, 16, 31, 23, 0, 16, 17, 72], ["-", 49, 50, 51, 16, 31, 23, 0, 16, 12, 13]]
1
54
N, X, T = map(int, input().split()) print(T * (N+X-1)//X)
N, X, T = map(int, input().split()) print(T * ((N+X-1)//X))
[["+", 0, 657, 12, 23, 0, 657, 31, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
32
N,X,T = [int(i) for i in input().split()] print((N+X-1)//T)
N,X,T = [int(i) for i in input().split()] print((N+X-1)//X*T)
[["+", 0, 652, 3, 4, 0, 657, 31, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 48]]
5
34
#include <bits/stdc++.h> using namespace std; int main() { int N, X, T; cin >> N >> X >> T; int minute = 0; while (N >= 0) { minute += T; N -= X; } cout << minute << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int N, X, T; cin >> N >> X >> T; int minute = 0; while (N > 0) { minute += T; N -= X; } cout << minute << endl; }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47]]
1
54
N, X, T = map(int, input().split()) print((N + X - 1) / X * T)
N, X, T = map(int, input().split()) print((N + X - 1) // X * T)
[["-", 0, 652, 3, 4, 0, 657, 31, 657, 17, 85], ["+", 0, 652, 3, 4, 0, 657, 31, 657, 17, 676]]
5
32
#include <bits/stdc++.h> using namespace std; #define FastRead \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define endl "\n" typedef long long ll; int main() { ll n, x, t; cin >> n >> x >> t; ...
#include <bits/stdc++.h> using namespace std; #define FastRead \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define endl "\n" typedef long long ll; int main() { ll n, x, t; cin >> n >> x >> t; ...
[["-", 31, 16, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 31, 16, 12, 16, 31, 23, 0, 16, 31, 22], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 12, 22]]
1
75
#include <bits/stdc++.h> using namespace std; int main() { int N, X, T; cin >> N >> X >> T; if (N / X == N / X * X) { cout << N / X * T << endl; } else { cout << (N / X + 1) * T << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int N, X, T; cin >> N >> X >> T; if (N % X == 0) { cout << N / X * T << endl; } else { cout << (N / X + 1) * T << endl; } }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 85], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["-", 15, 339, 51, 16, 12, 16, 31, 16, 31, 22], ["-", 15, 339, 51, 16, 12, 16, 31, 16, 17, 85], ["-", 15, 339, 51, 16, 12, 16, 31, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 48], ["-", 0, 57, 15, 339, 51, 16, 12,...
1
68
import math n, x, t = map(int, input().split()) print(t * math(n/x))
import math n, x, t = map(int, input().split()) print(t * math.ceil(n/x))
[["+", 3, 4, 0, 657, 12, 652, 63, 319, 0, 131], ["+", 3, 4, 0, 657, 12, 652, 63, 319, 319, 22]]
5
31
a,b,c = gets.chomp.split(" ").map(&:to_i); z=a%b if z==0 p a/b*t else p a/b*c+c end
a,b,c = gets.chomp.split(" ").map(&:to_i); z=a%b if z==0 p a/b*c else p a/b*c+c end
[["-", 64, 749, 0, 652, 3, 4, 0, 738, 12, 22], ["+", 64, 749, 0, 652, 3, 4, 0, 738, 12, 22]]
4
48
#include <stdio.h> int main(void) { int N, X, T; scanf("%d%d%d", &N, &X, &T); int i; for (i = 0; i * X < N; i++) { printf("%d\n", i * T); } return 0; }
#include <stdio.h> int main(void) { int N, X, T; scanf("%d%d%d", &N, &X, &T); int i; for (i = 0; i * X < N; i++) { } printf("%d\n", i * T); return 0; }
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
0
67
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int N, X, T; cin >> N >> X >> T; int S = 0; S += N / X * T; if (N % T >= 1) { S += T; } cout << S << endl; }
#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int N, X, T; cin >> N >> X >> T; int S = 0; S += N / X * T; if (N % X >= 1) { S += T; } cout << S << endl; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22]]
1
66
n, x, t = [int(i) for i in input().split()] print(n // x * t)
n, x, t = [int(i) for i in input().split()] print((n + x - 1) // x * t)
[["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 24], ["+", 31, 657, 31, 23, 0, 657, 31, 657, 17, 72], ["+", 31, 657, 31, 23, 0, 657, 31, 657, 12, 22], ["+", 0, 657, 31, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 657, 31, 657, 31, 23, 0, 657, 12, 612], ["+", 3, 4, 0, 657, 31, 657, 31, 23, 0, 25]]
5
30
#include <iostream> using namespace std; int main() { int N, X, T; cin >> N >> X >> T; int ans = (N / X + 1) * T; cout << ans << endl; }
#include <iostream> using namespace std; int main() { int N, X, T; cin >> N >> X >> T; int ans = (N + X - 1) / X * T; cout << ans << endl; }
[["-", 51, 16, 31, 23, 0, 16, 31, 16, 17, 85], ["-", 51, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 51, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 17, 85], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 12, 22]]
1
46
import math N,X,T = map(int,input().split()) print(T*(math.floor(N/X)+1))
import math N,X,T = map(int,input().split()) print(T*math.ceil(N/X))
[["-", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["-", 12, 23, 0, 657, 31, 652, 63, 319, 319, 22], ["+", 3, 4, 0, 657, 12, 652, 63, 319, 319, 22], ["-", 12, 23, 0, 657, 31, 652, 3, 4, 0, 25], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 17, 72], ["-", 3, 4, 0, 657, 12, 23, 0, 657, 12, 612]]
5
37