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
import java.util.Scanner; public class FlagDay { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int m = input.nextInt(); int[] dancer = new int[3]; int[] res = new int[n]; for (int i = 0; i < n; ++i) { res[i] = -1; } boolean[] visited = ...
Java
ee523bb4da5cb794e05fb62b7da8bb89
7b34e1052bfc5c666fe2e74ef87e6ff6
1,400
PASSED
import java.io.InputStreamReader; import java.io.IOException; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Hashtable; import java.util.LinkedList; import java.util.List; import j...
Java
ee523bb4da5cb794e05fb62b7da8bb89
57e2088444918fd02aed59d10b19b68f
1,400
PASSED
import java.io.*; public class B { public static void main(String[] args) throws IOException { Parser in = new Parser(System.in); PrintStream out = new PrintStream(System.out); int n = in.nextInt(); int[] d = new int[n+1]; int m = in.nextInt(); for (int i = 0; i < m; i++) { int a = in.nextInt(); int...
Java
ee523bb4da5cb794e05fb62b7da8bb89
c5dc069b242b0ee2866bbd2c3ad00c56
1,400
PASSED
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; p...
Java
ee523bb4da5cb794e05fb62b7da8bb89
9b576d94ff43df21007893c8ef4adf93
1,400
PASSED
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int m = s.nextInt(); int[] c = new int[n+1]; for(int i = 0; i < m; i++) { int d1 = s.nextInt(); int d2 = s.nextInt(); int d3 = s.nextInt(); if(c[d1] != 0) { ...
Java
ee523bb4da5cb794e05fb62b7da8bb89
21199a123290e57da57e377d1e7715c7
1,400
PASSED
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ //package programminginjava; import java.io.*; import java.util.*; /** * * @author vijit */ public class jeff2 { static String[] lines; static boolean debug; public static void assignColor(...
Java
ee523bb4da5cb794e05fb62b7da8bb89
285f28bbf455afce6c7d08d8b1efce39
1,400
PASSED
//package hash13; import java.io.IOException; import java.util.Arrays; import java.util.Scanner; public class cf207b { public static void main(String args[]) throws IOException { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int dance[]...
Java
ee523bb4da5cb794e05fb62b7da8bb89
d83f915f13938a46ed2f472c1e5dc9f3
1,400
PASSED
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Scanner; import java.lang.*; import java.nio.charset.Charset; public class B { public static void main(String[] args) { B a = new B(); a.run(); } void run(){ Scanner sc = new Scanner(System.in); ...
Java
ee523bb4da5cb794e05fb62b7da8bb89
ae3269524badb324853fc1a209b08e2e
1,400
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; impor...
Java
ee523bb4da5cb794e05fb62b7da8bb89
8b1f9905a2f5cdd1598e2d4894eaadbb
1,400
PASSED
import java.util.Scanner; public class Codeforces357B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] colors = new int[n+1]; for(int i = 0; i < m; i++){ int a = sc.nextInt(); int c = sc.nextInt(); int b = sc.nextInt()...
Java
ee523bb4da5cb794e05fb62b7da8bb89
6b3d50706f050e4cfa7caa6eae308a6d
1,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int lli; #define ff first #define ss second #define pi pair<lli,lli> #define pb push_back #define vi vector<lli> #define vc vector<char> #define vp vector<pair<lli,lli>> #define si set<lli> #define llmi LLONG_MIN #define llma LLONG_MAX #define mod 100000000...
C++
a60321dd9ada279c007415f28775099b
08c6b7a365dfb2bd0619914781849988
900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int a,b,c,d; int t; cin>>t; while(t--) { cin>>a>>b>>c>>d; cout<<max(a+b,c+d)<<'\n'; } return 0; }
C++
a60321dd9ada279c007415f28775099b
fc8a65556f77b18709a67973b4d2bc67
900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long int t; cin>>t; while(t--) { long int a,b,c,d; cin>>a>>b>>c>>d; int te=a+b; int tt=c+d; cout<<max(te,tt)<<endl; } }
C++
a60321dd9ada279c007415f28775099b
40299673e960111041d8a50b79ac3a38
900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int a,b,c,d; cin>>a>>b>>c>>d; cout<<max(a+b,c+d)<<endl; } return 0; }
C++
a60321dd9ada279c007415f28775099b
6acfec42dae84abc9ee40cefb3ac1fc2
900
PASSED
#include <iostream> #include <algorithm> #include <sstream> using namespace std; int main() { int t; cin >> t; stringstream ss; for (int i = 0; i < t; i++) { int a, b, c, d; cin >> a >> b >> c >> d; ss << max(a + b, c + d) << "\n"; } cout << ss.str(); }
C++
a60321dd9ada279c007415f28775099b
670329e6ec8b17e2f6538bc8b4f77a33
900
PASSED
#include <iostream> #include <algorithm> #include <sstream> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int a, b, c, d; cin >> a >> b >> c >> d; cout << max(a + b, c + d) << "\n"; } }
C++
a60321dd9ada279c007415f28775099b
e8b688db98f644cf8301671a27d9c2c0
900
PASSED
#include<bits/stdc++.h> #define sc(x) scanf("%d",&x) using namespace std; #define scll(x) scanf("%lld",&x) #define fr(i,n) for(int i=0;i<n;i++) #define Fr(i,x,y) for(int i=x;i<=y;i++) #define pf printf #define pb push_back #define mp make_pair #define nl endl #define um unordered_map<int,int> #define...
C++
a60321dd9ada279c007415f28775099b
8e092526ea87035148c63f86b8750eb5
900
PASSED
//Bismillahir-Rahmanir-Rahim #include<bits/stdc++.h> typedef long long int ll; typedef unsigned long long int llu; #define f1(i,n) for(i=1;i<=n;i++) #define f(i,n) for(i=0;i<n;i++) #define Max 3000009 #define pb push_back #define mp make_pair using namespace std; int main() { ll t,n,l,i,j; cin>>t; while(...
C++
a60321dd9ada279c007415f28775099b
5e27e49982da0ab236fa0e0ad70e6dfc
900
PASSED
#include<bits/stdc++.h> #define ll long long #define vc vector #define ff first #define ss second #define _ << " " << #define pb push_back #define mp make_pair #define MX moveX[] = {-1, 0, 1, 0, -1, -1, 1, 1}; #define MY moveY[] = {0, 1, 0, -1, -1, 1, 1, -1}; #define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie...
C++
a60321dd9ada279c007415f28775099b
52afb9dd6fea2ffcda97ba9a04ed30ad
900
PASSED
#include<bits/stdc++.h> #define int long long int using namespace std; int32_t main() { int q; cin>>q; for(int m=0; m<q; m++) { int a, b, c, d; cin>>a>>b>>c>>d; cout<<max(a+b, c+d)<<endl; } return 0; }
C++
a60321dd9ada279c007415f28775099b
59c492c4d2ab288155a376fff9000073
900
PASSED
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <ctime> #include <cctype> #include <iostream> #include <sstream> #include <iomanip> #include <string> #include <vector> #include <stack> #include <queue> #include <deque> #include <list> #include <set> #include <map> #include <bitset> #in...
C++
6587be85c64a0d5fb66eec0c5957cb62
a0d675be072bb24a98db8e90884a28fd
1,500
PASSED
#include <cmath> #include <math.h> #include <ctype.h> #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <complex> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #i...
C++
6587be85c64a0d5fb66eec0c5957cb62
7f6e6aa7a44187ab1e7a515b9825d8ba
1,500
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <cstring> #include <cstdio> #include <cstdlib> using namespace std; string s, z; int t; void f() { if (cin >> s) { z += s; if (s == "pair") z += "<", f(), z += ",", f(), z += ">"; } else ...
C++
6587be85c64a0d5fb66eec0c5957cb62
0b79eabd7cae5b99580795c74910c740
1,500
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <cstring> #include <cstdio> #include <cstdlib> using namespace std; string sss, z; int t; void f() { if (cin >> sss) { z += sss; if (sss == "pair") z += "<", f(), z += ",", f(), z += ">"; } ...
C++
6587be85c64a0d5fb66eec0c5957cb62
e1997daf1c224b39248c1aaafe577aa2
1,500
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <cstring> #include <cstdio> #include <cstdlib> using namespace std; int p; string s; vector <string> a; int r, d, q; void display(int n) { if (p >= n) return; int f = 0; if (a[p] == "pair") { s += "pair<"; ...
C++
6587be85c64a0d5fb66eec0c5957cb62
a724b2fb0654db4b6c2a7a174875c7ee
1,500
PASSED
#include<stdio.h> #include<iostream> using namespace std; string s,z; int t; void f() { if(cin>>s) { z+=s; if(s=="pair") z+="<",f(),z+=",",f(),z+=">"; } else t=1; } int main() { cin>>s; f(); if(t||cin>>s) puts("Error occurred"); else puts(z.c_str()...
C++
6587be85c64a0d5fb66eec0c5957cb62
af12015217ecdae0b001e9af2479c31b
1,500
PASSED
#include<cstdio> #include<iostream> using namespace std; string x,d; int t; void dfs() { if(cin>>x) { d+=x; if(x=="pair") { d+="<",dfs(),d+=",",dfs(),d+=">"; } } else t=1; } int main() { int o; cin>>...
C++
6587be85c64a0d5fb66eec0c5957cb62
ff1fda21a8289c568f337e92af187905
1,500
PASSED
#include<iostream> using namespace std; int o; int t; string ans; void f() { string x; if(cin>>x) { ans+=x; if(x=="pair")ans+='<',f(),ans+=',',f(),ans+='>'; } else t=1; } int main() { cin>>o; f(); string x; if(t==1 || cin>>x) cout<<"Error occurred"; else cout<<...
C++
6587be85c64a0d5fb66eec0c5957cb62
acd56467e6f5dbbd659dcf3d78398f35
1,500
PASSED
#include<cstdio> #include<iostream> using namespace std; string x,d; int t; void dfs() { if(cin>>x) { d+=x; if(x=="pair") { d+="<",dfs(),d+=",",dfs(),d+=">"; } } else { t=1; } } int main() ...
C++
6587be85c64a0d5fb66eec0c5957cb62
7f58ed977792fc168369dfd05cbf94e9
1,500
PASSED
#include<cstdio> #include<iostream> using namespace std; string x,d; int t; void dfs() { if(cin>>x) { d+=x; if(x=="pair") { d+="<",dfs(),d+=",",dfs(),d+=">"; } } else t=1; } int main() { int o; ...
C++
6587be85c64a0d5fb66eec0c5957cb62
dd47f23e7198685431eff0d24fb6adf1
1,500
PASSED
#include<cstdio> #include<cstring> using namespace std; const int N = 100005 , M = 107; #define fo(i , st , en) for (int i = st; i <= en; i++) #define Me(x , y) memset(x , y , sizeof(x)) double f[N][M]; int n , q; int a[N] , cur[N]; void Read(int &x){ char c; while (c = getchar() , c < '0' || c > '9'); ...
C++
247c3acd93aa1dfd79f9506ea7c6cc82
bffe9789c7e8c4c7d53c3f45fef7e548
2,600
PASSED
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int M=(int)1e5+5; int n,m; int a[M],tot[M]; double dp[M][105],p; int main(){ scanf("%d",&n); double ans=0; for(int i=1;i<=n;i++)scanf("%d",&a[i]),dp[i][a[i]]=1,tot[i]=a[i],ans+=dp[i][0]; scanf("%d",&m); for(int i=1...
C++
247c3acd93aa1dfd79f9506ea7c6cc82
9475624f0effc3dd4e45c45fb120e82e
2,600
PASSED
#include <bits/stdc++.h> //Damned if I don't take what I want. using namespace std; typedef long long ll; typedef pair<int, int> pii; double calc(int a, int b, int x, int y){ // not tasted, tasted, from not tasted, from tasted if (x > a || y > b || x < 0 || y < 0) return 0; double ans = 1; for (int i = 0; i < x...
C++
247c3acd93aa1dfd79f9506ea7c6cc82
1b5247db299131aaa19cd6e6e4de9eca
2,600
PASSED
#include<cstdio> #include<iostream> #include<cstdlib> #include<cstring> #include<algorithm> #include<cmath> using namespace std; double a[100010][101]; long long c[1000010][6]; int s[100010]; double b[101]; void doit(int u,int v,int k) { memset(b,0,sizeof(b)); for (int i=0;i<=100;i++) for (int j=0;j<=...
C++
247c3acd93aa1dfd79f9506ea7c6cc82
d1d47d842b2fd7d12bb6d2fc16a765a1
2,600
PASSED
#include<iostream> #include<cstdio> using namespace std; #define N 100100 #define NN 5*N+10000 #define eps (1e-11) int num[N];//sheng xia d panzi shu long double lef[N][110];//sheng xia de ganjingpanzi gailv int n, q; long double mid[110]; long double c[NN][6]; void pre() { for(int i=0; i<NN; i++){ c[i][0] = 1....
C++
247c3acd93aa1dfd79f9506ea7c6cc82
2e3e28c9ade5875a353f5ae66aa7333e
2,600
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <iostream> using namespace std; const int MAXN = 101010; int n; int q; int a[MAXN]; int u, v, k; double f[MAXN][111], ans = 0; int g[MAXN]; double c[501010][6]; double cur[111]; void pre() { c[0][0] = 1; for(int i = 1; i <= 500000; ++i) { c[i][...
C++
247c3acd93aa1dfd79f9506ea7c6cc82
6fa7afb5824f5d47b32076233695dd76
2,600
PASSED
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> using namespace std; #define ll long long #define MAX 100100 inline int read() { int x=0;bool t=false;char ch=getchar(); while((ch<'0'||ch>'9')&&ch!='-')ch=getchar(); if(ch=='-')t=true,ch=getchar(); ...
C++
247c3acd93aa1dfd79f9506ea7c6cc82
bccaf27fe2a1d8d105c2ced0fcdbb6bd
2,600
PASSED
#include <stdio.h> int n, m, a[100000]; double ans, f[100000][101], c[1000000][6]; int main() { for(int i = 0; i < 1000000; i++) { c[i][0] = 1.0; for(int j = 1; j < 6 && j <= i; j++) c[i][j] = c[i][j - 1] * (i - j + 1) / j; } scanf("%d", &n); for(int i = 0; i < n; i++) { scanf("%d", &a[i]); f[i][a[i]] ...
C++
247c3acd93aa1dfd79f9506ea7c6cc82
afa656b5edced639412889c82c50c294
2,600
PASSED
#include<stdio.h> #include<string.h> #include<math.h> #include<iostream> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> using namespace std; typedef long long lld; int sum[100010]; double dp[100010][110]; double c(int x,int y) { if(x < y) return 0; if(y == 0) re...
C++
247c3acd93aa1dfd79f9506ea7c6cc82
2f98301e5753f8cd5fab84cb1d7ea1a7
2,600
PASSED
#include<stdio.h> int n,a[100001],b[100001],Q,u,v,k,i,tmp,j;double dp[100001][102],now; int main() { scanf("%d",&n); for(i=1;i<=n;i++){scanf("%d",&a[i]);b[i]=a[i];dp[i][a[i]]=1;now+=dp[i][0];} scanf("%d",&Q); while(Q--) { scanf("%d%d%d",&u,&v,&k); now-=dp[u][0]; for(i=1,tmp=a[u];i<=k;i++,--tmp) for(j=0;j...
C++
247c3acd93aa1dfd79f9506ea7c6cc82
f4a99fe936c3fd162d5ee69e95224f29
2,600
PASSED
#include <iostream> #include <cstring> #include <cstdio> using namespace std; bool map1[20][20][20]; int ans=0; int k1[10]={-1,1,0,0,0,0}; int n1[10]={0,0,1,0,-1,0}; int m1[10]={0,0,0,1,0,-1}; bool used[15][15][15]; int k,n,m; bool isin(int tmpk,int tmpn,int tmpm) { if(tmpk>=0&&tmpk<k&&tmpn>=0&&tmpn<n&&tmpm>=0&...
C++
3f6e5f6d9a35c6c9e71a7eeab4acf199
c53123feaebc2151961850ad623bd451
1,400
PASSED
#include <iostream> #include <string> #include <vector> #include <queue> using namespace std; typedef vector<string> Layer; typedef struct Vec3d { int x, y, z; } Vec3d; inline bool isValid(const Vec3d &pos, int n, int m, int k){ if(pos.x < 0){ return false; } if(pos.x >= n){ return false; } if(pos.y ...
C++
3f6e5f6d9a35c6c9e71a7eeab4acf199
796a5b96a55c3aa24f4f737664cdeafd
1,400
PASSED
#include <iostream> #include <string> #include <queue> #include <stack> #include <algorithm> #include <cstdio> #include <map> #include <set> #include <vector> #include <cctype> #include <sstream> using namespace std; #define oo (1<<31-1) #define INFI (1e31) #define ll long long #define ull unsigned long long int dx[]={...
C++
3f6e5f6d9a35c6c9e71a7eeab4acf199
10da6c0981f23fe44bc067481da81546
1,400
PASSED
#include <iostream> #include <cstdio> #include <vector> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <list> #include <string> #include <cstring> #include <cmath> #include <algorithm> using namespace std; typedef vector<int> vi; typedef pair<int,int> ii; typedef long long ...
C++
3f6e5f6d9a35c6c9e71a7eeab4acf199
2b4fc2aa165b88ad8b0be321338dfd06
1,400
PASSED
#include <iostream> #include <cstdio> #include <vector> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <list> #include <string> #include <cstring> #include <cmath> #include <algorithm> using namespace std; typedef vector<int> vi; typedef pair<int,int> ii; typedef long long ...
C++
3f6e5f6d9a35c6c9e71a7eeab4acf199
e1b375e3450694fa22cf63b988fe4402
1,400
PASSED
#include<cstdio> #include<queue> #include<vector> #include<iostream> using namespace std; vector<vector<string> > vs; int k,n,m,x,y; int dx[6]={0,0,1,0,0,-1}; int dy[6]={0,0,0,1,-1,0}; int dz[6]={-1,1,0,0,0,0}; struct trio { int z,x,y; trio(int zz, int xx,int yy) { x=xx; y=yy; ...
C++
3f6e5f6d9a35c6c9e71a7eeab4acf199
ca1b256f22bc72b5906ca67434d7b395
1,400
PASSED
#include <algorithm> #include <string> #include <vector> #include <queue> #include <iostream> #include <cmath> #include <sstream> #include <map> #include <set> #include <numeric> #include <memory.h> #include <stdio.h> using namespace std; #define FOR(i,a,b) for (int _n(b), i(a); i < _n; i++) #define rep(i,n) FOR(i,0,...
C++
3f6e5f6d9a35c6c9e71a7eeab4acf199
942f2bc54bf6e68b97c5d7ea97eba80c
1,400
PASSED
#include <iostream> #include <cstdio> using namespace std; char mapa[13][13][13]; int k, n, m, x, y, res; void explore(int x, int y, int z) { if(x < 0 or x >= k or y < 0 or y >= n or z < 0 or z >= m or mapa[x][y][z] == '#') return; res++; mapa[x][y][z] = '#'; explore(x - 1, y, z); explore...
C++
3f6e5f6d9a35c6c9e71a7eeab4acf199
962f54e8b77eebef6fa27c92e65d5f91
1,400
PASSED
#include<cstdio> #include<cstring> #include<iostream> using namespace std; char c[105][15]; int b[105][15]; int dx[4]= {-1,0,1,0},dy[4]= {0,-1,0,1}; int ans,k,n,m,x,y,key; void bfs(int key,int x,int y) { int nx,ny; int t; b[x][y]=1; ans++; for(int i=0; i<4; i++) { nx=x+dx[i]; n...
C++
3f6e5f6d9a35c6c9e71a7eeab4acf199
c5a5fd7f7d2fd53bd00dd567a4ae2cec
1,400
PASSED
#include <cstdio> #include <cstring> #include <queue> using namespace std; int di[6][3] = {{0,1,0},{1,0,0},{0,-1,0},{-1,0,0},{0,0,1},{0,0,-1}}; struct Node{ int x,y,z; Node(){} Node(int _x,int _y,int _z):x(_x),y(_y),z(_z){} }; queue<Node>Q; int a[11][11][11]; char map[11][11]; int k,m,n,sx,sy; int BFS(No...
C++
3f6e5f6d9a35c6c9e71a7eeab4acf199
dc1722c1b6551081e3ab9262462637d6
1,400
PASSED
// #include <bits/stdc++.h> #define mod 1000000007 #define inf 1000000000000000000 #define mk make_pair #define pb push_back #define pii pair<lli, lli> #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; typedef unsigned long long ull; typedef long long int lli; typedef long doubl...
C++
600b322b10cbde66ad8ffba5dc7d84e6
ec33a688d4a7720883344537adbdca92
2,100
PASSED
#include <iostream> #include <list> #include <unordered_set> #include <stack> #include <utility> using namespace std; typedef pair<int, int> pii; const int sz = 1e6+10; int segs[sz]; unordered_set<int> edges[sz]; bool visited[sz]; bool istree(int C) { list<pii> seen; seen.push_front(make_pair(1, segs[1])); int ...
C++
600b322b10cbde66ad8ffba5dc7d84e6
8687c59bfac975816c02774f518bc23b
2,100
PASSED
#include<bits/stdc++.h> #define pb push_back #define ls d<<1 #define rs d<<1|1 using namespace std; typedef long long LL; #define data node const int N=500005; int n,f[N],cnt; struct node{int l,r;}a[N]; vector<int> vec[N*8]; bool cmp(data a,data b) { return a.r<b.r; } int find(int x) { return f[x]==x?x:f[x]=fi...
C++
600b322b10cbde66ad8ffba5dc7d84e6
f64067d826f8b1e661ad3753e50e4ded
2,100
PASSED
#include <bits/stdc++.h> //#include <ext/pb_ds/tree_policy.hpp> //#include <ext/pb_ds/assoc_container.hpp> //using namespace __gnu_pbds; //template<typename key, typename val> //using ordered_tree = // tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>; using namespace std; typedef long long i...
C++
600b322b10cbde66ad8ffba5dc7d84e6
a801246c51b0372506ea5daa1da9e0db
2,100
PASSED
#include<bits/stdc++.h> using namespace std; #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/hash_policy.hpp> // __gnu_pbds::gp_hash_table<int,int> mp; #define int long long int #define pb push_back vector<vector<int>> adj(500005); vector<int> visit(500005); int ans=1; int cn=0,ce=0; void dfs(int node) { ...
C++
600b322b10cbde66ad8ffba5dc7d84e6
ac25d6e2bb7b1fab3d905da8a1b0437e
2,100
PASSED
#include<bits/stdc++.h> #define int long long #define tezz ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); using namespace std; int n; vector<vector<int>> adj; int countt=0; vector<bool> vis; void dfs(int k){ vis[k]=true; countt++; for(auto it=adj[k].begin(); it!=adj[k].end(); it...
C++
600b322b10cbde66ad8ffba5dc7d84e6
942a5a00e2d749d20dd516e9066576eb
2,100
PASSED
#include <bits/stdc++.h> #define ll long long #define ld long double #define ull unsigned ll #define ioi exit(0); #define f first #define s second #define inf (int)1e9 + 7 #define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0); #define mp(x,y) make_pair(x,y) #define lb(x) lower_bound(x) #define ...
C++
600b322b10cbde66ad8ffba5dc7d84e6
2e772a1718ec4f34cb3ceb1a9a78e6ab
2,100
PASSED
#include <bits/stdc++.h> #define ll long long #define ld long double #define ull unsigned ll #define ioi exit(0); #define f first #define s second #define inf (int)1e9 + 7 #define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0); #define mp(x,y) make_pair(x,y) #define lb(x) lower_bound(x) #define ...
C++
600b322b10cbde66ad8ffba5dc7d84e6
ee5a2a03564a3cbd92151061f484686c
2,100
PASSED
#include<bits/stdc++.h> #define fi first #define se second #define pb push_back using namespace std; typedef long long ll; typedef pair<int,int> pii; const int maxn = 500005; int n; vector<int> g[maxn]; pii niz[maxn]; set<pii> s; int rez; int visited[maxn]; bool dfs(int v, int p){ visited[v] = 1; for(auto u:g[v]){ ...
C++
600b322b10cbde66ad8ffba5dc7d84e6
902e589a7cf4e7e49833b1cdd4a06bf6
2,100
PASSED
#include <bits/stdc++.h> using namespace std; int test = 0; const int MAXN = 500009; typedef long long i64; typedef pair<i64, i64> pi64; typedef pair<int, int> pi; const i64 MOD = 119 << 23 | 1; class { public: int n, f[MAXN * 2]; pi a[MAXN * 2]; bool un(int x, int y) { // cout << x << "---" << y ...
C++
600b322b10cbde66ad8ffba5dc7d84e6
552324bb79bc4e9da37a6f6ddbc06711
2,100
PASSED
#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<vector> #include<set> #include<cstring> #include<cstdlib> #include<bits/stdc++.h> #define ll long long using namespace std; int main() { int n; scanf("%d", &n); for(int i = 0; i<n; i++) { ll num = 0; char...
C++
31be4d38a8b5ea8738a65bfee24a5a21
5d804b10eb007048e363858353453fda
2,000
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 scan(x) scanf("%d",&x) #define scanll(y) scanf("%lld",&y) #define print(x) printf("%d\n",x) #define printll(y) printf("%lld\n",y) typedef pair<int,int>pii; const int m...
C++
31be4d38a8b5ea8738a65bfee24a5a21
335b6ee4e72a538d54df4cfff1d68d7b
2,000
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; bool inside(string s, vector<ll> &l, vector<ll> &r) { stringstream ss(s); ll cur; ss>>cur; int sz=l.size(); for (int i=0; i<sz; i++) if(l[i]<=cur&&cur<=r[i]) return true; return false; } int main() { ios_base::sync_with_stdio(false); cin.tie...
C++
31be4d38a8b5ea8738a65bfee24a5a21
a7e9ad298fbbb13371b89e3d0f96637b
2,000
PASSED
/* PROG: cf664c LANG: C++ debug my code */ #include <iostream> #include <cstdio> #include <fstream> #include <algorithm> #include <cstring> #include <string> #include <cctype> #include <stack> #include <queue> #include <deque> #include <list> #include <vector> #include <map> #include <sstream> #include <cmath> #include...
C++
31be4d38a8b5ea8738a65bfee24a5a21
fefe47d6a8cf8f45e1bb30d8a364ad02
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define PI 3.141592653589793238462 typedef long long ll; typedef double db; ll num[25],a[25]; unordered_map<string,int> p; int main(){ int q; cin>>q; for(int i=1989;i<=15000;i++){ int x=i;string s=""; while(x){ char k=(char)('0'+x%10);...
C++
31be4d38a8b5ea8738a65bfee24a5a21
c35ceb74148ce31e4202696515181220
2,000
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <algorithm> #include <math.h> using namespace std; #define Max 111111 int main() { char ch[50]; int n; scanf("%d",&n); getchar (); for(int i=0;i<n;i++) { scanf("%s",ch); long long int len=strlen(ch); long long sum=0; ...
C++
31be4d38a8b5ea8738a65bfee24a5a21
58010c1153ce9bd7ace695913d4b2301
2,000
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <algorithm> #include <math.h> using namespace std; #define Max 111111 int main() { char ch[50]; int n; scanf("%d",&n); getchar (); for(int i=0;i<n;i++) { scanf("%s",ch); int len=strlen(ch); long long sum=0; int...
C++
31be4d38a8b5ea8738a65bfee24a5a21
ce78b2cbe5cd6b06b1046e5313cc9aee
2,000
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <algorithm> #include <math.h> using namespace std; #define Max 111111 int main() { char ch[50]; int n; scanf("%d",&n); getchar (); for(int i=0;i<n;i++) { scanf("%s",ch); int len=strlen(ch); long long sum=0; int...
C++
31be4d38a8b5ea8738a65bfee24a5a21
bb60e10eb81676e1e356e18d2d530165
2,000
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <algorithm> #include <math.h> using namespace std; #define Max 111111 int main() { char ch[50]; int n; scanf("%d",&n); getchar (); for(int i=0;i<n;i++) { scanf("%s",ch); long long int len=strlen(ch); long long sum=0; ...
C++
31be4d38a8b5ea8738a65bfee24a5a21
730a435c51a9918fb2cb67941059e90a
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define PB push_back #define ZERO (1e-10) #define INF (1<<29) #define CL(A,I) (memset(A,I,sizeof(A))) #define DEB printf("DEB!\n"); #define D(X) cout<<" "<<#X": "<<X<<endl; #define EQ(A,B) (A+ZERO>B&&A-ZERO<B) typedef long long ll; typedef pair<ll,ll> pll; typedef vector<i...
C++
31be4d38a8b5ea8738a65bfee24a5a21
f7c02a6a9f8ce337b381a69fa20cbd64
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(int i = a; i < b; ++i) main() { int debug = 1; int n = 0, ans = 1, mod = 1e9 + 7, x, inf = 1e9, mn, mx; mx = -inf, mn = inf; string type; cin >> n; set <int> buy, gre, sel; buy.insert(mx); sel.insert(mn); vector ...
C++
223db02b85d93692699134a3b51914bf
05e6170cc969c3287c8bd3fff042ae97
2,100
PASSED
#include <bits/stdc++.h> #define _ ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; int main(){ _ int n; cin >> n; int mod = 1e9+7; string s; int x; set<int> sell; set<int> unkn; set<int> buy; long long int ans = 1; while (n--){ cin >> s >> x; ans %= mod; if (s == "ADD"){ if (!buy.empty...
C++
223db02b85d93692699134a3b51914bf
40ca62997f86d1b7faa36cb4f345e04c
2,100
PASSED
#include<algorithm> #include<typeinfo> #include<stdlib.h> #include<string.h> #include<iostream> #include<iomanip> #include<stdio.h> #include<math.h> #include<string> #include<vector> #include<queue> #include<stack> #include<map> #include<set> using namespace std; typedef long long ll; #define pi acos(-1) #define mod (1...
C++
223db02b85d93692699134a3b51914bf
f08c8f255545f2c2d6d1adeb6553f406
2,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = 1e9+7; const int PRICE_LIMIT = 1e9; int main(){ set<int> orders; set<int>::iterator it; int bestBuy = 0; int bestSell = PRICE_LIMIT; orders.insert(PRICE_LIMIT); orders.insert(0); int ans = 1; int n; c...
C++
223db02b85d93692699134a3b51914bf
d6a4ef009528aaf12c08ab581bd4942c
2,100
PASSED
#include <iostream> #include <vector> #include <map> #include <set> #include <queue> #include <string> #include <iomanip> #include <algorithm> #include <cmath> #include <stdio.h> using namespace std; #define int long long int MOD = 1000000007; signed main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N...
C++
223db02b85d93692699134a3b51914bf
f37679cde2cb8f6d623529ff1bca95ef
2,100
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<vector> #include<queue> #include<set> #include<map> #include<stack> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pII; #define pb push_back #define mp make_pair #define clr(x,y)...
C++
223db02b85d93692699134a3b51914bf
eaefd9eebab5c1ec128561920bdc0d8e
2,100
PASSED
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; #define pii pair<int,int> #define pll pair<ll,ll> #define fo(i,a,b) for(int i=a;i<b;i++) #define fo_(i,a,b) for(int i=a;i>b;i--) #define M(a) memset(a,0,sizeof a) #define M_(a) memset(a ,-1,sizeof a) #define pb push_back #define PI 3.1415926...
C++
223db02b85d93692699134a3b51914bf
50f917940a6f41404236fc1a1b9dab4a
2,100
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define int ll #define faster ios_base::sync_with_stdio(false); #define openfiles ifstream cin("input.txt");ofstream cout("output.txt"); signed main() { //openfiles; faster; int n; cin>>n; set<int> s; int...
C++
223db02b85d93692699134a3b51914bf
091962b3264594047cfe32143f053660
2,100
PASSED
#include <bits/stdc++.h> #define ll long long #define sz(x) ((int) (x).size()) #define all(x) (x).begin(), (x).end() #define fi first #define se second #define vi vector<int> #define pii pair<int, int> #define rep(i, a, b) for(int i = (a); i < (b); i++) using namespace std; // there is some interval between best sel...
C++
223db02b85d93692699134a3b51914bf
1091565d9567b17b79a3fadfe8fd0fa5
2,100
PASSED
#include <bits/stdc++.h> #define pb push_back #define MOD 1000000007 #define lll long long #define mp make_pair #define fi first #define se second using namespace std; const int NR = 363304 + 10 ; void boost () { #ifndef ONLINE_JUDGE freopen("date.in", "r", stdin); // freopen("scmax.out", "w", stdout); ...
C++
223db02b85d93692699134a3b51914bf
bc555a33c3ba16ae3bbbc6fef060cd5e
2,100
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <vector> #include <queue> #include <map> #include <set> #include <algorithm> #include <deque> using namespace std; #define dout(x) cerr << #x << " = " << x << endl; typedef vector< vector<int> > Graph; const int MAX...
C++
f010eebcf35357f8c791a1c6101189ba
a8ef3cf4dfdd8d186b94c6e27cf5f6fb
2,200
PASSED
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; ll n,x,y; const int MX=2e5+3; vector<int>adj[MX]; bool ss() { for(int i=1;i<=n;i++) { if(adj[i].size()==n-1)return 0; } return 1; } int num=0; int dfs(int node,int pa) { int adjec=0; for(auto u : adj...
C++
f010eebcf35357f8c791a1c6101189ba
e7c739deb42ee2724f4498ad1c593ffb
2,200
PASSED
//In God We Trust //Go To Be Your Best ! #include<bits/stdc++.h> #define F first #define S second #define pb push_back typedef long long ll; using namespace std; const int N = 2 * 1e5 + 10; vector<int> a[N]; int dp[N]; bool us[N]; void dfs(int v,int p = 0){ int tmp = 0; for(auto u:a[v]){ if(u == p)cont...
C++
f010eebcf35357f8c791a1c6101189ba
de9a3a8710f09acd1d3355146588bd5a
2,200
PASSED
//In God We Trust //Go To Be Your Best ! #include<bits/stdc++.h> #define F first #define S second #define pb push_back typedef long long ll; using namespace std; const int N = 2 * 1e5 + 10; vector<int> a[N]; ll dp[N] , us[N]; void dfs(int v,int p = 0){ int tmp = 0; for(auto u:a[v]){ if(u == p)continue;...
C++
f010eebcf35357f8c791a1c6101189ba
d7a81bdf255cfb122d339fc9755ec02c
2,200
PASSED
#include <cstdio> #include <algorithm> #include <vector> using namespace std; typedef long long ll; const int N = 2e5+1; vector<int> g[N]; ll n, x, y, u, v, ans=0, c, ok = 1; int dfs(int u, int p) { int as=0; if (g[u].size() == n-1) ok = 0; for(int i=0; i<g[u].size(); ++i) { if (g[u][i] != p) as ...
C++
f010eebcf35357f8c791a1c6101189ba
c293902fadd3764c8a9a82066a002de4
2,200
PASSED
/******************************** *MAHBUBCSEJU * *CSE 22 * *JAHANGIRNAGAR UNIVERSITY * *TIMUS:164273FU * *UVA>>LIGHTOJ>>HUST:mahbubcseju * ********************************/ #include<cfloat> #include<climits> #include<fstream> #include<cstdio> #include<cst...
C++
f010eebcf35357f8c791a1c6101189ba
bab1a4d2e88bc9a44a5c508526cb61d7
2,200
PASSED
#include<iostream> #include<vector> #include<algorithm> #include<set> using namespace std; long long int n,x,y; vector<int>adj[200007]; int dp[200007][3]; void dfs(int i,int parent) { for(int j=0;j<adj[i].size();j++) if(adj[i][j]!=parent) { dfs(adj[i][j],i); dp[i][0]+=max(dp[adj[i][j]][0],max(dp[adj[i][j]][2],dp[adj[...
C++
f010eebcf35357f8c791a1c6101189ba
423e96512c64aaea63246fab9cc40cc6
2,200
PASSED
#include<iostream> #include<vector> #include<set> using namespace std; long long int n,x,y; vector<int>adj[200007]; int dp[200007][3]; void dfs(int i,int parent) { dp[i][0]=0; dp[i][1]=0; dp[i][2]=0; int temporary_child; for(int j=0;j<adj[i].size();j++) if(adj[i][j]!=parent) { dfs(adj[i][j],i); dp[i][0]+=max(dp[adj[i][...
C++
f010eebcf35357f8c791a1c6101189ba
7b342b3cb7ed2a50e0d5d3c685061f1a
2,200
PASSED
#include<iostream> #include<vector> #include<algorithm> #include<set> #include<climits> using namespace std; long long int n,x,y; vector<int>adj[200007]; int dp[200007][3]; void dfs(int i,int parent) { for(int j=0;j<adj[i].size();j++) if(adj[i][j]!=parent) { dfs(adj[i][j],i); dp[i][0]+=max(dp[adj[i][j]][0],max(dp[adj...
C++
f010eebcf35357f8c791a1c6101189ba
90a64da45b32b233de56d7c8081e71fb
2,200
PASSED
#include<iostream> #include<vector> #include<set> using namespace std; long long int n,x,y; vector<int>adj[200007]; int dp[200007][3]; void dfs(int i,int parent) { dp[i][0]=0; dp[i][1]=0; dp[i][2]=0; int temporary_child; for(int j=0;j<adj[i].size();j++) if(adj[i][j]!=parent) { dfs(adj[i][j],i); dp[i][0]+=max(dp[adj[i][...
C++
f010eebcf35357f8c791a1c6101189ba
f6ba3d77557dcdc84ae05e61cde338eb
2,200
PASSED
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define foo(i, n) for (int i = 0; i < n * 2; i ++) #define rep(i, n) for (int i = 1; i < n; i ++) using namespace std; typedef long long ll; typedef unsigned long long ull; const int N = 1e6 + 7; const int INF = 2e18; int main(){ ios_base::sync_w...
C++
adb0f6082367dc432e2e096c64f13a56
a1a5e2a66feaf70ae18481630b972c9a
1,000
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; void solve(){ int n; cin>>n; ll ans = INT_MAX; ll diff = 0; vector<ll> v(2*n); int k = n; for(auto &i:v) cin>>i; sort(v.begin(),v.end()); for(int i=0;i<n;i++){ diff = v[n] - v[i]; ans = min(diff,ans); }...
C++
adb0f6082367dc432e2e096c64f13a56
57977bb0fe8da97921de9e2cab3b781c
1,000
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; void solve(){ int n; cin>>n; ll ans = INT_MAX; ll diff = 0; vector<ll> v(2*n); int k = n; for(auto &i:v) cin>>i; sort(v.begin(),v.end()); for(int i=0;i<n;i++){ diff = v[i+(k--)] - v[i]; //cout<<" K "<<k<<en...
C++
adb0f6082367dc432e2e096c64f13a56
0077cd4f087b1c1df631d30d6949dd53
1,000
PASSED
#include<cstdio> #include<iostream> #include<string> #include<cstring> #include<math.h> #include<algorithm> using namespace std; typedef long long ll; int a; int ss[200010]; int t; int main() { scanf("%d",&t); for(int r=0;r<t;r++) { scanf("%d",&a); a<<=1; for(int i=1;i<=a;i++) ...
C++
adb0f6082367dc432e2e096c64f13a56
5ba7e553541f9f86b1519d12803e1af6
1,000
PASSED
//bismillahir rahmanir rahim //Author:Fayed Anik #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 <typename T> using ordered_set = tree<T, null_type, less<T>, /// greater<T> f...
C++
adb0f6082367dc432e2e096c64f13a56
6845e02eee358a5753f02a465327e5ef
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t;cin>>t; while(t--) { int n;cin>>n; int size=2*n; int arr[size]; for(int i=0;i<size;i++) cin>>arr[i]; sort(arr,arr+size); int minAbs=INT_MAX; int main1=arr[(size/2)]; ...
C++
adb0f6082367dc432e2e096c64f13a56
34bfd518a5d3ca020c3dc0685ad35e10
1,000
PASSED
#include <bits/stdc++.h> #define MEM(a, b) memset(a, (b), sizeof(a)) #define CLR(a) memset(a, 0, sizeof(a)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) ) #define S(X) ...
C++
adb0f6082367dc432e2e096c64f13a56
3b841f61ab93afbecd11fa0d092c5861
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ int n; cin>>n; int a[2*n]; for(int i=0;i<2*n;i++){ cin>>a[i]; } sort(a,a+2*n); int ans=a[n]-a[n-1]; cout<<ans<<endl; } return 0; }
C++
adb0f6082367dc432e2e096c64f13a56
4b918b6507e3355f742701efd9e01036
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; scanf("%d",&t); while(t--){ int n; scanf("%d",&n); int a[2*n]; for(int i=0;i<2*n;i++){ scanf("%d",&a[i]); } sort(a,a+2*n); int ans=a[n]-a[n-1]; printf("%d\n",ans); ...
C++
adb0f6082367dc432e2e096c64f13a56
153c6b9988fca288cbfd39a175ed3a54
1,000
PASSED
#include<stdio.h> #include<stdlib.h> #include<algorithm> #include<time.h> struct Node { Node *parent, *left, *right, *child; int degree, marked, value; }; Node* removeList(Node* a) // Removes a from list: Does not modify its parent { a->marked=0; if(a->left==a) return NULL; a->left->right=a->right; a->right...
C++
adb0f6082367dc432e2e096c64f13a56
25a04258f2d6841c1cb544c53974284e
1,000
PASSED