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> using namespace std; typedef long long ll; int main() { int t; cin >> t; int n,k; while(t--){ int flag = 1; cin >> n >> k; string a; cin >> a; if(n - k *2 <= 0) { cout << "NO" << endl; continue; } if(k == 0) { cout << "YES" << endl; continue; } if(a[0] != ...
C++
6fbf41dc32d1c28351d78a9ec5fc0026
d1f00c71903331e6ea053ba213ff8221
900
PASSED
#include <bits/stdc++.h> #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) using namespace std; typedef long long ll;; typedef pair<int, int> PII; const int N = 1e5 + 10; int t, n, m; int arr[N]; string s; void solve() { cin >> n >> m; cin >> s; int flag = 1; for(int i = 0; i < m; i ++){ if(s[i...
C++
6fbf41dc32d1c28351d78a9ec5fc0026
9e7793a90455d5ba81c8c1dba89bae8f
900
PASSED
#include <bits/stdc++.h> using namespace std; char p[110]; int t, n, k; int main() { cin >> t; while (t--) { bool flag = true; cin >> n >> k; cin >> p; if (2 * k>=n) { flag = false; } else { for (int i = 0; i <k; i++) { if (p[i] != p[n-i-1]) { flag = false; break; } } } if (flag...
C++
6fbf41dc32d1c28351d78a9ec5fc0026
2d08fe9934dce8d2a0cd7f5f6f6f529b
900
PASSED
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 0; char ch = getchar(); while (!isdigit(ch)) f = (ch == 45), ch = getchar(); while ( isdigit(ch)) x = (x << 1) + (x << 3) +(ch ^ 48), ch = getchar(); return f ? (~x + 1) : x; } const int MAXN = 1e5 + 50; const int MOD...
C++
6fbf41dc32d1c28351d78a9ec5fc0026
4168407903a0e0c1a955349edafdf30f
900
PASSED
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize(3) #define all(a) a.begin(), a.end() typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; inline int ri32(){ int ret = 0; char c = getchar(), sign = c; ...
C++
6fbf41dc32d1c28351d78a9ec5fc0026
bab543ba77bcc2d7e270b79d8cb54ea2
900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; int n, k; char s[109]; void work() { cin >> n >> k; scanf("%s", s+1); if(n % 2 == 0 && n/2 == k) { cout << "NO\n";return; } if(k == 0) { cout << "YES\n";return; } for(int i = 1; i <= k; ++i) if(s[i] != s[n+1-i]) { cout << "NO\n";retu...
C++
6fbf41dc32d1c28351d78a9ec5fc0026
96b668064c555228f56107a700d21572
900
PASSED
#include <iostream> #include <stdio.h> using namespace std; int main() { int t; scanf("%d", &t); for (int i = 0; i < t; i++) { int n, k; scanf("%d%d", &n, &k); string s; cin >> s; int num = k * 2 + 1; if (num == 1) { printf("YES\n"); co...
C++
6fbf41dc32d1c28351d78a9ec5fc0026
13505ffcceef3449e199d2b098ff8e13
900
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); int t,n,k; string s; cin>>t; while(t--){ cin>>n>>k>>s; bool can=true; if(k*2+1>n) can=false; else{ for(int i=0;i<k;i++) if(s[i]!=s[n-1-i]){ can=false; break; } } if(can) cout<<"YE...
C++
6fbf41dc32d1c28351d78a9ec5fc0026
9b76312f7ac390c113d3bacb87b43056
900
PASSED
#include<iostream> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; while (n % 7) { n++; if (n % 10 == 0) n -= 10; } cout << n << endl; } }
C++
128372d890f632494e59e81287abd85a
69eddaaab528dc0958adf51668957fab
800
PASSED
#include <iostream> #include <algorithm> #include <bits/stdc++.h> using namespace std; int main() { int t; cin >>t; while(t--) { int n; cin>>n; if(n%7==0) { cout<<n<<endl; } else { n/=10; n*=10; while...
C++
128372d890f632494e59e81287abd85a
8452a0b43e31d791140911c724804a7f
800
PASSED
#include <iostream> #include <string> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; if (n % 7 == 0) { cout << n << endl; } else { int mod1 = n % 7; int c1 = n + (7 - mod1), c2 = n - mod1; string st_c1 = to_string(c1), st_c2 = to_string(c2), str = to_string(n...
C++
128372d890f632494e59e81287abd85a
1889987bc6eedb25fef1e8ec9a9df234
800
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define F first #define S second #define endl '\n' #define yes cout<<"YES"<<endl; #define no cout<<"NO"<<endl; #define len length() #define pb push_back #define ins insert #define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cons...
C++
128372d890f632494e59e81287abd85a
f914cb81dc425f6a29973bf2be786a3a
800
PASSED
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; if (n % 7 == 0) { cout << n << endl; } else { n -= n % 10; for (int i = 0; i < 10; i++, n++) { if (n % 7 == 0) { cout << n << endl; return ; } ...
C++
128372d890f632494e59e81287abd85a
99e0a5b6aacbdffe52b759344179c3e4
800
PASSED
#include <bits/stdc++.h> #define ll long long #define str string #define pb push_back #define kick(x) cout << x << "\n"; #define loop(i, a, b) for (int i = a; i < b; i++) #define loope(i, a, b) for (int i = a; i <= b; i++) #define loopr(i, a, b) for (int i = a; i > b; i--) using namespace std; int main() { ll t, ...
C++
128372d890f632494e59e81287abd85a
c6392cb3444691e0a3a06ac9c2fa042f
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ int n; cin>>n; if(n%7==0) cout<<n; else{ if(n-n%7<n-n%10) cout<<n-n%7+7; else cout<<n-n%7; } cout<<endl; } }
C++
128372d890f632494e59e81287abd85a
77622e44057b13072655e35fabf2a48a
800
PASSED
#define io ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define rep(i,l,r) for(ll i=l;i<=r;++i) #define per(i,l,r) for(ll i=r;i>=l;--i) #define debug(x) cout<<#x<<" = "<<x<<endl #define CY cout<<"YES"<<endl #define CN cout<<"NO"<<endl #include<bits/stdc++.h> using namespace std; using ll = long long; const ll N =...
C++
128372d890f632494e59e81287abd85a
4affc78b762df7e594e11f4fb935f825
800
PASSED
#include <stdio.h> int main(void) { int t; scanf("%d", &t); while (t--) { int n, k; scanf("%d", &n); k = n % 7; if (n % 10 - k<0) { n = n + 7 - k; } else { n = n - k; } printf("%d\n", n); } return 0; }
C++
128372d890f632494e59e81287abd85a
47aad99ef5499583b56883b9efe727d3
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(int argc,char *argv[]){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int T; cin>>T; while(T--){ int n;cin>>n; if(n%7) cout<<((n+7)/7*7/10==n/10?((n+7)/7*7):(n/7*7))<<endl; else cout<<n<<endl; } } ...
C++
128372d890f632494e59e81287abd85a
609b20947c0d41e797f6c9da84f65d19
800
PASSED
import java.util.*; public class diva{ public static void main(String args[]){ int t; Scanner sc=new Scanner(System.in); t=sc.nextInt(); while(t-->0) {int c1=0,c2=0; String s=sc.next(); for(int i=0;i<s.length();i++) { if(s.charAt(i)=='0') c1++; else c2++; } if(...
Java
62f5798bdcea237c0df9b4cd288b97de
36d6e826746b06950efc531d9a2569b7
800
PASSED
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int c =0; int c2 = 0; int i = 0; int limit = 0; List<Integer> arr = new ArrayList<>(); int t = sc.nextInt(); sc.nextLine(); f...
Java
62f5798bdcea237c0df9b4cd288b97de
c74bbbc3fce86e1a8198d5ffaca2f439
800
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class hs{ public static void main(String[] args){ FastReader sc=new FastReader(); int n=sc.nextInt(); for(int j=0;j<n;j++){ ...
Java
62f5798bdcea237c0df9b4cd288b97de
2fe8d69f49e7ad93ec8389956ce76a02
800
PASSED
import java.util.*; import java.io.*; public class B_Minority{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br=new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(st==null || ...
Java
62f5798bdcea237c0df9b4cd288b97de
feea69dcebb37436039fed2a34193602
800
PASSED
import java.util.*; public class Main { static Scanner sc = new Scanner (System.in); public static void main (String[]args) { int t = sc.nextInt (); for (int i = 0; i < t; i++) { String s = sc.next(); System.out.println(check (s)); } } static int check (String s) { ...
Java
62f5798bdcea237c0df9b4cd288b97de
bf969e7f05323074565c24729be4d0c8
800
PASSED
import java.util.*; public class Main { static Scanner sc = new Scanner (System.in); public static void main (String[]args) { int t = sc.nextInt (); for (int i = 0; i < t; i++) { String s = sc.next(); System.out.println(check (s)); } } static int check (String s) { ...
Java
62f5798bdcea237c0df9b4cd288b97de
0250ab0216efbb616f83dc0078e21ec3
800
PASSED
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int t =sc.nextInt(); int arr[]=new int[t]; for(int i=0;i<t;i++){ String s=sc.next(); int c_zeroes=0; int c_ones=...
Java
62f5798bdcea237c0df9b4cd288b97de
a9d63e7810b6ea946f331ac03cf412cb
800
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; // snippet public class Minority { // Question Link : static FastScanner sc = new FastScanner(); public static voi...
Java
62f5798bdcea237c0df9b4cd288b97de
b5fc18ddb7a324d17a3efbc9185075c0
800
PASSED
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int testcase= scan.nextInt(); for(int i=0;i<testcase;i++){ String bin=scan.next(); if(bin.length()==0) continue; if(bin.leng...
Java
62f5798bdcea237c0df9b4cd288b97de
5cc6b0c4d34083c28465e60cde41ff74
800
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { static void solve(Scanner in, PrintWriter out) throws IOException { int[] a = new int[2]; char[] ch = in.next().toCharArray(); ...
Java
62f5798bdcea237c0df9b4cd288b97de
55937d029f159995e0cd13b42bf13f19
800
PASSED
#include<iostream> #define int long long using namespace std; signed main(){ int t; cin>>t; while(t--){ int a,b,c,d; cin>>a>>b>>c>>d; int x,y,z; cin>>x>>y>>z; bool vi=0; for(int i=0;i<=x;i++){ if((a+(x-i)*z+d-1)/d>=(c+b+i*y-1)/(b+i*y)){ cout<<"YES"<<endl; vi=1; break; }...
C++
5b1f33228a58d9e14bc9479767532c25
88298a4cc8f831e16946ff66cd3ca0f0
1,100
PASSED
#include<iostream> #include<string> #include<cmath> using namespace std; #define int long long signed main() { int t; cin >> t; while (t--) { int hc, dc, hm, dm; cin >> hc >> dc; cin >> hm >> dm; int k, w, a; cin >> k >> w >> a; int flag = 0; for (int i = 0; i <= k; i++) { ...
C++
5b1f33228a58d9e14bc9479767532c25
ab6b005c4e2a6c61feb08fdf620a84a3
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long long t,hc,dc,hm,dm,k,w,a; scanf("%lld",&t); while(t--) { scanf("%lld %lld\n%lld %lld\n%lld %lld %lld",&hc,&dc,&hm,&dm,&k,&w,&a); long long m,n;//怪兽打人的次数,人打怪兽的次数,加强后的生命力,加强后的伤害 int flag=0;//标记 for(lo...
C++
5b1f33228a58d9e14bc9479767532c25
424d189b1f28b4f47cc02ded11630718
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long long t,hc,dc,hm,dm,k,w,a; scanf("%lld",&t); while(t--) { scanf("%lld %lld\n%lld %lld\n%lld %lld %lld",&hc,&dc,&hm,&dm,&k,&w,&a); long long x,y,m,n,flag=0;//怪兽打人的次数,人打怪兽的次数,加强后的生命力,加强后的伤害,标记 for(long long i=0...
C++
5b1f33228a58d9e14bc9479767532c25
09ed6d227b5ff70e4f68553262fd65e2
1,100
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long ll t,hc,dc,hm,dm,k,w,a; ll flag; void judge(ll hc,ll dc,ll hm,ll dm) { ll kk;//英雄能扛多少下 kk=(hc/dm); if(hc-kk*dm>0)//向上取整 kk++; ll cnt;//英雄要多少下才能打死怪物 cnt=hm/dc; if(hm-cnt*dc>0) cnt++; if(kk>=cnt) flag=1; } int ...
C++
5b1f33228a58d9e14bc9479767532c25
216d1847ac8edfba6108ba3be143bfdf
1,100
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long int hc,hm,dm,dc,k,w,a,t; inline void read(int &x){ x=0; int y=1; char a; a=getchar(); while(a<'0'||a>'9'){ if(a=='-')y=-1; a=getchar(); } while(a>='0'&&a<='9'){ x=x*10+a-'0'; a=getchar(); } x*=y; } signed main(){ re...
C++
5b1f33228a58d9e14bc9479767532c25
a46b378c35e20d14289e6e8d853372d2
1,100
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; signed main(){ int t; cin>>t; while(t--){ int a,b,c,d,x,y,z,f=0; cin>>a>>b>>c>>d>>x>>y>>z; for(int i=0;i<=x;i++){ if((a+(x-i)*z+d-1)/d>=(c+b+i*y-1)/(b+i*y)){ cout<<"YES"<<endl; f=1; break; } } if(f==0) cout...
C++
5b1f33228a58d9e14bc9479767532c25
24fb5bb3be2e4eac56f1cee834c19082
1,100
PASSED
#include<bits/stdc++.h> using namespace std; long long n,a,b,c,d,e,f,g; int main() { cin>>n; for (int i=1;i<=n;i++) { cin>>a>>b>>c>>d>>e>>f>>g; int r=0; for (int j=0;j<=e;j++) { long long l=a+(e-j)*g,o=b+j*f,x,y; x=c/o; if (x*o<c) x++; y=l/d; if (y*d<l) y++; if (y>=...
C++
5b1f33228a58d9e14bc9479767532c25
1be88e16aff415e26f4c6e7c074e1e14
1,100
PASSED
#include<iostream> using namespace std; struct sz { long long a,b,c,d,e,f,g; }m[50005]; int main() { int n; cin>>n; for(int i=1;i<=n;i++) { cin>>m[i].a>>m[i].b>>m[i].c>>m[i].d>>m[i].e>>m[i].f>>m[i].g; } for(int i=1;i<=n;i++) { bool flag=0; for(int j=0;j<=m[i].e;j++) { if((m[i].a+...
C++
5b1f33228a58d9e14bc9479767532c25
bf24efee267221fa525561e7ab49957a
1,100
PASSED
#include<bits/stdc++.h> using namespace std; long long t,hc,dc,hm,dm,k,w,a; bool flag; int main(){ cin>>t; while(t--){ cin>>hc>>dc>>hm>>dm>>k>>w>>a; flag=0; for(long long i=0;i<=k;i++){ long long ha=hc+a*i,da=dc+w*(k-i); if((ha+dm-1)/dm>=(hm+da-1)/da){ flag=1; break; } } if(...
C++
5b1f33228a58d9e14bc9479767532c25
2f0eb2215af431b65b7fa8315229a8ed
1,100
PASSED
/* ======================== author: yogeshiitm date: 09.02.2022 time: 22:35:33 ------------- _ _ _ _ | | (_|_) | _ _ ___ __ _ ___ ___| |__ _ _| |_ _ __ ___ | | | |/ _ \ / _` |/ _ \/ __| '_ \| | | __| ...
C++
c4929ec631caae439ccb9bc6882ed816
66ec63e854ed45a37f92185df7dec377
1,600
PASSED
/* ======================== author: yogeshiitm date: 09.02.2022 time: 22:35:32 ------------- _ _ _ _ | | (_|_) | _ _ ___ __ _ ___ ___| |__ _ _| |_ _ __ ___ | | | |/ _ \ / _` |/ _ \/ __| '_ \| | | __| ...
C++
c4929ec631caae439ccb9bc6882ed816
e272c49b7db610aa941b9fd6bc355580
1,600
PASSED
/* ======================== author: yogeshiitm date: 09.02.2022 time: 22:35:32 ------------- _ _ _ _ | | (_|_) | _ _ ___ __ _ ___ ___| |__ _ _| |_ _ __ ___ | | | |/ _ \ / _` |/ _ \/ __| '_ \| | | __| ...
C++
c4929ec631caae439ccb9bc6882ed816
b01ab889fae500381bc8501fce2a5683
1,600
PASSED
/* ======================== author: yogeshiitm date: 09.02.2022 time: 22:35:32 ------------- _ _ _ _ | | (_|_) | _ _ ___ __ _ ___ ___| |__ _ _| |_ _ __ ___ | | | |/ _ \ / _` |/ _ \/ __| '_ \| | | __| ...
C++
c4929ec631caae439ccb9bc6882ed816
8febd01ff5a1095583f25c62d176acf5
1,600
PASSED
/* ======================== author: yogeshiitm date: 09.02.2022 time: 22:35:32 ------------- _ _ _ _ | | (_|_) | _ _ ___ __ _ ___ ___| |__ _ _| |_ _ __ ___ | | | |/ _ \ / _` |/ _ \/ __| '_ \| | | __| ...
C++
c4929ec631caae439ccb9bc6882ed816
a6f5decf854781625e64c0cf6693365e
1,600
PASSED
/* ======================== author: yogeshiitm date: 09.02.2022 time: 22:35:32 ------------- _ _ _ _ | | (_|_) | _ _ ___ __ _ ___ ___| |__ _ _| |_ _ __ ___ | | | |/ _ \ / _` |/ _ \/ __| '_ \| | | __| ...
C++
c4929ec631caae439ccb9bc6882ed816
41e23c974a9914735d44b2de0e6d3dce
1,600
PASSED
/* ======================== author: yogeshiitm date: 09.02.2022 time: 22:35:32 ------------- _ _ _ _ | | (_|_) | _ _ ___ __ _ ___ ___| |__ _ _| |_ _ __ ___ | | | |/ _ \ / _` |/ _ \/ __| '_ \| | | __| ...
C++
c4929ec631caae439ccb9bc6882ed816
1d0e81365eb4f4ffa9fed0112e0e123c
1,600
PASSED
/* ======================== author: yogeshiitm date: 09.02.2022 time: 22:35:32 ------------- _ _ _ _ | | (_|_) | _ _ ___ __ _ ___ ___| |__ _ _| |_ _ __ ___ | | | |/ _ \ / _` |/ _ \/ __| '_ \| | | __| ...
C++
c4929ec631caae439ccb9bc6882ed816
212283b67c99cbd79e1e9c0dac54cd4b
1,600
PASSED
/* ======================== author: yogeshiitm date: 09.02.2022 time: 22:35:32 ------------- _ _ _ _ | | (_|_) | _ _ ___ __ _ ___ ___| |__ _ _| |_ _ __ ___ | | | |/ _ \ / _` |/ _ \/ __| '_ \| | | __| ...
C++
c4929ec631caae439ccb9bc6882ed816
93346395bec507f787cc3f030570b89d
1,600
PASSED
/* ======================== author: yogeshiitm date: 09.02.2022 time: 22:35:32 ------------- _ _ _ _ | | (_|_) | _ _ ___ __ _ ___ ___| |__ _ _| |_ _ __ ___ | | | |/ _ \ / _` |/ _ \/ __| '_ \| | | __| ...
C++
c4929ec631caae439ccb9bc6882ed816
521fc0bbf3301da94995a5a74d5a422b
1,600
PASSED
/** * author: MaGnsi0 * created: 01.02.2022 04:50:00 **/ #include <bits/stdc++.h> using namespace std; struct union_find { vector<int> parent, length; union_find(int n) { parent.resize(n); iota(parent.begin(), parent.end(), 0); length = vector<int>(n, 1); } ...
C++
2fad8bea91cf6db14b34271e88ab093c
fd365cc88ad1929d50aba1896513a91f
2,400
PASSED
#include <bits/stdc++.h> using namespace std; struct unionfind{ vector<int> p; unionfind(int N){ p = vector<int>(N, -1); } int root(int x){ if (p[x] < 0){ return x; } else { p[x] = root(p[x]); return p[x]; } } bool same(int x, int y){ return root(x) == root(y); } void un...
C++
2fad8bea91cf6db14b34271e88ab093c
efb2159bd6f8d38022e0554c4d3545bb
2,400
PASSED
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define rep(i, a, b) for (int i = a; i < b; ++i) #define per(i, a, b) for (int i = b - 1; i >= a-- i) using namespace std; #define MODE 0 #define DEBUG if (MODE) typedef long long LL; const int INF = 1e9 + 7, N = 50 + 19, M = 300 + 19; int n, m; v...
C++
2fad8bea91cf6db14b34271e88ab093c
4126d50c25d57dcacf2129b3ad370894
2,400
PASSED
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define rep(i, a, b) for (int i = a; i < b; ++i) #define per(i, a, b) for (int i = b - 1; i >= a-- i) using namespace std; #define MODE 0 #define DEBUG if (MODE) typedef long long LL; const int INF = 1e9 + 7, N = 50 + 19, M = 300 + 19; int n, m; v...
C++
2fad8bea91cf6db14b34271e88ab093c
767cc7ccd0c46ef344495ff013ff5dd2
2,400
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; typedef long long int ll; typedef long double ld...
C++
2fad8bea91cf6db14b34271e88ab093c
6bfbad693b387c66838950abd78e9bc4
2,400
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_...
C++
2fad8bea91cf6db14b34271e88ab093c
d1ee275a9ca7bc11e1fb66b48db416f0
2,400
PASSED
#include <iostream> #include <vector> #include <algorithm> #define ll long long #define forn(i, n) for(int i = 0; i < n; i++) using namespace std; int n, m; struct edge { int u, v; ll weight; }; vector<int> parent; vector<int> rank_; vector<edge> edges; int find(int u) { if(u != parent[u]) { p...
C++
2fad8bea91cf6db14b34271e88ab093c
b1c5821d03ee7b32374fd56a3b6f1249
2,400
PASSED
#include <iostream> #include <vector> #include <algorithm> #define ll long long #define forn(i, n) for(int i = 0; i < n; i++) using namespace std; int n, m; struct edge { int u, v; ll weight; }; vector<int> parent; vector<int> rank_; vector<edge> edges; int find(int u) { if(u != parent[u]) { p...
C++
2fad8bea91cf6db14b34271e88ab093c
b285fcfee735e2aeb4b6415469d6bd1c
2,400
PASSED
#include <iostream> #include <vector> #include <algorithm> #define ll long long #define forn(i, n) for(int i = 0; i < n; i++) using namespace std; int n, m; struct edge { int u, v; ll weight; }; vector<int> parent; vector<int> rank_; vector<edge> edges; int find(int u) { if(u != parent[u]) { p...
C++
2fad8bea91cf6db14b34271e88ab093c
71fe1cec617787f78022f360a6442a92
2,400
PASSED
#include <iostream> #include <vector> #include <algorithm> #define ll long long #define forn(i, n) for(int i = 0; i < n; i++) using namespace std; int n, m; struct edge { int u, v; ll weight; }; vector<int> parent; vector<int> rank_; vector<edge> edges; int find(int u) { if(u != parent[u]) { p...
C++
2fad8bea91cf6db14b34271e88ab093c
6ef8923ae232d0200092b992da9852e2
2,400
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/priority_queue.hpp> using namespace std; #define fo(i, j, k) for(auto i=j;i<k;i++) #define Fo(i, j, k) for(auto i=j;i>k;i--) #define mem(i, j) memset(i,j,sizeof(i)) #define mec(i, j) memcpy...
C++
6253ac78cd390d3c9fa235385eb837ae
6d94588c0a5505824e9c6a78393201d5
2,800
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/priority_queue.hpp> using namespace std; #define fo(i, j, k) for(auto i=j;i<k;i++) #define Fo(i, j, k) for(auto i=j;i>k;i--) #define mem(i, j) memset(i,j,sizeof(i)) #define mec(i, j) memcpy...
C++
6253ac78cd390d3c9fa235385eb837ae
64eeabe237d05f1c437287c7c84ee14d
2,800
PASSED
#include <sstream> #include <fstream> #include <cstdio> #include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <string> #include <cstring> #include <stack> #include <queue> #include <cmath> #include <ctime> #include <utility> #include <cassert> #include <bitset...
C++
6253ac78cd390d3c9fa235385eb837ae
11015b83c53c1f9175bbed955e25a5f7
2,800
PASSED
#include <bits/stdc++.h> using namespace std; #define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl #define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl #define erorp(x) cout<<#x<<"={"<<(x.F)<<" , "<<x.S<<"}"<<endl #define eror(x) cout<<#x<<'='<<(x)<<endl #define f_(i,a...
C++
6253ac78cd390d3c9fa235385eb837ae
7a557fbfba69b721eb4024b351a8189c
2,800
PASSED
#include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> using namespace std; typedef long long LL; const int maxn=200020; int n; struct pj{int y, nxt, id;} g[maxn<<1]; int len, la[maxn], top[maxn], c[maxn], tot[maxn], son[maxn], a[maxn]; struct tree{LL sum, c; int tot, ...
C++
6253ac78cd390d3c9fa235385eb837ae
bf25a1860626fd793f16f7060cd3c4f0
2,800
PASSED
#include<cstdio> #include<cstring> #include<cmath> #include<assert.h> #include<algorithm> #include<vector> using namespace std; typedef long long LL; const int maxn=200020; int n; struct pj{int y, nxt, id;} g[maxn<<1]; int len, la[maxn], top[maxn], c[maxn], tot[maxn], son[maxn], a[maxn]; struct tree{LL...
C++
6253ac78cd390d3c9fa235385eb837ae
c4a34ab1777ccf85842d005b3ad2d4de
2,800
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx,avx2,sse,tune=native") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ld eps=1e-12; const int N=200010; const ll mod=998244353; #define ADD(a,b) a+=b;if (a>=mod) a-=mod...
C++
6253ac78cd390d3c9fa235385eb837ae
55880f7230852243e6e1e0df0f48a24a
2,800
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx,avx2,sse,tune=native") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ld eps=1e-12; const int N=200010; const ll mod=998244353; #define ADD(a,b) a+=b;if (a>=mod) a-=mod...
C++
6253ac78cd390d3c9fa235385eb837ae
580b9ad54fac524a96b4bfa255545413
2,800
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx,avx2,sse,tune=native") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ld eps=1e-12; const int N=200010; const ll mod=998244353; #define ADD(a,b) a+=b;if (a>=mod) a-=mod...
C++
6253ac78cd390d3c9fa235385eb837ae
bb9dc14c64586b152609e1f874a0de33
2,800
PASSED
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx,avx2,sse,tune=native") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ld eps=1e-12; const int N=200010; const ll mod=998244353; #define ADD(a,b) a+=b;if (a>=mod) a-=mod...
C++
6253ac78cd390d3c9fa235385eb837ae
172ebc2bc6d70aafc856ed6856b7d876
2,800
PASSED
/* بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ Iftekhar Md. Shishir Dept. of Information and Communication Engineering University of Rajshahi */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tre...
C++
71e6ceb75852f4cd437bbf0478e37dc4
1cc0a019bc19132a1853b65f05bd9e19
1,500
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF=1e9+7; const ll INFF=1e18+7; #define nl '\n' void __print(int x) { cout << x; } void __print(long x) { cout << x; } void __print(long long x) { cout << x; } void __print(unsigned x) { cout << x; } void __print(unsigned long ...
C++
71e6ceb75852f4cd437bbf0478e37dc4
c09f7dcc0a14a2952fd32ed80454c950
1,500
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using str = string; #define fi first #define se second #define mp make_pair #define pb push_back #define sz(x) (int)(x).size() #define all(x) begin(x),end(x) #define sor(x) sort(begin(x),end(x)); #define TRAV(a, x) for(auto& a:x) #define RO...
C++
71e6ceb75852f4cd437bbf0478e37dc4
720b40512ab1f9d0800cef5bb84f0796
1,500
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using str = string; #define fi first #define se second #define mp make_pair #define pb push_back #define sz(x) (int)(x).size() #define all(x) begin(x),end(x) #define sor(x) sort(begin(x),end(x)); #define TRAV(a, x) for(auto& a:x) #define RO...
C++
71e6ceb75852f4cd437bbf0478e37dc4
1b4d7c6612d3a1f3ca5393b49707c39e
1,500
PASSED
/*" بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ -In the name of Allah." "Never stop chasing!-MD.SOURAV." */ //Graph Practice till DEC_26-2021 #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define F f...
C++
71e6ceb75852f4cd437bbf0478e37dc4
639d5626855e089d2283cea6c1f6445c
1,500
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <map> #include <set> #include <cmath> #include <math.h> #include <queue> #include <numeric> #include <stack> #include <fstream> #define endl '\n' #define int long long #define double long double using namespace std; si...
C++
71e6ceb75852f4cd437bbf0478e37dc4
d2e3e5a113279b07634b1ad8a45204ed
1,500
PASSED
//Turn Down For What #include <bits/stdc++.h> #define lld long long int #define pb push_back #define in insert #define mod 1000000007 #define pi 3.14159265358979 #define inf 1000000000000000007 using namespace std; using namespace std::chrono; /*lld powf(lld bse, lld co) { lld mul = 1; for (lld...
C++
71e6ceb75852f4cd437bbf0478e37dc4
a73c620e5ff5c25b6ea746463660dcf5
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #ifndef ONLINE_JUDGE auto start = chrono::steady_clock::now(); #endif #define int long long int #define float double #define all(a) a.begin(), a.end() #define sz(x) ((int)(x).size()) #define vi vector<int> #define vvi vector<vector<int>> #define vpi vector<p...
C++
71e6ceb75852f4cd437bbf0478e37dc4
a2b0e25bf424a190c75ebb77f5163faf
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define IO ios_base::sync_with_stdio(0),cin.tie(0); #define sz(v) ((int)v.size()) #define psh push_back #define x first #define y second #define OO 1e18 typedef long long ll; typedef pair<int,int> ii; typedef vector<int> vi; typedef...
C++
71e6ceb75852f4cd437bbf0478e37dc4
cf1ad59139c8dc41f04609e50bf79d56
1,500
PASSED
#include<iostream> #include<algorithm> #include<cstring> #include<string> #include<stack> #include<vector> #include<cmath> using namespace std; typedef long long ll; const ll mod1 = 1e9 + 7; const ll mod2 = 998244353; ll a[200005]; ll b[200005]; int main() { int t; cin >> t; while (t--) { int n; ...
C++
71e6ceb75852f4cd437bbf0478e37dc4
24717a71d2b9de24f095f9094c0bcd1c
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define F first #define S second #define pb push_back #define cend cout << endl; #define output_arr(a, n) \ for (int i = 0; i < n; i++) \ cout << a[i] << " "; \ cout << endl; #define input_arr(a, n) \ f...
C++
c8fddee2f1c7d325437a7d0b82758b03
f8323a124cf802694f14d489c2ffe902
800
PASSED
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < int(n); i++) using namespace std; // sorting for pairs bool sortbyw(const pair<int, pair<int, int>> &a, const pair<int, pair<int, int>> &b) { return (a.first < b.first); } void solve() { int n; cin >> n; if (n > 19...
C++
c8fddee2f1c7d325437a7d0b82758b03
8e8dcbdf8d9e1de6882b0b17f7eaa9b1
800
PASSED
#include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < int(n); i++) using namespace std; // sorting for pairs bool sortbyw(const pair<int, pair<int, int>> &a, const pair<int, pair<int, int>> &b) { return (a.first < b.first); } void solve() { int n; cin >> n; if (pow(3,...
C++
c8fddee2f1c7d325437a7d0b82758b03
8ecb58fb7fb96b3f6d45aa18ace18342
800
PASSED
/*Arpit*/ #include<bits/stdc++.h> using namespace std; #define ll long long #define lli long long int int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin.exceptions(ios::badbit | ios::failbit); int t;cin>>t; while(t--){ int n;cin>>n; vector<ll>arr(n); arr[0]=1;bool ok=true; ...
C++
c8fddee2f1c7d325437a7d0b82758b03
9c9e43dd78b9249a5517d63f5f36dca8
800
PASSED
#include <bits/stdc++.h> #define ll long long #define str string #define pb push_back #define kick(x) cout << x << "\n"; #define loop(i, a, b) for (int i = a; i < b; i++) using namespace std; int main() { ll t, n, m, p, q, r; ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> t; while (t--)...
C++
c8fddee2f1c7d325437a7d0b82758b03
58e3f6b0ef0eb7193be105a5ae70658b
800
PASSED
#include<bits/stdc++.h> using namespace std; void ac(){ int n; cin>>n; if(n>19) cout<<"NO\n"; else{ cout<<"YES\n"; for(int i=1,j=1; i<=n; i++, j*=3){ cout<<j<<" "; } cout<<"\n"; } } int main(){ int tc; cin>>tc; while(tc--){ ac(); } ...
C++
c8fddee2f1c7d325437a7d0b82758b03
18107dce2a4cf4e81a40f9a293edf66a
800
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; int arr[1000005]; void fastCode(){ ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); } int main(){ fastCode(); int t,n; cin>>t; while(t--){ cin>>n; if(n>19) //pow(3,n-1)>pow(10,9) cout<<"NO"<<...
C++
c8fddee2f1c7d325437a7d0b82758b03
bdc05b357cd5d99f9e1532f2529cac71
800
PASSED
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #include<ext/pb_ds/detail/standard_policies.hpp> using namespace std; using namespace __gnu_pbds; #define LL long long #define DD double #define Pb push_back #define Bp pop_back #define Pf push_front #define Fp pop_fro...
C++
c8fddee2f1c7d325437a7d0b82758b03
fc9386f818f239aed7b884b78343f3ed
800
PASSED
#include<bits/stdc++.h> using namespace std; void solve() { int n; cin>>n; if(n <= 19) { cout<<"YES\n"; int t = 1; for(int i=1;i<=n;i++) { cout<<t<<" "; t*=3; } cout<<'\n'; } else cout<<"NO\n"; } int main() { int t;cin>>t; for(int i=1;i<=t;i++) { solve(); } ...
C++
c8fddee2f1c7d325437a7d0b82758b03
105c939e9d5912f052fd483e421b1079
800
PASSED
#include<bits/stdc++.h> using namespace std; int t; long long a[21]; int main() { scanf("%d",&t); a[0]=1; for(int i=1; i<=20; ++i) a[i]=a[i-1]*3; while(t--) { int n; scanf("%d",&n); if(n >= 20) printf("NO\n"); else { printf("YES\n"); for(int i=0; i<=n-1; ++i) printf("%lld ",a[i]); printf("...
C++
c8fddee2f1c7d325437a7d0b82758b03
54dba2609c51cc78c76b8a72f71c9b4b
800
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int t, tc; const int N = 2e5 + 9; int n; map<pair<int, int>, int> points; pair<int, int> cur[N]; pair<int, int> ans[N]; bool on_edge[N]; vector<int> same_x[N]; const pair<int, int> neg = {int(1e9), int(1e9)}; const int MX = 1e6; int m...
C++
b021a3c7ae119671c81c51da7cfabdb3
2a8fac3daf10cc858c43e51c194d1f0b
1,900
PASSED
#include<bits/stdc++.h> #define F first #define S second using namespace std; typedef pair<int,int> pii; const int M=2e5+5; const complex<int> d[]={{1,0},{-1,0},{0,1},{0,-1}}; const complex<int> bruh={(int)1e9,(int)1e9}; struct cmp { bool operator()(const complex<int> &a,const complex<int> &b)co...
C++
b021a3c7ae119671c81c51da7cfabdb3
281529a14e96eb69fc3e916be913c7b8
1,900
PASSED
#include<bits/stdc++.h> #define F first #define S second using namespace std; typedef pair<int,int> pii; const int M=2e5+5; const complex<int> d[]={{1,0},{-1,0},{0,1},{0,-1}}; const complex<int> bruh={(int)1e9,(int)1e9}; bool cmp1(const complex<int> &a,const complex<int> &b) { if(a.real()!=b...
C++
b021a3c7ae119671c81c51da7cfabdb3
09fd463720d0af3bc681f32f2e0970f7
1,900
PASSED
#include<bits/stdc++.h> #define F first #define S second using namespace std; typedef pair<int,int> pii; const int M=2e5+5; const pii d[]={{1,0},{-1,0},{0,1},{0,-1}}; const pii bruh = {1e9,1e9}; vector<array<int,3>> cpr; vector<pii> vt; int dis[M]; pii check(pii a) { for(auto&c:d) { ...
C++
b021a3c7ae119671c81c51da7cfabdb3
4d616b423f4a1ac5d3e3829b644dd743
1,900
PASSED
// #pragma GCC optimize("Ofast") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2") #include<bits/stdc++.h> // #include<ext/pb_ds/assoc_container.hpp> // #include<ext/pb_ds/tree_policy.hpp> // #include<ext/rope> #define int ll #define sz(x) int((x).size()) #define all(x) (x).begin(),(x).end() using nam...
C++
b021a3c7ae119671c81c51da7cfabdb3
9cc8ca910a8450b9c62730c01710325b
1,900
PASSED
//inexorable and inevitable #include <bits/stdc++.h> using namespace std; #pragma GCC optimize (Ofast) #define fastio ios_base::sync_with_stdio(0); cin.tie(NULL); #define rep(i, a, b) for(int i = (a); i <= (b); i++) #define per(i, a, b) for(int i = (a); i >= (b); i--) #define LL long long #define mp make_pair ...
C++
b021a3c7ae119671c81c51da7cfabdb3
ecb3e0bc79983b7e918a73468424b5ef
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define int long long int inf=1e18, mod=998244353; vector <int> xx[200009]; vector <pair<int, int> >xp[200009]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifndef ONLINE_JUDGE freopen("inpu...
C++
b021a3c7ae119671c81c51da7cfabdb3
8638cde2e8e6c6a14938f87cd7ec2588
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long //#define ll unsigned long long #define il (i<<1) #define ir (i<<1)+1 #define pb push_back #define pii pair<int,int> #define pll pair<ll,ll> const ll mod = 1e9 + 7; const int maxn = 2e5 + 5; const int maxm = 1e7 + 100; const ll mod2 = 1e7 + 3...
C++
b021a3c7ae119671c81c51da7cfabdb3
50d612db55e0c4cd238616e32ce86152
1,900
PASSED
#include <unordered_map> #include <algorithm> #include <iostream> #include <iomanip> #include <cmath> #include <queue> #include <map> #include <set> using namespace std; typedef long long ll; struct segment{int l, r; int size(){return r-l+1;}}; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #def...
C++
b021a3c7ae119671c81c51da7cfabdb3
1749a7e3918167abb2d953d9f5e9a9ba
1,900
PASSED
#include<bits/stdc++.h> using namespace std; const int NMAX=2e5; pair<int,int>pts[NMAX+5]; map<pair<int,int>,int>mp; pair<int,int> ans[NMAX+5]; bool stuck[NMAX+5]; pair<int,int>dir4[4]={ {1,0}, {-1,0}, {0,1}, {0,-1} }; set<pair<int,int>>used; signed main(){ ios_base::sync_with_stdio(0);cin.tie(0)...
C++
b021a3c7ae119671c81c51da7cfabdb3
9ee411a842aae8b201308b631b9940be
1,900
PASSED
#include<cstdio> #include<vector> std::vector<int> a[6005]; int n,s[6005],vis[6005],cnt; long long ans=0; void add(int x,int y){a[x].push_back(y);a[y].push_back(x);} void dfs(int v) { if (vis[v]) return; vis[v]=1; s[++cnt]=v; for (int i=0;i<(int)a[v].size();i++) { int u=a[v][i]; dfs(u); } } l...
C++
202396838c98654c4e40179f21a225a0
6b955eeac11dcc3b6736f6449306f10e
2,600
PASSED
#include<cstdio> #include<vector> #define int long long std::vector<int> a[6005]; int n,s[6005],vis[6005],cnt; long long ans=0; void add(int x,int y){a[x].push_back(y);a[y].push_back(x);} void dfs(int v) { if (vis[v]) return; vis[v]=1; s[++cnt]=v; for (int i=0;i<(int)a[v].size();i++) { int u=a[v][i...
C++
202396838c98654c4e40179f21a225a0
ad2fee52226b1ee757b4590e47a89848
2,600
PASSED