uz
Feedback
Codeforces|Leetcode|Codechef free solutions

Codeforces|Leetcode|Codechef free solutions

Kanalga Telegram’da o‘tish

Free codeforces, Codechef, Leetcode solutions are available 😍😍😍😍😍😍 Helped More than 200+ students to crack coding round in 2022 and helped placed them in Good companies. 🥳🥳🥳🤩🤩🤩 Dm @Cpsoln if you want help in coding round.

Ko'proq ko'rsatish
4 317
Obunachilar
Ma'lumot yo'q24 soatlar
-137 kunlar
-5230 kunlar
Postlar arxiv
Dm @Cpsoln for any coding round

INDIA ARE THROUGH TO THE FINAL OF 2024 T20 WORLD CUP 🏆🇮🇳

Info Edge slots available Dm @Cpsoln

Enjoy guys😊😊😁

#include <iostream> #include<bits/stdc++.h> using namespace std; #define int long long signed main() {     int t;     cin>>t;     while(t--){            int n;      cin>>n;           vector<int> a(n),b(n);           for(auto &val:a) cin>>val;      for(auto &val:b) cin>>val;           int count = 0,P = 0,N = 0;          for(int i = 0;i<n;i++){       if(a[i]==b[i]){         if(a[i]==-1){           N--;         }         else if(a[i]==1){             P++;         }       }     }                   int A = 0,B = 0;             for(auto i = 0;i<n;i++){                 if(a[i]==b[i]) continue;                 if(a[i]>b[i]){           A+=a[i];         }         else{           B+=b[i];         }               }                   if(A>B) swap(A,B);             count = P;         int x = min(B-A,count);         A+=x;         count-=x;         x = count/2;         count = count - x;         A+=max(x,count);         B+=min(x,count);       if(A>B) swap(A,B);       count = N;         x = max(A-B,count);         B+=x;         count-=x;         x = count/2;         count = count - x;         A+=max(x,count);         B+=min(x,count);                         cout<<min(A,B)<<endl;           }            return 0; } @contestsolution

So share channel with your friends

Will upload codeforces c on 5175+ subscribers😊

DE SHAW slots available Dm @Cpsoln

Lowes slots available Dm @Cpsoln

Dm @Cpsoln for any coding rounds.

Any desk slots available Dm @Cpsoln

Junglee games slots available Dm @Cpsoln

If you need help in any coding rounds then Dm @Cpsoln

Break the string😁😁☺

#include <iostream> #include <vector> #include <string> using namespace std; const long long PRIME = 53; const long long MOD = 1e9 + 7; void solve() {     string s;     cin >> s;     long long n = s.size();     vector<long long> pow(n);     vector<long long> dp(n + 1);     pow[0] = 1;     for (long long i = 1; i < n; i++) {         pow[i] = (pow[i - 1] * PRIME) % MOD;     }     dp[0] = 0;     for (long long i = 0; i < n; i++) {         dp[i + 1] = (dp[i] + (s[i] - 'a' + 1) * pow[i]) % MOD;     }     auto calc = [&](int l, int r) -> long long {         long long hash_value = (dp[r] - dp[l] + MOD) % MOD;         hash_value = (hash_value * pow[n - 1 - l]) % MOD;         return hash_value;     };     long long count = 0;     for (long long i = 0; i < n; i++) {         long long remaining_length = n - 2 * i;         if (remaining_length % 2 == 1) continue;         if (calc(0, i) == calc(i, 2 * i)) {             long long half_remaining_length = remaining_length / 2;             if (calc(2 * i, 2 * i + half_remaining_length) == calc(2 * i + half_remaining_length, n)) {                 count++;             }         }     }     cout << count << endl; } int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;         while(t--) solve();     return 0; }

Wait guys I will upload in 2 mins

Break the string Enjoy guys🥳🥳😁😁

#include <iostream> #include <vector> #include <string> using namespace std; const long long PRIME = 53; const long long MOD = 1e9 + 7; void solve() {     string s;     cin >> s;     long long n = s.size();     vector<long long> pow(n);     vector<long long> dp(n + 1);     pow[0] = 1;     for (long long i = 1; i < n; i++) {         pow[i] = (pow[i - 1] * PRIME) % MOD;     }     dp[0] = 0;     for (long long i = 0; i < n; i++) {         dp[i + 1] = (dp[i] + (s[i] - 'a' + 1) * pow[i]) % MOD;     }     auto calc = [&](int l, int r) -> long long {         long long hash_value = (dp[r] - dp[l] + MOD) % MOD;         hash_value = (hash_value * pow[n - 1 - l]) % MOD;         return hash_value;     };     long long count = 0;     for (long long i = 0; i < n; i++) {         long long remaining_length = n - 2 * i;         if (remaining_length % 2 == 1) continue;         if (calc(0, i) == calc(i, 2 * i)) {             long long half_remaining_length = remaining_length / 2;             if (calc(2 * i, 2 * i + half_remaining_length) == calc(2 * i + half_remaining_length, n)) {                 count++;             }         }     }     cout << count << endl; } int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;         while(t--) solve();     return 0; }

After 5115+ subscribe we will upload break the string 🥳🥳