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<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> #include<cstring> #include<string> #include<cmath> #include<map> #include<set> #include<vector> #include<queue> #include<bitset> #include<ctime> #include<deque> #include<stack> #include<functional> #include<sstream> //#include<cctype> //#pragma G...
C++
9d3ab9c33b69c4f8e60454d369704b30
7dbec3b2d335703fce284ba74ec21160
1,900
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> #include<cstring> #include<string> #include<cmath> #include<map> #include<set> #include<vector> #include<queue> #include<bitset> #include<ctime> #include<deque> #include<stack> #include<functional> #include<sstream> //#include<cctype> //#pragma G...
C++
9d3ab9c33b69c4f8e60454d369704b30
3ab7a199e264d30a92208d84d58560e4
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 300005, INF = 1000000009; int n; int a[N]; multiset<int> s; vector<int> g[N]; int main() { ios_base::sync_with_stdio(false); cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; s.insert(a[i]); } for (int i = 0; i < n...
C++
9d3ab9c33b69c4f8e60454d369704b30
279c3153a17dacbce58d3fe8ac2f6d1d
1,900
PASSED
/** Bismillahir Rahmanir Rahim ___________________ \_______ ________\ | | __ ___ __ ___ __ __ _______ | | / \ | \ | | \ \ / / | | / ___ \ | | / /\ \ | |\ \ | | \ \ / / | | | | | \ | | / /__\ \ ...
C++
9d3ab9c33b69c4f8e60454d369704b30
79afc5d61ee7a43067e9eaca5fbf6ffc
1,900
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair #define xx first #define yy second #define sz(v) v.size() const int B=500; using namespace std; using namespace __gnu_pbds; #define be begin() #define rb rbegin() #define all...
C++
9d3ab9c33b69c4f8e60454d369704b30
78bbc85018b8679046b0a363c46f9f08
1,900
PASSED
#include <bits/stdc++.h> #include <chrono> using namespace std; using namespace std::chrono; // #pragma GCC target ("avx2") // #pragma GCC optimization ("O3") // #pragma GCC optimization ("unroll-loops") // #pragma optimization_level 3 // #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") ...
C++
9d3ab9c33b69c4f8e60454d369704b30
9a8276d2206cd44baa24128afbe7c804
1,900
PASSED
#include<bits/stdc++.h> typedef long long ll; using namespace std; ll good_rand() { return rand()*RAND_MAX+rand(); } template<class A> class myvector : public std::vector<A> { public: A& operator[](int pos) { if (pos<0) pos=0; while (this->size() <= pos) { this->push_back...
C++
40a5e4b4193901cb3004dac24dba1d62
ae44dc1b1e21cb4a0c73aaabde415b33
1,800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; ll l, r; ll mod=1000000007; ll ans(ll x) { if (x==0) return 0; if (x==1) return 1; ll s=1; ll n=1; ll w=0; ll so=3; ll se=2; x-=1; n*=2; while (x>=n) { x-=n; if ...
C++
40a5e4b4193901cb3004dac24dba1d62
044cb19d29b1aa423b8b73dbade377b8
1,800
PASSED
#include<bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // a non-standard tree in g++ // #include <ext/pb_ds/tree_policy.hpp> #define ll unsigned long long #define fi first #define se second #define pb push_back #define mp make_pair #define umap map #define INF 10000000000000000LL #define M...
C++
40a5e4b4193901cb3004dac24dba1d62
e159f37aeb1927fe035825e7de39a021
1,800
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <unordered_map> #include <string> #include <queue> #include <cmath> #define ll long long #define finish(x) cout<<x<<endl #define all(x) (x).begin(), (x).end() using namespace std; ll mod = 1e9+7; ll func(ll& ec,ll& oc,ll x) { // in...
C++
40a5e4b4193901cb3004dac24dba1d62
22e431f9024df5d7134f25f1dd7e4baa
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int I=1; typedef long long ll; int modpow(int n,int x) { if(x==0)return 1%100000; ll u=modpow(n,x/2); u=(u*u)%100000; if(x%2==1)u=(u*n)%100000; return u; } int main() { ios::sync_with_stdio(false); cin.tie(0); ll l,r; cin>>l>>r; ...
C++
40a5e4b4193901cb3004dac24dba1d62
46cd696bcb96edfacc40e80b6843ab84
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int I=1; typedef long long ll; #define MOD 1000000007 int modpow(int n,int x) { if(x==0)return 1%100000; ll u=modpow(n,x/2); u=(u*u)%100000; if(x%2==1)u=(u*n)%100000; return u; } int main() { ios::sync_with_stdio(false); cin.tie(...
C++
40a5e4b4193901cb3004dac24dba1d62
8a1b1715fb1496788af8b08c5193303f
1,800
PASSED
#include<bits/stdc++.h> using namespace std; int I=1; typedef long long ll; #define MOD 1000000007 int modpow(int n,int x) { if(x==0)return 1%100000; ll u=modpow(n,x/2); u=(u*u)%100000; if(x%2==1)u=(u*n)%100000; return u; } int main() { ios::sync_with_stdio(false); cin.tie(...
C++
40a5e4b4193901cb3004dac24dba1d62
5877fc49252a126cecc1913fc2d871c3
1,800
PASSED
//coded by armish_123// #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <vector> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <queue> #include <ctime> #include <cassert> #include <complex> #include <string> #include <cst...
C++
40a5e4b4193901cb3004dac24dba1d62
2d16b165846cdabdcc867dfbf29a022f
1,800
PASSED
//coded by armish_123// #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <vector> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <queue> #include <ctime> #include <cassert> #include <complex> #include <string> #include <cst...
C++
40a5e4b4193901cb3004dac24dba1d62
d2965ac4a07f3ee5563c78fb0b60a30a
1,800
PASSED
#include <bits/stdc++.h> #define DEBUG if(0) #define lli long long int using namespace std; const lli mod = 1e9 + 7; lli nearestPowerOfTwo(lli number) { lli p = 0; while (number) number >>= 1, p ++; return(p - 1); } lli start(lli power) { lli s = power & 1 ? 2 : 1; while (power > 1) { s += 1LL << (po...
C++
40a5e4b4193901cb3004dac24dba1d62
15c8f2e2844e4ddbb4839f15c7ab8f48
1,800
PASSED
#include<bits/stdc++.h> #include <iostream> #include <string> #include <vector> #include <queue> #include <math.h> #include <algorithm> #include <map> #include <set> #define l(i,n) for(int i=0;i<n;i++) typedef long long ll; using namespace std; bool vis[10000]; int main(){ int n,m; cin >> n >> m; memset(vis,...
C++
d93a0574497b60bb77fb1c1dfe95090f
bc6729af29b37c1bb975f4d0f5cbabbf
1,300
PASSED
#include <bits/stdc++.h> #define ll long long int using namespace std; bool cmp(pair<ll, ll>& a, pair<ll, ll>& b) { if(a.first == b.first) { return a.second < b.second; } return a.first < b.first; } int main() { ll n, t, c, m; while(cin >> n >> m) { vector<ll> v(m + 5); map<ll, ll> mp; ll x = 0...
C++
d93a0574497b60bb77fb1c1dfe95090f
5eba18a66561c7f3e697d5a6ac1c80d5
1,300
PASSED
#include <bits/stdc++.h> #define ll long long int using namespace std; bool cmp(pair<ll, ll>& a, pair<ll, ll>& b) { if(a.first == b.first) { return a.second < b.second; } return a.first < b.first; } int main() { ll n, t, c, m; while(cin >> n >> m) { vector<ll> v(m + 5); map<ll, ll> mp; ll x = 0...
C++
d93a0574497b60bb77fb1c1dfe95090f
73d97cf1e1e6121071fd33fab72c4e93
1,300
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; map<pair<int,int>,bool> ma; vector<bool> vis(n+1); // for(int i=1;i<=n;i++) vis[i] = false; for(int i=1;i<=m;i++) { int a,b; cin>>a>>b; // ma[{a,b}] = true; vis[a] = vis[b] = true; ...
C++
d93a0574497b60bb77fb1c1dfe95090f
e4eb74057d45f88a65e5a19cadf5cadb
1,300
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; map<pair<int,int>,bool> ma; bool vis[n+1]; for(int i=1;i<=n;i++) vis[i] = false; for(int i=1;i<=m;i++) { int a,b; cin>>a>>b; // ma[{a,b}] = true; vis[a] = vis[b] = true; } in...
C++
d93a0574497b60bb77fb1c1dfe95090f
3fc33d83f66485c10be5acb3350ce88a
1,300
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; map<pair<int,int>,bool> ma; // vector<bool> vis(n+1); // for(int i=1;i<=n;i++) vis[i] = false; bool vis[n+1] = {false}; for(int i=1;i<=m;i++) { int a,b; cin>>a>>b; // ma[{a,b}] = true; ...
C++
d93a0574497b60bb77fb1c1dfe95090f
c8cc0e89af0a1d65057f5be1350f0f37
1,300
PASSED
#include<bits/stdc++.h> // 79 90 using namespace std; #define rep(i,k,n) for(i=(k); i<(n); ++i) #define repr(i,k,n) for(i=(k); i>(n); --i) #define tr(it,a) for(auto it = (a).begin(); it != (a).end(); ++it) #define ll long long #define siz(x) ((int)(x).size()) #define si(x) scanf("%d", &x) #define sl(x) sca...
C++
d93a0574497b60bb77fb1c1dfe95090f
f9b188b244fb2c0d5fcdd9a60d631ea9
1,300
PASSED
#include<bits/stdc++.h> // 79 90 using namespace std; #define rep(i,k,n) for(i=(k); i<(n); ++i) #define repr(i,k,n) for(i=(k); i>(n); --i) #define tr(it,a) for(auto it = (a).begin(); it != (a).end(); ++it) #define ll long long #define siz(x) ((int)(x).size()) #define si(x) scanf("%d", &x) #define sl(x) sca...
C++
d93a0574497b60bb77fb1c1dfe95090f
9b7cfe5d2f5a3d6b08a938ecef58e24e
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define pb push_back #define f(i,n) for(i=0;i<n;i++) #define F(i,a,b) for(i=a;a<=b;i++) #define arr(a,n) for( i=0;i<n;i++)cin>>a[i]; #define fi first #define se second #define mp make_pair #define mod 1000000007 #define YES cout<<"YES...
C++
d93a0574497b60bb77fb1c1dfe95090f
689ae6268cd1859028a39a8b97aca37f
1,300
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; vector<int> v(n,0); for(int i=0;i<m;i++) { int x,y; cin>>x>>y; v[x-1]=1; v[y-1]=1; } int s=0; for(int i=0;i<n;i++) { if(v[i]==0) { ...
C++
d93a0574497b60bb77fb1c1dfe95090f
5a91a334258923d326056977e63b4340
1,300
PASSED
#include<bits/stdc++.h> using namespace std; void fast() { std::ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int main() { fast(); int n , k , i, j , cnt =0 , mx=0 , x, y ; cin>>n>>k; char c[n][n] ; int a[n][n] = { 0 } ; for(i=0;i<n;i++) for(j=0;j<n;j++)...
C++
6fb20914525715af737d81f3a5d98636
39fa14127ea1816cde2380d2f83528b6
1,300
PASSED
#include <iostream> #include <algorithm> #include <map> using namespace std; int main() { int n, k, Max(0), max_i(-1), max_j(-1), i, j, l; cin >> n >> k; char field[100][100], temp; map<pair<int, int>, int> locations; bool valid; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { cin >> field[i][j]; ...
C++
6fb20914525715af737d81f3a5d98636
86e1f72761d0a7d924d759cda9fcaf0c
1,300
PASSED
#include <iostream> #include <vector> using namespace std; int n, k, maxx = 0, maxX, maxY; vector<vector<int>> a(102, vector<int>(102)); int search(int i, int j, int x, bool vert) { if (a[i][j] == -1) { return 0; } if (x == k) { a[i][j]++; if (a[i][j] > maxx) { maxx = a[i][j]; maxX = i; maxY = j; ...
C++
6fb20914525715af737d81f3a5d98636
c5497966421c889804c536e7039c866a
1,300
PASSED
#include <bits/stdc++.h> #define ll long long #define ss second #define pb push_back #define ff first #define pii pair<int, int> #define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define INF INT_MAX using namespace std; int main() { int n, k; cin >> n >> k; vector<string> g( n ); for (...
C++
6fb20914525715af737d81f3a5d98636
8f0f14880d5eba0a490039001766ccc5
1,300
PASSED
#include<iostream> #include<cmath> #include<algorithm> #include<string.h> using namespace std; char ch[102][102]; int main() { int n,k,x,y,max,sum,qnx,hnx,qny,hny; bool flag=true; max=-1; x=y=1; k; cin>>n>>k; for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { cin>>ch[i][j]; } } for(int i=1...
C++
6fb20914525715af737d81f3a5d98636
230f9bf5fe86bcebd341827e328639a9
1,300
PASSED
#include<stack> #include<vector> #include<iostream> #include<string> #include<unordered_set> #include<unordered_map> #include<queue> #include<map> #include<algorithm> using namespace std; int main() { int n, k; cin >> n >> k; int r = 0, c = 0, max = -1; int len = k; vector<string> arena; for (int i = 0; i < n; ...
C++
6fb20914525715af737d81f3a5d98636
0ed5424bd91e0c311da4a4c9de44a5d9
1,300
PASSED
#include<stack> #include<vector> #include<iostream> #include<string> #include<unordered_set> #include<unordered_map> #include<queue> #include<map> #include<cmath> #include<algorithm> using namespace std; typedef unsigned long long ull; int main() { ull n, ks; cin >> n >> ks; vector<string> p; for (int i = 0; i...
C++
6fb20914525715af737d81f3a5d98636
e1ef1453aaa2f3ca5c3033e89e5a2a38
1,300
PASSED
#include<bits/stdc++.h> using namespace std; #define code ios::sync_with_stdio(0); cin.tie(0); cout.tie(0) //#define int long long #define endl "\n" #define pb push_back #define rep(i,j,k) for(int i=j;i<k;i+=1) #define ff first #define ss second const long double pi=2*acos(0.0); const int MOD=1e9+7; int vis[1000006]; ...
C++
6fb20914525715af737d81f3a5d98636
04edc3c031cd8c36604e79e8e7b81072
1,300
PASSED
#include <iostream> #include <bits/stdc++.h> #include <string> #include <bitset> using namespace std; #define pb push_back #define ull unsigned long long #define ll long long #define F first #define S second #define PI acos(-1) #define EPS 1e-9 #define ld double #define MAX 1000000000 #define NIL 0 #define INF 1e15 #...
C++
6fb20914525715af737d81f3a5d98636
6d7c93d84e467f3e92299d1d6a2133c5
1,300
PASSED
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100 + 10; char matrix[MAX_N][MAX_N]; int answer[MAX_N][MAX_N] = { 0 }; int main () { int n, k; scanf("%d %d", &n, &k); for(int i = 0; i < n; i+= 1) scanf("%s", matrix[i]); for(int i = 0; i < n; i += 1) { for(int j = 0;...
C++
6fb20914525715af737d81f3a5d98636
6a4d85d21c2eb1f5b65d8b3aa186c946
1,300
PASSED
import java.util.*; import java.io.*; public class Main { static BufferedReader br; static FileInputStream fis; static InputStreamReader isr; static FileWriter fw; public static void main(String[] args) throws IOException{ //fis = new FileInputStream("input.txt"); //isr = new InputStreamReader(fis); ...
Java
50e88225d8b081d63eebe446f48057f4
2ca41bd2264f984fdac2d4b8d0b231f5
1,200
PASSED
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Yanhong Wu */ public class B { public static void main(String[] args) { InputStream inputStream =...
Java
50e88225d8b081d63eebe446f48057f4
2793ea6905f35b98361b5a232282deef
1,200
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = 0; try { n = Inte...
Java
50e88225d8b081d63eebe446f48057f4
fada42ef7cfa9053f25522f07af7f184
1,200
PASSED
import java.util.Scanner; /** * Created by Admin on 18.07.2016. */ public class B_379 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = in.nextInt(); ...
Java
50e88225d8b081d63eebe446f48057f4
14c2ed54cbb3a5fcf519526312df3f75
1,200
PASSED
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class NYP { public static void main(String[] args) throws Exception { BufferedReader br= new BufferedReader(new InputStrea...
Java
50e88225d8b081d63eebe446f48057f4
794dd761b4b7bd121a56d310557187ed
1,200
PASSED
import java.io.*; import java.util.*; public class Main { static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer; static int nextInt() throws IOException { return Integer.parseInt(nextToken()); } static long nextLong() throws IOException { return Long.parseLong(nextToken(...
Java
50e88225d8b081d63eebe446f48057f4
dce30ebbde870a366158223b67acbd09
1,200
PASSED
import java.util.Arrays; import java.util.Scanner; public class CF_Bye2013_II { public static void solve(int[] arr) { int len = arr.length; int[] cur = new int[len]; for(int i=0;i<len;i++) { cur[i] = 0; } int ind = 0; while(!equal(cur,arr)) { while(ind!=len-1) { if(cur[ind]<arr[ind]) { cu...
Java
50e88225d8b081d63eebe446f48057f4
1f6b2d056d6d91b30bebfd31c3cd4886
1,200
PASSED
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringToken...
Java
50e88225d8b081d63eebe446f48057f4
e772177349e39243a82e41dad193a216
1,200
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class NewYearPresent { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedRea...
Java
50e88225d8b081d63eebe446f48057f4
b7fa3e5014d9ffb339c95390a0da3686
1,200
PASSED
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class NewYearPresent { /** * @param args */ public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; int n = 0; int[] a = ...
Java
50e88225d8b081d63eebe446f48057f4
5c12ccdab494ff033d4435969d62bfbc
1,200
PASSED
t = int(input()) for _ in range(t): n,x = list(map(int,input().split())) a = list(map(int, input().split())) a = list(set(a)) a.sort() for i in a: if i<=x+1: x+=1 print(x)
Python
e5fac4a1f3a724234990fe758debc33f
48edd508213e2c40402bc74783849b9d
900
PASSED
t = int(input()) for _ in range(t): n,x = list(map(int,input().split())) a = list(map(int, input().split())) a = list(set(a)) a.sort() for i in a: if i<=x+1: x+=1 print(x)
Python
e5fac4a1f3a724234990fe758debc33f
85e694a956ad4df26b7e6de940d10dfa
900
PASSED
for t in range(int(input())): n,x = map(int,input().split()) a = [int(s) for s in input().split()] b = [0 for i in range(201)] for j in a: b[j-1] = 1 for j in range(201): if b[j] == 0: if x > 0: b[j] += 1 x -= 1 else: ...
Python
e5fac4a1f3a724234990fe758debc33f
052006621875f871dc4311d9449949e4
900
PASSED
# Finding an opportunity is a matter of believing it's there. Barbara Corcoran # by : Blue Edge - Create some chaos for _ in range(int(input())): n,x=map(int,input().split()) arr=[0]*500 a=list(map(int,input().split())) for y in a: arr[y-1]=1 # print(*arr) i=0 while True: i...
Python
e5fac4a1f3a724234990fe758debc33f
85a7be0acfb0a295fc4a6b2e8d903c06
900
PASSED
import sys def f(n, x, a): x1 = x i = 0 b = set(a) while (1): i += 1 if i in b: continue else: if x1 == 0: return i - 1 else: x1 -= 1 input = sys.stdin.readline def inp(): return (int(input())) def...
Python
e5fac4a1f3a724234990fe758debc33f
f0f3dae17ae4530f2382eacfef2a9ef2
900
PASSED
import math from functools import reduce from bisect import bisect_left,bisect,bisect_right from itertools import accumulate from math import sqrt from math import gcd def transformer(i): if i=='d' or i=='f': return 1 return 0 def changer(s): l=[] for i in s: if i=='H': l.ap...
Python
e5fac4a1f3a724234990fe758debc33f
4f3c17add9702108f7e7358f1256db66
900
PASSED
t = int(input()) for _ in range(t): n, x = map(int, input().split()) a = list(map(int, input().split())) visited = set() for i in range(n): visited.add(a[i]) for i in range(1, 202): if i not in visited: x -= 1 if x == -1: print(i - 1) ...
Python
e5fac4a1f3a724234990fe758debc33f
f721d7b49e63dd8ad1a339cd523807d5
900
PASSED
t = int(input()) for i in range(t): n_m = list(map(int,input().split())) n = n_m[0] x = n_m[1] a = list(map(int,input().split())) a.sort() flag=0 for j in range(n): if(j==0): diff = a[0]-1 else: diff = a[j]-a[j-1]-1 if(diff>0 and x>=diff): x-=diff elif(x==0 and diff>0): print(a[j-1]) flag=...
Python
e5fac4a1f3a724234990fe758debc33f
3b23abfd4291ffe7067f57524e9ebd58
900
PASSED
t = int(input()) for i in range(t): n_m = list(map(int,input().split())) n = n_m[0] x = n_m[1] a = list(map(int,input().split())) a.sort() flag=0 for j in range(n): if(j==0): diff = a[0]-1 else: diff = a[j]-a[j-1]-1 if(diff>0 and x>=diff): x-=diff elif(diff>0 and x<diff): if(j==0): print(...
Python
e5fac4a1f3a724234990fe758debc33f
5b5b60e0b55933e340c62208aa253ae7
900
PASSED
from collections import Counter for _ in range(int(input())): a,b = map(int,input().split()) l = list(map(int,input().split())) d = Counter(l) count=0 # print(d.keys()) for i in range(1,300): if (i in d.keys()) and b>=0: count+=1 elif b>=0: b-=1 ...
Python
e5fac4a1f3a724234990fe758debc33f
ef9c365dadccf7cbdf547be617e725c4
900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t , id = 0; cin >> t; int n; string s , b = "", c = "" ; while(t--) { cin >> n; cin >> s; for(int i = 0; i < s.size(); i++) { if(s[i] == '1') { id = i; break; ...
C++
c4c8cb860ea9a5b56bb35532989a9192
b670362eb07049be3d1ce08cf6bc9bc3
1,200
PASSED
#include <stdio.h> void run(void) { int n, i; char X[50001]; char A[50001]; char B[50001]; short int indicator = 0; scanf("%d", &n); A[n] = '\0'; B[n] = '\0'; scanf("%s",X); for(i=0; i<n; i++){ if (X[i] == '0'){ A[i] = '0'; B[i] = '0'; }el...
C++
c4c8cb860ea9a5b56bb35532989a9192
f9569b22ccb985c70ca6caf942d2cd75
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int tt ; cin >> tt ; while(tt--){ long long o ; cin >> o ; string x , a = "1" , b = "1" ; cin >> x ; int e = 0 ; bool when = true; for(int i = 1 ; i < o ;i++){ int w ,u ; ...
C++
c4c8cb860ea9a5b56bb35532989a9192
245521e1a99c83c8c9b05d3eab72343c
1,200
PASSED
#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define eb emplace_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define ins insert #define ull uns...
C++
c4c8cb860ea9a5b56bb35532989a9192
aa3a393d3f9d809ee7220d2e753c6b1a
1,200
PASSED
#include <iostream> #include <string> #include <cstring> #include <vector> #include <cstdlib> #include <cstdio> #include <queue> #include <algorithm> #include <cmath> #include <set> #include <stack> #include <fstream> #include <stdio.h> #include <map> #define ll long long #define TEST cout << "test" << endl; using ...
C++
c4c8cb860ea9a5b56bb35532989a9192
8bdca42d54afe04d9aabc2dc0781b272
1,200
PASSED
#include <bits/stdc++.h> using namespace std ; int main () { int x ; string stt[10100] ;int x2[100100] ; cin >> x ; for (int i=0;i<x;i++) { cin >> x2[i] ; cin >> stt[i] ; } for (int i=0;i<x;i++) { long long int a =0,c=0,w=0,h=0; string st1 ,st2 ; char b ; ...
C++
c4c8cb860ea9a5b56bb35532989a9192
ff716710d4477568573e3378eabcd2ec
1,200
PASSED
#include <bits/stdc++.h> using namespace std; #define V(i) vector<i> #define rep(i, n) for (__typeof(n) i = 0; i < n; i++) #define crep(i, N, n) for (__typeof(n) i = N; i < n; i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define P(i, j) pair<i, j> #define MP make_pair #define MOD 10000000...
C++
c4c8cb860ea9a5b56bb35532989a9192
6ab6cf5bd2300557a8841b2ca546aee7
1,200
PASSED
/* ///////// ///// //// //// // // // // // // // ////// // // // // // // // /// // // // //////// // // // // */ #include<bits/stdc++.h> #include<assert.h> using namespace std; typedef long long int ...
C++
c4c8cb860ea9a5b56bb35532989a9192
c73f4b3b093d4c01bfdefec0575bfb45
1,200
PASSED
#include<bits/stdc++.h> //#include<pair> using namespace std; typedef long long ll; typedef int ii; //typedef vector<ll> vi; #define INF 1000000007 #define T while(t--) #define for2(i,a,b) for(i=a;i>=b;i--) #define for1(i,a,b) for(i=a;i<=b;i++) #define pb push_back #define mp make_pair typedef long double ld; #def...
C++
c4c8cb860ea9a5b56bb35532989a9192
ac298ce2eae1eda972f1724204a0c3c6
1,200
PASSED
#include <iostream> #include <vector> using namespace std; int main() { int t; cin>>t; while(t--) { int n,i,flag=0; cin>>n; string s; cin>>s; vector <int>a; vector<int>b; a.push_back(1); b.push_back(1); i=1; while(i<n && s[...
C++
c4c8cb860ea9a5b56bb35532989a9192
6a177ffd43ff3a89aa75ab8f3d50ea22
1,200
PASSED
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; #define pb push_back using namespace std; int a[110], b[110]; int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; for(int i = 0; i <= n; i++) cin >> a[i]; for(int i = 0; i <= m; i++) cin >> b[i]; if(m != n...
C++
37cf6edce77238db53d9658bc92b2cab
8602f3803440dc9a71cd8b6f1aeecb21
1,400
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int //ll p[50000005][2]; //ll sum[200005]; //priority_queue<ll>pq; //ll b[2000005]; class Myfirst{ private: string *name; ll *age; public: ll gcd(ll a ,ll b) { if(b==0) return a; a%=b; return gcd(b,a); } ll ...
C++
37cf6edce77238db53d9658bc92b2cab
6478ba356ebeed843f6ab1f92931177f
1,400
PASSED
// ashu goyal #include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; int arr1[n+1]; int arr2[m+1]; for(int i=0;i<n+1;i++){ cin>>arr1[i]; } for(int i=0;i<m+1;i++){ cin>>arr2[i]; } string ans=""; // case 1 if(n > m ){ if(arr1[0]*...
C++
37cf6edce77238db53d9658bc92b2cab
0d76fce6646c096a0ed11faa186e8ff0
1,400
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define endl '\n' #define all(C) C.begin(),C.end() #define allr(C) C.rbegin(),C.rend() #define EB emplace_back #define present(container, element) (container.find(element) != container.end()) #define spr...
C++
37cf6edce77238db53d9658bc92b2cab
9eb24050479d10a50b6fded52a7625f3
1,400
PASSED
#pragma comment(linker, "/stack:200000000") #pragma GCC optimize("O3") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #define ll long long int #define pb push_back #define endl '\n' #define INF (long long) 1e18 + 5 //Infinity #def...
C++
37cf6edce77238db53d9658bc92b2cab
31ab4adc2d83a8d6130a7bcd1e0034ab
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int a[500]; int b[500]; //Compiler version g++ 6.3.0 int main() { int n, m; int af=-1; int bf=-1; cin>>n>>m; for(int i=0;i<n+1;i++){ cin>>a[i]; } for(int i=0;i<m+1;i++){ cin>>b[i]; } if(n>m){ for(int i=0;i<n+1;i++){ if(a[i]<00){ ...
C++
37cf6edce77238db53d9658bc92b2cab
0aef5805dc0a258024f9f42cc079f3d0
1,400
PASSED
#include<bits/stdc++.h> #include<stdio.h> typedef long long int ll; typedef long double ld; #define pb push_back #define arr vector<ll> #define mem(x) memset(x,0,sizeof(x)) #define vp(x) vector<pair<ll,ll>>x #define matrix ...
C++
37cf6edce77238db53d9658bc92b2cab
5f7933797c6b79bd0c6df084e551371a
1,400
PASSED
#include <iostream> #include <math.h> using namespace std; int gcd(int a, int b) { int larger, smaller; if(a >= b) { larger = a; smaller = b; } else { larger = b; smaller = a; } for (int i = smaller; i > 1; i--) { if(larger % i == 0 && small...
C++
37cf6edce77238db53d9658bc92b2cab
054a77b4a0038ebe5a03db19397164cc
1,400
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define ff first #define ss second #define lim 1000000 #define mod 1000003ll #define pii pair<ll,ll> #define ull usigned long long const float pi = 3.141592653589793238; ll toint(const string &s) {stringstre...
C++
37cf6edce77238db53d9658bc92b2cab
0378a0dd10213337f6627c73eae0cb2a
1,400
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define ff first #define ss second #define lim 1000000 #define mod 1000003ll #define pii pair<ll,ll> #define ull usigned long long const float pi = 3.141592653589793238; ll toint(const string &s) {stringstre...
C++
37cf6edce77238db53d9658bc92b2cab
f2f3a86a7a018127ad6d9e6df15a4320
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ long long x; cin>>x; long long int base=1; long long int req=1; long long int ans=1; long long int j=1; while(req<=x){ base+=pow(2,j); long lon...
C++
f0806ab99cf4da228abe3cd8073884d9
881424da64eefae655a809e069bac709
1,200
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define mod 1000000007 /* /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ *** Debugging Start *** \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ */ void __print(int x)...
C++
f0806ab99cf4da228abe3cd8073884d9
db82da537fe7a765648d4bd5fdb514a9
1,200
PASSED
#include <bits/stdc++.h> #include <stdio.h> using namespace std; unsigned long long sum(unsigned long long x) { return x * (x + 1) / 2; } int f(unsigned long long x) { int res = 0; for (int i = 1; i < 64 && sum((1u << i) - 1) <= x; ++i) { ++res; x -= sum((1u << i) - 1); } return r...
C++
f0806ab99cf4da228abe3cd8073884d9
4de30a23e4b4a44eb326ee0dd213a75d
1,200
PASSED
//Codeforces 671 B #include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define mod 1000000007 #define ll long long int main() { int t; cin>>t; while(t--) { long long int n; cin>>n; /*int q = 1500000000; vector<int> dp(q,0); dp[1] = 1; d...
C++
f0806ab99cf4da228abe3cd8073884d9
b7f203c8360e98cbc34fb392d8d88bb7
1,200
PASSED
#include <bits/stdc++.h> using namespace std; #define pb push_back #define Fd(start, end) for(int i = start; i < end; i++) #define Fb(end, start) for(int i = end - 1; i >= start; i--) #define pr pair<int,int> #define prll pair<ll,ll> #define N 200001 #define ll long long int #define mod 998244353 #define MOD 1000000007...
C++
f0806ab99cf4da228abe3cd8073884d9
cc164b98c710f04affd244d80b714931
1,200
PASSED
#include<bits/stdc++.h> //#include <boost/multiprecision/cpp_int.hpp> //using namespace boost::multiprecision; #define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization ("unroll-loops" #pragma GCC optimize "...
C++
f0806ab99cf4da228abe3cd8073884d9
612b5797b8cbbd53d32058210f4c3084
1,200
PASSED
#include <bits/stdc++.h> using namespace std; void solve(){ long long S,C,N,count=0; cin>>S; N=1; C=1; while(S>=C){ S=S-C; N=2*N+1; C=(N*N+N)/2; count++; } cout<<count<<endl; } int main(){ int T; cin>>T; while(T--){ solve(); } return 0; }
C++
f0806ab99cf4da228abe3cd8073884d9
6eb828d412442852c1a0b3d92a2736b1
1,200
PASSED
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } vo...
C++
f0806ab99cf4da228abe3cd8073884d9
3d8b091add37311c17fc0d6d25e65fbf
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int T; cin>>T; while(T-->0){ int64_t n; cin>>n; int ans=0; for(int64_t i=1;i*(i+1)/2<=n;i=2*i+1) { n-=(i*(i+1)/2); ans++; } cout<<ans<<"\n"; } }
C++
f0806ab99cf4da228abe3cd8073884d9
bdf9f2a19f141fe95ea6d656758b910b
1,200
PASSED
#include <bits/stdc++.h> #include <iomanip> #define lli long long int #define mod 1000000009 #define pb push_back #define pp pop_back #include <vector> #include <algorithm> #include <math.h> #include <unordered_map> using namespace std; lli get(lli k){ return k * (k+1)/2; } int main() { ios_base::sync_with_st...
C++
f0806ab99cf4da228abe3cd8073884d9
92ee6f5b5b22675b32e1aa20ea7d73c3
1,200
PASSED
#include <bits/stdc++.h> using namespace std; const int md = 1e9 + 7; int power[300005]; int n, q, l, r; string s; vector<int> suf; int main() { cin >> n >> q; suf.resize(n + 1); cin >> s; for(int i = 0; i < n; i++) suf[i + 1] = suf[i] + s[i] - '0'; power[0] = 1; for(int i = 1; i < 3 * n; i++) ...
C++
88961744a28d7c890264a39a0a798708
954f62fbf0359d89512a3dfd36de8baa
1,600
PASSED
#include <bits/stdc++.h> using namespace std; const int md = 1e9 + 7; int n, q; int power[300005]; vector<int> suf; string s; int main() { cin >> n >> q; power[0] = 1; for(int i = 1; i < 3 * n; i++) power[i] = power[i - 1] * 2 % md; cin >> s; suf.resize(n + 1); for(int i = 1; i <= n; i++) suf[i...
C++
88961744a28d7c890264a39a0a798708
ef085eff283560a7126a6fae5112afc1
1,600
PASSED
#include <bits/stdc++.h> using namespace std; const int md = 1e9 + 7; int n, q, l, r; char c[100005]; string s; int pw[300005]; int main() { cin >> n >> q; pw[0] = 1; for(int i = 1; i < 3 * n; i++) pw[i] = (pw[i - 1] * 2) % md; cin >> s; vector<int> suf(n + 1, 0); for(int i = 1; i <= n; i++) su...
C++
88961744a28d7c890264a39a0a798708
5a4abad2aa3660ecd0f1fe1484a93786
1,600
PASSED
#include <bits/stdc++.h> using namespace std; const int md = 1e9 + 7; int n, q; string s; vector<int> suf; int power[300005]; int main() { cin >> n >> q; cin >> s; suf.resize(n + 1); power[0] = 1; for(int i = 1; i < 3 * n; i++) power[i] = power[i - 1] * 2 % md; for(int i = 1; i < n + 1; i++) su...
C++
88961744a28d7c890264a39a0a798708
35e56d52f095ad89fcbf7ef2d95f0156
1,600
PASSED
#include <bits/stdc++.h> using namespace std; const int md = 1e9 + 7; int n, q, l, r; int power[300005]; vector<int> suf; string s; int main() { cin >> n >> q; cin >> s; power[0] = 1; for(int i = 1; i < 3 * n; i++) power[i] = power[i - 1] * 2 % md; suf.resize(n + 1); for(int i = 1; i <= n; i++)...
C++
88961744a28d7c890264a39a0a798708
54cd014f4bd27bc6dd9f3ed79653c6b1
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long double #define rl long long const rl modd = 1e9+7; ll mod (ll x) { return fmod(x, modd); } bool nums [100100]; ll dp [100100]; ll pre1 [100100]; ll pre0 [100100]; ll poww (ll x, ll y) { if ( x == 1 ) return 1; if (y == 1) return mod((rl)x); ll res...
C++
88961744a28d7c890264a39a0a798708
e452bace53c5a5b3425b49dfdc82f109
1,600
PASSED
/******************************************************/ /******************************************************/ /** BISMILLAHIR RAHMANIR RAHIM **/ /** Al-Shahriar Tonmoy - Red_Sparkle **/ /** Department of Computer Science and Engineering **/ /** Barisal Universit...
C++
88961744a28d7c890264a39a0a798708
7721756d0965dc3a9966577563890050
1,600
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <assert.h> #define pb push_back #define x first #define y second #define int long long using namespace std; int n, q; vector<int> pr; int MOD = (int)1e9 + 7; int binpow(int x) { int res = 1; int a = 2; while (x) { if (x & 1) { ...
C++
88961744a28d7c890264a39a0a798708
2e3e1302c086842eb2eb1d8a0d4d4b13
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int ll M=1e9+7; // ll powe(ll a,ll b){ // if(b==1) return a; // else if(b==0) return 1; // ll p=power(a,b/2); // p=p%(M); // if(b%2==0) return (p*p)%M; // else return (((p*p)%M)*a)%M; // } int main() { // ll M=1e9+7; ll n,q; cin>>n>...
C++
88961744a28d7c890264a39a0a798708
79dc00b7c184a239882f47ba4ddd6366
1,600
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <string> using namespace std; vector <long long> vec; long long pw(long long a, long long n) { long long res = 1; while (n) if (n & 1) { res = (res* a) % 1000000007; --n; } else { a = (a * a) % 1000000007; n >>= 1; } return res ...
C++
88961744a28d7c890264a39a0a798708
8afe9ff49fb7ce0c21330d9fa5efeb07
1,600
PASSED
#include <iostream> #include <vector> #include <set> #include <cstdlib> #include <limits> #include <algorithm> typedef long long int lli; class TSegmentAddTree { public: TSegmentAddTree(size_t n, lli x = 0) : SegmentSize(n) { TreeElems.resize(4 * n, TSegment(std::numeric_limits<size_t>::max(), std::numeric_limits<...
C++
562656bfc27b7cf06f7c4a373c6bc029
2603c57f9d49d476d308ca74a3d229c1
2,400
PASSED
/* * totoroXD * */ #include <cstdio> #include <cstring> #include <vector> #include <algorithm> #include <limits> #include <iostream> #include <cstdlib> #include <vector> #include <cmath> #include <set> #include <map> #include <queue> #include <stack> using namespace std; typedef long long LL; const int INF = 1011110...
C++
562656bfc27b7cf06f7c4a373c6bc029
ea292ff16ebf26ee5021c64ed54c82a0
2,400
PASSED
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <cassert> using namespace std; #define print(x) cout << x << endl #define input(x) cin >> x #define TLE_ASSERT(exp) \ do { \ while (!(exp)) { \ ...
C++
562656bfc27b7cf06f7c4a373c6bc029
b38eb06e14cd484c35cd63921b7e5d56
2,400
PASSED
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <cassert> using namespace std; #define print(x) cout << x << endl #define input(x) cin >> x #define TLE_ASSERT(exp) \ do { \ while (!(exp)) { \ ...
C++
562656bfc27b7cf06f7c4a373c6bc029
7bf9d3410b2e6fda294117f13857867d
2,400
PASSED