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; int pre[130],d[130],n,shu[130],t1,t; void init(){ for(int i=0;i<=n;i++) pre[i]=i; } int findd(int x){ if(x!=pre[x]) return findd(pre[x]); else return x; } void jia(int x,int y){ x=findd(x); y=findd(y); pre[x]=y; return; } int main(){ cin>>n; for(int i=1;i<=n;i++) sca...
C++
c4b7265ff4332225c0d5617c3233a910
9768ce89342ba795d9725e0d70c6ba49
1,600
PASSED
#include <bits/stdc++.h> namespace FastIO { template <typename T> inline void readInteger(T& ret) { char ch = getchar(); bool flag = false; while ((ch<'0' || ch>'9') && ch!='-') ch=getchar(); if (ch == '-') { flag = true; ch = getchar(); } ret = 0; while (ch>='0' && ch<='9') { ret = ret*10 + (...
C++
2ba73e9b1359a17d10cf2f06a30c871d
7a34810239b3710473b8476d1b783fee
2,600
PASSED
#include <cstdio> #include <cassert> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <algorithm> #include <vector> #include <map> #include <set> #include <climits> #include <cctype> #include <utility> #include <queue> #include <cmath> #include <complex> using namespace std; typedef ...
C++
2ba73e9b1359a17d10cf2f06a30c871d
0354e8beb6d01d8716d4df1d479bf83c
2,600
PASSED
#include <iostream> #include <cstdio> #include <vector> #include <set> #include <deque> #include <algorithm> #include <queue> #include <cmath> #include <map> #include <complex> #include <cstring> #include <bitset> //#include "sdf.hpp" using namespace std; #define rep(i, a, b) for(int i = (a); i < (b); i++) #define rep...
C++
2ba73e9b1359a17d10cf2f06a30c871d
cb1112adfa3468ff7d0adb68fa0673ae
2,600
PASSED
#include <cstdio> #include <iostream> #include <vector> #include <set> #include <map> #include <cmath> #include <string> #include <cstring> #include <sstream> #include <algorithm> using namespace std; typedef pair <int, int> ii; typedef long double ld; typedef pair <ld, int> ldi; const int Maxn = 505; const int Maxd ...
C++
2ba73e9b1359a17d10cf2f06a30c871d
00cdfc805ea82506d30b14a5eb43d7ce
2,600
PASSED
#include <bits/stdc++.h> #define eps 1e-7 #define sq(x) ((x)*(x)) #define x1 kakaskakas #define x2 jmjjmjjmjj #define y1 spiderspid #define y2 likolikoli #define inf 0x3f3f3f3f using namespace std; template<class T> inline void smin(T &a, T b) {if(a>b) a=b;} template<class T> inline void smax(T &a, T b) {if(a<b) a=b;...
C++
2ba73e9b1359a17d10cf2f06a30c871d
ca0ebb7932e6722c7bcd146a3936790f
2,600
PASSED
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define fo(i,a,b) for(int i=a;i<=b;i++) #define fd(i,a,b) for(int i=a;i>=b;i--) #define maxn 505 #define mem(a,b) memset(a,b,sizeof(a)) using namespace std; int a[maxn][maxn]; int n,tot,sum; bool bz[maxn*maxn]; struct poi{ int x,y; }s[maxn *...
C++
2ba73e9b1359a17d10cf2f06a30c871d
eea6e090076e27660c4b835614bf31fc
2,600
PASSED
#include<bits/stdc++.h> using namespace std; const int N=505; struct point { int x,y; }p[N*4]={}; bool point_cmp(const point &p1,const point &p2) { return p1.x<p2.x || (p1.x==p2.x && p1.y<p2.y); } int n,m=0,s[N*4]={},top=0; char ch[N][N]={}; void init() { //scanf("%d",&n); for(int i=0;i<N;++i) for(int j=0;j<N;++j...
C++
2ba73e9b1359a17d10cf2f06a30c871d
76ef40007b0c9112d8d4efd720dbe55f
2,600
PASSED
#include<bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; struct Point{ int x,y; Point operator -(Point b){ Point ret; ret.x=x-b.x; ret.y=y-b.y; return ret; } int operator ^(Point a){ return x*a.y-y*a.x; } }; bool cmp(Point a,Point b){ return a.x==b.x?a.y<b.y:a.x<b.x; } bool ...
C++
2ba73e9b1359a17d10cf2f06a30c871d
a76e48a01bd3e71f53568b2a2fa3ffb4
2,600
PASSED
#include <bits/stdc++.h> using namespace std; #define M 510 #define ep 1e-9 typedef pair <int, int> PII; char s[M][M]; int n, a[M][M], id[M * M]; int dx[] = {-1, -1, 0, 0}; int dy[] = {-1, 0, -1, 0}; double ang[M * M]; vector <PII> v; PII con[M * M]; PII operator - (PII a, PII b) { return PII(a.first - b.firs...
C++
2ba73e9b1359a17d10cf2f06a30c871d
f77e6f93ee5d0b51c17bef71b343ed29
2,600
PASSED
#include <iostream> #include <vector> #include <algorithm> #define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++) using namespace std; typedef long long ll; struct P { double x, y; P() {} P(double x, double y): x(x), y(y) {} P operator+(P p) { return P(x + p.x, y + p.y); } P operator-(P p) { return P...
C++
2ba73e9b1359a17d10cf2f06a30c871d
c6872b08b671562232a67fe81adefbf0
2,600
PASSED
#include <cstdio> int main(){ int t ; scanf ("%d",&t) ; while(t --){ int n , m , p ; scanf ("%d%d%d",&n,&m,&p) ; if (n > m+p) printf ("%d\n",p+1) ; else if (m > n+p) printf ("0\n") ; else printf ("%d\n",(p+1+n-m)/2) ; } return 0 ; }
C++
0816295355375a2d3f1cd45852b86360
46ff3f2315b4f18f883ada8169bf8135
1,300
PASSED
#include <cstdio> int stre, inte, expe; int bs(int l, int r) { while (l < r) { int mid = l + r >> 1; if (stre + mid > inte + (expe - mid)) r = mid; else l = mid + 1; } return l; } int main() { int q; scanf("%d", &q); while (q --) { scanf("%d%d%d", &stre, &inte, &expe); if (expe == 0) { if (stre > ...
C++
0816295355375a2d3f1cd45852b86360
3493165be08b3c9c3de8655029ff260d
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t) { int a, b, k; cin >> a >> b >> k; int ans = 0; double temp = (b + k - a)/2.0; //cout<<"temp "<<temp<<endl; if(temp >= 0 ) { int f = floor(temp); ans = k - f; } else { //int c = floor(temp); //cou...
C++
0816295355375a2d3f1cd45852b86360
b6491e4a855b22ad31a2ae77c3fcd7ea
1,300
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define INF 1e9 + 5 #define MOD 1000000009 int main(){ int n; cin >> n; for(int i = 0; i < n; i++) { ll str, in, ex; cin >> str >> in >> ex; ll ans = 0; ll temp = str + ex; if(temp <= in) { ans = 0; } else if (ex < str - in) { ans...
C++
0816295355375a2d3f1cd45852b86360
aca5e3d115afb320bca84b9a428451e7
1,300
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define ll long long int int main() { ll n; cin>>n; //scanf("%d",&n); ll a,b,c; for(int i = 1;i <= n;++i) { ll ans = 0; cin>>a>>b>>c; ans = (a + c - b)/2; if((a + c - b)...
C++
0816295355375a2d3f1cd45852b86360
4cc7a50bc42c423940448d0ece4897d7
1,300
PASSED
#include <iostream> #include <bits/stdc++.h> using namespace std; int t; void handle(long long str, long long intell, long long exp){ long long minAddStr = (intell + exp - str + 2)/(long long)2; minAddStr = max((long long)0, minAddStr); cout << max((long long)0, exp - minAddStr + 1) << endl; return; }...
C++
0816295355375a2d3f1cd45852b86360
a9bf888f23cd36db50c0447fb11a7c31
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; while(n--) { long long int first,second,third; cin>>first>>second>>third; if(first>second && third==0) printf("%d\n",1); else if(second<=first && third==0) printf("%d\n"...
C++
0816295355375a2d3f1cd45852b86360
1e411dee74fe76c053377311b09a39ca
1,300
PASSED
#include <iostream> #include <vector> #include <utility> #include <algorithm> #include <iomanip> #include <cmath> #include <functional> #include <map> #include <queue> #include <string> #include <deque> #include <set> #include <bitset> #include <cstring> #include <unordered_map> //#include <bits/stdc++.h> using na...
C++
0816295355375a2d3f1cd45852b86360
5a3934913943409cd9d0ebbf79da6639
1,300
PASSED
#include <iostream> #include <vector> using namespace std; vector<long long>answers; long long check(long long st,long long in,long long exp) { long long cross; long long res; cross=(st+in+exp)/2; res=(st+exp)-cross; if(st>cross || in+exp<cross) res=exp+1; return res; } int main() { ...
C++
0816295355375a2d3f1cd45852b86360
2ed9a2f1e596e0f6f8a533f5ca6c13f4
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define error(args...){string _s=#args;replace(_s.begin(), _s.end(), ',', ' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);err(_it,args);} void err (istream_iterator<string> it) {} template <typename T, typename... Args> void err (istream_iterator<string> ...
C++
0816295355375a2d3f1cd45852b86360
85275b742c7eb8c7a2ce0a41a972a443
1,300
PASSED
import java.io.*; import java.util.*; public class CF { public static void main(String[] args) throws IOException{ Scanner in=new Scanner(System.in); int n=in.nextInt(); int[] A=new int[n]; for(int i=0;i<n;i++) { A[i]=in.nextInt(); } int m=in.nextInt(); int[] B=new int[100+100]; for(int i=0;i<...
Java
62766ef9a0751cbe7987020144de7512
8ff108ef5e0bbd4fa3f95d5bf4f42216
1,200
PASSED
/*Author LAVLESH*/ import java.util.*; import java.io.*; public class main{ static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st=new StringTokenizer(""); static public String next() { while (st == null || !st.hasMoreTokens()) { try { ...
Java
62766ef9a0751cbe7987020144de7512
b808b766da014b0dd6f59371c81efa24
1,200
PASSED
import java.io.*; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Random; public class CF489 { static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test"; public static void main(String args[]) { InputReader inputReader = Helper.r...
Java
62766ef9a0751cbe7987020144de7512
47004132a84fdeee857a06bf04d6bcb7
1,200
PASSED
import java.io.*; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Random; public class CF489 { static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test"; public static void main(String args[]) { InputReader inputReader = Helper.r...
Java
62766ef9a0751cbe7987020144de7512
3ee3dbb2cb3d208a3bbd412e33a9f232
1,200
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class CF489 { // static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test"; public static void main(String args[])...
Java
62766ef9a0751cbe7987020144de7512
6cb0e2afd7acb94687778358acaa6609
1,200
PASSED
import java.io.*; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Random; public class CF489 { static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test"; public static void main(String args[]) { InputReader inputReader = Helper.r...
Java
62766ef9a0751cbe7987020144de7512
4ea140240f7fcc783877c00836792be7
1,200
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class CF489 { // static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test"; public static void main(String args[])...
Java
62766ef9a0751cbe7987020144de7512
6b0d8c48afa8f11ee214f6bfbaeb75fe
1,200
PASSED
import java.io.*; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Random; import java.util.StringTokenizer; public class CF489 { // static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test"; public static void main(String args[]) throws I...
Java
62766ef9a0751cbe7987020144de7512
065e37a8b9df0881d3cc3da2e3258efd
1,200
PASSED
import java.io.*; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Random; import java.util.StringTokenizer; public class CF489 { // static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test"; public static void main(String args[]) throws I...
Java
62766ef9a0751cbe7987020144de7512
f96164e004e7fa5679f9671e2f68450b
1,200
PASSED
import java.io.*; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Random; import java.util.StringTokenizer; public class CF489 { static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test"; public static void main(String args[]) throws IOE...
Java
62766ef9a0751cbe7987020144de7512
68c2bb97bc83a97bb75a59d5f71431c4
1,200
PASSED
#include <iostream> #include <stdio.h> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> #include <vector> #include <cstring> #include <cstdlib> #include <math.h> #include <deque> #include <list> #include <complex> using namespace std; const int MAX = 1005; const int oo = 1e9+7; const...
C++
00b27a7d30bf2e200bdecd3ae74433c7
f5485e5220578c8daff16cfdb5597094
1,900
PASSED
#include <iostream> #include <stdio.h> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> #include <vector> #include <cstring> #include <cstdlib> #include <math.h> #include <deque> #include <list> #include <complex> using namespace std; const int MAX = 1005; const int oo = 1e9+7; const...
C++
00b27a7d30bf2e200bdecd3ae74433c7
84f16f9ebbd3b9b5681d688fe027a47e
1,900
PASSED
/* ID: keyvank2 TASK: combo LANG: C++ */ #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define mp make_pair #define FOR(i,j,k) for(int i = j; i < (int)(k); i++) #define FORV(i, v) FOR(i, 0, ((v).size())) #define REP(i,j,k) for(int i = j; i >= (int)(k); i--) #define setmax(i) const i...
C++
00b27a7d30bf2e200bdecd3ae74433c7
f0777d9fad1beddbc54d15c50a309977
1,900
PASSED
#include<algorithm> #include<cstdio> #include<iostream> #define inf 1000000000 using namespace std; typedef long long ll; ll read() { ll x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } int n; struct data{int w,h;}a[10...
C++
00b27a7d30bf2e200bdecd3ae74433c7
20d2f833b1763c20cab2ab2bf35e3e5f
1,900
PASSED
#include<bits/stdc++.h> using namespace std; const int MAXN = 1005; struct data{ int w,h; bool operator < (const data &p) const{ return (w - h) > (p.w - p.h); } }pic[MAXN]; bool havechanged[MAXN]; int n,all[MAXN * 2]; int main() { scanf("%d",&n); for(int i = 1; i <= n; ++i){ scanf("%d %d",&pic[i].w,&pic[i].h);...
C++
00b27a7d30bf2e200bdecd3ae74433c7
280fee4d3e36a3f88a2c61c4e5c84741
1,900
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<set> using namespace std; int n,h[1003],w[1003]; multiset<int> se; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d%d",&w[i],&h[i]); int ans=1<<30; int sum=0; for (int i=1;i<=n;i++) sum+=w[i]; for ( int i=1;...
C++
00b27a7d30bf2e200bdecd3ae74433c7
8ab0d54a5f63b1f9d5bb098d92eb7c9f
1,900
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<set> using namespace std; int n,h[1003],w[1003]; multiset<int> se; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d%d",&w[i],&h[i]); int ans=1<<30; int sum=0; for (int i=1;i<=n;i++) sum+=w[i]; for ( int i=1;...
C++
00b27a7d30bf2e200bdecd3ae74433c7
7943bd29e5c07b38a230fa8b92f16e0f
1,900
PASSED
#include <bits/stdc++.h> #define FOR(i, a, b) for(int i = a; i <= b; ++i) #define FRD(i, a, b) for(int i = a; i >= b; --i) #define FR(i, a) for(int i = 0; i < a; ++i) #define REP(i, a) for(int i = 0; i <= a; ++i) #define pb push_back #define sz(x) (int)x.size() #define reset(a, b) memset(a, b, sizeof a) #define bug(x)...
C++
00b27a7d30bf2e200bdecd3ae74433c7
50d41cc6493342bb7f97958f362578f6
1,900
PASSED
#include <cstring> #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 <fstream> #include <iostream> #include <iomanip> #include <...
C++
00b27a7d30bf2e200bdecd3ae74433c7
9d95ec508bd059c87defd321a52be427
1,900
PASSED
#include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <string> #include <iostream> #include <algorithm> using namespace std; #define MEM(a,b) memset(a,b,sizeof(a)) #define REP(i,n) for(int i=0;i<(n);++i) #defi...
C++
00b27a7d30bf2e200bdecd3ae74433c7
783dc8838cd92fb49cc9b7d812d616a3
1,900
PASSED
#define _CRT_SECURE_NO_WARNINGS #include<bits/stdc++.h> using namespace std; const long long OO = 1e6; const long long mod = 1e9 + 7; const double EPS = (1e-7); int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; } void fast(){ #ifndef ONLINE_JUDGE freopen("F:\\solving\\input.txt", "r", s...
C++
5dbf91f756fecb004c836a628eb23578
8c2e5fa7f32f9304e6e6d44b212836dc
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int MAX = 310; int dis[MAX][MAX],n,k,v1,v2,w; int main() { cin >> n; for (int i = 0; i < n ; ++i) { for (int j = 0 ; j < n ; ++j) { cin >> dis[i][j]; } } cin ...
C++
5dbf91f756fecb004c836a628eb23578
9746b09f9834cf01e122787a661de989
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int MAX = 310; int dis[MAX][MAX],n,k,v1,v2,w; int main() { scanf("%d",&n); for (int i = 0; i < n ; ++i) { for (int j = 0 ; j < n ; ++j) { ...
C++
5dbf91f756fecb004c836a628eb23578
4cf4aad2dd86e415d165ed1ea8ae2fb7
1,900
PASSED
#include <map> #include <set> #include <list> #include <queue> #include <stack> #include <math.h> #include <vector> #include <cstring> #include <iostream> #include <algorithm> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> ii; #define x first #define y second #define endl "\n" #d...
C++
5dbf91f756fecb004c836a628eb23578
9d400e1f3968be855e39dadbcca88b40
1,900
PASSED
/*****Be Name Khoda*****/ #include <bits/stdc++.h> #define int long long #define endl '\n' using namespace std; const int MAXN = 3e2 + 10; int d[MAXN][MAXN] , n , k; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) c...
C++
5dbf91f756fecb004c836a628eb23578
8715a81dca58717fedcc11a6f04857ad
1,900
PASSED
#include<iostream> #include<string> #include<cmath> #include<vector> using namespace std; int main(){ int n; cin>>n; int adj[n+1][301]; for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) cin>>adj[i][j]; int k; cin>>k; int a,b,c; ...
C++
5dbf91f756fecb004c836a628eb23578
a8cb1c2199c5e4c7f631ed032e00d2a2
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define all(x) x.begin(), x.end() typedef long long ll; typedef unsigned long long int ull; typedef long double ld; typedef pair<int, int> pii; typedef pair<int, pii> piii; typedef pair<ll, int> pli; typedef pair<...
C++
5dbf91f756fecb004c836a628eb23578
94025e27df9e3087060c8a1611ac674e
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define all(x) x.begin(), x.end() typedef long long ll; typedef unsigned long long int ull; typedef long double ld; typedef pair<int, int> pii; typedef pair<int, pii> piii; typedef pair<ll, int> pli; typedef pair<...
C++
5dbf91f756fecb004c836a628eb23578
e57603e9d993adaf20822859f810d91f
1,900
PASSED
#include <bits/stdc++.h> #define file "" #define all(x) x.begin(), x.end() #define sc second #define fr first #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef pair<int, int> pii; const int inf = 1e9; const int MOD = 1e9 + 7; const int dx[] = {+1, -1, 0, 0}; const int ...
C++
5dbf91f756fecb004c836a628eb23578
a7649dd58aead9d4f8e7bf0b822820ec
1,900
PASSED
///Astalavista Code........~CodeSlayer007 #include <bits/stdc++.h> using namespace std; #define endl "\n" #define Br cout<<endl #define pb push_back #define mp make_pair #define fe first #define se second #define int long long #define double long double #define all(v) v.begin(),v.end() #define allr(v) v.rbegin(),v.rend...
C++
5dbf91f756fecb004c836a628eb23578
0c6f51d1ffaeaf960eb55937c5d1a37c
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef pair <int, int> pii; #define X first #define Y second #define mp make_pair const int maxn = 1000 * 1000 + 321; int n, m, s, t, deg[maxn], dp[maxn], cnt; vector <int> adj[maxn]; bool mark[maxn]; queue <int> path; vector <int> active; void bfs() { while(!path...
C++
f0bf3024cce07b84d70ea3490dcb0579
4f599d12897f24ddec4266a29979c5e7
2,600
PASSED
#include <bits/stdc++.h> #include <cassert> using namespace std; typedef long long ll; typedef long double ld; #define rep(i,s,e) for (int i=(s);i<(e);++i) #define all(x) begin(x),end(x) #define clr(x,y) memset(x,y,sizeof x) #define contains(x,y) ((x).find(y)!=end(x)) #define pb push_back #define T tuple #define mk mak...
C++
f0bf3024cce07b84d70ea3490dcb0579
183521cf89d6e9d2ff9cdedabe19cb28
2,600
PASSED
#include <cstdio> #include <deque> #include <cstring> #include <algorithm> using namespace std; const int maxn = 1e6 + 8; int n, m, S, T, f[maxn], deg[maxn]; deque<int> Q; bool vis[maxn]; struct Edge {int v; Edge *n; Edge() {}} *h[maxn]; inline void AddEdge(int u, int v) { Edge *x = new Edge(); x->v = v; x->n = h[...
C++
f0bf3024cce07b84d70ea3490dcb0579
a761f488107ac5ecb7f91f0dbc29b7c9
2,600
PASSED
#include <cstdio> #include <vector> #include <cstring> #include <queue> #include <algorithm> using namespace std; const int INF = 1000000007; int dp[1000005]; bool v[1000005]; vector<int> e[1000005]; vector<int> r[1000005]; int main(){ int n,m,s,t; scanf("%d%d",&n,&m); for(int i=0;i<m;i++){ scanf...
C++
f0bf3024cce07b84d70ea3490dcb0579
156aca7b10c9e761a6668a5e037598be
2,600
PASSED
//ITNOG #include <bits/stdc++.h> using namespace std; #define int long long const int maxN = 1000*1000 + 5; const int mod = 1000*1000*1000 + 7; vector<int> a[maxN]; vector<int> c[maxN]; int dis[maxN], ou[maxN]; main() { ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; for(int i = 0; i < m; i ...
C++
f0bf3024cce07b84d70ea3490dcb0579
10e27b978026ed8fc68edc8c9bf03cde
2,600
PASSED
#include <iostream> #include <sstream> #include <iomanip> #include <vector> #include <string> #include <map> #include <set> #include <algorithm> #include <numeric> #include <iterator> #include <functional> #include <complex> #include <queue> #include <stack> #include <cmath> #include <cassert> #include <tuple> using na...
C++
f0bf3024cce07b84d70ea3490dcb0579
4be1f333162c421446e9287553a2f10d
2,600
PASSED
#include <cstdio> #include <cstdlib> #include <algorithm> #include <vector> #include <cstring> #include <queue> #include <deque> #define SIZE 1000005 using namespace std; vector <int> rvec[SIZE]; int dp[SIZE],deg[SIZE]; bool up[SIZE]; int main() { int n,m; scanf("%d %d",&n,&m); for(int i=0;i<m;i++) { int a,b; ...
C++
f0bf3024cce07b84d70ea3490dcb0579
59350be5a500e3ae2c1746e5d765ede4
2,600
PASSED
#include <cstring> #include <iostream> #include <algorithm> #include <queue> #include <vector> using namespace std; int N, M, A, B; vector<int> V[1000002], W[1000002]; queue<int> Q; bool inQ[1000002]; int minC[1000002]; int main() { cin.sync_with_stdio(false); cin >> N >> M; for (int i = 1, nod1, n...
C++
f0bf3024cce07b84d70ea3490dcb0579
34f50e5da6ecb3cb57a0519d1892ffc7
2,600
PASSED
#include <cstdio> #include <string.h> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <set> #include <queue> #include <functional> using namespace std; typedef long long ll; const int MX=1001*1001; int n, m, s, t, ql, qr, d[MX], q[MX*2], de[MX]; set<int> nd; vector<i...
C++
f0bf3024cce07b84d70ea3490dcb0579
6c5ac1fbb1e5db7a52c56f5569e56609
2,600
PASSED
#include <bits/stdc++.h>/*{{{*/ using namespace std;typedef long long ll;typedef long double real;void run();int main(){ios::sync_with_stdio(0);run();}/*}}}*/ #define INF 2000000 #define MAN 1000000 int cost[MAN]; int deps[MAN]; vector<int> back[MAN]; vector<int> edge[MAN]; vector<int> expand[MAN+2]; set<pair<int,int...
C++
f0bf3024cce07b84d70ea3490dcb0579
d6d971f7e5d804056dd18a322a6886f0
2,600
PASSED
#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> using namespace std; const int maxn = 200005; int a[maxn]; int r[maxn]; int ans1[maxn]; int ans2[maxn]; int main() { int n; scanf("%d", &n); int x; memset(r, 0, sizeof(r)); for(int i = 0; i < n;i++) { scanf("%d"...
C++
cdb19d87ad3713dac104252737153411
2730fbcca54845172f5d83c0149eb282
1,000
PASSED
#include<iostream> #include <algorithm> #include<stdio.h> #include <sstream> #include <cstdio> #include<fstream> #include<algorithm> #include<vector> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #...
C++
cdb19d87ad3713dac104252737153411
4265a80e39dab09fad6431f7cedaae58
1,000
PASSED
#include <iostream> #include <cmath> #include <vector> #include <algorithm> using namespace std; int main() { vector <int> in,dec; short b[200001]; for (int i = 0; i < 200001; i++) { b[i] = 0; } int n,now; cin >> n; for (int i = 0; i < n; i++) { cin >> now; b[now]++; if (b[now] == 1) in.push_back(...
C++
cdb19d87ad3713dac104252737153411
d63421d42aa006787d59d37204b1bbb3
1,000
PASSED
#include<iostream> #include<stdio.h> #include<vector> #include<string> #include<algorithm> using namespace std; int a[200000]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) scanf_s("%d", &a[i]); sort(a, a + n); if (n >= 3) { int flag = 0; for (int i = 2; i < n; i++) if (a[i] == a[i - 1] && ...
C++
cdb19d87ad3713dac104252737153411
2aab5b050b6e6ac66ddf1a6940394ece
1,000
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <string> #include <list> using namespace std; int main() { int N; cin >> N; vector<int> shuffled, inc, dec, values(200005, 0); shuffled.reserve(N); bool t = true; for (int i = 0; i < N; i++) { int Ai; cin >> Ai; shuffled....
C++
cdb19d87ad3713dac104252737153411
c042e0280a9f64941d8d4fc7e3b76361
1,000
PASSED
#include <stdio.h> #include <iostream> #include <algorithm> #include <string> #include <vector> using namespace std; int main() { // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); int n; cin >> n; int c[2*100000]; for (int i = 0; i < n; i++) { cin >> c[i]; } sort(c, c + n); bool g[2...
C++
cdb19d87ad3713dac104252737153411
6842371bd143362bf55c58548e58f8bc
1,000
PASSED
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <set> using namespace std; int main() { int n, temp, prev1, prev2; prev1 = -1; prev2 = -1; vector <int> v, v1, v2; cin >> n; for (int i = 0; i < n; i++) { cin >> temp; v.push_back(temp); } sort(v.begin(), v.end()); for...
C++
cdb19d87ad3713dac104252737153411
a90f4c42213d17156f77d36fe0eaacf6
1,000
PASSED
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <deque> using namespace std; int main() { long long n; cin >> n; vector<long long> a(n); deque<long long> b1; deque<long long> b2; for(long long i = 0; i<n; i++){ cin>>a[i]; } sort(a.begin(), a...
C++
cdb19d87ad3713dac104252737153411
c0993d6ee075604c533749f660cb6f51
1,000
PASSED
#include "iostream" #include "vector" using namespace std; int compare(const void * x1, const void * x2); int main() { int n; cin >> n; int * arr = new int[n]; for (int i = 0; i < n; i++) cin >> arr[i]; qsort(arr, n, 4, compare); if (n == 1) { cout << "Yes" << endl; cout << "1" << endl; cout << arr...
C++
cdb19d87ad3713dac104252737153411
b92c66c21280b24b6c068f7779a0e8e9
1,000
PASSED
#include<iostream> #include<cstdio> #include<string> #include<algorithm> #include<map> #include<set> using namespace std; int main() { int n, str[200005], i, flag = 1, sizes1, sizes2; map<int, int> mp; map<int, int>::iterator it; set<int> s1, s2; set<int>::iterator iter; scanf("%d", &n); for (i = 0; i < n; i++) ...
C++
cdb19d87ad3713dac104252737153411
3a0ebc3944afe036251a01d3610d6d43
1,000
PASSED
#include <cstdio> #include <algorithm> #include <cmath> #include <iostream> #include <queue> #include <set> using namespace std; int n, w[1000005]; class cmp{ public: bool operator()(const int& a, const int& b) const{ return a > b; } }; priority_queue<int,vector<int>,cmp> pq; int main(){ while (~scanf_s("%d...
C++
089eea1841ef10064647e61094c374fd
f09487fb79ff0f36b99bc21bd1e40fe4
1,500
PASSED
#include <cstdlib> #include <cstring> #include <map> #include <set> #include <string> #include <stdio.h> #include <ctype.h> #include <iostream> #include <fstream> #include <math.h> #include <sstream> #include <vector> #include <functional> #include <algorithm> #include <stack> #include <queue> #define INF 1111111111 #...
C++
089eea1841ef10064647e61094c374fd
bdff7026f8bebe07d9dded2a0944810e
1,500
PASSED
#include <iostream> #include <algorithm> using namespace std; const int MAX = 1000031; int main() { int s[MAX] = { 0 }; int n; cin >> n; for (int i = 0; i < n; i++) { int a; cin >> a; s[a]++; } int ans = 0; for (int i = 0; i < MAX; i++) { if (s[i] >= 2) { s[i + 1] += s[i] / 2; s[i] %= 2; ...
C++
089eea1841ef10064647e61094c374fd
35279f4bd2554a051ec72de29493f7c2
1,500
PASSED
#include <stdio.h> #include <string.h> #include <algorithm> using namespace std; const int maxn = 1000100; int a[maxn]; int hash1[maxn]; int main() { //freopen("in.txt","r",stdin); int n,i,x; while(~scanf("%d",&n)) { memset(hash1,0,sizeof(hash1)); int cnt = 0; for( i = 0 ; i < n ; i++) { scanf("%d",&a[i...
C++
089eea1841ef10064647e61094c374fd
d8728fe30d7c7e8892ce73481306b8fd
1,500
PASSED
#pragma warning(disable:4996) #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <queue> #include <map> #include <cstdio> #include <stdio.h> using namespace std; typedef long long ll; int n; int val[1000005]; class cmp { public: bool ...
C++
089eea1841ef10064647e61094c374fd
4475dd9217facac54af184af36cd2a72
1,500
PASSED
#include<iostream> #include<string.h> #include<algorithm> int a[1001000]; using namespace std; int main() { int n; while(cin>>n) { memset(a,0,sizeof(a)); for(int i=0;i<n;i++) { int t; cin>>t; a[t]++; } int s=0; for(int i=0;i...
C++
089eea1841ef10064647e61094c374fd
320599832647f29dde3ac989a41ebe32
1,500
PASSED
#include<iostream> #include<cstdio> #include<string> #include<cstring> #include<cstdlib> #include<cmath> #include<queue> #include<vector> #include<stack> #include<algorithm> #include<set> #include<map> using namespace std; int flag[2000005],ans; int main(){ int i,j,m,T,n,t; scanf("%d",&n); for(i=1;i<=n;i++)...
C++
089eea1841ef10064647e61094c374fd
0e9daf8c96e5280eeed8c4f339122135
1,500
PASSED
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main(){ int n; cin>>n; int i,j; vector <int> a(1000001,0); for(int i=0;i<n;i++){ cin>>j; a[j]++; } int res=0; for(i=0;i<1000000;i++){ res+=a[i]%2; a[i+1]+=a[i]/2; } while(a[i]){ res+=a[i]%2; a[i]/=2; } cout<<res;...
C++
089eea1841ef10064647e61094c374fd
b01d0c293a5a25d0db4ce4ec767d05eb
1,500
PASSED
#pragma comment(linker, "/STATK:134217728") #include <cstdio> #include <iostream> #include <map> #include <set> #include <vector> #include <queue> #include <string> #include <algorithm> #include <numeric> #include <functional> #include <cmath> #include <complex> #include <memory.h> #include <time.h> using namespace s...
C++
089eea1841ef10064647e61094c374fd
22b9c0469c4677527b5c310c7be1ef2f
1,500
PASSED
#define USE_MATH_DEFINES #include <vector> #include <set> #include <algorithm> #include <stdio.h> #include <cmath> #include <math.h> #include <queue> #include <map> #include <iomanip> #include <deque> #include <time.h> #include <string> #include <bitset> #include <unordered_set> using namespace std; typedef long long...
C++
089eea1841ef10064647e61094c374fd
62fc08e9d715a218d699432153396d22
1,500
PASSED
#include<bits/stdc++.h> #include <queue> #include <vector> #include <climits> using namespace std; #define ll long long int #define max3(a, b, c) max(a, b) > max(b, c) ? max(a, b) : max(b, c) #define min3(a, b, c) min(a, b) < min(b, c) ? min(a, b) : min(b, c) #define digit(c) (c - '0') #define pb push_back #define mp...
C++
db4775339de9122f1ae0c047fd39220f
7326c807adfc90ddb4401c8b707b272f
1,900
PASSED
#include<bits/stdc++.h> using namespace std; int n, k, a[501]; bitset<501> dp[2][501]; int main(int argc, char **argv) { scanf("%d%d", &n, &k); for(int i=0 ; i<n ; ++i) scanf("%d", a+i); dp[0][0][0] = dp[1][0][0] = true; for(int i=0 ; i<n ; ++i) { int ii = i&1; for(int k1 =0 ; k1 <= k ; ++k1) for(int j=0 ...
C++
db4775339de9122f1ae0c047fd39220f
83badeb8a662d287946ac0f5e9d7a1b1
1,900
PASSED
#include<iostream> #include<vector> using namespace std; bool dp[501][501][501]; int arr[501]; vector<int> v; int main() { int n,k,i,j,m; cin>>n>>k; for(i=1;i<=n;i++) cin>>arr[i]; dp[0][0][0]=1; for(i=1;i<=n;i++) { for(j=0;j<=k;j++) { for(m=0;m<=k;m++) ...
C++
db4775339de9122f1ae0c047fd39220f
f4c9fc3a6360ef3b364b938f7669ecd2
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #ifndef ONLINE_JUDGE #include "../debug.hpp" struct debugger dbg; #else #define debug(args...) // Just strip off all debug tokens #endif #define si(i) scanf("%d",&i) #define si2(i,j) scanf("%d %d",&i,&j) #define si3(i,j,k) ...
C++
db4775339de9122f1ae0c047fd39220f
8dd64a07b9c1fea8e74d0ce296c744b1
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 505; int n,m,w[N],f[2][N][N]; int cnt,s[N]; int main() { //freopen("1.out","w",stdout); int i,j,k,now,las; scanf("%d%d",&n,&m); for(i = 1; i <= n; ++ i) { scanf("%d",&w[i]); s[i] = s[i-1] + w[i]; } f[0][0][0] = true;...
C++
db4775339de9122f1ae0c047fd39220f
03977b867a9a2b5885d0e614d4eab8dc
1,900
PASSED
#include<bits/stdc++.h> #define finc(i,a,b) for (int i = a; i <= b; ++i) #define fdec(i,a,b) for (int i = a; i >= b; --i) #define ms(a, i) memset(a, i, sizeof(a)) #define sqr(a) a * a; using namespace std; const int oo = 1e9 + 7; const int maxn = 502; int m, n, a[maxn]; bool f[maxn][maxn][maxn]; vector <int> res; vo...
C++
db4775339de9122f1ae0c047fd39220f
55a4815cfc408476382085441b560517
1,900
PASSED
#include <cmath> #include <map> #include<fstream> #include<algorithm> #include <iostream> #include<numeric> #include<utility> #include<functional> #include<stdio.h> #include<assert.h> #include<memory.h> #include<bitset> #include <cassert> #include <stack> #include <ctime> #include <vector> #include <cstdlib> #include <...
C++
db4775339de9122f1ae0c047fd39220f
fcc3eece3c8bb2e6b0c3ebae046f593e
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ull unsigned long long #define ll long long #define INF (int)(1e9) #define MAXE 50005 #define MAXV 1005 #define MAXN (int)(3e5+5) #define pb push_back #define MP make_pair #define MOD (ll)(1e9+7) #define EPS 1e-9 #define BASE 257 int N, P; int ps...
C++
db4775339de9122f1ae0c047fd39220f
06264f4b394c59670f2e9d3340c87ecc
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ull unsigned long long #define ll long long #define INF (int)(1e9) #define MAXE 50005 #define MAXV 1005 #define MAXN (int)(3e5+5) #define pb push_back #define MP make_pair #define MOD (ll)(1e9+7) #define EPS 1e-9 #define BASE 257 int N, P; int ps...
C++
db4775339de9122f1ae0c047fd39220f
cd7be8a6b197cb5e583f4cc8d5e2209e
1,900
PASSED
#include <bits/stdc++.h> #define mp make_pair #define ff first #define ss second #define INF 1000000000000000005 #define ll long long #define pb push_back #define MAX 100005 #define mod 1000000007 using namespace std; int n,sum; bool dp[505][505][505],visited[505]; int c[505]; int main(){ cin>>n>>sum; for(int i...
C++
db4775339de9122f1ae0c047fd39220f
9b38ec3a9f1740eca92f76721818b425
1,900
PASSED
#include<iostream> #include<set> #include<algorithm> #include<map> #include<vector> #include<iomanip> #include<cmath> using namespace std; typedef long long ll; typedef long double ld; const int N = int(2e5+10); int used[N], n, m, k; set<pair<int, int> > st; set<int> add, uud; void dfs(int a) { // cout << a...
C++
852e1d776c560a8720d4e9f1762b255f
2b66f4dbf22bb3e88ebf0fd9dfd74043
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int MAXN = 1 << 18; const int INF = 1 << 30; set<int> g[MAXN]; bool vis[MAXN]; bool taken[MAXN]; int zeroJoin(int s, int n) { vector<int> q[2]; set<int> e; for (int i = 1; i <= n; ++i) e.insert(i); vis[s] = true; q[0].push_back(...
C++
852e1d776c560a8720d4e9f1762b255f
1eb9f6d97956c5bc3a6f8839e0b21e0d
1,900
PASSED
#include <bits/stdc++.h> using namespace std; void getComponent(int ind, int visited[], set<int> blocked[], int n, set<int> sequence){ queue<int> q; q.push(ind); while(true){ if(q.size() == 0){ break; } int cur = q.front(); q.pop(); for(set<int>::iter...
C++
852e1d776c560a8720d4e9f1762b255f
0177824d76549549026f781cf0f2f49b
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define filein freopen("in.txt","r",stdin) #define fileout freopen("out.txt","w",stdout) #define all(v) v.begin(),v.end() #define ff first #define ss second #define mod 1000000007 #define mx 300005 #define IOS ios::sync_with_stdio(0...
C++
852e1d776c560a8720d4e9f1762b255f
f00ec2c9be568bbf0cced74745f1140e
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define pii pair<int, int> const int N = 1e5 + 5; map<int,int> mp[N]; set<int> st; int vis[N]; void bfs(int x) { queue<int> Q; Q.push(x); while(!Q.empty()) { int u = Q.front(); Q.pop(); vi...
C++
852e1d776c560a8720d4e9f1762b255f
972a89d3c5e7f279300bdc4d0fd5cd76
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long const int N=1e5+10; set<int>G[N],s; int vis[N]; void bfs(int x) { queue<int>q; q.push(x); s.erase(x); while(q.size()>0) { int y=q.front(); q.pop(); if(vis[y]) continue; vis[y]=1; f...
C++
852e1d776c560a8720d4e9f1762b255f
4a8bee23957885b5333ee4e26bfe8f2c
1,900
PASSED
/*******************************************\ * Name: S. M. Shaheduzzaman(Shajal) * * Begum Rokeya Uniersity, Rangpur * \*******************************************/ #include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cmath> #include<cstring> #include<string> #include<cl...
C++
852e1d776c560a8720d4e9f1762b255f
18dfec1f07b201c43adcecd5ed9414d0
1,900
PASSED
/*******************************************\ * Name: S. M. Shaheduzzaman(Shajal) * * Begum Rokeya Uniersity, Rangpur * \*******************************************/ #include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cmath> #include<cstring> #include<string> #include<cl...
C++
852e1d776c560a8720d4e9f1762b255f
293244700fcf13b470b8f46d1a470dcc
1,900
PASSED
#include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define mp make_pair #define pb push_back #define N 998244353 using namespace std; map<int, bool> graph[100005]; set<int> s, ns; void dfs(int t) { vector<int> v; ns.clear(); for (set<int>::iterator it = s.begin(); it != s.end(...
C++
852e1d776c560a8720d4e9f1762b255f
c418b3f0c5f53a838fd6711fdee64147
1,900
PASSED