source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include<bits/stdc++.h> using namespace std; struct ss{ int zhi; long long num; }a[300005],b[300005]; int cnta,cntb,flag; int main(){ int t,n,m; cin>>t; while(t--){ cnta=0;cntb=0;flag=0; cin>>n>>m; long long sum=0; for(int i=1,x,y;i<=n;i++){ cin>>x; sum+=x;y=1; while(x%m==0){ x/=m; y...
C++
2ff40423619cefd8c2fb35a18549c411
2efd308f5f9fa7d1df15a5fd619bff26
1,400
PASSED
#include<bits/stdc++.h> #define ll unsigned long long #define linf 0x3f3f3f3f3f3f3f3f #define inf 0x7fffffff #define INF 0x3f #define v e[i].y using namespace std; inline ll read(){ char ch=getchar();ll x=0,w=1; while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();} while(ch>='0'&&ch<='9')x=(x<<1)+(...
C++
2ff40423619cefd8c2fb35a18549c411
3b22f3a3a59834d267cf770982a9a059
1,400
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; int T,n,m,k,a[100005],b[100005],p1,p2,sum1,sum2; struct node{ int num,sum; }; stack<node>s; signed main(){ cin>>T; while(T--){ cin>>n>>m; bool flag=1; sum1=sum2=0; while(!s.empty())s.pop(); for(int i=1;i<=n;i++){ cin>>a[...
C++
2ff40423619cefd8c2fb35a18549c411
d2c9aa58e3531e66cc10cde947e51249
1,400
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key #define pb push_bac...
C++
8a752a1d78876fc20ee674d4fb93d769
e09fcc7395198379bd7656604e605a2c
2,000
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key #define pb push_bac...
C++
8a752a1d78876fc20ee674d4fb93d769
659fbf7d81ad249847ae8b4b98738a49
2,000
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key #define pb push_bac...
C++
8a752a1d78876fc20ee674d4fb93d769
8440ca6d62f81f4dfe8451d8e9733fb0
2,000
PASSED
/* Mantra's code :) */ #pragma GCC optimize("unroll-loops") #pragma GCC optimize("O3") #pragma GCC target("avx2") #include<bits/stdc++.h> using namespace std; using namespace chrono; #define pub push_back #define pob pop_back #define ya cout<<"YES\n" #define na cout<<"NO\n" #define imp cout<<"Impossi...
C++
8a752a1d78876fc20ee674d4fb93d769
c385961f0672ac09b583dfd1a11dedba
2,000
PASSED
#include <bits/stdc++.h> using namespace std; class Combo{ private: long long p; vector<long long> f,invf,subf; long long invfact(long long x){ if(x>=invf.size()) invf.resize(x+1,-1); if(invf[x]!=-1) return invf[x]; return invf[x]=inv(fact(x)); ...
C++
8a752a1d78876fc20ee674d4fb93d769
713357cebd2aed378848d3c3bd666618
2,000
PASSED
#include <bits/stdc++.h> using namespace std; class Combo{ private: long long p; vector<long long> f,invf,subf; long long invfact(long long x){ if(x>=invf.size()) invf.resize(x+1,-1); if(invf[x]!=-1) return invf[x]; return invf[x]=inv(fact(x)); ...
C++
8a752a1d78876fc20ee674d4fb93d769
e7dd736c649c62136e08e34250c1e00f
2,000
PASSED
#include <bits/stdc++.h> using namespace std; class Combo{ private: long long p; vector<long long> f,invf,subf; public: Combo(long long P){ p=P; f={1,1}; invf={1,1}; subf={1,0}; } //x^y mod p long...
C++
8a752a1d78876fc20ee674d4fb93d769
559ba0fca018f90fe3b2b70d5585503a
2,000
PASSED
#include <bits/stdc++.h> using namespace std; class Combo{ private: long long p; vector<long long> fact,invfact,subfact; public: Combo(long long P){ p=P; } //x^y mod p long long expmod(long long x,long long y){ long long r...
C++
8a752a1d78876fc20ee674d4fb93d769
150f3735ea0ec40c817797ff00be1b48
2,000
PASSED
#include <bits/stdc++.h> using namespace std; class Combo{ private: long long p; vector<long long> fact,invfact,subfact; public: Combo(long long P){ p=P; } //x^y mod p long long expmod(long long x,long long y){ long long r...
C++
8a752a1d78876fc20ee674d4fb93d769
ce328044d3f521a902c2fad40e31c1ee
2,000
PASSED
#include <bits/stdc++.h> using namespace std; class Combo{ private: long long p; vector<long long> fact,invfact,subfact; public: Combo(long long P){ p=P; } //x^y mod p long long expmod(long long x,long long y){ long long r...
C++
8a752a1d78876fc20ee674d4fb93d769
bc3e8f5b05454422d86208ea9ca65cc3
2,000
PASSED
// xtqqwq #include<bits/stdc++.h> #define fi first #define se second #define mp make_pair #define pb push_back using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef pair<ll,ll> pll; template<typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}...
C++
af1fa4bddcb3cb0659104e718afb99df
196a96da0ee7125447967b1caf382374
3,300
PASSED
#include <bits/stdc++.h> #define eprintf(args...) fprintf(stderr, args) #define rep(i, n) for (int i = 0; i < (int)(n); ++ i) using db = double; const db inf = 1e18; const int B = 3; const int mxn = 1 << 18; int n, q, x, y; int a[mxn]; struct matrix { db va[B][B]; matrix(db z = -inf) { rep(i, ...
C++
af1fa4bddcb3cb0659104e718afb99df
0ff2427399463f37ef65ae696a90c27c
3,300
PASSED
#include<bits/stdc++.h> using namespace std; int n,q,x,y; struct node{ double f[3][3]; node(){ for(int i=0;i<3;i++) for(int j=0;j<3;j++) f[i][j]=-998244353; } }dat[524288]; node merge(node a,node b){ node ret; for(int i=0;i<3;i++) for(int j=0;j<3;j++){ ret.f[i][j]=max(ret.f[i][j],a.f[i...
C++
af1fa4bddcb3cb0659104e718afb99df
a3f35f26f15379d0f9bafb15414b650f
3,300
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define all(a) begin(a), end(a) #define len(a) int((a).size()) #ifdef LOCAL #include "debug.h" #else #define dbg(...) #endif // LOCAL template<typename node> struct segtree { int n; std::vec...
C++
af1fa4bddcb3cb0659104e718afb99df
4e7e3611736bc010a4eab7959cd526bf
3,300
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define all(a) begin(a), end(a) #define len(a) int((a).size()) #ifdef LOCAL #include "debug.h" #else #define dbg(...) #endif // LOCAL template<typename node> struct segtree { int n; std::vec...
C++
af1fa4bddcb3cb0659104e718afb99df
469e6ad3ad2a0cd8e983bf757550c395
3,300
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <unordered_map> #include <unordered_set> #include <set> #include <map> #include <ctime> #include <cmath> #include <iomanip> #include <cassert> #include <bit> #include <array> #include <iterator> #include <random> using ...
C++
af1fa4bddcb3cb0659104e718afb99df
f4200eda9521c2e8867b01c42741f096
3,300
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <unordered_map> #include <unordered_set> #include <set> #include <map> #include <ctime> #include <cmath> #include <iomanip> #include <cassert> #include <bit> #include <array> #include <iterator> #include <random> using ...
C++
af1fa4bddcb3cb0659104e718afb99df
b9102b367bb68b021db8b864e2a12d54
3,300
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <unordered_map> #include <unordered_set> #include <set> #include <map> #include <ctime> #include <cmath> #include <iomanip> #include <cassert> #include <bit> #include <array> #include <iterator> #include <random> using ...
C++
af1fa4bddcb3cb0659104e718afb99df
82ea45257243f79acef091e51d33a830
3,300
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <unordered_map> #include <unordered_set> #include <set> #include <map> #include <ctime> #include <cmath> #include <iomanip> #include <cassert> #include <bit> #include <array> #include <iterator> #include <random> using ...
C++
af1fa4bddcb3cb0659104e718afb99df
9abfa644a0cec9c4915bee548f2dffb3
3,300
PASSED
#include <cstdio> #include <cctype> #include <cstring> #include <algorithm> #include <numeric> #include <vector> #include <cassert> #include <array> using namespace std; using ll = long long; using ull = unsigned long long; #define LOG(f...) fprintf(stderr, f) #define DBG(f...) printf("%3d: ", __LINE__)...
C++
af1fa4bddcb3cb0659104e718afb99df
323e44c64eaf1abb4cd63874d0060ca0
3,300
PASSED
//~ while (clock()<=69*CLOCKS_PER_SEC) //~ #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("O3") //~ #pragma GCC target ("avx2") //~ #pragma GCC optimize("Ofast") //~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //~ #pragma GCC optimize("unroll-loops") #include <bits/st...
C++
daadf2acaa58e3da99dedb96186821a0
a604c0536a8b03413411b5c3506ee1a7
3,500
PASSED
#include <bits/stdc++.h> #ifdef ALGO #include "el_psy_congroo.hpp" #else #define DUMP(...) #define PLOT(...) #define CHECK(...) #endif namespace { using LL = long long; template<typename T, typename U> bool enlarge(T& a, U b) { \ return a < b ? (a = b, true) : false; } template<typename T, typename U> bool minify(T...
C++
daadf2acaa58e3da99dedb96186821a0
b6d2669fa5f1005db98662b6d218b25a
3,500
PASSED
#include <bits/stdc++.h> #ifdef ALGO #include "el_psy_congroo.hpp" #else #define DUMP(...) #define PLOT(...) #define CHECK(...) #endif namespace { using LL = long long; template<typename T, typename U> bool enlarge(T& a, U b) { \ return a < b ? (a = b, true) : false; } template<typename T, typename U> bool minify(T...
C++
daadf2acaa58e3da99dedb96186821a0
8d18e3722812b760fae58cfd6460a6b1
3,500
PASSED
#include <bits/stdc++.h> #ifdef ALGO #include "el_psy_congroo.hpp" #else #define DUMP(...) #define PLOT(...) #define CHECK(...) #endif namespace { using LL = long long; template<typename T, typename U> bool enlarge(T& a, U b) { \ return a < b ? (a = b, true) : false; } template<typename T, typename U> bool minify(T...
C++
daadf2acaa58e3da99dedb96186821a0
d260d796d3f4a990aaa19a448fccff8e
3,500
PASSED
#include <bits/stdc++.h> #ifdef ALGO #include "el_psy_congroo.hpp" #else #define DUMP(...) #define PLOT(...) #define CHECK(...) #endif namespace { using LL = long long; template<typename T, typename U> bool enlarge(T& a, U b) { \ return a < b ? (a = b, true) : false; } template<typename T, typename U> bool minify(T...
C++
daadf2acaa58e3da99dedb96186821a0
7348130b58715a621e543b7285bec942
3,500
PASSED
//#define DEBUG //#define USEPB_DS #define USETR1 #define CPPELEVEN #define GPP /* * temp.cpp * * Created on: 2012-7-18 * Author: BSBandme */ //#pragma comment(linker, "/STACK:1024000000,1024000000") #include <bits/stdc++.h> using namespace std; #ifndef CPPELEVEN #ifdef USETR1 #include ...
C++
daadf2acaa58e3da99dedb96186821a0
d83e30f95d12f83ec73654103e917bcd
3,500
PASSED
//#define DEBUG //#define USEPB_DS #define USETR1 #define CPPELEVEN #define GPP /* * temp.cpp * * Created on: 2012-7-18 * Author: BSBandme */ //#pragma comment(linker, "/STACK:1024000000,1024000000") #include <bits/stdc++.h> using namespace std; #ifndef CPPELEVEN #ifdef USETR1 #include ...
C++
daadf2acaa58e3da99dedb96186821a0
c89ddfc915f90d40af523052ba8d9a86
3,500
PASSED
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <...
C++
daadf2acaa58e3da99dedb96186821a0
c9c03732af22c540af16f406b775aaff
3,500
PASSED
#include<bits/stdc++.h> #define P 1000000007 #define N 605 inline void fmo(int &x){ x+=(x>>31)&P; } inline int fp(int x,int k=P-2){ int res=1; for(;k;k>>=1,x=1ll*x*x%P) if(k&1) res=1ll*res*x%P; return res; } int n,m,a[N]; int pw[N]; std::vector<int> A,B; int f[N][N][2],g[N][N][2],s[N][2],...
C++
daadf2acaa58e3da99dedb96186821a0
d7684f7b6de8495f9745376d7e28a4d1
3,500
PASSED
#include<bits/stdc++.h> #define P 1000000007 #define N 605 inline void fmo(int &x){ x+=(x>>31)&P; } inline int fp(int x,int k=P-2){ int res=1; for(;k;k>>=1,x=1ll*x*x%P) if(k&1) res=1ll*res*x%P; return res; } int n,m,a[N]; int pw[N]; std::vector<int> A,B; int f[N][N][2],g[N][N][2],s[N][2],...
C++
daadf2acaa58e3da99dedb96186821a0
94af260cc8219f83bae17dad5ab4bfe0
3,500
PASSED
#include <bits/stdc++.h> using namespace std; #define fastIO ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); typedef long long ll; #define sz(s) int (s.size()) int main() { fastIO string basicString, resultingString; int t; cin >> t; while(t--) { cin >> basicString >> resultingSt...
C++
d69e10bb05d119ec2ad4b5c0e4304336
e9b3973c9525509d555e080d1b8324b4
1,300
PASSED
//// //// Created by MA on 10/31/2022. //// //#include <iostream> //#include<string> //using namespace std; //#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); //int main() { // fio // /* // 2 times to the right // 3 times to the left // */ // int n; // cin >> n; // string s, t; ///...
C++
d69e10bb05d119ec2ad4b5c0e4304336
0d66e5677114605a831fdaaf39a13bbc
1,300
PASSED
//#include <bits/stdc++.h> #include <iostream> #include <algorithm> #include <string> using namespace std; int main() { int tc; cin>>tc; while (tc--){ string s,t ; cin>>s>>t; bool found = 0; for(int i = 0;i<s.size();++i){ string right =s.substr(0,i+1); ...
C++
d69e10bb05d119ec2ad4b5c0e4304336
9e226af50267be4eabd3f4aa2a663289
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define sz(s) int(s.size()) #define ll long long #define FIO ios_base::sync_with_stdio(0);cin.tie(0); int main () { FIO int t; cin >> t; string s, k; while(t--) { cin >> s >> k; bool good = 0; for(int i = 0; i< sz(s); i++) ...
C++
d69e10bb05d119ec2ad4b5c0e4304336
f4a63ac7c48dc12217d583cd666e375f
1,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5 + 5, mod = 1e9 + 7; const ll oo = 1e18; ll a[N]; void solve() { string s,t; cin>>s>>t; int n = s.size(),m = t.size(); bool found = 0; for(int i=0;i<n;i++){ for(int j=i;j<n;j++){ ...
C++
d69e10bb05d119ec2ad4b5c0e4304336
3deb14b9d55f244c947b58999e429b48
1,300
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++
d69e10bb05d119ec2ad4b5c0e4304336
ac4e5d8c51c204ef79d663d208ffa8e7
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int tc; cin >> tc; while(tc--) { string s1, s2; cin >> s1 >> s2; bool flag=0; for(int i= 0; i <s1.size(); i++) { string a, b; a = s1.substr(0, i+1); b = s1.substr(0, i);...
C++
d69e10bb05d119ec2ad4b5c0e4304336
4303e428dfa43e226ca980123d86b54b
1,300
PASSED
#include <iostream> using namespace std; int main() { int T; cin >> T; while(T--) { string s, t; cin >> s >> t; bool ok = false; for (int i = 0; !ok && i < s.size(); i++) { // starting position int idx = 0; for (int j = i; !ok && j < s.size(); j++) { // how many...
C++
d69e10bb05d119ec2ad4b5c0e4304336
27247e2e4ce57df69cdb91c44ffb3dfc
1,300
PASSED
#include<iostream> #include <algorithm> using namespace std; const int N = 27; int main() { int q; cin >> q; while (q--) { string s, t; cin >> s >> t; int n = s.size(), m = t.size(); bool yes = false; for (int right = 0; right < n; right++) { for (i...
C++
d69e10bb05d119ec2ad4b5c0e4304336
b8fc271db54092bc037c0abd8a9042c6
1,300
PASSED
#include <algorithm> #include <iostream> #include <iomanip> #include <string> #include <cmath> using namespace std; int main() { int t; cin >> t; while (t--) { string a, b; cin >> a >> b; bool f = 0; for (int i = 0; i < a.size(); i++) { for (int j = ...
C++
d69e10bb05d119ec2ad4b5c0e4304336
920eab1eebbfff88979836aaf9949c4b
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int input; cin >> input; for(; input > 0; input--) { int candidate, answer; cin >> candidate; answer = candidate/10; if((candidate % 10) == 9) answer++; cout << answer << endl; } return 0...
C++
8e4194b356500cdaacca2b1d49c2affb
5c5f659b8baffb839045b44f28e6da7f
800
PASSED
#include <iostream> /* Como o primeiro número é o 9, podemos perceber que somente ao adicionarmos mais um dígito teremos um número com a propriedade dada. Portanto, se dividirmos por 10, iremos verificar a quantidade de números com essa propriedade. Entretanto, se o número é reduzido a 9 no módulo 10, ...
C++
8e4194b356500cdaacca2b1d49c2affb
53aeddcc30a8be291044441f31ad7bcc
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ long long n; cin>>n; if(n%10==9){ int x=n/10; x=x+1; cout<<x<<endl; } else{cout<<n/10<<endl;} } }
C++
8e4194b356500cdaacca2b1d49c2affb
3af84f80b6210e437265db7a5823cef8
800
PASSED
#include<iostream> using namespace std; int a[10001]; int n; int main() { int t; cin >> t; while (t--) { int a; cin >> a; int num; num = a / 10; if (a % 10 == 9) { num++; } cout << num << endl; } }
C++
8e4194b356500cdaacca2b1d49c2affb
1f2a4d806428761bef73d73609c593b6
800
PASSED
#include<iostream> #include<algorithm> #include<cstring> #include<cstdio> using namespace std; int main() { int t; scanf("%d", &t); while (t--) { long long tmp; scanf("%lld", &tmp); long long ans = (tmp + 1) / 10; printf("%lld\n", ans); } }
C++
8e4194b356500cdaacca2b1d49c2affb
3e7093592caf65b02950e4e9f7dcefb8
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t,n; cin >> t; for(int i=1;i<=t;i++) { cin>>n; if(n%10 == 9) { cout << n/10 + 1 << endl; } else cout << n/10 << endl; } }
C++
8e4194b356500cdaacca2b1d49c2affb
b0c93500c8eb23d9691cf215670696f8
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(void) { long long int n,t,inter; cin >>t; for(int i=1;i<=t;i++) { cin>> n; if(n%10 == 9) cout << (n/10)+1 << endl; else cout << n/10 << endl; } return 0; }
C++
8e4194b356500cdaacca2b1d49c2affb
63b3a70d0f43e40c8725d17b9719636a
800
PASSED
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <vector> #include <queue> //#include <map> //#include <unordered_map> #include <unordered_set> #define ll long long #define ULL unsigned long long #define Buff std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define endl '\...
C++
8e4194b356500cdaacca2b1d49c2affb
31d70592e02670f06b0aa5bd19fdb0ce
800
PASSED
#include<iostream> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; cout << (n + 1) / 10 << endl; } return 0; }
C++
8e4194b356500cdaacca2b1d49c2affb
883016ec1d9c6176ae11c6ca55835900
800
PASSED
#include <bits/stdc++.h> #define long long LL #define debug(x) \ ; \ cout << x << "---" << endl; using namespace std; void slove() { int n; cin >> n; if (n % 10 == 9) cout << n / 10 + 1 << endl; else cout << n / 10 << endl; } int main() { int _; cin >> _; ...
C++
8e4194b356500cdaacca2b1d49c2affb
872f24a8e560038538f3dacf1db782fe
800
PASSED
#!/usr/bin/env python3 def solve(s, t): #print('---------') #print(s) #print(t) if 0: if t == s: return 'YES' if len(t) >= len(s): return 'NO' if t in s: return 'YES' #s = f' {s} ' #t = f' {t} ' max_tri...
Python
67856314f24ed718eb9b0d9fc9ab1abe
c9283d50f2f81b1034949fd581dff554
1,500
PASSED
#!/usr/bin/env python3 def solve(s, t): #print('---------') #print(s) #print(t) if 0: if t == s: return 'YES' if len(t) >= len(s): return 'NO' if t in s: return 'YES' #s = f' {s} ' #t = f' {t} ' max_tri...
Python
67856314f24ed718eb9b0d9fc9ab1abe
652e0cff1811b3d7735dfa6189def32c
1,500
PASSED
import sys from math import sqrt, gcd, factorial, ceil, floor, pi, inf, isqrt from collections import deque, Counter, OrderedDict, defaultdict from heapq import heapify, heappush, heappop sys.setrecursionlimit(10**5) from functools import lru_cache #@lru_cache(None) #===========================================...
Python
67856314f24ed718eb9b0d9fc9ab1abe
2d28fc1e4a825ade289047332eff42e3
1,500
PASSED
def match(s, t): """ iterate over the chars in s: |s| - |t| is odd? start at 1, otherwise start at 0 s[j] == t[i]? yes: inc counter of matches & inc both i & j by 1 no: inc j by 2 repeat once all chars in t were tried if matches == |t| return true, otherwis...
Python
67856314f24ed718eb9b0d9fc9ab1abe
41fa5d4ea719fb49c5d23785a1095ce8
1,500
PASSED
#https://codeforces.com/blog/entry/71884 import sys input = sys.stdin.readline from math import inf, gcd, log, log2, floor, ceil, sqrt from collections import Counter, defaultdict, deque from heapq import heappush, heappop, heapify from functools import lru_cache from itertools import permutations, accumulate ...
Python
67856314f24ed718eb9b0d9fc9ab1abe
d10d8442bcfbf349b97265a128393b60
1,500
PASSED
t = int(input()) for _ in range(t): S = input() T = input() if len(S) < len(T): print("NO") else: s = S[::-1] t = T[::-1] tt = "" s_now = 0 for x in t: while s[s_now] != x: s_now += 2 if s_now>=len(s): break if s_now>=len(s): ...
Python
67856314f24ed718eb9b0d9fc9ab1abe
969baf6a01064fded30e1b38269f6b7d
1,500
PASSED
def solve(s, t): s0, s1 = 0, 0 while True: if s0 < len(s) and s1 < len(t) and s[s0] == t[s1]: s0 += 1 s1 += 1 else: s0 += 2 if s1 == len(t): return 'YES' if s0 > len(s): return 'NO' for _ in range(int(input())): print(...
Python
67856314f24ed718eb9b0d9fc9ab1abe
8a21f754f4efaba56f97159f4cd8726b
1,500
PASSED
import sys from collections import Counter input = lambda : sys.stdin.readline().strip() intput = lambda : map(int, input().split()) def solve(): s, t = input(), input() ls, lt = len(s), len(t) if lt > ls: return "NO" i = j = 0 while i < ls and j < lt: a, b = s[~i], t[~j] if a == b...
Python
67856314f24ed718eb9b0d9fc9ab1abe
9b1de0c4cc51cc7df04b05a6722f5278
1,500
PASSED
import sys input = sys.stdin.readline for _ in range(int(input())): s = input()[:-1][::-1] t = input()[:-1][::-1] n = len(s) m = len(t) i = 0 j = 0 while i < n and j < m: if s[i] == t[j]: i += 1 j += 1 else: i += 2 if j...
Python
67856314f24ed718eb9b0d9fc9ab1abe
de9b255ee3d44563207d9563e77f0a13
1,500
PASSED
def check_backspace(s,t): if len(t)==0: return print('YES') i = len(s)-1 j = len(t)-1 while True: if j < 0 or i < 0: print('YES' if j < 0 else 'NO') return if s[i]==t[j]: i -= 1 j -= 1 else: i -= 2 q = int(input()); for i in range(q): s = input() ...
Python
67856314f24ed718eb9b0d9fc9ab1abe
5035b9414577439359bef496754439ec
1,500
PASSED
// tmmarssanzhar777 #include <bits/stdc++.h> using namespace std; #define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define all(a) a.begin(),a.end() #define pb push_back #define mk make_pair #define endl '\n' #define X first #define Y second typedef long long ll; typedef long double ld; const...
C++
ba1aa2483f88164c1f281eebaab2cfbd
1d9cadf0a7b951d9b53651649e993c62
1,200
PASSED
// GLORY TO LORD SHIVA :- ABHISHEK SINGH BHADAURIA// //vaishnavam yatha sambhu// #include<bits/stdc++.h> #define ll long long using namespace std; bool dh1(ll s1, ll s2, ll r){ if(s2+r<s1) return true; return false;} bool dh2(ll s1, ll s2, ll r){ if(s1+r<s2) return true; ret...
C++
ba1aa2483f88164c1f281eebaab2cfbd
154d0c09f02964dc8e0343a4c8e26e16
1,200
PASSED
#define ALLAH_IS_THE_GREATEST ALLAH_IS_THE_GREATEST #include<bits/stdc++.h> #define ll long long #define fl float #define pb push_back #include<cmath> #define no cout << "NO\n" ; #define yes cout << "YES\n" ; #define elif else if #define en <<endl; #define ld long double //#define r0 return 0; using namesp...
C++
ba1aa2483f88164c1f281eebaab2cfbd
4f98f0ee93d4bf93335f0ecbc43f6a91
1,200
PASSED
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define mp make_pair #define pdd pair<double, double> #define endl '\n' const int INF = 1e9+10; using namespace std; bool bs(ll a,ll b, ll r){ ll ma = r/2; ll mb = (r+1)/2; return a + ma < b || b + mb < a; } int main(){ ios_base::s...
C++
ba1aa2483f88164c1f281eebaab2cfbd
3a3828441270c87b59f262eca576bc74
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int ans = 9; { int cnt0 = 0, cnt1 = 0; for (int i = 0; i < 10; ++i) { if (i % 2 == 0) cnt0 += s[i] != '0'; else cnt1 += s[i] == '1'; if (cnt0 > cnt1 + (10 - i) / 2) ans = min(...
C++
ba1aa2483f88164c1f281eebaab2cfbd
e3de38962228c3a433d0aac78444a711
1,200
PASSED
#include<iostream> using namespace std; int main(){ int t; scanf("%d ",&t); while(t--){ int a = 0, x = 0, b = 0, y = 0; char s[12]; scanf(" %s",&s[1]); int i; for(i = 1; i <= 10; i++){ if(i & 1){ if(s[i] == '1'){ a++; } else if(s[i] == '?'){ x++; } } else{ if(s[i] ==...
C++
ba1aa2483f88164c1f281eebaab2cfbd
a9c7ba952b34bcf6c46d153996a1cb90
1,200
PASSED
#include <bits/stdc++.h> #define rep(x, start, end) for (int x = start; x < end; x++) #define pb(x) push_back(x) #define mp(x, y) make_pair(x, y) using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; int process(string x) { int a = 0, b = 0, aturns = 0, bturns = 0, awilds = ...
C++
ba1aa2483f88164c1f281eebaab2cfbd
1eaf2bc68ca16f387250d48f635c0954
1,200
PASSED
#include <iostream> #include <algorithm> #include <cstring> #include <cmath> #include <cstdio> using namespace std; char ch[15]; int t; int main() { cin>>t; while(t--) { for(int i=1;i<=10;i++) cin>>ch[i]; int ans=10; for(int i=1;i<=10;i++) { int cnt1_0=0,cnt2_0=0; int cnt1_1=0,cnt2_1=0; int cnt1_2=0...
C++
ba1aa2483f88164c1f281eebaab2cfbd
d110329f972a503d4b04122916687ec2
1,200
PASSED
#include <bits/stdc++.h> using namespace std; void solve() { string s; cin >> s; int ans = 10; for (int mask = 0; mask < (1<<10); mask++) { bool woi = true; int fi = 0, se = 0, a = 5, b = 5; for (int i = 0; i < 10; i++) { if (mask&(1<<i)) { if (s[i] == '0') { woi = false; brea...
C++
ba1aa2483f88164c1f281eebaab2cfbd
b40bce44e444debcf481023c4f521130
1,200
PASSED
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int queries; cin >> queries; for(int q = 0; q < queries; q++){ string s; cin >> s; int ans = 9; int a = 0, b = 0; for (int...
C++
ba1aa2483f88164c1f281eebaab2cfbd
ba4327243267dc14ff5082b1348774b0
1,200
PASSED
#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<vector> using namespace std; const int Maxn=3e5+10; const int mod=998244353; int a[Maxn],b[Maxn]; int c[Maxn],f[Maxn]; int ans[Maxn]; int n,m; inline int read() { int s=0,w=1; char ch=getchar(); while(ch<'0'||ch>'9'){i...
C++
2c610873aa1a772a4c7f32cb74dd75fa
f249cf3dca064c3fb05faa9ee96737c7
2,100
PASSED
#include<bits/stdc++.h> using namespace std; const int N=3e5+10; int n,m,a[N],k[N],cnt[N],r,lst[N],b[N]; bool flag[N]; bool check(int x){ for(int i=1;i<=n;i++)b[i]=a[(i+x-1)%n+1]; int ans=0; for(int i=1;i<=n;i++)flag[i]=0; for(int i=1;i<=n;i++){ if(flag[i])continue; int tmp=i; while(!flag[tmp]){ ...
C++
2c610873aa1a772a4c7f32cb74dd75fa
3ed2df411331eca492901833bb05029f
2,100
PASSED
#include<iostream> #include<cstring> #include<vector> #include<cstdio> #define N 300005 using namespace std; int a[N],p[N],b[N]; int f[N]; int n,m,ans[N],cnt,sum; int j; int main() { int t; scanf("%d",&t); while(t--) { n,m,cnt=0; scanf("%d %d",&n,&m); for(...
C++
2c610873aa1a772a4c7f32cb74dd75fa
e82d3c357c39466a7b35839bd2612733
2,100
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define mem(x) memset(x,0,sizeof(x)) //const ll inf=1000000000000000000; const int N=300005; int n,m,T; int a[N],tmp[N],ans[N],cnt; int fa[N],rans[N],tot; int find(int x) { if (x==fa[x]) return x; return fa[x]=find(fa[x]); } ...
C++
2c610873aa1a772a4c7f32cb74dd75fa
510c1efd934357d721db30f972ca9a86
2,100
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 300000; inline int read() { int s = 0, w = 1; char ch = getchar(); while (ch > '9' || ch < '0') { if (ch == '-') w = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar(); return s * w; } int T, n, m, st...
C++
2c610873aa1a772a4c7f32cb74dd75fa
e9c89c7a8cc8de1da6a95dbed69f00b2
2,100
PASSED
#include<iostream> #include<cstdio> #define R register using namespace std; const int maxn=3e5; int T,n,m,ans[maxn+5]; int sta[20],top,a[maxn+5],cnt,b[maxn+5]; bool vis[maxn+5]; inline int read(){ int a=0,b=1; char s=getchar(); while(s<48||s>57){ if(s=='-') b=-1; s=getchar(); } while(s>=48&&s<=5...
C++
2c610873aa1a772a4c7f32cb74dd75fa
24a000a4e00a9504527127e0ebe0f7cd
2,100
PASSED
#include<iostream> #include<cstdio> #include<vector> #define Maxn 300005 using namespace std; vector <int> ed[Maxn]; int p[Maxn],tot[Maxn],ans[11],cnt=0; bool vis[Maxn]; inline int read() { char c=getchar(); int x=0; while(c<48) c=getchar(); while(c>47) x=(x<<3)+(x<<1)+(c^48),c=getchar(); return x; } ...
C++
2c610873aa1a772a4c7f32cb74dd75fa
5203e785c1d8da76a78263914c520d96
2,100
PASSED
#include <bits/stdc++.h> using namespace std; int cycle_count(vector<int> q, int n) { for(int i = 0; i < n; i++) q[i]--; vector<int> used(n); int ans = 0; for(int i = 0; i < n; i++) { if(used[i] == 1) continue; int j = i; while(used[j] == 0) { used[j] = 1; j =...
C++
2c610873aa1a772a4c7f32cb74dd75fa
eb9606d4b7dbb2bbc03ccc0a995be0c1
2,100
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; int T, n, m, p[N], delta[N], bef[N], vis[N]; inline bool check(int k) { int need = 0; for (int i = 1; i <= n; ++ i) bef[i] = p[(i + k - 1) % n + 1], vis[i] = 0; for (int i = 1; i <= n; ++ i) if (!vis[i]) { int x = i, cnt = 0; while (!vis[...
C++
2c610873aa1a772a4c7f32cb74dd75fa
50312e98f5729083b0633172f0e8cb90
2,100
PASSED
#include<bits/stdc++.h> #define N 1110000 #define mod 998244353 #define left l,mid,ls[p] #define righ mid+1,r,rs[p] #define fer(x,y,z) for(register int x=y;x<=z;x++) using namespace std; int n,ans[N],ct[N],now[N],m; int res[N],rr[N],aa[N]; int cnt=0; main(){ int t;cin>>t;while(t--){ cin>>n>>m;fer(i,0,n...
C++
2c610873aa1a772a4c7f32cb74dd75fa
155cb4e54e83cb064e9e70bfb158427f
2,100
PASSED
#pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> // sharky too orz using namespace std; #define int long long //#define endl "\n" #define pb push_back #define mp make_pair #define mt make_tuple #define itn int #define inf 1000000000000000000LL #define ll long long //#define gcdi gcd t...
C++
d4774270c77128b1cc4a8f454ee544bd
5d80be988c516d2b4e243db07f68edaa
2,700
PASSED
#pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> // sharky too orz using namespace std; #define int long long //#define endl "\n" #define pb push_back #define mp make_pair #define mt make_tuple #define itn int #define inf 1000000000000000000LL #define ll long long //#define gcdi gcd t...
C++
d4774270c77128b1cc4a8f454ee544bd
1216bcf9ad5401728537b3101ba7eaf8
2,700
PASSED
#include "bits/stdc++.h" using namespace std; #define all(x) begin(x),end(x) template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>...
C++
d4774270c77128b1cc4a8f454ee544bd
c97ddd72a70930f1750a30311302cd7e
2,700
PASSED
#include "bits/stdc++.h" using namespace std; #define all(x) begin(x),end(x) template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>...
C++
d4774270c77128b1cc4a8f454ee544bd
9dc47c06496cc0f0e0e654abad93adcd
2,700
PASSED
#include <iostream> #include <algorithm> #include <iomanip> #include <vector> #include <queue> #include <deque> #include <set> #include <map> #include <tuple> #include <cmath> #include <numeric> #include <functional> #include <cassert> #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x...
C++
d4774270c77128b1cc4a8f454ee544bd
839c0a20c3ac7131505ff0c7a67c6c98
2,700
PASSED
// time-limit: 4000 // problem-url: https://codeforces.com/contest/1553/problem/G #include <bits/stdc++.h> using namespace std; #ifdef DEBUG #include "../../debug.h" #else #define DEB(...) #endif typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vl; ty...
C++
d4774270c77128b1cc4a8f454ee544bd
aabdcdfcc31d6b2a672e4025d69732a8
2,700
PASSED
// time-limit: 4000 // problem-url: https://codeforces.com/contest/1553/problem/G #include <bits/stdc++.h> using namespace std; #ifdef DEBUG #include "../../debug.h" #else #define DEB(...) #endif typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vl; ty...
C++
d4774270c77128b1cc4a8f454ee544bd
1959507f641ba1601c6f0724bb800d25
2,700
PASSED
// time-limit: 4000 // problem-url: https://codeforces.com/contest/1553/problem/G #include <bits/stdc++.h> using namespace std; #ifdef DEBUG #include "../../debug.h" #else #define DEB(...) #endif typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vl; ty...
C++
d4774270c77128b1cc4a8f454ee544bd
19be645352fc2a7cbc55926a6a5a3b99
2,700
PASSED
// time-limit: 4000 // problem-url: https://codeforces.com/contest/1553/problem/G #include <bits/stdc++.h> using namespace std; #ifdef DEBUG #include "../../debug.h" #else #define DEB(...) #endif typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vl; ty...
C++
d4774270c77128b1cc4a8f454ee544bd
cef502f7c8990ae4ae5df96f344f3036
2,700
PASSED
#include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> #include <map> #include <set> #include <vector> #include <queue> using namespace std; typedef long long ll; typedef unsigned long long ull; template<typename T> void chkmax(T& x, T y) { if (y > x) x = y; } templ...
C++
d4774270c77128b1cc4a8f454ee544bd
3e5e21e5955debed154bc689ef32e271
2,700
PASSED
// LUOGU_RID: 93125063 /* 大致总体思路就是对于每一个x(题面中的x)枚举它的每一位,看从最高位 到 (这一位的上一位)都与它相同,这一位不同的两个数的最优答案(一个数选&1,另一个数选&1^1), 因为异或相同为1,不同为0的性质,选不同的>选相同的,所以让选不同的那个取最小值,选相同的那个取最大值,这样差才尽可能小。 然后就是一些优化复杂度的方法,看代码 */ #include <bits/stdc++.h> using namespace std; typedef int ll; const int maxn = 1e6+50; const int maxm = 2e6; const int N ...
C++
d975f1a3b42a09da3cb2e549a2ce3046
9d1aca83ef23d7774ad640de6e2a15a3
2,900
PASSED
/* 大致总体思路就是对于每一个x(题面中的x)枚举它的每一位,看从最高位 到 (这一位的上一位)都与它相同,这一位不同的两个数的最优答案(一个数选&1,另一个数选&1^1), 因为异或相同为1,不同为0的性质,选不同的>选相同的,所以让选不同的那个取最小值,选相同的那个取最大值,这样差才尽可能小。 然后就是一些优化复杂度的方法,看代码 */ #include <bits/stdc++.h> using namespace std; typedef int ll; const int maxn = 1e6+50; const int maxm = 2e6; const int N = 21; l...
C++
d975f1a3b42a09da3cb2e549a2ce3046
5b6697b542a2107de8faf76b440eec91
2,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef int ll; const int maxn = 1e6+50; const int maxm = 1e7+1e6; const int N = 21; ll R() { ll x = 0,f = 1; char c = getchar(); while(c > '9' || c < '0') { if(c == '-')f = -1; c = getchar(); } while(c >= '0' &...
C++
d975f1a3b42a09da3cb2e549a2ce3046
7cb93c9956380f2b3d5bcdd7e2d0e1cd
2,900
PASSED
// LUOGU_RID: 93124925 #include <bits/stdc++.h> using namespace std; typedef int ll; const int maxn = 1e6+50; const int maxm = 1e7+1e6; const int N = 21; ll R() { ll x = 0,f = 1; char c = getchar(); while(c > '9' || c < '0') { if(c == '-')f = -1; c = getchar(); } while(c >= '...
C++
d975f1a3b42a09da3cb2e549a2ce3046
5d7a3052b073e882361c48a5a1596c16
2,900
PASSED
#include<bits/stdc++.h> using namespace std; typedef long long ll; int n,K,a[530005],c[10600005][2],rt=1,tot=1,mn[21][530005]; void Insert(int p){ int x=rt,m[24]={0}; while(p)m[++m[0]]=p%2,p/=2; for(int i=K;i>=1;i--){ if(!c[x][m[i]])c[x][m[i]]=++tot; x=c[x][m[i]]; } } int Qmi(int p,int x,int dep){ ...
C++
d975f1a3b42a09da3cb2e549a2ce3046
d69b8a212429259857a85ecb6bd68fbb
2,900
PASSED
// LUOGU_RID: 90165165 #include<bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define mk make_pair #define lowbit(x) (x&(-x)) #define pb emplace_back #define pr pair<int,int> #define let const auto const int N=(1<<19)|5,M=(1<<21)|5,K=20; int read(){ int x=0,f=1; cha...
C++
d975f1a3b42a09da3cb2e549a2ce3046
a51854cb998bb8aa99e8a88a3691353e
2,900
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define mk make_pair #define lowbit(x) (x&(-x)) #define pb emplace_back #define pr pair<int,int> #define let const auto const int N=(1<<19)|5,M=(1<<21)|5,K=20; int read(){ int x=0,f=1; char c=getchar(); while(...
C++
d975f1a3b42a09da3cb2e549a2ce3046
883450b8dfcd316abf53095c0dfbd4cd
2,900
PASSED