source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include<bits/stdc++.h> #define gcd(a,b) __gcd(a,b) #define debug(x) cout<<#x<<'='<<(x)<<endl #define setp setiosflags(ios::fixed)<<setprecision #define IOS ios_base::sync_with_stdio(false),cin.tie(0) #define LL long long #define pii pair<int,int> #define vc vector #define pb push_back #define epb emplace_back...
C++
046d0c0c73aad1a5dc295af1a43e0fc6
355c9c3cbc7baf7532ac5497e9601856
2,800
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 300005; const int MAXQ = 300005; const unsigned long long INF = 1ll << 63; unsigned long long w[MAXN]; unsigned long long x[MAXN]; unsigned long long answer[MAXQ]; vector< pair <int, int> > queries[MAXN]; vector<int> segments[MAXN]; unsigned...
C++
046d0c0c73aad1a5dc295af1a43e0fc6
0f10a57dab06b99099b4a96fd0e90954
2,800
PASSED
#include <bits/stdc++.h> #define x first #define y second using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef pair<int, int> PII; typedef pair<double, double> PDD; const int N = 300010; const LL INF = 8e18; int n, m; int x[N], w[N]; struct Query { int l, id; }; v...
C++
046d0c0c73aad1a5dc295af1a43e0fc6
8a8d0c19d9fbbc6d31c7645982f4dfed
2,800
PASSED
#include <bits/stdc++.h> #define x first #define y second using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef pair<int, int> PII; typedef pair<double, double> PDD; const int N = 300010; const LL INF = 4e18 + 1; int n, m; int x[N], w[N]; struct Query { int l, id; }...
C++
046d0c0c73aad1a5dc295af1a43e0fc6
f2cdac606913a000c49b9b351577ab95
2,800
PASSED
#include <bits/stdc++.h> #define x first #define y second using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef pair<int, int> PII; typedef pair<double, double> PDD; const int N = 300010; const LL INF = 4e18 + 1; int n, m; int x[N], w[N]; vector<int> tmp[N]; vector<PI...
C++
046d0c0c73aad1a5dc295af1a43e0fc6
8aa60b20a6d839cacf9ba103bbb74489
2,800
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using ld = long double; template <typename T> int sz(T &x) { return (int)(x.size()); } int power(int x, int y, int mod) { if (y == 0) { return 1; } int z = power(x, y >> 1, mod); z = z * 1...
C++
046d0c0c73aad1a5dc295af1a43e0fc6
c8b7bae2b9fd54e38ead8e4103f92aeb
2,800
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 3e5 + 69; int n, q; ll x[N], w[N], res[N]; vector<int> upd[N]; vector<array<int, 2>> qu[N]; struct ST{ ll tree[1200005]={0,},sz; void upd(ll now,ll s,ll e,ll p,ll d){ if(s>=e){ tree[now]=d;...
C++
046d0c0c73aad1a5dc295af1a43e0fc6
6ae558bcbc0661ec55319ee8de351e68
2,800
PASSED
#include <bits/stdc++.h> #define ll long long #define llu unsigned long long #define ld long double #define pii pair<ll,ll> #define fi first #define se second using namespace std; ll w[300005],x[300005],ql[300005],ans[300005]; vector<ll> qline[300005]; vector<pii> iline[300005]; struct ST{ ll tree[1...
C++
046d0c0c73aad1a5dc295af1a43e0fc6
8d8a60750a57d6efc01a239b806d65aa
2,800
PASSED
#pragma GCC optimize("Ofast") #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <numeric> #include <iomanip> #include <vector> #include <queue> #include <stack> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <bitset> // re...
C++
046d0c0c73aad1a5dc295af1a43e0fc6
ab35158b5c658fec9c137ef1523627b0
2,800
PASSED
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { //br = new BufferedReader(new FileReader("input.txt")); //out = new PrintWriter("output.txt"); int t = 1; t = nextInt(); while (t-- != 0) { ...
Java
e25e44b8f300d6be856df50bff8ff244
90046677827cfb27823b30416dc749c8
1,400
PASSED
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { //br = new BufferedReader(new FileReader("input.txt")); //out = new PrintWriter("output.txt"); int t = 1; t = nextInt(); while (t-- != 0) { ...
Java
e25e44b8f300d6be856df50bff8ff244
141170eea1076ffbdd54283ee425e4d5
1,400
PASSED
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); long k=sc.nextLong(); long a[]=new long[n]; fo...
Java
e25e44b8f300d6be856df50bff8ff244
a68d6d68248d6b661387768ff82b226c
1,400
PASSED
import java.util.*; import java.io.*; //import static com.sun.tools.javac.jvm.ByteCodes.swap; public class fastTemp { static FastScanner fs = null; public static void main(String[] args) { fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); ...
Java
e25e44b8f300d6be856df50bff8ff244
13478e1f5fc4b1fdbb4d4911e4d03b47
1,400
PASSED
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while (n-- > 0) { long ans = 0; int m = sc.nextInt(); int k = sc.nextInt(); int a...
Java
e25e44b8f300d6be856df50bff8ff244
16ad153e7acc760e4fc9939d4490f259
1,400
PASSED
//package CodeforcesContests; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class C { public static void main (String[] Z) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Sy...
Java
e25e44b8f300d6be856df50bff8ff244
05df9c4c633c13ee7f33287ff1736a3b
1,400
PASSED
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Practice { static StringBuilder sb = new StringBuilder(); static Scanner scn = new Scanner(System.in); public static void main(String[] HastaLaVistaLa) { int t = scn.nextInt(); // int t = 1; for(int tests = 0; t...
Java
e25e44b8f300d6be856df50bff8ff244
2ff72360b2fd30dbc42d82990e506666
1,400
PASSED
import java.util.*; import java.io.*; import java.math.*; /** * @author Naitik * */ public class Main { static FastReader sc=new FastReader(); static int dp[][][]; //static int v[][]; static int mod=998244353;; // static int mod=1000000007; static long max; static long bit[]; ...
Java
e25e44b8f300d6be856df50bff8ff244
cc80b9b0c3a1cbbe8935e5807f47cd14
1,400
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class c { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new ...
Java
e25e44b8f300d6be856df50bff8ff244
cc2e7d7eecf94984530386b062cb7f63
1,400
PASSED
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Templ { static StreamTokenizer in; static int nextInt() throws IOException { in.nextToken(); return (int) in.nval; } public static void ma...
Java
e25e44b8f300d6be856df50bff8ff244
4f49e99087c551bfe7442525ad0f5bc2
1,400
PASSED
#include<iostream> #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define nd "\n" #define all(x) (x).begin(), (x).end() #define lol cout <<"i am here"<<nd; #define py cout <<"YES"<<nd; #define pp cout <<"ppppppppppppppppp"<<nd; #de...
C++
351ffff1dfe1bc1762f062f612463759
f401b0b4c7cbf1b5bb83bdc3fd7aaffa
900
PASSED
#include<iostream> #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define nd "\n" #define all(x) (x).begin(), (x).end() #define lol cout <<"i am here"<<nd; #define py cout <<"YES"<<nd; #define pp cout <<"ppppppppppppppppp"<<nd; #de...
C++
351ffff1dfe1bc1762f062f612463759
c2e431bb829e7c1fe44c2acadcd7ea12
900
PASSED
#include<iostream> #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define nd "\n" #define all(x) (x).begin(), (x).end() #define lol cout <<"i am here"<<nd; #define py cout <<"YES"<<nd; #define pp cout <<"ppppppppppppppppp"<<nd; #de...
C++
351ffff1dfe1bc1762f062f612463759
1695b37a110736e8f50af13790cd1649
900
PASSED
#include<iostream> #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define nd "\n" #define all(x) (x).begin(), (x).end() #define lol cout <<"i am here"<<nd; #define py cout <<"YES"<<nd; #define pp cout <<"ppppppppppppppppp"<<nd; #de...
C++
351ffff1dfe1bc1762f062f612463759
1165b0824984815ba492f287662dfdcd
900
PASSED
#include<iostream> #include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define nd "\n" #define all(x) (x).begin(), (x).end() #define lol cout <<"i am here"<<nd; #define py cout <<"YES"<<nd; #define pp cout <<"ppppppppppppppppp"<<nd; #de...
C++
351ffff1dfe1bc1762f062f612463759
71000d96b947b97013d9af3ebe20bf13
900
PASSED
#include <bits/stdc++.h> using namespace std; // 如果改变的是中间的话 ,那只会有ab,ba同时变化的结果 //所以只能改变两头的; // int main() { int n; cin>>n; while (n--) { string a; a.clear(); cin>>a; a[0]=a[a.length()-1]; cout<<a<<endl; } return 0; }
C++
351ffff1dfe1bc1762f062f612463759
610fdcd86a9a669d53a2717f1d53ab19
900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { string s; cin>>s; int n=s.length(); s[0]=s[n-1]; cout<<s<<endl; } return 0; }
C++
351ffff1dfe1bc1762f062f612463759
6bea642161a65859803066f34aaed1bc
900
PASSED
#include <stdio.h> #include<string.h> int main() { int t; scanf("%d",&t); while(t--) { char a[100000]; scanf("%s",&a); int l=strlen(a); a[0]=a[l-1]; printf("%s\n",a); } return 0; }
C++
351ffff1dfe1bc1762f062f612463759
47bba3165f7991e0f20560516ef41475
900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2010; pair<ll,ll> q[N]; map<int,int>mp; int hh = 0; int n; void solve() { string s; cin >> s; if(s.size() == 1 ){ cout << s << endl; return; } /*for(int i = 0;i < s.size();i++) { if(s[i] != s[i + 1] && i < s.size() - 1...
C++
351ffff1dfe1bc1762f062f612463759
ca93c4a1a9f097ecf68cc56bbc8b87b9
900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; string x; while(t--){ int sum=0,sum1=0; cin >> x; sum=x.size()-1; if(x[0] == x[sum]){ cout << x; } else if(x[0] == 'a...
C++
351ffff1dfe1bc1762f062f612463759
f8409fa1a6aa615133d5ee3eeb2e0154
900
PASSED
#include <bits/stdc++.h> using namespace std; #define Mohab ios_base::sync_with_stdio(false); cin.tie(nullptr); #define fa(i, a, n) for(int (i) = (a); (i) < (n); (i)++) #define fb(i, n, a) for(int (i) = (n); (i) >= (a); (i)--) #define pii pair<int, int> #define p(a, b) pair<a, b> #define v(a) vector<a> #define q(a) qu...
C++
5df6eb50ead22b498bea69bb84341c06
ce64edd27f4dd9bf37c626dee6f7c636
1,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll n,k; int main(){ int t; cin >> t; while(t--){ ll cnt = 1 , num = 0; cin >> n >> k; n -= 1; while(cnt < k && n -cnt >= 0){ n -= cnt; num++; cnt *= 2; } if(n%k==0) num += n/k; else num += n/k + 1; cout << num <<endl; } ...
C++
5df6eb50ead22b498bea69bb84341c06
859b2eb1d10c5002a3f1b86123e71b1a
1,100
PASSED
#include <stdio.h> #include <vector> #include <iostream> #include <algorithm> #include <cstring> using namespace std; string s; int b[100000]; int main() { int t; cin>>t; while(t--) { long long n,k,s=1,time=0; cin>>n>>k; while(s<k) { time++; s*=2; ...
C++
5df6eb50ead22b498bea69bb84341c06
17394fa41f3b4915cb65a4bb9ac8cc1f
1,100
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { long long i; long long n,k; cin>>n>>k; long long sum=n-2,count=1; long long m=1; for(i=1; sum>0; i++) { if(m*2<=k) { s...
C++
5df6eb50ead22b498bea69bb84341c06
ed9e6f683dc9ee48854b87b05437e922
1,100
PASSED
#include <iostream> #include <algorithm> using namespace std; string s; int main() { long long t,i,n,j,k; cin >> t; for(i=1; i<=t; i++) { long long f=1,q=0,r=0; cin >> n >> k; while(f<k) { f*=2; q++; } if(f>=n) cout << ...
C++
5df6eb50ead22b498bea69bb84341c06
d452ee81d4c2ef44c61d7a40a1ca5022
1,100
PASSED
#include <iostream> using namespace std; typedef long long ll; ll kpow(int a, int b) { ll res = 1, t = 1LL * a; while (b) { if (b & 1) res *= t; t *= t; b >>= 1; } return res; } void solve() { ll n, k; cin >> n >> k; ll x; for (ll i = 0; i < 100; i ++ ) { if (kpow(2, i) >= k) { x = i; br...
C++
5df6eb50ead22b498bea69bb84341c06
a52379e0b82ab361043ab16bf4694e00
1,100
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; ll a[100]; int main() { int t ; cin>>t; a[0]=1; for(int i=1;i<=100;i++) { a[i]=2*a[i-1]; } while(t--) { ll n,k; cin>>n>>k; n--; ll num=0; for(int i=0;i<=100&&a[i]<=n;i++) { if(!(k<a[i])) { n-=a[i]; num++; } e...
C++
5df6eb50ead22b498bea69bb84341c06
16bf89d47585003d6836cfa38594e04b
1,100
PASSED
#include<iostream> #include<algorithm> #include <iomanip> #include<queue> #include<vector> #include<string> #include<cmath> #include<set> #include<cstring> using namespace std; typedef long long ll; const int maxn = 200005; int main() { int t; cin >> t; while (t--) { ll n, k, temp = 1; cin >> n >> k; if (n ...
C++
5df6eb50ead22b498bea69bb84341c06
467352b41c74e8d16af1bec8ba4cfa03
1,100
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned ll; using ld = long double; using pi = pair<int, int>; using pii = pair<ll, ll>; const int MAX_N = 1e5 + 1; const ll mod = 1e9 + 7; const ll INF = 1e9; #define ci cin #define co cout #define PI 3.14159265358979323...
C++
5df6eb50ead22b498bea69bb84341c06
d8100b867256f871ed37c91eacb7a258
1,100
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; long long k, n, cnt; cin >> t; while(t--){ cin >> n >> k; n--; cnt = 0; for (long long i=1; i<k; i*=2){ n -= i; cnt++; if(n <= 0){ n = 0; ...
C++
5df6eb50ead22b498bea69bb84341c06
8e7d5eef4b0b75c217c08f6f9d49678b
1,100
PASSED
#include <bits/stdc++.h> using namespace std; template<typename T, typename F> void For(T from, T to, F f) { for (T i{from}; i < to; i++) f(i); for (T i{from - 1}; i >= to; i--) f(i); } template<typename T, typename F> void For2(T from, T to, T from2, T to2, F f) { For(from, to, [&](int i) { ...
C++
10751c875f4d7667ba21685c57cddd9e
528993f92d7e384acbcf9c76f0dda76a
2,400
PASSED
#include <bits/stdc++.h> using namespace std; template<typename T, typename F> void For(T from, T to, F f) { for (T i{from}; i < to; i++) f(i); for (T i{from}; i > to; i--) f(i); } template<typename T, typename F> void For2(T from, T to, T from2, T to2, F f) { For(from, to, [&](int i) { ...
C++
10751c875f4d7667ba21685c57cddd9e
57a20348e08490c25981b509f28dc2c2
2,400
PASSED
#include <bits/stdc++.h> using namespace std; template<typename T, typename F> void For(T from, T to, F f) { for (T i{from}; i < to; i++) f(i); for (T i{from}; i > to; i--) f(i); } template<typename T, typename F> void For2(T from, T to, T from2, T to2, F f) { For(from, to, [&](int i) { ...
C++
10751c875f4d7667ba21685c57cddd9e
2c366af79a5d4b132b10cbac1e8d0008
2,400
PASSED
#include <bits/stdc++.h> using namespace std; template<typename T, typename F> void For(T from, T to, F f) { for (T i{from}; i < to; i++) f(i); for (T i{from}; i > to; i--) f(i); } template<typename T, typename F> void For2(T from, T to, T from2, T to2, F f) { For(from, to, [&](int i) { ...
C++
10751c875f4d7667ba21685c57cddd9e
4e07ea29a052939cffec9f5e21f3f8a0
2,400
PASSED
#include <bits/stdc++.h> using namespace std; int main() { using vi = vector<int>; using vvi = vector<vi>; ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n, m; cin >> n >> m; vvi a(n, vi(m+1)); { for (int i = 0; i < n; i++) { ...
C++
10751c875f4d7667ba21685c57cddd9e
371c19127cfc548e654d4a4d656f20b5
2,400
PASSED
#include <bits/stdc++.h> using namespace std; int main() { using vi = vector<int>; using vvi = vector<vi>; ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n, m; cin >> n >> m; vvi a(n, vi(m)); { for (int i = 0; i < n; i++) for (in...
C++
10751c875f4d7667ba21685c57cddd9e
1653dfd372a0c05860bbd309218845c2
2,400
PASSED
#include <bits/stdc++.h> using namespace std; int main() { using vi = vector<int>; using vvi = vector<vi>; ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n, m; cin >> n >> m; vvi a(n, vi(m)); { for (int i = 0; i < n; i++) for (in...
C++
10751c875f4d7667ba21685c57cddd9e
cc209694718b3c52a48351b9360f53d5
2,400
PASSED
// C++ template for coding competitions designed for C++11 support. // Disable security/deprecation warnings on MSVC++. #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS #endif #include <algorithm> #include <atomic> #include <bitset> #include <cassert> #include <chrono> #include <cinttypes> ...
C++
10751c875f4d7667ba21685c57cddd9e
09f760a5cf9362c01a6a71960089d8db
2,400
PASSED
// CF #include<iostream> #include<stack> #include<list> #include<set> #include<vector> #include<algorithm> #include<math.h> #include<numeric> #include<map> #include<cstring> #include<queue> #include<iomanip> #include<cmath> #include<ctime> #include<random> #include<queue> #include <bitset> #include<...
C++
10751c875f4d7667ba21685c57cddd9e
aa6da031cb14914980b6a15417ac8ee4
2,400
PASSED
#include<bits/stdc++.h> using namespace std; using ll=long long; const int N=(int)5e5+5; int _; vector<int> a[N]; vector<int> p1[N],p2[N],p3[N],p4[N]; int n,m; int p[N]; char ans[N]; void work(){ scanf("%d%d",&n,&m); for(int i=0;i<=n+1;i++){ p1[i].clear(); p2[i].clear(); ...
C++
10751c875f4d7667ba21685c57cddd9e
4ca6d7704c292e5921faa9fb50d2116f
2,400
PASSED
/** 🍪 the_hyp0cr1t3 🍪 10.01.2022 15:08:11 **/ #ifdef W #include <k_II.h> #else #include <bits/stdc++.h> using namespace std; #endif template<class T> class Y { T f; public: template<class U> explicit Y(U&& f): f(forward<U>(f)) {} template<class... Args> decltype(auto) operator()(Args&&... a...
C++
c7f0fefd9616e4ba2d309a7c5c8a8a0a
4d0f98e4390220865a7aa9eaed99990c
2,800
PASSED
/** 🍪 the_hyp0cr1t3 🍪 10.01.2022 15:08:11 **/ #ifdef W #include <k_II.h> #else #include <bits/stdc++.h> using namespace std; #endif template<class T> class Y { T f; public: template<class U> explicit Y(U&& f): f(forward<U>(f)) {} template<class... Args> decltype(auto) operator()(Args&&... a...
C++
c7f0fefd9616e4ba2d309a7c5c8a8a0a
854645853db44f5c4573d0f7f991f0ee
2,800
PASSED
/** 🍪 the_hyp0cr1t3 🍪 10.01.2022 15:08:11 **/ #ifdef W #include <k_II.h> #else #include <bits/stdc++.h> using namespace std; #endif template<class T> class Y { T f; public: template<class U> explicit Y(U&& f): f(forward<U>(f)) {} template<class... Args> decltype(auto) operator()(Args&&... a...
C++
c7f0fefd9616e4ba2d309a7c5c8a8a0a
ba4f6bb7871e52a36eaa2e2a9dee0d70
2,800
PASSED
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const int N = 200000; const int K = 400; const int C = N/K + 2; int dpz[N+5][C+5]; int sz[N+5]; int dp[N+5]; vector <in...
C++
c7f0fefd9616e4ba2d309a7c5c8a8a0a
3d2be14c670563838c00021acc996dec
2,800
PASSED
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const int N = 200000; const int K = 500; const int C = N/K + 2; int dpz[N+5][C+5]; int sz[N+5]; int dp[N+5]; vector <in...
C++
c7f0fefd9616e4ba2d309a7c5c8a8a0a
0c115d9eacc52660eaefc956e53fceba
2,800
PASSED
#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <bits/stdc++.h> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ldb; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<ldb,ldb> pdd; #define ff(i,a,b) for(int i = a; i...
C++
c7f0fefd9616e4ba2d309a7c5c8a8a0a
79e60ea46e34f505af5bfe9c6e89c829
2,800
PASSED
#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <bits/stdc++.h> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ldb; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<ldb,ldb> pdd; #define ff(i,a,b) for(int i = a; i...
C++
c7f0fefd9616e4ba2d309a7c5c8a8a0a
d8dc9495b04b246f2befdd2f71fca470
2,800
PASSED
#pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include <bits/stdc++.h> #define pb push_back #define ll long long #define ull unsigned long long #define mp make_pair #define si short int #define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define pill pair<ll,ll> #define f first #defin...
C++
c7f0fefd9616e4ba2d309a7c5c8a8a0a
a2dbf010cd9f3276ee19a3697d0a2c7b
2,800
PASSED
#pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include <bits/stdc++.h> #define pb push_back #define ll long long #define ull unsigned long long #define mp make_pair #define si short int #define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define pill pair<ll,ll> #define f first #defin...
C++
c7f0fefd9616e4ba2d309a7c5c8a8a0a
915671608f34a7db28970dff671b5a61
2,800
PASSED
#pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include <bits/stdc++.h> #define pb push_back #define ll long long #define ull unsigned long long #define mp make_pair #define si short int #define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define pill pair<ll,ll> #define f first #defin...
C++
c7f0fefd9616e4ba2d309a7c5c8a8a0a
bd7a6c99dd45728d78dfcae090bf370b
2,800
PASSED
//besmellah #include<bits/stdc++.h> //#include <unistd.h> //#pragma GCC optimize ("O2,unroll-loops") using namespace std; #define mp(a,b) make_pair(a,b) #define bi first #define setp(a) setprecision(a)<<fixed #define ik second #define all(a) a.begin() , a.end() #define revall(a) a.rbegin() , a.rend() #define intt long ...
C++
d2cc6efe7173a64482659ba59efeec16
8857689fdb15d1db367b7f8f4d97808a
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int T,n,l,r; vector<int>ans(100005); void doing(){ cin>>n>>l>>r; for(int i=1;i<=n;i++){ ans[i]=((l - 1) / i + 1) * i; if(ans[i]>r) return printf("nO\n"),void(); } printf("yEs\n"); for(int i=1;i<=n;i++) printf("%d ",ans[i]); p...
C++
d2cc6efe7173a64482659ba59efeec16
046abed52b7781bfeb9a3998bbc4798b
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int T,n,l,r; vector<int>ans(100005); void doing(){ cin>>n>>l>>r; for(int i=1;i<=n;i++){ ans[i]=((l - 1) / i + 1) * i; if(ans[i]>r) return printf("nO\n"),void(); } printf("yEs\n"); for(int i=1;i<=n;i++) printf("%d ",ans[i]); putchar('\n'); } int main()...
C++
d2cc6efe7173a64482659ba59efeec16
dc46f9d636da5b02d8726dcbb327b869
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int T,n,l,r,ans[100005]; void doing(){ cin>>n>>l>>r; for(int i=1;i<=n;i++){ ans[i]=((l - 1) / i + 1) * i; if(ans[i]>r) return printf("nO\n"),void(); } printf("yEs\n"); for(int i=1;i<=n;i++) printf("%d ",ans[i]); putchar('\n'); } int main(){ cin>>T; ...
C++
d2cc6efe7173a64482659ba59efeec16
843832ac5a107535d63bf08ac5305916
1,100
PASSED
#include<bits/stdc++.h> #define int long long #define ll long long using namespace std; void solve() { ll n,l,r; cin>>n>>l>>r; vector<ll> a(n); if(n==1) { cout<<"YES\n"; cout<<l<<endl; return; } vector<int>v;...
C++
d2cc6efe7173a64482659ba59efeec16
412a8a9186fbd5a2cd50068c0e65d6a2
1,100
PASSED
#include <stdio.h> int main(){ int t; scanf("%d",&t); while(t--){ int n,l,r; scanf("%d%d%d",&n,&l,&r); bool yes = true; for(int i=1;i<=n;i++){ if(r/i *i< l){ yes = false; } } if(yes){ puts("YE...
C++
d2cc6efe7173a64482659ba59efeec16
7f2c8ceaab82c0086fbf59d306d5cd38
1,100
PASSED
#include <bits/stdc++.h> #define int long long using namespace std; #define pb push_back #define eb emplace_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define fi first #define se second #define SZ(x) ((int)(x).size()) typedef vector<int> VI; typedef basic_string<int> BI; typedef long l...
C++
d2cc6efe7173a64482659ba59efeec16
7769a5e26af44840f1f06a7cce5cd043
1,100
PASSED
#include<bits/stdc++.h> using namespace std; #pragma GCC target ("avx2") #pragma GCC optimization ("03") #pragma GCC optimization ("unroll-loops") typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef unsigned char uc; typedef string str; // #define pb(a) push_back(a);...
C++
d2cc6efe7173a64482659ba59efeec16
e8d6c6f1b4847707d75eb91fc2f8cec2
1,100
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,x,y,z; cin >>n; while(n--){ cin >> z >> x >> y; int v=2,m=y; int arr[z+1]={0}; arr[1]=x; int h=0; int st=1; for(int i=2; i<=z; i++){ if(x%i == 0){ ...
C++
d2cc6efe7173a64482659ba59efeec16
97849fa675960fc52bbca6978108fac7
1,100
PASSED
/**************************************************************** In the name of ALLAH, the most gracious, the most merciful ****************************************************************/ #include <bits/stdc++.h> using namespace std; typedef long long ll; const long long mod = 1e9+7; const long long max...
C++
d2cc6efe7173a64482659ba59efeec16
6df1bfd7bae2b28678dd3fb0212d706d
1,100
PASSED
for _ in range(int(input())): n = int(input()) a = [int(i) for i in input().split()] for _ in range(n): for i in range(n-1, 0, -1): q = a[i]%a[i-1] if q == 0 : q = a[i-1] a[i] = q if len(set(a)) == 1 : print("YES") else : print("NO")
Python
1c597da89880e87ffe791dd6b9fb2ac7
4f0316775f4affe3c43f6ae30e56a757
800
PASSED
for _ in range(int(input())): n=int(input()) arr=list(map(int,input().split())) brr=list(filter(lambda x:x%arr[0]==0,arr)) if(len(brr)==n): print("YES") continue print("NO")
Python
1c597da89880e87ffe791dd6b9fb2ac7
0f1a3ae90d0152cc4e8ac6af0aab9a25
800
PASSED
t=int(input()) for i in range(t): n=int(input()) a=list(map(int,input().split())) c=0 for i in range(n): if a[i]%a[0]==0: c=c+1 if c==n: print("YES") else: print("NO")
Python
1c597da89880e87ffe791dd6b9fb2ac7
f135223af717be71cdd66c6cb7e95c9f
800
PASSED
for _ in range(int(input())): n = int(input()) array = list(map(int, input().split())) if array[0] == 1: print("YES") else: for i in range(1, n): if array[i] % array[0] == 0: continue else: print("NO") break else: print("YES")
Python
1c597da89880e87ffe791dd6b9fb2ac7
ba774d307f9cb0b9dc88b1e8c13b97ee
800
PASSED
def solve(a): for i in range(1, len(a)): if a[i]%a[0]!=0: return "NO" return "YES" t = int(input()) for j in range(t): n = int(input()) a = list(map(int, input().split())) print(solve(a))
Python
1c597da89880e87ffe791dd6b9fb2ac7
c82bb6832bb8a4015b11da2c9ebf2f0c
800
PASSED
testcases=int(input()) for i in range(testcases): n=int(input()) arr=list(map(lambda ele:int(ele),input().split())) xx=True for i in range(1,n): if(arr[i]%arr[0]): xx=False if(xx): print("YES") else: print("NO")
Python
1c597da89880e87ffe791dd6b9fb2ac7
112e9429b574680e582ea2d6c56e3de7
800
PASSED
testcases=int(input()) for i in range(testcases): n=int(input()) parse=input() parse=parse.split() arr=list(map(lambda ele:int(ele),parse)) xx=True for i in range(1,n): if(arr[i]%arr[0]): xx=False if(xx): print("YES") else: print("N...
Python
1c597da89880e87ffe791dd6b9fb2ac7
5ee16204d81d36875747f2c5337cebec
800
PASSED
from sys import stdin, stdout T = int(stdin.readline()) for i in range(T): N = int(stdin.readline()) A = list(map(int, stdin.readline().strip().split())) POSS = True for j in range(1, N): if A[j]%A[0]!=0: POSS = False if POSS: stdout....
Python
1c597da89880e87ffe791dd6b9fb2ac7
07d94ce4aff2b5bb001f9324705debaf
800
PASSED
n=int(input()) for i in range(0,n): l=int(input()) a=list(map(int,input().split())) c=0 for k in range(1,l): if(a[k]%a[0]==0): c=c+1 if(c==l-1): print("YES") else: print("NO")
Python
1c597da89880e87ffe791dd6b9fb2ac7
c88eef1c3fd8f398d11289f8f9cfb148
800
PASSED
# ---------------------------iye ha aam zindegi--------------------------------------------- from calendar import c from itertools import count from math import inf import os import sys from io import BytesIO, IOBase from collections import Counter, defaultdict mod = 10 ** 9 + 7 mod1 = 998244353 BUF...
Python
1c597da89880e87ffe791dd6b9fb2ac7
8282c595c1853a17d8fcca76ec38c8bb
800
PASSED
#include<bits/stdc++.h> using namespace std; template <int mod> struct modular_int { using mint = modular_int; int value; modular_int() : value(0) { } modular_int(long long v) { if (-mod < v && v < mod) { value = v; } else { value = v % mod; } if (value < 0) { ...
C++
c5f137635a6c0d1c96b83de049e7414a
b2d7ccd6afb927cc3d9cb21f487de28b
2,000
PASSED
#include <bits/stdc++.h> using namespace std; template <int mod> struct modular_int { using mint = modular_int; int value; modular_int() : value(0) { } modular_int(long long v) { if (-mod < v && v < mod) { value = v; } else { value = v % mod; } if (value < 0) { ...
C++
c5f137635a6c0d1c96b83de049e7414a
f33f06b87f702e520f08e2209c4bd871
2,000
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <cmath> #include <iostream> #include <iomanip> #include <algorithm> #include <string> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <cstdio> #include <utility> #include <fstream> #include <iterator> #include <cassert> ...
C++
c5f137635a6c0d1c96b83de049e7414a
e01442409455cd31e5ec58be6e500c89
2,000
PASSED
#include <bits/stdc++.h> #define endl '\n' using namespace std; using ll = long long; using VI = vector<int>; using PII = pair<int, int>; const int maxn = 2e5 + 5; //const int mod = 1e18+3; const int mod = 998244353; int aa[maxn][632 / 2]; inline void solve() { int n, k; cin >> n >> k; VI ans...
C++
c5f137635a6c0d1c96b83de049e7414a
ce800c45136a23d41c98f26604b34c9c
2,000
PASSED
#include <bits/stdc++.h> #define endl '\n' using namespace std; using ll = long long; using VI = vector<int>; using PII = pair<int, int>; const int maxn = 2e5 + 5; //const int mod = 1e18+3; const int mod = 998244353; inline void solve() { int n, k; cin >> n >> k; VI ans(n + 1); VI nex(n + 1)...
C++
c5f137635a6c0d1c96b83de049e7414a
449af97a34d12eaaf95854f69c75b9a9
2,000
PASSED
#include <bits/stdc++.h> #define endl '\n' using namespace std; using ll = long long; using VI = vector<int>; using PII = pair<int, int>; const int maxn = 2e5 + 5; //const int mod = 1e18+3; const int mod = 998244353; inline void solve() { int n, k; cin >> n >> k; VI ans(n + 1); VI nex(n + 1)...
C++
c5f137635a6c0d1c96b83de049e7414a
175b8a85a94b359a8836479f15570727
2,000
PASSED
#include <bits/stdc++.h> #define endl '\n' using namespace std; using ll = long long; using VI = vector<ll>; using PII = pair<ll, ll>; const ll maxn = 2e5 + 5; //const ll mod = 1e18+3; const int mod = 998244353; inline void solve() { ll n, k; cin >> n >> k; VI ans(n + 1); VI nex(n + 1); VI...
C++
c5f137635a6c0d1c96b83de049e7414a
44cf8d30569f9f35ff44b48b8a064201
2,000
PASSED
#include <bits/stdc++.h> #define endl '\n' using namespace std; using ll = long long; using VI = vector<ll>; using PII = pair<ll, ll>; const ll maxn = 2e5 + 5; //const ll mod = 1e18+3; const int mod = 998244353; inline void solve() { ll n, k; cin >> n >> k; VI ans(n + 1); VI nex(n + 1); VI...
C++
c5f137635a6c0d1c96b83de049e7414a
9826808b342a2ad30c11bbbb99f2acf2
2,000
PASSED
#include <bits/stdc++.h> #define endl '\n' using namespace std; using ll = long long; using VI = vector<ll>; using PII = pair<ll, ll>; const ll maxn = 2e5 + 5; //const ll mod = 1e18+3; const int mod = 998244353; inline void solve() { ll n, k; cin >> n >> k; VI ans(n + 1); VI nex(n + 1); VI...
C++
c5f137635a6c0d1c96b83de049e7414a
9ad46d47c763ef6a8cbc153c6ef41e25
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long const int N=200010; const int mod=998244353; int a[N]; int dp[N]; int dp1[N]; int ans[N]; signed main() { int t=1; //cin>>t; while(t--) { int n,k; cin>>n>>k; int m=sqrt(2*n); dp1[0]=1; for(int i=1;i*(i+1)<=2*n;i++) ...
C++
c5f137635a6c0d1c96b83de049e7414a
078c080cf901bb304eb9378e238ef829
2,000
PASSED
// LUOGU_RID: 93696829 #include <iostream> using namespace std; int main(){ int t,n; cin >> t; for(int i = 1;i <= t;i++){ cin >> n; if(n == 1){ cout << "2" << endl; } else { if(n % 3 == 0){ cout << n / 3 << endl; } if(n % 3 == 1){ cout << (n - 4) / 3 + 2 << endl; ...
C++
208e285502bed3015b30ef10a351fd6d
dbef4a74cbbb486453b97e7de278899d
800
PASSED
// LUOGU_RID: 92273534 #include <bits/stdc++.h> using namespace std; int t,y = 0,x = 0,ans; int main() { cin >> t; for(int i = 1; i <= t; i++) { int n; cin >> n; if(n == 1) { cout << 2 << endl; continue; } for(i...
C++
208e285502bed3015b30ef10a351fd6d
2cf0a975f3bb39281bac12a9dea4548b
800
PASSED
// LUOGU_RID: 91946534 #include<bits/stdc++.h> using namespace std; int t,n; int main(){ cin>>t; while(t--){ cin>>n; if(n==1) cout<<"2"<<endl; else{ if(n%3==0){ cout<<n/3<<endl; } if(n%3==1){ cout<<(n-4)/3+2<<endl; } if(n%3==2){ cout<<n/3+1<<endl; } } } r...
C++
208e285502bed3015b30ef10a351fd6d
1110e986ee18e9c8aa186fc98759f896
800
PASSED
// LUOGU_RID: 90394903 #include<iostream> #include<cstdio> using namespace std; int n,i,a,s,t; int main() { cin>>n; for (i=1;i<=n;i++) { cin>>a; if (a==1) { cout<<'2'<<endl; continue; } s=a/3; t=a%3; if (t==0) { cout<<s<<endl; continue; } if (t==1||t==2) { cout<<s+1<<endl; continue; } }...
C++
208e285502bed3015b30ef10a351fd6d
8667918a7cc679cac638e24e79b71766
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,m,t,y,s; cin>>n; for(int i=1;i<=n;i++) { cin>>m; if(m==1)cout<<2<<endl; else if(m==2)cout<<1<<endl; else if(m==3)cout<<1<<endl; else if(m%3==0)cout<<m/3<<endl; else cout<<m/3+1<<endl; } return 0; }
C++
208e285502bed3015b30ef10a351fd6d
5d2c15e9339518fe114e68054ac396d2
800
PASSED
#include <bits/stdc++.h> using namespace std; int main () { int t, n; cin >> t; while (t--){ cin >> n; if (n == 1){ cout << "2" << endl; continue; } cout << (n + 2) / 3 << endl; } return 0; }
C++
208e285502bed3015b30ef10a351fd6d
05f25224719d6703f0c8dc5309ed07f3
800
PASSED
#include <iostream> using namespace std; int main(){ int t; cin >> t; while(t--){ int n; cin >> n; if(n % 3 == 0){ cout << n / 3 << endl; }else if(n == 1){ cout << "2" << endl; }else{ cout << n / 3 + 1 << endl; } } return 0; } //1 4 7 10 13
C++
208e285502bed3015b30ef10a351fd6d
b98c35ad67c783394756157f449cd279
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int n,a,ans; cin>>n; for(int i=1;i<=n;i++){ cin>>a; if(a==1){ cout<<"2"<<endl;continue; } ans=a/3+(a%3)/2; if(a%3%2==1)ans++; cout<<ans<<endl; } return 0; }
C++
208e285502bed3015b30ef10a351fd6d
09beaccb3e3c3a92e7a5e13e24c7a689
800
PASSED
#include<iostream> using namespace std; int minPaths(int n){ return n==1?2:(2+n)/3; } int main(void){ int n; cin>>n; int l[n]; for(int i=0;i<n;i++){ cin>>l[i]; } for(int i=0;i<n;i++){ cout<<minPaths(l[i])<<endl; } return 0; }
C++
208e285502bed3015b30ef10a351fd6d
390f66c3a4755c9c80d70b7f2213616c
800
PASSED
#include<iostream> #include<cmath> #include<cstdio> using namespace std; int ans(int a){ if (a==1) return 2; if (a%3==0) return a/3; else return a/3+1; } int main(){ int n; cin>>n; int t[n+1]={0}; for (int i=1;i<=n;i++){ cin>>t[i]; if (t[i]<0) t[i]=-1*t[i]; } for (int i=1;i<=n;i++){ cou...
C++
208e285502bed3015b30ef10a351fd6d
e7396b344ef0c65444c816881cc57f59
800
PASSED
#include<bits/stdc++.h> using namespace std; #define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define pb push_back #define ll long long int #define MP make_pair #define F first #define S second #define endl "\n" //erase it ,if it's not essential .....:D #define TS to_string #define FF fflu...
C++
02bdd12987af6e666d4283f075f73725
659f6e1912f42c70521bb09d2c6fb672
800
PASSED