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
/** Micro Mezz Macro Flation -- Overheated Economy ., Last Update: Sep. 17th 2014 **/ //{ /** Header .. **/ //{ #pragma comment(linker, "/STACK:36777216") //#pragma GCC optimize ("O2") #define LOCAL //#include "testlib.h" #include <functional> #include <algorithm> #include <iostream> #include <fstream> #include <sstre...
C++
e2cdcfde0d5585cb6c40473fb1c48499
ccf6a9d9de00c8722e13c94afd24ed72
3,000
PASSED
/** Micro Mezz Macro Flation -- Overheated Economy ., Last Update: Sep. 17th 2014 **/ //{ /** Header .. **/ //{ #pragma comment(linker, "/STACK:36777216") //#pragma GCC optimize ("O2") #define LOCAL //#include "testlib.h" #include <functional> #include <algorithm> #include <iostream> #include <fstream> #include <sstre...
C++
e2cdcfde0d5585cb6c40473fb1c48499
06aec3883d4b09b4333acf479e1d0fbd
3,000
PASSED
#include <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <cstdlib> #include <string> #include <vector> #include <cstdio> #include <cassert> #include <ctime> #include <set> using namespace std; typedef long long ll; typedef long double ld; #ifdef WIN32 #define LLD "%I64d" #else #define ...
C++
e2cdcfde0d5585cb6c40473fb1c48499
22c44ed3fc3458c1284f5cd7e6dc9caa
3,000
PASSED
/** Micro Mezz Macro Flation -- Overheated Economy ., Last Update: Jun. 15th 2014 **/ //{ /** Header .. **/ //{ #pragma comment(linker, "/STACK:36777216") //#pragma GCC optimize ("O2") #define LOCAL //#include "testlib.h" #include <functional> #include <algorithm> #include <iostream> #include <fstream> #include <sstre...
C++
e2cdcfde0d5585cb6c40473fb1c48499
8ff645332de3efb9eeaf4046ff44d74c
3,000
PASSED
/** Micro Mezz Macro Flation -- Overheated Economy ., Last Update: Jun. 15th 2014 **/ //{ /** Header .. **/ //{ #pragma comment(linker, "/STACK:36777216") //#pragma GCC optimize ("O2") #define LOCAL //#include "testlib.h" #include <functional> #include <algorithm> #include <iostream> #include <fstream> #include <sstre...
C++
e2cdcfde0d5585cb6c40473fb1c48499
d26cdec416e4e631abbafff44b668a48
3,000
PASSED
/** Micro Mezz Macro Flation -- Overheated Economy ., Last Update: Jun. 15th 2014 **/ //{ /** Header .. **/ //{ #pragma comment(linker, "/STACK:36777216") //#pragma GCC optimize ("O2") #define LOCAL //#include "testlib.h" #include <functional> #include <algorithm> #include <iostream> #include <fstream> #include <sstre...
C++
e2cdcfde0d5585cb6c40473fb1c48499
6cb3cf6b459bea9fdb67376a95eb9aa0
3,000
PASSED
/** Micro Mezz Macro Flation -- Overheated Economy ., Last Update: Jun. 15th 2014 **/ //{ /** Header .. **/ //{ #pragma comment(linker, "/STACK:36777216") //#pragma GCC optimize ("O2") #define LOCAL //#include "testlib.h" #include <functional> #include <algorithm> #include <iostream> #include <fstream> #include <sstre...
C++
e2cdcfde0d5585cb6c40473fb1c48499
d2f0c9a2ffa7ba457b09233beca4ebe0
3,000
PASSED
#include <cstdio> #include <iostream> #include <vector> #include <algorithm> #include <string> #include <cstring> #include <queue> #include <stack> #include <map> using namespace std; typedef pair<int, int> PII; typedef pair<unsigned, unsigned> PUU; typedef long long LL; typedef long double K; const int mod = 100000...
C++
e2cdcfde0d5585cb6c40473fb1c48499
7e9acf009214eab51646df24ceab6a98
3,000
PASSED
#include <iostream> #include <algorithm> #include <set> using namespace std; #ifdef LOCAL #define eprintf(...) fprintf(stderr, __VA_ARGS__) #else #define eprintf(...) 0 #endif const int N = 100500; const int SIZE = (1 << 17); const int HASH_SIZE = 2; const int MOD[HASH_SIZE] = {(int) 1e9 + 7, (int) 1e9 + 9}; const...
C++
e2cdcfde0d5585cb6c40473fb1c48499
b773c963d165b9a37eb566a0c4f1c4b8
3,000
PASSED
using namespace std; #include <iostream> #include <vector> #include <algorithm> #include <map> long long int n, maxi, ind1, ind2, col1, col2; struct cube{ long long int id; long long int siz; }; struct group{ long long int num; long long int color; }; map <long long int, long long int> colorInd; bo...
C++
fa867bb7df94cc0edc03bcbf975de001
791c0b93c1a59cb9930c0d16df9499c0
1,700
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int N=1e5+5; int n,x,y,color1,color2,sz1,sz2; long long ans=-1e18; set< pair<int,int> >q[N]; map< int,vector<pair<int,int> > >g; main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n; for(int i=1;i<=n;i++){ ...
C++
fa867bb7df94cc0edc03bcbf975de001
7d907e8c62976d30f23c5a9dbc00d109
1,700
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int N=1e5+5; int n,x,y,color1,color2,sz1,sz2; long long ans=-1e18; set< pair<int,int> >q[N]; unordered_map< int,vector<pair<int,int> > >g; main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n; for(int i=1;i<=n;i+...
C++
fa867bb7df94cc0edc03bcbf975de001
1d4d3bb0096984630195374aa9f580e9
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned long long uLL; typedef long double ldb; typedef pair<int,int> pii; map<LL, vector<pii>> M; LL MAX[100003]; int color[100003]; int main() { ios_base::sync_with_stdio(0);cin.tie(0); int n; cin>>n; int c, s; for(LL ...
C++
fa867bb7df94cc0edc03bcbf975de001
9657f25c4bb38a13fdf6fe0f95a63aeb
1,700
PASSED
#include <bits/stdc++.h> #define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout); #define ll long long int #define FF first #define SS second #define mp make_pair #define pb push_back #define pii pair<int,int> #define pll pair<long...
C++
fa867bb7df94cc0edc03bcbf975de001
d23948d1e778bebfcd15dd3940a98958
1,700
PASSED
#include <bits/stdc++.h> using namespace std; using ll=long long; const ll N = 2e5+5; struct cube { ll color, sz, id; }; ll n, num1, num2, col1, col2; ll f[N], d[N], res; vector<cube> cubes; void update(ll x, ll y, ll col, ll sum) { if (f[y]!=-1 && res<sum+f[y]) { res=sum+f[y]; num1=x; num2=y...
C++
fa867bb7df94cc0edc03bcbf975de001
b98063bdce716fc0ff886bb4423e9f55
1,700
PASSED
#include <stdio.h> #include <vector> #include <algorithm> #include <set> using namespace std; const int N=100050; #define pb push_back #define mp make_pair #define ll long long set<pair<ll,int> ,greater<pair<ll,int> > > Set; set<pair<ll,int> ,greater<pair<ll,int> > >::iterator it; vector<int> ids[N]; vector<int> id; ve...
C++
fa867bb7df94cc0edc03bcbf975de001
3a9261a761d6df3bdd394f1b1214e300
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define PII pair<int,int> #define f first #define s second #define VI vector<int> #define LL long long #define MP make_pair #define LD long double #define PB push_back #define PLL pair <LL, LL> #define ALL(V) V.begin(),V.end() #define abs(x) max((x),-(x)) #define PDD pair<LD...
C++
fa867bb7df94cc0edc03bcbf975de001
2f4354a988b86e3ed65f9b1e882a2600
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll MAX = 100005; struct Prop { ll height, id; Prop(ll h, ll i) : height(h), id(i) {} }; bool PropCmp(Prop x, Prop y) { return x.height > y.height; } struct Box { ll color; ll sum_h = 0; vector<ll> cSum; vector<Prop...
C++
fa867bb7df94cc0edc03bcbf975de001
ebe90a71a005fc90de6c2a6a6e833fe8
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define ENGZ ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0); #define sfi(x) scanf("%d" , &x) #define sfi2(x, y) scanf("%d%d" , &x,&y) #define sfl2(x, y) scanf("%I64d%I64d" , &x,&y) #define sfl(x) scanf("%I64d" , &x) #define sfl3(x, y, z) scanf("%I64d%I64d%...
C++
fa867bb7df94cc0edc03bcbf975de001
5f0aeec94030f94754bf989db9f0b2a6
1,700
PASSED
#include<stdio.h> #include<iostream> #include<cstring> #include<stdlib.h> #include<algorithm> #include<time.h> #define ll long long #define inf 0x3f3f3f3f #define maxn 100005 using namespace std; int G[maxn],pre[maxn],l[maxn],top; int f[maxn],a[maxn],b[maxn],vis[maxn],ans[maxn]; int n,m; int read() { int num,sign=1;...
C++
42815780abd845fba3ad8145b82f19ac
dde0b63fa782702a6302758985a95369
3,000
PASSED
#include <stdio.h> #include <stdlib.h> #define inf 1999999999 int cmp(const void*a,const void*b) { return *(int*)b-*(int*)a; } int sz[100010],st[100010],px[100010],n,dy[100010],la[100010],dp[100010]; int find(int x) { int l=-1,r=n; while(l<r) { int m=(l+r+1)>>1; if(st[m]<x) l=m; else r=m-1; } return l...
C++
42815780abd845fba3ad8145b82f19ac
0dab0b1935ea86e7e951ae535a63f5a3
3,000
PASSED
#include<bits/stdc++.h> #define MAXN 100005 #define INF 2147483647 using namespace std; inline int read() { int x=0,f=1;char ch=getchar(); while(!isdigit(ch)){if(ch=='-') f=-f;ch=getchar();} while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();} return x*f; } int n,m; int f[MAXN],g[MAXN],l[MAXN],p[MAXN]; int a[MAXN],b[M...
C++
42815780abd845fba3ad8145b82f19ac
06d5f0e1fc9036277a43be9995e2686a
3,000
PASSED
#include<algorithm> #include<iostream> #include<climits> #include<cstring> #include<cstdio> #include<cmath> #include<set> using namespace std; //{{{ read() inline int read(){ register int x=0,f=1; register char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') x=x*1...
C++
42815780abd845fba3ad8145b82f19ac
636d570dc32f5cb40ac01edba9d4b778
3,000
PASSED
#include<bits/stdc++.h> #define fi first #define se second #define pb push_back #define SZ(x) ((int)x.size()) #define L(i,u) for (register int i=head[u]; i; i=nxt[i]) #define rep(i,a,b) for (register int i=(a); i<=(b); i++) #define per(i,a,b) for (register int i=(a); i>=(b); i--) using namespace std; typedef long long ...
C++
42815780abd845fba3ad8145b82f19ac
f5e6ebf4cbcb6f8576f86acc474d0ec0
3,000
PASSED
#include<bits/stdc++.h> using namespace std; int n, m, a[100007], b[100007], len[100007], pos[100007], mn[100007], pmn[100007], res[100007]; bool vis[100007]; int read() { int num = 0, f = 1; char c = getchar(); while ((c < '0' || c>'9') && c != '-')c = getchar(); if (c == '-')f = -1, c = getchar(); while (c >= '0...
C++
42815780abd845fba3ad8145b82f19ac
d1d2b96d6b19caf902acff19de21d2fb
3,000
PASSED
#include "iostream" #include "algorithm" #include "vector" #include "set" #include "map" #include "cstring" #include "string" #include "vector" #include "cassert" #include "queue" #include "cstdio" #include "cstdlib" #include "ctime" #include "cmath" using namespace std; typedef long long ll; typedef pair < int, int ...
C++
42815780abd845fba3ad8145b82f19ac
ac75096e244863bd8f384bcf2ad4e056
3,000
PASSED
#include<stdio.h> #include<algorithm> using namespace std; int tmp[131072],wz[131072],num=0; int bs(int x) { int l=1,r=num+1; while(l<r) { int mid=(l+r)>>1; if(tmp[mid]<x) { l=mid+1; } else { r=mid; } } return l; } int a[131072],val[131072]; int dp[131072],pre[131072],pval[131072]; bool vis[131...
C++
42815780abd845fba3ad8145b82f19ac
1a9bb05edefe19ca6f58d63e82c268dd
3,000
PASSED
#include "iostream" #include "cstdio" #include "cstring" #include "cmath" #include "cstdlib" #include "cctype" #include "algorithm" #include "set" #include "queue" #include "map" #include "stack" #include "vector" #define lxl int #define R register #define INF 0x3f3f3f3f #define debug(x) printf("debug:%lld\n",x) const...
C++
42815780abd845fba3ad8145b82f19ac
d073789101f6c02138a4ebdc72b81cf6
3,000
PASSED
#include <cstdio> #include <algorithm> #include <set> const int Inf = 0x3f3f3f3f; const int MN = 100005; int N, M, K, A[MN], C[MN]; int S[MN], H[MN]; int len[MN], pos[MN]; int f[MN], g[MN]; std::multiset<int> st; int Ans[MN]; int main() { scanf("%d", &N), N += 2, A[1] = 0, A[N] = 1000000001; for (int i = 2; i < N;...
C++
42815780abd845fba3ad8145b82f19ac
060d5c6041c916875ffc69f6eb79d53c
3,000
PASSED
// // main.cpp // RaisingBacteria // // Created by Nishtha Mehrotra on 13/12/19. // Copyright © 2019 Nishtha Mehrotra. All rights reserved. // #include <iostream> #include <vector> #include <algorithm> using namespace std; long long int dp[20][1048605]; void func(int n, int m, long long int a[20], long long int ...
C++
5b881f1cd74b17358b954299c2742bdf
5875d34c011e3b6ac6de3fff833dec24
1,800
PASSED
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <queue> #include <cassert> #include <cstdlib> #include <ctime> using namespace std; using ull = unsigned long long; using pii = pair<int, int>; using vi = vector<int>; using qi = queue<int>; ull e[18][18]; ull ans[18][1 << 18]; vector...
C++
5b881f1cd74b17358b954299c2742bdf
f9f1d38bcd2405469fcb32529e99c9fa
1,800
PASSED
#include<iostream> #include<math.h> #include<algorithm> #include<stdio.h> #include<map> #include<vector> #include<set> #include<iomanip> #define F first #define S second #define P system("PAUSE"); #define H return 0; #define pb push_back using namespace std; const long long A = 100000000000000LL, N = 1228228; long l...
C++
5b881f1cd74b17358b954299c2742bdf
0dea8b1530aebbe99cd29590c428e6f6
1,800
PASSED
#include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <algorithm> #include <set> #include <bitset> #include <vector> #include <sstream> #include <queue> #include <typeinfo> #include <fstream> #include <map> #include <stack> typedef long long ll; using namespace std; #define...
C++
5b881f1cd74b17358b954299c2742bdf
3833384dd603e2526b2cea0f3fbbd797
1,800
PASSED
#include<iostream> #include<algorithm> #include<cstring> using namespace std; const int max_j = 1 << 19; typedef long long ll; int n, m, k; ll a[20]; ll G[20][20]; ll dp[20][max_j]; ll dfs(int u,int state) { if (!((state >> u) & 1))return 0; if (dp[u][state] != -1)return dp[u][state]; dp[u][state] = 0; ...
C++
5b881f1cd74b17358b954299c2742bdf
f6a58adf30db6579cf8111ea4e1c0e13
1,800
PASSED
#pragma comment(linker, "/STACK:10000000000") //#pragma GCC optimize("O3") #define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <stdio.h> #include <iostream> #include <sstream> #include <iomanip> #include <math.h> #include <map> #include <chrono> #include <set> #include <stack> #include <vector> #include <time....
C++
5b881f1cd74b17358b954299c2742bdf
f3ecf24f0d247f79a2b88bb2bd67340a
1,800
PASSED
#include <stdio.h> #include <algorithm> #include <vector> using namespace std; int ones(int n) { int res = 0; while (n) { res++; n &= n - 1; } return res; } int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int n, m, k; scanf("%d%d%...
C++
5b881f1cd74b17358b954299c2742bdf
7ad2bc198079766779455b25c2207e83
1,800
PASSED
#include <sstream> #include <vector> #include <algorithm> #include <cstring> #include <cstdlib> #include <iostream> #include <string> #include <cassert> #include <ctime> #include <stack> #include <map> #include <math.h> #include <cstdio> #include <set> #include <deque> #include <memory.h> #include <queue> typedef unsi...
C++
5b881f1cd74b17358b954299c2742bdf
239f7100672f39c06a956ed5c6d7308c
1,800
PASSED
#include<algorithm> #include<stdio.h> using namespace std; typedef long long LL; int a[1300005],b[1300005],r[21][21]; LL d[1300005][21]; int n; int len(int mask) { int k=0,i; for(i=0;i<n;i++)if(mask&b[i])k++; return k; } LL max(LL a, LL b) { if(a<b)return b; return a; } int main() { int m,k,...
C++
5b881f1cd74b17358b954299c2742bdf
fb2bc2d0fa6655a5b4e8ba41d2cd41fa
1,800
PASSED
#include <algorithm> #include <iomanip> #include <istream> #include <map> #include <numeric> #include <ostream> #include <set> #include <sstream> #include <string> #include <utility> #include <vector> using namespace std; // Powered by caide (code generator, tester, and library code inliner) typedef __int64 ll; class...
C++
5b881f1cd74b17358b954299c2742bdf
8411e8b39fa606c5511ab927a3834fe7
1,800
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class beautifulString { //FastScanner for Java public static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner() { br = new BufferedReader(n...
Java
98c08a3b5e5b5bb78804ff797ba24d87
30633b9aa7d8a4c6aba9731a9be46d4e
1,000
PASSED
import java.io.*; import java.util.*; import java.lang.*; // import java.text.DecimalFormat; public class test{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br=new BufferedReader(new InputStreamReader(System.in)); } ...
Java
98c08a3b5e5b5bb78804ff797ba24d87
89ef1dc6d970134fc40b62f67854e77f
1,000
PASSED
import java.util.*; public class JavaApplication2{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); scan.nextLine(); String[] str = new String[n]; for (int i = 0; i < n; i++) { boolean f = true; ...
Java
98c08a3b5e5b5bb78804ff797ba24d87
ec5f1b4b9e42f48e6590597797243e57
1,000
PASSED
import java.io.*; import java.util.*; import java.lang.*; public class s { public static void main (String[] args) throws java.lang.Exception { try { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ String s = sc.next(); int n = s.length...
Java
98c08a3b5e5b5bb78804ff797ba24d87
c66d5f30215af7f0d7ffac0fa5d34470
1,000
PASSED
//package cf1; import java.io.*; import java.util.*; public class utkarsh { BufferedReader br; PrintWriter out; long mod = (long) (1e9 + 7), inf = (long) (3e18); void solve() { int t = ni(); while(t-- > 0) { char s[] = ns().toCharArray(); int n =...
Java
98c08a3b5e5b5bb78804ff797ba24d87
855f29ca5da72af1547b053f7262153c
1,000
PASSED
import java.io.*; import java.util.*; public class Main { long k; void run(FastIO io) { int n = io.nextInt(); String next; char last, now; StringBuilder sb; boolean end; for (int i = 0; i < n; i++) { next = io.nextToken(); sb = new Strin...
Java
98c08a3b5e5b5bb78804ff797ba24d87
e85202be5004fcc7f4371aad56a1471b
1,000
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BeautifulString { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int testcase = Integer.parse...
Java
98c08a3b5e5b5bb78804ff797ba24d87
305377156cf9466411595e24df25f929
1,000
PASSED
import java.io.*; import java.util.*; import javafx.util.Pair; public class HR27 { InputStream is; PrintWriter out; String INPUT = ""; //boolean codechef=true; boolean codechef=true; void solve() { int n = ni(); for(int i=0;i<n;i++) { String s=ns(); char[] ans=s.toCharArray();...
Java
98c08a3b5e5b5bb78804ff797ba24d87
e7249886982cce8c67912d960d7446e7
1,000
PASSED
import java.util.*; import java.io.*; public class q1{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int test = scan.nextInt(); while(test-->0){ String str = scan.next(); int n = str.length(); char ch[] = str.toCharArray()...
Java
98c08a3b5e5b5bb78804ff797ba24d87
c16c3cf0a683f0ff85898c3b2a643d04
1,000
PASSED
import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class ProblemA { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNextLine()) { int number = Integer.parseInt(scanner.nextLine().trim()); for (int k =...
Java
98c08a3b5e5b5bb78804ff797ba24d87
dfc08328273393e89ace19d9d3847a57
1,000
PASSED
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cctype> #include <cmath> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <algorithm> #include <climits> #define MAXN 100000 #define eps 1e-5 #define N 100005 #define MOD 1000000007 #define I...
C++
60f3c7528ee169be4ce63441802fec6b
cc07f1dcfc9dfa5d48870196aae2ee8e
2,700
PASSED
#include <cstdio> #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <set> #include <map> #include <ctime> #include <cstring> #include <cassert> #include <bitset> #include <sstream> #include <queue> #define pb push_back #define mp make_pair #define fs first #define s...
C++
60f3c7528ee169be4ce63441802fec6b
3fd1536bcb47f3bcfa3eac795391f4fd
2,700
PASSED
#include <vector> #include <list> #include <queue> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cst...
C++
60f3c7528ee169be4ce63441802fec6b
4982bacc5059e6512be5fb9b0461f69f
2,700
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cst...
C++
60f3c7528ee169be4ce63441802fec6b
661950dc06de452b5b16576bcbee26ae
2,700
PASSED
#include <cstdio> #include <iostream> #include <cmath> #include <iomanip> using namespace std; int n,m,k; long double l[1000000]; long double f(int i, int j) { int x = (i+j)*n-i*j; if(x > k) return 0.0; long double r = l[m-x] - l[k-x] - l[m] + l[k] + l[n] - l[i] - l[n-i] + l[n] - l[j] - l[n-j]; return ...
C++
60f3c7528ee169be4ce63441802fec6b
4d090c887d1f6c272ecebf2d6a9327b0
2,700
PASSED
#include <bits/stdc++.h> using namespace std; #define rep(i,a,n) for (int i=a;i<(int)n;i++) #define per(i,a,n) for (int i=n-1;i>=a;i--) #define pb push_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define fi first #define se second #define SZ(x) ((int)(x).size()) #define ACCU accumulate #define TWO(x)...
C++
60f3c7528ee169be4ce63441802fec6b
e5bcc90fcecd937e78714cb3ee0d5ab9
2,700
PASSED
#include <cmath> #include <map> #include <vector> #include <cstdio> #include <cstdlib> #include <iostream> #include <algorithm> #include <cstring> #include <set> #include <bitset> #include <memory.h> #include <functional> #include <queue> #include <fstream> #include <ctime> #include <deque> #include <utility> #include ...
C++
60f3c7528ee169be4ce63441802fec6b
6e4a1a836dbdaedd4836d6d645295dea
2,700
PASSED
#include <bits\stdc++.h> #include <ext\rope> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_cxx; using namespace __gnu_pbds; #define pb push_back #define mp make_pair typedef long long ll; typedef unsigned long long ull; typedef unsigned int uint...
C++
60f3c7528ee169be4ce63441802fec6b
80e1943b616b939f6ad70c16925897f9
2,700
PASSED
#include<cstdio> #include<algorithm> #define N 320 #define M 100100 #define eps 1e-6 using namespace std; double p[M],dp[N][N]; double cmb(int n,int m){ if(n<m||m<0) return 0; if(n==m||m==0) return 1; if(dp[n][m]>eps) return dp[n][m]; return dp[n][m]=cmb(n-1,m)+cmb(n-1,m-1); } int main(){ double ans=0; int i,j,n,...
C++
60f3c7528ee169be4ce63441802fec6b
20fafb291eeb90f78415688051b2e692
2,700
PASSED
#include <bits/stdc++.h> using namespace std; template<class T, class U> void ckmin(T &a, U b) { if (a > b) a = b; } template<class T, class U> void ckmax(T &a, U b) { if (a < b) a = b; } #define MP make_pair #define PB push_back #define LB lower_bound #define UB upper_bound #define fi first #define se second #def...
C++
60f3c7528ee169be4ce63441802fec6b
8584d90c331112ad19af36a6a8ae4e15
2,700
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <string> #include <cstring> #include <cmath> #include <set> #include <map> #include <cstdio> #include <stdlib.h> #include <stack> #include <numeric> #include <bitset> #include <cctype> #include <list> #include <assert.h> #include <rand...
C++
f56597c8c3d17d73b8ede2d81fe5cbe7
d2b07c38a1c253edc74db78630c0ee72
1,900
PASSED
#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization ("unroll-loops") #include <iostream> #include <fstream> #include <algorithm> #include <vector> #include <set> #include <stack> #include <map> #include <iomanip> #include <cmath> #include <queue> #include <bitset> #include <numeric...
C++
f56597c8c3d17d73b8ede2d81fe5cbe7
2461f77294248cf5cdf383dcfd4f2472
1,900
PASSED
#include <iostream> #include <algorithm> using namespace std; using ll = long long; const int MAXN = 100005; const ll INF = 1e17; int M, N; ll A[MAXN], B[MAXN]; ll aSum, bSum; int main() { ios::sync_with_stdio(false); cin >> M >> N; for (int i = 0; i < M; i++) { cin >> A[i]; aSum += A[i]...
C++
f56597c8c3d17d73b8ede2d81fe5cbe7
31c7164cb73a525e7bbd5dc9f822197c
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long unsigned ll a[1000000]; unsigned ll b[1000000]; int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); ll n,m; cin>>n>>m; for (int i=0;i<n;i++)cin>>a[i],a[n]+=a[i]; for (int i=0;i<m;i++)cin>>b[i],b[m]+=b[i]; sort(a,a+n)...
C++
f56597c8c3d17d73b8ede2d81fe5cbe7
37f7e52cb62eba2f7c12336ac2b468ed
1,900
PASSED
#include <bits/stdc++.h> #include <iostream> #include <vector> using namespace std; typedef long long LL; typedef long double LD; typedef pair < int, int > PII; typedef pair < LL, LL > PLL; typedef pair < LD, LD > PDD; #define MAXINT (100000 + 42) int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(...
C++
f56597c8c3d17d73b8ede2d81fe5cbe7
cffe17e223db496f5a7c6733785cf7fa
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define vi vector<ll > #define vvi vector<vi > #define all(x) x.begin(), x.end() int n, m; vi a, b; ll f() { ll sum = accumulate(all(a), 0ll); ll res = sum; for (int i = 0; i < b.size() - 1; ++i) res += min...
C++
f56597c8c3d17d73b8ede2d81fe5cbe7
0ff1bed8b5fb5b6c76d49108903cc238
1,900
PASSED
#include <iostream> #include <string> #include <cstdio> #include <cmath> #include <vector> #include <map> #include <queue> #include <stack> #include <sstream> #include <algorithm> using namespace std; #define rep(_m,s,e) for(ll _m=s;_m<e;_m++) typedef unsigned long long int ll; typedef __int64 li; int toInt(string s) ...
C++
f56597c8c3d17d73b8ede2d81fe5cbe7
00c262eef53b96832b36bc25f71867e0
1,900
PASSED
#define _CRT_SECURE_NO_DEPRECATE #define _USE_MATH_DEFINES #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <set> #include <map> #include <queue> #include <memory.h> using namespace std; #pragma comment(link...
C++
f56597c8c3d17d73b8ede2d81fe5cbe7
264ce9fbce234bbe26f2994c801deeb7
1,900
PASSED
#define _CRT_SECURE_NO_WARNINGS #pragma comment(linker, "/stack:16777216") #include <string> #include <vector> #include <map> #include <list> #include <iterator> #include <set> #include <queue> #include <iostream> #include <sstream> #include <stack> #include <deque> #include <cmath> #include <memory.h> #include <cstdli...
C++
f56597c8c3d17d73b8ede2d81fe5cbe7
cfdd93afa411c5f2d4dc9c98724b969c
1,900
PASSED
#include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<queue> #include"string.h" using namespace std; #define maxn 210000 #define LL __int64 int n, m; LL a[maxn], b[maxn]; LL sum1[maxn], sum2[maxn]; int main(){ while (scanf("%d%d", &n, &m) != EOF){ sum1[0] = sum2[0] = 0; LL ans = 1e16; ...
C++
f56597c8c3d17d73b8ede2d81fe5cbe7
ed9b6be089d78c3e69e65317d3e4a8c9
1,900
PASSED
#include<stdio.h> #include<algorithm> #include<string.h> using namespace std; int main() { int i,n,x,d,u; char ans,q[10],line[100]; bool checkd=false,checku=false; scanf("%d",&n); gets(line); for(i=1;i<=n;i++) { gets(line); sscanf(line,"%s %d %c",&q,&x,&ans); if (ans=...
C++
6c6f29e1f4c951cd0ff15056774f897d
806ac79adc5352ca95a52ef48bdb0bfb
1,400
PASSED
#include <iostream> //processor directive #include <string> #include <sstream> #include <vector> #include <cmath> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <iterator> #include <stdio.h> #define F first #define S second typedef long long LL; typedef unsigned long long ULL; //freopen(...
C++
6c6f29e1f4c951cd0ff15056774f897d
04999f7d701ce3e30e36819f5e629784
1,400
PASSED
#include <iostream> //processor directive #include <string> #include <sstream> #include <vector> #include <cmath> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <iterator> #include <stdio.h> #define F first #define S second typedef long long LL; typedef unsigned long long ULL; //freopen(...
C++
6c6f29e1f4c951cd0ff15056774f897d
0c7e06cf6e761cf2c0606c764c3f962b
1,400
PASSED
#include <iostream> #include <stdio.h> using namespace std; main(){ string str,ans; long long n,x,a=-1998638045,b=1998638045; cin>>n; /*if(n==10000){ cin>>str; if(str==">") cout<<"1001317593"; else cout<<"Impossible"; return 0; }*/ while(n--){ cin>>str>...
C++
6c6f29e1f4c951cd0ff15056774f897d
fe1db036747b6c6a9e70f45402b46659
1,400
PASSED
#include<iostream> #include<string> using namespace std; int main() { int n; while( cin>>n) { long long x; string s; char c; long long max=2000000000; long long min=-2000000000; for(int i=0;i<n;i++) { cin>>s>>x>>c; if(s==">=" && c=='Y' && min<=x) min=x; if(s==">" && c=='Y' && min<=x) ...
C++
6c6f29e1f4c951cd0ff15056774f897d
47c672b0e6f26461e1697de86c59da60
1,400
PASSED
#include<stdio.h> #include<string.h> int main() { int n; while(scanf("%d",&n)!=EOF) { int le=-2000000000,ri=2000000000,le1=-2000000000,ri1=2000000000; char a[3],c; int m; while(n--) { getchar(); memset(a,0,sizeof(a)); scanf("%s",a);...
C++
6c6f29e1f4c951cd0ff15056774f897d
3526f25b70fb0d3c97579be7070b87a1
1,400
PASSED
#include<iostream> using namespace std; int main() { int n,i; char ch; string s; cin>>n; long long int least=-1000000009,large=1000000009,data; bool laset,leset; laset=leset=false; while(n--) { cin>>s>>data>>ch; if(s.length()==1) { if(s[0]=='>'&&ch=='N') {large=min(large,data);laset=true;} el...
C++
6c6f29e1f4c951cd0ff15056774f897d
da18bd038cf526d8374f576cc9f7e416
1,400
PASSED
#include <stdio.h> #include <math.h> #include <iostream> #include <string.h> typedef long long LL; using namespace std; #define mod 1000000007 char symbol[2]; LL MAX = mod-6; LL MIN = -mod+6; LL upperbound = mod-6; LL belowbound = -mod+6; int questioncount; int temp = 1; int main() { cin>>questioncount; while(q...
C++
6c6f29e1f4c951cd0ff15056774f897d
45173419897675837c16c27a4728198e
1,400
PASSED
#include <stdio.h> #include <math.h> int main() { char symbol[3]; char judge; long long upperbound =2 * pow(10.0, 9); long long belowbound = -2 * pow(10.0, 9); //printf("%d %d\n", upperbound, belowbound); int questioncount; int number, i; int temp = 1; scanf("%d", &questioncount);...
C++
6c6f29e1f4c951cd0ff15056774f897d
80e1c9af980cd8f1707f37af2e1d181b
1,400
PASSED
#include<iostream> #include<string.h> using namespace std; int main() { char si[10000][3]; int n,i,flag1=0,flag2=0; long long int max,min; cin>>n; long long int *x=new long long int [n]; char *ans= new char [n]; for(i=0; i<n; i++) { cin>>si[i]>>x[i]>>ans[i]; if(flag1!=-1) if((strcmp(si[i],">=")==0 && ans[i]=='Y') || (s...
C++
6c6f29e1f4c951cd0ff15056774f897d
4dbcef797eeb9fa82901a05e48fe86b2
1,400
PASSED
#include<cstdio> #include<iostream> #include<algorithm> #include<cstdlib> #include<cstring> #include<vector> using namespace std; int nex[100010]; bool vis[100010]; int main(){ int n; scanf("%d",&n); int p; int first1,first2; first1=first2=-1; for(int i=1;i<=n;i++){ scanf("%d",&p); ...
C++
5ecb8f82b073b374a603552fdd95391b
af6973a623217d0e836d8d6149d3dde9
2,100
PASSED
//#pragma comment(linker, "/STACK:102400000,102400000") #include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <algorithm> #include <set> #include <cmath> #include <set> #include <string> #include <queue> using namespace std; typedef long long LL; #define el else if #define FOR(i, l, r) f...
C++
5ecb8f82b073b374a603552fdd95391b
ce8e18b2ca07896c71477f88cbcd4d29
2,100
PASSED
#include<cstdio> using namespace std; const int N=100005; int p[N],t[N],n; bool vis[N]; int main(){ //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); scanf("%d",&n); for(int i=1;i<=n;i++){scanf("%d",p+i);t[i]=1;} for(int i=1;i<=n;i++) if(p[i]==i){ puts("YES");//<<endl; for(int j=1;j<=n;j++) ...
C++
5ecb8f82b073b374a603552fdd95391b
c5674f0bcb03f5afb857bc3eddf90507
2,100
PASSED
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <queue> #include <stack> #include <set> #include <map> //#include <tr1/unordered_set> //#include <tr1/unordered_map> #include <bitset> //#pragma comment(linker, "/STACK:1024000000,1024000000") #defi...
C++
5ecb8f82b073b374a603552fdd95391b
25e3acfcecc6677dcf381e0d062e0388
2,100
PASSED
#include <cstdio> #include <iostream> #include <algorithm> #include <vector> #include <cstring> #include <map> #include <set> #include <iterator> #include <string> #include <queue> #include <cctype> using namespace std; #define LL long long const LL l1 = 1LL; const int Len = 100000; const int inf = (1<<30); int n; int ...
C++
5ecb8f82b073b374a603552fdd95391b
a8cd610746534ec624085a6dd9284799
2,100
PASSED
#include <bits/stdc++.h> using namespace std; int main (){ #define NN 100100 static int p[NN]; int n; cin >> n; for(int i=1; i<=n; i++) cin >> p[i]; for(int i=1; i<=n; i++){ if(p[i]==i){ puts("YES"); for(int j=1; j<=n; j++){ if(i!=j) cout << i << ' ' << j << endl; } return 0; } } int a=0; fo...
C++
5ecb8f82b073b374a603552fdd95391b
a36f768cbb39dff7cbecf76eb112bdd6
2,100
PASSED
#include<bits/stdc++.h> #define x first #define y second #define pb push_back #define inf 0x3f3f3f3f #define mod 1000000007 #define sq(x) ((x)*(x)) #define PQ priority_queue<pii, vector<pii>, greater<pii> > using namespace std; typedef double DO; typedef long long INT; typedef pair<int, int> pii; type...
C++
5ecb8f82b073b374a603552fdd95391b
1da5608ae32bb319d0f39083cc0f2cfa
2,100
PASSED
#include <bits/stdc++.h> #define x first #define y second #define eps 1e-8 #define pb push_back #define mod 1000000007 #define inf 0x3f3f3f3f #define INF 0x3f3f3f3f3f3f3f3fLL #define bit(x, y) (((x)>>(y))&1) #define bctz(x) (__builtin_ctz(x)) #define bclz(x) (__builtin_clz(x)) #define bclzl(x) (__builtin_c...
C++
5ecb8f82b073b374a603552fdd95391b
b6578980a8d090eaad6f0315b6c21952
2,100
PASSED
#include <bits/stdc++.h> #define NN 100100 using namespace std; typedef long long INT; typedef pair <int, int> pii; int p[NN]; int vst[NN]; vector <pii> edge; int main (){ int n; cin >> n; for(int i=1; i<=n; i++){ scanf("%d", p+i); } for(int i=1; i<=n; i++){ if(p[i]==i){ puts("YE...
C++
5ecb8f82b073b374a603552fdd95391b
ae2092836c4668257b790bcdfbdfa0ee
2,100
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <vector> #define pb push_back using namespace std; int n,cnt; int a[233333]; bool f[233333]; vector<int> p[100010]; void dfs(int x){ p[cnt].pb(x); f[x]=false; if(f[a[x]])dfs(a[x]); } int main(){ scanf("%d",&n); ...
C++
5ecb8f82b073b374a603552fdd95391b
8536aad81677f41baa663cb063c90b53
2,100
PASSED
#include <bits/stdc++.h> typedef long long ll ; typedef long long ull ; using namespace std; const ll mod = 1e9 +9 ; const int N = 1e7 + 5; bitset<N> b; set<int> primes ; vector<int> vpr ; void sieve(){ vpr.push_back(2); primes.insert(2); for(int i = 3 ; i < N ; i += 2){ if(!b[i]){ ...
C++
bf8bbbb225813cdf42e7a2e454f0b787
3152887f04b4ddc2a83372b101eb7158
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 3e6; const int maxn = 1e5+5; int prime[N+5], cnt; bool isprime[N+5]; void prime_init() { for(int i = 2; i <= sqrt(N); ++i) { if(!isprime[i]) { for(int j = i*i; j <= N; j+=i) { isprime[j] = 1; } } } cnt = 0; for(int i = 2; i <= N; ++i) { if(...
C++
bf8bbbb225813cdf42e7a2e454f0b787
fbf7afb80f26c85cff927ad00a74485b
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int MX = 2e6, MXA = 1e5; int sieve[MX]; set<int> cand; int main() { ios::sync_with_stdio(0);cin.tie(0); int i; for(i=2; i<2*MXA; i++) cand.insert(i); for(i=2; i*i<=MX; i++) { if(sieve[i]) continue; cand.insert(i); for(int j=i; j<MX; j+=i) sieve[j] = i;...
C++
bf8bbbb225813cdf42e7a2e454f0b787
32956fb8a3cb6757d8f049d13e009063
1,900
PASSED
#include <iostream> #include <vector> #include <set> using namespace std; vector<int> d[2000005]; set<int> s; bool p[2000005],er[2000005]; int main() { int n; scanf("%d",&n); for (int i=2;i<2000005;i++) { if (!p[i]) { for (int x=i;x<2000005;x+=i) { ...
C++
bf8bbbb225813cdf42e7a2e454f0b787
435d2a60f60f2eca48ce5c6b894c094f
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int MX = 2e6, MXA = 1e5; int sieve[MX]; set<int> cand; int main() { ios::sync_with_stdio(0);cin.tie(0); int i; for(i=2; i<MX; i++) cand.insert(i); for(i=2; i*i<=MX; i++) { if(sieve[i]) continue; cand.insert(i); for(int j=i; j<MX; j+=i) sieve[j] = i; }...
C++
bf8bbbb225813cdf42e7a2e454f0b787
59f6340af429ef13b8ac02959ea7e9b2
1,900
PASSED
#include <bits/stdc++.h> #define pb push_back using namespace std; const int MAXN = (int)(5e6); bool was[MAXN]; set <int> st; int a[100100]; bool good = true; vector <int> p , g , ans; vector<int> fu(int x){ vector<int> res; for (int j=2; j*j<=x; j++){ if (x % j == 0) res.pb(j); wh...
C++
bf8bbbb225813cdf42e7a2e454f0b787
4d2999f6af94104db1d5952fe41080b7
1,900
PASSED
#include <iostream> #include <vector> #include <set> using namespace std; vector<int> d[2000005]; set<int> s; bool p[2000005],er[2000005]; int main() { int n; scanf("%d",&n); for (int i=2;i<2000005;i++) { if (!p[i]) { for (int x=i;x<2000005;x+=i) { ...
C++
bf8bbbb225813cdf42e7a2e454f0b787
c1c24159524dcce0ffa921cbabcd8f08
1,900
PASSED
#include<bits/stdc++.h> #define ll long long #define int long long #define inf (1LL<<61) #define fi first #define se second #define pb push_back #define pa pair<int,int> #define mkp(a,b) make_pair(a,b) const int N=2e6+10; const ll mod=1e9+7; int dir[4][2]={0,1,1,0,0,-1,-1,0}; using namespace std; set<int>s; int a[N],...
C++
bf8bbbb225813cdf42e7a2e454f0b787
776df2218d249ce6cf303a53c13e5de7
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define printvector(v,n) for(int i=1;i<=n;i++) cout<<v[i]<<" "; cout<<ln; #define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," ")) #define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," ")) #define forstl(i,v) for(auto &i: v) #define forn(i,e) for(...
C++
bf8bbbb225813cdf42e7a2e454f0b787
c434dbd4b1d48e16cc5d5b3a67dceba7
1,900
PASSED
#include <iostream> #include <algorithm> #include <cstdio> #include <stack> #include <string> using namespace std; #pragma warning(disable:4996) typedef long long LL; int main() { int n, x, y, p, q, ans, g; cin >> n; x = 0, y = 0; ans = 1; for (int i = 1; i <= n; i++) { cin >> p >> q; if (x == y) g = -1; ...
C++
5b84295330fa07a9b42570766012990b
d192482ba12ba339ccfce671f2e69fe7
1,400
PASSED
#include<iostream> using namespace std; int main() { long long ans = 1; int n; cin>>n; long long a1 = 0, b1 = 0; long long a2 = 0, b2 = 0; while(n--) { a1 = a2; b1 = b2; cin>>a2>>b2; if(a2 == a1&&b2 == b1) continue; if(a1 > b1) { if(min(a2, b2) < a1) continue; else ans += (min(a2, ...
C++
5b84295330fa07a9b42570766012990b
2be1241f1f4a0d33b664d849f6ccd104
1,400
PASSED