uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7f848e22-562c-4c07-ad28-c49db600a765 | CEsposito2014/SoftTire | moos-ivp-15.5/ivp/src/lib_behaviors-marine/BHV_GoToDepth.cpp | /*****************************************************************/
/* NAME: Michael Benjamin, Henrik Schmidt, and John Leonard */
/* ORGN: Dept of Mechanical Eng / CSAIL, MIT Cambridge MA */
/* FILE: BHV_GoToDepth.cpp */
/* DATE: Aug 1 2006 ... | ALGO | 0.98259 | 5.259369 |
6853e626-bf80-4891-91f3-39ae07839178 | Sand33pJadhav/LeetCode-Optimal-Solutions | CPP/powCpp.cpp | class Solution {
public:
double myPow(double x, int n) {
double ans = 1.0;
long long nn = n;
if(nn<0) nn = -1 * nn;
while(nn) {
if(nn % 2) {
ans = ans * x;
nn = nn - 1;
}
else {
x = x * x;
... | ALGO | 0.999938 | 6.085344 |
154af0d5-b3c3-484b-8684-c3298148e37a | saumyap48/leetcode | 0028-find-the-index-of-the-first-occurrence-in-a-string/0028-find-the-index-of-the-first-occurrence-in-a-string.cpp | class Solution {
public:
int strStr(string haystack, string needle) {
int n=haystack.size(),m=needle.size();
for(int i=0; i<=n-m; i++){
int first=i,second=0;
while(second<m){
if(haystack[first]!=needle[second])
break;
second++,first++;
... | ALGO | 0.999956 | 5.696875 |
bb05e694-7e37-481a-bb8c-d4c0073845fc | Aya921/to_do_app_flutter | 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 |
1a25c567-a65b-42f8-a995-53fc8052c338 | CodeSmith7/Leetcode_Submission | 3235-minimum-cost-to-convert-string-i/minimum-cost-to-convert-string-i.cpp | //T.C : O(n) -> Because other for loops run only for constant time 26*26*26
//S.C : O(1) -> We take distances matrix of 26*26 which is constant
class Solution {
public:
void FloydWarshall(vector<vector<long long>> &adjMatrix, vector<char>& original, vector<char>& changed, vector<int>& cost) {
for(int... | ALGO | 0.999987 | 5.507952 |
e49bb53d-7e34-46d5-b705-4e57620139f5 | gongyiling/cpp_lecture | simd/box_box_simd.cpp | #include <iostream>
#include <chrono>
#include <xmmintrin.h>
typedef __m128 float4;
struct Point2D
{
float4 x;
float4 y;
};
struct Rect2D
{
Point2D minimum;
Point2D maximum;
};
inline float4 intersect1d(float4 a_minimum, float4 a_maxinum, float4 b_minimum, float4 b_maximum)
{
float4 i = _mm_cmple_ps(a_minimum,... | TEST | 0.998449 | 5.791182 |
ec90bda1-f25b-491c-a5fb-021b5f51c5af | ShiftMediaProject/game-music-emu | gme/Fir_Resampler.cpp | // Game_Music_Emu https://bitbucket.org/mpyne/game-music-emu/
#include "Fir_Resampler.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "blargg_source.h"
#undef PI
#define PI 3.1415926535897932384626433832795029
static void gen_sinc( double rolloff, int width, double offset, ... | ALGO | 0.989324 | 5.884812 |
83a24890-8aa7-4811-bdf9-adf3cce8bf68 | Nan-dan55/LeetCode | Difficulty: Easy/Bit Manipulation/bit-manipulation.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
void bitManipulation(int num, int i) {
// your code here
int dup=num;
if((dup>>(i-1))&1){
cout<<1<<" ";
}else{
cout<<0<<" ";
}
int ans=num|(... | ALGO | 0.998936 | 5.175027 |
997a0c5a-6a18-40a7-8b05-5f80a5744875 | JimenaD-creator/Algorithms_DataStructures | main.cpp | #include <SFML/Graphics.hpp>
#include <cstdlib>
#include "Prácticas.h"
#include <iostream>
#include <sstream>
#include <vector>
#include <fstream>
#include <thread>
#include <chrono>
using namespace std;
struct Empleado {
string nombre;
int edad;
string hobbies;
string habilidades;
};
vector<Emplead... | TOOL | 0.95969 | 4.566395 |
bdbbf240-6285-430c-a212-79d36d979561 | imraghavagr/DSA-cpp | Binary Tree/13.rightView1.cpp | /* Solution is incomplete
8
/ \
10 3
/ \ \
1 6 14
/ \ /
9 7 13
Right view of the above tree : 8,3,14,13
Approach 1 : Print the last node value in level order traversal of each node
*/
#include<iostr... | ALGO | 0.999821 | 4.382407 |
44003c3b-33ff-48a1-b4ea-186a54a0a6d2 | AfnanRakib/Y0ouKnowWho-code-library | Graph Theory/Johnson's Algorithm.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1010;
// Johnson's algorithm for all pair shortest paths with negative edges
// Complexity: O(N * M) + O(N * M * log(N))
const long long INF = 1e18;
struct edge {
int u, v;
long long w;
edge(){}
edge(int u, int v, long long w) : u(u), v(v), w(w){}
}... | ALGO | 0.999967 | 4.100566 |
03577d59-a915-466c-8569-45ceab83a9d5 | VedSojitra/DSA | HeapifyAlgo.cpp | #include<iostream>
using namespace std;
class heap{
public:
int arr[100];
int size;
heap(){
arr[0] = -1;
size = 0;
}
void insert(int val){
size = size + 1;
int index = size;
arr[index] = val;
while(index > 1){
int parent = index / 2;
if(arr[pa... | ALGO | 0.999963 | 4.249856 |
58f128c9-80c6-4f86-a065-53cbce5026cf | dipayancodes/codsoft | c++/task5.cpp | #include <iostream>
#include <vector>
#include <string>
#include <ctime>
struct Book {
std::string title;
std::string author;
std::string isbn;
bool available;
};
struct Borrower {
std::string name;
std::string borrowedBookISBN;
std::time_t dueDate;
};
class Library {
private:
std::ve... | TOOL | 0.900338 | 6.892944 |
4efc1743-1684-4ac8-9cf2-a256cd420ef0 | rylahs/Study_Previous | CPP,CodingTest/Baaarking/0x0E/PS/11931_1.cpp | // 0x0E. 정렬 I
// Written by : Rylah
// Date : 2022.02.12
// 11931. 수 정렬하기 4
// https://www.acmicpc.net/problem/11931
// https://www.acmicpc.net/source/38955672
#include <bits/stdc++.h>
using namespace std;
int n, a;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
vector<int> v(n, 0);
... | ALGO | 0.999845 | 4.869179 |
9cc70d8b-4ea9-4dc4-a996-33041efea37a | DevScript/Code-Khata | C++/quick_sort.cpp | /* C++ implementation of QuickSort */
#include <bits/stdc++.h>
using namespace std;
// A utility function to swap two elements
void swap(int* a, int* b)
{
int t = *a;
*a = *b;
*b = t;
}
/* This function takes last element as pivot, places
the pivot element at its correct position in sorted
array, and ... | ALGO | 0.999979 | 6.08613 |
b5adb5d2-edb2-4f99-b365-92357b52c928 | Jay-Ppark/Algorithm | 1629_곱셈.cpp | #include<iostream>
using namespace std;
long long int POW(long long int a,long long int b,long long int c){
if(b==1){
return a%c;
}
long long int v=POW(a,b/2,c);
v=v*v%c;
if(b%2==0){
return v;
}
else{
return v*a%c;
}
}
int main(void){
long long int a,b,c;
... | ALGO | 0.999986 | 4.174072 |
0e5a974d-399b-472f-9f82-41e323f2e46a | abdirahmandhiblaawe/todolist | 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 |
700f4341-c094-4d42-92f3-809eadacfbc1 | vishnujeet0609/my-dsa-submissions | june/3747-maximum-difference-between-adjacent-elements-in-a-circular-array/maximum-difference-between-adjacent-elements-in-a-circular-array.cpp | //T.C : O(n)
//S.C : O(1)
class Solution {
public:
int maxAdjacentDistance(vector<int>& nums) {
int n = nums.size();
int maxDiff = abs(nums[0] - nums[n-1]);
for(int i = 0; i < n-1; i++) {
maxDiff = max(maxDiff, abs(nums[i] - nums[i+1]));
}
return maxDiff;
... | ALGO | 0.999856 | 5.937394 |
320f5dcd-df36-4a12-bd15-8ba7faff8725 | shahriar-ruet14/Practice-Problem | 10018 Reverse and Add.cpp | #include<bits/stdc++.h>
using namespace std;
///############################ MD. SHAHRIAR MAHMUD ############################
///################################ CSE,RUET'14 ################################
/*
*/
bool isPalindromeNaive(long long n)
{
long long a=n;
long long temp = 0;
while(n != 0 )
{... | ALGO | 0.999842 | 3.822567 |
71892252-4481-4439-919d-75e6157a798d | borglab/gtsam | gtsam/discrete/DiscreteFactor.cpp | /**
* @file DiscreteFactor.cpp
* @brief discrete factor
* @date Feb 14, 2011
* @author Duy-Nguyen Ta
* @author Frank Dellaert
*/
#include <gtsam/base/Vector.h>
#include <gtsam/discrete/DiscreteFactor.h>
#include <gtsam/hybrid/HybridValues.h>
#include <cmath>
#include <sstream>
using namespace std;
namespace g... | ALGO | 0.919438 | 7.80566 |
d80c7b09-8b5f-40de-949c-a92329e8f94f | PiyushSacher/DSA_leetcode | 0002-add-two-numbers/0002-add-two-numbers.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbe... | ALGO | 0.999945 | 6.236497 |
d1b378b7-8af9-4b81-a598-eb784f4360ba | ishandutta2007/codeforces | ei133333/normal/1553/C.cpp | #include<bits/stdc++.h>
using namespace std;
using int64 = long long;
// const int mod = 1e9 + 7;
const int mod = 998244353;
const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10)... | ALGO | 0.999924 | 4.625623 |
454c20ba-993b-4a0d-8587-7b98708ea086 | Rupii/DataStructure_Algorithms | Trees/tree_dfs_bfs.cpp | #include<iostream>
#include<queue>
using namespace std;
//Tree and Dfs
// pre post inoreder traversels
// Bfs
struct Node{
int data;
Node *left, *right;
};
Node* GetNewNode(int data){
Node* temp = new Node();
temp->data = data;
temp->left = temp->right = NULL;
return temp;
}
Node* insert(Node* root, int data)... | ALGO | 0.999843 | 4.895131 |
ce62a59d-90e5-4db8-b6da-8d57c10eae22 | samyak2405/MY-LeetCoding | 856-score-of-parentheses/856-score-of-parentheses.cpp | class Solution {
public:
int scoreOfParentheses(string s) {
int scr = 0;
stack<int> s1;
for(int i = 0;i<s.length();i++)
{
if(s[i]=='(')
{
s1.push(scr);
scr = 0;
}
else
{
scr =... | ALGO | 0.999811 | 5.27871 |
9e9dfb48-7c1c-409c-bd8c-70b45faf783d | Fang0105/APCSpractice | toj/toj-540.cpp | #include<bits/stdc++.h>
#define int unsigned long long
#define endl '\n'
using namespace std;
int s[200005];
int b[200005];
int r[200005];
int n;
bool vis[200005][3] = {false};
int dp[200005][3];
int fun(int id,int sport){
if(vis[id][sport]==false){
vis[id][sport] = true;
//cout<<id<<" "<<sport<<end... | ALGO | 0.999636 | 3.572675 |
9e8e79a2-f71a-43f2-bcc4-6baa73080472 | 2023-1-CoMit-PS-study1/PS-intermediate-study | 박상혁/WEEK3_1로만들기.cpp | #include <iostream>
#define us unsigned short
#define N_MAX 1'000'000
using namespace std;
us cal_count[N_MAX + 1] = { 0, 0, 1, 1, 2 };
int main()
{
int N;
cin >> N;
for (int i = 5; i <= N; ++i)
{
if (i % 3)
{
cal_count[i] = i & 1 ? (cal_count[i - 1] + 1) : (min(cal_count[i >> 1], cal_count[i - 1]) + 1);... | ALGO | 0.99997 | 3.744497 |
63b5565b-7696-43d4-b015-85a4b279c33c | kimYouChae/C-_Question_solving | boj/boj_2252.cpp |
#include <sstream> //split() , stringstream
#include <list>
#include <deque>
#include <map>
#include <stack>
//#include<cmath> // math.pow
using namespace std;
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <algorithm> // sort
#include <string.h> //memset
#include <string> //stoi()
#inc... | ALGO | 0.999998 | 4.874937 |
fae577ab-4a6f-4f87-b621-03756e319650 | irfan701/Flutter | project_one/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.998388 | 6.785645 |
9326d6ee-7873-4684-8563-9e235ca0fb16 | vinci-grape/Rectifier | output/ChatGPT/codenet/Python/C++/s289483518.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
vector<vector<int>> ope(m, vector<int>(2));
for (int i = 0; i < m; i++) ... | ALGO | 0.999991 | 4.037857 |
009c5976-be0e-43de-b6eb-58a76b798bcc | Parag-Gavande/DSA_Using_CPP | Searching/binary_search_problrms.cpp | //find pivot index:
#include <iostream>
#include<vector>
using namespace std;
int findPivotIndex(vector<int>& arr) {
int n = arr.size();
int s = 0;
int e = n-1;
int mid = s + (e-s)/2;
while(s <= e) {
//corner case
if(s == e) {
//single e... | ALGO | 0.999979 | 5.430211 |
ce82fe34-a7e4-43b8-9ee9-1e45d7aaab16 | Rhythmsethiya/cpp-programs | binarySearch/In 2D/Division_BinSearch.cpp | #include<iostream>
using namespace std;
int main()
{
int a1 = -29;
int b1 = 7;
// //making search space
// int s = 0;
// int e = 29;
// int mid = (s+e)/2;
// //making checker and compare with checker
// //quotient will be our 'mid' number only
// int checker = 29;
// int ans =... | ALGO | 0.99979 | 3.545354 |
ef2953c7-ea6c-4ebf-8c9a-6ec789ab2aed | Ivan-71-ua/Competitive-Programming | LeetCode/892.cpp | #include <bits/stdc++.h>
class Solution {
public:
int surfaceArea(std::vector<std::vector<int>>& grid) {
int area = 0;
for (int i = 0; i < grid.size(); i++)
{
for (int j = 0; j < grid.size(); j++)
{
if(grid[i][j] > 0) {
area += 2;
if(i - 1 < 0) {
area += grid[i][j];
}
else {... | ALGO | 0.99944 | 5.101003 |
ef486ddc-85ab-474e-8e96-af93e59bc59b | AlekseiMaide/HackerRankCPP | algorithms/strings/panagrams.cpp | //
// Panagrams.
//
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <typeinfo>
using namespace std;
int main() {
set<int> set{};
string s{};
while (cin >> s) {
for (auto c : s) {
set.insert(tolower(c));
}
... | ALGO | 0.999764 | 5.510931 |
55d429c2-d812-4e37-95b2-65ad16a86795 | samankhan3210/UniResources | Semester 3/DS/DSproject/project.cpp | #include<iostream>
#include<string>
#include<fstream>
using namespace std;
struct node
{
string data;
node *next;
};
class linked_list
{
public:
node *head,*tail;
linked_list()
{
head = NULL;
tail = NULL;
}
void add_node(string n)
{
node *tmp = new node;
... | TOOL | 0.879384 | 3.061363 |
9e4361dd-927a-4df7-b609-831a9a60ae7e | alexmaruichen/code | 2-SAT/3207.cpp | #include <stdio.h>
#include <algorithm>
#include <stack>
#define assign(x) x=++id
using namespace std;
const int maxn=1010<<1;
const int maxm=510*510<<2;
int to[maxm];
int next[maxm];
int head[maxn];
int tot;
void add(int x,int y)
{
to[++tot]=y;
next[tot]=head[x];
head[x]=tot;
to[++tot]=x;
next[tot]=head[y];
h... | ALGO | 0.99994 | 4.045712 |
8b269a5c-22cf-4d01-9bb7-c3ca5d5c727d | AnTi0xoS/Cpp_HW1 | Task_6.cpp | #include <iostream>
#include <cmath>
int main()
{
setlocale(LC_ALL, "RUS");
double p, w;
std::cout << " p w: ";
std::cin >> p;
std::cin >> w;
std::cout << "x = " << p * (cos(w)) << "y = " << p * (sin(w));
return 0;
} | ALGO | 0.996473 | 4.103874 |
efb20b16-6469-4deb-bdc1-05446fdd6461 | dheerajtiwari461/DSA-and-cpp | Day_1_To_30/14_selection_sort.cpp | // https://www.geeksforgeeks.org/problems/selection-sort/1?utm_source=youtube&utm_medium=collab_striver_ytdescription&utm_campaign=selection-sort
int select(int arr[], int i)
{
// code here such that selectionSort() sorts arr[]
}
void selectionSort(int arr[], int n)
{
//code here
... | ALGO | 0.999909 | 5.26349 |
4df18bc7-6b4f-4cb0-83f3-7b7cba59d462 | darkey91/c- | BigInteger/BigInteger.cpp | /* калькулятор : http://itpride.net/useful/ochen-prodvinutyj-onlajn-kalkulyator.html
* перевод сс: http://calculatori.ru/perevod-chisel.html
* ASCII TABLE C++: http://en.cppreference.com/w/cpp/language/ascii*/
/*Определить оперции для шаблонов
* Вынести деление на короткое в отдельную функцию
* Написать какие-то ... | ALGO | 0.950704 | 4.087569 |
63d72887-f6e4-438c-acb5-418a680bcd23 | IamAliHossain/Data-Structure-Algorithm | Graph & Tree/Graph Practice/Graph representatin using Adjacency Matrix.cpp | #include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define dec greater<int>()
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define upper(s) transform(s.begin(), s.... | ALGO | 0.999748 | 3.792487 |
d33dc01b-451b-42eb-955d-068c95ffd32c | BearAlenko/Ground-Null | ext/physic2d/Box2D/Box2D/Dynamics/Joints/b2MotorJoint.cpp | #include "Box2D/Dynamics/Joints/b2MotorJoint.h"
#include "Box2D/Dynamics/b2Body.h"
#include "Box2D/Dynamics/b2TimeStep.h"
// Point-to-point constraint
// Cdot = v2 - v1
// = v2 + cross(w2, r2) - v1 - cross(w1, r1)
// J = [-I -r1_skew I r2_skew ]
// Identity used:
// w k % (rx i + ry j) = w * (-ry i + rx j)
//
// ... | ALGO | 0.961967 | 7.681295 |
2466d1c6-db87-44f1-9353-937ec8f1d344 | ishandutta2007/codeforces | jaroslavurban/normal/1277/A.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
int main(){
int t;
std::cin >> t;
for (int i = 0; i < t; i++){
long int n;
std::cin >> n;
long int n_of_zeros = -1;
long int tmp_n = n;
long int del = 1;
while (tmp_n){
tmp_n /= 10;
del *= 10;
n_of_zeros++;
}
de... | ALGO | 0.999725 | 4.074787 |
3f1f8fe8-3576-4e40-a3e3-9661b9397937 | polgreen/CBMCsynth-public | src/CBMCsynth/synthesis/synth_td.cpp | #include "synth_td.h"
#include "../utils/expr2sygus.h"
#include <util/arith_tools.h>
#include <iostream>
#include <util/mathematical_expr.h>
std::mt19937 rng2(rand());
top_down_syntht::enum_resultt top_down_syntht::replace_nts(exprt &expr, std::size_t ¤t_depth, std::vector<unsigned> &sequence)
{
std::cout<<"d... | ALGO | 0.99976 | 4.511537 |
044a4aa5-add3-4b40-894d-15f360780930 | pushkarmishra/IOISolutions | 2005/Garden/Garden.cpp | #include <bits/stdc++.h>
using namespace std;
#define f(a) fill(&a[0], &a[299], (int)1e9)
int l, w, n, k;
static int gr[300][300]={0};
static int bl[300], br[300], bu[300], bd[300];
void transform()
{
for(int i=1; i<=l; ++i)
for(int j=1; j<=w; ++j)
gr[i][j] += gr[i-1][j]+gr[i][j-1]-gr[i-1][j-1];
}
int get(int a... | ALGO | 0.999985 | 3.990208 |
cc1c2c74-4394-4b2e-ad37-8afe0f5118ae | aUSsieAnalytics/fx_trading | data_node/sha256.cpp | #include "sha256.hpp"
#include <cstring>
#include <fstream>
const unsigned int SHA256::sha256_k[64] = // UL = uint32
{0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4,
0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe,
0x9bdc06a7, 0xc19bf... | ALGO | 0.987558 | 6.377479 |
f2401bcd-5269-4287-bef9-82c1823b7584 | midjji/shire | srcs/utils/vis_helpers.cpp | #include <iostream>
#include <opencv2/imgcodecs.hpp>
#include <vis_helpers.h>
#include <mlib/utils/cvl/pose.h>
#include <mlib/opencv_util/cv.h>
#include <sfm/imo.h>
#include <mlib/utils/string_helpers.h>
#include <experimental/filesystem>
#include <thread>
#include <future>
namespace fs=std::experimental::filesystem;
... | ALGO | 0.892472 | 4.661858 |
c4dab5d2-602d-4462-9d12-34c9b6bba572 | erinmaus/autonomaus | DISCWORLD/twoflower/source/planners/visitPlanner.cpp | #include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include "visitPlanner.hpp"
twoflower::VisitPlanner::VisitPlanner(const Brochure& brochure, const Wizard& wizard) :
Planner(brochure, wizard)
{
// Nothing.
}
bool twoflower::VisitPlanner::visit(const Resource& from, const R... | ALGO | 0.855574 | 5.286209 |
4d3b24ef-0102-4426-92d0-f29164858df8 | mashrafsiddiq/SeiSMo | Code/ChainQ/dtwUCR.cpp |
#include "mex.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <iostream>
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)>(y)?(x):(y))
#define dist(x,y) ((x-y)*(x-y))
#define INF 1e20 //Pseudo Infitinte number for this code
using namespace std;
/// Data struct... | ALGO | 0.999878 | 3.312088 |
5b930089-797d-4687-94f6-b67174aa37af | securesystemslab/llvm-project | compiler-rt/lib/tsan/rtl/tsan_fd.cpp | #include "tsan_fd.h"
#include "tsan_rtl.h"
#include <sanitizer_common/sanitizer_atomic.h>
namespace __tsan {
const int kTableSizeL1 = 1024;
const int kTableSizeL2 = 1024;
const int kTableSize = kTableSizeL1 * kTableSizeL2;
struct FdSync {
atomic_uint64_t rc;
};
struct FdDesc {
FdSync *sync;
int creation_tid;
... | TOOL | 0.861317 | 6.908645 |
d7177784-a3b5-490f-be4d-77a3c005be76 | yzmninglang/C-Cpp-language | ysu/2-25.cpp | #include<iostream>
#include<math.h>
using namespace std;
void decide(int &x,int &y);
int main(){
int x,y;
cout<<"Please input x and y:";
cin>>x>>y;
decide(x,y);
cout<<"sorted x and y:"<<x<<'\t'<<y;
return 0;
}
void decide(int &x,int &y){
int temp;
if(x>y){
}else{
temp=x;
x=y;
y=temp;
}
}
| ALGO | 0.999449 | 3.374416 |
395e6816-d0ad-4ff4-af27-04a6ad9137e8 | hamadhassan/Cpp-withClasses-Course | Problem14.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter an integer: ";
cin >> n;
if (n < 10)
cout << "less than 10" << endl;
else if (n > 5)
cout << "greater than 5" << endl;
else
cout << "not interesting" << endl;
} | ALGO | 0.874751 | 3.605406 |
1aaef052-acf0-40bc-9386-1d6ff42d3dfe | sarvex/leetcode-guile | solution/0400-0499/0451.Sort Characters By Frequency/Solution.cpp | class Solution {
public:
string frequencySort(string s) {
unordered_map<char, int> cnt;
for (char& c : s) {
++cnt[c];
}
vector<char> cs;
for (auto& [c, _] : cnt) {
cs.push_back(c);
}
sort(cs.begin(), cs.end(), [&](char& a, char& b) {
... | ALGO | 0.999998 | 6.334289 |
d584c891-6d88-4c59-8101-56f7e973b310 | da5ater/cpp--projects-on-frank-course | docs/Source-codes-Section-19-IO-and-Streams/Section19/Challenge_2/main.cpp | // Section 19
// Challenge 2
// Automated Grader
#include <fstream>
#include <iomanip>
#include <iostream>
using namespace std;
int calc_degree(string test, string sol) {
int degree = 0;
for (size_t i = 0; i < sol.size(); i++) {
if (sol[i] == test[i])
degree++;
}
return degree;
}
int main() {
ifst... | TEST | 0.891887 | 4.757049 |
ed8a771b-46bc-4976-b7e5-ae9fa6ebcd7f | anatolykabakov/programming | cpp/leetcode/2_palindrome.cpp | /**
* Given an integer x, return true if x is a palindrome, and false otherwise
*/
#include <iostream>
#include <vector>
class Solution {
public:
bool isPalindrome(int x)
{
if (x < 0) {
return false;
}
const auto num_str = std::to_string(x);
auto half_size = num_str.size() / 2;
for (... | ALGO | 0.998991 | 6.442839 |
b611cb17-351d-4f96-b53f-2b29bc6dc4f5 | shivam-72/DSACodes | 3348-minimum-cost-walk-in-weighted-graph/3348-minimum-cost-walk-in-weighted-graph.cpp | class UnionFind {
private:
int *root, *rank;
public:
int* cost;
UnionFind(int n) {
root = new int[n]; // root array
rank = new int[n]();
cost = new int[n];
for (int i = 0; i < n; i++) {
root[i] = i;
cost[i] = -1;
}
}
int find(int x)... | ALGO | 0.999966 | 5.765056 |
40552f86-228d-458a-893d-b43247c6054c | MrMiner-org/TheMinerzCoin | src/rpc/mining.cpp | #include "base58.h"
#include "amount.h"
#include "chain.h"
#include "chainparams.h"
#include "consensus/consensus.h"
#include "consensus/params.h"
#include "consensus/validation.h"
#include "core_io.h"
#include "dstencode.h"
#include "init.h"
#include "main.h"
#include "miner.h"
#include "net.h"
#include "pow.h"
#inclu... | WEB | 0.990275 | 4.757994 |
7b4d3ca8-c2ac-4295-aeb5-a48ba0123153 | wangrenyao/NoteLibrary | csstudy/sort/sort/quick_sort.cpp | #include "util.h"
void quick_sort(int arr[], int cnt)
{
if (cnt <= 1) {
return;
}
int tmp = arr[0];
int left = 0;
int right = cnt - 1;
while (left < right) {
while (left < right && arr[right] > tmp) {
right--;
}
if (left < right) {
arr[left++] = arr[right];
}
while (left < right && arr[left] ... | ALGO | 0.999864 | 4.752272 |
1eccf77d-25f7-4cb0-bbbd-07fa7824ffde | quyifei23/gem5-CXL | gem5/src/systemc/tests/systemc/misc/unit/data/datawidth_bool_to_signed/promote_extension/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.952696 | 5.67011 |
31ad717d-d6fb-49a3-991e-e5fec1cc6332 | MrinmoyOpsAlpha/Leetcoding | 2653-sliding-subarray-beauty/2653-sliding-subarray-beauty.cpp | class Solution {
public:
vector<int> getSubarrayBeauty(vector<int>& nums, int k, int x) {
vector<int> res;
map<int,int> mp;
int i=0, j =0;
while(j<nums.size()){
mp[nums[j]]++;
if(j-i+1 == k){
int count = 0;
... | ALGO | 0.999988 | 5.56053 |
ba2eb099-eb0e-449e-8e6d-d9d83d2ce72f | chinoiserie/stepik_yandex_cpp | while/1_5_14.cpp | /* Определите наименьшее расстояние между двумя локальными максимумами последовательности натуральных чисел, завершающейся числом 0.
Если в последовательности нет двух локальных максимумов, выведите число 0.
Начальное и конечное значение при этом локальными максимумами не считаются. Расстоянием считается количество п... | ALGO | 0.999956 | 4.070088 |
856f8ae5-0fe4-47e4-84d5-a921077f5c77 | Fadi-B/pantheon | third_party/sprout-fadi/src/sprout/third_party/eigen-3.3.9/doc/examples/QuickStart_example.cpp | #include <iostream>
#include <Eigen/Dense>
using Eigen::MatrixXd;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << m << std::endl;
}
| ALGO | 0.992076 | 3.474624 |
46238ab2-593e-4d0b-8c31-d370a611ff67 | stellaruniversex/test | test/Namu darbai 5/Project2/Funkcijos.cpp | #include "Funkcijos.h"
#include <cmath>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
int A[256][256];
int a, b = 0;
int c, d = 0;
int n = 0;
int m = 0;
int o = 0;
string u = "";
ofstream fs("rez.txt");
void skait(int A[][256], int &e, int &f)
{
ifstream fd("data.txt... | ALGO | 0.997073 | 3.258417 |
dd92a769-5e06-4cfd-9430-6bb933ccb6ef | xta0/LeetCode-Solutions | 124-Binary-Tree-Maximum-Path-Sum/Binary-Tree-Maximum-Path-Sum.cpp | #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
using namespace std;
struct TreeNode{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
int maxSum = INT_MIN;
public:
... | ALGO | 0.999976 | 5.58266 |
cfb3508e-d27c-4a9e-9577-080fac7956a4 | Zentoros/bootcamp | Pointers/Pointers_Ex_basic_usage.cpp | #include <iostream>
using namespace std;
int main()
{
int myIntVariable = 99; // declare myIntVariable and set it to 99
int *myIntVariablesPointer; // declare pointer variable
myIntVariablesPointer = &myIntVariable; // Set pointer to address of myIntVariable
cout << myIntVariable << endl; // p... | TOOL | 0.963167 | 3.931439 |
b92ef41e-3672-4424-9dbc-ea03b659bddc | SundeepChand/DSA-Practice | GraphAlgorithms/DFS/reconstruct_itinerary.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
map<string, int> m;
vector<string> iti;
vector<int> beg;
void dfs(vector<vector<string>> &adj, string src)
{
int idx_src = m[src];
// Visit all the edges of src
for (int i = beg[idx_src]; i < adj[idx_sr... | ALGO | 0.999996 | 6.143129 |
5e14264a-c726-4254-b6f6-7d380ba93e0a | raincross7/code-similarity | codes/train_code/problem491/problem491_200.cpp | // DP
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n); for(ll i = 0; i < (ll)n; i++)
template<class T> inline bool chmin(T& a, T b) {
if (a > b) { a = b; return true; }
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if... | ALGO | 0.999802 | 4.108735 |
c22d067a-235d-44ad-ad30-397a9e82cfdb | vfolunin/archives-solutions | EOlymp/11673.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
string s;
int limit;
cin >> s >> limit;
vector<int> mismatch(s.size());
for (i... | ALGO | 0.999728 | 3.81905 |
9d22dc94-0832-4612-af94-a96926615479 | njrafi/Competitive-Programming-Solutions | CodeForces/1196A - Three Piles of Candies - 57654825.cpp | #include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define gc getchar
#define pc putchar
#else
#define gc getchar_unlocked
#define pc putchar_unlocked
#endif
using namespace std;
#define vi vector<int>
#define si set<int>
#define vs vector<string>
#define pii pair<int, int>
#define vpi vector<pii>
#define pri priority_queue... | ALGO | 0.999471 | 3.728502 |
01ab2aaf-d996-48a1-ad7c-60b3b3583e0f | 6666sssj/C- | myproject_C++/CODE/SRC/motion.cpp | #include "motion.hpp"
motion ::motion(int direction) : _direction(direction)
{
_food = generate_random_food();
test1.draw_food(_food);
snake_node _head_node(Point(8, 8), Point(8, 9));
snake_node _second_node(Point(8, 7), Point(8, 8));
snake_node _third_node(Point(8, 6), Point(8, 7));
a.push_bac... | TOOL | 0.93273 | 5.163154 |
baa13c93-efba-4702-9b42-bbc13d3b2ba7 | omar351999/revision | session_4/40-53/t43.cpp | #include <iostream>
#include <string>
using namespace std;
void Array_Reverse(int (&arr)[5], int size) {
int temp = 0;
for (int i = 0; i < size/2; i++) {
temp = arr[i];
arr[i] = arr[size - i - 1];
arr[size - i - 1] = temp;
}
for (int i = 0; i < size; i++) {
cout << arr[i] << " ";
}
cout << endl;
}
int m... | ALGO | 0.999211 | 5.028798 |
97ab0600-2220-43b2-b2b0-f95cccd6262d | ishandutta2007/codeforces | qiuzx/normal/1566/E.cpp | //ANMHLIJKTJIY!
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 998244353
#define F first
#define S second
#define ll long long
#define N 200010
using namespace std;
ll n,ans;
vector<ll> vt[N];
ll dfs(ll x,ll lst)
{
ll i,val=0;... | ALGO | 0.999879 | 4.344106 |
25c087ee-f7b3-4489-9b17-e023302d4cdc | rkcraushan333/leetcode | 0392-is-subsequence/0392-is-subsequence.cpp | class Solution {
public:
int dp[101][10001];
bool lcs(string s,string t,int i,int j){
if(i==s.size()) return true;
if(j==t.size()) return false;
if(dp[i][j]!=-1) return dp[i][j];
if(s[i]==t[j]){
return dp[i][j] = lcs(s,t,i+1,j+1) | lcs(s,t,i,j+1);
}
r... | ALGO | 0.999971 | 6.027487 |
911db798-1d78-48c0-bb38-3c23cf7b32e5 | ishandutta2007/codeforces | peti1234/normal/1536/D.cpp | #include <bits/stdc++.h>
using namespace std;
const int c=200005;
int w, n, t[c];
set<int> s;
int main()
{
ios_base::sync_with_stdio(false);
cin >> w;
while (w--) {
cin >> n;
bool jo=1;
s.clear();
for (int i=1; i<=n; i++) {
cin >> t[i];
s.insert(t[i])... | ALGO | 0.999925 | 3.946843 |
d2b8ad72-3bb2-45ae-978f-4ddd987c1a2f | cechallenge/2025 | llvm/libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter>
// requires ShuffleIterator<Iter> && LessThanComparable<Iter::value_type>
// constexpr void // constexpr in C++20
// pop_heap(Iter first, Iter last, Compare comp);
#include <algorithm>
#include <cassert>
#include <functional>
#include "test_macros.h"
#incl... | TEST | 0.962469 | 5.987416 |
19c553b3-dae2-4119-bb6e-03a437689a9b | raincross7/code-similarity | codes/train_code/problem099/problem099_337.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repi(i,x,n) for(ll i=x;i<(ll)(n);i++)
typedef pair<int,int>... | ALGO | 0.999933 | 3.378139 |
3a61fb48-0fad-4c86-9a7a-4ce13f007dde | alastair-thomas/Cascadia | Code/BayesianCSZ/BayesianCSZ.cpp |
#include <TMB.hpp>
using namespace R_inla;
using namespace density;
using namespace Eigen;
// helper function to make sparse SPDE precision matrix
// Inputs:
// logkappa: log(kappa) parameter value
// logtau: log(tau) parameter value
// M0, M1, M2: these sparse matrices are output from:
// R::INLA::inla.... | ALGO | 0.999377 | 4.404055 |
a64aff44-6f78-47f0-94cf-487afb7d4cb6 | xJasminxu/-bungen-Programmieren-1 | Übung_6_2/Quelle.cpp | #define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <conio.h>
float RADtoDEG(float x){
float Gradmass = (x/ M_PI) * 180.f; //Bogenma zu Gradma
return Gradmass;
}
float DEGtoRAD(float x){
float Bogenmass = (x / 180.f) * M_PI;
return Bogenmass;
}
void RADtoDEGRef(float& GradmassRef){
GradmassR... | ALGO | 0.927108 | 3.487349 |
d1153e19-0fd5-4e89-8cc6-eaa39c3e7ec9 | jstanco/MonteCarlo-Methods | monte_carlo_methods/src/old/matrix_mc_state.cpp | //created by John Stanco 7.1.18
#include "../include/matrix_mc_state.hpp"
double
vec_sum( const arma::vec& x)
{
double sum = 0;
for( size_t i = 0; i < x.n_elem; i++ )
{
sum += x( i );
}
return sum;
}
double
row_sum( const arma::mat& A, const size_t row )
{
double rsum = 0;
for( size_t col = 0; col < A.n_c... | ALGO | 0.994256 | 5.480821 |
64d888d0-8179-4204-a30b-1bd4456201fb | Harshitha122/DSA-INTERVIEW-PREP | 215-KthLargestElementinanArray/215-KthLargestElementinanArray.cpp | class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
priority_queue<int,vector<int>,greater<int>> pq;
for(int i=0;i<k;i++){
pq.push(nums[i]);
}
int n=nums.size();
for(int i=k;i<n;i++){
if(pq.top()<nums[i]){
pq.pop();
... | ALGO | 0.999972 | 5.067562 |
dd7c8075-7b3e-4752-b946-0970618742e7 | Shubham10kumar/DSA | lec8(Pattern-2)/pyramid_num_palindrome.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter the number of rows : ";
cin >> n;
int nsp = n - 1;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= nsp; j++)
{
cout << " ";
}
nsp--;
for (int k = 1; k <= i - 1; k++... | ALGO | 0.999901 | 3.639448 |
7eb981ad-a9f1-47b0-a4d5-34c9e40574e8 | king-yyf/cpcode | codeforce/cf/gym/104471/g.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ar2 = array<int, 2>;
using ar3 = array<int, 3>;
using ar4 = array<int, 4>;
#define all(c) (c).begin(), (c).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define f0(e) for(int i = 0; i < (e); ++i)
#define f1(e) for... | ALGO | 0.99991 | 4.021629 |
9c5025a4-6cef-4810-aea8-4940496bbbd7 | ksw1220/BOJ-Problem-Solving | 2014.cpp | #include<stdio.h>
#include<queue>
using namespace std;
priority_queue<long long> pq;
int prime[101];
int main() {
int K, N;
long long now;
scanf("%d %d", &K, &N);
for (int i = 0; i < K; i++) {
scanf("%d", &prime[i]);
pq.push(-prime[i]);
}
for (int iter = 0; iter < N; iter++) {
now = -pq.top();
pq.pop();
... | ALGO | 0.999975 | 3.29329 |
768bac92-90cb-4b80-a3a9-23f6c7383efe | mrquincle/visualsfm | graclus1.2/matlab/graclus_mex.cpp | #include <metis.h>
#include "mex.h"
int boundary_points;
int spectral_initialization;
int cutType; /*cut type, default is normalized cut */
int memory_saving; /* forbid using local search or empty cluster removing */
/*char mlwkkm_fname[256]; */ /*used to store coarsest file*/
/***************************************... | ALGO | 0.999879 | 4.604429 |
43c92e9f-c644-4779-bce8-7b5ffb69b3e8 | Arslanarsal/Full_Courses | Apna College C++/Stack & Queue/Infix_to_Pre_and_postfix_Evaluation.cpp | #include <bits/stdc++.h>
using namespace std;
// Return the preference of operator
int pref(char ch)
{
if (ch == '^')
{
return 3;
}
else if (ch == '*' || ch == '/')
{
return 2;
}
else if (ch == '+' || ch == '-')
{
return 1;
}
return 0;
}
// Convert the in... | ALGO | 0.999561 | 4.356153 |
bf4925ad-a572-4ad3-b377-2a4ec15cbb71 | knguyen780/INT2215-LapTrinhNangCao | Week (2)/week 2 ex (8).cpp | #include <iostream>
#include <cmath>
#include <iomanip>
#define ll long long
#define ull unsigned long long
using namespace std;
int main ()
{
ll n;
cin >>n;
int ans =0;
do
{
ans ++;
n /=10;
}
while (n !=0);
cout <<ans;
return 0;
}
| ALGO | 0.999856 | 3.382967 |
f5bc3e7a-f0d4-4d1a-b58d-65b364f1b18a | kangjunyoung37/algorizm-c | codingTest_Problem12.cpp | #include<iostream>
#include<queue>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
bool answer = true;
string s;
cin >> s;
if (s[0] == ')')
{
answer = false;
//
}
queue<char> q;
for (int i = 0; i < s.length(); i++)
{
if (q.empty())
{
q.push(s[i]);
c... | ALGO | 0.999595 | 3.501933 |
41ac6af5-ed27-4a17-b2be-92921be6b518 | BovenPeng/LightGBM-GPU-Compiled-Source | LightGBM/compute/perf/perf_bolt_reduce_by_key.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <bolt/cl/copy.h>
#include <bolt/cl/device_vector.h>
#include <bolt/cl/reduce_by_key.h>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
struct unique_key {
int current;
int avgValuesNoPerKe... | ALGO | 0.997957 | 4.861027 |
fb8da68a-1291-45ad-8e6d-05b910d2f7b2 | dmcintosh11/CPSC | CPSC298_CPP/Proj_FunctionMusic/MusicalNoteImpl.cpp | /// @brief Musical Notes Application Programming Interface (API) Implementation File
/// CPSC-298-6 Programming in C++ Project Musical Note Frequencies with Functions
/// @author <EMAIL>
#include <iostream>
#include <string>
#include <cmath>
// /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\... | TOOL | 0.913767 | 6.622334 |
047ba83e-43ab-45d7-97db-088c677feb90 | mar-ina-17/UP | task1.1.cpp | #include "iostream"
using namespace std;
int main() {
double number;
cin>>number;
if(number>=10 && number<100){
cout<<"Dvucifreno"<<endl;
return 0;
}
cout<<"Ednocifreno"<<endl;
return 0;
}
| TOOL | 0.971531 | 3.211963 |
10a32031-35b3-4f41-9e38-1b59460e9566 | RYFan-RS/NLP-1 | 5.百度LDA开源Femilia源码及详细注释/src/demo/query_doc_sim_demo.cpp | #include "familia/inference_engine.h"
#include "familia/semantic_matching.h"
#include "familia/tokenizer.h"
#include <gflags/gflags.h>
#include <iostream>
using std::string;
using std::vector;
using std::ifstream;
using std::cin;
using std::cout;
using std::endl;
DEFINE_string(model_dir, "./", "model directory");
DE... | DATA | 0.957808 | 5.933516 |
eb9c4e9f-1687-43c4-aa3d-a6ec2b51a6b2 | Dev1634/CodeBreaker | flappyrabbit.cpp | #include "flappyrabbit.h"
#include <vector>
using namespace std;
vector<int> low, up;
void init(vector<int> A, vector<int> B) {
low = A, up = B;
int cur_max = A[0], cur_min = B[B.size() - 1];
for (int i = 1; i < A.size(); i++) {
cur_max = max(cur_max, A[i]);
cur_min = min(cur_min, B[B.size() - i - 1]);
low[... | ALGO | 0.999565 | 5.180241 |
93318af2-794a-4b2f-b326-3cf3fb90450f | 5ecret99/leetcode | problems/1231-replace-elements-with-greatest-element-on-right-side/solution.cpp | class Solution {
public:
vector<int> replaceElements(vector<int>& arr) {
int prev_max = -1;
for(auto it = arr.rbegin(); it != arr.rend(); ++it){
auto temp = *it;
*it = prev_max;
prev_max = max(prev_max, temp);
}
return arr;
}
};
| ALGO | 0.999942 | 5.687623 |
cca87595-8268-4441-ad4f-ea6308e37ec1 | kaiumuddin/DSA-Codes | Time_and_Space_pepcoding_level_1/8.quick_select.cpp | #include<bits/stdc++.h>
using namespace std;
int partition(vector<int>& arr, int pivot, int lo, int hi)
{
// small_eq , big, unknown
// start/0 to j-1 <= pivot
// j to i-1 > pivot
// i to end/n => unknown
// big index starts from j
// pivot index in j-1
int i = lo;
int j = lo;
w... | ALGO | 0.999997 | 4.394545 |
11316ab6-422c-41a0-adbe-9c6cbe2de714 | Zero-Vec/cppACM | lanqiao/lanqiao_problem/3algorithmBase/chafen/lanqiao1276.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e6;
long long a[N], d[N];
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n, m;
cin >> n >> m;
for (int i = 1; i <= n;i++)
cin >> a[i];
for (int i = 1; i <= n;i++)
d[i] = a[i] - a[i - 1];
while(m--){
... | ALGO | 0.999997 | 3.920777 |
c99cb316-9bb6-404e-baab-ddd4e941a541 | Abhi551/C-Practise | inline_fun.cpp | #include <iostream>
using namespace std;
inline int cube(int s)
{
return (s*s*s);
}
class inline_f
{
int a , b ;
public:
void add(int a ,int b);
void sub(int a ,int b);
void mul(int a ,int b);
void div(int a ,int b);
};
inline void inline_f::add(int a , int b)
{
cout<<(a+b);
}
inline void inline_f::sub(int... | TOOL | 0.892738 | 4.043035 |
5dab923e-f626-4afc-b034-8277c2ee6876 | automenta/old-crittergod | src/physics/BulletCollision/Gimpact/btGImpactShape.cpp | #include "btGImpactShape.h"
#include "btGImpactMassUtil.h"
#define CALC_EXACT_INERTIA 1
void btGImpactCompoundShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
{
lockChildShapes();
#ifdef CALC_EXACT_INERTIA
inertia.setValue(0.f,0.f,0.f);
int i = this->getNumChildShapes();
btScalar shapemass = ... | ALGO | 0.979963 | 6.537411 |
3829b3bd-9e7f-4813-a987-ba4b0199961c | pratapshingane18/Leetcode-Daily-Problems | Maximize Score After N Operations.cpp | class Solution {
public:
int gcd(int num1,int num2) {
if(num2 == 0)
return num1;
return gcd(num2,num1 % num2);
}
int helper(vector<int>& nums,int mask,int op,unordered_map<int,int> &mp) {
if(mp.find(mask) != mp.end()) // checking if the combination is ... | ALGO | 0.999973 | 5.380414 |
ce77453a-a020-41dc-bc83-fd0c4977e432 | walker-zheng/code | stl_test/test-stl.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <string>
#include <list>
using namespace std;
int args_sort();
int erase_list();
int trans_case();
int str_trim();
int erase_char();
int replace_str();
int read_line();
int out_iter();
int ma... | ALGO | 0.962996 | 4.213497 |
c13c67ad-8b1a-4eae-ba9b-57d52cde1f4f | haoping0901/LeetCode-Practice-Records | 0067-add-binary/0067-add-binary.cpp | class Solution {
public:
string addBinary(string a, string b) {
int carry_in = 0, idx_a, idx_b;
string ret;
for (idx_a=a.size()-1, idx_b=b.size()-1; idx_a>=0 && idx_b>=0; idx_a--, idx_b--) {
int bit_a = a[idx_a] - '0', bit_b = b[idx_b] - '0';
ret.push_back((char) (b... | ALGO | 0.999991 | 6.536754 |
84da9384-f64c-49fd-91b8-a53f58e6e19c | alstn1234/CodingTest | 프로그래머스/lv0/120896. 한 번만 등장한 문자/한 번만 등장한 문자.cpp | #include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
string solution(string s) {
string answer = "";
map<char, int> m;
for(const char ss : s){
m[ss]++;
}
for(auto it = m.begin(); it != m.end(); it++){
if(it->second == 1)
answer +=... | ALGO | 0.999896 | 5.120498 |
00aaf085-bce6-4c26-ba6a-172a9f3dbdf9 | vdmitriev90/OrbMod | core/src/OrbFit/Filtering/XV/pureKalman_XV.cpp | #include "pureKalman_XV.h"
#include "Filter_XV.h"
#include "Control.h"
#include "Global.h"
#include "LinAlgAux.h"
#include "Integration_.h"
#include "state.h"
#include <iomanip>
using namespace Algebra;
using namespace std;
namespace OrbMod
{
//
pureKalman_XV pureKalman_XV::instance;
//
pureKalman_XV::pureKalm... | ALGO | 0.992634 | 4.027534 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.