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; #define int long long typedef long long ll; const ll INF = 1e18; void solve() { int n; cin >> n; int l, r; cin >> l >> r; string s, t; cin >> s >> t; vector<int> p; for (int i = 0; i < n; i++) { if (s[i] != t[i]) {...
C++
498b31f46ed24fb5fa7f126eaf377901
1f91ca370c93546ef763ec8e2529facf
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long typedef long long ll; const ll INF = 1e18; void solve() { int n; cin >> n; int l, r; cin >> l >> r; string s, t; cin >> s >> t; vector<int> p; for (int i = 0; i < n; i++) { if (s[i] != t[i]) {...
C++
498b31f46ed24fb5fa7f126eaf377901
180ee3adb6256d69f64b2e5786b00d58
2,000
PASSED
#include<bits/stdc++.h> #define fi first #define se second #define pb push_back #define mp make_pair #define ll long long #define LOG 20 #define rboost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define en "\n" #define getbit(i,j) ((i>>j)&1) #define cnt_bit(x) __builtin_popcount(x) using namespace ...
C++
498b31f46ed24fb5fa7f126eaf377901
014b979c763338e9886e3618d69850c6
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long int dp[5010]; vector<int> dif; signed main() { int t; cin>>t; while(t--) { dif.clear(); int n,x,y; cin>>n>>x>>y; string a,b; cin>>a>>b; if(x>=y) { for(int i=0;i<n;i++) if(a[i]!=b[i]) dif.push_back(i); if(signed(...
C++
498b31f46ed24fb5fa7f126eaf377901
e8d2a339888f946cdf195849c0d55b47
2,000
PASSED
/******************************* | Author: jason-wang | Problem: D2. Zero-One (Hard Version) | Contest: Codeforces Round #821 (Div. 2) | URL: https://codeforces.com/contest/1733/problem/D2 | When: 2022-09-19 22:35:11 | | Memory: 512 MB | Time: 3000 ms **************...
C++
498b31f46ed24fb5fa7f126eaf377901
fd43777674d13cc848b9c1ce96932d75
2,000
PASSED
/******************************* | Author: jason-wang | Problem: D2. Zero-One (Hard Version) | Contest: Codeforces Round #821 (Div. 2) | URL: https://codeforces.com/contest/1733/problem/D2 | When: 2022-09-19 22:35:11 | | Memory: 512 MB | Time: 3000 ms **************...
C++
498b31f46ed24fb5fa7f126eaf377901
d29db6f95155b545eb3990378f8ff565
2,000
PASSED
/******************************* | Author: jason-wang | Problem: D2. Zero-One (Hard Version) | Contest: Codeforces Round #821 (Div. 2) | URL: https://codeforces.com/contest/1733/problem/D2 | When: 2022-09-19 22:35:11 | | Memory: 512 MB | Time: 3000 ms **************...
C++
498b31f46ed24fb5fa7f126eaf377901
285f11096ba5d3cfccf1da0b809c6a2f
2,000
PASSED
/******************************* | Author: jason-wang | Problem: D2. Zero-One (Hard Version) | Contest: Codeforces Round #821 (Div. 2) | URL: https://codeforces.com/contest/1733/problem/D2 | When: 2022-09-19 22:35:11 | | Memory: 512 MB | Time: 3000 ms **************...
C++
498b31f46ed24fb5fa7f126eaf377901
dab9a5812932134a7aa8bb9b9a1d8434
2,000
PASSED
// LUOGU_RID: 90272793 #include <bits/stdc++.h> #define rep(i,l,r) for (int i = l; i <= r; i++) #define per(i,r,l) for (int i = r; i >= l; i--) #define fi first #define se second #define prt std::cout #define gin std::cin #define edl std::endl namespace wxy{ const int N = 125; using ll = long long; ...
C++
73a077e8e715c72e37cf10fca281d3e2
588574e0e627f5ed4a48209f20fea796
2,700
PASSED
#include <bits/stdc++.h> #define rep(i,l,r) for (int i = l; i <= r; i++) #define per(i,r,l) for (int i = r; i >= l; i--) #define fi first #define se second #define prt std::cout #define gin std::cin #define edl std::endl namespace wxy{ const int N = 125; using ll = long long; ll t,f[N][N]; int x...
C++
73a077e8e715c72e37cf10fca281d3e2
4f0ed276a599cb1420129b02ba106155
2,700
PASSED
/* * @Author: Michael Lee * @Date: 2022-09-23 17:13:14 * @LastEditors: Michael Lee * @LastEditTime: 2022-09-23 17:59:08 * @Description: */ #define fastIO #include<iostream> #include<cstring> #include<algorithm> #include<cmath> using namespace std; /***********fast IO***********/ #ifdef fastIO c...
C++
73a077e8e715c72e37cf10fca281d3e2
a59c95cc4bbccea69010297ad7332331
2,700
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define N 130 int q, t, x, y, dp[N][N]; int work(int t, int x, int y) { memset(dp, 0, sizeof(dp)); dp[0][0] = max(0ll, t - x - y + 1); for(int i = 0; i <= x; i++) for(int j = 0; j <= y; j++) { dp[i][j + 1] += (...
C++
73a077e8e715c72e37cf10fca281d3e2
c9221dee9db2a996ca81b965f49e49b9
2,700
PASSED
// LUOGU_RID: 93375817 #include<bits/stdc++.h> #define fep(i,l,r) for(int i=l;i<=r;++i) #define feb(i,r,l) for(int i=r;i>=l;--i) #define For(i,u) for(int i=head[u];i;i=e[i].nxt) #define int long long #define LL long long #define mpr make_pair #define pr pair<int,int> #define mpr make_pair using namespace std; ...
C++
73a077e8e715c72e37cf10fca281d3e2
c0fddf4922ba292c26cf347ec373b478
2,700
PASSED
#include<bits/stdc++.h> #define fep(i,l,r) for(int i=l;i<=r;++i) #define feb(i,r,l) for(int i=r;i>=l;--i) #define For(i,u) for(int i=head[u];i;i=e[i].nxt) #define int long long #define LL long long #define mpr make_pair #define pr pair<int,int> #define mpr make_pair using namespace std; const int N = 120+5,...
C++
73a077e8e715c72e37cf10fca281d3e2
2dc5fe9bc6bc20b70fe946cb525e64e1
2,700
PASSED
#include <iostream> #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #include <queue> #define int long long #define file(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout); #define dbg(x) cerr<<"In Line"<<__LINE__<<" the "<<#x<<" = "<<x<<'\n'; #define abs(x) ((x) < 0 ? -(...
C++
73a077e8e715c72e37cf10fca281d3e2
f406ff8468f1f49a30f4627f60d1b9b9
2,700
PASSED
#include <iostream> #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #include <queue> #define int long long #define file(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout); #define dbg(x) cerr<<"In Line"<<__LINE__<<" the "<<#x<<" = "<<x<<'\n'; #define abs(x) ((x) < 0 ? -(...
C++
73a077e8e715c72e37cf10fca281d3e2
24d8ba19de4b2c475be5c5e5d29adfed
2,700
PASSED
// LUOGU_RID: 90329960 #include<iostream> #include<cstdio> #define CI const int #define int long long using namespace std; const int N=135; int T,n,f[N][N]; int read(int &v) { int f=1; char ch; for(ch='*';!isdigit(ch) && ch!='-';ch=getchar()); if(ch=='-') f=-1,ch=getchar(); for(v=0;isdigit(ch);v=v*10+c...
C++
73a077e8e715c72e37cf10fca281d3e2
755b51e0715e443af8119bf57f5dd365
2,700
PASSED
// LUOGU_RID: 90329884 #include<iostream> #include<cstdio> #define CI const int #define int long long using namespace std; const int N=135; int T,n,f[N][N]; int read(int &v) { int f=1; char ch; for(ch='*';!isdigit(ch) && ch!='-';ch=getchar()); if(ch=='-') f=-1,ch=getchar(); for(v=0;isdigit(ch);v=v*10+c...
C++
73a077e8e715c72e37cf10fca281d3e2
b0692377e31a50f28e74962efe459ed0
2,700
PASSED
import java.io.BufferedReader; import java.io.Closeable; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import s...
Java
3888f8d6cce7037169c340a9fb508cbe
990627dfbc0b2c82ccfab15dde3c9dbd
2,100
PASSED
import java.io.*; import java.util.*; public class Main { private static final int MOD = 1000000007; private static final Map<String, Long> memo1 = new HashMap<>(); private static void solve(int n, Map<Integer, List<Integer>> g, int s, int t){ int[] distToEnd = new int[n + 1]; ...
Java
3888f8d6cce7037169c340a9fb508cbe
8b94927ba27572153b2bc8f50fd2811b
2,100
PASSED
import java.io.*; import java.util.*; public class Main { private static final int MOD = 1000000007; private static final Map<String, Long> memo1 = new HashMap<>(); private static void solve(int n, Map<Integer, List<Integer>> g, int s, int t){ int[] distToEnd = new int[n + 1]; ...
Java
3888f8d6cce7037169c340a9fb508cbe
5a649eed148d6c8c1abafc9c9a20ae5b
2,100
PASSED
import java.util.*; import java.io.*; public class Main { static long startTime = System.currentTimeMillis(); // for global initializations and methods starts here static List<List<Integer>> graph; static int[] dis; static int[][] dp; static int paths(int src, int dest, int t) ...
Java
3888f8d6cce7037169c340a9fb508cbe
d7516ad620c556f41a93a401f651d292
2,100
PASSED
import java.util.*; import java.io.*; public class Main { static long startTime = System.currentTimeMillis(); // for global initializations and methods starts here static List<List<Integer>> graph; static int[] dis; static int[][] dp; static int paths(int src, int dest, int t) ...
Java
3888f8d6cce7037169c340a9fb508cbe
96eb564edc97ff0a3cac9f9046334ead
2,100
PASSED
import java.io.*; import java.util.*; public final class Main { //int 2e9 - long 9e18 static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)}; static...
Java
3888f8d6cce7037169c340a9fb508cbe
742bfefc73bfd1e31af369f49fd6e271
2,100
PASSED
import java.util.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int tc = cin.nextInt(); Solution solution = new Solution(); for (int i = 0; i < tc; i++) { int n = cin.nextInt(); int m = cin.nextI...
Java
3888f8d6cce7037169c340a9fb508cbe
c1f5c75382f81673ddd694b2285413cc
2,100
PASSED
//package kg.my_algorithms.Codeforces; import java.util.*; import java.io.*; // If you know the reason for your existence, then act on it. // "मैं दर्शक नहीं हूँ" -> I am not a spectator public class Solution { private static final FastReader fr = new FastReader(); private s...
Java
3888f8d6cce7037169c340a9fb508cbe
b2d72cbe59c1b44e5a090feb47b01dce
2,100
PASSED
import java.util.*; import java.util.concurrent.TimeUnit; import java.io.*; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; public class G_Counting_Shortcuts{ public static void solve(){ } public static void main(String args[])throws IOException, P...
Java
3888f8d6cce7037169c340a9fb508cbe
008acc81e42e343ae8917158d172194b
2,100
PASSED
/* I am dead inside Do you like NCT? */ import static java.lang.Math.*; import java.util.*; import java.io.*; import java.math.*; public class x1650G { static final long MOD = 1000000007L; static ArrayDeque<Integer>[] edges; public static void main(String hi[]) throws Exception { ...
Java
3888f8d6cce7037169c340a9fb508cbe
bae3fe858b42b4f685ac1a696f808785
2,100
PASSED
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> PII; int t; int n,m; string s; bool sort1(pair<PII,int>a,pair<PII,int>b){ return a.first.second<b.first.second; } bool sort2(pair<PII,int>a,pair<PII,int>b){ return a.first.first<b.first.first; } void solve(){ vector<pair<PII,int>>node(m); ...
C++
bfb2831c319400d4a62890e6ea20d045
84e62f5adefa9c769332796e5e933ebd
1,200
PASSED
#include<iostream> #include<algorithm> #include<vector> using namespace std; typedef pair<int,int> pa; struct node { int x,w,index; }a[200010]; bool cmp(node a,node b) { return a.w<b.w; } bool cmpp(node a,node b) { return a.x<b.x; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); ...
C++
bfb2831c319400d4a62890e6ea20d045
4e3101c09e5c87385a36d89907e0af5e
1,200
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int t; int n, m; struct node{ int x, w; int f; }a[N]; bool cmp1(node a, node b) { return a.w < b.w; } bool cmp2(node a, node b) { return a.x < b.x; } int main() { cin >> t; while(t --) { long long sum = 0...
C++
bfb2831c319400d4a62890e6ea20d045
aa2efc58486552232664c7e5cb883f40
1,200
PASSED
#include<iostream> #include<algorithm> using namespace std; const int N=2e5+5; int t,n,m; struct node { int w,pos,oridnal; }a[N]; bool cmp(node x,node y) { return x.w<y.w; } bool cmp1(node x,node y) { return x.pos<y.pos; } int main() { cin>>t; while(t--) { cin>>n>>m; for(int i=1;i<=m;i++) { cin>>a...
C++
bfb2831c319400d4a62890e6ea20d045
05c8e91657444f746678f7b46a15d69b
1,200
PASSED
#include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define ll long long #define pb push_back #define pll pair<ll,ll> #define bug(a) cerr<<#a<<" : "<<a<<endl #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(),(x).rend() const ll MX = 1e5 + 9, mod = 1e...
C++
bfb2831c319400d4a62890e6ea20d045
13b21eb267af0330a9b3f956397a0ac6
1,200
PASSED
#include <bits/stdc++.h> using namespace std; struct note { int x,y,z; } s[1000000]; bool cmp(note a,note b) {return a.y<b.y;} bool cmp1(note a,note b) {return a.x<b.x;} int main() { int t; scanf("%d",&t); while(t--) { printf("\n"); int n,m; scanf("%d%d",&n,&m); for(i...
C++
bfb2831c319400d4a62890e6ea20d045
1ea8948a8591bde9bc44027e6af8917c
1,200
PASSED
#include <bits/stdc++.h> using namespace std; int n,m; struct Node{ int x,w,i; }a[200005]; bool cmp(Node a,Node b){ if(a.x<b.x) return true; else return false; } bool cmp2(Node a,Node b){ if(a.w<b.w) return true; else return false; } signed main() { int t; cin>>t; while(t--){ cin>>n>>m; for(int i=1;i<=m;++i...
C++
bfb2831c319400d4a62890e6ea20d045
58848d24dde7183096c6ef0e3d4457e8
1,200
PASSED
#include<iostream> #include<algorithm> #include <iterator> #include <vector> #include<cstdio> #include<cmath> #include<set> #include <stack> #include <map> #include<queue> #include<string> #define ll long long using namespace std; const int N=100100; struct node { ll x,w,l; }a[200010]; int cmp(node a,node b) { ...
C++
bfb2831c319400d4a62890e6ea20d045
9d92ed20f112c2cdc9a948dd21d9bec8
1,200
PASSED
#include <iostream> #include <cstdio> #include <iomanip> #include <algorithm> #include <cstdio> #include <cmath> #include <string> #include <cstring> #include <set> #include "map" #include <queue> #include <vector> #include <cmath> using namespace std; typedef long long LL; const long long N = 1e6 + 10; LL m, n, k; LL ...
C++
bfb2831c319400d4a62890e6ea20d045
0370b0b62916a08e70d6edb169a275e5
1,200
PASSED
#include<iostream> #include<vector> #include<map> #include<set> #include<algorithm> #include<cmath> #include<stack> #include<cstring> using namespace std; int main() { int t; cin>>t; while(t--) { vector<vector<int>>a; int n,m; cin>>n>>m; for(int i=0; i<m; i++) ...
C++
bfb2831c319400d4a62890e6ea20d045
5a4ee155d6edbcaaf1be3e146e1250f1
1,200
PASSED
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define int long long signed main(){ int t; cin >> t; while(t--){ int l, r, x; bool ok = false; cin >> l >> r >> x; int k = r - (r % x); k -= 1; if(k >= l && k <= r)ok = true; if(ok)cout << max(k%x+k/x, r % x ...
C++
681ee82880ddd0de907aac2ccad8fc04
ac680e408ed15c06b30170594dd6dc48
900
PASSED
#include <bits/stdc++.h> using namespace std; int t, a, l, r; int main(){ cin >> t; while (t){ t--; cin >> l >> r>> a; int maxv = r / a + r % a, s = r / a * a - 1; if(s >= l) maxv = max(maxv, s / a + s % a); cout << maxv << endl; } return 0; }
C++
681ee82880ddd0de907aac2ccad8fc04
eda40caa77f130984659de0bfb4aa8d0
900
PASSED
/* Bismillahir Rahmanir Rahim "Rabbi Zidni Ilma" |||.......Author : Md.Shahidul Islam Shanto.....||| */ #include<bits/stdc++.h> usin...
C++
681ee82880ddd0de907aac2ccad8fc04
339b55990d86b40a5066e987a014246f
900
PASSED
#include <bits/stdc++.h> #define REP(i, a, b) for (int i = a; i < b; i++) #define ll long long #define all(c) (c).begin(),(c).end() #define ff first #define ss second #define pb push_back #define mp make_pair #define fast ios::sync_with_stdio(0); cin.tie(0); using namespace std; typedef priority_queue<in...
C++
681ee82880ddd0de907aac2ccad8fc04
94dc6630c173d2e575342345c05c9d3d
900
PASSED
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <vector> #include <map> #include <string> #include <queue> #include <stack> #include <set> #include <cmath> #include <fstream> #include <climits> using namespace std; typedef long long ll; const ll mod=1e9+7; ll dp[25][25][25]; void ...
C++
681ee82880ddd0de907aac2ccad8fc04
683a0254d6e2533ad1368b2252984643
900
PASSED
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <vector> #include <map> #include <string> #include <queue> #include <stack> #include <set> #include <cmath> #include <fstream> #include <climits> //#include <unordered_map> #define PII pair<int,int> #define PIII pair<int,pair<int,in...
C++
681ee82880ddd0de907aac2ccad8fc04
025c2e3a3c563643c8ee4ab9149ca400
900
PASSED
#include <bits/stdc++.h> // #include <sys/resource.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> using namespace std; // #define INF 1e18 // #define MOD 100000000711 #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define MOD 1000000007 #define MOD1...
C++
681ee82880ddd0de907aac2ccad8fc04
3b4bafc24e66757466a51d3f55e2d3cd
900
PASSED
//bis.mi‿l.laː.hi‿r.raħ.maː.ni‿r.ra.ħiː.mi// #pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef complex<ld> cd; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef pair<ld, ld> pd; typedef vector<int> v...
C++
681ee82880ddd0de907aac2ccad8fc04
1c7e4f8038ed908de67dcf29dac691fc
900
PASSED
/*BISMILLAH*/ #include <bits/stdc++.h> using namespace std; #define ll long long #define scl(a) scanf("%lld", &a) #define scll(a, b) scanf("%lld %lld", &a, &b) #define scf(a) scanf("%lf", &a) #define sci(a) scanf("%d", &a) #define scii(a, b) scanf("%d %d", &a, &b) #define scff(a, b) scanf("%lf %lf", &a, &b) #define pb...
C++
681ee82880ddd0de907aac2ccad8fc04
ec713b7d65ed86f7012fa8cb8d126355
900
PASSED
#include <bits/stdc++.h> using namespace std; int main() { // your code goes here int x; cin >> x; while(x--) { int l, r, num; cin >> l >> r >> num; if(l == r) { cout << (l /num) + l%num << endl; }else if(r < num) { cout << r << endl; } else if(r == num) { cout << r-1 << endl; } else { if((...
C++
681ee82880ddd0de907aac2ccad8fc04
39b469fa150c46d0b738c7f5d41edb34
900
PASSED
#include <iostream> #include<bits/stdc++.h> using namespace std; int main() { int t, x; cin >> t; while (t--) { int n; cin >> n; vector<int> v(n + 1), shifted(n + 1); for (int i = 1; i <= n; ++i) { cin >> x; v[x] = i; } for (int i = n; ...
C++
a83aaaa8984d1a6dda1adf10127b7abc
d9322d51919491010090b4485ab30129
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define sz(s) int(s.size()) #define FIO ios_base::sync_with_stdio(0);cin.tie(0); int main () { FIO int t; cin >> t; while(t--) { int n, x; cin >> n; deque<int> dq; for(int i = 0; i< n; i++) { ...
C++
a83aaaa8984d1a6dda1adf10127b7abc
600f0446477c96ce1c0b18385efb21c5
1,300
PASSED
#include <iostream> #include <bits/stdc++.h> #define fastIO() ios::sync_with_stdio(false),cin.tie(0); using namespace std; int main(){ int t; cin>>t; while (t--){ int n ; cin>>n; deque<int>q(n); for (int i = 0; i < n; ++i) { cin>>q[i]; } vector<int>ans(n+1...
C++
a83aaaa8984d1a6dda1adf10127b7abc
c37541597becc70b6b0e309c5de54f18
1,300
PASSED
#include<iostream> #include<algorithm> #include<vector> #include<deque> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; deque<int>q(n), ans(n + 1); for (int i = 0; i < n; i++) { cin >> q[i]; } for (int i = n; i...
C++
a83aaaa8984d1a6dda1adf10127b7abc
8c2f51b37e159cb620ba34f8e45a410f
1,300
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--){ int n; cin>>n; vector<int> vec(n+1); vector<int> ans(n+1); for(int i=1; i<=n; i++){ int x; cin>>x; vec[x]=i; } for(i...
C++
a83aaaa8984d1a6dda1adf10127b7abc
25100ed64b019c63bfaa72aac1a26406
1,300
PASSED
#include<bits/stdc++.h> using namespace std; void seive(){ const int N=1e5+7; vector<int>prime(N,1); prime[0]=prime[1]=0; for(int i=2;i<N/i;i++){ cout<<prime[i]<<'\n'; if(prime[i]){ for(int j=i*i;j<N;j+=i) prime[j]=0; } } } int main(){ int t;...
C++
a83aaaa8984d1a6dda1adf10127b7abc
7539e86469f3b709c0296ec501fe33dd
1,300
PASSED
#include<bits/stdc++.h> #define GOBA ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; typedef long long ll; const int MOD=1e9+7, OO=0x3f3f3f3f; const ll LOO=0x3f3f3f3f3f3f3f3f; #define all(x) (x).begin(),(x).end() #define mem(f, x) memset(f,x,sizeof(f)) #define f(i,a,n) for(int i=(a);i<=(n);++i) #define f_...
C++
a83aaaa8984d1a6dda1adf10127b7abc
969f3427dfc2bf3f37cca9a87061584f
1,300
PASSED
#include <iostream> #include<vector> #include<deque> using namespace std; int main() { int t; cin>>t; while(t--){ int n; cin>>n; deque<int>q(n); for(int i=0;i<n;i++){ cin>>q[i]; } vector<int>ans(n+1); for(int i=n;i>=1;i--){ ...
C++
a83aaaa8984d1a6dda1adf10127b7abc
a6907acbd0cf0c53e3c64d48deda76c0
1,300
PASSED
// Online C++ compiler to run C++ program online #include <iostream> #include<bits/stdc++.h> #include <queue> #include <stack> #include <set> #include <map> #include <vector> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<int> v(n + 1); ...
C++
a83aaaa8984d1a6dda1adf10127b7abc
b4278e172738e39dd9ef3dfcd978c6ef
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define endl "\n" signed main() { ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); #ifdef Clion freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int t; cin >> t; while (t--) { int n; ...
C++
a83aaaa8984d1a6dda1adf10127b7abc
2a8cdedb3e400a689a18a35c12c61b83
1,300
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; char a[100010]; while(t--){ char b; cin>>a; int len=strlen(a); cin>>b; int i; for(i=0;i<len;i++){ if(a[i]==b&&i%2==0)break; } if(a[i]==b&&i%2==0)cout<<"YES"<<endl; else cout<<"NO"<<endl; } }
C++
c569b47cf80dfa98a7105e246c3c1e01
2f101e45de771fb4ead58ad6fa4b1c03
800
PASSED
#include<bits/stdc++.h> using namespace std; long long a[200010]; int main() { int i,n,t=0,l; string x; char y; cin>>n; for(i=0;i<n;i++) { cin>>x>>y; t=0,l=x.size(); for(int j=0;j<l;j=j+2) if(x[j]==y) { cout<<"YES"<<endl; t=1; break; } if(t==0) cout<<"NO"<<endl; } return 0; } ...
C++
c569b47cf80dfa98a7105e246c3c1e01
a120cb6ec41d8d3faa0112654cf77c1f
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin >>t; string s; char c; while(t--) { cin >> s >> c; bool flag=true; for(int i=0;i<s.length();i++) { if(s[i]==c && i%2==0) { cout<<"YES"<<endl; flag=false; break; } } if(flag==true) cout<<"NO"<<e...
C++
c569b47cf80dfa98a7105e246c3c1e01
b570ade5a1c5922ebc446a7cba6d2537
800
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; while(n--){ string s; char c; cin>>s>>c; int m=0; for(int i=0;i<s.size();i++){ if(s[i]==c){ if(i%2==0 && (s.size()-1-i)%2==0){ m=1; break; } } } if(m==1){ cout<<"YES"<<endl; } else{ cout<<"NO"<<...
C++
c569b47cf80dfa98a7105e246c3c1e01
10f0a7b3311af8ae1d7b4f59609356b5
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t,length,flag; string str; char ch; cin>>t; while(t--){ cin>>str; length = str.size(); flag = 0; cin>>ch; for(int i=0; i<length; i++){ if(str[i]==ch){ int p = i+1; ...
C++
c569b47cf80dfa98a7105e246c3c1e01
ded943d31876c0e102a4ebbf05800f04
800
PASSED
#include <bits/stdc++.h> #define ll long long #define PI 3.14159265358979323846 using namespace std; void Y() { cout << "YES\n"; } void N() { cout << "NO\n"; } void IOS(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cout.tie(NULL);} bool isPrime(ll num){if (num == 1 || num == 0){return fa...
C++
c569b47cf80dfa98a7105e246c3c1e01
98fc9b17116869ae54cb2a29f50b20dd
800
PASSED
//Author:Zealous_YH //Hai Bian & Xiao Bao #include <bits/stdc++.h> #define ET return 0 #define fi first #define se second #define mp make_pair #define pb push_back #define ll long long #define ull unsigned long long #define bk break #define ctn continue #define inf INT_MAX #define uinf INT_MIN #define prq priority_queu...
C++
c569b47cf80dfa98a7105e246c3c1e01
31b7e23d4dcb4f5802b3ca382994280b
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() {int tc;cin>>tc;while(tc--){ string s,t; int flg=1; cin >>s>>t; for (int i=0;i<s.size();i+=2) { if (s.substr(i,t.size())==t&&(s.size()-(i+t.size()))%2==0) { cout<<"YES\n"; flg=0; break; } if(flg==0) break; } if(flg==1) cout...
C++
c569b47cf80dfa98a7105e246c3c1e01
6e54172b024c6a9a6f7fff2c45ae92c1
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int tc,i; cin >> tc; while(tc--) { string str, t; cin >> str >> t; bool y = false; for(i=0; i<str.size(); i++) { if(str[i] == t[0] && i % 2 == 0) { ...
C++
c569b47cf80dfa98a7105e246c3c1e01
df8758eaa4439f1820a5a49f58968b89
800
PASSED
#include<iostream> using namespace std; int main() { int t; cin>>t; while(t--) { string s; char s1; cin>>s; cin>>s1; int j=s.size(),p=0,i; for(i=0;i<j;i++) { if((char(s[i])==s1) && (i%2==0)) { cout << "YES" << endl; p=1; break; } } if(p==0) cout << "NO" << endl; } return...
C++
c569b47cf80dfa98a7105e246c3c1e01
4278e0d6ab9aa356fab7a6dd361b77d8
800
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long int cnt = 0; int func(int pos,vector<int> &a,int d){ vector<int> b; for(int i=0;i<a.size();++i){ if(i==pos) continue; b.push_back(a[i]); } // first we assume that point lies in bw the range not on the boundar...
C++
be27a43c6844575f1d17487e564803bb
1b54a456ed193f1f0510a498d66c641a
1,900
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long int cnt = 0; int func(int pos,vector<int> &a,int d){ vector<int> b; for(int i=0;i<a.size();++i){ if(i==pos) continue; b.push_back(a[i]); } // first we assume that point lies in bw the range not on the boundar...
C++
be27a43c6844575f1d17487e564803bb
dcbf274c8f0da0f6e7ce82c0e19c6a4a
1,900
PASSED
#include<iostream> using namespace std; const int N = 2e5+10; const int MAX = 1e9+10; int num[N]; int main(void){ int T,tt=0; cin>>T; while(T--){ tt++; int n,d,now=0,u=MAX,minw=MAX,maxu=-1,target=-1,minu=MAX,f=0; cin>>n>>d; for(int i=1;i<=n;i++){ int a; cin>>a; // if(tt==50) cout<<a<<...
C++
be27a43c6844575f1d17487e564803bb
957194d2ceb19751c2d8ccddadae4d8e
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 10; int t, n, d, a[MAXN]; int solve(int c) { if (c <= 0) return 0; int mx = 0, ll; for (int i = 1; i <= n; i++) if (mx < a[i] - a[i - 1] - 1) mx = a[i] - a[i - 1] - 1, ll = a[i - 1]; if (mx <...
C++
be27a43c6844575f1d17487e564803bb
e975a356e4ecf1aa04ccafd4074ef10a
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 10; int t, n, d, a[MAXN]; int solve(int c) { if (c <= 0) return 0; int mx = 0, ll; for (int i = 1; i <= n; i++) if (mx < a[i] - a[i - 1] - 1) mx = a[i] - a[i - 1] - 1, ll = a[i - 1]; if (mx <...
C++
be27a43c6844575f1d17487e564803bb
e97d6465d7df1fd2a8d25d023ce2b35c
1,900
PASSED
#include <bits/stdc++.h> using namespace std; const int INF = 2e9; int get_ans(vector<int>& loc, int move_index, int len){ vector<int> gaps; int n = loc.size(), prev = -1, min_gap = 1e9; for(int i = 0; i < n; ++i){ if(i == move_index){ continue; } min_gap = m...
C++
be27a43c6844575f1d17487e564803bb
85a2dfc1c5045477b776c4a1d496cb15
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define mod 1000000007 #define pb push_back #define ss second #define ff first #define all(v) v.begin(), v.end() #define deb(...) __logger(#__VA_ARGS__, __VA_ARGS__) template <typename... Args> void __logger(string vars, Args &&...values) { cerr ...
C++
be27a43c6844575f1d17487e564803bb
14be1253c1da9808f500e4854dc9ee30
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define mod 1000000007 #define pb push_back #define ss second #define ff first #define all(v) v.begin(), v.end() #define deb(...) __logger(#__VA_ARGS__, __VA_ARGS__) template <typename... Args> void __logger(string vars, Args &&...values) { cerr ...
C++
be27a43c6844575f1d17487e564803bb
3cdbcbe6cdfb89ee8c861992fc5744f9
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define mod 1000000007 #define pb push_back #define ss second #define ff first #define all(v) v.begin(), v.end() #define deb(...) __logger(#__VA_ARGS__, __VA_ARGS__) template <typename... Args> void __logger(string vars, Args &&...values) { cerr ...
C++
be27a43c6844575f1d17487e564803bb
1715055789cd051a115787dea3fcfcac
1,900
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define mod 1000000007 #define pb push_back #define ss second #define ff first #define all(v) v.begin(), v.end() #define deb(...) __logger(#__VA_ARGS__, __VA_ARGS__) template <typename... Args> void __logger(string vars, Args &&...values) { cerr ...
C++
be27a43c6844575f1d17487e564803bb
87642fc346cdfc86cd7811a2a407afb8
1,900
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef tuple <int, int, int> i3; #define MAXN 100010 #define INF 99999999999999 ll n, m, c, tam, tarefas[MAXN], dp[MAXN][205]; //(n+m)*t = 2*10^5 //pq passar os par...
C++
e745f777e5676c2629f806e09f83a739
1f5dc467c36e6bb8fba961faa5c68a4c
2,200
PASSED
#include <cstdio> #include <cmath> #include <algorithm> #include <iostream> #include <cstring> #include <map> #include <string> #include <stack> #include <cctype> #include <vector> #include <queue> #include <set> #include <utility> #include <cassert> #include <iomanip> #include <deque> #include <time.h>...
C++
e745f777e5676c2629f806e09f83a739
5453ff4ab22d2c405e439d4db98486e8
2,200
PASSED
#include <cstdio> #include <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <queue> #include <set> #include <map> #include <vector> #include <queue> using namespace std; const long long maxn = 1e5 + 5; const long long inf = 1e12 + 5; long long q, n, m, cnt, f[205]; long long a[...
C++
e745f777e5676c2629f806e09f83a739
7c7da63241d18f43d9ae6c3deb07152e
2,200
PASSED
//Hoang Son WIBU lolicon codeforces rate 1791 khong cay #include <bits/stdc++.h> //#pragma GCC optimize("Ofast") // Make __builtin_popcount faster: https://codeforces.com/blog/entry/13134?#comment-736517 //#pragma GCC target("popcnt") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") ...
C++
e745f777e5676c2629f806e09f83a739
1c9c203fc523413e4074aa26d8557c48
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long void solve() { int n, m; cin >> n >> m; vector<ll> arr(n); for (int i = 0; i < n; ++i) cin >> arr[i]; vector<vector<pair<ll, ll>>> choices(n); vector<vector<int>> indices(n); for (int i = 0; i < m; ++i) { int e, t, p; cin >> e...
C++
e745f777e5676c2629f806e09f83a739
3f4a0bd5ef77a897553b07665238b683
2,200
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long void solve() { int n, m; cin >> n >> m; vector<int> arr(n); for (int i = 0; i < n; ++i) cin >> arr[i]; vector<vector<pair<int, int>>> choices(n); vector<vector<int>> indices(n); for (int i = 0; i < m; ++i) { int e, t, p; cin >> e >> t >...
C++
e745f777e5676c2629f806e09f83a739
4a2fa53c9c3118fe9064e5db76dc95dc
2,200
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; const int MN2=2e5+10; const int MN=101; const int MOD=1e9+7; const int bits=31; using pi = pair<ll, ll>; using ti = tuple<ll, ll, ll>; typedef t...
C++
e745f777e5676c2629f806e09f83a739
2b5e12039d07b879f754a7e87b933c55
2,200
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; const int MN2=2e5+10; const int MN=101; const int MOD=1e9+7; const int bits=31; using pi = pair<ll, ll>; using ti = tuple<ll, ll, ll>; typedef t...
C++
e745f777e5676c2629f806e09f83a739
c4cdbc8e1ebebb489ead1658525847a1
2,200
PASSED
# include <bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define pii pair<ll,ll> #define pb push_back #define iipi pair<pii,ll> /* fi.fi=task ke berapa fi.se=cost se.fi=poin(persentase) yang didapat se.se=index(buat backtracking) */ ll n,m,a[100009],memo[1000...
C++
e745f777e5676c2629f806e09f83a739
7e4ffe422b2885dc124ce9675e10a3ca
2,200
PASSED
#include "stdio.h" #include <cmath> #include <algorithm> #include <vector> #include <iostream> #include <map> #include <string> #include <set> #include <cstring> #include <queue> #include <bitset> using namespace std; #define max(a,b) (((a)>(b))?(a):(b)) #define min(a,b) (((a)<(b))?(a):(b)) #define IN...
C++
e745f777e5676c2629f806e09f83a739
5c9158679160ff3cf4371217f66a303c
2,200
PASSED
#include<bits/stdc++.h> using namespace std; main() { int t; cin>>t; while(t--) { int n,count=0; cin>>n; int s=(n/2)+1; int x=1; if(n%2==1) { while(s<n) { cout<<s<<" "<<x<<" "; ...
C++
0d5f4320fc2c7662d21e09a51baf21db
fde5070d381ff563a54c30764d78dd1f
800
PASSED
#include<bits\stdc++.h> using namespace std; int w,a,b,d,f; main(){ cin>>a; for(int i=0;i<a;i++){ cin>>d; if(d%2==1){ d--; for(int j=0;j<d/2;j++){ cout<<d/2-j<<" "<<d-j<<" "<< endl; } cout<<d+1<<endl; } else{ for(int j=0;j<d/2;j++){ cout<<d/2-j<<" "<<d-j<<" "<<endl; } } } }
C++
0d5f4320fc2c7662d21e09a51baf21db
40f59fc02717211902972925042723a8
800
PASSED
#include<bits/stdc++.h> #define ll long long #define Inf +1e18 #define OO +1e9 #define F first #define line cout<<"______________________"<<endl; #define S second #define deb(help) cout<<#help<<" is: "<<help<<endl; #define pi pair<ll,ll> #define pb push_back #define answer(x) cout << (x ? "YES\n" : "NO\n") ...
C++
0d5f4320fc2c7662d21e09a51baf21db
adedc4a63b7ac2094a39c4adf9ecad63
800
PASSED
#include <bits/stdc++.h> using namespace std; int* solve(int n) { int* arr = new int[n]; int end = n/2; int i=end+1, j=1, p=0; while (i<=n) { arr[p] = i; if (j==end+1) return arr; arr[p+1] = j; i+=1; j+=1; p+=2; } return arr; } ...
C++
0d5f4320fc2c7662d21e09a51baf21db
746ff4a1c7606755b143698cf684f3b6
800
PASSED
// Copyright: Mayank(nerdmyk) #include <bits/stdc++.h> using namespace std; #define int long long #define sqrt(x) sqrtl(x) #define mod 1000000007 void solve() { int n; cin >> n; int j = 1; int i = n / 2 + 1; if (n == 4) { cout << "2 4 1 3" << endl; return; } ...
C++
0d5f4320fc2c7662d21e09a51baf21db
9100f679db03fb83f823735b86fe92ef
800
PASSED
// Problem: B. Kevin and Permutation // Contest: Codeforces - Codeforces Round #829 (Div. 2) // URL: https://codeforces.com/contest/1754/problem/B // Memory Limit: 256 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org) #include <bits/stdc++.h> using namespace std; #define ll long lo...
C++
0d5f4320fc2c7662d21e09a51baf21db
43fa110922f69ae6357024b5a0bfaa1b
800
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int tt; cin >> tt; while (tt--) { int n; cin >> n; for(int i = n/2; i >= 1; --i) { cout << i << ' ' << n/2 + i << ' '; } if(n & 1) { cout << n; } cout <<...
C++
0d5f4320fc2c7662d21e09a51baf21db
3f555bda07b1829d634eaffe531dfde0
800
PASSED
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <vector> using name...
C++
0d5f4320fc2c7662d21e09a51baf21db
dd811c7d4ab8cd968896449af3c8e332
800
PASSED
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <vector> using name...
C++
0d5f4320fc2c7662d21e09a51baf21db
a207f3adf60c8e0db45ec7412249a13e
800
PASSED
// author: glaucoacassioc // created on: October 26, 2022 10:04 PM // Problem: B. Kevin and Permutation // URL: https://codeforces.com/problemset/problem/1754/B // Time Limit: 1000 ms // Memory Limit: 256 MB #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #i...
C++
0d5f4320fc2c7662d21e09a51baf21db
5a13c118239508784becd6fc4845b78f
800
PASSED
#include <iostream> #include<string> using namespace std; int main() { long long int t,n,f=0; cin>>t; string a; while(t!=0) { cin>>n; cin>>a;// for(int i=0;i<n;i++){ if(a[i]=='Q'){ f=f+1; } ...
C++
c5389b39312ce95936eebdd83f510e40
f5a98f7d35513f62813773f8f9191fa2
800
PASSED
#include <iostream> #include<string> using namespace std; int main() { long long int t,n,f=0; cin>>t; string a; while(t!=0) { cin>>n; cin>>a; for(int i=0;i<n;i++){ if(a[i]=='Q'){ f=f+1; } ...
C++
c5389b39312ce95936eebdd83f510e40
2d00eef2d860719f20a772d5973ff57c
800
PASSED