uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
28c0b182-fa7f-440f-be64-3ccd45251e0e | adambrowning47/C-Github-repository | Paper Rock Scissor/Paper Rock Scissor/Paper Rock Scissor.cpp | // Paper Rock Scissor.cpp : Defines the entry point for the console application.
// Author: Adam Browning.
// version: Classified.
// purpose: To allow the user to play paper rock scissors while their supervisor is not looking.
#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib... | TOOL | 0.931485 | 3.946831 |
51075736-8890-48a2-a20d-0ac1a7946df2 | BIT-zhangxin/AlogrithmLearning | 做题/7.木板墙.cpp | //#include <cstdio>
//#include <cstring>
//#include <stack>
//#include <algorithm>
//using namespace std;
//
//typedef struct{
// int pre;
// int num;
// long long int high;
//}NODE;
//NODE Node[100010];
//
//int main()
//{
// int n;
// while (1)
// {
// scanf("%d", &n);
// if (n == 0) break;
// memset(Node, 0, size... | ALGO | 0.999746 | 3.639728 |
99054696-90d0-41a3-bac1-bf0c35dcade2 | alexandraback/datacollection | solutions_2755486_0/C++/twentynine/C.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
struct abcd{
int day,nt,west,east,str,Dd,Dp,Ds;
}a[1000];
int main(){
//freopen("C-small-attempt0.in","r",stdin);
//freopen("C-small-attempt0.out","w",stdout);
int tc,i,j,k,ii,n;
scanf("%d",&tc);
for(ii=... | ALGO | 0.998365 | 3.169194 |
f1b77e50-ea9d-4079-bb1f-515aab64349b | srishti-coder/Cpp | QUEUE/Circualr tour[IMPORTANT QUES].cpp | https://practice.geeksforgeeks.org/problems/circular-tour/1#
#include<bits/stdc++.h>
using namespace std;
struct petrolPump
{
int petrol;
int distance;
};
//The structure of petrolPump is
struct petrolPump
{
int petrol;
int distance;
};
class Solution{
public:
//Function to find starting ... | ALGO | 0.999785 | 5.318627 |
26af84fa-140f-4672-baf9-fb375375f6c2 | Exr0nProjects/learn_cpp | problems/xjoi.net/x9524/main.cpp | /*
* Problem #9524
* Fri 02 Aug 2019 @ 11:06 CST)
* number of leaf nodes
*/
#include <iostream>
#include <cstdio>
#include <utility>
#include <exception>
#include <algorithm>
#include <functional>
#include <math.h>
#include <random>
#include <set>
#include <map>
#include <tuple>
#include <string>
#include <vector>... | ALGO | 0.99902 | 3.28498 |
2dd3bfb8-57b0-4558-82bd-3630fc7e49f6 | MRIDUL896/6Companies30days | Day_29/LC_2400.cpp | //2400. Number of Ways to Reach a Position After Exactly k Steps
#include<iostream>
#include<unordered_map>
using namespace std;
class Solution {
public:
#define mod 1000000007
unordered_map<int,unordered_map<int,int>> dp;
int numberOfWays(int startPos, int endPos, int k) {
if(startPos == endPos &&... | ALGO | 0.999989 | 5.271381 |
39cf48f5-fd1f-4183-b46a-d2237179fe24 | leverimmy/Codes | 比赛/学校/2019-11-12测试2/source/PC27_Sonoda想要变可爱/sequence.cpp | #include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
namespace Sonoda
{
template<typename T> void swap(T &a,T &b)
{
T t;
t=a;
a=b;
b=t;
}
template<typename T> T GCD(T a,T b)
{
if(b==0)
{
return a;
}
return GCD(b,a%b);
}
template<typename T>T Qpow(T a,T b,T p)
{
T res=1;
wh... | ALGO | 0.999903 | 3.647254 |
54a2ce49-4fa5-48ed-bf96-74b8b7b6fb0a | BabkenK/HomeworkJul1 | oddcount_array.cpp | #include <iostream>
int main() {
const int size = 10;
int arr[size] = {};
std::cout << "Enter " << size << " integers:" << std::endl;
for (int i = 0; i < size; ++i) {
std::cout << "Enter element " << i+1 << ": ";
std::cin >> arr[i];
}
int oddCount = 0;
// Lo... | ALGO | 0.999291 | 6.11271 |
2967bb9f-47db-40ea-b6ff-bca6842adeee | Aadij724/Dsa | Graph/IslandsInGraphBFS.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
void addEdge( vector<int> adj[], int u, int v )
{
adj[u].push_back(v);
adj[v].push_back(u);
}
void printGraph( vector<int> adj[], int v)
{
for( int i=0; i<v; i++)
{
cout<<i<<" : ";
for( int x:adj[i] )
cout<<x<<... | ALGO | 0.999507 | 5.237806 |
95b1e973-d70c-4695-bdc8-6c154f3ecb95 | pingjuiliao/BasicBlockIDTracing | llvm-project-10.0.1/libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp | // <set>
// class multiset
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
#include <set>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.h"
int main(int, char**)
{
{
typedef int V;
ty... | TEST | 0.953777 | 4.688297 |
a0535ad4-87dd-4577-88a0-20ebab0ec8e8 | Andrew-liu/Leetcode | SetMatrixZeroes.cpp | class Solution {
public:
void setZeroes(vector<vector<int>>& matrix) {
if(matrix.size() == 0 || matrix[0].size() == 0) {
return;
}
int m = matrix.size(), n = matrix[0].size();
bool zero_row = false, zero_col = false;
for(int i = 0; i < n; ++i) {
if(mat... | ALGO | 0.999077 | 6.330547 |
22f7cdf4-1eff-474c-9bbc-b7a61ceced7e | zoewilson/C-plus-plus | Wilson_HWK3_7.cpp | /*
* Zoe Wilson
* January 26, 2016
* Homework 3.7
*
*/
#include <iostream>
#include <math.h>
/*
* v = wind speed in m/sec
* t = temperature in Celsius
* W = wind chill index
* @return wind chill index
*/
double get_wind_chill_factor (double v, double t) {
return (33 - (((10 * (sqrt(v)) - v + 10.5) * (33... | ALGO | 0.990843 | 6.569891 |
223f7b79-186e-408d-840f-498c1c5eaad3 | XiangZi0028/GAMES101_CODE_FRAMEWORK | 3party/eigen3/bench/geometry.cpp |
#include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace std;
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 8
#endif
typedef SCALAR Scalar;
typedef NumTraits<Scalar>::Real RealScalar;
typedef Matrix<RealScalar,Dynamic,Dynamic> A;
type... | ALGO | 0.961683 | 5.934697 |
f3bbdb88-fafe-415a-b9b6-b9107f121f14 | felipezfr/flutter_automatic_feeder | 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 |
ec50dede-7292-4443-889e-b26b91da8109 | FlorentCLMichel/palisade | src/binfhe/examples/equality.cpp | #include "binfhecontext.h"
using namespace lbcrypto;
using namespace std;
// function checking the quality between two vectors of ciphertext
// The first two arguments must have at least one element each.
template <typename ContextType>
LWECiphertext are_equal(vector<LWECiphertext> &c1, vector<LWECiphertext> &c2, Con... | ALGO | 0.988423 | 4.991035 |
7cc8234a-2b57-40d3-911c-b95bade103e4 | LMFRomero/SRS_Cards | boost/libs/phoenix/example/if.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <boost/phoenix/statement.hpp>
#include <boost/phoenix/operator.hpp>
#include <boost/phoenix/core.hpp>
int
main()
{
using boost::phoenix::if_;
using boost::phoenix::arg_names::arg1;
int init[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
std::... | TOOL | 0.980078 | 4.477701 |
5491a0de-0493-4baa-9ee6-8b08db3ba7c2 | Javeria-ali/Program22-VS2019 | Program22-VS2019/Source.cpp | #include<iostream>
using namespace std;
int main()
{
cout << "JAVERIA ALI" << endl << "Reg# bcy243018" << endl;
int num1, num2;
char op;
cout << "Enter (+,-,/,*)= ";
cin >> op;
cout << "Enter two numbers= ";
cin >> num1 >> num2;
switch (op)
{
case '+':cout << num1 + num2 << endl;
break;
case '-':cout << n... | TOOL | 0.94083 | 3.255171 |
19c63dff-21db-4cf2-b98f-2ed5a8f8b149 | hexu1985/Reimplement.Of.Cpp.Standard.Library | code/list/recipe-01/samples/benchmark_unique.cpp | #include <iostream>
#include <list>
int main()
{
std::list<int> x = {1, 2, 2, 3, 3, 2, 1, 1, 2};
std::cout << "contents before:";
for (auto val : x)
std::cout << ' ' << val;
std::cout << '\n';
x.unique();
std::cout << "contents after unique():";
for (auto val : x)
std::cout << ' ' << val;
... | ALGO | 0.91478 | 4.67118 |
bf93d543-032b-462b-b0bf-538995269b94 | ishandutta2007/codeforces | monsoon/normal/992/A.cpp | #include <cstdio>
#include <algorithm>
#include <set>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);++i)
int n;
set<int> s;
int main() {
scanf("%d",&n);
REP(i,n) {
int a; scanf("%d",&a);
s.insert(a);
}
s.erase(0);
printf("%d\n", (int)s.size());
} | ALGO | 0.999167 | 3.797738 |
dc465142-fe43-4e37-aeef-212711a34cc5 | Liseon01/LeetCode1-60 | leetcode_16.cpp | class Solution {
public:
int threeSumClosest(vector<int>& nums, int target) {
int res = nums[0] + nums[1] + nums[2];
sort(nums.begin(), nums.end());
for(int i = 0; i < nums.size(); i++){
if(i > 0 && nums[i] == nums[i-1]) continue;
int num = nums[i];
int le... | ALGO | 0.999995 | 6.207419 |
0a8f2f3d-726b-4e3d-a8fe-3202b901875a | Vesion/Misirlou | arsenal/string/SlidingWindow.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <unordered_map>
using namespace std;
// Sliding Window (hash table + two pointers) is a powerful method to solve substring problems:
//
// For most substring problem, we are given a string and need to find a s... | ALGO | 0.999264 | 6.217356 |
653dbe5a-c998-4af5-8398-e715bf82d935 | hcx1-hp/bitcoin-core | src/rpc/util.cpp | #include <bitcoin-build-config.h> // IWYU pragma: keep
#include <chain.h>
#include <clientversion.h>
#include <common/args.h>
#include <common/messages.h>
#include <common/types.h>
#include <consensus/amount.h>
#include <core_io.h>
#include <key_io.h>
#include <node/types.h>
#include <outputtype.h>
#include <pow.h>
#i... | TOOL | 0.970832 | 3.742985 |
757727c1-da2a-44c9-92f9-6b6dd683abf0 | FrostyBen/packages | packages/camera/camera_windows/example/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.998777 | 6.805244 |
9d89ccd3-3322-4acb-8236-6bba864aa97f | airliang/liangairan-s-rendering | BvhBuilder/RadeonRays/accelerator/bvh.cpp | #include "bvh.h"
#include <algorithm>
#include <thread>
#include <stack>
#include <numeric>
#include <cassert>
#include <vector>
#include <future>
namespace RadeonRays
{
static int constexpr kMaxPrimitivesPerLeaf = 1;
static bool is_nan(float v)
{
return v != v;
}
void Bvh::Build(bbox co... | ALGO | 0.999466 | 7.231933 |
9164e462-6082-4e1e-a747-c1b13306a5c1 | demonsheart/Study-Code | Algorithm/EX1_Sort/code/SelectSort.cpp | #include <iostream>
#include <random>
#include <time.h>
#include <vector>
using namespace std;
void SelectSort(vector<unsigned int> &v)
{
int len = v.size();
int index, i, j;
for (i = 0; i < len - 1; i++)
{
index = i;
// 寻找最小数索引
for (j = i + 1; j < len; j++)
{
... | ALGO | 0.999917 | 4.670299 |
1f17e66a-9d4d-4372-806c-23b1ab6ee055 | SHREYDEVLOPER/sde-journey | 1769-get-maximum-in-generated-array/get-maximum-in-generated-array.cpp | class Solution {
public:
int getMaximumGenerated(int n) {
if (n == 0) return 0;
vector<int> nums(n + 1, 0);
nums[0] = 0;
if (n >= 1) nums[1] = 1;
int maxVal = 1;
for (int i = 2; i <= n; i++) {
if (i % 2 == 0) {
nums[i] = nums[i / 2];
... | ALGO | 0.999997 | 6.49385 |
3bddbf66-da99-42e1-a6f4-658c86b7a3b8 | prakashkumar11/C-Program1 | c++ Practice/Practice-C++/ArithmeticOperator.cpp | #include<iostream>
using namespace std;
int main() {
int x = 10;
int y = 2;
int z = x + y ;
int re = x - y ;
int res = x * y ;
int resu = x / y;
int resul = x % y;
cout << resul << endl;
cout << resu << endl;
cout << res << endl;
cout << re << endl;
cout << z << endl;
return 0;
}
| ALGO | 0.992009 | 3.34713 |
87df29b0-dcb8-487c-a5d7-14f4c02cea9e | BBSSJJ/BOJ | 1927.cpp | //https://www.acmicpc.net/problem/1927
//endl 쓰면 시간초과, \n써서 해결
#include <iostream>
#include <queue>
using namespace std;
priority_queue<int, vector<int>, greater<int>> pq;
int main(){
ios::sync_with_stdio(0); cin.tie(NULL);
int N, x;
cin >> N;
for(int i = 0; i < N; i++){
cin >> x;
if(x... | ALGO | 0.999981 | 4.563669 |
4e27dbb7-5c07-4f30-94ae-dc46162b9aa7 | ishandutta2007/codeforces | abeker/normal/932/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 4e5 + 5;
const int LOG = 20;
int Q;
int cost[MAXN];
int depth[MAXN];
ll sum[MAXN];
int anc[MAXN][LOG];
int up[MAXN];
int curr = 1;
int mx[MAXN][LOG];
int dad[MAXN][LOG]; // original tree
void add_node(int x, int w) {
curr++;
da... | ALGO | 0.999863 | 3.910164 |
2005564d-352c-4c6c-a5f4-ef4c3a94715d | lucas54neves/gcc224-ialg | Lista de estruturas condicionais (Seletores)/Questão 14 - Seno ou cosseno/exercicio14.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main () {
char funcao, medida;
float valorAngulo, valorFuncao;
cin >> funcao >> medida >> valorAngulo;
if (medida == 'g') {
valorAngulo = valorAngulo / 180 * M_PI;
}
if (medida == 'r') {
valorAngulo = valorAngulo;
}
if (funcao == 's') {
valorF... | ALGO | 0.992561 | 3.938896 |
a53eb8f0-a64b-4591-b54c-065d2a0c00a4 | Ruchixz/c-_dsa_problems | BurningTree.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
Node *buildTree(string str) {
// Corner Case
if (str.length() == 0 || str[0] == 'N')
return NULL;
// Creating v... | ALGO | 0.999817 | 6.140713 |
64486950-350d-4b14-b32a-31269f96ba3d | fadilcse5bu/CSES-Problems-Solution | 2. Sorting and Searching/3. Ferris Wheel.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll n, x;
cin >> n >> x;
ll p[n], ans = 0;
for(int i = 0; i < n; i++) cin >> p[i];
sort(p, p + n);
priority_queue <ll> pq;
for(int i = n - 1; i >= 0; i--) {
if(pq.empty()) {
++ans;
pq.push(x - p[i]);
}
... | ALGO | 0.999945 | 3.861643 |
9103b3e2-6f8a-4e0d-b0d9-09eafbc17192 | Sahil-Vaidya/DSA | 2107-find-unique-binary-string/find-unique-binary-string.cpp | class Solution {
public:
string findDifferentBinaryString(vector<string>& nums) {
string result="";
for(int i=0;i<nums.size();i++){
result += (nums[i][i] == '0') ? '1' : '0';
}
return result;
}
}; | ALGO | 0.999651 | 5.932787 |
e77e59a7-9dd7-4c4d-bcf6-ae48acd9ae98 | wang-shishuang/Solutions-To-Introduction-To-Algorithms | other/Karatsuba/Karatsuba.cpp | #include<iostream>
#include<cmath>
#include<fstream>
using namespace std;
int makeEqualLength(string &str1, string &str2)
{
int len1 = str1.size();
int len2 = str2.size();
if (len1 < len2)
{
for (int i = 0 ; i < len2 - len1 ; i++)
str1 = '0' + str1;
return len2;
}
el... | ALGO | 0.999991 | 4.515603 |
34e75ffe-ce89-4097-9702-19e5303d23e5 | RanaRajat/cpp-DSA | nov2.decimal2binary.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
cin>>n;
int rem = 0;
int ans = 0;
int i = 0;
while(n!=0){
rem = n&1;
ans = rem*pow(10,i) +ans;
i++;
n = n>>1;
}
cout<<ans;
} | ALGO | 0.999987 | 4.581447 |
b5de9a21-1882-476f-8b69-d7b92ef953cf | ashib11/Sub_Zero_ | 2nd contest/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi acos(-1.0)
#define ull unsigned long long
#define i_mn INT_MIN
#define i_mx INT_MAX
#define p_b push_back
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define endl "\n"
#define getln(s) geline(cin, s)
#define point(x, d) fixed << set... | ALGO | 0.999608 | 5.172027 |
8a02b271-4c77-4d60-837d-6c6e61ab5778 | surya02112002/Leetcode_DSA | 21-merge-two-sorted-lists/merge-two-sorted-lists.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* mergeTwoLis... | ALGO | 0.999832 | 5.585355 |
7730c0f0-4a3a-4780-a850-3c28ce59e3e3 | AhJo53589/leetcode-cn | problems/reverse-linked-list/SOLUTION.cpp |
//////////////////////////////////////////////////////////////////////////
class Solution2 {
public:
ListNode* reverseList(ListNode* head)
{
if (head == nullptr || head->next == nullptr) return head;
ListNode* p = reverseList(head->next);
head->next->next = head;
head->next = ... | ALGO | 0.999869 | 6.075748 |
8dd8182d-3da5-489f-b0a6-c4e988ef88b1 | R11happy/PAT | 乙级/1057. 数零壹(20).cpp | /**
* @tag PAT_B_1057
* @authors R11happy (<EMAIL>)
* @date
* @version 1.0
* @Language C++
* @Ranking 1010/191
* @function null
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 100010;
int hashTable[2];
int main(int argc, char const *argv[])
{... | ALGO | 0.999095 | 3.882212 |
e0dd6ed2-34ec-4520-82bc-4a0f68e5db72 | nutan-sangani/CP-Practice | CSES problem set/Mix of tree,dp,sorting, searching,maths,graphs/distinct_numbers.cpp | #include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define forLoop for(int i=0;i<n;i++)
#define pii pair<int,int>
#define pb push_back
#define pll pair<ll,ll>
#define mp make_pair
#define um unordered_map
#define us unordered_set
#define umll unordered_map<ll,ll>
#define omll map<ll,ll>
#define vecll vect... | ALGO | 0.999891 | 4.039521 |
acca48c6-8a7c-4a13-a22c-ebe116df1c11 | vivekm92/practice | tle/800/1903A.cpp | #include <iostream>
#include <vector>
using namespace std;
string solve(vector<int>& arr, int n, int k) {
if (k == 1) {
for (int i = 1; i < n; i++) {
if (arr[i] < arr[i-1]) {
return "NO";
}
}
}
return "YES";
}
int main() {
int t, n, k;
... | ALGO | 0.999942 | 4.331713 |
8e3885f4-183e-432d-9bc3-30181368904a | tang415a/algorithms | numbers/minFallingPathSum.cpp | /*
Given a square array of integers A, we want the minimum sum of a falling path
through A.
A falling path starts at any element in the first row, and chooses one element
from each row. The next row's choice must be in a column that is different from
the previous row's column by at most one.
Example 1:
Input: [[1,2... | ALGO | 0.999984 | 6.828306 |
642c95ec-8138-4235-9886-71ee3fd38167 | Shailesh93602/potd | leetcode/2025/february/19/19.cpp | class Solution {
public:
string getHappyString(int n, int k) {
stack<string> s;
int i = 0;
s.push("");
while(!s.empty()) {
string curr = s.top();
int len = curr.length();
s.pop();
if(len == n) {
if(++i == k) return cur... | ALGO | 0.99985 | 5.623976 |
b099eee9-77b7-4e34-96c9-284fa052277e | bpfinnerty/DeepLearningLibrary | boost_1_62_0/libs/algorithm/example/clamp_example.cpp | #include <string>
#include <iostream> // for cout, etc
#include <boost/algorithm/clamp.hpp>
namespace ba = boost::algorithm;
bool compare_string_lengths ( const std::string &one, const std::string &two )
{
return one.length () < two.length ();
}
int main ( int /*argc*/, char * /*argv*/ [] ) {
// Clamp take... | TEST | 0.972607 | 6.000297 |
0f62baa8-a14a-42c5-9976-a5c0be83bd2f | Charlyhash/CodingInterviews | 58 二叉树的下一个结点.cpp | /*
ָoffer:һ
Ŀ:
һеһ㣬ҳ˳һ㲢ҷءע⣬
Ľ㲻ӽ㣬ͬʱָָ롣
˼·
3
(1)ôΪߵĽڵ
(2)ûǸڵڵ㣬ôΪڵ
(3)ûΪڵҽڵ㣬ôһֱϲңֱýڵΪڵ
ôڵĸڵΪ
*/
#include <iostream>
using namespace std;
struct TreeLinkNode
{
int val;
struct TreeLinkNode *left;
struct TreeLinkNode *right;
struct TreeLinkNode *next;
TreeLinkNode(int x) :val(x), left(NULL), right(NULL), next(NU... | ALGO | 0.99997 | 3.979852 |
e43efc7f-0630-4e07-a5cd-dd9c23acefa4 | droneslab/bauhaus | gtsam-rs/sys/3rd/gtsam/timing/timeIncremental.cpp | /**
* @file timeIncremental.cpp
* @brief Overall timing tests for incremental solving
* @author Richard Roberts
*/
#include <gtsam/slam/dataset.h>
#include <gtsam/slam/BetweenFactor.h>
#include <gtsam/sam/BearingRangeFactor.h>
#include <gtsam/geometry/Pose2.h>
#include <gtsam/inference/Symbol.h>
#include <gt... | ALGO | 0.93139 | 5.412624 |
d6cba245-691e-4fae-83e5-b06ec4476565 | XuSY021125/C | Circle.cpp | #include<stdio.h>
#define PAI 3.14
int main()
{
double fRadius;
double fResult = 0;
printf("Բİ뾶");
scanf_s("%lf",&fRadius);
fResult = fRadius * fRadius * PAI;
printf("ԲΪ%lf\n", fResult);
return 0;
} | ALGO | 0.998139 | 3.145936 |
2f04fa2e-d2dc-4608-a336-916c4d3225ff | moon4runa/DSA_Practice | 0438-find-all-anagrams-in-a-string/0438-find-all-anagrams-in-a-string.cpp | class Solution {
public:
vector<int> findAnagrams(string st, string p) {
unordered_map<char, int> mp;
int m = p.length();
int n = st.length();
for(int i=0; i<m; i++){
mp[p[i]]++;
}
int char_mat = 0;
int s = 0;
int e = 0;
vector<int> res;
while(e < n){
if(mp.find(st[e]) != mp.end()){
mp[st[e]]... | ALGO | 0.999972 | 5.86283 |
1abe7e19-3822-426f-9fd9-8c776f4c89d0 | kunal2812/CP | codeforces/1629/C.cpp | #pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define yes cout << "YES" << endl; return
#define no cout << "NO" << endl; return
#define dc double
#de... | ALGO | 0.999934 | 3.889805 |
af593dd8-6efe-4667-910f-4aea5cdcdf37 | cait7/myLeetCode | 401_500/424_滑动窗口.cpp | class Solution {
public:
string rankTeams(vector<string>& votes) {
if (votes.size() == 0) {
return "";
}
int teams = votes[0].size();
string res = votes[0];
sort(res.begin(), res.end());
for (int i=teams-1; i>=0; i--) {
// bucket sort
... | ALGO | 0.999998 | 5.970394 |
8c978ade-960a-4250-a19d-fe7553ba8fd9 | unmoved21/frameworks_av | media/codecs/amrnb/dec/src/lsp_avg.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/lsp_avg.c
Functions:
Date: 04/14/2000
------------------------------------------------------------------------------
REVISION HISTORY
Description: Removed the functions lsp_avg_init and lsp_avg... | ALGO | 0.973928 | 6.647949 |
db7e776f-fa2a-4752-9668-234dc373d2d5 | PriyanshK09/Leetcode-Discord-Bot | solutions/dice-roll-simulation.cpp | // Time: O(m * n), m is the max of rollMax
// Space: O(m)
class Solution {
public:
int dieSimulator(int n, vector<int>& rollMax) {
static const int MOD = 1e9 + 7;
vector<vector<int>> dp;
for (int i = 0; i < 6; ++i) {
dp.emplace_back(rollMax[i]);
dp[i][0] = 1; // 0-... | ALGO | 0.999981 | 6.492308 |
961a9ff1-4593-4058-a41b-a24d124025d7 | creativeYS/cimDevGroup_algorithm | jch0622/16931_겉넓이구하기.cpp | #include <iostream>
#include <vector>
#include <algorithm>
class StackCube
{
typedef std::vector<std::vector<int> > cubeInfo;
private:
const int depth;
const int width;
const cubeInfo map;
StackCube();
int getDepth() const;
int getWidth() const;
cubeInfo getMap() const;
int each... | ALGO | 0.999022 | 4.964345 |
fc3bcade-25e4-4b48-8219-6fd1744b4ebf | AnishDhomase/Code2.O | 2581-divide-players-into-teams-of-equal-skill/divide-players-into-teams-of-equal-skill.cpp | class Solution {
public:
long long dividePlayers(vector<int>& skill) {
long long ans = 0;
unordered_map<int,int> freq; //{skill,freqOfSkill}
int n = skill.size();
int totalTeams = n/2;
int totalSkillSum = 0;
for(auto s : skill){
freq[s]++;
tota... | ALGO | 0.999979 | 5.36549 |
22ff69ce-96a4-44c7-af20-189266dcf8d4 | rnavdeep/SIT315 | Sequential.cpp | #include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>
#include <queue>
#include <iostream>
#include <chrono>
#include <iomanip>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
volatile int running_threads = 0;
using std::cout;
using std::endl;
using std::vector;
using ... | ALGO | 0.894592 | 4.022548 |
64182976-2b4c-4fa9-ae06-19e185e4c8fa | JoshBleggi/Ender3ProSpriteCRTouchMarlin | Marlin/src/lcd/menu/game/maze.cpp | #include "../../../inc/MarlinConfigPre.h"
#if ENABLED(MARLIN_MAZE)
#include "game.h"
int8_t move_dir, last_move_dir, // NESW0
prizex, prizey, prize_cnt, old_encoder;
fixed_t playerx, playery;
// Up to 50 lines, then you win!
typedef struct { int8_t x, y; } pos_t;
uint8_t head_ind;
pos_t maze_walls[50] = {
... | ALGO | 0.929765 | 5.047589 |
b0793d67-9dfc-4608-a8b9-a2cefefa3e5b | k-rishabh6172/Coding_Minutes_Cpp | Exercise_113_LastOccurence.cpp | #include<bits/stdc++.h>
using namespace std;
int getLastOccurenceUtility(int* arr, int target, int index)
{
if (arr[index] == target) return index;
return getLastOccurenceUtility(arr, target, index-1);
}
int getLastOccurence(int* arr,int n, int target)
{
return getLastOccurenc... | ALGO | 0.999307 | 5.338178 |
4367e5ad-d424-4a7a-9dce-3ffbc7b7a23a | LuisEnGuz/Luis_Enrique_PMC2 | Programas Capitulo 4/Programa 4.11.cpp | #include <stdio.h>
int MAD(int N1);
int main() {
int NUM, RES;
printf("INGRESA EL NUMERO: ");
scanf("%d", &NUM);
RES = MAD(NUM);
printf("EL MAYOR DIVISOR DE %d ES: %d", NUM, RES);
return 0;
}
int MAD(int N1) {
int I = N1 / 2;
while (N1 % I != 0) {
I--;
}
return I... | ALGO | 0.999829 | 4.377211 |
947ccb42-004b-4c20-b549-78f5bdfb5681 | Cristina143/Practica19Flutter | 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 |
ee39619e-b0b0-4c34-85f9-356e1454c861 | henrycolesides/fractals-temp | IFS/Voxels/Octree.cpp | // Octree.cpp
// Provides implementation of a Sparse Voxel Octree (SVO) for efficient storage of voxel data
// Used by Voxel Raycaster to find voxel state and bounds for any particular point in 3d space
#include <algorithm>
#include <cmath>
#include <vector>
#include "iostream"
#include "Octree.h"
using std::cout, s... | ALGO | 0.879047 | 6.953691 |
486802dc-d875-4f63-89f1-44d5c1da4329 | pranav1812/DS_algo_with_cpp | Arrays/insertionSort.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
cout<<"Enter the array: "<<endl;
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
for(int i=1;i<=n-1;i++)
{
int cur=arr[i];
int j=i-1;
while(j>=0 && arr[j]>cur)
{
arr[j+1]=arr[j];
j--;
}
arr[j+1]=cur;
}
for(int i=0;i<n... | ALGO | 0.999974 | 3.661465 |
8d196065-90df-4d9e-8abd-f4fb2f17f7ed | yashss1/Sublime_CP | cf_mashup2.cpp | //YashS
#include <bits/stdc++.h>
using namespace std;
#define test int T;cin>>T;while(T--)
#define int long long
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pVec(v) for(auto e:v)cout<<e<<"... | ALGO | 0.99998 | 3.800435 |
09f07b57-8adf-4a37-8e10-2d03698e044d | techyvish/codeforce-problems | Codeforces/UVa/LeetCode/TWOSUM.cpp | //
// Created by Vishal Patel on 11/25/16.
//
#include <fstream>
#include <vector>
#include <queue>
#include <iostream>
#include <cmath>
#include <stack>
#include <map>
using namespace std;
#define fin cin
vector<int> twoSum(vector<int>& nums, int target) {
for ( int i = 0 ; i < nums.size() ; i ++ )
{
... | ALGO | 0.999869 | 5.744432 |
9ba08efa-0868-4be8-be1c-a5cfb89d9f5d | IRrokEZ/SaveOldWorks | cursera/06022024_2240/main.cpp | #include <iostream>
#include <map>
#include <vector>
#include <string>
using namespace std;
int main() {
map <string, string> my_map;
int Q;
string command, p1, p2, save;
vector <string> result;
cin >> Q;
for(int i = 0; i < Q; ++ i) {
cin >> command;
if (command == "CHANGE_CAPI... | ALGO | 0.926981 | 4.624405 |
51b6e956-c135-4681-86a6-2b55f1721e20 | whquddn55/Algorithm_BojSolves | 2000/2953.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename a, typename b>
ostream& operator<<(ostream& os, const pair<a, b>& pai) {
os << pai.first << ' ' << pai.second;
return os;
}
template<typename a, typename b>
istream& operator>>... | ALGO | 0.999862 | 3.55141 |
9f8b6855-b992-4837-854f-10b78afc48e6 | Piyusss/Lc-2024 | 1207-delete-nodes-and-return-forest/delete-nodes-and-return-forest.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999816 | 6.129144 |
e230238c-7251-4962-99c3-9ebbe5f85ced | Starry0/ACM | codeforces/439div2/b.cpp | #include <bits/stdc++.h>
#define ll long long
ll a[12];
using namespace std;
int main() {
ll a, b, ans = 1;
cin >> a >> b;
ll num = b - a;
if(num >= 10) printf("0\n");
else {
for(ll i = a+1; i <= b; i ++) {
ans = ans*i%10;
}
printf("%lld\n", ans);
}
return 0;
} | ALGO | 0.999969 | 4.223063 |
c2c426a1-a090-4d7f-a4e5-dcfab6f428af | Dipto-shaha/LeetCode-Daily-Challenge | 0647-palindromic-substrings/0647-palindromic-substrings.cpp | class Solution {
public:
int countSubstrings(string s) {
int i,j,n=s.size();
int dp[n][n],ans=n;
memset(dp,-1,sizeof(dp));
for(i=0;i<n;i++)
{
dp[i][i]=1;
if(i+1<n && s[i]==s[i+1])
dp[i][i+1]=1,ans++;
}
for(i=2;i<n;i++)
... | ALGO | 0.999976 | 6.306371 |
87b72e57-d1a0-42f3-937e-679c6a1f13a2 | rodrigo-munguia/Hybrid_VSLAM | src/localslam/src/ekf_visual_match_feats.cpp | #include "ekf.hpp"
#include "../../common/Vision/vision.hpp"
#include "../../common/Transforms/Euler_to_Ra2b.hpp"
#include "ekf_Jacobians.hpp"
int EKF::Visual_match_feats(FRAME *frame)
{
// Use features descriptors for matching process
int n_matches = Visual_match_feats_by_descriptors_e(frame);
return... | ALGO | 0.990908 | 6.004641 |
4cbb4189-1b37-4a67-8f46-18d1f2cb2d57 | karikay18/Leetcode-Solutions | 63-unique-paths-ii/unique-paths-ii.cpp | class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
int m = obstacleGrid.size();
int n = obstacleGrid[0].size();
if (obstacleGrid[0][0] == 1 || obstacleGrid[m-1][n-1] == 1) return 0;
vector<vector<long long>> dp(m, vector<long ... | ALGO | 0.999764 | 6.237759 |
a54d28f9-51cb-4f7a-a29f-e77677f2c4be | LuminosityHope/AudioExtraction | src/FromInt32ToFloat.cpp | #include "FromInt32ToFloat.h"
#include <algorithm>
#include <cmath>
std::vector<float> convertToFloat(const std::vector<float>& signal) {
if (signal.empty()) {
return {};
}
float maxVal = *std::max_element(signal.begin(), signal.end(),
[](float a, float b) { return std::abs(a) < std::abs(... | TOOL | 0.944632 | 5.46936 |
edf32e53-d1fd-440e-a998-c124f4450654 | 3Dprog24-Guest-Lecture/3Dprog24 | libs/assimp/tools/assimp_cmd/Info.cpp | /** @file Info.cpp
* @brief Implementation of the 'assimp info' utility */
#include "Main.h"
#include <cstdio>
#include <iostream>
#include <string>
constexpr char AICMD_MSG_INFO_HELP_E[] =
"assimp info <file> [-r] [-v]\n"
"\tPrint basic structure of a 3D model\n"
"\t-r,--raw: No postproc... | TOOL | 0.919847 | 6.194722 |
71a2c871-2eef-4eff-a2db-22b6d4c76de9 | SergiuIonescu98/fractals_parallel | linux_fractals/julia/julia_explorer/noSDL/julia_explorer.cpp | #include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include "quickcg.h"
using namespace QuickCG;
using namespace std;
#include "fractal_math.h"
int main(int argc, char *argv[])
{
screen(320, 240, 0, "Julia Explorer");
//each iteration, it calculates: new = old*old + c, where c is a consta... | ALGO | 0.984621 | 5.35182 |
b5cbbd5e-60b5-4385-bbe7-aa7d134cf005 | pradeeptosarkar/LeetCode | LeetCode/problems/find_words_that_can_be_formed_by_characters/solution.cpp | class Solution {
public:
int countCharacters(vector<string>& words, string chars)
{
vector<int> counts(26, 0);
for (char c : chars)
counts[c - 'a']++;
int ans = 0;
for (string word : words)
{
vector<int> wordCount(26, 0);
... | ALGO | 0.999929 | 6.120299 |
1f18f014-d74a-45f9-b8f8-b2a62f758e39 | Vismaya-p/Cpp_Training | assessments/cppbasics/cppbasics/prg29.cpp | // Program to Print the Hourglass Pattern
#include<iostream>
using namespace std;
int main()
{
int n = 5;
for (int i = 0;i < n;i++)
{
for (int j = 0;j < i;j++)
{
cout << " ";
}
for (int k = 0;k < n - i;k++)
{
cout << "* ";
}
cout << endl;
}
for (int i = 1;i < n;i++)
{
for (int j = 0;j < n - ... | ALGO | 0.996068 | 4.42435 |
bf03f092-5b25-4b55-ba46-c10803f0e226 | mohsin0176/HandNotes-onCPlusCPlus | Functions/17.cpp | #include<bits/stdc++.h>
#include<math.h>
#include<cstdlib.h>
#include<limits.h>
#include<iomanip.h>
#include<fstream.h>
#include<process.h>
#define PI 3.1416
using namespace std;
inline float lbstokg(float pounds)
{
return 0.453592*pounds;
}
int main()
{
float lbs;
cin>>lbs;
cout<<lbstokg(lbs);
return 0... | ALGO | 0.997646 | 3.573631 |
ed37a150-96de-47da-8658-a17ba984ce33 | Mneach/Leetcode-Solution | 1305-all-elements-in-two-binary-search-trees/1305-all-elements-in-two-binary-search-trees.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999972 | 6.012157 |
3013bb8a-6b76-4358-b0a4-411d35049e04 | RydKrm/Competitive_Program | Codeforces/891A Pride.cpp | //#include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<cstring>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<iterator>
#include<algorithm>
#include<bitset>
#de... | ALGO | 0.999944 | 3.276528 |
1152cae3-b2cf-4159-ad0a-0690ae781103 | KitchenGun/SGA_Study | DataStructureSelfStudy/CodingTestTemplate/CodingTestTemplate/PhoneketMonster.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
using namespace std;
//ó Ǯ
//int solution(vector<int> nums)
//{
// int answer = 0;
// int n = nums.size()/2;
// sort(nums.begin(), nums.end());
// nums.erase(unique(nums.begin(),nums.end()),nums.end());
//
// answer = nu... | ALGO | 0.998737 | 5.232632 |
68863d3f-aa57-49cf-b8cc-2370594a5558 | Raghav9797/Internship-Codes | Front_Back.cpp | #include <iostream>
#include <list>
using namespace std;
int main()
{
list<int> numbers = {1, 2, 3, 4, 5};
cout << "First Element: " << numbers.front() << endl;
cout << "Last Element: " << numbers.back() << endl;
return 0;
}
| TOOL | 0.918037 | 4.360243 |
4a730338-852f-4a22-ab32-df0fdfb3c195 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/july/ChefinaAndSwaps_20200705131221.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printVect(vect,dataStruc... | ALGO | 0.999971 | 3.300288 |
6ffc9d56-fa0f-442b-857a-c2d5803525d2 | AlvinJ15/CompetitiveProgramming | codeforces/prac/Oso.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> votos;
int n,oso,vote,max,resp=0;
scanf("%d",&n);
scanf("%d",&oso);
for(int i=1;i<n;i++){
scanf("%d",&vote);
if(vote>=oso)
votos.push_back(vote);
}
if(votos.size()==0){
printf("%d\n",0);
... | ALGO | 0.999959 | 3.325002 |
0cd0f4f5-65c8-4a0b-8fed-dfad7099d253 | Jackarain/avpn | third_party/boost/libs/compute/example/opencv_sobel_filter.cpp | //---------------------------------------------------------------------------//
// About Sobel Filter:
// * Edge Filter - distinguishes the differrent color region
// * Finds the gradient in x and y-axes
// * Three step process
// -> Find x-axis gradient with kernel/matrix
// Gx = [-1 0 +1]
// ... | ALGO | 0.997543 | 6.980258 |
e1148326-51d5-41ba-b363-ce4294c69c85 | shiningstarpxx/newstart | algorithm/leetcode/cpp/dp_1728.cpp | //
// Created by 裴星鑫 on 2022/5/10.
//
#include <string>
#include <vector>
using namespace std;
class Solution {
const static int N = 1000;
const static int S = 8 * 8 * 8 * 8;
public:
bool canMouseWin(vector<string>& grid, int catJump, int mouseJump) {
row_ = grid.size();
column_ = grid[0].size();
ca... | ALGO | 0.999759 | 5.771764 |
7cdafa18-dfd1-4787-855b-1056445f95e2 | pedrosorio/codesprint | twitchtv/Matching.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.999986 | 4.362503 |
27a10367-9a5f-45de-9186-22c4b80a573d | 0xAriseAizen-404/LeetCode-Solutions | 0039-combination-sum/0039-combination-sum.cpp | class Solution {
public:
vector<vector<int>> combinationSum(vector<int>& candidates, int target) {
vector<vector<int>> res;
vector<int> combination;
backTrack(res, combination, 0, candidates, target);
return res;
}
void backTrack(vector<vector<int>> &res, vector<int> &combina... | ALGO | 0.999947 | 6.712161 |
53d26e6b-e1db-41a1-80ab-58b971db014c | sabeelkhan99/HackerBlockAssignment | ptrn.cpp | #include<iostream>
using namespace std;
int main(){
int i,j,m=0,rows,n;
cin>>rows;
if(rows==0||rows%2==0)
return 0;
n=(rows+1)/2;
for(i=1;i<=rows;i++){
i<=n?m++:m--;
for(j=1;j<=rows;j++){
if(j<=n+1-m||j>=n-1+m)
cout<<"*"<<'\t';
else
... | ALGO | 0.999963 | 3.147003 |
a67310bd-e110-45b5-abd2-48a6d3c9a8ec | AnkeAgasi/Blok-in-time-Blokhuispoort | Library/PackageCache/com.unity.ide.visualstudio@2.0.12/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call made to Visual Studio can fail after ... | TOOL | 0.96573 | 6.969462 |
802c6f3c-1a94-4a4d-9b9c-24f5ba65313d | p-archive/NJUST_CSmaster_kaoyan | 2006/7.cpp | #include<bits/stdc++.h>
using namespace std;
// һĸλƵλ1234-4123
int f(int x){
if(x==0) return 0;
int decwidth = 0, t=x; //ʮƱʾµλ
while(t){++decwidth; t/=10;}
return (x%10)*int(pow(10,decwidth-1))+x/10;
}
int main() {
int i=10;
while(!( f(i)==4*i )) ++i;
printf("%d", i);
}
| ALGO | 0.999909 | 3.396775 |
39a9960b-756f-41a8-964b-420388db3d30 | VaibhavJha187/leetcode | 0088-merge-sorted-array/0088-merge-sorted-array.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
for(int i = 0 ; i<n ; i++){
nums1[i+m]= nums2[i];
}
sort(nums1.begin(),nums1.end());
}
}; | ALGO | 0.999954 | 5.301473 |
412eff97-340b-4f93-a761-db83c6396057 | jayshree-12/cpp-assignment | pair_array.cpp |
#include<iostream>
using namespace std;
int main()
{
//first method
pair <int,int> a[5]={{2,3},{2,7},{6,3},{7,9},{3,8}};
for(int i=0;i<5;i++)
{
cout<<"First value : "<<a[i].first<<" , Second value : "<<a[i].second<<endl;
}
//second method
pair <int,int> a[5];
for(int... | ALGO | 0.949459 | 3.424527 |
d131644f-3a3b-4b6d-93d8-170963f991d5 | MissoniF/RECURSIVE | recursiveInOrder.cpp | #include<iostream>
#include<vector>
void inOrder(std::vector<int>&, int, int);
int main(){
std::vector<int> v={1,2,3,4,5};
inOrder(v, 0, 0);
}
void inOrder(std::vector<int>& v, int i, int stop){
if(stop==v.size())
return;
std::cout << v.at(i) << std::endl;
stop++;
return inOrder(v, i+1, stop);
}
| ALGO | 0.999933 | 5.103008 |
e79ce187-f86e-493e-ad07-5cfaf0b2ab9c | ishmeet09/DSA | Dynamic Programming/25_BuySellStock4.cpp | #include<bits/stdc++.h>
using namespace std;
//here limit is k
int solve(vector<int>&prices,int i,int buy, vector<vector<vector<int>>>&dp,int limit){
if(i>=prices.size()||limit==0){
return 0;
}
if(dp[i][buy][limit]!=-1){
return dp[i][buy][limit];
}
int ... | ALGO | 0.999594 | 4.874699 |
03eccf27-7f2b-4db8-a6a3-221718febc70 | ctrl-bers/Activity | Function 3.cpp | // Design a calculator program that uses Function with argument but no return value.
#include <iostream>
using namespace std;
void calculator (float x , char y , float z);
int main ()
{
float n1, n2;
char opt;
// Input the User
cout << "Enter Operator (+, -, *, /) ";
cin >> opt;
cout << "Enter the Fir... | TOOL | 0.955452 | 4.78001 |
749eef28-eed9-4780-b617-952bd1c5e79b | hugh-wuyan/demo | 链表类模板.cpp | #include <iostream>
#include <iomanip>
using namespace std;
template<class T>
class node
{
T data;
node* next;
};
class linkedList
{
public:
linkedList();//캯
virtual ~linkedList();//עҪнڵԴ
void insert( int value );//棺ʼʹã
bool initiate();//ʼʹnewͷ㡣ʧܣfalsetrue
bool isEmpty();//жϵǷΪ
//ɾ... | ALGO | 0.999559 | 3.808891 |
ac0792d5-34cd-466a-9750-2381fa1fb8a2 | salvovitale/TDlibrary | src/main2.cpp | /*!
* \file main2.cpp
* \brief this program is to compute total/static conditions for SU2 config file.
* \author M. Pini, S. Vitale
* \version 1.0
*/
#include <iostream>
#include <stdio.h>
#include "math.h"
#include <cmath>
#include <stdlib.h>
#include "../include/fluid_model.hpp"
using namespace std;
double En... | ALGO | 0.999074 | 3.559545 |
ad7b2885-b0a0-4252-bcd3-6cb496b1a533 | vic-w/open3d_clone | examples/cpp/Octree.cpp | #include <chrono>
#include <functional>
#include <memory>
#include "open3d/Open3D.h"
using namespace open3d;
bool f_traverse(const std::shared_ptr<geometry::OctreeNode>& node,
const std::shared_ptr<geometry::OctreeNodeInfo>& node_info) {
if (auto internal_node =
std::dynamic_point... | TOOL | 0.90057 | 7.147631 |
0b3c7a94-88be-4acd-a372-7adf65acbe12 | KhronosGroup/LLVM-SPIRV-Backend | bolt/lib/Passes/HFSortPlus.cpp | #include "bolt/Passes/HFSort.h"
#include "llvm/Support/CommandLine.h"
#include <cmath>
#include <set>
#include <vector>
#define DEBUG_TYPE "hfsort"
using namespace llvm;
using namespace bolt;
namespace opts {
extern cl::OptionCategory BoltOptCategory;
cl::opt<unsigned> ITLBPageSize("itlb-page-size",
... | ALGO | 0.999335 | 5.303108 |
f478173a-74dc-434e-8af8-4bf76553af15 | andreyDagger/generating_functions_lab | C.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 998244353;
int binpow(int a, int p) {
if (!p) return 1;
if (p & 1) return a * binpow(a, p - 1) % MOD;
auto t = binpow(a, p >> 1);
return t * t % MOD;
}
void solve() {
int k; cin >> k;
vector<int> a(k);
for... | ALGO | 0.999926 | 3.354437 |
ab84e5ae-3a4e-470d-87e6-38304e497e38 | hhchoksi/CP-Solution | CODEFORCES/Bear_and_Three_Balls.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,a,b,c;
cin>>n;
vector<int> v;
bool found = false;
for(int i=0; i<n; i++){
int k;
cin>>k;
v.push_back(k);
}
sort(v.begin(),v.end());
for(int i=0;i<(n-2);i++){
for(int j=i+1;j<(n-1);j++){
... | ALGO | 0.999971 | 3.49884 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.