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;
const double pi=acos (-1.0);
const double eps=1e-8 ;
//const ll INF=(_I64_MAX)/2;
//#pragma comment(linker, "/STACK:102400000,102400000")
const int inf=0x3f3f3f3f ;
#define maxx(a) memset(a, 0x3f, sizeof(a))
#define zero(a) memset(a, 0, sizeof(a))
#de... | C++ | 562656bfc27b7cf06f7c4a373c6bc029 | c4baff944f4dade38e3ca2aa3d669ade | 2,400 | PASSED |
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
using namespace std;
const int MAXN = (int)(1e5);
typedef long long ll;
int colors[4*MAXN + 5];
ll inc[4*MAXN + 5], sum[4*MAXN + 5];
// ni: node index; [si, ei]
void init(int ni, int si, int ei){
if(si >= ei){
colors[ni] = si;
... | C++ | 562656bfc27b7cf06f7c4a373c6bc029 | 88eaaadd9372b7fc163b47288366430c | 2,400 | PASSED |
#include <cstdlib>
#include <iostream>
using namespace std;
const int tree_size = 0x40000;
struct node_t {
int c;
long long m, v;
} segtree[tree_size];
const int leaf_o = tree_size >> 1;
inline long long calc(long long d, int l, int r) {
return abs(d) * (long long)(r - l + 1);
}
#define n_node segtree[n... | C++ | 562656bfc27b7cf06f7c4a373c6bc029 | 5fb961ef6d1452aa31cfb9361babeb8e | 2,400 | PASSED |
#include <cstdio>
#include <algorithm>
using namespace std;
int n, m, t, l, r, x, mark[410000];
long long delta[410000], sum[410000];
void read(int &x) {
char k;
for (k = getchar(); k <= 32; k = getchar());
for (x = 0; '0' <= k; k = getchar()) x = x * 10 + k - '0';
}
void mkt(int k, int q, int h) {
... | C++ | 562656bfc27b7cf06f7c4a373c6bc029 | 0ee4a28429a4efdb4a83855ca6d83e1e | 2,400 | PASSED |
#include <stdio.h>
#include <string.h>
#include <math.h>
#define ll __int64
#define in(a) scanf("%d", &a)
#define out(b) printf("%I64d\n", b)
#define maxn 100000 + 4
#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
ll sum[maxn << 2], lazy[maxn << 2];
int color[maxn << 2];
void pushUp(int rt) {
sum[r... | C | 562656bfc27b7cf06f7c4a373c6bc029 | c9b7e0f17aa0d9429704fff539ea2278 | 2,400 | PASSED |
#include <stdio.h>
#include <string.h>
#include <math.h>
#define ll __int64
#define in(a) scanf("%d", &a)
#define out(b) printf("%I64d\n", b)
#define maxn 100000 + 4
#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
ll sum[maxn << 2], lazy[maxn << 2];
int color[maxn << 2];
void pushUp(int rt) {
sum[r... | C | 562656bfc27b7cf06f7c4a373c6bc029 | 7acece5f0fff48c680030f5323270290 | 2,400 | PASSED |
def main():
number = int(raw_input())
min0 = -1
max0 = -1
covn = -1
for k in range(0, number):
line = raw_input()
words = line.split(' ', 1)
l0 = int(words[0])
r0 = int(words[1])
if min0 == -1 or l0 < min0:
min0 = l0
covn = -1
i... | Python | e702594a8e993e135ea8ca78eb3ecd66 | bcd2c822919dfa39ab883fa420e1c799 | 1,100 | PASSED |
e=[ map(int, raw_input().split()) for i in [0]*input() ]
m=zip(*e)
x=[min(m[0]),max(m[1])]
if x in e:
print e.index(x)+1
else:
print -1
| Python | e702594a8e993e135ea8ca78eb3ecd66 | b6078f885511a1465589e3e52db17e4a | 1,100 | PASSED |
n=int(raw_input())
ans=0
w=[]
lm,rm=1000000000,1
for i in range(n):
l,r=map(int,raw_input().split())
lm=min(l,lm)
rm=min(-r,rm)
w.append((l,-r))
chk=w[:]
chk.sort()
print w.index(chk[0])+1 if chk[0][0]==lm and chk[0][1]==rm else -1 | Python | e702594a8e993e135ea8ca78eb3ecd66 | 3deafab0c681cdfdcbff26b6e69dd603 | 1,100 | PASSED |
n=input()
l,r=[0]*n,[0]*n
for i in xrange(n):l[i],r[i]=map(int,raw_input().split())
t,u=map(lambda x,y:[x,y],l,r),[min(l),max(r)]
if u in t:print 1+t.index(u)
else:print -1
| Python | e702594a8e993e135ea8ca78eb3ecd66 | a15d14bad87b3cb02bebf88733f6faa5 | 1,100 | PASSED |
import sys
N = int(raw_input())
l = []
r = []
for i in range(N):
(L, R) = map(int, raw_input().split())
l.append(L)
r.append(R)
mins = set()
mi = sys.maxint
ma = -mi - 1
for i in l:
if i < mi:
mi = i
for (index, i) in enumerate(l):
if i == mi:
mins.add(index)
for i in r:
if i... | Python | e702594a8e993e135ea8ca78eb3ecd66 | 557ee0ec6b95cc13ba5a492f05ac07b1 | 1,100 | PASSED |
import sys
N = int(raw_input())
l = []
r = []
for i in range(N):
(L, R) = map(int, raw_input().split())
l.append(L)
r.append(R)
def option1():
mins = set()
mi = sys.maxint
ma = -mi - 1
for i in l:
if i < mi:
mi = i
for (index, i) in enumerate(l):
if i == m... | Python | e702594a8e993e135ea8ca78eb3ecd66 | 4fb97f585fa571b6b6f3e89201ac26ab | 1,100 | PASSED |
#copied code
num=-1
R=[]
L=[]
n=int (raw_input ())
for i in range(n):
l,r=((map(int,raw_input().split())))
R.append(r)
L.append(l)
MAXR=max(R)
MINL=min(L)
for i in range(n):
if R[i] == MAXR and L[i] == MINL:
print (i+1)
break
else:
print(-1)
| Python | e702594a8e993e135ea8ca78eb3ecd66 | 9aec25e66e705872be017228deae8cd3 | 1,100 | PASSED |
# -*- coding: utf-8 -*-
import sys
if __name__ == '__main__':
num = map(int,sys.stdin.readline().split())
max = -1
min = 9999999999
fg = -2
for v in range(num[0]):
a,b = map(int,sys.stdin.readline().split())
if a <= min :
if b >= max:
max = b
... | Python | e702594a8e993e135ea8ca78eb3ecd66 | efa8eabc58aeb59b08902bd5915fd26d | 1,100 | PASSED |
n = int(raw_input())
src = [map(int, raw_input().split()) for i in range(n)]
l = min([a[0] for a in src])
r = max([a[1] for a in src])
for i in range(n):
if src[i][0]<=l and src[i][1]>=r:
print i+1
exit(0)
print -1 | Python | e702594a8e993e135ea8ca78eb3ecd66 | b47c11addbbb3f8f3c3de7ef2951921e | 1,100 | PASSED |
s = [map(int, raw_input().split()) for _ in range(input())]
l = min(zip(*s)[0])
r = max(zip(*s)[1])
print s.index([l, r]) + 1 if [l, r] in s else -1 | Python | e702594a8e993e135ea8ca78eb3ecd66 | cbd9de7fd1af7abb3500db98cae68348 | 1,100 | PASSED |
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#pragma comment(linker, "/STACK:16777216")
#define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define For(i,a,b) for(int (i)... | C++ | d2313888d962b1dd6dc21b5f1eb96f91 | 361e43c72ec35411c3b0a8cac5c9f572 | 2,300 | PASSED |
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <set>
using namespace std;
vector<int> primoss(vector<int> &a) {
set<int> esPrimo;
for (int i= 0;i<a.size();i++) {
for (int p=2;p*p<=a[i];p++) {
if (a[... | C++ | d2313888d962b1dd6dc21b5f1eb96f91 | 829f0eb06c0be9834448371667f396de | 2,300 | PASSED |
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <set>
using namespace std;
vector<int> get_primes(vector<int> &potential_inits) {
set<int> sprimes;
for (int i = 0; i < 6; i++) {
for (int p = 2; p * p <= potentia... | C++ | d2313888d962b1dd6dc21b5f1eb96f91 | 0eca6461c8561eb91c97842f84a2c918 | 2,300 | PASSED |
#include<iostream>
#include<stdio.h>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
using namespace std ;
#define MAXN 1000007
int n , x , y ;
int a[ MAXN ] ;
long long pref[ MAXN ] ;
long long suff[ MAXN ] ;
long long add[ MAXN ] ... | C++ | d2313888d962b1dd6dc21b5f1eb96f91 | 52f206aa775846603e3e22d8a4b03d76 | 2,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define ll long long
#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define root l,r,rt
#define mst(a,b) memset((a),(b),sizeof(a))
#define pii pair<int,int... | C++ | d2313888d962b1dd6dc21b5f1eb96f91 | 950d60506a9222ccca90ef243c4ac33a | 2,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define ll long long
#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define root l,r,rt
#define mst(a,b) memset((a),(b),sizeof(a))
#define pii pair<int,int... | C++ | d2313888d962b1dd6dc21b5f1eb96f91 | fe994bc728a41267f526e2a4b17a4eb5 | 2,300 | PASSED |
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const long long inf(0x3f3f3f3f3f3f3f3fll);
long long f[1000011][3];
int p[105], pt, ar[1000011], n, a, b;
void dc(int x) {
if (x < 2) return;
int i, j(ceil(sqrt(x)));
for (i = 2; i <= j; ++i)
if (x % i == 0) {
p[pt++... | C++ | d2313888d962b1dd6dc21b5f1eb96f91 | 841c6d15af222991711afbbe806edaea | 2,300 | PASSED |
#include<bits/stdc++.h>
#define X first
#define Y second
#define eb push_back
#define pb pop_back
#define mp make_pair
#define siz(a) int(a.size())
//for traversing the container (bcoz we cannot access linked list etc with direct index)
//c stands for container and it for iterator
#define tr(c, it) \
for(typeof(c.b... | C++ | d2313888d962b1dd6dc21b5f1eb96f91 | e9650f14eb5c5f7f767bc8d01c2b0102 | 2,300 | PASSED |
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include<map>
#include<queue>
#include<vector>
#include<set>
#include<cmath>
using namespace std;
typedef long long LL;
const int MOD=1e9+7;
const int N=100000;
const LL MAX=1e15;
int a[1000005], prime[100005];
set<int> ss;
bool vis[100005];... | C++ | d2313888d962b1dd6dc21b5f1eb96f91 | e95176fb758edb581983bad7a140b058 | 2,300 | PASSED |
/**
Oh, my dear
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 100;
const ll oo = 1e18;
ll a, b;
int n;
int v[N];
inline int gcd (int a, int b) {
return (b && a) ? gcd (b, a % b) : (a + b);
}
set <pair <int, ll> > pref_a, pref_a2, suff_a[N];
ll ans = oo;
int main ... | C++ | d2313888d962b1dd6dc21b5f1eb96f91 | c0fa143cc89d6f5ab351c81fefbb9265 | 2,300 | PASSED |
#include <algorithm>
#include <stdio.h>
#include <vector>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<LL,LL> pi;
LL h,q,L,R;
vector<pi>exits;
vector<pi>old[2];
vector<pi>zeroes;
void DataNotSufficient()
{
puts("Data not... | C++ | dfd53e7baa1dc23352dcf3acaaa900a9 | 28f91cbc50b9cafb00585028aca12980 | 2,300 | PASSED |
#include <algorithm>
#include <stdio.h>
#include <vector>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<LL,LL> pi;
LL h,q,L,R;
vector<pi>exits;
vector<pi>old[2];
vector<pi>zeroes;
void DataNotSufficient()
{
puts("Data not... | C++ | dfd53e7baa1dc23352dcf3acaaa900a9 | 878208df765c443ff3aa5477ac39c5d0 | 2,300 | PASSED |
/*
Problem:cf312D;
Language:c++;
by dydxh;
2015.7.15;
*/
#include<iostream>
#include<string>
#include<cstring>
#include<queue>
#include<set>
#include<map>
#include<cstdio>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<utility>
using namespace std;
const int maxn=100005;
const int oo=200... | C++ | dfd53e7baa1dc23352dcf3acaaa900a9 | 0165ed36849fba6dc03ff51ebf87efb2 | 2,300 | PASSED |
#include <stdio.h>
#include <vector>
#include <algorithm>
#define pb push_back
#define lli long long int
using namespace std;
vector <pair <lli, lli> > no;
lli left;
lli right;
void intersect(lli a, lli b) {
left = max(left, a);
right = min(right, b);
return;
}
int main(void) {
int h, q;
lli i, l, r, ans;
lli ... | C++ | dfd53e7baa1dc23352dcf3acaaa900a9 | 581bb72e0fdca77db25c84b763565a73 | 2,300 | PASSED |
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
vector<pii> yes;
vector<pii> nos;
int main() {
int h;
int q;
cin>>h>>q;
while(q--) {
long long level, l, r, ans;
cin>>level>>l>>r>>ans;
for(int i=level... | C++ | dfd53e7baa1dc23352dcf3acaaa900a9 | 5d03ca9647c0a5baa7720903a24e3dba | 2,300 | PASSED |
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<set>
#include<iomanip>
#include<complex>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
#include<bitset>
#include<memory.h>
#include<cassert>
#include<ctime>
using namespace std;
#pragma comment(linker, ... | C++ | dfd53e7baa1dc23352dcf3acaaa900a9 | 70bf24a31fadb0706c1932badabcf3dc | 2,300 | PASSED |
#include <bits/stdc++.h>
#include <map>
using namespace std ;
//#ifndef ONLINE_JUDGE++++
//freopen("input.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
//#endif
#define pb push_back
#define all(x) x.begin(),x.end()
#define distSqr(x1,y1,x2,y2) (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)
#define dist(x1,y1,x2,y2... | C++ | dfd53e7baa1dc23352dcf3acaaa900a9 | 91a20a971d94de74f374d720b9006030 | 2,300 | PASSED |
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
vector<pair<ll,int> > G;
vector<pair<ll,ll> > N;
int main()
{
int h,q,lv,ok;
ll l,r,al,ar;
w... | C++ | dfd53e7baa1dc23352dcf3acaaa900a9 | 0661ac5019e89151db96b54781112a8b | 2,300 | PASSED |
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
vector<pair<ll,int> > G;
vector<pair<ll,ll> > N;
int main()
{
int h,q,lv,ok;
ll l,r,al,ar;
w... | C++ | dfd53e7baa1dc23352dcf3acaaa900a9 | 6f174bbd040e4d13f88326194ccfb109 | 2,300 | PASSED |
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
vector<pair<ll,int> > G;
vector<pair<ll,ll> > N;
int main()
{
int h,q,lv,ok;
ll l,r,al,ar;
w... | C++ | dfd53e7baa1dc23352dcf3acaaa900a9 | d428d7145c90e6c89283e0a20f91de13 | 2,300 | PASSED |
#include<stdio.h>
#include<stdlib.h>
#define size 2*100000
main()
{
long long int n,i,k=0;
long long int a[size+1];
long long int ans[size+2];
long long int cnt[size+1]={0};
long long int sum=0;
scanf("%I64d",&n);
for(i=0;i<n-1;++i)
{
scanf("%I64d",&a[i]);
sum+=a[i];
}
if(sum==0)
{
printf("-1");
}
else
{... | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 247f7086c1862b81923713aa42151741 | 1,500 | PASSED |
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#define P_SIZE 200000 + 4
#define ABS(x) (((x)^((x) >> 31)) + (1&((x) >> 31)))
#define PREFIX_ID(id) (id+1)
uint32_t n;
int32_t ready[P_SIZE];
int32_t p[P_SIZE+1];
uint8_t exists[P_SIZE];
#define LEFT_BIT_ONE (1 << 31)
struct sub_sum {
uint32_t left;
... | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 3b42ec776d137bcb1975d6cbc81c4a5a | 1,500 | PASSED |
#include<stdio.h>
#include<math.h>
long long arr[200010]={};
int main(){
long long n;int inarr[200010];
scanf("%lld",&n);
for(int i=1;i<n ; i++){
scanf("%d",&inarr[i]);
arr[i]=arr[i-1]+inarr[i];
}
long long sum=0;
for(int i=1;i<n; i++){
sum+=arr[i];
arr[i]=0;
}
inarr[0... | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | ae0f7be4ed34f06d6bb8d904b1c05fe0 | 1,500 | PASSED |
#include <stdio.h>
#include <stdlib.h>
int cmpfunc (const void * a, const void * b) {
return ( *(int*)a - *(int*)b );
}
int main()
{
int i, b, c, d, e, f,check=0,check1 =0,min =1;
scanf("%d", &i);
int br[i], cr[i+1], dr[i+1];
cr[0] = 1;
for(b=0; b<i-1; b++)
{
scanf("%d", &br[b]);
cr[b+1] = cr[b] + br[b];
... | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 6f998298cadc7d9c46dd67ddd2ced1c9 | 1,500 | PASSED |
#include <stdio.h>
#include <stdlib.h>
#define SWAP(a , b) *a = *a ^ *b; *b = *a ^ *b; *a = *a ^ *b;
#define INP_INT_ARA(ara_ads , size) for(int i = 0; i < size ; i++) scanf("%d",(ara_ads + i));
double qSum = 0 , tempP , tempN ;
int n , p[200000] = {0} , q[199999] = {0} , flag[200001] = {0};
int main(void) {
sc... | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 11f85dcf9b7b9dd06a47c9fb255a42aa | 1,500 | PASSED |
#include<stdio.h>
#include<math.h>
int y[200001]={0};
int main()
{
int n,i,j,k=0,min=0;
scanf("%d",&n);
int a[n],b[n],c[n];
for(i=1;i<n;i++)
{
scanf("%d",&a[i]);
k=k+a[i];
if(k>n || k<-n)
{
printf("-1");
return 0;
}
if(k<min)
... | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 46a5b3f2c009e760e7acccb59dfad2b1 | 1,500 | PASSED |
#include<stdio.h>
void merge(int arr[], int l, int m, int r)
{
int n1 = m - l + 1;
int n2 = r - m;
// Create temp arrays
int L[n1], R[n2];
// Copy data to temp arrays L[] and R[]
for(int i = 0; i < n1; i++)
L[i] = arr[l + i];
for(int j = 0; j < n2; j++)
R[j] = arr[m + 1... | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 6bbc91cff589c33041eafafec45f1480 | 1,500 | PASSED |
#include <stdio.h>
#include <string.h>
int main() {
int a[200010], test[200010];
int N, i, temp, MAX = 0, p1;
scanf("%d", &N);
a[0] = 0;
for(i = 1; i < N; i++) {
scanf("%d", &temp);
a[i] = a[i - 1] + temp;
if(a[i] > N || a[i] < 1 - N) {
printf("-1\n");
return 0;
}
if(a[i] > MAX) MAX = a[i];
}
m... | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 6237585f78791139468d2bd2ba907e9c | 1,500 | PASSED |
#include<stdio.h>
void merge(int a[],int l,int m,int r)
{
int i=0,j=m+1,k=l;
int size1=m-l+1;
int size2=r-m;
int leftArr[size1],rightArr[size2];
for(int i=0;i<size1;i++){
leftArr[i]=a[l+i];
}
for(int i=0;i<size2;i++){
rightArr[i]=a[m+1+i];
}
i=0;
j=0;
while(i<size1&&j<size2)
... | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | 8240756ba16220791fbb9279672a8be4 | 1,500 | PASSED |
/// Property of vipulks \\
#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
int main(){
ll t,n,m,i,j,k,cnt;
t=1;
//scanf("%lld",&t);
while(t--){
bool ok=true;
scanf("%lld",&n);
ll q[n+2],p[n+2],pref[n+3];
for(i=1;i<... | C | b6ac7c30b7efdc7206dbbad5cfb86db7 | ef0e65673016cfaab9c8b29d6c9011ee | 1,500 | PASSED |
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
class Edge
{
public:
int to, cost;
Edge (int t, int c)
{
to = t;
cost = c;
}
};
bool operator < (const Edge &e1, const Edge &e2) //for priority_queue
{
return e1.cost > e2.cost;
};
typedef std::vector< std::vector <Edge> > G... | C++ | c3c3ac7a8c9d2ce142e223309ab005e6 | dc9b58e8ab1db7a6b30253dbf55b3578 | 1,900 | PASSED |
#include <iostream>
#include <set>
int MAX_DIST = 200000000;// max 10^5 nodes, each edge is <= 1000
struct node_s
{
int id;
int dist;// distance to capital
bool visited;// for dijkstra
};
// struct shared between i and j nodes' adjacent lists
// if there's (i,j) edge
struct edge_s
{
int length;// road leng... | C++ | c3c3ac7a8c9d2ce142e223309ab005e6 | 8cff09cd6780225ecd7741b9c15e3e95 | 1,900 | PASSED |
#include <iostream>
#include <set>
int MAX_DIST = 200000000;// max 10^5 nodes, each edge is <= 1000
struct node_s
{
int id;
int dist;// distance to city
bool visited;
};
struct edge_s
{
int length;// road length
bool visited;
};
struct edge_lst
{
int node;// node id
edge_s* edge;
edge_lst* nxt... | C++ | c3c3ac7a8c9d2ce142e223309ab005e6 | 8a286125e464be30e60b0031be232af9 | 1,900 | PASSED |
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<string>
#include<cmath>
using namespace std;
typedef long long int ll;
#define X first
#define Y second
#define mp make_pair
struct item
{
int v1, v2, w;
item () : v1(0), v2(0), w(0) {}
item (int v1, int v2, int w) : v1... | C++ | c3c3ac7a8c9d2ce142e223309ab005e6 | 9aed76e22fa1e3ff416297ddac982655 | 1,900 | PASSED |
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <set>
#include <algorithm>
using namespace std;
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
int n,m,i,a,b,c,S,l;
vector<vector<pair<int,int> > > g;
int main()
{
//freopen... | C++ | c3c3ac7a8c9d2ce142e223309ab005e6 | f6d03675e7c7354815088b369c228ffe | 1,900 | PASSED |
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <set>
#include <algorithm>
using namespace std;
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
int n,m,i,a,b,c,S,l;
vector<vector<pair<int,int> > > g;
int main()
{
//freopen... | C++ | c3c3ac7a8c9d2ce142e223309ab005e6 | 9ecc261223e7b02c464a10bd1d9bb9ad | 1,900 | PASSED |
#pragma warning( disable : 4996)
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:666000000")
#define bublic public
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits.h>
#... | C++ | c3c3ac7a8c9d2ce142e223309ab005e6 | 8b689182ca023f9c35104eeeac5ea0cc | 1,900 | PASSED |
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_N = 100000+10;
const int INF = 1e9+10;
struct E {
E(int to_=0, int len_=0):to(to_),len(len_) {;}
int to,len;
bool operator>(const E& e) const {
return len>e.len;
}
};
struct EE {
EE(int from_=0, int... | C++ | c3c3ac7a8c9d2ce142e223309ab005e6 | e09f8bf5f9109038d12b344c31e45fa1 | 1,900 | PASSED |
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_N = 100000+10;
const int INF = 1e9+10;
struct E {
E(int to_=0, int len_=0):to(to_),len(len_) {;}
int to,len;
bool operator>(const E& e) const {
return len>e.len;
}
};
struct EE {
EE(int from_=0, int... | C++ | c3c3ac7a8c9d2ce142e223309ab005e6 | 0a8706bdadd33423cdb8f9241aa7c15a | 1,900 | PASSED |
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_N = 100000+10;
const int INF = 1e9+10;
struct E {
E(int to_=0, int len_=0):to(to_),len(len_) {;}
int to,len;
bool operator>(const E& e) const {
return len>e.len;
}
};
struct EE {
EE(int from_=0, int... | C++ | c3c3ac7a8c9d2ce142e223309ab005e6 | bd9b4fae78faa681ae6ab3cad0e0956a | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef vector<int> vec;
typedef vector<int64> vec64;
#define ss cout << " ";
#define nn cout << "\n";
#define ct(x) cout << x;
#define cts(x) cout << x << " ";
#define ctn(x) cout << x << "\n";
#define db(x) cout << "> " << #x << ": " << x << "\n";... | C++ | 6983823efdc512f8759203460cd6bb4c | 41b888aebea4a10e835d50a2a64473e4 | 1,200 | PASSED |
#include<bits/stdc++.h>
#define test int t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define sz 200000
typedef long long ll;
using namespace std;
int main()
{
test
{
int n;
cin>>n;
int a[n];
... | C++ | 6983823efdc512f8759203460cd6bb4c | 1c5032b480d4fce9d2f9e09ec7db5471 | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t, i, n, x, j, k;
cin >> t;
string s(200,'a');
while (t--)
{
cin >> n;
cout << s << endl;
while(n--){
cin >> x;
s[x] = s[x] == 'a'?'b':'a';
cout << s << endl;
}
... | C++ | 6983823efdc512f8759203460cd6bb4c | 7e0e718b1c6f1b70848a2d5eebbdc1f1 | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005
int t , n;
int a[MAXX];
int main()
{
_FastIO;
cin >> t;
while(t--){
cin >> n;
string s(200 , 'a');
... | C++ | 6983823efdc512f8759203460cd6bb4c | 5612de2a8f34c6fcc852fc3ec59582ba | 1,200 | PASSED |
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX 10000005
#define mod 1000000007
#define sp fixed<<setprecision(12)
using namespace std;
/*
vector<int> primes;
ll sumprime[MAX];
bool is_prime[MAX];
void sieve(){
is_prime[0]=is_prime[1]=true;
for(int i=4;i<MAX;i+=2){
is... | C++ | 6983823efdc512f8759203460cd6bb4c | 3fe143b7a90d8a02553a5a44de99b84d | 1,200 | PASSED |
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX 10000005
#define mod 1000000007
#define sp fixed<<setprecision(12)
using namespace std;
/*
vector<int> primes;
ll sumprime[MAX];
bool is_prime[MAX];
void sieve(){
is_prime[0]=is_prime[1]=true;
for(int i=4;i<MAX;i+=2){
is... | C++ | 6983823efdc512f8759203460cd6bb4c | 53f02c49d6d47c62c5567567fe311979 | 1,200 | PASSED |
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define pr... | C++ | 6983823efdc512f8759203460cd6bb4c | 136f390255a0d5d8d9430a373ccd7599 | 1,200 | PASSED |
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono>
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long
#define pr... | C++ | 6983823efdc512f8759203460cd6bb4c | 254ae2f354741602aa7b5b9395ca48fb | 1,200 | PASSED |
/*
" اللهم صلي و سلم علي سيدنا محمد و علي اله وصحبه اجمعين "
*/
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define f for
#define ll long long
#define ull unsigned long long
#define endl "\n"
#define intial(s1, s2, x, dp) f(int i = 0; i < s1; i++) f(int j = 0; j < s2; j++) dp[i][j] = x;
us... | C++ | 6983823efdc512f8759203460cd6bb4c | 3452fb63f8d62bf9102586eeebbdde13 | 1,200 | PASSED |
#include <iostream>
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define decimal(x) cout<<fixed<<setprecision(x);
#define hackerboi(x) cout<<"Case #"<<x<<": ";
#include <bits/stdc++.h>
using namespace std;... | C++ | 6983823efdc512f8759203460cd6bb4c | 04617b3b35345d95905369fe783c5461 | 1,200 | PASSED |
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vint;
const int INF = 1e9;
const ll LINF = 1e18;
template <typename T>
voi... | C++ | 900a509495f4f63f4fa5b66b7edd84f7 | 048141f371b33635f3d470a60cbf72d9 | 1,900 | PASSED |
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <tuple>
#include <algorithm>
#include <ctime>
#include <cmath>
#define int long long
#define ld long double
#define sp system("pause")
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define cdouble cout.setf(ios::fix... | C++ | 900a509495f4f63f4fa5b66b7edd84f7 | 486a07e41704b9aab00d8ef91820a123 | 1,900 | PASSED |
#include <iostream>
#include <algorithm>
#include <queue>
#include <math.h>
#include <vector>
#include <string>
#include <set>
#include <unordered_map>
#include <map>
#include <string.h>
#include <iomanip>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
typedef long long... | C++ | 900a509495f4f63f4fa5b66b7edd84f7 | c72d8783aa169f0ee25844140ee6b792 | 1,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 999999999999999999
#define endl "\n"
#define MOD 998244353
ll po(ll x, ll n){
ll ans=1;while(n>0){if(n&1)ans=(ans*x);x=(x*x);n/=2;}
... | C++ | 900a509495f4f63f4fa5b66b7edd84f7 | 6296d174ece3a11fe6549f1702e8c3a8 | 1,900 | PASSED |
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll INF = (ll)1<<62;
const ll MOD = 1e9+7;
const int iINF = 1<<30;
const double PI = 3.14159265359;
int main(){
ios_base::sync_with_stdio(false);
cin.ti... | C++ | 900a509495f4f63f4fa5b66b7edd84f7 | bbcb5c105356ec0ce059b29b9365c558 | 1,900 | PASSED |
//TrungNotChung
#include <iostream>
#include <bits/stdc++.h>
#define foru(i,a,b) for(int i=a ; i<=b ; i++)
#define ford(i,a,b) for(int i=b ; i>=a ; i--)
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define int long long
#define oo (int)1e18
using namespace std;
... | C++ | 900a509495f4f63f4fa5b66b7edd84f7 | beb3f4fe03600945b647696710d1bb5b | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define FASTIO() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const double PI = 3.14159265358979323846, EPS = 0.0000000001;
struct Point {
double x, y;
Point() {}
... | C++ | 900a509495f4f63f4fa5b66b7edd84f7 | 3d375490652f5ed80c5ba4d4dc0e8108 | 1,900 | PASSED |
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) cerr<<i<<" ";puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#... | C++ | 900a509495f4f63f4fa5b66b7edd84f7 | 09857f4dc8c51d83887ea7a0159e5fdc | 1,900 | PASSED |
#include <stdio.h>
#include <iostream>
#include <vector>
#include <set>
#include <math.h>
#include <algorithm>
using namespace std;
long double l2(long double x, long double y)
{
return sqrt(x*x + y*y);
}
long double l1(long double x, long double y)
{
return abs(x) + abs(y);
}
int main()
{
long long a,b,c,x,y,xx... | C++ | 900a509495f4f63f4fa5b66b7edd84f7 | 4605ed07536de1baa1167f615d02b7e4 | 1,900 | PASSED |
/**
"You think you're the only ones who matter. You think you can put off death. But that peace made you foolish and thoughtless. If you kill someone, someone else will kill you… this hatred binds us together."
"Those who do not understand true pain can never understand true peace."
I’m the only one who can bear the ... | C++ | 900a509495f4f63f4fa5b66b7edd84f7 | 5cc2bd838fcaf758ac19ba19f7cfecab | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
const int N = 1e5 + 7;
int n, m;
int mn[N];
int ren[N];
int perm[15][N];
int main(){
scanf("%d %d", &n, &m);
for(int i = 1; i <= m; ++i)
for(int j = 1; j <= n; ++j)
scanf("%d", &perm[i][j]);
for(int i = 1; i <= n; ++i)
ren[perm[1][... | C++ | 7733551cffde2a78826e9cd53f3a7c9d | 1bf62d84714590aa1844259a6c516e5f | 1,700 | PASSED |
#include <iostream>
#include <stdio.h>
#include <string>
#include <memory.h>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <time.h>
#include <assert.h>
#include <cmath>
#include <stack>
#include <string.h>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long ll;
con... | C++ | 7733551cffde2a78826e9cd53f3a7c9d | 535d1778f3cfb77874cc48064866a9be | 1,700 | PASSED |
#include <iostream>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
const int N = 1e5 + 2;
... | C++ | 7733551cffde2a78826e9cd53f3a7c9d | ef99f579af859b3776660b5f3e081c1e | 1,700 | PASSED |
#include <iostream>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
const int N = 1e5 + 2;
... | C++ | 7733551cffde2a78826e9cd53f3a7c9d | ac119300b3504e2f45e6eed7d872d105 | 1,700 | PASSED |
#include <bits/stdc++.h>
using namespace std;
long long int arr[11][100001];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int n,m,pele;
cin >> n >> m;
memset(arr,-1,sizeof(arr));
for(long int x=0;x<m;x++){
long int last;
cin >> last;
if(x==0){
... | C++ | 7733551cffde2a78826e9cd53f3a7c9d | 253fa55ab3464806d54d119dec20e65b | 1,700 | PASSED |
/**
* Coded by : lucky_21
* --------Lokesh Singh
**/
#include<bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_upd... | C++ | 7733551cffde2a78826e9cd53f3a7c9d | 7397dd230fd21b09e5caa65426c2604c | 1,700 | PASSED |
/**
* Coded by : lucky_21
* --------Lokesh Singh
**/
#include<bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_upd... | C++ | 7733551cffde2a78826e9cd53f3a7c9d | 35d1f294812873ce5a9f3c936842933a | 1,700 | PASSED |
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
set<pair<int,int> >vis;
map<pair<int,int> , int >mp;
ll n, m, ans, a[10][100005], p[100005], c[100005];
int get_len(int node){
deque<int>dq;
dq.push_back(node);
while(c[node])
vis.in... | C++ | 7733551cffde2a78826e9cd53f3a7c9d | acffeafcc79072ddc35cc7119ab3dbd9 | 1,700 | PASSED |
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
set<pair<int,int> >vis;
map<pair<int,int> , int >mp;
ll n, m, ans, a[10][100005], p[100005], c[100005];
int get_len(int node){
vector<int>dq;
dq.push_back(node);
while(c[node])
vis.i... | C++ | 7733551cffde2a78826e9cd53f3a7c9d | 24c768941bd9ac5bcdb5c9a324a809f7 | 1,700 | PASSED |
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
set<pair<int,int> >vis;
map<pair<int,int> , int >mp;
ll n, m, ans, a[10][100005], p[100005], c[100005];
int get_len(int node){
deque<int>dq;
dq.push_back(node);
while(c[node])
vis.in... | C++ | 7733551cffde2a78826e9cd53f3a7c9d | e49165a7995509724aaaffd91bf62ff9 | 1,700 | PASSED |
#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
#include <set>
#include <chrono>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace _... | C++ | e467189b4a1468f246b39f4a9e3aff53 | 514218bd8585af916264a6890acc78e4 | 2,500 | PASSED |
#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
#include <set>
#include <chrono>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace _... | C++ | e467189b4a1468f246b39f4a9e3aff53 | 077dc248c9ac3b0e5aebaa4056e27958 | 2,500 | PASSED |
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
int l[100005],r[100005],a[400005],w[400005];
int b[400005],cnt;
map <int,int> mp;
vector <int> R[400005],L[400005];
int dp[400005][260];
int now[10],nowcnt,CNT[1000];
int main(int argc, char** argv) {
int n,m,k;
cin >> n >>... | C++ | e467189b4a1468f246b39f4a9e3aff53 | a2018d4a53a814276da33050feb11958 | 2,500 | PASSED |
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
struct Event{
bool operator==(const Event& rhs) const{
return start == rhs.start && id == rhs.id;
}
bool operator<(const Event& rhs) const {
int lhs_coord = (start? l:r);
int rhs_coord = (rhs.start?rhs.l: rhs.r);
re... | C++ | e467189b4a1468f246b39f4a9e3aff53 | c4c00a084aa3145dd2825f01b00089c9 | 2,500 | PASSED |
// #pragma GCC optimize("O3", "unroll-loops", "fast-math")
// #pragma GCC target("avx", "avx2", "sse", "sse2")
// #pragma GCC target("popcnt")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define F first
#define S second
#define all(v... | C++ | e467189b4a1468f246b39f4a9e3aff53 | b37d3bedc0c7f0c5210a451dd59a65d9 | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
int n, m, k, f[MAXN], memo[2 * MAXN][(1 << 8)];
vector<pair<int, int>> e;
int dp(int idx, int mask)
{
if(idx == e.size())
return 0;
if(memo[idx][mask] != -1)
return memo[idx][mask];
auto&[pos, id] = e[idx];
int prevPos = 0;
if(idx != 0)
... | C++ | e467189b4a1468f246b39f4a9e3aff53 | f9f04a5ee41874a6a0d95c12c6086393 | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
int n, m, k, f[MAXN], memo[2 * MAXN][(1 << 8)];
vector<pair<int, int>> e;
int dp(int idx, int mask)
{
if(idx == e.size())
return 0;
if(memo[idx][mask] != -1)
return memo[idx][mask];
auto&[pos, id] = e[idx];
int prevPos = (idx ? e[idx - 1].... | C++ | e467189b4a1468f246b39f4a9e3aff53 | 52da23428be050364ec83affab5f89a3 | 2,500 | PASSED |
#include <bits/stdc++.h>
#define ii pair<int, int>
#define l first
#define r second
using namespace std;
const int N = 1e5 + 5, MASK = 8, MAX_STATE = 256, UNVISITED = -1;
int n, m, k, dp[N][MAX_STATE], mp[MASK];
vector<int> adj[N];
ii s[N];
void preprocess() {
set<ii> tmp;
sort(s, s + n);
for(int i = 0; i... | C++ | e467189b4a1468f246b39f4a9e3aff53 | d3e91ae61d6044b628a810468f33c458 | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
template<typename T>
vector<T> compress(vector<T> A){
sort(A.begin(), A.end());
A.erase(unique(A.begin(), A.end()), A.end());
return A;
}
int pop_count(int bits){
bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
bits = (bits & 0x33333333) + (bits... | C++ | e467189b4a1468f246b39f4a9e3aff53 | 449c52b7ab60d88118b2589fe0968571 | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
struct UnionFind {
vector<int> par;
vector<int> sz;
UnionFind(int n=0){ if(n>0) initialize(n); }
void initialize(int n){
par.resize(n);
sz.assign(n, 1);
for(int i=0; i<n; i++){
par[i] = i;
}
}
int find(i... | C++ | e467189b4a1468f246b39f4a9e3aff53 | c0f00218acb957d3bc6cc3d3fcba381f | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int fun(int a[],int n,int t,int mid){
int sum=0;
for(int i=0;i<(mid);i++)
sum+=a[i];
if(sum>t){
int j=0;
for(int i=mid;i<n;i++){
sum=sum-a[j]+a[i];
if(sum<=t)
return 1;
else{
... | C++ | ef32a8f37968629673547db574261a9d | 5f0566c1396d74479ccc724679100795 | 1,400 | PASSED |
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define SZ(c) int(c.size())
#define pb push_back
#define loop(i,start,n) for(int i=start;i<n;i++)
#define rloop(i,start,n) for(int i=start;i>n;i--)
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vs ... | C++ | ef32a8f37968629673547db574261a9d | 1bac407d22d3b511c7f65badc1f615ab | 1,400 | PASSED |
// A C++ program to find longest subarray with
// sum of elements at-least k.
#include <bits/stdc++.h>
using namespace std;
// function to find the length of largest subarray
// having sum atmost k.
int atMostSum(int arr[], int n, int k)
{
int sum = 0;
int cnt = 0, maxcnt = 0;
for (int i = 0; i < n; i++)... | C++ | ef32a8f37968629673547db574261a9d | 6521062cca9cd7822c884dcf71b43e28 | 1,400 | PASSED |
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> v(n);
for (int& x : v)cin >> x;
int ans = 0, r = 0, sum = 0;
for (int l = 0; l < n; ++l) {
while (r < n && sum + v[r] <= k) {
sum += v[r];
r++;
}... | C++ | ef32a8f37968629673547db574261a9d | a144510d5c149d6f94f3a4b9b0c7d231 | 1,400 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.