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 <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<string> #include<vector> #define N 100005 #include<map> using namespace std; int d[N]; int vis[N]; vector<int> v[N]; map<int,int> m; int p[N]; int n,a,b; bool init(){ if(a==b){ for(int i=1;i<=n;i++){ if(m[a-p[i]]...
C++
1a46737540d253583234193a026008e3
a80b5ea5c89ee4f075908d8c44d53aa1
2,000
PASSED
#pragma comment(linker,"/STACK:102400000,102400000") #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <iomanip> #include <fstream> #include <string> #include <algorithm> #include <bitset> #include <functional> #include <numeric> #in...
C++
1a46737540d253583234193a026008e3
99d753828ee7c6b691ac65a383e229cc
2,000
PASSED
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <time.h> #include <string> #include <vector> #include <stack> #include <queue> #include <deque> #include <list> #include <set> #include <map> #include <iostream> #include <algorithm> #include <complex> using namespace std; #define pb...
C++
1a46737540d253583234193a026008e3
c6f9652faf74a95d11f65ffd5bc7b1a4
2,000
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <c...
C++
1a46737540d253583234193a026008e3
2d97e507d42ec1d794c43e159e0e96ed
2,000
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; struct xyi { int value; int index; int pair_a; int pair_b; xyi() : value(0), index(0), pair_a(-1), pair_b(-1) { } bool operator<(const xyi& other) { return value < other.value; ...
C++
1a46737540d253583234193a026008e3
599dfdab2027622ae0e7e9997bced772
2,000
PASSED
#include <iostream> #include <algorithm> using namespace std; int A[100000]; bool loc[100000]; int index[100000]; int id[100000]; int sz[100000]; int canBe[100000]; //canBe = 11,01,10,00 first digit A, second digit B int find(int i) { int j = i; while(j != id[j]) j = id[j]; id[i] = j; return j; } void join(in...
C++
1a46737540d253583234193a026008e3
36e8bf2fd9cb2043632dab44b34f8064
2,000
PASSED
#include<cstdio> #include<map> std::map<int,char>f; const int N=1e5+1; int i,n,a,b,t,x[N],q[N]; int main() { for(scanf("%d%d%d",&n,&a,&b);i<n;f[x[i++]]=1)scanf("%d",x+i); for(i=0;i<n;++i)if(!f[a-x[i]])f[x[i]]=2,q[++*q]=x[i]; for(i=1;i<=*q;++i) if(!(t=f[b-q[i]]))return puts("NO");else if(t^2)f[b-q[i]]=2,f[t=a-b+q...
C++
1a46737540d253583234193a026008e3
cb6c4cf13eb07aa75db7397ef1dfe46f
2,000
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <map> #include <set> #include <stack> #include <fstream> #include <string> #include <algorithm> #include <sstream> #include <cmath> #include <queue> #include <time.h> #include <stdio.h> #include <list> #include <stdlib.h> #include <Windows.h...
C++
1a46737540d253583234193a026008e3
cec38f7a2d75d1e604f82378f37febae
2,000
PASSED
#pragma warning(disable:4996) #include<algorithm> #include<stdio.h> #include<string.h> #define MAXN 100005 using namespace std; struct E { int w; int id; E() { w=id=-1; } bool operator <(const E &a)const { return w<a.w; } bool operator ==(const E &a)const { return w==a.w; } E operator -(const E&a)cons...
C++
1a46737540d253583234193a026008e3
5e64814a704e91aa79755896bc2527bc
2,000
PASSED
#include <cstdio> #include <map> #include <algorithm> using namespace std; int color[100005]; int grp[100005]; int dat[100005]; map<int,int> idat; int getroot(int a) { int na = a; while(a != grp[a]) a = grp[a]; while(na != grp[na]) { int ta = grp[na]; grp[na] = a; na = ta; } return a; } bool merge(int a,...
C++
1a46737540d253583234193a026008e3
26e8d5a29e1ec89fc895e7e5f1919bb0
2,000
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n,d,m; cin>>n>>d>>m; vector<ll>smol,big; for(int i=0;i<n;i++){ int x;cin>>x; if(x>m)big.push_back(x); else smol.push_back(x); } sort(big.rbegin(),big.rend()); sort(smol.rb...
C++
3dc8d6d89a29b0aa0b7527652c5ddae4
5982d55c79fbbee01ed279c7161cd67d
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define ALL(x) x.begin(), x.end() #define RALL(x) x.rbegin(), x.rend() #define makeVI(a, n) VI a (n); for (int i = 0; i < n; ++i) cin >> a[i]; #define makeVVI(a, n) VVI a (n, VI (n)); for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) cin >> a[i...
C++
3dc8d6d89a29b0aa0b7527652c5ddae4
8464f31de02ed4c31b17fbba1c72da13
1,800
PASSED
#include <iostream> #include <iomanip> #include <algorithm> #include <math.h> #include <vector> #include <set> #include <map> #include <queue> using namespace std; #define ll long long #define ld long double #define px first #define py second const ll M = 998244353; const ll INF = 9223372036854775800; const ll inf ...
C++
3dc8d6d89a29b0aa0b7527652c5ddae4
32babb360a1d59bcda2b19fcf8f02188
1,800
PASSED
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,no-stack-protector,fast-math") #include <bits/stdc++.h> #define ll long long #define ld long double #define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); using namespace std; vector<long long> v1,v2; long long arr1[100010],arr2[100010]; int main() { ...
C++
3dc8d6d89a29b0aa0b7527652c5ddae4
62c76d5afa170e9365c92e8d8b810f4b
1,800
PASSED
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,no-stack-protector,fast-math") #include <bits/stdc++.h> #define ll long long #define ld long double #define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); using namespace std; vector<long long> v1,v2,v3; long long arr1[200010]; int main() { int n,...
C++
3dc8d6d89a29b0aa0b7527652c5ddae4
2ded207c75b31af212f2354a65c32b8e
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define sz(x) (int) (x).size() int main(){ ios::sync_with_stdio(0); cin.tie(0); int n,d,m; cin>>n>>d>>m; vector<ll> big, small; big.reserve(n+1); small.reserve(n); for (int i=0; i<n; ++i){ int x; cin>>x; if (...
C++
3dc8d6d89a29b0aa0b7527652c5ddae4
310d3e5eeef2a4e3449ff6631964c1fe
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define sz(x) (int) (x).size() int main(){ ios::sync_with_stdio(0); cin.tie(0); int n,d,m; cin>>n>>d>>m; //'big' numbers are greater than 'm' - they will cause muzzling // all others are 'small' vector<int> big, small; ...
C++
3dc8d6d89a29b0aa0b7527652c5ddae4
f9612ecadf0ec102eece98f97db589f7
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define sz(x) (int) (x).size() int main(){ ios::sync_with_stdio(0); cin.tie(0); int n,d,m; cin>>n>>d>>m; vector<ll> big, small; big.reserve(n+1); small.reserve(n); for (int i=0; i<n; ++i){ int x; cin>>x; if (...
C++
3dc8d6d89a29b0aa0b7527652c5ddae4
8e1f16c733d6c7094bb4d38a66c0d79f
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define sz(x) (int) (x).size() int main(){ ios::sync_with_stdio(0); cin.tie(0); int n,d,m; cin>>n>>d>>m; //'big' numbers are greater than 'm' - they will cause muzzling // all others are 'small' vector<int> big, small; ...
C++
3dc8d6d89a29b0aa0b7527652c5ddae4
46637c095d0f5a5e06be51c5c5f1de3d
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define sz(x) (int) (x).size() int main(){ ios::sync_with_stdio(0); cin.tie(0); int n,d,m; cin>>n>>d>>m; vector<ll> big(1), small; for (int i=0; i<n; ++i){ int x; cin>>x; if (x>m) big.push_back(x); else small.pus...
C++
3dc8d6d89a29b0aa0b7527652c5ddae4
8446969f4e6d5ca68763bdf099478408
1,800
PASSED
#include<iostream> #include<cstdio> #include<stdlib.h> #include<algorithm> #define ll long long #define SIZE 100006 using namespace std; typedef struct {int ind; float t;} node; node dui[SIZE]; bool comp(const node &a, const node &b){ return a.t<b.t; } float store; int main(void){ int n, p;float sum=0, ans, psum=0;bo...
C++
1c2fc9449989d14d9eb02a390f36b7a6
3e45b33549daf4f2be0a6f583d5b9efa
1,800
PASSED
#include<iostream> #include<cstdio> #include<stdlib.h> #include<algorithm> #define ll long long #define SIZE 100006 using namespace std; typedef struct {int ind; float t;} node; node dui[SIZE]; bool comp(const node &a, const node &b){ return a.t<b.t; } int a, b; float store; int main(void){ int n, p;float sum=0, ans,...
C++
1c2fc9449989d14d9eb02a390f36b7a6
1dffbc19c03d95adea4222a5aeb2c4a0
1,800
PASSED
#include<iostream> #include<cstdio> #include<stdlib.h> #include<algorithm> using namespace std; typedef struct {int power; float t;} node; node device[100006]; bool comp(const node &a, const node &b){ return a.t < b.t; } int n, p, a, b; int main(){ float storage, sum=0, ans, powersum=0;bool flag = false; long long ch...
C++
1c2fc9449989d14d9eb02a390f36b7a6
f7d036c63d487a7517f15b469b282338
1,800
PASSED
#include<iostream> #include<cstdio> #include<stdlib.h> #include<algorithm> using namespace std; typedef struct {int power; float t;} node; node device[100006]; bool comp(const node &a, const node &b){ return a.t < b.t; } float storage; int main(){ int n, p;float sum=0, ans, powersum=0;bool flag = false; long long chec...
C++
1c2fc9449989d14d9eb02a390f36b7a6
f1111f5c52b46168ffb5498ea7c40084
1,800
PASSED
#include<iostream> #include<cstdio> #include<stdlib.h> #include<algorithm> using namespace std; typedef struct {int power; float t;} node; node device[100006]; bool comp(const node &a, const node &b){ return a.t < b.t; } int n, p, a, b; float storage; int main(){ float ans, sum=0, powersum=0; bool flag = false; long...
C++
1c2fc9449989d14d9eb02a390f36b7a6
16eb4a6929161a4f596f26c5058f578e
1,800
PASSED
#include<iostream> #include<cstdio> #include<stdlib.h> #include<algorithm> using namespace std; typedef struct {int power; float t;} node; node device[100006]; bool comp(const node &a, const node &b){ return a.t < b.t; } int n, p; int main(){ float storage, sum=0, ans, powersum=0;bool flag = false; long long check=0;...
C++
1c2fc9449989d14d9eb02a390f36b7a6
7eba45ae95f1212417028ee370692359
1,800
PASSED
#include<iostream> #include<cstdio> #include<stdlib.h> #include<algorithm> using namespace std; typedef struct {int power; float t;} node; node device[100006]; bool comp(const node &a, const node &b){ return a.t < b.t; } int n, p, a, b; int main(){ float storage, sum=0, ans, powersum=0;bool flag = false; long long ch...
C++
1c2fc9449989d14d9eb02a390f36b7a6
edc704f4931d290e2c000c041aff8567
1,800
PASSED
#include<iostream> #include<cstdio> #include<stdlib.h> #include<algorithm> using namespace std; typedef struct {int power; float t;} node; node device[100006]; bool comp(const node &a, const node &b){ return a.t < b.t; } int n, p, a, b; double powersum, sum; int main(){ float ans, storage; bool flag = false; long l...
C++
1c2fc9449989d14d9eb02a390f36b7a6
f2ee83a67de19a29c188d2f9a95c507e
1,800
PASSED
#include <cstdio> #include <cmath> using namespace std; long n, p, a, b; long start[100100]; long worst[100100]; double inf = 1000000000000000000; bool isok(double t) { double current = t; for (long i = 0; i < n; i++) { double go = worst[i] * t; if (start[i] < go) { double temp = ((long double)(worst[i] * t...
C++
1c2fc9449989d14d9eb02a390f36b7a6
56fd54217559f52923900acd8fb988db
1,800
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const long double eps = 1e-6; const long double inf = 1e14; long double sol = 0; long double a[N], b[N], p; int n, op = 300; void init() { long double t = 0.0; for (int i = 1; i <= n; i++) t += a[i]; if (t <= eps + p) { puts ("-1"); ...
C++
1c2fc9449989d14d9eb02a390f36b7a6
6a9e845889471a9d8756816e06f33885
1,800
PASSED
#include <bits/stdc++.h> using namespace std; string S; long long l, stopRep, pree; int main(){ cin>>S; l = S.size(); if(S[0]!='a'){ long long i; for(i=0; i<l; i++){ if(S[i] == 'a') break; cout << --S[i]; } for(i=i;i<l;i++) cout << S[i]; } else { long long i = 0; while(S[i]=='a' && i<l-1)cout<...
C++
e70708f72da9a203b21fc4112ede9268
2599d67343183386da3e94273d59d188
1,200
PASSED
// CODED BY : Super_KAZAKH(-: >----> Yedige Ashirbek #include <cstring> #include <algorithm> #include <vector> #include <set> #include <map> #include <deque> #include <fstream> #include <stdio.h> #include <cmath> #include <iomanip> #include <iostream> #include <stack> #include <queue> #include <climits> #include <st...
C++
e70708f72da9a203b21fc4112ede9268
c9eecccbefc7c8177a9a5bd0f291a5b2
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define endl '\n' #define spc ' ' #define pi 2*acos(0.0) #define sqr(a) (((a) * (a))) #define ffor(i,a,b) for( __typeof(b) i = a; i<=b ; ++i ) #define rfor(i,a,b) for( __typeof(b) i = a; i>=b ; --i ) #define min3(a,b,c) min(a,min(b,c)) #define max3(a,b,c) max(a,max(b,c))...
C++
e70708f72da9a203b21fc4112ede9268
94b23c15ed972451564318e102e5c54c
1,200
PASSED
#include <bits/stdc++.h> using namespace std; #define f(i,n) for(int i=0;i<n;i++) #define rep(i,a,b) for(int i=a;i<=b;i++) #define r(v) {reverse(all(v));} #define pb push_back #define mp make_pair #define sf(x) sort(x.begin(),x.end(),func) #define s(x) sort(x.begin(),x.end()) #define all(v) v.begin(),v.end() #define l...
C++
e70708f72da9a203b21fc4112ede9268
2e11a952634e5501c04295f1ae9bf21d
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define asgnarr(a,n) for(int i=0;i<n;i++)cin>>a[i] #define fast ios_base::sync_with_stdio(false) #define loop(a,b) for(int i=a;i<b;i++) #define mem(a,x) memset(a,x,sizeof(a)) typedef long long lli; typedef long li; typedef unsigned long long ulli; typedef unsigned long int ...
C++
e70708f72da9a203b21fc4112ede9268
2d0ffb783519be7ffc3872da72cb9cb3
1,200
PASSED
#include<cstdio> #include<cstring> using namespace std; char a[100005]; int main(void){ scanf("%s",a); char pre; bool flag=0; int len=strlen(a); for(int i=0;i<len;++i){ if(i==0){ pre=a[i]; if(a[i]!='a'){ a[i]--; flag=1; } ...
C++
e70708f72da9a203b21fc4112ede9268
faaee3a217bedbf75ed72580443e9e8f
1,200
PASSED
#include<bits/stdc++.h> #include<iostream> using namespace std; int main(){ char s[100000]; scanf("%s",s); int len = strlen(s); if(s[0]!='a'){ for(int i=0;i<len;i++){ if(s[i]=='a') break; int d = s[i]-97; d = (d-1)%26; s[i] = d + 97; } }else{ int j=1; for(int i=1;i<len;i++){ if(s[i]=='a'...
C++
e70708f72da9a203b21fc4112ede9268
4af81c8e6f3fb32009e53105dec1141e
1,200
PASSED
#include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; char str[100006]; int main() { while (~scanf("%s", &str)) { int len = strlen(str); bool all_a = 1; for (int i = 0; i < len; i++) if (str[i] != 'a') { all_a = 0; break; } if (all_a) { str[len - 1] = 'z'; ...
C++
e70708f72da9a203b21fc4112ede9268
62f12cd94a9f5a0d9c266b56f03afe39
1,200
PASSED
#include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; char str[100005]; int main() { while (~scanf("%s", &str)) { bool flag = 0; int len = strlen(str); for (int i = 0; i < len; i++) { if (str[i] == 'a' && flag)break; else if (str[i] == 'a' && i < len - 1)continue;...
C++
e70708f72da9a203b21fc4112ede9268
9a18f7cf3e691ef1eeca8a934db8345e
1,200
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { string s; cin>>s; int idmin,idmax; bool flag=false; int i,j; for(i=0; i<s.size(); i++) { if(s[i]=='a') continue; flag=true; idmin=i; for(j=i+1; j<s.size()&&s[j]!='a'; j++) ...
C++
e70708f72da9a203b21fc4112ede9268
b4a6970956cf2c06968edae1a53979c8
1,200
PASSED
#include <bits/stdc++.h> using namespace std; #define READ() freopen("in.txt","r",stdin) #define WRITE() freopen("out.txt","w",stdout) #define sf(n) scanf("%d",&n) #define sl(x) scanf("%I64d",&x) #define lsf(n) scanf("%lld", &n) #define pb(n) push_back(n) #define mem(x,y) memset(x,y,s...
C++
a30b5ff6855dcbad142f6bcc282601a0
5e2b1ae6134eac583cbd4484f5820a4b
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define READ() freopen("in.txt","r",stdin) #define WRITE() freopen("out.txt","w",stdout) #define sf(n) scanf("%d",&n) #define sl(x) scanf("%I64d",&x) #define lsf(n) scanf("%lld", &n) #define pb(n) push_back(n) #define mem(x,y) memset(x,y,s...
C++
a30b5ff6855dcbad142f6bcc282601a0
50f719757bee9e250d17496ac97d1f56
1,600
PASSED
#include<bits/stdc++.h> #define ll long long int #define pb push_back #define mod 1000000007 #define pi (3.141592653589) #define deb(n) cerr << #n << " = " << (n) << " "; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precisio...
C++
a30b5ff6855dcbad142f6bcc282601a0
a56adaf1d1ec1fe7e6c402c6c6ad3975
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define lli long long int const lli mod=1e9+7; const lli pINF=LLONG_MAX; const lli nINF=-LLONG_MAX; void fast() {std::ios::sync_with_stdio(false);cin.tie(NULL);} lli power(lli a,lli b){lli ans=1;while(b!=0){ if(b%2==1){ans*=a;}b/=2;a*=a;} return ans;} lli invmod(lli a) {retu...
C++
a30b5ff6855dcbad142f6bcc282601a0
1ade4d1c65d523654c61187944ea89c0
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define ll long long struct node { int first,second; }a[400001]; bool check(node x,node y) { if(x.first==y.first) return x.second<y.second; return x.first<y.first; } int sc[3]={0}; int main() { int i,j,k,l,n,m; //int sc1=0,sc2=0; cin>>n; f...
C++
a30b5ff6855dcbad142f6bcc282601a0
37525a6b35ca23b2a4ef8079b2ed70e7
1,600
PASSED
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #incl...
C++
a30b5ff6855dcbad142f6bcc282601a0
f0b6f4476f9c10f612dae6da9a4c44c0
1,600
PASSED
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #incl...
C++
a30b5ff6855dcbad142f6bcc282601a0
1ecae6a12234ff7008c45618c8b0880a
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define DEBUG if(1) #define MAX INT_MAX #define MAXLL INT_MAX #define MAXU ULLONG_MAX #define MIN -2000000 #define endl "\n" #define INF INT_MAX #define MOD 1000000007 #define s(n) scanf("%d", &n) #define ss(a,b) scanf("%d %d",&a,&b) #define pb push_back #define mp make_p...
C++
a30b5ff6855dcbad142f6bcc282601a0
7f336b9a780ce5e228c703e50abdf376
1,600
PASSED
#include <bits/stdc++.h> #define inf 1e9 #define NN 200100 using namespace std; typedef long long INT; int a[NN], b[NN]; int main(){ #ifndef ONLINE_JUDGE freopen("in.in", "r", stdin); freopen("out.out", "w", stdout); #endif int ans1, ans2, mx = -inf; int n, m; scanf("%d", &n); for(int i = 0; i < n; i++) scanf("...
C++
a30b5ff6855dcbad142f6bcc282601a0
e38a43ef145f0f39a66c2f41209a368f
1,600
PASSED
#include <bits/stdc++.h> #define pb push_back #define x first #define y second using namespace std; typedef double DO; typedef long long INT; typedef pair<int,int> pii; typedef pair<pii,int> pi3; template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;} template<typename T, typename U> inline v...
C++
a30b5ff6855dcbad142f6bcc282601a0
458e6bdf9c2e83f770d9eb84fb01d9af
1,600
PASSED
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <vector> #include <algorithm> using namespace std; #define FOR(i,n) for (int i = 0; i < (n); i++) #define FORI(i,s) FOR(i,(int)s.size()) #define BEND(x) (x).begin(),(x).end() #define ll long long ll n, m, lo, hi; vector<int> diviso...
C++
d5028210eb4bbbbc3dcded435535ae85
c6c4ca0c8ada06d6d2b6ce87e6c8a8dc
3,000
PASSED
#include <bits/stdc++.h> #define FOR(i,a,b) for(register int i=(a);i<(b);++i) #define ROF(i,a,b) for(register int i=(a);i>=(b);--i) #define pi pair<int,int> #define mk(a,b) make_pair(a,b) #define fi first #define se second #define ls(x) ch[x][0] #define rs(x) ch[x][1] #define xs(x) (ch[fa[x]][1]==x) using namespace std...
C++
d5028210eb4bbbbc3dcded435535ae85
27eaa4e4fc32c92363fc4b83a7189760
3,000
PASSED
#include<cstdio> #include<algorithm> #include<set> #include<queue> #include<vector> #define mp make_pair using namespace std; set<long long>s; priority_queue<pair<long long,int> >q; int vis[200010]; long long ans[200010][7]; int t[200010]; int n,m; long long l,r; long long read() { long long ans=0; char ch=getchar()...
C++
d5028210eb4bbbbc3dcded435535ae85
148aa209628284e52c44accf186db636
3,000
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=2e5+5; int n,m,M,T[N*3],g,b,a,t,x,i,ans[N]; ll L,R; inline void mdy(int x,int v){ for(x+=M;x;T[x]=v,x>>=1); } inline int ask(int l,int r){ int ret=0; for(l+=M-1,r+=M+1;l^r^1;l>>=1,r>>=1){ if(!(l&1))ret=max(ret,T[l^1]); if(r&1)ret=max...
C++
d5028210eb4bbbbc3dcded435535ae85
633b546bb1afad0dd310d975d2932c16
3,000
PASSED
#include<bits/stdc++.h> using namespace std; int n,m,i,j; long long l,r; vector<int> d[200005]; int main() { cin>>n>>m>>l>>r; for(i=1;i<=n;++i) for(j=i;j<=n;j+=i) d[j].push_back(i); for(i=1;i<=n;++i) { long long ul=(l+i-1)/i,ur=r/i; ur=min(ur,1ll*m); if(ul>m||ul>ur) { puts("-1"); continue; } ...
C++
d5028210eb4bbbbc3dcded435535ae85
c5181b523caaf93cdf0a8d7819203007
3,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=200005; const int inf=0x3f3f3f3f; int n,m,ans[maxn][2],mn[maxn<<2]; ll l,r; #define ls (rt<<1) #define rs (rt<<1|1) #define pushup(rt) (mn[rt]=min(mn[ls],mn[rs])) void build(int rt,int l,int r) { mn[rt]=inf; if(l==r) return; int mid=(...
C++
d5028210eb4bbbbc3dcded435535ae85
8129bc1b737cfd9422b2fc64691fdd6b
3,000
PASSED
#include<bits/stdc++.h> #define FOR(i,a,b) for(register int i=(a);i<=(b);i++) #define REP(i,a,b) for(register int i=(a);i>=(b);i--) #define pb push_back #define fi first #define se second #define hvie '\n' #define debug cerr<<("QAQ")<<hvie const int inf=0x3f3f3f3f; #define int long long using namespace std; typedef pai...
C++
d5028210eb4bbbbc3dcded435535ae85
3830488f060ecf332b03686befb45e06
3,000
PASSED
#include<iostream> #include<cstdio> #include<set> #define ll long long using namespace std; const int Maxn=2e5+10; int n,m,vis[Maxn]; ll l,r; struct node{ int x1,y1,x2,y2; }ans[Maxn]; namespace Seg{ pair<int,int> w[Maxn<<2]; struct Init{ Init(){ for (int i=1;i<(Maxn<<2);i++) w[i]=make_pair(Maxn,0); ...
C++
d5028210eb4bbbbc3dcded435535ae85
bbfa4796568c17661bac3217aa35d824
3,000
PASSED
#include <stdio.h> #include <iostream> #include <stdlib.h> #include <string.h> #include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <deque> #include <cmath> #include <utility> #include <algorithm> #include <bitset> #include <climits> #include <random> #include <chrono> #include <ca...
C++
d5028210eb4bbbbc3dcded435535ae85
187394f09f0184af345a43e8eb31ae91
3,000
PASSED
#include <stdio.h> #include <iostream> #include <stdlib.h> #include <string.h> #include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <deque> #include <cmath> #include <utility> #include <algorithm> #include <bitset> #include <climits> #include <random> #include <chrono> #include <ca...
C++
d5028210eb4bbbbc3dcded435535ae85
4583f9059ba2db7d3549a632100b013d
3,000
PASSED
import java.util.*; import java.io.*; public class Main { static class Scan { private byte[] buf=new byte[1024]; private int index; private InputStream in; private int total; public Scan() { in=System.in; } public int scan()throws IOExcepti...
Java
28610d192329c78580db354f8dfc4094
45e2500c21d0c477aa7d32f72ebec4e4
1,000
PASSED
import java.io.*; import java.util.*; public class Main{ static long ceil(long a, long b) { return (a+b-1)/b; } public static void main(String[] args) throws IOException{ int t = sc.nextInt(); while (t-->0){ long x = sc.nextInt()-1; long y = sc.nextInt(); long torch = sc.nextLong(); long needed ...
Java
28610d192329c78580db354f8dfc4094
3a7adb1541f39a5b927e9b75bbb146fb
1,000
PASSED
import java.util.Scanner; public class App { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long t = sc.nextInt(); for (long c = 1; c <= t; c++) { long count = 0; long x = sc.nextInt(); long y = sc.nextInt(); lon...
Java
28610d192329c78580db354f8dfc4094
41e7091907cf183ae20d4d5ee8f82749
1,000
PASSED
import java.net.Inet4Address; import java.nio.channels.InterruptedByTimeoutException; import java.util.*; import java.io.*; import java.text.*; import java.math.*; public class Main { public static FastIO file = new FastIO(); private static void solve() { int amount = nextInt(); long coalTrade...
Java
28610d192329c78580db354f8dfc4094
f06063ad3cdf6915f1f868f248fabbae
1,000
PASSED
import java.util.*; public class solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { long x=sc.nextLong(); long y=sc.nextLong(); long k=sc.nextLong(); long s=k*(y+1); long a; s=s-1; if(s%(x-1)==0) { a=s/(x-1...
Java
28610d192329c78580db354f8dfc4094
c5e10a5d6b37b9a685a3a51187b43a80
1,000
PASSED
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class CodeForces { private final static Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in))); private static long solve(int x, int y, int k) { //get k coals long sticksNeede...
Java
28610d192329c78580db354f8dfc4094
09b227a9c667d6b074716091b2647ef9
1,000
PASSED
//package hiougyf; import java.io.*; import java.util.*; import java.util.Map.Entry; public class Solution { public static void main(String[] args){ Scanner sc =new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { long x=sc.nextLong(),y=sc.nextLong(),k=sc.nextLong(); long v= (k*y+k-1); long p=...
Java
28610d192329c78580db354f8dfc4094
4ff6b4b2ee1d798a87d60d17f72a4b43
1,000
PASSED
//package hiougyf; import java.io.*; import java.util.*; import java.util.Map.Entry; public class Solution { public static void main(String[] args){ Scanner sc =new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { long x=sc.nextLong(),y=sc.nextLong(),k=sc.nextLong(); long v= (k*y+k-1); long an...
Java
28610d192329c78580db354f8dfc4094
c94ee48c4b27c2e716b10b2bc5acc6a9
1,000
PASSED
import java.util.*; import java.io.*; public class A { private static final int mod =(int)1e9+7; public static void main(String[] args) throws Exception { Scanner sc=new Scanner(System.in); PrintWriter out=new PrintWriter(System.out); int t=sc.nextInt(); while(t-->0) { lo...
Java
28610d192329c78580db354f8dfc4094
668e8ce1add4529ab8d3767de66537b2
1,000
PASSED
import java.util.*; import java.lang.*; import java.io.*; public class Test { public static void main (String[] args) throws java.lang.Exception { Scanner s=new Scanner(System.in); int test=s.nextInt(); for(int i=0;i<test;i++) { long x=s.nextInt(); long y=s.nextInt(); ...
Java
28610d192329c78580db354f8dfc4094
4d9cea19db5d1f2db22c39acedc31891
1,000
PASSED
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools # import time,random,resource # sys.setrecursionlimit(10**6) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 mod2 = 998244353 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(...
Python
df92643983d6866cfe406f2b36bec17f
1c88b940dfd382f75b65068001fdff8f
1,500
PASSED
n=int(input()) if n<3: print ("-1") elif n*n%4: print(n*n//2,n*n//2+1) else: print(n*n//4-1,n*n//4+1)
Python
df92643983d6866cfe406f2b36bec17f
645dd7f6a0a48e98dc8db18969c68dd7
1,500
PASSED
n=int(input()) if n==1 or n==2: print(-1) else: if n%2==0: a = (n**2//4 -1) c= (n**2//4 +1) print(a,c,end=" ") else: a = ((n*n-1)//2) c = ((n*n+1)//2) print(a,c,end=" ")
Python
df92643983d6866cfe406f2b36bec17f
56c85604327fb6509474db780edc6e80
1,500
PASSED
######### ## ## ## #### ##### ## # ## # ## # # # # # # # # # # # # # # # # # # # # # # # ### # # # # # # # # # # # # # ##### # # # # ### # # # # # # # # ##### # # # # # # # # # # # # # # # # # # #########...
Python
df92643983d6866cfe406f2b36bec17f
8829a088d4127822cf549f527777731d
1,500
PASSED
n = int(input()) def main(): if n <= 2: print(-1) return if n % 2 == 0: print( (n//2)**2 + 1, (n//2)**2 - 1 ) else: print( (n**2-1)//2, (n**2+1)//2) main()
Python
df92643983d6866cfe406f2b36bec17f
ac4c1b3f6ff7ca6095a4b973a5cb6685
1,500
PASSED
n = int(input()) if n == 1 or n == 2: print(-1) quit() if n == 4: print(3, 5) quit() m = n // 2 if n % 2 == 0: print(m ** 2 - 1, m ** 2 + 1) else: print(2 *(m ** 2) + 2 * m, 2 * (m ** 2) + 2 * m + 1)
Python
df92643983d6866cfe406f2b36bec17f
3f9f0fc10efa8e0eab562f6bfb09de66
1,500
PASSED
import math, cmath parse_int = lambda: list(map(int, input().split())) n = int(input()) if n < 3: print(-1) exit() if n % 4 == 0: n //= 4 print(n*3, n*5) exit() a = n mno = 1 for i in range(2, min(n, round(math.sqrt(n))+3)): if n % i == 0: a, mno = i, n // i if a == 2: a, ...
Python
df92643983d6866cfe406f2b36bec17f
c9c35afbc54f3c0a9877eabb8c483a10
1,500
PASSED
n = int(input()) if n < 3: print(-1) elif n % 2 == 1: print(n**2//2, n**2//2+1) elif n % 4 == 0: print(n//4*3, n//4*5) else: k = 2 if n&2 else 1 n //= k b, c = n**2//2, n**2//2+1 print(b*k, c*k)
Python
df92643983d6866cfe406f2b36bec17f
8698380fa4b983328406cd8bfde70267
1,500
PASSED
n = int(input()) if n < 3: print(-1) elif n % 4 == 0: print(n//4*3, n//4*5) else: k = 2 if n&1 == 0 else 1 n //= k b, c = n**2//2, n**2//2+1 print(b*k, c*k)
Python
df92643983d6866cfe406f2b36bec17f
838db8c27afd49b89e480bbdad9b0e2d
1,500
PASSED
def prim(x): p=1 for i in range(2,int(x**(0.5))+1): #print(i) if x%i==0: p=x//i return p return x b=int(input()) a=0 c=0 p=1 if b%2!=0: p=2 b*=2 m=b//2 n=1 #print(m,n) a=m**2-n**2 c=m**2+n**2 if (a%p==0 and c%p==0 and a>0 and c>0): print(a//p,c//p) els...
Python
df92643983d6866cfe406f2b36bec17f
e4bf6366a0ad47e83365a4e8987cc5c7
1,500
PASSED
def main(): n=int(input()) print(2) for i in range(2,n+1): print(i*(i+1)**2-(i-1)) main() ''' 1=>2: 2->4 [2] 2=>3: 2->36 [17] 3=>4: 6->144 [46] 4=>5: 12->400 [97] 5=>6: 20->900 [176] '''
Python
6264405c66b2690ada9f8cc6cff55f0b
c110c795a3144221aa279294612eb2aa
1,600
PASSED
from math import * n = int(input()) x0 = 2 k = 1 while (k < n+1): r = (k*k*(k+1)*(k+1) - x0)/k x0 = k*(k+1) k = k+1 print(int(r))
Python
6264405c66b2690ada9f8cc6cff55f0b
1b3f7bde8bff7d3d5118f224d6c3d01b
1,600
PASSED
n = (int)(input()) print(2) if n>1: for i in range(2,n+1): print((i+2)*(i*i)+1)
Python
6264405c66b2690ada9f8cc6cff55f0b
a2a42bcc800f0a07422905f8c723a751
1,600
PASSED
n = (int)(input()) for i in [2]+[(x+2)*(x*x)+1 for x in range(2,n+1)]: print(i)
Python
6264405c66b2690ada9f8cc6cff55f0b
17a715f6e402091827d789696cef36a5
1,600
PASSED
n = int(input()) for i in range(1,n+1): if i==1: print(2) else: print(((i+1)*(i+1)*i)-(i-1))
Python
6264405c66b2690ada9f8cc6cff55f0b
1e332fd2d6f87d958d8d7939af5048ee
1,600
PASSED
x=2 for i in range(1, int(input())+1): print(i*(i+1)**2-x) x=i # Made By Mostafa_Khaled
Python
6264405c66b2690ada9f8cc6cff55f0b
a7e3bf6e407183e5061f54b64ab92846
1,600
PASSED
n=int(input()) print(2) for i in range(2,n+1): print(i*((i+1)**2)-i+1)
Python
6264405c66b2690ada9f8cc6cff55f0b
2dc99db0426770cca257e443055773df
1,600
PASSED
n = int(input()) cur = int(2) i = int(1) nxt = int() print(2) while i < n: i = i + 1 nxt = i * (i + 1) print (int(((nxt * nxt) - cur) / i)) cur = nxt;
Python
6264405c66b2690ada9f8cc6cff55f0b
477cd6e7a903e90f54e7cab8551c60fa
1,600
PASSED
n=int(input()) c=2 s=4 for i in range(1,n+1): s=i**2*(i+1)**2 t=int((s-c)/i) print(t) c=int(s**0.5)
Python
6264405c66b2690ada9f8cc6cff55f0b
c066cada5a7ffa3a99f36f4c38197bc7
1,600
PASSED
n=int(input()) k=1 m=2 aux=2 tmp = 4 while n > 0: print((m*m - aux)//k) k+=1 aux = m m += tmp tmp += 2 n -=1
Python
6264405c66b2690ada9f8cc6cff55f0b
cc3c65e6bddc09a961e4e8f84097139f
1,600
PASSED
#include <vector> #include <queue> #include <map> #include <set> #include <utility> //Pair #include <algorithm> #include <sstream> // istringstream>> ostring stream<< #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <cstring> #include <limits> using...
C++
d3bdb328e4d37de374cb3201c2a86eee
3ba6a61424b60c4951761f97b17f32e8
2,000
PASSED
#include <vector> #include <queue> #include <map> #include <set> #include <utility> //Pair #include <algorithm> #include <sstream> // istringstream>> ostring stream<< #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <cstring> #include <limits> using...
C++
d3bdb328e4d37de374cb3201c2a86eee
ece183566b002e027e55dcd1589c2782
2,000
PASSED
#include <bits/stdc++.h> #define pb push_back using namespace std; vector <long long> v[100005]; long long n, use[100005], m, gr[100005], ans2, ans1, ok, ans; bool dfs(long long k, long long depth) { use[k]=2-depth%2; if(depth%2==0) ans1++; else ans2++; for(long long i=0;i<v[k].size();i++) { ...
C++
d3bdb328e4d37de374cb3201c2a86eee
fc1d3526f62a55f29cc318f7c2a16e7c
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int MAX=100005; long long ans =0,sz[2]; bool cycle = false; int col[MAX]; bool marked[MAX]; vector <long long> edges[MAX]; bool cnt[100005],ty=0; long long NC3(long long n){ return (n*(n-1)*(n-2))/6; } void dfs(int v){ marked[v] = true; ans += sz[col[v]]; sz[...
C++
d3bdb328e4d37de374cb3201c2a86eee
3b9973812efcc7de80f24fe9fc55b83e
2,000
PASSED
#include <bits/stdc++.h> #define O(x,y) cout << x << " " << y << "\n" using namespace std; const int Maxn=100005; bool col[Maxn],Marked[Maxn]; vector <int> edges[Maxn]; long long sz[2],ans=0; inline long long NC3(long long n){ return (n*(n-1)*(n-2))/6; } void dfs(int v){ Marked[v] = true; ans += sz[col[v]]; sz[...
C++
d3bdb328e4d37de374cb3201c2a86eee
ad31d0e9978bbb24e3cc9b23d1594318
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int MAX=100005; long long ans =0,sz[2]; bool cycle = false; int col[MAX]; bool marked[MAX]; vector <long long> edges[MAX]; bool cnt[100005],ty=0; long long NC3(long long n){ return (n*(n-1)*(n-2))/6; } long long NC2(long long n){ return (n*(n-1))/2; } void dfs(int...
C++
d3bdb328e4d37de374cb3201c2a86eee
fe49e1912e3e0ee34fee6b7adfe02d64
2,000
PASSED
#include <bits/stdc++.h> using namespace std; int color[100005]; vector< int > g[100005]; vector< int > ccs[100005]; bool isBipartite(int i, int j ){ queue< int > q; q.push( i ); color[i]= 0; ccs[j].push_back( i ); while( !q.empty() ){ int u= q.front(); q.pop(); for( int k= 0; k< g[u].size(); ++k ){ ...
C++
d3bdb328e4d37de374cb3201c2a86eee
7e1303aaee8a12255e994f1fcd3afd3a
2,000
PASSED
#include <cstdio> #include <vector> using namespace std; #define int long long const int MAX = 1e5 + 5; int n, m; bool color[MAX], vis[MAX]; vector<int> G[MAX], cur; int u, v; bool dfs(int u) { cur.push_back(u), vis[u] = 1; bool res = 1; for(int i=0; i < (int) G[u].size(); ++i) { int v = G[u][i];...
C++
d3bdb328e4d37de374cb3201c2a86eee
99f6415e7aafac35b00674be498977e6
2,000
PASSED
#include <iostream> #include <assert.h> #include <stdio.h> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <string> #include <string.h> #include <cmath> #include <memory.h> #include <algorithm> using namespace std; typedef long long ll; int n, m, p[100000], sz[100000], d[10000...
C++
d3bdb328e4d37de374cb3201c2a86eee
4e8fc3f1b38c86d1814c8039624db2d0
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5+10; vector<int>G[MAXN]; int degree[MAXN]; void init (){ for (int i = 0; i < MAXN; i++){ G[i].clear(); degree[i] = 0; } } int color[MAXN]; long long n, m; long long solve(){ long long res = 0; memset(color, -1, sizeof (col...
C++
d3bdb328e4d37de374cb3201c2a86eee
72efc97299d3bbcdb9cee53e8f244280
2,000
PASSED