uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
37620cba-7868-4906-8c36-44e546a464d2 | Mansi1713/Problem-Solving | LBAssignment45-1.cpp | #include<iostream>
using namespace std;
template <class T>
void Display(T value,int isize)
{
int i=0;
for ( i = 0; i < isize; i++)
{
cout<<value<<" ";
}
}
int main()
{
Display('M',7);
Display(11,3);
Display(3.7,6);
} | TOOL | 0.899152 | 4.278562 |
8623b38f-62f4-427c-b90b-bca13f8da50a | andrejjakovljevic/llvm-project-morello | clang-tools-extra/clangd/index/dex/Iterator.cpp | #include "Iterator.h"
#include "llvm/Support/Casting.h"
#include <algorithm>
#include <cassert>
#include <numeric>
namespace clang {
namespace clangd {
namespace dex {
namespace {
/// Implements Iterator over the intersection of other iterators.
///
/// AndIterator iterates through common items among all children. It... | TOOL | 0.984881 | 7.349944 |
683862fe-084d-4d4c-a335-14b577e0ee1e | vincbct34/Tek2-EPITECH | Mathematics/stoneanalysis/src/StoneAnalyser.cpp | /*
** EPITECH PROJECT, 2025
** StoneAnalysis [WSL: Ubuntu-24.04]
** File description:
** StoneAnalyser
*/
#include "StoneAnalyser.hpp"
StoneAnalyzer::StoneAnalyzer(const WavFile &wav, double sampleRate)
: wavFile(wav), sampleRate(sampleRate) {}
void StoneAnalyzer::analyze(int topN) const {
const auto &samples ... | TOOL | 0.871368 | 6.199031 |
aac7d020-069d-40bc-bdb6-7b121fa696f4 | susantabiswas/Software-Interview-Essentials | Leetcode/Dynamic Programming/best-time-to-buy-and-sell-stock-with-cooldown.cpp | /*
https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/
There are 3 states, each state actually also tells about the profit for that state:
(Cooldown)-----buy------->(Bought)
^ |
| sell
--------cooldo... | ALGO | 0.999958 | 6.257999 |
ed68c8ba-4ca3-4e20-96eb-ae1c6b8156fc | Manjunath-Jakaraddi/Competitive-Coding | hackerrank/usables/DP/0-1knap.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,wt;
cin>>n>>wt;
int val[n+1],w[n+1];
int knap[n+1][wt+1]={{0}};
for(int i=0;i<n;i++) cin>>w[i];
for(int i=0;i<n;i++) cin>>val[i];
for(int i=0;i<=n;i++)
for(int j=0;j<=wt;j++)
knap[i][j]=0;
for(int i=1;i<=n;i++)
{
for(int j... | ALGO | 0.99999 | 3.271153 |
e37abd25-5852-43a3-b137-27c829f7b91f | NestZ/competitive-programming | AtCoder/Sentou.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll n, t;cin >> n >> t;
ll start = 0;
ll cur_e = 0;
ll ans = 0;
for(int i = 0;i < n;i++){
ll num;cin >> num;
if(num > cur_e){
ans += cur_e - start;
start = num;
cur_e = num +... | ALGO | 0.999954 | 3.481812 |
3077dfa4-4e43-4c7d-8061-6fbed02dba04 | sidrasa/DSA-CP | Movie_Festival.cpp | #include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
int main() {
int a[]={1,3,5,7,8};
int n=5;
int x=7;
bool ok=0;
int low=0,high=n-1;
while(low<=high){
int mid=(low+high)/2;
if(a[mid]==x){
ok=1;
break;
... | ALGO | 0.999796 | 3.421534 |
d39fa74f-2bbb-4189-a19b-b61f141dda88 | nitronium102/Algorithm | 투포인터/PGS_연속된 부분 수열의 합.cpp | // LV2
// Created by KangMinji on 2023-04-29.
// https://school.programmers.co.kr/learn/courses/30/lessons/178870
#include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<int> sequence, int k) {
vector<int> answer;
int start = 0, end = 0, len = 1e6 +1;
int sum = sequence[0];
pair<int,... | ALGO | 0.999945 | 5.87851 |
851a0a27-e18f-4931-b88a-e2b6508b109d | ArvidKristoffersson/Programmeringslosningar | Programmeringsolympiaden/onlinekval23/Kattriket.cpp | #include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;
const int MAXN = 1e5+2;
vector<int> children[MAXN];
int parent[MAXN];
int value[MAXN];
vector<int> adj[MAXN... | ALGO | 0.999985 | 4.362892 |
3554c1e4-68a5-4169-a8b5-413841c94fdc | ChuangShen0819/HLS- | LAB2/src/hls_FIRN11Stream/FIRTester.cpp | #include <iostream>
#include "fir.h"
using namespace std;
#define NUM_SAMPLES 600
int main(int argc, char *argv[])
{
FILE *fp;
int32_t signal;
int32_t input[NUM_SAMPLES], output[NUM_SAMPLES];
stream_t strmInput, strmOutput;
int32_t taps[N] = {0,-10,-9,23,56,63,56,23,-9,-10,0};
value_t valDataCtrl;
... | TEST | 0.962969 | 5.345346 |
fcde49d3-80d7-4281-8abd-310c5c6c4457 | ericliuu/flux | FLUX/libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp | // UNSUPPORTED: c++03, c++11
// <set>
// class multiset
// template<typename K>
// size_type count(const K& x) const; // C++14
#include <cassert>
#include <set>
#include <utility>
struct Comp {
using is_transparent = void;
bool operator()(const std::pair<int, int> &lhs,
const std:... | TEST | 0.984419 | 5.601079 |
e4413d67-479c-4b82-b3db-e06cbfc18b87 | VatsBhatt11/LeetCode-DCC | Feb 2023/8th Feb.cpp |
class Solution {
public:
int jump(vector<int>& nums) {
for(int i = 1; i < nums.size(); i++)
{
nums[i] = max(nums[i] + i, nums[i-1]);
}
int ind = 0;
int ans = 0;
while(ind < nums.size() - 1)
{
ans++;
ind = nums[ind];
}
return ans;
... | ALGO | 0.999988 | 5.966568 |
5968879d-7f06-4708-87ab-13808101ae56 | adrian-budau/work | Usaco/2015/11-14 December/Silver/3 - Breed Counting/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main() {
ifstream cin("bcount.in");
ofstream cout("bcount.out");
int N, Q; cin >> N >> Q;
vector< vector<int> > count(3, vector<int>(N, 0));
for (int i = 0; i < N; ++i) {
int x; cin >> x;
count[x - ... | ALGO | 0.999091 | 3.737479 |
64edd847-ef5f-4cd2-a5b8-765a281c5e55 | Xubaidu/thesis | src/network/crypt.cpp | #pragma once
#include <cstdlib>
#include <random>
#include <vector>
#include "../common/utils.cpp"
using std::string;
namespace CRYPT {
const std::vector<int> base = {2, 325, 9375, 28178, 450775, 9780504, 1795265022};
int qpow(int a, int b, int mod) {
int ans = 1;
while (b) {
if (b & 1) ans = 1LL * an... | ALGO | 0.99663 | 4.034907 |
7a8a3796-048d-4a53-bc82-b3a7c375f8db | PriyanshK09/Leetcode-Discord-Bot | solutions/break-a-palindrome.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
string breakPalindrome(string palindrome) {
for (int i = 0; i < palindrome.length() / 2; ++i) {
if (palindrome[i] != 'a') {
palindrome[i] = 'a';
return palindrome;
}
}
if (palindro... | ALGO | 0.998921 | 4.445345 |
c75d6efe-1134-4c0e-bdef-a32d89c54750 | avi-rn/prediction_service | venv/Lib/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.9982 | 7.198757 |
aa8420c6-3c86-49e5-8ff5-7277d5b35620 | adityaverma0864/Mission-DSA | leetcode/236-LowestCommonAncestorofaBinaryTree.cpp | class Solution {
public:
TreeNode* help(TreeNode* root, TreeNode* p, TreeNode* q){
if(root == NULL) return NULL;
if(root ==p || root == q) return root;
TreeNode* lef = lowestCommonAncestor(root->left,p,q);
TreeNode* rig = lowestCommonAncestor(root->right,p,q);
... | ALGO | 0.999959 | 6.334949 |
a960ba2c-57fa-41d5-9b03-a2e8c6ae14bf | 66kesara99/Hackerrank-Random | Contests/Hackers Interactive Coding Sessions/MarsColonyV2.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n, k;
cin >> n >> k;
int m = 1000000007;
vector <long long int> pre;
vector <long long int> now;
for (int j = 1; j<=n; j++){
now.push_back(1);
for (int i = 1; i<j && i<=k; i++){
now.push_back((pre[i-1]+pre[i])%m);
}
now.pus... | ALGO | 0.999996 | 4.135057 |
9627b5f0-ec5b-42c4-acb4-a91e9d7cb6eb | saladwithgrass/Hologram_plot | HologramGraph/segmentfunction.cpp | #include "segmentfunction.h"
SegmentFunction::SegmentFunction(const double& t0_p, const double& t1_p,
const double& v0_p, const double& v1_p,
const double& x0_p) {
t0 = t0_p;
t1 = t1_p;
v0 = v0_p;
v1 = v1_p;
x0 = x0_p;
a = (v1 - ... | ALGO | 0.986569 | 5.846468 |
92e986a7-3c6b-4fe8-86a2-702909dc90c1 | Ansaine/programming | Codeforces/817 Div 4/d.cpp | typedef long long ll;
#define mod 1e9+7
#define pb push_back
#define fo(i,n) for(int i = 0; i<n; i++)
#define fok(i,k,n) for(int i = k; i<n; i++)
#define umii unordered_map<int,int>
#define mii map<int,int>
#define vi vector<int>
// #define int long long
#include<bits/stdc++.h>
using namespace std;
ll count(string... | ALGO | 0.999898 | 3.788875 |
dcd28af7-ee6f-4498-9f71-ae6c5e1e9058 | louis-bompart/8IAR125-01 | lib/boost_1_61_0/libs/compute/perf/perf_rotate_copy.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/rotate_copy.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
i... | ALGO | 0.985709 | 5.495827 |
eaaba47d-fc6b-4700-8781-a6e7c8f2f070 | creatorIND/cpp | DataStructures/SimpleGraph.cpp | #include <iostream>
#include <vector>
class SimpleGraph
{
private:
int numVertices;
std::vector<std::vector<int>> adjList;
public:
SimpleGraph(int n) : numVertices(n)
{
adjList.resize(numVertices);
}
void addEdge(int u, int v)
{
adjList.at(u).push_back(v);
adjList.... | ALGO | 0.998401 | 5.898032 |
208dd305-a0f7-4e96-9439-e4fb5667d54c | the-xlk/QT-OpenCV | opencv-4.5.4/modules/video/src/tracking/detail/tracker_sampler.cpp | #include "../../precomp.hpp"
#include "opencv2/video/detail/tracking.detail.hpp"
namespace cv {
namespace detail {
inline namespace tracking {
TrackerSampler::TrackerSampler()
{
blockAddTrackerSampler = false;
}
TrackerSampler::~TrackerSampler()
{
// nothing
}
void TrackerSampler::sampling(const Mat& image... | TOOL | 0.88088 | 6.088943 |
43dda576-af8a-4df6-8ab4-d42df0d3c611 | durgeshkk/Codeforces-Contests | Practice/1500/C_Representative_Edges.cpp | #include<bits/stdc++.h>
#include<iomanip>
#include <deque>
#include <bitset>
#include <cstdint>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_updat... | ALGO | 0.99989 | 4.320034 |
97764b74-323b-4e94-b228-8ac0380bf0b8 | Ronalmano/kuddle_project | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
e310758b-4a63-49f8-9cd2-01ffc7f336c9 | ishandutta2007/codeforces | ljc1301/normal/1208/F.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn=1000005;
const int maxloga=21;
const int maxa=1<<maxloga;
int n,f[maxa|1],g[maxa|1],a[maxn];
int main()
{
int i,ans=0,j,k;
scanf("%d",&n);
for(i=0;i<maxa;i++) f[i]=g[i]=-1;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
g[a[i]]=f[a[... | ALGO | 0.999971 | 4.149435 |
a75e9958-0bb4-49fc-af3f-32ccf404d7af | colinhli/MachineLearning_scratch | third_party/eigen-323c052e1731/bench/vdw_new.cpp | #include <iostream>
#include <Eigen/Core>
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &inter... | ALGO | 0.999718 | 3.509 |
699c178b-3c1a-49a4-8479-11482de1baf8 | ishandutta2007/codeforces | jiaqiyang/normal/781/A.cpp | #include <cstdio>
#include <vector>
const int N = 200000 + 10;
int n, m;
std::vector<int> adj[N];
int col[N];
void dfs(int a, int fa = 0) {
static int tag[N], tot;
tag[col[a]] = tag[col[fa]] = ++tot;
int c = 1;
for (auto b : adj[a]) {
if (b == fa) continue;
while (tag[c] == tot) ++c;
tag[col[b] ... | ALGO | 0.999951 | 4.627456 |
15bf3e42-5c36-4d01-850d-650a070ae9e6 | Pis5ciclo/Pis_movil | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
6e3301ad-ffcc-4d3a-adee-69f68cf2e9af | knst/Competitive-programming | codeforces/288/b.cpp | /*****************************************************************************
* codeforces: knst
* topcoder: knstqq
* projecteuler: knstqq
* **************************************************************************/
#include <algorithm>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#i... | ALGO | 0.99997 | 3.810552 |
b7c272a3-a60e-4387-b31e-a5454673b5d1 | AseemSrivastava/Leet-Code-30-Days-Challenge | 13_contiguousarray.cpp | int findMaxLength(vector<int>& a) {
unordered_map<int,int>m;
m[0]=-1;
int maxlen=0,count=0;
for (int i=0;i<a.size();++i) {
count+=a[i]==1 ? 1 : -1;
if(m.find(count)!=m.end())maxlen=max(maxlen,i-m[count]);
else m[count]=i;
}
return maxlen;
} | ALGO | 0.999927 | 4.896531 |
5b050a2d-1716-40fd-9cf7-c1686f93a697 | kaijia2022/CSE167_RayTracer | Project1/enc_temp_folder/5c9c7e2c33428a09bf812295b4d1fa9/RayTracer.cpp | #include "RayTracer.h"
#include <iostream>
RayTracer::RayTracer() {
bvh = new BVH();
int i, j;
int rootIdx = bvh->bvhNode[0].firstTri;
int leftChild = bvh->bvhNode[1].firstTri;
int rightChild = bvh->bvhNode[2].firstTri;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
t = infty;
Vec3 raydir ... | ALGO | 0.985877 | 4.181854 |
34053257-f291-465e-a4ce-77174f37514c | Eeman1113/Leetcode | Problems/2867.cpp | class Solution {
public:
int minOperations(vector<int>& nums) {
int ans = 0;
unordered_map<int, int> count;
for (const int num : nums)
++count[num];
for (const auto& [_, freq] : count) {
// If freq == 3k, need k operations.
// If freq == 3k + 1 = 3*(k - 1) + 2*2, need k + 1 operat... | ALGO | 0.998356 | 6.222476 |
bfe0d76a-2a49-4ef8-a1c4-bb178eba0326 | behitek/acm-epu | SPOJ/cpp/spoj/classical/BRCKTS.cpp | #include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
struct node {
int o, c, t;
} tr[1 << 18];
char s[1 << 16];
void modify(int i, int l, int r, int p, char b) {
if (l == r) {
t... | ALGO | 0.999697 | 3.688407 |
b841fb5b-e84a-45c4-a41e-0e4f62038ef1 | sangvirgo/algorithm | codeforce/oldd/6.7.2024/3.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX 100
/*
số palindrome là số mà đọc ngược hay đọc xuôi đều giống nhau, ví dụ: 12321,2442,10201,.... Nhưng Số 123123, 1000, 554,... không phải là số palindrome
Input
Dòng đầu tiên chứa số test T (1<=T<=10) T dòng tiếp theo, chứa số nguyên N (1<=N<=10^5)
Output
Vớ... | ALGO | 0.998715 | 5.039883 |
7db5b421-1fe2-408d-b2ca-d6f437d08ed6 | Hypervariate/Orchid | Orchid/ThirdParty/Boost/libs/flyweight/example/html.cpp | #include <boost/flyweight.hpp>
#include <boost/functional/hash.hpp>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <iterator>
#include <sstream>
#include <string>
#include <vector>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{using ::exit;using ::tolower;... | TOOL | 0.886852 | 6.233359 |
013c3f4d-29bf-4886-9dfe-e231bdf7dae8 | RidmaPalansuriya/EnergyEffix | Arduino_ESP32_OTA/src/decompress/lzss.cpp | /* Original code: https://oku.edu.mie-u.ac.jp/~okumura/compression/lzss.c */
/**************************************************************************************
INCLUDE
**************************************************************************************/
#include "lzss.h"
/*********************************... | TOOL | 0.977487 | 5.909296 |
4266853a-d8c3-44fe-9540-078738d5979c | curtischung/UNR-CS | CS-302/Homework 8/main.cpp | //Homework 8, Extra Credit Project
#include <iostream>
#include <vector>
#include <climits>
#define V 6
typedef std::vector<int> iVec;
typedef std::vector<iVec> Graph;
typedef std::vector<bool> bVec;
// A utility function to find the vertex with
// minimum key value, from the set of vertices
// not yet included i... | ALGO | 0.999683 | 4.195089 |
70120b9b-aa2a-4008-8134-37fced11069d | akshatshah21/Data-Structures-and-Algorithms | C++/Disjoint Set (Union Find)/UF_Product_of_Sizes.cpp | /* Question link(HackerEarth): https://www.hackerearth.com/practice/data-structures/disjoint-data-strutures/basics-of-disjoint-data-structures/practice-problems/algorithm/teachers-dilemma-3/ */
#include<bits/stdc++.h>
using namespace std;
#define fastio(); ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
... | ALGO | 0.999989 | 4.610389 |
5567152b-a198-4777-9fef-60ea4dab2a84 | Ayushkr7380/C-plus-plus-Practice | DSA/Array/secondLargest.cpp | #include<iostream>
#include <climits>
using namespace std;
int secondLargest(int arr[],int size){
int FirstLargest = INT_MIN;
int SecondLargest = INT_MIN;
for(int i=0;i<size;i++){
if(arr[i] > FirstLargest){
SecondLargest = FirstLargest;
FirstLargest = arr[i];
}
... | ALGO | 0.999916 | 4.115785 |
24825bc9-0db2-443f-9c55-0d371c873bf7 | JuyiZhang/ORB_SLAM_ARM | Thirdparty/boost_1_87_0/libs/compute/perf/perf_comparison_sort.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <boost/program_options.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/sort.hpp>
#include <boost/compute/algorithm/is_sorted.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
namespace po = boost::pro... | ALGO | 0.991929 | 5.952507 |
86dfc250-e681-4f4d-8bf9-9232866a09ab | aphrim/codeforces-workspace | completed/usaco/bronze/sleepy-cow-herding.cpp | #include <bits/stdc++.h>
#define int long long int
#define USACO
using namespace std;
template<typename T> istream& operator>>(istream& in, vector<T>& a) {for(auto &x : a) in >> x; return in;};
template<typename T> ostream& operator<<(ostream& out, vector<T>& a) {for(auto &x : a) out << x << ' '; return out;};
templ... | ALGO | 0.999834 | 4.198784 |
94553ed7-02fe-4341-b02f-0f5545cda6a6 | jupo91/OpenSees | SRC/element/forceBeamColumn/ForceBeamColumnCBDI3d.cpp | // $Revision$
// $Date$
// $Source$
/*
* References
*
State Determination Algorithm
---
Neuenhofer, A. and F. C. Filippou (1997). "Evaluation of Nonlinear Frame Finite
Element Models." Journal of Structural Engineering, 123(7):958-966.
Spacone, E., V. Ciampi, and F. C. Filippou (1996). "Mixed Formulation of
Nonlin... | TOOL | 0.971693 | 5.206945 |
8dd7e1db-caec-48f8-a6b7-bf5ed878ab73 | tiykuma/compe-program | DT truong/090124/CNDK.CPP | #include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n, a[1000000];
int main() {
freopen("CNDK.inp", "r", stdin);
freopen("CNDK.out", "w", stdout);
cin >> n;
for (ll i = 0; i < n; i++) {cin >> a[i];}
for (ll i = (n-1)/2; i >1; i--) {
if ((n-1)%i==0) {
bool f=true... | ALGO | 0.99985 | 3.976233 |
182c965f-cacd-45f3-97ae-a5823ccadc1b | akashpatilx7/GeeksForGeeks | Arrays/Sort an array of 0s, 1s and 2s.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
void sort012(int a[], int n)
{
int low=0;
int mid=0;
int high=n-1;
while(mid<=high){
if(a[mid]==0){
swap(a[low++],a[mid++])... | ALGO | 0.999799 | 6.314842 |
19c347ea-ac3d-4480-9b59-5a213e0dc9ae | Anshu1Gupta/CP_-_DSA | B_BAN_BAN.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int x=3*n;
int i=1;
int j=x;
int count=0;
vector<pair<int,int>>ans;
while(i<j){
ans.push_back({i,j});
... | ALGO | 0.999495 | 3.645363 |
02f58fef-ca2c-4162-9b99-cc4e397ab280 | NishchayBhokare/DSA_Code_Files | 16 Searching& Sorting/Concepts/Sorting/MergeSort.cpp | #include<iostream>
using namespace std;
//Best,worst,average TC - O(n logn)
//Stable, Adaptive(after optimization), it is recursive algo.
//It is not in place algo.
void mergeBothArrays(int *arr2,int start,int mid, int end){
int len1 = (mid-start+1); //calculating length of first array
int len2 = (end-mid); /... | ALGO | 0.999987 | 5.149657 |
b1a0dd71-59b7-4d13-b518-5afbb41d85dc | eden-submodules/dynarmic | externals/catch/src/catch2/reporters/catch_reporter_console.cpp | #include <catch2/interfaces/catch_interfaces_config.hpp>
#include <catch2/catch_test_spec.hpp>
#include <catch2/internal/catch_console_colour.hpp>
#include <catch2/internal/catch_string_manip.hpp>
#include <catch2/catch_version.hpp>
#include <catch2/internal/catch_textflow.hpp>
#include <catch2/internal/catch_reusable_... | TEST | 0.880472 | 7.47788 |
0a857e97-50a4-4c3f-a25f-ead52dac18e3 | houhongyi/opencv-3.2.0 | 3rdparty/carotene/src/template_matching.cpp | #include "common.hpp"
#include <vector>
#include <cstring>
namespace CAROTENE_NS {
#define ENABLE4LINESMATCHING false //Disabled since overall time for simultaneous 4 lines matching is greater than
//time for simultaneous 2 lines matching for the same amount of data
bool isMatch... | ALGO | 0.992523 | 5.252957 |
600e9a1f-97e6-4603-b411-41fac94f0f46 | programmingduo/ACMsteps | 课件/Code/3475.cpp | /*
ļ㼸ϰ
*/
#include <iostream>
using namespace std;
#define maxn 505
struct Point
{
int x,y;
}p[maxn];
int n;
int dis(Point a,Point b)
{
return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
int main()
{
int i,j,dmax;
int ans1,ans2,len;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;i++)
{
scanf("%d%d",&p[i].x,&p[... | ALGO | 0.999904 | 3.53031 |
c79bf193-3876-4b9c-bfe3-c5ea6e28c9ac | Aliln/practice_code_C | test_4_25/test_4_25/test4.cpp | #include <stdio.h>
int count9(int n) {
int count = 0;
while (n > 0) {
if (n % 10 == 9) {
count++;
}
n /= 10;
}
return count;
}
int main() {
int count = 0;
// λ9Ĵ
count += count9(100);
// ʮλ9Ĵ
for (int i = 1; i <= 10; i++) {
count += c... | ALGO | 0.998318 | 5.579106 |
7d41f27b-6776-46b6-bace-e5fb11989764 | manikanta2901/ubuntu | .history/SRM/elab/DataStructures/LinkedList/LL6_20200930121256.cpp | // deleted the nodes
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
struct node{
int data;
struct node* next;
};
void printList(struct node *a){
cout << "List : ";
while(a != NULL){
cout << a->data << " ";
a = a->next;
}
cout << endl;
}
int main(){
int siz... | ALGO | 0.999586 | 3.901738 |
fa434b39-7e24-457f-9b70-9e525cbf8047 | koba-e964/contest | codeforces/edu30/d.cpp | #include <cassert>
#include <iostream>
#include <vector>
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
using namespace std;
typedef vector<int> VI;
int gen = 0;
void rec(VI &ans, int l, int r, int k) {
assert (k % 2 == 1);
assert (k >= 1);
assert (k <= 2 * (r - l) - 1);
if (k == 1) {
REP(i, l, r... | ALGO | 0.999743 | 3.745484 |
1fb07d3d-0b17-4691-9a30-20eabdcfbb32 | esadmazi/MeshGraph | MeshGraph.cpp | #include "MeshGraph.h"
#include "BinaryHeap.h"
// For printing
#include <fstream>
#include <iostream>
#include <sstream>
MeshGraph::MeshGraph(const std::vector<Double3>& vertexPositions,
const std::vector<IdPair>& edges)
{
int v1size = vertexPositions.size();
edgeCount = edges.size();
... | ALGO | 0.996219 | 6.807799 |
94b377ec-1f20-4433-98af-586d1b26223f | ji-junhyuk/algo | Boj/14500.cpp | #include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <algorithm>
#include <string.h>
#include <list>
using namespace std;
// -------
//
//bfs로 확인할 수 없는 도형
// ***
// *
//
// *
//**
// *
//
// *
//***
//
//*
//**
//*
int map[500][500];
int dy[] = {-1, 1, 0, 0};
int dx[] ... | ALGO | 0.999921 | 4.688503 |
835f5215-1144-4260-8d34-5366969b5eab | Ad1tyaV/ProblemSolving-2024 | blind-75/sort-and-search/next-greatest-element.cpp | #include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
using namespace std;
vector<int> getRandomVector(int n, int maxElement) {
vector<int> tmp;
for(int index=0; index<n; index++) {
tmp.push_back(rand()%maxElement);
}
return tmp;
}
void print(vector<int> tmp) {
... | ALGO | 0.999638 | 4.8457 |
a13c9600-5135-49d1-82a3-d433f2570588 | black-shadows/LeetCode-Topicwise-Solutions | C++/largest-subarray-length-k.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
vector<int> largestSubarray(vector<int>& nums, int k) {
int left = 0, right = 1, l = 0;
while (right + k - 1 < size(nums) && right + l < size(nums)) {
if (nums[left + l] == nums[right + l]) {
++l;
con... | ALGO | 0.999887 | 6.233039 |
3fa1b26b-5251-4bf3-b798-d3c6e1bfc164 | jemin0619/PS | NYPC 대비하기/NYPC 2022/Round 2A/B 리본.cpp | //최소 골 4급 DP
//풀이 참고: https://blog.myungwoo.kr/144
//dp[i][j]: 리본 i와 리본 j를 묶었을 때, 얻을 수 있는 최대 점수 (i<j)
//H[i][j]: 리본 i와 리본 j를 묶었을 때의 리본 세로 길이
//세로길이는 2로 나누지 않음. (괜히 0.몇 나오면 애매해짐)
//H[i][j]>=0 인 경우만 묶기 가능
//dp[i][j]가 -1인 경우는 묶으면 안되는 경우임
#include <bits/stdc++.h>
using namespace std;
#define fastio cin.tie(NULL)->sync_... | ALGO | 0.999766 | 4.039956 |
9c6e2a11-361b-49c0-9406-0e30fdfac135 | EliahKagan/old-practice-snapshot | main/binary-tree-inorder-traversal/binary-tree-inorder-traversal-iter.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<int> inorderTraversal(const TreeNode* root);
};
vector<int> Solution::inorderTraversal(... | ALGO | 0.999996 | 6.951958 |
5bcc5b75-1600-4bee-9c96-251fcac1a62b | nojhan/paradiseo | mo/test/t-moTSexplorer.cpp | #include <memory/moSolVectorTabuList.h>
#include <memory/moDummyIntensification.h>
#include <memory/moDummyDiversification.h>
#include <memory/moBestImprAspiration.h>
#include <explorer/moTSexplorer.h>
#include "moTestClass.h"
#include <iostream>
#include <cstdlib>
#include <cassert>
int main() {
std::cout << "[... | ALGO | 0.979395 | 5.000195 |
45e39df5-512d-4822-8f64-da04e8888065 | mayanksinha963/DSA | input/practice/two_stack.cpp | #include<iostream>
using namespace std;
class stack {
public :
int* arr;
int top1;
int top2;
int size;
stack (int size)
{
this->size = size;
arr = new int [size];
top1 = -1;
top2 = size;
}
void push1 (int element)
{
if (top2 <= top1+1)
... | ALGO | 0.99896 | 4.359512 |
92278bd7-922e-44bf-b2ac-8c96b0098e6a | Uma-Mahesh118/CrackYourPlacement | DSA Practice/Trees/LeetCode 230 - kth smallest element.cpp | class Solution {
public:
void inorder(TreeNode *root, int &k, int &ans) {
if(root == NULL || k<0) return;
inorder(root->left, k, ans);
k--;
if(k==0) {
ans = root->val;
return;
}
inorder(root->right, k, ans);
}
int kthSmallest(TreeNode* ... | ALGO | 0.999998 | 5.986961 |
15a7cef6-6c0f-44d6-9c90-5fa734fed22b | cuong2905say/codeforces | codeforces/1734A.cpp | /*
author : cuong2905say
created : 23-09-2022 19:11:38 UTC: +7
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int A[301];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 0; // test case ;
cin >> t;
... | ALGO | 0.999792 | 5.007614 |
c8cbdbdf-0e6c-4281-a59d-9c5826b7fc44 | MohitR1999/cpp-store | Sorting/countingSort.cpp | //Counting sort
//Ideal for situations where range of elements is not significantly greater than the number of elements in the vector/array
//Time Complexity : n+k, where n is the number of elements and k is the range of inputs
//Space Complexity: n+k
#include "iostream"
#include "vector"
using namespace std;
void co... | ALGO | 0.999987 | 5.733487 |
8fa3c011-d150-4518-9c17-1b0a587d1fa8 | yuvanganesan/my_shop | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998762 | 6.786404 |
6e58bdc0-9582-49ea-836b-02d7af852782 | Djokovic0311/LeetCode | problems/swap_adjacent_in_lr_string/solution.cpp | class Solution {
public:
bool twoPointerSol(string start, string end) {
// both the strings have be of same size
if(start.size() != end.size())
return false;
int n = start.size();
int i = 0, j = 0;
while(i < n && j < n) {
// Get past ... | ALGO | 0.999829 | 5.530811 |
f985ef3b-55ee-4d74-bda3-fcb993f08d98 | TrellixVulnTeam/gem5_indirect_E9WH | src/systemc/tests/systemc/misc/user_guide/chpt3.1/fsmr.cpp | /*****************************************************************************
fsmr.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | ALGO | 0.998598 | 4.888353 |
b1c84d14-99a8-444e-98f5-d8672529c4cb | clashroyaleisgood/Courses | 進階程式設計/HW3 - STL function usage/G - Jolly Jumpers.cpp | #include <iostream>
#include <algorithm>
#include <numeric>
#include <sstream>
using namespace std;
int main()
{
int n;
stringstream oss;
while(cin >> n)
{
/*
if(n == 0) {
break;
}*/
int jolly[n] = {}, result[n] = {};
for(int i=0; i<n; ++i){
cin >... | ALGO | 0.999078 | 3.987073 |
ce3a1cf0-92e1-4f3f-8e8d-20f047fd1d01 | thishaaarsh/Leetcode-Solutions | 1615-maximal-network-rank/1615-maximal-network-rank.cpp | class Solution {
public:
int maximalNetworkRank(int n, vector<vector<int>>& roads) {
vector<int> degree(n, 0);
set<pair<int, int>> road_set;
for (auto& road : roads) {
degree[road[0]]++;
degree[road[1]]++;
road_set.insert({road[0], road[1]});
... | ALGO | 0.999926 | 6.191969 |
53e60b3c-84ac-42cd-a9b5-42e83c835ee0 | kb787/Codulate | server/cppCodes/ecb091db-ba5d-4cbc-849a-29dc3043ad84.CPP | #include<iostream>
using namespace std;
int main() {
int first_number, second_number, sum;
cout << "Enter two integers: ";
cin >> first_number >> second_number;
// sum of two numbers in stored in variable sumOfTwoNumbers
sum = first_number + second_number;
// prints sum
cout << first_number << "... | TOOL | 0.919693 | 4.291195 |
86228cde-3bb7-4139-9616-3c0dd5cc9dd3 | IPSBHANGU/caf_bionic | tools/versioner/src/DeclarationDatabase.cpp | #include "DeclarationDatabase.h"
#include <err.h>
#include <iostream>
#include <map>
#include <mutex>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <clang/AST/AST.h>
#include <clang/AST/Attr.h>
#include <clang/AST/Mangle.h>
#include <clang/AST/RecursiveASTVisitor.h>
#include <clang/... | TOOL | 0.865974 | 7.904442 |
bc2f5f72-ea2e-4a39-a75e-6e723517f20d | Inouyasha/Even-Mansour | Even-Mansour Test/Even-Mansour Test/AEM_16.cpp | //#include <iostream>
//#include <cstdlib>
//#include <ctime>
//#include<algorithm>
//#include<vector>
//#include<map>
//#include<random>
//#include<iterator>
//
//using namespace std;
//
//#define N 65536
//
//
//
//vector<unsigned int> a(N, 0), b(N, 0); //a-->F, b-->F^-1
//
//unsigned int k1 = 999, k2 = 0;//ke... | ALGO | 0.999878 | 3.220158 |
d1455cde-7230-4cd9-af93-f9b56451af93 | ali-hasrat/DSA-Cpp | Delete-Node-of-Linked-List.cpp | //Program to Delete first, last and at given position Node of given Linked List
#include<bits/stdc++.h>
using namespace std;
struct node
{
int data;
struct node *next;
};
struct node *head = NULL;
void elements(int item)
{
struct node *newnode = (struct node *)malloc (sizeof(struct node));
newnode->data... | ALGO | 0.999935 | 4.569905 |
de89bff9-1cf5-4968-ae51-394b8edfcf81 | ibamin/Camera-Image-Auth | AI/dlib/opencv-4.x/modules/core/src/arithm.cpp | /* ////////////////////////////////////////////////////////////////////
//
// Arithmetic and logical operations: +, -, *, /, &, |, ^, ~, abs ...
//
// */
#include "precomp.hpp"
#include "opencl_kernels_core.hpp"
namespace cv
{
/****************************************************************************************... | TOOL | 0.921602 | 3.718922 |
20a02d46-c62e-428e-bde8-f315c08f1ce4 | moinmalik996/pointers_in_c | 2. arrays_and_pointers/example_2.cpp | /*
Now we will implement example1.cpp
using a loop to access the all
the elements and their addresses.
*/
#include <iostream>
using namespace std;
int main()
{
int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
for (int i = 0; i <= 9; i++)
{
cout << "The starting address of A = " << A + i... | ALGO | 0.969881 | 3.345807 |
b360dad2-de23-46a8-8abc-07f83aa44894 | WTY-code/RUC | 2018/1044.cpp | #include<iostream>
using namespace std;
int main()
{
int light[10010] = {0}, n = 0, i = 0, j = 0, k = 0;
cin >> n;
//for(i = 1; i <= n; i++){
for(j = 2; j <= n; j++){
for(k = 1; j*k <= n; k++){
if(light[j*k]==0){
light[j*k] = 1;
}
else if(light[j*k] ==1){
light[j*k] = 0;
}
}
}
//... | ALGO | 0.99993 | 3.384803 |
5060988e-7e20-405a-8d2d-0c8cff407d13 | Eimund/UiO | FYS4460/Project 1/project1/project1.cpp | /*
* FYS4460 - Uordnede systemer og perkolasjon - Project 1
*
* Written by: Eimund Smestad
*
* 08.02.2015
*
* c++11 compiler
*/
#ifndef PROJECT_CPP
#define PROJECT_CPP
#include <string>
#include <time.h>
#include "array.h"
#include "boltzmann.h"
#include "delegate.h"
#include "euclidean.h"
#include... | ALGO | 0.995519 | 4.975155 |
9e31b4bf-9d61-4fc9-b24f-723460339366 | Haritha-tadepalli/LeetCode | Easy/28.find-the-index-of-the-first-occurrence-in-a-string.cpp | /*
Question: https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/
Solution: https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/submissions/908220214/
*/
class Solution {
public:
int strStr(string haystack, string needle) {
int len = needle.size(), ... | ALGO | 0.999914 | 6.145055 |
383665f9-dafb-4dd8-a4bf-fdc15460ac54 | hank95179/fa24_ece408_yuhan23-main | Project/project/third_party/eigen/test/sparse_permutations.cpp | static long int nb_transposed_copies;
#define EIGEN_SPARSE_TRANSPOSED_COPY_PLUGIN {nb_transposed_copies++;}
#define VERIFY_TRANSPOSITION_COUNT(XPR,N) {\
nb_transposed_copies = 0; \
XPR; \
if(nb_transposed_copies!=N) std::cerr << "nb_transposed_copies == " << nb_transposed_copies << "\n"; \
VERIFY( (#XPR... | TEST | 0.895109 | 6.2616 |
5a870619-51b1-4676-a096-e1b171ffdafb | haninhamdi/ROB305_Hanin-Hamdi_Ahmed-Yassine-Hammami | TD1/TD1e_main.cpp | /******************************************************************
RESPONSE to : TD1e (second part concerning the calibration)
This script is used to calibrate the function calculating
the number of loops done by the function incr during a given
duration. We suppose that this function is linear :
... | ALGO | 0.957858 | 4.749931 |
3c4735d5-c613-4e00-a695-0db7c4fd4890 | akhilred36/coScheduling | apps/lammps/examples/COUPLE/lammps_spparks/lmpspk.cpp | // lmpspk = umbrella driver to couple LAMMPS + SPPARKS
// for a strain-induced grain growth model
// Syntax: lmpspk Niter Ndelta Sfactor in.spparks
// Niter = # of outer iterations
// Ndelta = time to run MC in each iteration
// Sfactor = multiplier on strain effect
// in.sppar... | TOOL | 0.995889 | 5.392388 |
cf1ebb63-fd7e-4c48-9579-94154cbd3dc2 | KmrAnish04/100DaysOfCode | Dynamic_Programming/20_Longest_Repeating_Subsequence.cpp | // *************************** Dynamic Programming ***************************
/*
Problem Description:
Question Link:
GFG: https://practice.geeksforgeeks.org/problems/longest-repeating-subsequence2004/1
Leetcode:
pepcoding:
nados:
Complexity Analysis:
Expected ... | ALGO | 0.999941 | 5.407055 |
2823283b-d106-4547-bcf2-f5c5e0ed5177 | AhmedElKhoriby/Leetcode | 2006-find-the-student-that-will-replace-the-chalk/find-the-student-that-will-replace-the-chalk.cpp | class Solution {
public:
int chalkReplacer(vector<int>& chalk, int k) {
int sz = chalk.size();
int sum = 0;
for (int i = 0; i < sz; i++) {
sum += chalk[i];
if (sum == k) {
if (i + 1 == sz)
return 0;
else
... | ALGO | 0.999975 | 5.82274 |
96fa2051-0d59-4193-a986-4020fda37302 | facespublications/math-algorithm-book_tw | editorial_ch/chap4-7/prob4-7-2.cpp | #include <iostream>
using namespace std;
struct Matrix {
long long p[2][2] = { {0, 0}, {0, 0} };
};
Matrix Multiplication(Matrix A, Matrix B) { // 回傳 2×2 矩陣 A, B 乘積的函式
Matrix C;
for (int i = 0; i < 2; i++) {
for (int k = 0; k < 2; k++) {
for (int j = 0; j < 2; j++) {
C.p[i][j] += A.p[i][k] * B.p[k][j];
... | ALGO | 0.99997 | 4.793552 |
d682e527-41f1-423a-8801-f02344c90d0a | contactzbox/lovefork | src/modules/physics/box2d/wrap_Contact.cpp | #include "wrap_Contact.h"
#include "Fixture.h"
namespace love
{
namespace physics
{
namespace box2d
{
Contact *luax_checkcontact(lua_State *L, int idx)
{
Contact *c = luax_checktype<Contact>(L, idx, PHYSICS_CONTACT_ID);
if (!c->isValid())
luaL_error(L, "Attempt to use destroyed contact.");
return c;
}
int w_Con... | TOOL | 0.858034 | 6.133379 |
cda2ec9a-fdee-40a9-85e7-5c3a7d2a7047 | 944740137/y-WDcontroller | src/start/start.cpp | #include <fstream> //note 文件
#include <iostream> //note 标准IO,终端
#include "config.h"
#include "controller/controller.h"
#include "robot/robot.h"
#include "processCom/communication.h"
#include "wdLog/log.h"
#include "initParam.h"
extern Communication *communication;
extern Controller *controller;
extern Robot *robot;
/... | CONFIG | 0.868453 | 4.566435 |
9260ca85-e304-41a4-8e39-458d9b3149c1 | LucasAbrandao/competitive_programing | beecrowd/2040.cpp | #include <bits/stdc++.h>
using namespace std;
#define _ std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(a) a.begin(), a.end()
#define int long long int
#define double long double
#define vi vector<int>
#define pii pair<int,int>
#define endl "\n"
#d... | ALGO | 0.999592 | 4.643208 |
506867c4-a142-49c9-8dd2-7094670eae54 | dojiaruninsilence/doobGrooveTestSynth | Source/Utils/DoobMath/DDsp/DDspUtils.cpp | /*
==============================================================================
DDspUtils.cpp
Created: 7 May 2024 3:36:10pm
Author: Zubin
==============================================================================
*/
#include "DDspUtils.h"
#include "../DGeneralMath/DSqrRootAbsFunctions.h"
nam... | TOOL | 0.955487 | 5.780252 |
dc1b6c2e-e213-46c6-a97d-81cccca94207 | PrajwalaTM/accepted | General/Dynamic Programming/longest_common_subsequence.cpp | #include <bits/stdc++.h>
using namespace std;
int lcs(char *x,char *y,int m,int n)
{
int L[m+1][n+1],i,j;
for(i=0;i<=m;i++)
{
for(j=0;j<=n;j++)
{
if(i==0 || j==0)
L[i][j]=0;
else if(x[i-1]==y[j-1])
L[i][j]=L[i-1][j-1]+1;
else
L[i][j]=max(L[i-1][j],L[i][j-1]);
}
}
return L[m][n];
}
int main()
{... | ALGO | 0.999933 | 4.560613 |
d7874faf-075a-4866-8cc9-b0b7c06a21d2 | faizer001/Codeforces-Problem- | lab 2/atschool266B.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
string a;
cin>>a;
while(m>0)
{
for(int i=0;i<a.length()-1;i++)
{
if(a[i]=='B'&&a[i+1]=='G')
{
a[i]='G';
a[i+1]='B';
i++;
}
}
m--;
}
cout<<a<<endl;
}
| ALGO | 0.999813 | 3.405854 |
8110cca7-5a09-4036-b88b-d43e3d5d54bd | ZeekoZhu/HomeWork | FinalHomeWork/CppTask06/Source.cpp | #include<iostream>
#include<string>
using namespace std;
class String
{
public:
int length;
String():length(0),content(NULL)
{
}
String(string& s)
{
length = s.length();
content = new char[length + 1];
memcpy(content, s.c_str(), sizeof(char)*length + 1);
}
vo... | ALGO | 0.960095 | 3.377043 |
9102cde9-6320-45d0-b056-60784598f82d | Abhiman67/DSA | LEETCODE/931.cpp | /// m1 memoisation
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
// Memoization
int solve(int i, int j, vector<vector<int>> &matrix, vector<vector<int>> &dp, int n, int m) {
if (j < 0 || j >= m) {
return -1e9;
}
if (i == 0) {
return matrix[i][j];
}
... | ALGO | 0.999992 | 6.13465 |
c5524842-7003-482c-b5fd-36d15f53605d | TanishqRawat0112/Dynamic-Programming | STRIVER/1-D DP/House Robber/tabulation.cpp | #include<iostream>
#include<vector>
using namespace std;
int houseRobber(vector<int>&nums,int n){
vector<int>dp(n+1,0);
dp[1]=nums[0];
for(int i=2;i<=n;i++){
dp[i] = max(nums[i-1] + dp[i-2],dp[i-1]);
}
return dp[n];
}
int houseRobber2(vector<int>&nums,int n){
int prev2 = 0;
int pre... | ALGO | 0.999945 | 5.148891 |
42e4f5ba-36fb-49b9-983b-bd7c44a936e3 | larissamlima/computacao-grafica | Atividade01/CImg-3.3.1/examples/mcf_levelsets3d.cpp | #include "CImg.h"
using namespace cimg_library;
#undef min
#undef max
// Apply the Mean curvature flow PDE
//-----------------------------------
template<typename T> CImg<T>& mcf_PDE(CImg<T>& img, const unsigned int nb_iterations,
const float dt=0.25f, const float narrow=4.0f) {
... | ALGO | 0.999617 | 6.073204 |
55a8ffa6-acbc-4333-8233-eeafe9692c34 | denis-gubar/Leetcode | all/1470. Shuffle the Array.cpp | class Solution {
public:
vector<int> shuffle(vector<int>& nums, int n) {
vector<int> result;
for (int i = 0; i < n; ++i)
{
result.push_back(nums[i]);
result.push_back(nums[i + n]);
}
return result;
}
}; | ALGO | 0.99995 | 6.293618 |
00d310e0-0997-4689-a84f-0fd026eaee11 | raincross7/code-similarity | codes/train_code/problem134/problem134_51.cpp | #include <string>
#include <iostream>
using namespace std;
// ???????????§???????????§?????§??????
int DP[1024][1024] = {};
int main(){
int N;
cin >> N;
for(int c=0; c<N; ++c){
string X,Y;
cin >> X >> Y;
int xlen = (int)X.size();
int ylen = (int)Y.size();
for(int i... | ALGO | 0.99998 | 4.736086 |
a4a3fb68-040b-4f68-8fb2-c324a61d8834 | SharifdotG/SharifdotG-s-CodeVault | Kattis/1.3/Which Number Kind Is It/whichnumberkindisit2.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int testCases;
cin >> testCases;
while (testCases--) {
int number;
cin >> number;
bool isOdd = (number % 2 != 0);
bool isSquare = false;
if (number >= 0) {
int root = sqrt(number);
... | ALGO | 0.996261 | 4.99366 |
3467ff07-a6c6-4c90-8b50-e6e8a96816b1 | rutvasolanki2128/SE_assignment | C/module3.1/6.cpp | #include<stdio.h>
int main(){
int a,b,c;
printf("enter the height:");
scanf("%d",&a);
printf("enter the base:");
scanf("%d",&b);
c=b*a/2;
printf("area of triangle= %d",c);
}
| ALGO | 0.990538 | 3.342589 |
4a832c48-d3d7-45bc-851c-d32f3e145c46 | 6emrulhossain9/DSA_CPP | Sort/SelectionD.cpp | #include <bits/stdc++.h>
using namespace std;
void selectionSort(int arr[], int n)
{
for (int i = 0; i < n - 1; i++)
{
int max_idx = i;
for (int j = i + 1; j < n; j++)
{
if (arr[j] > arr[max_idx])
max_idx = j;
}
if (max_idx != i)
... | ALGO | 0.999773 | 5.681338 |
a15abe58-22b5-440c-aac6-5a0c03bf80b9 | tynnp/CP-Practice | UPCODER/TKTUANTU.cpp | #include <iostream>
using namespace std;
int n, x, a[105];
bool found;
int main() {
cin >> n >> x;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n; i++) {
if (a[i] == x) {
found = true;
cout << i;
break;
}
}
... | ALGO | 0.999815 | 5.268903 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.