source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
import java.io.*; import java.util.*; public class Main { static class ft2d { long[][]tree; int max_x;int max_y; ft2d(int x,int y){ tree=new long[x+1][y+1]; max_x=x;max_y=y; } void update(int x , int y , long val){ int y1; while (x <= max_x){ y1 = y; while (y1 <= max_y){ ...
Java
a45f38aae8dadb6f0991b41ecb1be855
ee17bc1684bf69e8a6d845231233c397
2,400
PASSED
#include <bits/stdc++.h> #define pii pair<int, int> #define ll long long using namespace std; const int N = 2e3 + 7; int n, m, k, a[N][N]; bool add[N], lazy[N]; vector<pii> G[N]; struct Bit { ll tree[N][N]; inline int lowbit(int x) { return x & -x; } void add(int x, int y, int w) { if (!x || !y) return; for...
C++
a45f38aae8dadb6f0991b41ecb1be855
9b49e54ec85edea7fe1a6962af55466c
2,400
PASSED
//https://codeforces.com/contest/707/problem/E //E. Garlands #include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; typedef long long ll; vector<vector<pair<ll,ii>>> garland; vector<vector<ll>> fen; vector<bool> isTurned; vector<bool> needChange; int R, C, K; void add(int i, int j, ll val){ for(in...
C++
a45f38aae8dadb6f0991b41ecb1be855
cf2c7d233e180062fb09296493737ed2
2,400
PASSED
#include <bits/stdc++.h> #define all(x) x.begin(), x.end() using namespace std; using ll = long long; using pii = pair<int, int>; const int MN = 2e3 + 5; int n, m, k, q; struct Cell { int x, y, w; }; vector<Cell> garland[MN]; struct Query { int x1, y1, x2, y2; }; vector<Query> qs; ll ans[MN], b[MN][MN]; int pre...
C++
a45f38aae8dadb6f0991b41ecb1be855
490357f6e5d87851d757441212c238f0
2,400
PASSED
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags #pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX #pragma GCC target("avx2") //Enable AVX #include <bits/stdc++.h> #define db(x) cout << (x) << '\n'; #define all(v) (v).begin(),(v).end() #define a...
C++
a45f38aae8dadb6f0991b41ecb1be855
1413b22ff8fb3eefb9f5f8a0e584fdcb
2,400
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; const int N=2005; int n,m,k,state[N],need_change[N]; struct point { int x,y,w; }; vector<point>garlan[N]; struct SegmentTree { int ST[4*N]; int get (int id,int l,int r,int L,int R) { if (r<L||R<l) return 0; ...
C++
a45f38aae8dadb6f0991b41ecb1be855
49cb386883415d714a097a675e86ebee
2,400
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 2e3 + 5; long long bit[maxn][maxn]; long long ans[maxn][maxn]; int n, m; typedef pair< pair<int,int> , long long > pii; vector<pii> lad[maxn]; void update(int y, int x, int val){ for(; y <= n; y+=y&-y) for(int j = x; j <= m; j+=j&-j) bit[y][j]+= val; ...
C++
a45f38aae8dadb6f0991b41ecb1be855
d724b50db6c1255cbc4853cb7051477b
2,400
PASSED
/* Use a range sum 2D BIT to answer queries for each garland. Since Ask queries <=2k. O("Ask Queries" * "No of garlands" * log(rows) * log(cols)) works. To reduce memory use an offline algorithm. Processing each garland at a time. */ #include<iostream> #include<bits/stdc++.h> #include<stdio.h> using namespa...
C++
a45f38aae8dadb6f0991b41ecb1be855
097e8050cf6a33311b5a682f26be1253
2,400
PASSED
/* Warn - Don't change next line else you will get WA verdict. Online Judge is configured to give WA if next line is not present. "An ideal problem has no test data." Author - Aryan Choudhary (@aryanc403) */ #pragma warning(disable:4996) #pragma comment(linker, "/stack:200000000") #pragma GCC optimize ("Ofast") ...
C++
a45f38aae8dadb6f0991b41ecb1be855
c580a1a939738a12c6b0ce5847bf8768
2,400
PASSED
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; template <typename _T> inline void read(_T &f) { f = 0; _T fu = 1; char c = getchar(); while(c < '0' || c > '9') {if(c == '-') fu = -1; c = getchar();} while(c >= '0' && c <= '9') {f = (f << 3) + (f << 1) +...
C++
3c984366bba580993d1694d27982a773
989e85c776457e18e10736e4b39f0020
800
PASSED
#include <bits/stdc++.h> using namespace std; struct node { int a, b, c, d, ID, sum; }s[1005]; int n; inline bool cmp(node a, node b) { if (a.sum != b.sum) return a.sum > b.sum; else return a.ID < b.ID; } int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d %d %d %d", &s[i...
C++
3c984366bba580993d1694d27982a773
b7a38d344ad1559c38d6723ae294b392
800
PASSED
#include<iostream> #include<cstdio> using namespace std; struct st { int no,tot; }s[1000005]; int main() { int n,a,b,c,d,rank=1; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d%d%d%d",&a,&b,&c,&d); s[i].no=i; s[i].tot=a+b+c+d; } for(int i=2;i<=n;i++) { if(s[i].tot>s[1].tot)rank++; } printf("%d",ran...
C++
3c984366bba580993d1694d27982a773
a8b002478cbc2e51840afde65cf9dc33
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { short n,t; cin>>n; short x[1000]; for(short i=0;i<n;i++) { short a,b,c,d; cin>>a>>b>>c>>d; x[i]=a+b+c+d; if(!i) t=x[i]; } sort(x,x+n); for(short i=n-1;i>=0;i--) if(x[i]==t) { cout<<n-i; return 0; } }
C++
3c984366bba580993d1694d27982a773
fdd53177b916efc654d1ba23c3f83b3a
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { short n,t; cin>>n; short x[n]; for(short i=0;i<n;i++) { short a,b,c,d; cin>>a>>b>>c>>d; x[i]=a+b+c+d; if(!i) t=x[i]; } sort(x,x+n); for(short i=n-1;i>=0;i--) if(x[i]==t) { cout<<n-i; return 0; } }
C++
3c984366bba580993d1694d27982a773
f7fc7717a6642eb2516e41ebd4900a72
800
PASSED
#include<bits/stdc++.h> using namespace std; int n; struct wfq{ int b,h; }a[10050]; int cmp(const wfq &a,const wfq &b) { if(a.h==b.h)return a.b<b.b; return a.h>b.h; } int main() { cin>>n; for(int i=1;i<=n;i++) { int a1,b1,c1,d1; scanf("%d%d%d%d",&a1,&b1,&c1,&d1); a[i].h=a1+b1+c1+d1; a[i].b=i; } sort(a+1...
C++
3c984366bba580993d1694d27982a773
10c2913729dbf81161f460bbae90ad88
800
PASSED
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); int n; vector<int> V; cin >> n; int a,b,c,d; cin >> a >> b >> c >> d; int s = a + b + c + d; if(n == 1){ cout << 1; return 0; } for(int i = 0;i < n - 1;++i){ int aa,bb,cc,dd; cin >> aa >> bb >> cc >> dd; V.push...
C++
3c984366bba580993d1694d27982a773
7f516ae028cd4e52e2cf82b25fd69d20
800
PASSED
#include <bits/stdc++.h> #define ii pair <int,int> using namespace std; bool cmp(ii a, ii b){ if(a.first>b.first) return 1; if(a.first==b.first && a.second<b.second) return 1; return 0; } int main(){ int T,p,q,r,s; vector <ii> V; int sum=0,temp=0; cin>> T; for(int i=1; i<=T; i++){ ...
C++
3c984366bba580993d1694d27982a773
1d37e5f6fb7af5005b74a99823e301c1
800
PASSED
#include<cmath> #include<algorithm> #include<cstdio> #include<iostream> #include<cstring> using namespace std; const int N=1005; int a[N],sum[N],score; int n; int main() { memset(sum,0,sizeof(sum)); cin>>n; for(int i=1;i<=n;i++) { for(int j=1;j<=4;j++) { scanf("%d",&a[i]); sum[i]+=a[i]; } } score=sum...
C++
3c984366bba580993d1694d27982a773
e7c612d76967399988dda9a2789031e1
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,a[1000],b[1000],c[1000],d[1000],i,g[1000],s,max,l=1; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]); } s=0; for(i=0;i<n;i++) { s=s+a[i]+b[i]+c[i]+d[i]; g[i]=s; ...
C++
3c984366bba580993d1694d27982a773
5015c2112775caa46a27c49050bbcdc3
800
PASSED
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.Reader; import java.util.StringTokenizer; public class TaskB { public static void main(String[] args) throws Exception { Tokenizer in = new Tokenizer(new InputStreamReader(System.in)); int n = in.nextInt(); Point[] p = new P...
Java
495488223483401ff12ae9c456b4e5fe
004672080e92a4b005204806f08f41cf
1,800
PASSED
import java.util.*; import java.io.*; public class B { FastScanner in; PrintWriter out; class Point { long x, y; public Point(long x, long y) { super(); this.x = x; this.y = y; } } Point[] pts; double vecMul(Point p0, Point p1, Point p2) { double x1 = p1.x - p0.x; double x2 = p2.x - p0.x...
Java
495488223483401ff12ae9c456b4e5fe
8e0c0f7f9cdba6c863f3809c37c4a73f
1,800
PASSED
import java.io.*; import java.util.StringTokenizer; /** * Created by gamezovladislav on 21.03.2017. */ public class TaskB { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputRe...
Java
495488223483401ff12ae9c456b4e5fe
e9a13751ab7ee4aadbadb3ef17d7f460
1,800
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
495488223483401ff12ae9c456b4e5fe
23cb4290dec456bb0d099b87c567c28a
1,800
PASSED
import java.io.*; import java.math.BigInteger; import java.util.*; public class Solution { public static void main(String[] args) throws Exception { MyReader reader = new MyReader(System.in); MyWriter writer = new MyWriter(System.out); new Solution().run(reader, writer); writer.clo...
Java
495488223483401ff12ae9c456b4e5fe
cbc0f3987c296dbdd5de982fe74fe9e4
1,800
PASSED
import java.io.*; import java.util.*; public class solver { static BufferedReader in; static PrintWriter out; static StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args) throws IOException { String filename = ""; if (filename.isEmpty()) { in = new BufferedReader...
Java
495488223483401ff12ae9c456b4e5fe
0b4773f44834cfec3cd46ea4e53c4c4c
1,800
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.Input...
Java
495488223483401ff12ae9c456b4e5fe
5fcc2e763a02c6a505b3ec4facfc467f
1,800
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.Input...
Java
495488223483401ff12ae9c456b4e5fe
530d38a5e2be7c89aa5d8624305fdc16
1,800
PASSED
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; ...
Java
495488223483401ff12ae9c456b4e5fe
772760357afcb73605ba2976262d61aa
1,800
PASSED
import java.util.*; import java.io.*; public class B { class Line { double a, b, c; public Line(int x1, int y1, int x2, int y2) { a = y2 - y1; b = x1 - x2; c = -(a * x1 + b * y1); } double dist(int x, int y) { double d = a * x + b * y + c; return Math.abs(d) / Math.sqrt(a * a + b * b); } ...
Java
495488223483401ff12ae9c456b4e5fe
e0120bb8048ae258f793bbd7c4b69a6e
1,800
PASSED
#include <bits/stdc++.h> using namespace std; /***Crazy Macros***/ #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define reu(i,a,b) for (ll i = (a); i <= (b); ++i) #define red(i,a,b) for (ll i = (a); i >= (b); --i) typedef int64_t ll; typedef pair<ll,ll> ii; typedef vector<ll> vi; typede...
C++
12157ec4a71f0763a898172b38ff1ef2
042098c6e8afe692c0e77837c8ff8a81
1,700
PASSED
#include <bits/stdc++.h> using namespace std; /***Crazy Macros***/ #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define reu(i,a,b) for (ll i = (a); i <= (b); ++i) #define red(i,a,b) for (ll i = (a); i >= (b); --i) typedef int64_t ll; typedef pair<ll,ll> ii; typedef vector<ll> vi; typede...
C++
12157ec4a71f0763a898172b38ff1ef2
8038b35aa894b0cffdad6283f9e36f13
1,700
PASSED
#include <bits/stdc++.h> #include <algorithm> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ass 1e18 #define MOD 1000000007 #define mp make_pair #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front #define fi first #define se second #define sz(x) ...
C++
12157ec4a71f0763a898172b38ff1ef2
d9c73016fa35d23ec49a53d604e80fb2
1,700
PASSED
#include <bits/stdc++.h> #define lli long long int using namespace std; int main() { lli t;cin>>t; while(t--) { lli n,k; cin>>n>>k; lli i=1; lli c=1; lli sum=1; while(true) { if(n<=sum) { break; } c++; sum+=(i*2); i*=2; } sum=0...
C++
12157ec4a71f0763a898172b38ff1ef2
19e36684f45469512188764d4b2887c0
1,700
PASSED
#include <iostream> #include <iomanip> #include <bits/stdc++.h> using namespace std; #define ll long long int #define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++) #define repr(i,n) for (ll i = n - 1; i >= 0; i--) #define MAX 1000000 #define mo 1000000007 #define ld long double #define pb push_back #define mp make_pa...
C++
12157ec4a71f0763a898172b38ff1ef2
c057dfc6b86d861fb83a747f00ac3e75
1,700
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); ll t; cin>>t; while(t--){ ll d,m,i; cin>>d>>m; ll ans=1; for(i=0;i<30;i++){ if(d<(1<<i)){ break; } ans=ans*(min((1ll<<(i+1))-1,d)-(1<<i)+2)%m; } ans--; if(ans<0...
C++
12157ec4a71f0763a898172b38ff1ef2
547934804f0c4627c581d6353dfb487a
1,700
PASSED
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define ull unsigned long long #define md 1000000007 #define pb push_back #define ff first #define ss second #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); using names...
C++
12157ec4a71f0763a898172b38ff1ef2
999a5e7d738a9e5c4093db87e67356d5
1,700
PASSED
// exp worth blood #include <bits/stdc++.h> #include <cmath> #define ll long long #define ld long double #define pb push_back #define fs first #define sc second #define mp make_pair using namespace std; const ll base = 7; const ll maxn = 1000 + 9; const ll inf = 1e9 + 7; typedef pair<ll,ll> LL; ll d,m,p,cnt,t,i; ll m...
C++
12157ec4a71f0763a898172b38ff1ef2
8a9849214e03822f339e288777b43d6b
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' #define mod 1000000007 void solve(){ ll d, m; cin>>d>>m; ll n = (long)(log2(d)+1); ll ans =1, i =1; for(ll i=0; i<n; ++i){ ans *= min((ll)(1<<(i+1)) - 1, d) - (1<<i) + 2; ans%=m; } --ans; cout<<(ans+m)%m<<endl; } int mai...
C++
12157ec4a71f0763a898172b38ff1ef2
79952d65b9afd7348956b5b44f6ac76b
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long int #define F first #define S second #define hell 1000000007 ll m; vector<ll> p2(100); std::vector<ll> fib(40); void buildfib() { fib[0]=0; fib[1]=1; for(ll i=2;i<32;i++) { fib[i]=fib[i-1]+fib[i-2]; } } void build() { p2[0]=1; p2[1]=2; for(ll...
C++
12157ec4a71f0763a898172b38ff1ef2
395c2dc3bd944353d1b17a2735a62716
1,700
PASSED
#include<stdio.h> #include<algorithm> using namespace std; #define ll long long #define inf 2147483647 struct data{ int s,m,r,t; data(int x=0){t=x;} void gao(){ scanf("%d%d%d",&s,&m,&r); t=(r?m/r+(m%r>0):inf); } ll calc(ll u){return min(s+r*u,(ll)m);} }a[18][100010]; int Tt[400010]; ll Tm[18][400010],Tr[18][40...
C++
f912e88b3bf0cd705c08fc4db1a81f86
7d4a660abeaa8942fdc834c6f6ad9c58
3,100
PASSED
#include <cstdio> #include <algorithm> #include <numeric> #include <iterator> using namespace std; int s[100000]; int m[100000]; int rg[100000]; bool good[(1 << 18) - 1]; int last[(1 << 18) - 1]; int tmax[18][1 << 17]; int tmp[18][1 << 17]; long long summax[18][1 << 17]; long long sumreg[18][1 << 17]; int mydiv(int...
C++
f912e88b3bf0cd705c08fc4db1a81f86
3014328238c42fd6325435440d847b9d
3,100
PASSED
#include<bits/stdc++.h> #define time greetings_traveller #define int long long using namespace std; const int N=1e5+5; const long long inf=1e18; int n,m,ti,l,r,s[N],mx[N],reg[N]; struct node{ vector<pair<int,pair<long long,long long> > >q; int color,cur; node(){ color=-1; } }; node t[12*N]...
C++
f912e88b3bf0cd705c08fc4db1a81f86
506a89d6cc64b70edb7eaf7851bc9d35
3,100
PASSED
#include<bits/stdc++.h> #define time greetings_traveller #define int long long using namespace std; const int N=1e5+5; const long long inf=1e18; int n,m,ti,l,r,s[N],mx[N],reg[N]; struct node{ vector<pair<int,pair<long long,long long> > >q; int color,cur; node(){ color=-1; cur=0; } ...
C++
f912e88b3bf0cd705c08fc4db1a81f86
4deb2f276d426d69cd5c5e613ce5a9ca
3,100
PASSED
#include<bits/stdc++.h> using namespace std; #define Ri register template<typename T>inline T read(Ri T&t) {Ri T f=1;Ri char ch=getchar();t=0; while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();} while(ch>='0'&&ch<='9')t=t*10+ch-'0',ch=getchar();t*=f;return t;} template<typename T,typename...Args> inline void read(T&t,...
C++
f912e88b3bf0cd705c08fc4db1a81f86
6ea679f24aa824b22a6b05b63b4d96b2
3,100
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 1e5+4; int n, m; struct node { long long s, a, b, rate; node() { s = a = b = rate = 0; } bool friend operator < (const node &a, const node &b) { return a.rate < b.rate; } } p[20][N], x[N]; long long ans; long long sa[20][N], sb[20][N], day[N << 2]; void b...
C++
f912e88b3bf0cd705c08fc4db1a81f86
18ed20ca757756c95e88376e211a8a99
3,100
PASSED
/* So, is the glass half empty, half full, or just twice as large as it needs to be? */ #include <algorithm> #include <cstdio> #include <cstring> #include <set> template <typename T> void read(T &n) { char c; for (; (c = getchar()) < '0' || c > '9';) ; for (n = c - '0'; (c = getchar()) >= '0' && c <= '9...
C++
f912e88b3bf0cd705c08fc4db1a81f86
7857425b3d91258744ea5e8a48d60582
3,100
PASSED
#include <bits/stdc++.h> using namespace std; const int mxN=1e5, bs=300; int n, q, s[mxN], m[mxN], r[mxN], g[(mxN-1)/bs+1][mxN+3], lt1[(mxN-1)/bs+1], lt2[mxN], ti, li, ri; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i=0; i<n; ++i) { cin >> s[i] >> m[i] >> r[i]; if(!r[i]) cont...
C++
f912e88b3bf0cd705c08fc4db1a81f86
4660bc2af30d7c0ba8afacef460a1054
3,100
PASSED
#include <bits/stdc++.h> using namespace std; const int mxN=1e5, bs=250; int n, q, s[mxN], m[mxN], r[mxN], g[(mxN-1)/bs+1][mxN+3], lt1[(mxN-1)/bs+1], lt2[mxN], ti, li, ri; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i=0; i<n; ++i) { cin >> s[i] >> m[i] >> r[i]; if(!r[i]) cont...
C++
f912e88b3bf0cd705c08fc4db1a81f86
d75fe72c32f8312a798e311bd4da8573
3,100
PASSED
#include <bits/stdc++.h> using namespace std; const int mxN=1e5, bs=275; int n, q, s[mxN], m[mxN], r[mxN], g[(mxN-1)/bs+1][mxN+3], lt1[(mxN-1)/bs+1], lt2[mxN], ti, li, ri; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i=0; i<n; ++i) { cin >> s[i] >> m[i] >> r[i]; if(!r[i]) cont...
C++
f912e88b3bf0cd705c08fc4db1a81f86
124003293563d39ce9c3b2bc58affb82
3,100
PASSED
using System; using System.Linq; using System.IO; class P { static void Main() { var s = File.ReadAllLines("input.txt").First().Split(' ').Select(int.Parse).ToArray(); var b = s[0]; var g = s[1]; var s2 = ""; if (b > g) { for (var i = 0; i < g ; i++) s2 += ("BG"); s2 += (new string('B', b...
C#
5392996bd06bf52b48fe30b64493f8f5
502f99c300410ec7c62575d5a031fe68
1,100
PASSED
using System; using System.IO; using System.Text; namespace Boys_and_Girls { internal class Program { private static readonly StreamReader reader = new StreamReader("input.txt", Encoding.ASCII, false, 1024 * 10); private static readonly StreamWriter writer = new StreamWriter("output.txt", fals...
C#
5392996bd06bf52b48fe30b64493f8f5
7a9b5d1d78d1cd170af59c52bde8dbc0
1,100
PASSED
using System; using System.Collections.Generic; using System.IO; class Program { static void Main(string[] args) { StreamReader inp = new StreamReader("input.txt"); StreamWriter Out = new StreamWriter("output.txt"); string[] tok = inp.ReadLine().Split(); int n = Convert.ToInt32(t...
C#
5392996bd06bf52b48fe30b64493f8f5
da7dcc3abad30694f323dc98322122f0
1,100
PASSED
using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; public class Codeforces { protected static TextReader reader; protected static TextWriter writer; static object Solve() { var s = File.ReadAllLines("input.txt").First().Split(' ').Sel...
C#
5392996bd06bf52b48fe30b64493f8f5
0a186e1a90043cd52777b48eb442f0f2
1,100
PASSED
using System; using System.Collections.Generic; using System.IO; using System.Linq; namespace Codeforces { class Solver { static void Main() { var reader = new StreamReader("input.txt"); var tokens = reader.ReadLine().Split(); var n = int.Parse(tokens[0]); ...
C#
5392996bd06bf52b48fe30b64493f8f5
4a5dd32699c1a19a908dbe090468df34
1,100
PASSED
using System; using System.IO; namespace AllProblems { class _253A_BoysAndGirls { public static void Run() { var reader = new StreamReader("input.txt"); try { if (File.Exists("output.txt")) File.Delete("output.txt"); } ...
C#
5392996bd06bf52b48fe30b64493f8f5
7c0cc19dc2134d10e49bbf5c453d77ea
1,100
PASSED
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace codeforces { class Program { public const int Osn = 1000000007; public class Pair { public long First; public long Second; } public class PairComparer : IComparer<Pair> { public i...
C#
5392996bd06bf52b48fe30b64493f8f5
27d7669f5ac24a85358688107eb68e03
1,100
PASSED
using System; using System.Linq; using System.Collections.Generic; using System.Text; using System.IO; namespace MakeCalendar { public static class MainClass { static void Main(string[] args) { int n=0, m = 0, v3 = 0; char[] sep = {' '}; var dd = File.R...
C#
5392996bd06bf52b48fe30b64493f8f5
f8426e2a1e38dad5e7ae30ff7e3ab4f7
1,100
PASSED
import java.io.* import java.util.* fun main(args: Array<String>) { //hi val scanner = Scanner(FileReader("input.txt")) val writer = PrintWriter("output.txt") var n = scanner.nextInt() var m = scanner.nextInt() var flag = m > n while (n > 0 || m > 0) { if (n <= 0 || m <= 0) { ...
Kotlin
5392996bd06bf52b48fe30b64493f8f5
4dfe2246651ac156d1f6b82bae0f2ed3
1,100
PASSED
import java.io.File import java.io.PrintWriter import java.util.Scanner fun main() { val sc = Scanner(File("input.txt")) val pw = PrintWriter("output.txt") var n : Int = sc.nextInt() var m : Int = sc.nextInt() val both : Int = Math.min(n, m) n -= both m -= both if (n >= m) { ...
Kotlin
5392996bd06bf52b48fe30b64493f8f5
cb4aa525e4ca11b2d429fde63c0daf8b
1,100
PASSED
//Bismillahir rahmanir rahim #include<bits/stdc++.h> using namespace std; #define ll long long #define N 100005 int par[N][18],dep[N],subtree[N]; int chainhead[N],chainid[N],pos[N],seg[4*N]; vector<int>g[N]; vector<pair<int,int> >edge; int chain,ind; void build(int n,int s,int e) { if(s==e){ seg[n]=0; ...
C++
f9407e5aafb0df3b741e76c2e7e7a890
3e63d79196f7de57f4d7169a5982a177
2,100
PASSED
#include <bits/stdc++.h> using namespace std; //.define // #define FILE_IN_OUT #define RET(_x) return cout << (_x) << '\n', 0; #define all(_obj) (_obj).begin(), (_obj).end() #define loop(_n) for (int i = 0; i < (_n); ++i) #define CeilDiv(_dividend, _divide...
C++
f9407e5aafb0df3b741e76c2e7e7a890
1805c3db32e63cee021a3c0569306b4b
2,100
PASSED
#include <bits/stdc++.h> using namespace std; //.define // #define FILE_IN_OUT #define RET(_x) return cout << (_x) << '\n', 0; #define all(_obj) (_obj).begin(), (_obj).end() #define loop(_n) for (int i = 0; i < (_n); ++i) #define CeilDiv(_dividend, _divide...
C++
f9407e5aafb0df3b741e76c2e7e7a890
0e013d6bee3357787a8305e1537e1d9d
2,100
PASSED
// Divide graph into disjoint chains then process on each chain // I think about HLD first but maybe too complicated idea for this problem #include <bits/stdc++.h> using namespace std; template<typename TH> void _dbg(const char* sdbg, TH h) { cerr << sdbg << " = " << h << "\n"; } template<typename TH, typename... ...
C++
f9407e5aafb0df3b741e76c2e7e7a890
12fda68e48536c1ee7017cbe55865a13
2,100
PASSED
#include<bits/stdc++.h> using namespace std; int dx[] = { 1,-1,0,0,1,1,-1,-1 }; int dy[] = { 0,0,1,-1,1,-1,1,-1 }; #define sz(a) int((a).size()) #define sc(x) scanf("%d",&x) #define scl(x) scanf("%lld",&x) #define MP make_pair #define ll long long #define ld long double #define rep(i,a,b) for(int i=a;i<b;i++) #define r...
C++
f9407e5aafb0df3b741e76c2e7e7a890
957d444b2994f59631f069b0c6a18243
2,100
PASSED
/* Overkill? */ #include <bits/stdc++.h> using namespace std; #define fl(i,a,b) for(int i=a;i<b;i++) #define endl '\n' #define pb push_back #define ff first #define ff first #define ss second #define mod 1000000007 #define inf 4e18 #define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); #define m...
C++
f9407e5aafb0df3b741e76c2e7e7a890
fa0517380b64e8aba094029a3d485e40
2,100
PASSED
/* Overkill? */ #include <bits/stdc++.h> using namespace std; #define fl(i,a,b) for(int i=a;i<b;i++) #define endl '\n' #define pb push_back #define ff first #define ff first #define ss second #define mod 1000000007 #define inf 4e18 #define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); #define m...
C++
f9407e5aafb0df3b741e76c2e7e7a890
d0cc6ce214debaaac149303f9afc85db
2,100
PASSED
#include<bits/stdc++.h> #define pb push_back #define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define ll long long #define pii pair<int,int> #define pll pair<ll,ll> #define f first #define s second #define int long long #define sz(x) (ll)(x.size()) using namespace std; const int mod = 1e9+7; in...
C++
f9407e5aafb0df3b741e76c2e7e7a890
213b213423352786c16b5a18b430477b
2,100
PASSED
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<ll, ll> ii; const ll maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 322; struct HDL{ HDL(const vector<vector<ii>>& adj){ n = (ll)adj.size(); heavy.assign(n, -1); depth.assign(n, 0); seg.resize(4*n); seg_arr = dist = ...
C++
f9407e5aafb0df3b741e76c2e7e7a890
0aaa4ba8d1959c1c4b39831def4a6d96
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 100005 using nam...
C++
f9407e5aafb0df3b741e76c2e7e7a890
6541dcca4a2e9adcff419371c955102a
2,100
PASSED
/* This code is written by 18to_nhanh */ #define Tourist "1305E" #include<bits/stdc++.h> #pragma GCC optimize ("Ofast") #define fi first #define se second #define pb push_back #define mp make_pair #define pb push_back #define ep emplace_back #define ll long long #define FOR(i,a,b) for(int i=a;i<=b;i++) #define FORs(i,a...
C++
b8c440664f8073d3e273878b0ca1e810
5a438f122d1801da94487cf97ffb727b
2,200
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; int sigma(int x) { return x*(x+1)/2; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n,m; cin>>n>>m; int maxp = sigma((n-1)/2)*2; if(n&1) maxp-=(n/2); if(m>maxp) { cout<<"-1\n"; return 0; } vector<int> ans; int st=1,tem...
C++
b8c440664f8073d3e273878b0ca1e810
e97695b8ee3f9f1e9d020c392a30f24f
2,200
PASSED
#include<bits/stdc++.h> #define limit 100001 using namespace std; int main() { int n,m; scanf("%d %d",&n,&m); int vv = (n-1)/2; int total = vv*(vv+1); if(n%2!=0) { total = total - vv; } if(total < m) { printf("-1\n"); return 0; } if(n == 1) { if(m == 0) { printf("1\n"); } return 0; } in...
C++
b8c440664f8073d3e273878b0ca1e810
a52bc10a0104cc81ae5ededc04d73015
2,200
PASSED
//Patwari26 #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define endl '\n' #define mii map<ll,ll> #define pii pair<ll,ll> #define vi vector<ll> #define all(a) (a).begin(),(a).end() #define F first #define S ...
C++
b8c440664f8073d3e273878b0ca1e810
40e88aa16a873b24e40b5e9f3f3e2f9b
2,200
PASSED
/* Ujjawal Pabreja */ #include <bits/stdc++.h> #include <functional> using namespace std; #define rep(i,a) for(ll i=0;i<a;i++) #define repe(i,a,b) for(ll i=a;i<b;i++) #define bac(i,a) for(ll i=a;i>=0;i--) #define bace(i,a,b) for(ll i=a;i>=b;i--) #define pb push_back #define mp make_pair #define in insert #define ...
C++
b8c440664f8073d3e273878b0ca1e810
eb623a4788525f9f1cd79da93d6e3e72
2,200
PASSED
/* Ujjawal Pabreja */ #include <bits/stdc++.h> #include <functional> using namespace std; #define rep(i,a) for(ll i=0;i<a;i++) #define repe(i,a,b) for(ll i=a;i<b;i++) #define bac(i,a) for(ll i=a;i>=0;i--) #define bace(i,a,b) for(ll i=a;i>=b;i--) #define pb push_back #define mp make_pair #define in insert #define ...
C++
b8c440664f8073d3e273878b0ca1e810
d73043600d8a1ddfecd1df6dbf01441c
2,200
PASSED
#include<iostream> #include<string.h> #include<string> #include<stdio.h> #include<algorithm> #include<vector> #include<bitset> #include<math.h> #include<stack> #include<queue> #include<set> #include<map> using namespace std; typedef long long ll; typedef long double db; typedef pair<int,int> pii; const int N=100000; co...
C++
b8c440664f8073d3e273878b0ca1e810
426d790c509bcb4b29c2ad48fba3934b
2,200
PASSED
// warm heart, wagging tail,and a smile just for you! // ███████████ // ███╬╬╬╬╬╬╬╬╬╬███ // ███╬╬╬╬╬████╬╬╬╬╬╬███ // ...
C++
b8c440664f8073d3e273878b0ca1e810
31db5cf845ff2b7113f62f3aad526820
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int #define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) int main() { fio; ll n,m;vector<ll> a;cin>>n>>m;ll p;ll i,j; if(m==0) { for(i=0;i<n;i++) cout<<(n+i+1)<<" ";return 0; } vector<ll> f;ll...
C++
b8c440664f8073d3e273878b0ca1e810
15b06c6bbb7ee56f9e2d0755027839b1
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define test() int t;cin>>t;while(t--) #define pb push_back #define nl cout<<endl #define MOD 1000000007 #define loop(i,start,end) for(int i=start;i<end;i++) #define N 100001 #define ...
C++
b8c440664f8073d3e273878b0ca1e810
19e1216f5760c2919f5fb804963d9da6
2,200
PASSED
#include <bits/stdtr1c++.h> #define MAX 1010 #define clr(ar) memset(ar, 0, sizeof(ar)) #define read() freopen("lol.txt", "r", stdin) #define dbg(x) cout << #x << " = " << x << endl #define ran(a, b) ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a)) using namespace std; bool visited[1000010]; bitset <MAX> ar[MAX]...
C++
2b78f6626fce6b5b4f9628fb15666dc4
dca838b7da580c86392bb2bb418e8bcd
2,200
PASSED
#include <iostream> #include <cmath> #include <map> #include <set> #include <vector> #include <cassert> #include <unordered_map> #include <unordered_set> #include <algorithm> #include <bitset> #include <string.h> #include <time.h> #define pb push_back #define mp make_pair using namespace std; #define fi first #defin...
C++
2b78f6626fce6b5b4f9628fb15666dc4
7caaf4edf7e68fe6d68c42c72fa7e291
2,200
PASSED
///============================================================================/// /// /// /// IT'S ME /// /// BISHAL GAUTAM ...
C++
2b78f6626fce6b5b4f9628fb15666dc4
990d0648d01bebceb62ad109bbec6db4
2,200
PASSED
///============================================================================/// /// /// /// IT'S ME /// /// BISHAL GAUTAM ...
C++
2b78f6626fce6b5b4f9628fb15666dc4
6bb46a35d3340607d25a8bebb99c8baa
2,200
PASSED
///============================================================================/// /// /// /// IT'S ME /// /// BISHAL GAUTAM ...
C++
2b78f6626fce6b5b4f9628fb15666dc4
6aa032816208e988f90a840048b1eba1
2,200
PASSED
#include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <iostream> #include <string> #include <cmath> #include <vector> #include <set> #include <map> #include <bitset> using namespace std; #define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i) #define MP make_pair #define...
C++
2b78f6626fce6b5b4f9628fb15666dc4
55c8595c29827854aa9fdb05e86a6cfe
2,200
PASSED
#include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <iostream> #include <string> #include <cmath> #include <vector> #include <set> #include <map> #include <bitset> #include <stack> using namespace std; #define REP(i,n) for ( int i=1; i<=int(n); i++ ) #define MP make_pair #define P...
C++
2b78f6626fce6b5b4f9628fb15666dc4
a6aa14beeb9507ee4eaf7b4d1ecb4593
2,200
PASSED
/*Sherlock and Watson and Adler*/ #pragma comment(linker, "/STACK:1024000000,1024000000") #include<stdio.h> #include<string.h> #include<stdlib.h> #include<queue> #include<stack> #include<math.h> #include<vector> #include<map> #include<set> #include<bitset> #include<cmath> #include<complex> #include<string> #include<alg...
C++
2b78f6626fce6b5b4f9628fb15666dc4
bd2fddb87a5b12fdb3bb9dc354322ca6
2,200
PASSED
/*Sherlock and Watson and Adler*/ #pragma comment(linker, "/STACK:1024000000,1024000000") #include<stdio.h> #include<string.h> #include<stdlib.h> #include<queue> #include<stack> #include<math.h> #include<vector> #include<map> #include<set> #include<bitset> #include<cmath> #include<complex> #include<string> #include<alg...
C++
2b78f6626fce6b5b4f9628fb15666dc4
54bc41e67a04f5d6e77bdbd3b4decbeb
2,200
PASSED
#include <vector> #include <map> #include <set> #include <queue> #include <stack> #include <algorithm> #include <sstream> #include <iostream> #include <cstdio> #include <cmath> #include <cstdlib> #include<bitset> #include <cstring> #include <string> #include <ctime> using namespace std; class Node{ public: int...
C++
2b78f6626fce6b5b4f9628fb15666dc4
7c1ee719aa16687569d2fac343eae94b
2,200
PASSED
#include <bits/stdc++.h> #define max(xx,yy) (xx > yy ? xx : yy) #define min(xx,yy) (xx > yy ? yy : xx) #define all(x) x.begin(), x.end() using namespace std; int main(){ int n,q; scanf("%d", &n); vector<vector<long long>> grid(n,vector<long long>(n)); for(long long i = 0;i < n;++i) for(long long j = 0;j < n;+...
C++
8b0ec419248bb98b5e0c3d991c7e14fb
dd3c601d55a4fe10b23feec96d0bf965
2,100
PASSED
#include <bits/stdc++.h> #define int long long using namespace std; void solve(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> help(60); help[0] = 1; for(int i = 1; i < 60; ++i){ help[i] ...
C++
8b0ec419248bb98b5e0c3d991c7e14fb
c33eba4b5bd110d824ffed685ece5b66
2,100
PASSED
/****************************************** * AHAM BRAHMASHMI ;) * ******************************************/ #include <bits/stdc++.h> using namespace std; #define ll long long #define vll vector<ll> #define pll pair<ll,ll> #define pb push_back #define mp make_pair #define F first #define S second #define mod 10000000...
C++
8b0ec419248bb98b5e0c3d991c7e14fb
2637ef1e9869154b9db6fefcf560db6b
2,100
PASSED
#include<bits/stdc++.h> #include<algorithm> #include<cmath> #include<climits> using namespace std; typedef long long int lli; typedef vector<int> vi; typedef vector<long long int> vlli; typedef pair<int,int> pii; typedef pair<long long int,long long int> plli; typedef vector< vi > vvi ; typedef vector< vlli > vvlli ; ...
C++
8b0ec419248bb98b5e0c3d991c7e14fb
09852be038074127834da9483ec59c7b
2,100
PASSED
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<math.h> #include<numeric> #include<deque> #include<assert.h> using namespace std; class PrefSum { public: PrefSum(vector<int64_t> numbers) : pref_sum(move(numbers)) { for (size_t i = 1; i < pref_sum.size(); ++i) { pref_sum[i] +=...
C++
8b0ec419248bb98b5e0c3d991c7e14fb
2335686d3fdc3c92565ca5c4ab3c983b
2,100
PASSED
#include <iostream> #include <fstream> #include <vector> #include <set> #include <map> #include <unordered_map> #include <cstring> #include <string> #include <cmath> #include <cassert> #include <ctime> #include <algorithm> #include <sstream> #include <list> #include <queue> #include <deque> #include <stack> #include <c...
C++
8b0ec419248bb98b5e0c3d991c7e14fb
b2a8360bf1cd022e86c32d1df6e38569
2,100
PASSED
#include <stdio.h> int n, q; long long r[47]; int a[47]; long long k; int x, y; int main() { scanf("%d", &n); r[0] = 1; for (int i = 1; i <= 46; i++) { r[i] = r[i - 1] * 2; } for (int i = 0; i < n; i++) { if (i % 2) { for (int j = 0; j < n; j++) { if (j < n - 1)printf("%lld ", r[i + j - 1]); else pr...
C++
8b0ec419248bb98b5e0c3d991c7e14fb
b9d24da6aeccd4eb756205bde1c38d0c
2,100
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <set> #include <map> #include <fstream> #include <queue> #include <deque> #include <numeric> #include <iomanip> #include <math.h> using namespace std; typedef long long LL; typedef vector< int > vi; typedef vector< vi > vvi; typedef ...
C++
8b0ec419248bb98b5e0c3d991c7e14fb
36cce1820c9a8f15460b243a926c6b98
2,100
PASSED
#include <cassert> #include <iostream> #include <vector> #include <map> #include <stack> #include <unordered_map> #include <unordered_set> #include <set> #include <bitset> #include <algorithm> #include <string> #include <deque> #include <queue> #include <math.h> #include <random> using namespace std; typedef long long...
C++
8b0ec419248bb98b5e0c3d991c7e14fb
6a71900bf36fa2c1367b6cb316f3e0a0
2,100
PASSED
#include <iostream> #include <math.h> #include <vector> #include <unordered_set> #include <unordered_map> #include <algorithm> #include <functional> #include <string> #include <queue> #include <map> #include<stdio.h> using std::vector; using std::pair; using std::cin; using std::cout; using std::endl; using std::make_p...
C++
8b0ec419248bb98b5e0c3d991c7e14fb
f1a29e9da4203489e8c6dbc843419460
2,100
PASSED
#include<iostream> #include<string> using namespace std; int main() { char a[100000],kil=0; bool d=false,b=false,t=false; cin.get(a,100000); for(int i=0;i<strlen(a);i++) { if(a[i]=='A' && a[i+1]=='B' && a[i+2]=='A' && t==false|| a[i]=='B' && a[i+1]=='A' && a[i+2]=='B' && t==false){t=true;if(a[i+3]=='A' && a[i+3]=='B...
C++
33f7c85e47bd6c83ab694a834fa728a2
ff1fc2a7092b310da52d7444d7764b55
1,500
PASSED