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> #define LOG(FMT...) fprintf(stderr, FMT) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; // mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); struct Line { int k; ll b; Line() : k(0), b(0) {} Line(ll b) : k(0),...
C++
78cdbd4869982e417aa7975dd7a9f608
5c271577a9eccaa584a5fc1e0cd02503
3,200
PASSED
#include <cstdlib> #include <cstdio> #include <iostream> #include <cmath> #include <string> #include <cstring> #include <ctime> #include <algorithm> #define N 101000 #define NN 389 typedef long long ll; template <typename T> inline void read(T &x) { x = 0; char c = getchar(); bool flag = false; while (!isdigit(c)) { ...
C++
78cdbd4869982e417aa7975dd7a9f608
39b45ba2daa8b24ef5b3244d29c2ef42
3,200
PASSED
// Legends Never Die. #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned int UI; typedef pair<int, int> pii; #define DEBUG(...) fprintf(stderr, __VA_ARGS__) #define mp make_pair #define fst first #define snd second #define SZ(u) ((int) (u).size()) #define ALL(u) (u).begin(), (u).en...
C++
78cdbd4869982e417aa7975dd7a9f608
efd24d014d99f5b3937100a90a1af493
3,200
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++
78cdbd4869982e417aa7975dd7a9f608
95f5e2ba58422665dfea0ccc93decc37
3,200
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++
78cdbd4869982e417aa7975dd7a9f608
0eeec88ed385c76acf8791c85b3cc771
3,200
PASSED
#include <cstdio> #include <cstdlib> #include <algorithm> #define int long long int n,ch[100001][2],pri[100001],size[100001],root; long long val[100001],add[100001]; inline void pushdown(int x,int y){x?val[x]+=y,add[x]+=y:0;} inline void spread(int x){pushdown(ch[x][0],add[x]),pushdown(ch[x][1],add[x]),add[x]=0;} inli...
C++
78cdbd4869982e417aa7975dd7a9f608
1dd17e58eca056977bbce743a9205616
3,200
PASSED
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include "bits/stdc++.h" using namespace std; #define pb push_back #define F first #define S second #define f(i,a,b) for(int i = a; i < b; i++) #define endl '\n' using ll = long long; using db = long double; using ii = pair<int, int>; const int N = ...
C++
78cdbd4869982e417aa7975dd7a9f608
188d8e856e8927f9e594cc5fc3be5d71
3,200
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int blk=350,N=100000; int n,a[N+10],bel[N+10],L[N/blk+10],R[N/blk+10],tag[N/blk+10],pos[N/blk+10]; ll tag2[N+10]; int tag1[N+10]; class line { public: int k,id; ll b; bool operator <(const line &t)const { return k==t.k?b<t.b:k<t.k; }...
C++
78cdbd4869982e417aa7975dd7a9f608
5df180fb5224a70f2ee04af6b144096b
3,200
PASSED
#include <fstream> #include <iostream> #include <stdio.h> using namespace std; int chess[2000][2000]; long long int diagonali_1[20000]; long long int diagonali_2[20000]; int main() { int n; // cin >> n; scanf("%d", &n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { // cin >> chess[i][j]; // ...
C++
a55d6c4af876e9c88b43d088f2b81817
5bfeeb6b4d4cba633c5fee58d5d146fc
1,900
PASSED
#include <iostream> #include <iomanip> #include <limits> #include <vector> #include <set> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstdio> #include <cstring> #include <numeric> #include <queue> #include <sstream> #include <map> #include <stack> #include <cstdio> #include <stdexcept> #include <...
C++
a55d6c4af876e9c88b43d088f2b81817
e18dea8fc1b796e1f8235b7126cc219c
1,900
PASSED
#include <iostream> using namespace std; typedef long long ll; const int MAXN = 2005; int N; int mat[MAXN][MAXN]; ll nw_se[4 * MAXN]; // indexed by c - r (goes from -(N-1) to +(N-1)) ll sw_ne[4 * MAXN]; // indexed by c + r (goes from 0 to 2*(N-1)) inline ll get_value(int r, int c) { return nw_se[MAXN + c - r] +...
C++
a55d6c4af876e9c88b43d088f2b81817
ef1eaff954716bf3cbd8a69face0ce2a
1,900
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <map> #include <cmath> #include <fstream> #include <set> #include <queue> #include <iomanip> #include <functional> #include <string.h> #include <unordered_set> #include <bitset> #include <ctime> using namespace std; const double eps ...
C++
a55d6c4af876e9c88b43d088f2b81817
268d2e72efcb33e74ab4f6f093ec86b6
1,900
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <map> #include <cmath> #include <fstream> #include <set> #include <queue> #include <iomanip> #include <functional> #include <string.h> #include <unordered_set> #include <bitset> #include <ctime> using namespace std; const double eps ...
C++
a55d6c4af876e9c88b43d088f2b81817
a0ddf64e647cfda7f8fbbba5d1e0c6dc
1,900
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <map> #include <cmath> #include <fstream> #include <set> #include <queue> #include <iomanip> #include <functional> #include <string.h> #include <unordered_set> #include <bitset> #include <ctime> using namespace std; const double eps ...
C++
a55d6c4af876e9c88b43d088f2b81817
712485106cc0efb5c5dbccf8171cff06
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; #define MAX numeric_limits<int>::max() #define MIN numeric_limits<int>::min() #define MOD 1000000007 ll board[2002][2002]; ll cum[2002][2002]; ll cum2[2002][2002]; int main() { ios_base::sync_with_stdio(false); int n; pair<int,int>p[2]; ...
C++
a55d6c4af876e9c88b43d088f2b81817
c7a6722a9b920e34443a240941c7a626
1,900
PASSED
//copied ...solution provided by problem setter #include <iostream> #include <cstdio> using namespace std; const int NMAX = 2014; long long d1[2*NMAX], d2[2*NMAX], sol[2]; pair < int , int > v[2]; int a[NMAX][NMAX]; inline void Update(const int c,const int i,const int j,const long long val){ if(val > sol[c]){ ...
C++
a55d6c4af876e9c88b43d088f2b81817
2043abd27d08d9b62fc69a9cd3640f77
1,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int ll; #define MAX numeric_limits<int>::max() #define MIN numeric_limits<int>::min() #define MOD 1000000007 ll board[2002][2002]; ll cum[2002][2002]; ll cum2[2002][2002]; int main() { int n; pair<int,int>p[2]; //cin>>n; scanf("%d",&n); ...
C++
a55d6c4af876e9c88b43d088f2b81817
e48e97082cbe8cf1ada3e4178bf6a915
1,900
PASSED
#include<iostream> using namespace std; int n; long long max1,max2; int a[2010][2010]; long long d1[4010],d2[4010]; int ansx1=1,ansy1=1,ansx2=1,ansy2=2; long long sum(int x, int y) { return d1[n+y-x]+d2[x+y-1]-a[x][y]; } int main() { ios_base::sync_with_stdio(0); cin>>n; for(int i=1;i<=n;i++) for(int j=1;j<=n...
C++
a55d6c4af876e9c88b43d088f2b81817
2393e2595acc514fea293f89b444067a
1,900
PASSED
#include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; inline char nc() { static char buf[100000], *l = buf, *r = buf; return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++; } template<class T> void read(T &x)...
C++
f5e23ee7d82a91b4f1a2cb301e59d8ec
c82c0deb7afe3ba356971279ef0f0915
2,200
PASSED
#include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <stack> #include <queue> #include <set> #include <cstring> #include <map> #include <cstdlib> #include <ctime> #include <cassert> #include <bitset> #define f first #define s second #define ll long lon...
C++
f5e23ee7d82a91b4f1a2cb301e59d8ec
7257aa39bee1f82789724c149dbb86d0
2,200
PASSED
#include <iostream> #include <cassert> #include <cstring> #include <cstdlib> #include <cstdio> #include <cmath> #include <ctime> #include <queue> #include <set> #include <map> #include <stack> #include <string> #include <bitset> #include <vector> #include <complex> #include <algorithm> using namespace std; typedef long...
C++
f5e23ee7d82a91b4f1a2cb301e59d8ec
aec8c854140dfa35c277ada51c740790
2,200
PASSED
#include <iostream> #include <cassert> #include <cstring> #include <cstdlib> #include <cstdio> #include <cmath> #include <ctime> #include <queue> #include <set> #include <map> #include <stack> #include <string> #include <bitset> #include <vector> #include <complex> #include <algorithm> using namespace std; typedef long...
C++
f5e23ee7d82a91b4f1a2cb301e59d8ec
c24f5b3d3904e44c839e17af03c8f6e3
2,200
PASSED
#include <iostream> #include <functional> #include <numeric> #include <cstring> #include <algorithm> std::istream& in = std::cin; std::ostream& out = std::cout; const int MaxN = 100005; const int MaxE = MaxN << 1; #ifndef GRAPH_H #define GRAPH_H struct edge_t { int to, weight; edge_t *next; } edges[MaxE], *cure...
C++
f5e23ee7d82a91b4f1a2cb301e59d8ec
e6563e3e3d8cd8c54a87aa341fed66ad
2,200
PASSED
//by xxj #include<bits/stdc++.h> using namespace std; #define fst first #define snd second #define mp make_pair #define ll long long #define pii pair<int,int> #define lowbit(x) x&-x const int inf=1e9+7; const double eps=1e-10; const ll linf=1e18+7; const ll hh=523; //const int mod=; string d[100007]; int dis[100007]; v...
C++
f5e23ee7d82a91b4f1a2cb301e59d8ec
6eba9c82ac3d74f4c190644efecc2e92
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define N 200000 #define M 100000 #define inf (1<<30) struct rd { int v, l; }; #define end eeeeend int end[N], d[N], pre[N], lpre[N], enext[N]; bool vis[N]; vector<rd> aj[N]; int vcmp(int v, int w) { if(d[v] < d[w]) return -1; if(d[w] < d[v]) return 1; int ...
C++
f5e23ee7d82a91b4f1a2cb301e59d8ec
d238ae73ea78f7a33f1922363e390ebd
2,200
PASSED
#include <bits/stdc++.h> using namespace std; int n, m ; int dis[110000] ; vector< pair<int,int> > mm[110000] ; int mark[110000] ; int minDis ; vector<int> ans ; vector<int> path ; int after[110000] ; int pre[110000] ; void dfs(int id) { minDis = min(minDis, dis[id]) ; mark[id] = 1 ; for(auto r: mm[id]) if(mark...
C++
f5e23ee7d82a91b4f1a2cb301e59d8ec
205e0f783bc8987f43b9b01918c758b6
2,200
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 100010; typedef pair<int, int> pi; int n, m; vector <pi> a[N]; int d[N], st[N], cnt, d2[N]; vector <int> x[N]; int lv[N]; int c[N]; pi b[N]; int pre[N]; void bfs() { for (int i = 1; i < n; i++) { d[i] = 1e9; } st[0] = 0; cnt = 1; for (int i =...
C++
f5e23ee7d82a91b4f1a2cb301e59d8ec
9876976301fb0eea436ad060cd7a8dad
2,200
PASSED
#include <bits/stdc++.h> using namespace std; struct foo { int x, y; }; const int N = 1e5 + 5; int n, m, d[N], pre[N], path[N]; vector<int> e[N][10]; bool vst[N]; void init() { fill_n(vst, n, false); queue<int> q; q.push(n-1); vst[n-1] = true; while (!q.empty()) { int x = q.front(); q.pop...
C++
f5e23ee7d82a91b4f1a2cb301e59d8ec
306ecba2f66610c1f1d04c63002caf96
2,200
PASSED
# include<cstdio> # include<iostream> # include<algorithm> # include<string.h> # include<cstdlib> # include<math.h> # include<vector> # include<string> # include<set> # include<map> # define pf push_front # define pb push_back # define mp make_pair # define pr printf # define se second # define si size() # define sc s...
C++
3d6151b549bd52f95ab7fdb972e6fb98
c6d73afa030334d151a5159b5de66fc1
1,400
PASSED
# include<cstdio> # include<iostream> # include<algorithm> # include<string.h> # include<cstdlib> # include<math.h> # include<vector> # include<string> # include<set> # include<map> # define pf push_front # define pb push_back # define mp make_pair # define pr printf # define se second # define si size() # define sc s...
C++
3d6151b549bd52f95ab7fdb972e6fb98
66ebe33bfa71dfcf47374bf85c611c26
1,400
PASSED
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { long int a,b,c,m,i,j,p;long long eqcomp=0,cost=0; string s; vector <long int> ps2; vector <long int> usb; cin>>a>>b>>c>>m; for(i=0;i<m;i++) { cin>>p>>s; if(s=="USB") usb.push...
C++
3d6151b549bd52f95ab7fdb972e6fb98
c917e75221769e94f38b7402aa7d5e6d
1,400
PASSED
#include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <iostream> #include <algorithm> #include <queue> #include <stack> #include <map> #include <vector> using namespace std; typedef long long ll; const int Maxn = 1e9 + 10; const int N = 1e6 + 10; const int INF=(0x7fffffff...
C++
3d6151b549bd52f95ab7fdb972e6fb98
8773c275d2265f14132f161a5afc2fd2
1,400
PASSED
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define maxn 1000005 using namespace std; long long m[maxn],n[maxn],w[maxn]; int main(){ long long a,b,c; char ch[10]; while((scanf("%lld%lld%lld",&a,&b,&c))!=EOF){ long long t; scanf("%lld"...
C++
3d6151b549bd52f95ab7fdb972e6fb98
b9da267c07635a8b6be9d0f18ed94b0f
1,400
PASSED
#include<bits/stdc++.h> using namespace std; long long a,b,c,m,cu=0,cps=0,cont=0,ans=0; pair<long long ,string>mtp[500005]; map<int,int>cfy; int main() { cin>>a>>b>>c>>m; //mn=min(min(a,b),c); for(int i=0;i<m;i++) { cin>>mtp[i].first>>mtp[i].second; } sort(mtp,mtp+m); if( m==0) ...
C++
3d6151b549bd52f95ab7fdb972e6fb98
a056bca4bab285a87618d3ce40014b5a
1,400
PASSED
#include <iostream> #include <stdio.h> #include <algorithm> #include <vector> using namespace std; typedef long long Lin; #define sqr(x) x*x; vector < Lin > U, P, Q; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif // ONLINE_JUDGE int a, b, c; cin >>a >>b >>c; int...
C++
3d6151b549bd52f95ab7fdb972e6fb98
f6ae90df744aae0d95a51c5bcb2efd28
1,400
PASSED
#include <iostream> #include <stdio.h> #include <algorithm> #include <vector> using namespace std; typedef long long Lin; #define sqr(x) x*x; vector < Lin > U, P, Q; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif // ONLINE_JUDGE ios_base::sync_with_stdio(false); cin.tie(...
C++
3d6151b549bd52f95ab7fdb972e6fb98
330894a9180e57421a78fb971612e434
1,400
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll e[3*100000+5],f[3*100000+5],t; char ty[5]; int main() { ll a,b,c; scanf("%lld%lld%lld",&a,&b,&c); ll n; scanf("%lld",&n); e[0]=f[0]=0; for(ll i=0;i<n;i++) { scanf("%lld%s",&t,ty); if(ty[0]=='U') { ...
C++
3d6151b549bd52f95ab7fdb972e6fb98
8cd7429e6419c9b0351706883de53305
1,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int a,b,c; cin>>a>>b>>c; int n; cin>>n; int u[500000],p[500000]; int cn1=0,cn2=0; int i; for(i=0;i<n;i++) { int cost; char name[10]; scanf("%d%s",&cost,name); if(name[0]...
C++
3d6151b549bd52f95ab7fdb972e6fb98
3bb68a2fee29d025031b83ccea3fd854
1,400
PASSED
/** I can do this all day **/ #pragma GCC optimize("O2") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; #define all(x) (x).begin(),(x).e...
C++
7eadb6e7629ec7ba999557c66c4563a9
1296ba49d4f042d09c5341ebe69f610b
2,100
PASSED
#include<bits/stdc++.h> using namespace std; #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr) typedef long long int ll; typedef long double ld; typedef pair<ll,ll> p2; #define sz(a) ll(a.size()) ll dp[3005],pd[3005],lo[3005],res=100000; void dfs1(ll i,ll p,vector<vector<p2>> &v){ dp[i]=pd[i]=0; for(ll ...
C++
7eadb6e7629ec7ba999557c66c4563a9
c939fd8080f23bea55fd16d323b9c67d
2,100
PASSED
///supercalifragilisticexpialidocious. #include <cstdio> #include <cstring> #include <cmath> #include <cassert> #include <cstdlib> #include <cctype> #include <ctime> #include <iostream> #include <iomanip> #include <sstream> #include <numeric> #include <utility> #include <string> #include <algorithm> #include <vector> #...
C++
7eadb6e7629ec7ba999557c66c4563a9
abb42ffa938a91975b64f813c422e412
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" const int N=3005; int n, ans=3000; vector<pair<int, int> > g[N]; int cache[N][2][2]; int dfs(int k, int par, int dir, int fin) { int &ans=cache[k][dir][fin]; if(ans!=-1) return ans; an...
C++
7eadb6e7629ec7ba999557c66c4563a9
648adcfa6efd09827c33262a4909e35c
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;}) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int rnd(int l,int r){return l+rng()%(r-l+1);} #define fasty ios_base::s...
C++
7eadb6e7629ec7ba999557c66c4563a9
e79748a4dcb65b28d83edc843fb4d7c5
2,100
PASSED
/* ID: mm.khan1 PROG: beads LANG: C++14 */ #include <bits/stdc++.h> using namespace std; //#pragma GCC target ("sse4.2") #define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); #define FILE_IO ifstream cin ("beads.in"); ofstream cout ("beads.out"); #define pii pair<int, int> #define pb push_back typedef long...
C++
7eadb6e7629ec7ba999557c66c4563a9
b0dd3db5e96062fb994f8abc75de04c2
2,100
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> typedef long long ll; #define MAX 3105 using names...
C++
7eadb6e7629ec7ba999557c66c4563a9
5034d6abab68b46d4dd39d8df757348d
2,100
PASSED
#include<bits/stdc++.h> #define MOD 1000000007 #define ll long long #define mp make_pair #define pb push_back #define N 100010 using namespace std; set<pair<int, int> > graph[N]; int ct[N], res = 1e9, visited[N], cur = -1, val[N]; void dfs(int s){ visited[s] = 1; ct[s] = 0; for(auto to: graph[s]){ if(!visited[to...
C++
7eadb6e7629ec7ba999557c66c4563a9
db8ef9ac0cee30e302555aa3612d7c3e
2,100
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long const int mod = 1e9 + 7; const int N = 5e5 + 10; vector<pair<int,int>> v[3005]; int cc,dis[3005]; void dfs(int s,int p = 0) { for(auto it : v[s]) { if(it.first == p) continue; if(it.second == 1) { dis[it.first] = dis[s] + 1; cc ++; } ...
C++
7eadb6e7629ec7ba999557c66c4563a9
bba45493f452fab3f9940ffe059f0779
2,100
PASSED
///In the name of GOD #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll MXN = 2e5 + 10; ll n, maxi, ans, aNs = 1e18; vector<pair<ll, ll>> adj[MXN]; void dfs(ll u, ll par, ll x){ maxi = max(maxi, x); for(auto Pr : adj[u]){ ll v, f; tie(v, f) = Pr; if(v == par) continue;...
C++
7eadb6e7629ec7ba999557c66c4563a9
b8e22802a76cc2e4dafb293d165551c8
2,100
PASSED
#include<iostream> #include<stdio.h> #include<assert.h> #include<string.h> #include<time.h> #include<stdlib.h> #include<math.h> #include<string> #include<sstream> #include<map> #include<set> #include<queue> #include<stack> #include<vector> #include<algorithm> #pragma comment(linker, "/STACK:16777216") #define pb push_b...
C++
295c768a404d11a4ac480aaaf653c45c
2a72a9537152e67934f3f95c69a6c32d
2,100
PASSED
#include<bits/stdc++.h> #define NN 50011 #define x first #define y second using namespace std; typedef pair<int, int> pii; double sum[NN]; pii song[NN]; bool cmp(pii i, pii j){ return i.x*i.y*(100-j.y)>j.x*j.y*(100-i.y); } int main(){ int n; cin>>n; for(int i=1; i<=n; i++) { scanf("%d %d...
C++
295c768a404d11a4ac480aaaf653c45c
24faa26c5d69d0ed12c172f7fd019e1e
2,100
PASSED
#include<bits/stdc++.h> #define x first #define y second #define eps 1e-7 #define pb push_back #define inf 0x3f3f3f3f #define mod 1000000007 #define sq(x) ((x)*(x)) #define cb(x) ((x)*(x)*(x)) #define bit(x, y) (((x)>>(y))&1) #define bctz(x) (__builtin_ctz(x)) #define bclz(x) (__builtin_clz(x)) #define bc...
C++
295c768a404d11a4ac480aaaf653c45c
7adb282f39e991fd6de804acbab9b80d
2,100
PASSED
#include <iostream> #include <cstdio> #include <string.h> #include <algorithm> using namespace std; #define MAXN 50000 + 10 int n; struct Node { double l, p; }a[MAXN]; bool cmp(Node a, Node b) { return (1.0 - b.p) * a.p * a.l > (1.0 - a.p) * b.p * b.l; } double dp[MAXN][2]; int main() { scanf("%d",...
C++
295c768a404d11a4ac480aaaf653c45c
d1457733ad1137202d1fc78a4435c691
2,100
PASSED
using namespace std; #include <cmath> #include <cstdio> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <string> #include <vector> #include <iostream> #include <algorithm> #define all(c) (c).begin(),(c).end() #define tr(c,i) for(typeof((c).begi...
C++
295c768a404d11a4ac480aaaf653c45c
41f3247ee3a1105a3a12e8e32ddc187a
2,100
PASSED
#include <iostream> #include <vector> #include <map> #include <algorithm> #include <set> #include <queue> #include <stack> #include <string> #include <sstream> #include <cstdio> #include <cstring> #include <cmath> #include <cassert> using namespace std; #define ri(X) scanf("%d", &(X)) #define pi(X) printf("%d", (X)) ...
C++
295c768a404d11a4ac480aaaf653c45c
5de70286e44254858d9df6f50f709731
2,100
PASSED
# include <iostream> # include <cstdlib> # include <vector> # include <cstdio> # include <algorithm> using namespace std; using namespace std; vector<pair<int, pair<int, int> > >a; bool Compare(pair<int, pair<int, int> > i, pair<int, pair<int, int> > j) { return (i.first * (1 - j.second.first / 100.0) < j.first * ...
C++
295c768a404d11a4ac480aaaf653c45c
746de8639fb05d49fec07a8ab3e722f9
2,100
PASSED
#include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> using namespace std; struct node { int l,p; }mat[550000]; bool cmp(node a,node b) { /*if(a.p==100) { return true; } if(b.p==100)return false;*/ return a.l*a.p*(100-b.p)>b.l*b.p*(100-a.p); } int main() { in...
C++
295c768a404d11a4ac480aaaf653c45c
a7c1329017b70d47bbfca1333ee3184d
2,100
PASSED
#include<vector> #include<list> #include<map> #include<set> #include<deque> #include<queue> #include<stack> #include<bitset> #include<algorithm> #include<functional> #include<numeric> #include<utility> #include<iostream> #include<sstream> #include<iomanip> #include<cmath> #include<cstdlib> #include<cct...
C++
295c768a404d11a4ac480aaaf653c45c
055373722e966006e341081f9f49f97c
2,100
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; struct song { double l; double p; }songs[50005]; bool cmp(song a,song b) { return a.l*a.p*(100.0-b.p)>b.l*b.p*(100.0-a.p); } int main() { int n; scanf("%d",&n); memset(songs,0,sizeof(songs)); ...
C++
295c768a404d11a4ac480aaaf653c45c
f2b4d09d26f039b5c93b081c12eec22b
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define test(x) cout << (x) << endl #define ll long long #define fr(i,n) for(int i = 0; i < n; i++) #define fr1(i,n) for(int i = 1; i <= n; i++) #define pii pair<int,int> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template <typename T> using orde...
C++
c90c7a562c8221dd428c807c919ae156
19e9a3d981300d20c2e27f1c31da1e7e
2,200
PASSED
#include<bits/stdc++.h> #define reg register int #define il inline #define fi first #define se second #define mk(a,b) make_pair(a,b) #define numb (ch^'0') #define pb push_back #define solid const auto & #define enter cout<<endl #define pii pair<int,int> #define int long long using namespace std; typedef long long ll; ...
C++
c90c7a562c8221dd428c807c919ae156
9f4d1a8631599351a5540e2742ce1c27
2,200
PASSED
#include<bits/stdc++.h> #define reg register int #define il inline #define fi first #define se second #define mk(a,b) make_pair(a,b) #define numb (ch^'0') #define pb push_back #define solid const auto & #define enter cout<<endl #define pii pair<int,int> #define int long long using namespace std; typedef long long ll; ...
C++
c90c7a562c8221dd428c807c919ae156
683da9d5180d63e95560e5953ef41654
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef unsigned int uint; typedef double db; typedef pair <int, int> pii; typedef vector <int> vi; #define Fi first #define Se second #define pb push_back #define mp make_pair #define rep(x, a, b) for(int x = (a); x <...
C++
c90c7a562c8221dd428c807c919ae156
6ceb743729c0f78abb4847eb3d88653e
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef unsigned int uint; typedef double db; typedef pair <int, int> pii; typedef vector <int> vi; #define Fi first #define Se second #define pb push_back #define mp make_pair #define rep(x, a, b) for(int x = (a); x <...
C++
c90c7a562c8221dd428c807c919ae156
8b3f351b876e736a8c80f469a8bfbbbf
2,200
PASSED
// Author -- Frame #include<cstdio> #include<cstring> #include<algorithm> #define Finline __inline__ __attribute__ ((always_inline)) typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; const int inf=0x3f3f3f3f,Inf=0x7fffffff; const ll INF=0x7ffffffffffffff; template <typename _Tp>_Tp g...
C++
c90c7a562c8221dd428c807c919ae156
da4cae30b75191cd2f1de84ef593d4df
2,200
PASSED
// Author -- Frame #include<cstdio> #include<cstring> #include<algorithm> #define Finline __inline__ __attribute__ ((always_inline)) typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; const int inf=0x3f3f3f3f,Inf=0x7fffffff; const ll INF=0x7ffffffffffffff; template <typename _Tp>_Tp g...
C++
c90c7a562c8221dd428c807c919ae156
49b793af1ef7e8ba703e290cd51e6465
2,200
PASSED
#include <bits/stdc++.h> using namespace std; template<class T> using min_heap = priority_queue<T, vector<T>, greater<T>>; #define FOR(i, a, b) for (int i=a; i<(b); i++) #define F0R(i, a) for (int i=0; i<(a); i++) #define F0R1(i, a) for (int i=1; i<=(a); i++) #define FORd(i, a, b) for (int i = (b)-1; i >= a; i--) #d...
C++
c90c7a562c8221dd428c807c919ae156
b4b0dd19eba9f3e8e6281b087a05705e
2,200
PASSED
import java.io.*; import java.util.*; import java.math.BigInteger; public class Main{ static int mod = (int)(Math.pow(10, 9) + 7); public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int n = sc.nextInt(); Str...
Java
08bce37778b7bfe478340d5c222ae362
742f722d947cfeb9f99d357af4646166
1,500
PASSED
import java.math.BigInteger; import java.util.Stack; import java.util.Scanner; public class Main { public static void main(String[] args) { BigInteger one = new BigInteger("0"); Scanner input = new Scanner(System.in); int len = input.nextInt(); String s = input.next(); BigInteger x,y,an...
Java
08bce37778b7bfe478340d5c222ae362
a7296fb262f538772ae654ccd4ac06eb
1,500
PASSED
// practice with kaiboy import java.io.*; import java.util.*; public class CF1181B extends PrintWriter { CF1181B() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1181B o = new CF1181B(); o.main(); o.flush(); } int split(byte[] cc, int l, int n, int[] a...
Java
08bce37778b7bfe478340d5c222ae362
7041a69ac89afcf87fd2373f6734d77f
1,500
PASSED
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int len; len = input.nextInt(); String ss = input.nextLine(); ss = input.nextLine(); BigInteger a = new BigIn...
Java
08bce37778b7bfe478340d5c222ae362
9062d43529a947639982a7e2cb306735
1,500
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Scanner; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputReader input = new InputReade...
Java
08bce37778b7bfe478340d5c222ae362
e8c07919aa4114870523a335237cd971
1,500
PASSED
import java.util.*; import java.io.*; import java.math.BigInteger; public class Split_the_Number { static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while(st == null || !st.hasMoreEle...
Java
08bce37778b7bfe478340d5c222ae362
258fcca1fd73ec4674b7c545abb886b1
1,500
PASSED
import java.util.*; import java.math.*; import java.io.*; public class pro{ public static void main(String[] args) { Scanner input = new Scanner(System.in); int l = input.nextInt(); String n = input.next(); BigInteger x = null, y = null, z = null; boolean f = false, ff = false, fa = false; if(n.charAt(l...
Java
08bce37778b7bfe478340d5c222ae362
0fac4b8221e037d77db50a75e31e87f6
1,500
PASSED
// package cp; import java.io.*; import java.math.*; import java.util.*; public class Cf_one { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(System.out); Readers.init(System.in); int l=Readers.nextInt(); String s=Readers.next(); int ll=-1; int rr=-1; fo...
Java
08bce37778b7bfe478340d5c222ae362
40bc1dc260a77b9472b23052ce187d34
1,500
PASSED
#include<iostream> #include<string> #include<cmath> #include<algorithm> using namespace std; int main() { int len, i, count = 0, adsub = 1; string s, first, second, sum = ""; cin >> len >> s; i = len / 2; while(++count) { if (count>1 && sum != "" && ((len % 2 == 0) ^ (count % 2 == 1))) { break; } int ...
C++
08bce37778b7bfe478340d5c222ae362
da8d1b37c1c15557a00dfda68c735ccf
1,500
PASSED
#include<bits/stdc++.h> #define ll long long int using namespace std; string findSum(string s1, string s2) { int n1=s1.size(); int n2=s2.size(); int k=min(n1, n2); int l=max(n1, n2); string greater=""; string smaller=""; if(l==n1) { greater=s1; smaller=s2; } else...
C++
08bce37778b7bfe478340d5c222ae362
7889b8ea34182fff226126e65533d17c
1,500
PASSED
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pi; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; long long p = 1000000007; // long long p = 998244353; long long power(long long a, long long b, long long p) { long long res =1; while(b) { ...
C++
fc4d0f2d4dfc97484dbbafb3f2aee362
9052827f749fb9f5e6ce1a878b408fa1
2,200
PASSED
#include <iostream> #include <stack> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <tuple> #include <fstream> #include <map> using namespace std; #define ll long long #define ull unsigned long long #define pi pair<int, int> #define vi vector<int> #define vull vecto...
C++
fc4d0f2d4dfc97484dbbafb3f2aee362
4469da31870cb5352980fa049c3cd910
2,200
PASSED
/* author : s@if */ #include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define NIL -1 #define fi first #define sec second #define MAX INT_MAX #define INF 1e9 #define ll long long #define PI acos(-1.0) #...
C++
fc4d0f2d4dfc97484dbbafb3f2aee362
adaf45f3749b6f5f6584f5eea9158a70
2,200
PASSED
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define endl '\n' typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; //const int mod=1e9+7; const int mod=998244353; const double eps = ...
C++
fc4d0f2d4dfc97484dbbafb3f2aee362
d3b9eb318548c2674b588f6e550a58cd
2,200
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; const int N=1e6+1; const int mod=1e9+7; ll a[N], dp[N][2]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifdef _DEBUG freopen("input.txt", "r", stdin); #endif unordered_map<int, int> m; int n, k; cin>>n>>k; for(int i=n;i--;){ cin...
C++
fc4d0f2d4dfc97484dbbafb3f2aee362
df285e843e5e6f8e0986ccf8a8112ee7
2,200
PASSED
#include <iostream> #include <algorithm> #include <cstdlib> #include <cstring> #include <cmath> #include <vector> #include <stack> #include <queue> #include <unordered_map> #include <map> #include <set> using namespace std; #define int long long #define val(x) cout << #x << " equals to " << x << endl #define F first...
C++
fc4d0f2d4dfc97484dbbafb3f2aee362
402e64e5b90db585f9c18d4dc52fe0e3
2,200
PASSED
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; int a[n]; for(int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); vector<pair<long long, long long>> v; for(int i = 0; i < n; i++) { if(v.empty() or v.back().first != a[i]) { v.push_back({a[i], 1}); } e...
C++
fc4d0f2d4dfc97484dbbafb3f2aee362
7942d6414ba2e9d34c885c9e821381a9
2,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define M 998244353 #define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL)); #define ff first #define ss second #define mk make_pair int main() { FAST; ll n,k; cin>>n>>k; ll a[n+1], pre[n+1],...
C++
fc4d0f2d4dfc97484dbbafb3f2aee362
898df299631f565a388cb71ab9a300d2
2,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define M 998244353 #define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL)); #define ff first #define ss second #define mk make_pair int main() { FAST; ll n,k; cin>>n>>k; ll a[n+1], pre[n+1], su...
C++
fc4d0f2d4dfc97484dbbafb3f2aee362
0e9d28c99a0f356d9e7c12cc2799c18b
2,200
PASSED
#include <iostream> #include <vector> #include <queue> #include <climits> #include <algorithm> #define ll long long int #define INF INT_MAX using namespace std; struct node { ll key; ll freq; }; vector <node> v; ll arr[200005]; ll prev_final[200005], next_final[200005]; ll nprev[200005], nnext[200005], pre...
C++
fc4d0f2d4dfc97484dbbafb3f2aee362
b33c69378c270545e560586d70315494
2,200
PASSED
#include<iostream> using namespace std; int main() { int T; cin>>T; while(T--) { int n;cin>>n; if(n%4==0)cout<<"Yes"<<endl; else cout<<"No"<<endl; } }
C++
07e56d4031bcb119d2f684203f7ed133
3cae7369e4c939bd17342098e28f9462
800
PASSED
#include<iostream> using namespace std; int main() { int t; cin>>t; while(t--){ long long n; cin>>n; if(n%4) cout<<"no\n"; else cout<<"yes\n"; } }
C++
07e56d4031bcb119d2f684203f7ed133
9c3b3da2211ebf681b8d67d4dc464bf5
800
PASSED
/* * @Description: * @Autor: Kadia * @Date: 2020-06-23 22:08:23 * @LastEditors: Kadia * @Connect: vx:ccz1354 qq:544692713 * @LastEditTime: 2020-06-23 22:27:28 */ #include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; int n; while(q--) { cin >> n ; if(n...
C++
07e56d4031bcb119d2f684203f7ed133
1389b1b5fe3bfa31a97bbe3cef6cff6f
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int test; cin>>test; while(test--) { long long int n; cin>>n; if(n%2) cout<<"NO"<<endl; else { if(n%4==0) cout<<"YES"<<endl; else cout<<"N...
C++
07e56d4031bcb119d2f684203f7ed133
8a852b3c4265f68573f28b15042d9fad
800
PASSED
#include <bits/stdc++.h> int solve(int it) { for (size_t i = 0; i < it; i++) { int n = 0; scanf("%d", &n); if (n % 4 == 0) { printf("YES\n"); } else { printf("NO\n"); } } return 0; } int main() { int n = 0; scanf("%d", &n); solve(...
C++
07e56d4031bcb119d2f684203f7ed133
52a199cba033e7e189548ff1e89f6d8b
800
PASSED
#include <bits/stdc++.h> using namespace std; int n; unsigned long long x; int main(){ cin>>n; while(n--){ cin>>x; if (x%4) cout<<"NO"<<'\n'; else cout<<"YES"<<'\n'; } return 0; }
C++
07e56d4031bcb119d2f684203f7ed133
90f4cad60006cf9ef9cc766842c4895b
800
PASSED
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; typedef long long ll; ll a[1000009]; int main() { int x; scanf("%d", &x); for (int i = 1; i <= x; i++) { scanf("%lld", &a[i]); if (a[i] % 4 == 0)puts("YES"); else puts("NO"); } return 0; }
C++
07e56d4031bcb119d2f684203f7ed133
32bf1ecdf539dd7c36cf29e7fea4be50
800
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long int lli; #define BIG 1000000007 void solve(){ lli n; cin>>n; if(n%4==0) cout<<"YES"<<endl; else cout<<"NO"<<endl; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--){ solve...
C++
07e56d4031bcb119d2f684203f7ed133
7db9c86fc56d95ac5dd784bb8af055c9
800
PASSED
#include<bits/stdc++.h> using namespace std; string solve() { long long n; cin>>n; return (n%4) ? "NO\n" : "YES\n"; } void TC() { cout<<solve(); } int main() { ios_base::sync_with_stdio(0) , cin.tie(0),cout.tie(0) ; int t; cin>>t; while(t--) TC(); }
C++
07e56d4031bcb119d2f684203f7ed133
be79efde06d8bd8b90680afcf50eb6fa
800
PASSED
#include <iostream> #include<bits/stdc++.h> using namespace std; int main() { // your code goes here int t; cin>>t; while(t--){ long long int n; cin>>n; if(n%4!=0){ cout<<"NO"<<endl; } else{ cout<<"YES"<<endl; } } return 0; }
C++
07e56d4031bcb119d2f684203f7ed133
29f6776f02cd94923a22fa61e141b13c
800
PASSED
for _ in range(1): n=int(input()) l=list(map(int,input().split())) c=0 l=[0]+l i=1 while i<=n: c+=1 ma=i while i<=n and i<=ma: ma=max(ma,l[i]) i+=1 print(c)
Python
291601d6cdafa4113c1154f0dda3470d
ff3c1ec3ac3fcf274025d8d090bf9ac7
1,000
PASSED
n = int(input()) a = list(map(int, input().split())) i = 1 num = 0 d = set() for i in range(1, n + 1): d.add(a[i - 1]) if i in d: d.remove(i) if len(d) == 0: num += 1 print(num)
Python
291601d6cdafa4113c1154f0dda3470d
3031b1a2507a185c30516d10e6876e6a
1,000
PASSED
n = int(input()) arr = list(map(int, input().split())) p = 0 s = 0 while p + 1 <= n: p += 1 m = arr[p - 1] while p <= m: m = max(m, arr[p - 1]) p += 1 p -= 1 s += 1 #print(p) print(s)
Python
291601d6cdafa4113c1154f0dda3470d
f950f265227789f259b2596b2090ca56
1,000
PASSED
N=int(input()) a=0 b=list(map(int,input().split())) c=0 for i in range(N): c=max(c,b[i]) if max(c,b[i])==i+1: a+=1 print(a)
Python
291601d6cdafa4113c1154f0dda3470d
5341956ffade77872e1d0ba910add1f8
1,000
PASSED