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<cstdio> #include<iostream> using namespace std; int n,m,q,t,w,f,g,p,lim,a[1<<25],unlimited,illegal; inline int qp(int b,int f){int res=1;for(;f;f>>=1,b=b*1ll*b%p) if(f&1) res=res*1ll*b%p;return res;} inline void update(int dep,int pos,int val){ int x=a[(2<<dep)+pos],y=a[(3<<dep)+pos],&z=a[(1<<dep)+pos];...
C++
b7cbf0465cac777120f2a1ad52964a46
6a63508ec2c6b0902ea2e9d5d48f0af2
3,500
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int n, m, t, w; cin >> n >> m >> t >> w; t = min(t, 1 << __builtin_ctz(n)); int lim = __lg(n - 1) + 1; vector<int> a(1 << (lim + 1)); for (int i = 0; i < 1 << lim; i++) { a[i |...
C++
b7cbf0465cac777120f2a1ad52964a46
3ea5b413e90bb9579db00c1f3ab4b655
3,500
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int n, m, t, w; cin >> n >> m >> t >> w; t = min(t, 1 << __builtin_ctz(n)); int lim = __lg(n - 1) + 1; vector<int> a(1 << (lim + 1)); for (int i = 0; i < 1 << lim; i++) { a[i |...
C++
b7cbf0465cac777120f2a1ad52964a46
3e587277928226c9f74ff82160310160
3,500
PASSED
#include <algorithm> #include <cstdio> #include <cstring> #include <vector> #include <iostream> using namespace std; const int N = 10000005, Q = 100005; int n, m, t, w, q, lgt, lb; int a[N], p[Q]; int fa[N], sz[N], v[N]; int lt[N]; int tot, cnt; bool u[N]; pair<int, int> query(int x) { x &= lb - 1, x = lb - 1 - x;...
C++
b7cbf0465cac777120f2a1ad52964a46
354212137888ae4f13ae2cbbe7a4fbc7
3,500
PASSED
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <vector> using namespace std; const int N = 10000005, Q = 100005; int n, m, t, w, q, lgt, lb; int a[N], p[Q]; int fa[N], sz[N], v[N]; int lt[N]; int tot, cnt; bool u[N]; pair<int, int> query(int x) { x &= lb - 1, x = lb - 1 - x;...
C++
b7cbf0465cac777120f2a1ad52964a46
8786a5d54ab4f2936c71938c12de9f08
3,500
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define sz(a) (int)(a.size()) const ll linf = (ll) 2e18; const int inf = (int) 2e9; const ll mod = (ll) 1e9 + 7ll; #define ch() getchar() #define pc(x) putchar(x) template<typename T> void read(T &x) { static char c; ...
C++
b7cbf0465cac777120f2a1ad52964a46
ca6fc5e29a222aea714726d543bddede
3,500
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using db = long double; // or double, if TL is tight using str = string; // yay python! // pairs using pi = pair<int,int>; using pl = pair<ll,ll>; using pd = pair<db,db>; #define mp make_pair #define f first #define s second #define...
C++
b7cbf0465cac777120f2a1ad52964a46
420893b54701af5bd13ad84d99bd2292
3,500
PASSED
// LUOGU_RID: 95195120 #include<bits/stdc++.h> using namespace std; namespace DEBUG { inline void cerr_out() { cerr << '\n'; } template<typename Head, typename... Tail> inline void cerr_out(Head H, Tail... T) { cerr << ' ' << H, cerr_out(T...); } void debug_out() { cerr << '\n'; } template ...
C++
b7cbf0465cac777120f2a1ad52964a46
aab6dcacfb5e98b540fea227b7660e68
3,500
PASSED
#include <cstdio> #include <iostream> #include <vector> #include <set> #include <functional> #include <cassert> using namespace std; #define debug(a) cerr << #a << ": " << (a) << '\n'; #define debug_two(a, b) cerr << #a << ": " << (a) << ", " << #b << ": " << (b) << '\n'; const int inf = 1e9 + 7; void s...
C++
27e8cf87034934d067b0a8c4b9703271
6c75102a5297e3989b757b550b2ae425
3,000
PASSED
#include <bits/stdc++.h> using namespace std; # define Rep(i,a,b) for(int i=a;i<=b;i++) # define _Rep(i,a,b) for(int i=a;i>=b;i--) # define RepG(i,u) for(int i=head[u];~i;i=e[i].next) typedef long long ll; typedef double db; # define chkmax(a,b) a=max(a,b) # define chkmin(a,b) a=min(a,b) # define PII p...
C++
27e8cf87034934d067b0a8c4b9703271
09948c9fd8cd65112ad858c1ae92a107
3,000
PASSED
#include <cstdio> #include <vector> typedef long long LL; const int N=4e3+10; int n,P,dnt,prd[N],nprd[N],inv[N],head[N],to[N],next[N],dp[N][N],ds[N][N],ivs[N][N];bool vis[N]; namespace IO{ int lt,nw,res,dig[30];char c; int read(){ res=0;for(;c<'0'||c>'9';c=getchar()); for(;!(c<'0'||c>'9');c=getchar())res...
C++
27e8cf87034934d067b0a8c4b9703271
8faf2b32e328634e196f20a792147304
3,000
PASSED
#include <cstdio> #include <vector> typedef long long LL; const int N=4e3+10; int n,P,dnt,prd[N],nprd[N],inv[N],head[N],to[N],next[N],dp[N][N],ds[N][N],ivs[N][N];bool vis[N]; namespace IO{ int lt,nw,res,dig[30];char c; int read(){ res=0;for(;c<'0'||c>'9';c=getchar()); for(;!(c<'0'||c>'9');c=getchar())res...
C++
27e8cf87034934d067b0a8c4b9703271
8057f286cddaa49db9c836d866dd8489
3,000
PASSED
#include <bits/stdc++.h> #define pb push_back using namespace std; const int maxn = 2005; int n, mod; int fac[maxn], ifac[maxn]; int f[maxn][maxn], s[maxn][maxn], ans[maxn]; int pre[maxn][maxn], suf[maxn][maxn], sum[maxn]; vector<int> e[maxn]; void amod(int &x, int y) { x = x + y >= mod ? x + y - mod : x + y...
C++
27e8cf87034934d067b0a8c4b9703271
ee7df80808a21e910c4d3739ad2cc4b7
3,000
PASSED
#include <bits/stdc++.h> #define pb push_back using namespace std; const int maxn = 2005; int n, mod; int fac[maxn], ifac[maxn]; int f[maxn][maxn], s[maxn][maxn], d[maxn][maxn], ans[maxn]; vector<int> e[maxn]; //int sum[maxn][maxn]; int pre[maxn][maxn], suf[maxn][maxn], sum[maxn]; void amod(int &x, int y) { ...
C++
27e8cf87034934d067b0a8c4b9703271
98238452ad7e2e22b41a6eb12b2ac402
3,000
PASSED
#include <bits/stdc++.h> #define pb push_back using namespace std; const int maxn = 2005; int n, mod; int fac[maxn], ifac[maxn]; int f[maxn][maxn], s[maxn][maxn], d[maxn][maxn], ans[maxn]; int pre[maxn][maxn], suf[maxn][maxn], sum[maxn]; vector<int> e[maxn]; void amod(int &x, int y) { x = x + y >= mod ? x + ...
C++
27e8cf87034934d067b0a8c4b9703271
c59342bbd82b3053362458a61101143c
3,000
PASSED
#include<bits/stdc++.h> #pragma GCC optimize(3) using namespace std; #define ll long long #define N 2002 #define fo(i, l, r) for (int i = (l), ed = (r); i <= ed; i ++) #define fd(i, l, r) for (int i = (l), ed = (r); i >= ed; i --) #define pb push_back #define fi first #define se second #define INF 2147483647 ...
C++
27e8cf87034934d067b0a8c4b9703271
404a8192d9d42e3619ac80702b9b01c8
3,000
PASSED
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; i < (n); ++i) #define rep1n(i, n) for (int i = 1; i <= (n); ++i) #define repr(i, n) for (int i = (n) - 1; i >= 0; --i) #define pb push_back #define eb emplace_back #define all(a) (a).begin(), (a).end() ...
C++
27e8cf87034934d067b0a8c4b9703271
e4570489f01425291fc1d9b6f5b2b636
3,000
PASSED
// LUOGU_RID: 94369702 #include<bits/stdc++.h> using namespace std; #define int long long #define maxn 2005 int n,p; int f[maxn][maxn]; int g[maxn][maxn]; int h[maxn][maxn]; int pre[maxn],bac[maxn]; int s[maxn][maxn]; int qp(int x,int t){ int base=x%p,ret=1; while(t){ if(t&1){ ret=ret*base%p; } b...
C++
27e8cf87034934d067b0a8c4b9703271
d5b4f74e1522aa35dd1a28922492551d
3,000
PASSED
#define here cerr<<"===========================================\n" #define dbg(x) cerr<<#x<<": "<<x<<endl; #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #define ld double #define ll long long #define llinf 100000000000000000LL // 10^17 #define pb push_bac...
C++
2bf41400fa51f472f1d3904baa06d6a8
f73bf898612a7b3cbd6828d3f1b2449b
2,400
PASSED
#define here cerr<<"===========================================\n" #define dbg(x) cerr<<#x<<": "<<x<<endl; #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #define ld double #define ll long long #define llinf 100000000000000000LL // 10^17 #define pb push_bac...
C++
2bf41400fa51f472f1d3904baa06d6a8
cb809424bb241edf167c50ae61d4f3ed
2,400
PASSED
#define here cerr<<"===========================================\n" #define dbg(x) cerr<<#x<<": "<<x<<endl; #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #define ld double #define ll long long #define llinf 100000000000000000LL // 10^17 #define pb push_bac...
C++
2bf41400fa51f472f1d3904baa06d6a8
9a877acf0c0100ae449d2ea5145173cf
2,400
PASSED
#include<bits/stdc++.h> #define s second #define f first using namespace std; int n, m, a, b, c, p[25][100100], d[100100], bio[100100]; vector <int> l[100100]; vector <pair <int, int> > e; void dfs (int x = 1, int br = 0) { br+=bio[x], bio[x] = br; for (int i=0; i<l[x].size(); i++) if (l[x][i] != p[0][x]) p[...
C++
2bf41400fa51f472f1d3904baa06d6a8
b3fdc4606e6203bc6af85141f0663e42
2,400
PASSED
#include <bits/stdc++.h> #define BIT(x, i) (((x) >> (i))&1) #define MASK(i) (1ll<<(i)) #define all(x) x.begin(), x.end() #define reu(i, a, b) for(int i = (a); i <= (b); ++i) #define red(i, a, b) for(int i = (a); i >= (b); --i) #define F first #define S second #define pb push_back using namespace std; typede...
C++
2bf41400fa51f472f1d3904baa06d6a8
edc606d4636d74ac2eb6181a2a496418
2,400
PASSED
#include <bits/stdc++.h> #define BIT(x, i) (((x) >> (i))&1) #define MASK(i) (1ll<<(i)) #define all(x) x.begin(), x.end() #define reu(i, a, b) for(int i = (a); i <= (b); ++i) #define red(i, a, b) for(int i = (a); i >= (b); --i) #define F first #define S second #define pb push_back using namespace std; typede...
C++
2bf41400fa51f472f1d3904baa06d6a8
b8b2a32dee2cde030a7e4c078303c169
2,400
PASSED
#include <bits/stdc++.h> #define BIT(x, i) (((x) >> (i))&1) #define MASK(i) (1ll<<(i)) #define all(x) x.begin(), x.end() #define reu(i, a, b) for(int i = (a); i <= (b); ++i) #define red(i, a, b) for(int i = (a); i >= (b); --i) #define F first #define S second #define pb push_back using namespace std; typede...
C++
2bf41400fa51f472f1d3904baa06d6a8
b90e10dca44c02673d2d94e842af6eac
2,400
PASSED
#include <bits/stdc++.h> #define BIT(x, i) (((x) >> (i))&1) #define MASK(i) (1ll<<(i)) #define all(x) x.begin(), x.end() #define reu(i, a, b) for(int i = (a); i <= (b); ++i) #define red(i, a, b) for(int i = (a); i >= (b); --i) #define F first #define S second #define pb push_back using namespace std; typede...
C++
2bf41400fa51f472f1d3904baa06d6a8
c40d64ffa53ccd684ed370f2490e4596
2,400
PASSED
#include<iostream> #include<cstdio> const int N = 2e5 + 5; struct edge { int nxt,to; }; edge e[N]; int head[N],cnt; void add(int x,int y) { e[++cnt]={head[x],y}; head[x]=cnt; } int dsu[N]; int x[N],y[N],col[N]; int d[N]; int f[N][21],dep[N]; int find(int x) { if(dsu[x] != x) dsu[x...
C++
2bf41400fa51f472f1d3904baa06d6a8
fe86763acf3c752dd770e3485e3af71d
2,400
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 1e5, M = 2e5; int cnt, fa[N + 5], sz[N + 5], dep[N + 5], hs[N + 5], tp[N + 5], dfn[N + 5], rk[N + 5]; vector<int> e[N + 5]; vector<pair<int, int> >sb; struct Segment_Tree { struct Tree { int l, r, lzy; }t[N * 4 + 5]; void build(int l, int r, int ...
C++
2bf41400fa51f472f1d3904baa06d6a8
9fe72a8023e809357a67a11842d66ae4
2,400
PASSED
#include <iostream> using namespace std; int main() { int t ; cin>>t ; while(t--){ int n ; cin>>n ; int test = 0 ; int i=0 ; while (test<n){ i++ ; if(i%3==0 || i%10==3) continue; test++; } cout<<i<<endl ; } return 0; } ...
C++
c37604d5d833a567ff284d7ce5eda059
fc25a9f94e392427ac2fdb32ee4edb7c
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int k; cin>>k; int ans=0; int i=1; while(1) { int temp=i; int rem=temp%10; if(i%3!=0 && rem!=3) { ...
C++
c37604d5d833a567ff284d7ce5eda059
3253ead83810aece0880d249767f3e37
800
PASSED
#include<iostream> #include<cmath> #include<iomanip> #include <algorithm> // y=ax+b // for calculations we use: -ax+y=b which can be converted to (-a 1 b) // (-1 1) (x) = (1) (-1 1) (1 1) // (-2 1) (y) = (2) (-2 2) (2 1) // using namespace std; int main() { int j = 0; int* x = new int[2000]; for (int i = 1;...
C++
c37604d5d833a567ff284d7ce5eda059
154eec0fa083f7de0a160e30b754665c
800
PASSED
#include<iostream> using namespace std; int main() { int i = 0 , j = 0 , y , c = 0; cin >> j ; while (j--) { cin >> y; i = 0; c = 0; while (true) { i++; if (i % 3 == 0 || i % 10 == 3) { continue; } c++; if (y == c) { cout << i << endl; break; } } } return 0; } ...
C++
c37604d5d833a567ff284d7ce5eda059
b356bf3dd9033464bde853cef39f3734
800
PASSED
// A. Dislike of Threes ////( وَلَنَجْزِيَنَّ الَّذِينَ صَبَرُوا أَجْرَهُمْ بِأَحْسَنِ مَا كَانُوا يَعْمَلُونَ ) #include<bits/stdc++.h> using namespace std; #define ll long long #define int long long #define el '\n' #define ss " " #define fr(s,n) for(int i = s; i<n;i++) #define frj(s,n) for(int j = s ;j<n;j++) #d...
C++
c37604d5d833a567ff284d7ce5eda059
94c649eb715de9e34c4c4f1a7fe8b5ac
800
PASSED
#include <iostream> #include<vector> #define ll long long #define FIO ios_base::sync_with_stdio(false), cout.tie(nullptr); cin.tie(nullptr); using namespace std; int main() { FIO; int t, k, a = 0; cin >> t; vector<int>v(1666); int j = 1; for (int i = 1; i <= 1666; i++) { if (i % 3 != 0) { if (i % 10 != 3)...
C++
c37604d5d833a567ff284d7ce5eda059
c3da3a577e6909147f9bd822483da4c7
800
PASSED
#include <iostream> using namespace std; int main() { int t;cin>>t; while(t--) { int k,res=0,a=1,j=0; cin>>k; while(j<k) { if(a%3!=0 && a%10!=3) { res=a; j++; } a++; } cout<<res<< "\n"; } return 0; }
C++
c37604d5d833a567ff284d7ce5eda059
9108f30d021c7f0fab096d4d42a0ea08
800
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; vector<int>ans; void fun(){ for(int i=1;i<=1666;i++){ if(i%3==0) continue; else if(i%10==3) continue; else ans.push_back(i); } } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); fun()...
C++
c37604d5d833a567ff284d7ce5eda059
fcdf0d42e696d8e182fb062da99a772e
800
PASSED
#include<iostream> #include<algorithm> #include<cmath> #include<iomanip> using namespace std; #define fast ios_base::sync_with_stdio(false),cout.tie(NULL),cin.tie(NULL); typedef long long ll; pair<string, int>P[100000]; bool comp(string x, string y, int z, int a) { if (x.size() == y.size()) { return z < a; } else...
C++
c37604d5d833a567ff284d7ce5eda059
528ff4ccb91ade71020b7ffce186c589
800
PASSED
#include <stdio.h> int main (void) { int i,t,k,x,a,b=0; scanf("%d",&t); for(i=0;i<t;i++) { a=0; scanf("%d",&k); for(x=0;x<k;x++) { for(a=a+1;a%3==0||a%10==3;a=a+1) a=a+0; } printf("%d\n",a); } return 0; }
C++
c37604d5d833a567ff284d7ce5eda059
1fb4787ca54dce253477f01fe74f16f2
800
PASSED
#include <iostream> using std::cout; using std::cin; using std::endl; int main() { int t; cin >> t; while (t--) { long a, b, c, bol, men, k, res; cin >> a >> b >> c; if (a > b) { bol = a; men = b; } else { bol = b; men = a; a = b; } bol % 2 == 0 ? bol : ++bol; if (a - men > bol...
C++
07597a8d08b59d4f8f82369bb5d74a49
9ac3a7b236eccfbbf9d791976a872c7b
800
PASSED
#include <iostream> #include <cmath> using namespace std; struct clock { long long x1, x2, x3; }t; long long n, d, maxim, minim; int maxi(int a, int b) { if (a > b) return a; else return b; } int mini(int a, int b) { if (a < b) return a; else return b; } int main() { cin >> n; while (...
C++
07597a8d08b59d4f8f82369bb5d74a49
d0902efd82c185335364518d3be88d22
800
PASSED
#include <iostream> #include <vector> using namespace std; int solve(int a, int b, int c) { int p_count = 2 * abs(a - b); if (a > p_count || b > p_count || c > p_count) return -1; else if (c + p_count / 2 > p_count) return c - p_count / 2; else return c + p_count / 2; } int main() { ...
C++
07597a8d08b59d4f8f82369bb5d74a49
05a7d0d4b914b539f25e62577a72023d
800
PASSED
#include<iostream> using namespace std; long long ans(long long a,long long b,long long c){ long long n,d; if(a<b) swap(a,b); n=(a-b)*2; if(a>n||b>n||c>n) return -1; d=c+a-b; if(d>n) return d-n; else return d; } int main(){ std::ios::sync_with_stdio(false); long long T,a,b,c; cin>>T...
C++
07597a8d08b59d4f8f82369bb5d74a49
3e5cc790e88044dcc5b39850c35ddcd1
800
PASSED
#include<iostream> using namespace std; long long ans(long long a,long long b,long long c){ long long n; if(a<b) swap(a,b); n=(a-b)*2; if(a>n||b>n||c>n) return -1; else if(c<=a-b) return c+a-b; else return c-a+b; } int main(){ std::ios::sync_with_stdio(false); long long T,a,b,c; cin>>...
C++
07597a8d08b59d4f8f82369bb5d74a49
a601c7072ab8ea39430bbdb4351c955a
800
PASSED
#include<iostream> using namespace std; long long ans(long long ua,long long ub,long long c){ long long a,b,n; if(ua<ub){ a=ub; b=ua; } else{ a=ua; b=ub; } n=(a-b)*2; if(a>n||b>n||c>n) return -1; else if(c<=a-b) return c+a-b; else return c-a+b; } int main(){ std::ios::sy...
C++
07597a8d08b59d4f8f82369bb5d74a49
e8d70426b4025108366b7f81a7c82b44
800
PASSED
//g++ -o main.exe opposite.cpp #include <string> #include <array> #include <utility> #include <algorithm> #include <vector> #include <iostream> #include <deque> #include <iterator> #include <stack> #include <queue> using namespace std; int main(){ int x; cin >> x; for(int n=0; n<x; n++){ int a, b...
C++
07597a8d08b59d4f8f82369bb5d74a49
c3a45eccec7469dd0e4bd07d66682f56
800
PASSED
#include<iostream> #include<cmath> using namespace std; int main(){ int t, a, b, c; cin>> t; for(int i = 0; i < t; i++){ cin>> a >> b >> c; if(a > b){ swap(a, b); } int n = (b - a); if((c <= 2 * n) && (b <= 2 * n)){ ...
C++
07597a8d08b59d4f8f82369bb5d74a49
8fb6151928900aba77c22cb756c7b6b8
800
PASSED
#include<iostream> #include<cstring> #include<algorithm> #include<map> #define ll long long using namespace std; void solve() { ll a, b, c; cin >> a >> b >> c; ll x = max(a, b); ll y = min(a, b); ll m; m = x - y; if (a >2*m || b >2* m || c >2* m) { cout << "-1" << endl; return; } if (...
C++
07597a8d08b59d4f8f82369bb5d74a49
9464e10c63be395ad56181aad7f63699
800
PASSED
#include <iostream> using namespace std; long long rek(long long a,long long b,long long c) { if(abs(a-b)<=1) return -1; int l=abs(a-b); if(2*l < a || 2*l < b || 2*l < c ) return -1; else if(c+abs(a-b) >2 * abs(a-b)) return c-abs(a-b); else return c+abs(a-b); } int...
C++
07597a8d08b59d4f8f82369bb5d74a49
7363ec141cb9778f7334ce05a11d8dc0
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; int k=ceil(sqrt(n)); //cout<<k<<endl; int kk=(k-1)*(k-1); //cout<<kk<<endl; kk+=k; int row=0,col=0; if(n<=kk) col=k; else row=k; // cout<<kk<<endl; if(col !=0) ...
C++
f8335c59cd05988c8053f138c4df06aa
88204cc871e7550115103c16b8566df6
800
PASSED
#include <bits/stdc++.h> #define ll long long #define ld long double #define el '\n' #define pi acos(-1) #define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it...
C++
f8335c59cd05988c8053f138c4df06aa
63654046b986980522c6bc86e783e45f
800
PASSED
#include <bits/stdc++.h> using namespace std; using i64 = long long; vector<int> s; void init() { } void solve() { int k; cin >> k; int z = sqrt(k); if (z * z == k || (z + 1) * (z + 1) == k) { cout << z << " " << 1 << "\n"; } else { k -= z * z; int x = 1, y = z + 1; ...
C++
f8335c59cd05988c8053f138c4df06aa
6b991deceeebb8ee78d692eb4a55bce0
800
PASSED
#include<iostream> #include<cmath> using namespace std; int main() { int t; cin >> t; while (t--) { int k; cin >> k; int x = sqrt(k); if (x * x != k) x++; int y = x * x; int r, c; if (k >= y - x + 1) { r = x; c = y - k + 1; } else { c = x; y = y - x + 1; r = x - (y - k); } c...
C++
f8335c59cd05988c8053f138c4df06aa
a6f00294cb800ce804f8fee81c094a23
800
PASSED
#include"bits/stdc++.h" using namespace std; int main(){ int t; cin>>t; while(t--){ int k; cin>>k; int t=sqrt(k); if(k-t*t==0){ cout<<t<<" 1"<<endl; } else if(k-t*t<=t+1){ cout<<k-t*t<<" "<<t+1<<endl; } else { int te=k-t*t-t-1; cout<<t+1<<" "<<t-te+1<<endl; } } return 0; } ...
C++
f8335c59cd05988c8053f138c4df06aa
4ab8c724f170c3bcb5034a2692dc90da
800
PASSED
#include "bits/stdc++.h" using namespace std; #define endl '\n' typedef long long ll; const int N=1e5+5,inf=0x3f3f3f3f; ll t,k; int main() { ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); cin>>t; while(t--) { cin>>k; ll p=sqrt(k),C,R,l,r; if(p*p==k) R=p,C=1; else { if(p*p+p+1>=k) { C=p+1,l...
C++
f8335c59cd05988c8053f138c4df06aa
3f2ae378f07fe92cbe57d4a3d0bad2db
800
PASSED
#include "bits/stdc++.h" using namespace std; int main() { int t; cin>>t; while(t--) { int k; cin>>k; int x = sqrt(k - 1); int idx = k - x * x; int y = x + 1; if(idx <= y) { cout<<idx<<" "<<y<<endl; } else { cout<<y<<" "<<y - (idx % y)<<endl; } } return 0; } ...
C++
f8335c59cd05988c8053f138c4df06aa
97a5815591acd19aa006f31be675ed38
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while(t--){ int k; cin >> k; int grid = ceil(sqrt(k)); int r, c; if(k <= grid*grid && k >= (grid * grid)-(grid-1)){ r = grid; int cnt = 1; for(int i = grid*grid; i >= (gr...
C++
f8335c59cd05988c8053f138c4df06aa
cb9b0ddb581aa92adb297100fbb518f1
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t;cin>>t; while(t--){ int n;cin>>n; int small = sqrt(n); int big = small + 1; int mid = (small*small + 1 + big*big) / 2; int row,col; if(small*small==n)col = small, row = 1; else if(n < mid)row =...
C++
f8335c59cd05988c8053f138c4df06aa
81d381636747cdc059800e6bbc325314
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { double n; cin>>n; double k=sqrt(n); if(floor(k)==ceil(k)) { cout<<(int)k<<" "<<1<<endl; } else { int a=k; int b=a*a; ...
C++
f8335c59cd05988c8053f138c4df06aa
2c57be8d5b584ab394f182432d7e5f58
800
PASSED
#define io ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define rep(i,l,r) for(ll i=l;i<=r;++i) #define per(i,l,r) for(ll i=r;i>=l;--i) #define debug(x) cout<<#x<<" = "<<x<<endl #define CY cout<<"YES"<<endl #define CN cout<<"NO"<<endl #include<bits/stdc++.h> using namespace std; using ll = long long; const ll N =...
C++
728e0e5e5d8350a2b79e6a4b5bef407b
296c47f8e1f5d555016c461b4c3141c0
1,300
PASSED
#include<iostream> #include<cstring> #include<vector> using namespace std; typedef long long ll; const ll NN=(ll)2e18; vector<string>v; string tostr(ll a) { string b=""; int c; while(a) { c=a%10; b=char(c+'0')+b; a/=10; } return b; } int solve(string a,string b) { int num=0; for(int i=0,j=0;i<a.length...
C++
728e0e5e5d8350a2b79e6a4b5bef407b
a680f2784cfddca55e3407064908f9f1
1,300
PASSED
#include <iostream> #include <algorithm> using namespace std; int main () { int t; string n ,n1 ; cin>>t; while (t--) { int mn=10000; cin>>n; for (long long i=1;i<2e18;i*=2){ n1=to_string(i); int idx=0,idx1=0,o=0 ; while (idx< n.size()&&idx1<n1.size...
C++
728e0e5e5d8350a2b79e6a4b5bef407b
ab39c3511c87d47560d4c0aeeb8a0a5a
1,300
PASSED
#include <iostream> using namespace std; int main() { int t; string n; cin >> t; while(t--){ int mn = 1000; cin >> n; for(long long i=1; i < 2e18; i*=2){ string n1 = to_string(i); int idx=0, idx1=0, op=0; while(idx < n.size() && idx1 < n1.size()){ if(n[idx] == n1[idx1]){ idx++; idx1++...
C++
728e0e5e5d8350a2b79e6a4b5bef407b
18d1b8b40a5ca868dec6772f7518145b
1,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll P2LIM = (ll)2e18; int solve(string s, string t) { int tp = 0; int sp = 0; int taken = 0; while (sp < s.length() && tp < t.length()) { if(s[sp] == t[tp]) { taken++; tp++; } sp++; } return (int)s.length() - taken + (in...
C++
728e0e5e5d8350a2b79e6a4b5bef407b
b8960ac060809a4f19b83ca16cb10690
1,300
PASSED
#include<iostream> #include<algorithm> #include<sstream> #include<vector> #include<string> using namespace std; typedef long long ll; vector<string>m; int judge(string a, string b) { int ans = 0, i = 0, j = 0; int alen = a.size(); int blen = b.size(); for (; i < alen && j < blen;) { if (a[i]...
C++
728e0e5e5d8350a2b79e6a4b5bef407b
5977c9312297654b747b4a351c35c1f8
1,300
PASSED
#include <iostream> #include <bits/stdc++.h> #define ll long long #define lld long double #define ff first #define ss second #define pb push_back #define mp make_pair #define fl(i,n) for(int i=0;i<n;i++) #define rl(i,m,n) for(int i=n;i>=m;i--) #define py cout<<"YES\n"; #define pn cout<<"NO\n"; #define vr(v) v.begin(),v...
C++
728e0e5e5d8350a2b79e6a4b5bef407b
5a658ec3739ebab707ddb49dc0b892b9
1,300
PASSED
#include<bits/stdc++.h> using namespace std; const long long N=1e18; vector<string>s; int slove(string a,string b) { int aa=a.length(); int bb=b.length(); int cnt=0,x=0,y=0; while(x<aa&&y<bb) { if(a[x]==b[y]) { cnt++; y++; } x++; } return aa+bb-2*cnt; } int main() { for(long long i=1;i<=N;i=i*2) ...
C++
728e0e5e5d8350a2b79e6a4b5bef407b
a3be25faefd864e62c7c247e600889d5
1,300
PASSED
#include<bits/stdc++.h> using namespace std; const long long N=1e18; vector<string>s; int slove(string a,string b) { int aa=a.length(); int bb=b.length(); int cnt=0,x=0,y=0; while(x<aa&&y<bb) { if(a[x]==b[y]) { cnt++; y++; } x++; } return aa+bb-2*cnt; } int main() { for(long long i=1;i<=N;i=i*2) ...
C++
728e0e5e5d8350a2b79e6a4b5bef407b
7dd8df03de4406120e3905455b4216d2
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; long long numbers[64+5]; string powers[64+5]; numbers[0]= 1; for(int i = 1; i<64; i++) { numbers[i] = numbers[i - 1] * 2; } for(int i = 0; i < 64; i++) { powers[i] = to_string(numbers[i]); } ci...
C++
728e0e5e5d8350a2b79e6a4b5bef407b
c76666eff98e65e5f48b6e39bec2697c
1,300
PASSED
#include<bits/stdc++.h> #include<unordered_map> #include<array> #define ll long long #define ull unsigned long long #define all(a) a.begin(),a.end() #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; const doubl...
C++
8705adec1bea1f898db1ca533e15d5c3
daba817e7cc53bcfd33845ce839e1d0d
1,800
PASSED
#include<bits/stdc++.h> #include<unordered_map> #include<array> #define ll long long #define ull unsigned long long #define all(a) a.begin(),a.end() #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; const doubl...
C++
8705adec1bea1f898db1ca533e15d5c3
16c6accf3fae548fdf67a1f1a699a26c
1,800
PASSED
#include<bits/stdc++.h> #include<array> #define ll long long #define ull unsigned long long #define all(a) a.begin(),a.end() #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; const double eps = 1e-8; const ll m...
C++
8705adec1bea1f898db1ca533e15d5c3
404fdf1077d35c95a0f4f8e0ee142290
1,800
PASSED
#include<bits/stdc++.h> #include<unordered_map> #include<array> #define ll long long #define ull unsigned long long #define all(a) a.begin(),a.end() #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; const doubl...
C++
8705adec1bea1f898db1ca533e15d5c3
cce780788a627778d921fd4bdafb3951
1,800
PASSED
#include <bits/stdc++.h> using namespace std; string check(string &a, string &b) { string res; vector<int> vis(26); for (int i = 0; i < b.length(); i++) { for (char j : a) if (!vis[j - 'a']) res += j; vis[b[i] - 'a'] = 1; } return res; ...
C++
8705adec1bea1f898db1ca533e15d5c3
8538dd3d10a5ec3907add2b1068085c7
1,800
PASSED
#include <bits/stdc++.h> using namespace std; string check(string &a, string &b) { string res; vector<int> vis(26); for (int i = 0; i < b.length(); i++) { for (char j : a) if (!vis[j - 'a']) res += j; vis[b[i] - 'a'] = 1; } return res; ...
C++
8705adec1bea1f898db1ca533e15d5c3
da14c7f601a18499c67958b55ff29e26
1,800
PASSED
#include <bits/stdc++.h> using namespace std; #pragma GCC(3) typedef long long ll; #define endl '\n' #define SQR(i) fixed << setprecision(i) #define inf 0x3f3f3f3f // int max #define inf_max 0x3f3f3f3f3f3f3f3f // long long max #define rep(i, a, n) for (int i = a; i <= n; i++) #define per(i, n, a) f...
C++
8705adec1bea1f898db1ca533e15d5c3
e431b36c859272981e69b196bad99957
1,800
PASSED
#pragma once #include <stack> #include <iostream> #include <functional> #include <iterator> #include <iomanip> #include <cmath> #include <list> #include <set> #include <map> #include <queue> #include <string> #include <deque> #include <assert.h> #include <unordered_map> #define even % 2 == 0 #define...
C++
8705adec1bea1f898db1ca533e15d5c3
c735d392076a592be0c1f7b422d8067c
1,800
PASSED
#pragma once #include <stack> #include <iostream> #include <functional> #include <iterator> #include <iomanip> #include <cmath> #include <list> #include <set> #include <map> #include <queue> #include <string> #include <deque> #include <assert.h> #include <unordered_map> #define even % 2 == 0 #define...
C++
8705adec1bea1f898db1ca533e15d5c3
316a9ba461c1f066927de0b599d532f9
1,800
PASSED
#pragma once #include <stack> #include <iostream> #include <functional> #include <iterator> #include <iomanip> #include <cmath> #include <list> #include <set> #include <map> #include <queue> #include <string> #include <deque> #include <unordered_map> #define even % 2 == 0 #define odd % 2 == 1 #defin...
C++
8705adec1bea1f898db1ca533e15d5c3
fce2fb048b1d30028be6d8d99c3c4c95
1,800
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pi pair<int,int> #define pll pair<ll,ll> #define pb push_back #define eb emplace_back #define nl "\n" #define NL "\n" #define Nl "\n" #define lp(i,n) for(int i=0;i<n;i++) #define rlp(n,j) for(int i=n-1;i>=0;i--...
C++
9bd393bb8752a69016c5312750e8b507
eb873cc4097d462da7b23059c7c41442
1,900
PASSED
#include <bits/stdc++.h> #include <vector> #include<iomanip> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include<cstring> #include <algorithm> #include <iostream> #include <cmath> #include <cstdlib> #include <string> #include<cstdio> using namesp...
C++
9bd393bb8752a69016c5312750e8b507
28597ea97f90e5e15b82d28c2d0f1fc4
1,900
PASSED
#include<bits/stdc++.h> using namespace std; int z; void solve() { long long int n,k,i,cnt,j,x,y,pos,l,r; string s,res; cin>>n>>k; l=n; while(n>0) { s.push_back(48+(n%10)); n=n/10; } reverse(s.begin(),s.end()); if(k==1) { cnt=0; ...
C++
9bd393bb8752a69016c5312750e8b507
8b5accc0829ce6c510a939c063f60a7c
1,900
PASSED
#include<bits/stdc++.h> using namespace std; /*std::iostream::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr);*/ int wei(int n){ int x[10],ans=0; memset(x,0,sizeof(x)); while(n!=0){ x[n%10]=1; n/=10; } for(int i=0;i<10;i++){ ans+=x[i]; } return ans; } int main(int argc, char const *a...
C++
9bd393bb8752a69016c5312750e8b507
9b66b3916101d1640ed9b930c053f878
1,900
PASSED
#include<bits/stdc++.h> using namespace std; /*std::iostream::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr);*/ int wei(int n){ int x[10],ans=0; memset(x,0,sizeof(x)); while(n!=0){ x[n%10]=1; n/=10; } for(int i=0;i<10;i++){ ans+=x[i]; } return ans; } int main(int argc, char const *a...
C++
9bd393bb8752a69016c5312750e8b507
0c7c36ae16889a1d5f1528e37f1de56a
1,900
PASSED
#include<bits/stdc++.h> using namespace std; /*std::iostream::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr);*/ int wei(int n){ int x[10],ans=0; memset(x,0,sizeof(x)); while(n!=0){ x[n%10]=1; n/=10; } for(int i=0;i<10;i++){ ans+=x[i]; } return ans; } int main(int a...
C++
9bd393bb8752a69016c5312750e8b507
c642b5946d9f14f36df1e29304eb0385
1,900
PASSED
//Author:Daneii #include <bits/stdc++.h> using namespace std; #define in(x) scanf("%d",&x) #define lin(x) scanf("%lld",&x) #define din(x) scanf("%lf",&x) typedef long long ll; typedef long double ld; typedef pair<int,int> pii; inline int safeMod(int x,int p) {return (x+p)%p;} inline int ls(int x){retu...
C++
9bd393bb8752a69016c5312750e8b507
e037fbe36843cc75f9d122b2deeecdbd
1,900
PASSED
//Author:Daneii #include <bits/stdc++.h> using namespace std; #define in(x) scanf("%d",&x) #define lin(x) scanf("%lld",&x) #define din(x) scanf("%lf",&x) typedef long long ll; typedef long double ld; typedef pair<int,int> pii; inline int safeMod(int x,int p) {return (x+p)%p;} inline int ls(int x){retu...
C++
9bd393bb8752a69016c5312750e8b507
f08803782f7b4a38d610d2cb1380ebdb
1,900
PASSED
#pragma GCC optimize("Ofast,unroll-loops,O3") #pragma GCC target("avx,avx2,sse,sse2,popcnt") #include <bits/stdc++.h> using namespace std; #define fio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define endl "\n" #define setbit...
C++
9bd393bb8752a69016c5312750e8b507
74f0731e27d950a877f9052bc14130d7
1,900
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; cin.ignore(); while (T--) { string n; cin >> n; int k; cin >> k; cin.ignore(); set<char> arr; while (1) { for (int i = 0; i < n.size(); i++) { arr.insert(n[i]); if (arr.size() > k) { if (n[i] == '9') { ...
C++
9bd393bb8752a69016c5312750e8b507
4bbc011e20eb6c59939e188c7e09b446
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define ll long long #define inf INT_MAX #define llinf LLONG_MAX #define mt make_tuple #define mp make_pair #define parll pair<ll,ll> #define parii pair<int,int> #define frs first #define se...
C++
3ef53ad23ec56344f68546096c6c3308
440b47ac4a29551667b89749f6c92dfe
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define ll long long #define inf INT_MAX #define llinf LLONG_MAX #define mt make_tuple #define mp make_pair #define parll pair<ll,ll> #define parii pair<int,int> #define frs first #define se...
C++
3ef53ad23ec56344f68546096c6c3308
f48a2f1804fdde737076705b6fb61e15
2,100
PASSED
#include<bits/stdc++.h> using namespace std; #define N 15 #define For(i,x,y)for(i=x;i<=(y);i++) #define Down(i,x,y)for(i=x;i>=(y);i--) bool bo[N]; int b[N],num[N]; int main() { bool rem=1; int t,i,j,n,m,cnt,k,l,r; scanf("%d",&t); while(t--) { cnt=m=0; For(i,0,9)bo[i]=0; scanf("%d %d",&n,&k); ...
C++
3ef53ad23ec56344f68546096c6c3308
8b19f06b75c58b1689d3e1325d7788ab
2,100
PASSED
#include <bits/stdc++.h> #define ll int #define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define inf 1e15 #define MOD 1000000007 #define EN '\n' #define vc vector #define pr pair <ll,ll> #define eps 0.00000001 #define m(s ,e) ((s) + (e)) / 2; #define wrp(p) for(auto it : (p)) cout << it.first <...
C++
3ef53ad23ec56344f68546096c6c3308
1f6a83e977dd3e8768309b03ed01a014
2,100
PASSED
#include<bits/stdc++.h> //#define int long long using namespace std; const int N=1e6+10; const int mod=998244353; int n,m,cnt[10]; char a[N],b[N],nex[N]; int check(){ int num=0; for(int i=1;i<=n;i++)cnt[a[i]-'0']=1; for(int i=0;i<10;i++)num+=cnt[i],cnt[i]=0; return num<=m; } int first_big(int x){ for...
C++
3ef53ad23ec56344f68546096c6c3308
6dd905604f0b08ad6badb9181cba1489
2,100
PASSED
#include <bits/stdc++.h> using namespace std; #define SZ(x) ((int)((x).size())) #define lb(x) ((x)&(-(x))) #define mkp make_pair #define pb push_back #define fi first #define se second typedef long long ll; typedef pair<int,int> pii; const int MAXN=11; int n,kkk; char s[MAXN]; ll mini[MAXN][MAXN]; ...
C++
3ef53ad23ec56344f68546096c6c3308
2ebed9991455ec88662e013ccaa4db84
2,100
PASSED
#pragma GCC target("sse,sse2,sse3,sse4.1,sse4.2,popcnt,abm,mmx,avx") #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #define SZ(x) ((int)((x).size())) #define lb(x) ((x)&(-(x))) #define mkp make_pair #define pb push_back #define fi first #define se second typedef long long ll; ...
C++
3ef53ad23ec56344f68546096c6c3308
688fdb641d4f857395e0090e0636885a
2,100
PASSED
#include<bits/stdc++.h> #define ll long long //#define int long long //#pragma GCC optimize(2) #define pb push_back #define in insert using namespace std; string s, ans; set<char> vis; set<char> :: iterator it; int k; int main(){ int t; cin >> t; while(t --) { cin >> s >> k; ...
C++
3ef53ad23ec56344f68546096c6c3308
d66c4b56e6968945cc863875f9ad2a8b
2,100
PASSED
#include <bits/stdc++.h> #include <vector> #include<iomanip> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include<cstring> #include <algorithm> #include <iostream> #include <cmath> #include <cstdlib> #include <string> #include<cstdio> using namesp...
C++
3ef53ad23ec56344f68546096c6c3308
ca539b2279d4790f827e377840419ff7
2,100
PASSED
#include <bits/stdc++.h> #define ll long long #define PII pair<int, int> #define PIL pair<int, ll> #define PLI pair<ll, int> #define PLL pair<ll, ll> #define STR string #define MP make_pair #define Fst first #define Snd second using namespace std; int tac,n,m; ll res; vector<int> vn; int bt[1030]; inline...
C++
3ef53ad23ec56344f68546096c6c3308
758fd5ab475fabf0b73f6004b6148284
2,100
PASSED
#include<bits/stdc++.h> using namespace std; int a[200000], b[200000]; void solve() { int i, n, k, j, val, place; long long count=0; bool replace=true; cin >> n >> k; for (i = 0; i < n; i++) { cin >> a[i]; count = count + a[i]; a[i] = a[i] - n + i + 1; } sort(a, a+n, greater<int>()); for ...
C++
66daa3864875e48d32a7acd23bd7a829
7c54c59531cd842ed59cb449012799d0
1,700
PASSED
#include<bits/stdc++.h> using namespace std; #include <iostream> #include <cstring> #include <algorithm> #include<stdio.h> #define endl '\n' #include <vector> #define int long long using namespace std; struct node { int x, i; }; node pi[2000010]; int ai[2000010]; bool cmp(node a, node b) { return a....
C++
66daa3864875e48d32a7acd23bd7a829
f728092f7cfe1fe8e3cecde02b6b2267
1,700
PASSED