uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c76f87a2-cf7e-454b-9a5e-c91de310b1f2 | reginaflores/AlgoSims2016 | week05/3D_Springs/src/Particle.cpp | //
// Particle.cpp
// 3D_Springs
//
// Created by Regina Flores on 9/29/16.
//
//
#include "Particle.hpp"
Particle::Particle() {
pos.x = ofGetWindowWidth()*0.5;
pos.y = ofGetWindowHeight()*0.5;
pos.z = 0.0;
vel.set(0,0,0);
acc.set(0,0,0);
damp = 0.95; // de resistance!!!
radiu... | ALGO | 0.97251 | 6.188448 |
0405e61e-83cb-434b-abb0-31289bf04325 | ishandutta2007/codeforces | 12tqian/normal/1335/F.cpp | #pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include... | ALGO | 0.999775 | 4.619438 |
94e698d3-bffd-4ef7-9ecc-22d0845fd3ab | cp-geeks-adgitm/Hacktoberfest | CSES-Solutions/Increasing-Array.cpp | #include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define llu unsigned long long
#define endl "\n"
using namespace std;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<int> arr(n);
for(int i = 0; i < n; ++i) cin >> arr[i];
... | ALGO | 0.999978 | 4.113605 |
d1ced06f-ef04-4a42-abd8-d6521a8d5591 | enkilee/leetcode | .history/no206_20200414202702.cpp | /*
* @Author: your name
* @Date: 2020-04-14 20:25:44
* @LastEditTime: 2020-04-14 20:26:39
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \leecode\no206.cpp
*/
#include <iostream>
#include <cmath>
#include <vector>
#include <stack>
#include <map>
#include <algorithm>
usi... | ALGO | 0.999889 | 3.712706 |
2c0b1e47-7c95-4e05-b2c2-53eefb2fb0be | Ar0ni1/calculatorc- | calc/calc.cpp | #include <iostream>
#include <cmath>
#include <locale>
double add(double a, double b) {
return a + b;
}
double subtract(double a, double b) {
return a - b;
}
double multiply(double a, double b) {
return a * b;
}
double divide(double a, double b) {
return a / b;
}
double power(double base, double expone... | TOOL | 0.987515 | 3.619893 |
7f920225-b02d-434b-9db4-cfbd9bfb9186 | JinRIIS/Custom-QGC | libs/eigen/bench/bench_gemm.cpp |
// g++-4.4 bench_gemm.cpp -I .. -O2 -DNDEBUG -lrt -fopenmp && OMP_NUM_THREADS=2 ./a.out
// icpc bench_gemm.cpp -I .. -O3 -DNDEBUG -lrt -openmp && OMP_NUM_THREADS=2 ./a.out
// Compilation options:
//
// -DSCALAR=std::complex<double>
// -DSCALARA=double or -DSCALARB=double
// -DHAVE_BLAS
// -DDECOUPLED
//
#include... | TOOL | 0.937744 | 5.842831 |
caa6db6b-b3a7-41df-b690-ff39dd23cf4c | ElizabethBey/csap | Trees/task3.cpp | //Дано идеально-сбалансированное дерево. Подсчитать сумму листьев.
#include <iostream>
#include <cmath>
#include <queue>
using namespace std;
struct tree
{
int inf;
tree *right;
tree *left;
};
tree *node(int x)
{ //начальный узел
tree *n = new tree;
n->inf = x;
n->left = n->right = NULL;
... | ALGO | 0.999944 | 3.899185 |
ae784077-3474-40f4-a4d5-37d532b18dfd | WEGFan/Algorithm-Contest-Code | online-judge/CodeForces/CodeForces 1152A.cpp | #include <iostream>
using namespace std;
int arr[100007], brr[100007];
int main()
{
int n, m, sum1 = 0, sum2 = 0;
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
cin >> arr[i];
if (arr[i] % 2 == 1)
{
sum1++;
}
}
for (int i = 1; i <= m; i++)
{
... | ALGO | 0.999961 | 3.361562 |
d52fecb7-dc77-4032-9383-859d535a68e9 | datpham0412/data-structure-and-algorithms | Stack/CarFleet.cpp | #include <iostream>
#include <vector>
#include <algorithm>
class Solution {
public:
int carFleet(int target, std::vector<int>& position, std::vector<int>& speed) {
std::vector<std::pair<int, double>> pair;
for (int i = 0; i < position.size(); i++) {
pair.push_back({position[i], (double)... | ALGO | 0.999668 | 6.392807 |
b7d6537b-d83d-49d8-b802-d8eaec655389 | Af-Oaks/Beecrowd-solutions | 2001_3000/bee2380.cpp | #include <bits/stdc++.h>
using namespace std;
int tamanho[100001],fusao[100001];
int procurar(int x){
if(fusao[x]==x) return x;
return fusao[x] = procurar(fusao[x]);
}
void uniao(int banco1,int banco2){
banco1 = procurar(banco1);
banco2 = procurar (banco2);
if(tamanho[banco1]<banco2)
... | ALGO | 0.999972 | 4.05072 |
6920dd6e-95c6-44f1-9d8d-4b81e5b0d8ed | ttamx/Competitive-Programming | codechef/Meximal_Sum.cpp | #include "template.hpp"
#include "data-structure/segment-tree/segment-tree.hpp"
#include "group/monoid/min.hpp"
void runcase(){
int n;
cin >> n;
vector<int> a(n);
for(auto &x:a){
cin >> x;
}
vector<int> pre_mex(n),suf_mex(n);
{
int mex=0;
vector<bool> seen(n+1);
... | ALGO | 0.999783 | 3.979299 |
a9947df1-6ca6-4585-96da-6f3ba15274ec | ishandutta2007/codeforces | theoneyouwant/normal/445/A.cpp | #include<bits/stdc++.h>
#include <iomanip>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
char x;
cin>>n>>m;
char a[n][m];
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin>>x;
if(x=='-')
{
... | ALGO | 0.999775 | 3.545701 |
5b532f4f-b6c0-45a5-97a9-1d068618b361 | JKSL12/cppchat | boost_1_83_0/libs/multi_index/example/random_access.cpp | #if !defined(NDEBUG)
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
#endif
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/random_access_index.hpp>
#include <b... | ALGO | 0.884642 | 5.667584 |
585175b4-3445-4dc6-9173-fb8624a15629 | SjioGG/DOA-Exercises | Week_1-2_ListsADTsAndComplexity/Benchmark/Source.cpp | //#include <stdio.h>
//#include <time.h>
//
//int main() {
// int n = 20000000; // Set the value of 'n' as needed
//
// clock_t start_time, end_time;
// double cpu_time_used;
// start_time = clock(); // Record the starting time
//
// int sum = 0;
// for (int i = 0; i < n; ++i) {
// ++sum;
// ... | ALGO | 0.971994 | 3.983137 |
81bf5af8-a183-43a5-848a-de11c93c74bd | mdsaquibabbas313/Cpp-Classes-DS | stackLL.cpp | #include<iostream>
// #include<bits/stdc++.h>
#define N 3
using namespace std;
class node{
public:
int data;
node* next;
node(int data) {
this->data = data;
this->next = NULL;
}
};
void push(node* &head , int data) {
node* newnode = new node(data);
if(head == NULL) {
head = newnode;
return;
}
... | ALGO | 0.99881 | 3.852774 |
1265fafb-9e25-4d63-967d-f97df23054d5 | qaul/qaul.net_legacy | pjproject_android/third_party/BaseClasses/arithutil.cpp | #include <pjmedia-videodev/config.h>
#if defined(PJMEDIA_VIDEO_DEV_HAS_DSHOW) && PJMEDIA_VIDEO_DEV_HAS_DSHOW != 0
#include <streams.h>
//
// Declare function from largeint.h we need so that PPC can build
//
//
// Enlarged integer divide - 64-bits / 32-bits > 32-bits
//
#ifndef _X86_
#define LLtoU64(x) (*(unsigne... | TOOL | 0.853389 | 4.282292 |
c4e31d02-7e96-47ff-bd63-802ebec829ad | satyamjha2001/DSA-CPP-Coder-Army | 012.Function in CPP/4SwapTwoNumber.cpp | #include <iostream>
using namespace std;
void swapABC(int &, int &);
int main()
{
int a, b, c;
cout << "Enter value of A and B: ";
cin >> a >> b;
cout << "Before Swap \n A=" << a << " B=" << b<< endl;
swapABC(a, b);
cout << "After Swap \n A=" << a << " B=" << b<< endl;
return 0;
}
void s... | ALGO | 0.996684 | 4.757687 |
77942159-7c11-45e3-9242-66e153b9b6a7 | jiiink/DataStructure | DS_2023_STL_Part_1_1a/STL_1620___Numbers__1e/Numbers_600___Get_Binary_from_double_1b/Binary_200___int_represent.cpp | #include <stdio.h> /* printf */
#include <string.h> /* strcat */
#include <stdlib.h> /* strtol */
const char *byte_to_binary(int x) {
static char b[33];
b[0] = '\0';
int z; // 2^30 = 1073741824
for (z = 1073741824 ; z > 0; z >>= 1) {
strcat(b, ((x & z) == z) ? "1" : "0");
}
... | ALGO | 0.922074 | 4.970637 |
1cb932d0-c850-4598-a92d-5b98e7ef6226 | gajgeospatial/boost_1_81_0 | libs/graph/example/straight_line_drawing.cpp | #include <boost/graph/planar_canonical_ordering.hpp>
#include <boost/graph/is_straight_line_drawing.hpp>
#include <boost/graph/chrobak_payne_drawing.hpp>
#include <boost/graph/boyer_myrvold_planar_test.hpp>
using namespace boost;
// a class to hold the coordinates of the straight line embedding
struct coord_t
{
s... | ALGO | 0.998464 | 7.311324 |
4f3ab7d5-8aa5-42ea-9cd7-2792f1a5fa32 | krishkhinchi/140daysDSAofseries | Day10/Question6.cpp | // Pair Sum (Code360)
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int s = 5;
int arr[5] = {1, 2, 3, 4, 5};
vector<vector<int>> value;
for (int i = 0; i < 5; i++)
{
for (int j = i + 1; j < 5; j++)
{
if (arr[i] + arr[j] == s)
{
... | ALGO | 0.999592 | 5.013476 |
a0b23444-326b-4404-adf6-6c3e59e29125 | Shrey-Dubey-25/Leetcode | prog1.cpp | #include<iostream>
#include<vector>
using namespace std;
bool pallindrome(string s,int st){
int i=0,j=s.length();
s.erase(st,1);
cout<<st;
while(i<j){
if(s[i]==s[j]){
i++;
j--;
}
else{
return false;
}
}
return true;
}
int main... | ALGO | 0.999615 | 3.833472 |
829f0df6-bb8c-4033-b493-9b0a4faaed16 | ugis70194/PCK | ho/1.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long double A, T, R;
cin >> A >> T >> R;
cout << setprecision(8) << R*T / A << endl;
} | ALGO | 0.996852 | 3.793961 |
6aa59a8a-dc5d-4205-825e-a0756849cd50 | Sri-Hasini/leetcode-sync | 1080-camelcase-matching/camelcase-matching.cpp | class Solution {
public:
vector<bool> camelMatch(vector<string>& queries, string p) {
int n = queries.size();
vector <bool> ans;
for (auto i : queries) {
int k = 0;
int cnt = 0;
for (int j = 0; j < i.size(); j++) {
if (i[j] == p[k]) {
... | ALGO | 0.999425 | 6.102534 |
4cc6a8a7-32c4-4ffc-8bba-47ac84a8c102 | ws333666/HaiZei-OJ | 217.cpp | /*************************************************************************
> File Name: 217.cpp
> Author: ws
> Mail: <EMAIL>
> Created Time: 2020年01月08日 星期三 20时52分48秒
************************************************************************/
#include<iostream>
#include <algorithm>
using namespace std;... | ALGO | 0.999944 | 3.743434 |
ffc3998d-ae5d-4b80-b451-313025432748 | Noriaki416/StochasticGFMC | SSE/SSE_SpinlessFermion.cpp | // MPI version
// compile on jupiter3
// MPICH : mpiicpc SSE_SpinlessFermion.cpp
// single: icc -DNOMPI SSE_SpinlessFermion.cpp
#ifndef NOMPI
#include<mpi.h>
#endif
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <cstdlib>
#i... | ALGO | 0.99856 | 3.137836 |
d3f4fe6d-f1c7-42a0-be95-81bf3ab27e4b | hareeshghk/leetcode_solutions | 415-add-strings/415-add-strings.cpp | class Solution {
public:
string addStrings(string num1, string num2) {
int num1idx = num1.size()-1;
int num2idx = num2.size()-1;
string ans;
int sum, carry = 0, x, y;
while(num1idx >=0 || num2idx>=0) {
x = num1idx>=0?(num1[num1idx]-'0'):0;
... | ALGO | 0.999944 | 6.872761 |
44c159cc-b381-4c22-a117-526af2fd6b0c | gvnee/dataStructures-Algorithm | codeforces/assiut/4M.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) int((x).size())
#define pb push_back
void f(){
string s; cin>>s;
string h = "hello";
int k = 0;
for(int i = 0;i<sz(s);i++){
if(s[i] == h[k]){
k++;
if(k == 5){
cout<<"YES\n";
return;
}
}
... | ALGO | 0.999764 | 3.848964 |
5c51efde-9787-4c6f-926a-4eddde3d0052 | xiaoswu/Leetcode | 0413-Arithmetic-Slices/cpp/main.cpp | using namespace std;
class Solution {
public:
int numberOfArithmeticSlices(vector<int>& nums) {
if (nums.size() < 3) {
return 0;
}
int differ = 0;
int times = 0;
for (int i = 0; i <= nums.size() - 3; i++) {
// 确定差
if (nums[i+2... | ALGO | 0.999595 | 5.48525 |
eaf61a53-1426-46ad-bc30-1d626e03ea9a | amish0301/DSA-Codes | 263 - Ugly Number.cpp | class Solution {
public:
vector<int> primes = {2,3,5};
bool isUgly(int n) {
if (n < 1) return false;
for (int p: primes) while (n % p == 0) n /=p;
return n == 1;
}
};
// #Leetcode easy way
// T.C = S.C = O(1)
| ALGO | 0.9998 | 6.086329 |
3dc75cfb-b8d7-4b6f-bfe6-b56af4fb2ed4 | wenqiangwangsustech/FP16-LSRK | MenyuanEq/src_addSource_hw/src_willimson_wave_con/src_willimson_con/src_con_med_fp/run.cpp | #include "header.h"
void modelChecking( PARAMS params )
{
int thisRank;
MPI_Barrier( MPI_COMM_WORLD );
MPI_Comm_rank( MPI_COMM_WORLD, &thisRank );
if ( params.useMultiSource && params.useSingleSource )
{
params.useMultiSource = 0;
if ( 0 == thisRank )
printf( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!... | ALGO | 0.99946 | 4.922368 |
83d4feb0-a777-4dee-ad3b-ca724c56bc5f | radi676/Data-Structures-and-Algorithms-2023-2024 | Homeworks/Week 08/Task 01/Radi.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#define llong long long
using namespace std;
struct Site
{
llong X;
llong Y;
llong distance;
bool operator<(const Site &other) const
{
return distance == other.distance ? (X == ... | ALGO | 0.999972 | 3.366568 |
9df081fd-0db4-4bae-9bb4-f2363e397132 | cw3n/Summer-2022-Design-Analysis-Comp-Algorithm | Sorting, Searching, Computational Complexity/functions.cpp | //
// functions.cpp
// Sorting, Searching, Computational Complexity
//
// Created by Jonas Larson on 8/7/22.
//
#include <vector>
#include "functions.hpp"
#include "iostream"
#include <algorithm>
void bubbleSort(std::vector<int> dataset, long long setsize)
{
}
void printVector(std::vector<int> dataset)
{
for... | ALGO | 0.998915 | 4.05204 |
945c6280-05d6-4ab9-92d2-01a37945f00e | marioyc/Online-Judge-Solutions | COCI/2010-2011/Contest #2/IGRA.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
struct letter{
int pos;
char c;
letter(){}
letter(int _pos, char _c){
pos = _pos; c = _c;
}
bool operator < (letter X)const{
if(c==X.c) return pos>X.pos;
re... | ALGO | 0.999995 | 3.588808 |
460aa9ac-a0ed-41ef-a835-a9efa38ecdb8 | ishandutta2007/codeforces | rama_pang/normal/1662/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fr first
#define sc second
const long long inf=1e18;
long long n,st,fn,a[200069],nr[200069];
pair<long long,long long> as[200069];
queue<long long> q;
struct segtree
{
long long l,r,cr[2];
vector<pair<long long,long long>> vl[2];
segtree ... | ALGO | 0.999802 | 3.13372 |
cb00a945-0c59-4a57-9841-8bb469adcd7a | nimendoza/noi-2023 | training/week-5/hackables/droids-f/ProtonDecay314/208167423.cpp | /*
Insights: The thing is always a tree, with 1 as the root
So we go in reverse order
Let 2 mean destroyed
1 mean warned
and 0 mean processing
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> c(n, 0);
for(int i = 1; i < n; i++) {
cin >> c[i];
c... | ALGO | 0.999969 | 4.446354 |
1afa3633-49a6-4d1a-8ea7-46816e33a2ef | yfliu017258/CPP_programs | CodeForce/vjcp2w3/pa.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = a; i <= b; i++)
#define rvep(i, a, b... | ALGO | 0.999955 | 4.464077 |
154d793a-7fb5-49cd-9fc2-ddd8af7d48ee | JakubDrozd/Assignments | wejsciowka14_jakub_drozd.cpp | //#include <string>
//#include <iostream>
//#include <iomanip>
//
//
//class Zbior_z_powtorzeniami
//{
//private:
//
// class Element {
// public:
// std::string content;
// Element* nast;
// Element() {
// this->content = "";
// this->nast = nullptr;
// }
// Element(std::string content) {
// this->content =... | TOOL | 0.916039 | 4.224167 |
ce7e6215-e3af-4d02-9815-f89f328e8fa0 | CyanoProject/cyano | src/spork.cpp | #include "spork.h"
#include "base58.h"
#include "chainparams.h"
#include "validation.h"
#include "messagesigner.h"
#include "net_processing.h"
#include "netmessagemaker.h"
#include <boost/lexical_cast.hpp>
CSporkManager sporkManager;
std::map<uint256, CSporkMessage> mapSporks;
std::map<int, int64_t> mapSporkDefault... | TOOL | 0.901029 | 6.063525 |
73ed302e-5747-4019-a75c-3cfeeb2ce442 | Abdulrahman-Yasser/ProblemSolving | MostafaSaad_Udemy_Courses/Algorithms_1/2_Sorting/1_insertion_sort.cpp | #include <iostream>
#include <string>
void swap(int &a, int &b){
int temp = a;
a = b;
b = temp;
}
void insert(int a[], int num, int pos){
for(int i = num; i > pos; i--){
swap(a[i], a[i-1]);
}
}
/*
Challenge : code must be only 3 operations
*/
// void insertion_sort(int a[], int num){
... | ALGO | 0.999856 | 4.924974 |
b5f9c823-260b-40fd-bcba-f1b792abf741 | shubham21699/My-LeetCode-Solutions | 2463-minimum-total-distance-traveled/2463-minimum-total-distance-traveled.cpp | class Solution {
public:
long long minimumTotalDistance(vector<int>& robot, vector<vector<int>>& factory) {
int n = robot.size();
int m = factory.size();
sort(robot.begin(), robot.end());
sort(factory.begin(), factory.end());
vector<long long> dp(n+1, 100000... | ALGO | 0.999986 | 5.912583 |
6dfbe99f-f169-40de-9670-f38cc11af28b | timothyegans1/CS_1428_Lab_Assignments | prelab8/main.cpp | //Timothy Egans, tbe13
// Oct/22/2023
// Lab 8 Pre-Lab Assignment
// Add the following functions:
// 1. 'getRadius' asks the user to enter the radius of a circle
// and returns the given value. (should return a double)
// 2. 'calcArea' takes the radius and returns the area of a circle.
// 3. 'printResults' void... | TOOL | 0.984847 | 6.49307 |
a5d935a8-b720-4ce6-b9a3-c518de557762 | Xinghui-Wu/LeetCode | problem_167.cpp | /**
* 167. Two Sum II - Input Array Is Sorted
*
* Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number.
* Let these two numbers be numbers[index1] and numbers[index2] where 1 <= index1 < index2 <= numbers.leng... | ALGO | 0.999992 | 7.110342 |
89240a93-9535-4eb3-a115-6749d2ae05a9 | alexandraback/datacollection | solutions_2645486_0/C++/gleraromero/main.cpp | #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <vector>
using namespace std;
int EnergiaUsar(vector<int>& V, int N, int E, int R, int e, int c, int maximo)
{
if (c == maximo)
return e;
else
{
int EPosible = e + (maximo-c) * R;
int energiaUsar = (EPosible - E);
for (i... | ALGO | 0.999822 | 3.989499 |
388c2cdd-4520-4050-b0e5-f8cb5b2473bf | Amanhacker/Aman-Barnwal-Leetcode-Solutions | 590-n-ary-tree-postorder-traversal/590-n-ary-tree-postorder-traversal.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val) {
val = _val;
}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
public:
void postorderHelper(N... | ALGO | 0.999973 | 5.981174 |
52745c6e-2566-4633-94fa-8e0127dfc14c | zzents959/GW-Kinect-Depth-Camera | opencv/sources/samples/cpp/lsd_lines.cpp | #include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace std;
using namespace cv;
int main(int argc, char** argv)
{
cv::CommandLineParser parser(argc, argv,
"{input i|building.jpg|input image}"
... | TOOL | 0.946102 | 5.734313 |
403e6439-405b-455a-8864-dfaf475029f2 | asad5059/CP | C_Hamburgers.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define ff first
#define INF 1e18
#define ss second
using namespace std;
using namespace __gnu_pbds;
template <typename PB>
using ordere... | ALGO | 0.999306 | 3.583809 |
28b36ddc-ed7f-470b-b4d3-d0af3ec9ab0c | ameybh/competitive-programming | SPOJ/ACPC10A.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define repD(i,a,b) for(auto i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll>
#def... | ALGO | 0.998455 | 3.342706 |
1dd3a613-1485-401d-9cb1-8979114f37a7 | arifparvez14/Basic-and-competetive-programming | Online-Judge-Solution/UVA Solutions/10591(Happy Number).cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long i,j,k,d,sum,num,t,n;
while(scanf("%lld",&t)==1)
{
for(k=1; k<=t; k++)
{
scanf("%lld",&n);
num=n;
for(j=1; j!=0; j++)
{
sum=0;
for(i=1; i!=0; i++... | ALGO | 0.999668 | 3.8482 |
be5aab8f-aeb5-4e5d-9502-dc32d7ee76f7 | QuangPho-29/IT3150-Lab | W1/Double.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
if ( n < 1) return 0;
for (int i = 1; i <= n; i++) {
cout << i << ' ' << i*i << endl;
}
}
| ALGO | 0.994227 | 3.896512 |
0d6389ad-3882-4984-89a9-7fc4f2807f4f | cryptocosta/CostaCoin | tests/CoreTests/ChainSplit1.cpp | #include "ChainSplit1.h"
using namespace std;
using namespace CryptoNote;
gen_simple_chain_split_1::gen_simple_chain_split_1()
{
REGISTER_CALLBACK("check_split_not_switched", gen_simple_chain_split_1::check_split_not_switched);
REGISTER_CALLBACK("check_split_not_switched2", gen_simple_chain_split_1::check_split_n... | TEST | 0.879186 | 3.652712 |
2ffbcb01-f87a-44d3-8a32-095340d9fbdd | zjsxzy/Leetcode | Find Edges in Shortest Paths/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
struct edge {
int to, cost;
edge(int to, int cost) {
this->to = to;
this->cost = cost;
}
};
const int inf = 1e9;
vector<int> dijkstra(int st, vector<vector<edge>>& adj) {
// vector<vector<edge> > adj(n);
// construc... | ALGO | 0.999753 | 4.883926 |
6810aca7-041a-4e03-a93d-6d3e0730a636 | henrymound/2018-Summer-Research | Golang/Tello/references/opencv/modules/features2d/src/feature2d.cpp | #include "precomp.hpp"
namespace cv
{
using std::vector;
Feature2D::~Feature2D() {}
/*
* Detect keypoints in an image.
* image The image.
* keypoints The detected keypoints.
* mask Mask specifying where to look for keypoints (optional). Must be a char
* matrix with non-zero value... | ALGO | 0.951082 | 6.719954 |
f650ed75-9888-42f3-b1fe-4d0bef149c38 | jeete121/Coding | Programs/Practice/Prac/GraphAlgorithms/longest_palindrome_in_array.cpp | #include <bits/stdc++.h>
using namespace std;
bool isPalindrome(int n)
{
int rev = 0;
int m = n;
while (m > 0)
{
rev = rev * 10 + m % 10;
m = m / 10;
}
if (rev == n)
return true;
return false;
}
int longestPalindrome(vector<int> &arr)
{
sort(arr.begin(), arr.end(... | ALGO | 0.999718 | 5.49979 |
85e0a47d-6ca1-496c-99e1-4b074a0929cf | S-K-Hasan/cpp-files | Brain's Photos.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int r, c, co = 0;
cin >> r >> c;
char a[r][c];
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
cin >> a[i][j];
}
}
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
... | ALGO | 0.998736 | 4.737605 |
164a14d5-d2e0-4309-8e4a-0a199ffb9ecc | kudotoan/PTIT-THCS2 | C01209.cpp | #include <stdio.h>
struct pkm{
char ten[50];
int need,have,lever;
};
main () {
struct pkm list[1000];
int n,sum=0,nho=0,max=0;
scanf("%d",&n);
getchar();
for (int i=0; i<n; i++) {
gets(list[i].ten);
scanf("%d%d",&list[i].need,&list[i].have);
getchar();
list[i].lever=0;
while (list[i].have>=list[i].nee... | ALGO | 0.999286 | 3.209088 |
b99fa321-fed0-4836-bc38-4d993c789b2e | soolabettu/cp | gks/2020/roundB/4/sol.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9;
int main() {
int T;
cin>>T;
for (int t = 1;t <= T;++t) {
printf("Case #%d: ", t);
ll H, W, L, U, R, D;
cin>>H>>W>>L>>U>>R>>D;
vector<vector<double>> g(H+1, vector<double>(W+1, 0.0));
vector<vector<bool>> h(H+1, vector... | ALGO | 0.993868 | 3.410922 |
4aaf1938-43e4-4b17-b08b-b96c552a8af7 | Veni-K/Price--Extractor | 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 |
4ff92215-6e54-477c-a2ff-a59ed0bca063 | eunbc/cWorkspace | algorithm/0x09 BFS/7569_2.cpp | #include <bits/stdc++.h>
using namespace std;
int board[1000][1000];
int vis[1000][1000];
int n,m;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
int main(void){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> m >> n;
queue<pair<int,int>> Q;
for(int i=0; i<n; i++) {
for(int j=0; j<m; j++) {... | ALGO | 0.999991 | 4.650356 |
c7bd290d-a324-49a9-9549-29f2d5298cec | machuiwen/LeetCode-Solutions | Medium/UniqueBinarySearchTrees.cpp | class Solution {
public:
int numTrees(int n) {
vector<int> numTrees(n + 1, 0);
numTrees[0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 0; j < i; j++) {
numTrees[i] += numTrees[j] * numTrees[i - 1 - j];
}
}
return numTrees[n];
}... | ALGO | 0.999982 | 6.69686 |
adabbe35-6869-4f25-a542-b939c64b467d | ishandutta2007/codeforces | dhxh/normal/1575/A.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int n, m;
string str[maxn];
int c[maxn];
bool cmp(int x, int y){
for(int i=0;i<m;i++){
if(str[x][i] != str[y][i]){
if(i & 1){
return str[x][i] > str[y][i];
}else{
return str[x][i] < str[y][i];
}
}
}
return false;
}
int... | ALGO | 0.999981 | 4.057809 |
0fee660c-44c7-4e43-ab82-75e536deb6fc | heeba-khan/Leetcode-Solutions | 0260-single-number-iii/0260-single-number-iii.cpp | class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
int p=0;
for(int num:nums)
p^=num;
unsigned int lowestbit=p&-(unsigned int)p;
vector<int>v(2,0);
for(int num:nums){
if((lowestbit & num)==0)
v[... | ALGO | 0.999995 | 5.493012 |
1c236983-25ae-4723-934b-70d5d3f6f497 | arne182/Arne-058 | selfdrive/controls/lib/lateral_mpc/lib_mpc_export/acado_qpoases_interface.cpp | extern "C"
{
#include "acado_common.h"
}
#include "INCLUDE/QProblem.hpp"
#if ACADO_COMPUTE_COVARIANCE_MATRIX == 1
#include "INCLUDE/EXTRAS/SolutionAnalysis.hpp"
#endif /* ACADO_COMPUTE_COVARIANCE_MATRIX */
static int acado_nWSR;
#if ACADO_COMPUTE_COVARIANCE_MATRIX == 1
static SolutionAnalysis acado_sa;
#endif /* AC... | ALGO | 0.998955 | 5.058304 |
71e8c4ed-5993-4a32-9f69-38df242096fd | jackrabbit-start/PS | jan.cpp | /*
[NWERC'09] Wormholes
by: Jan Kuipers
*/
#include <iostream>
#include <iomanip>
#include <vector>
#include <deque>
#include <cmath>
#include <climits>
using namespace std;
struct point
{
int x, y, z;
};
int dist(point a, point b)
{
return (int)ceil(sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y... | ALGO | 0.999642 | 3.934811 |
411d59a2-0cd9-40b0-b169-2e06faf50144 | Kivenleeeeeen/XDOJ-C | 基础题库/87.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
int a;
scanf("%d", &a);
int sum = 0;
int cnt = 0;
while (a != 0)
{
if (a == 1)
{
sum += 1;
cnt = 0;
}
if (a == 2)
{
cnt += 1;
sum += 2 * cnt;
}
scanf("%d", &a);
}
printf("%d", sum);
}
| ALGO | 0.999353 | 3.349246 |
573ed460-5620-4e5d-9f11-f1bc818e96c2 | SepehrGanji/LeetCode-Solutions | Solutions/0026-remove-duplicates-from-sorted-array/solution.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int p1 = 0;
for(int p2 = 1 ; p2 < nums.size() ; p2++) {
if(nums[p2] == nums[p1]) continue;
swap(nums[++p1], nums[p2]);
}
return p1 + 1;
}
};
| ALGO | 0.999947 | 6.246305 |
a5715868-67c3-435a-a907-bc7ddff9f9eb | qbolec/c | small_test.cpp | #include<algorithm>
#include<vector>
#include<iostream>
#include<cstdlib>
using namespace std;
typedef pair<int,int> C;
typedef vector<C> L;
typedef vector<L> S;
typedef unsigned long long int lint;
C K(int a,int b){
return C((a<?b),(a>?b));
}
S rainbow(int k){
S r;
for(int i=0;i<k;++i){
L l;
for(int j=0;... | ALGO | 0.998708 | 3.477504 |
137c2b39-ba3b-4708-86b6-45207183de9b | Omprasad2948/c-cpp-programs | Giris classes C language/prme.cpp | #include<stdio.h>
#include<conio.h>
int main(){
int num,i,count;
for(num=1;num<=100;num++){
count=0;
for(i=2;i<num;i++){
if(num%i==0){
count++;
break;
}
}
if(count==0 && num!=1){
printf("%d ",num);
}
}
return 0;
}
| ALGO | 0.999423 | 3.828331 |
bf7de3b5-dfc9-4b9c-b7ef-677d6b11a98d | DEEPIKA-SUK/6Companies30Days | Amazon/Q5.cpp | // Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution{
public:
vector<vector<string>> displayContacts(int n, string c[], string s){
// code here
vector<vector<string>> ans;
vector<string> h;
... | ALGO | 0.999874 | 4.742195 |
75641c06-e20d-439b-9841-7c45672fe878 | raincross7/code-similarity | codes/train_code/problem066/problem066_25.cpp | #define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;
int main(){
priority_queue<int> q;
for (int i = 0; i < 5; ++i) {
int a;
cin >> a;
q.push(a);
}
for (int i = 0; i <... | ALGO | 0.999887 | 3.171402 |
04650482-1f7e-44af-8155-b6e168b61378 | Rajeshnds/Competitive-Programming | codeforces/dragonmas/codeforces(c++)/D1_Prefix_Suffix_Palindrome_Easy_version_.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
string s;
int f(int l,int r){
while(l<r&&s[l]==s[r])l++,r--;
return (l>=r);
}
void solve(){
int l=0,r=s.size()-1;
while(l<r&&s[l]==s[r])l++,r--;
int l2,r2;
for(l2=l;l2<=r;l2++)if(f(l2,r))break;
for(r2=r;r2>=l;r2--)if(f(l,r2))break;
cout... | ALGO | 0.999811 | 3.900604 |
9b428d06-6257-4696-b9d0-9e02b429d57e | Ashutxshj/Codeforces | C_Classy_Numbers.cpp | #include <iostream>
#include <vector>
#include <cstring>
using namespace std;
#define ll long long
// dp[pos][nonzero_count][tight][started]
ll dp[20][4][2][2];
string num;
ll solve(int pos, int nonzero_count, int tight, int started) {
// Base case: processed all digits
if (pos == num.length()) {
retu... | ALGO | 0.99982 | 5.580248 |
a535f27a-7f7f-4582-8883-01a3dd5ca18b | sarvex/leetcode-shakespeare | solution/0600-0699/0673.Number of Longest Increasing Subsequence/Solution.cpp | class Solution {
public:
int findNumberOfLIS(vector<int>& nums) {
int maxLen = 0, ans = 0, n = nums.size();
vector<int> dp(n, 1), cnt(n, 1);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < i; ++j) {
if (nums[i] > nums[j]) {
if (dp[j] + 1 > dp... | ALGO | 0.999998 | 6.394032 |
7776b65d-37f9-467e-821d-38b0977e962b | gosth/MyLeetcodeOpen | 122.Greedy.AC.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
if (prices.size() <= 1) {
return 0;
}
int result = 0;
for (size_t index = 1; index < prices.size(); ++index) {
const int profit = prices[index] - prices[index - 1];
if (profit > 0) {
... | ALGO | 0.999728 | 6.631568 |
9ef6951a-cc6c-43a6-b7a2-01d5077d718a | Eduardofig/Competitive-Programming-Solutions | cf-ladder/ladder-2/52.cpp | #include <bits/stdc++.h>
using namespace std;
using ui = unsigned int;
using l = long;
using ul = unsigned long;
using ll = long long;
using ull = unsigned long long;
const int MXN = 2e5 + 3;
const int INF = 0x3f3f3f3f;
const int MOD = 1e7 + 9;
ll n;
ll k;
//int a[MXN];
//int b[MXN];
//string s;
void solve()
{... | ALGO | 0.999958 | 3.745321 |
6df620b2-4f4e-4bea-88b8-a45e37885b78 | SR-Akash/Problem-Solving | Codeforces/fff.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll n;
ll x,y;
cin>>n;
while(n--)
{
cin>>x>>y;
if(x-y>1)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
| ALGO | 0.999731 | 3.957781 |
3a8a3cc8-38f3-4caa-ac7e-9ac4089e9931 | bhbduman/cseComputer_Organization | 2/hw2.cpp | #include <iostream>
using namespace std;
#define MAX_SIZE 20
int CheckSumPossibility(int num, int arr[], int size){
int returnVal1=0, returnVal2=0;
if (num == 0){//If sum becomes 0 that means it find a subset so it can return 1
cout<<",";//to split numbers like if there is more then one pairs which giv... | ALGO | 0.999883 | 4.254035 |
080b3f3a-d340-4354-a03b-5afb5d83b61b | scipopt/scip | src/dejavu/dejavu.cpp | #include <iostream>
#include "dejavu.h"
#include <chrono>
#include <string>
typedef std::chrono::high_resolution_clock Clock;
dejavu::ir::refinement test_r;
dejavu::sgraph dej_test_graph;
void empty_hook(int, const int*, int, const int *) {}
int commandline_mode(int argc, char **argv) {
std::string filename;
... | ALGO | 0.938757 | 5.950437 |
05c04474-a37f-4421-8f51-4d5d9e39a168 | AbhisekhNayek/Placement-Series-DSA | RECURSION/CombinationSum1.cpp |
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
void findCombination(int ind, int target, vector < int > & arr, vector < vector < int >> & ans, vector < int > & ds) {
if (ind == arr.size()) {
if (target == 0) {
ans.push_back(ds);
}
return;
}
... | ALGO | 0.999961 | 5.810193 |
b42c48fe-bb5a-4300-bf3a-d505798bf2cd | Aaditya8C/CP_DSA | lvl1000/raspberries.cpp | #include <bits/stdc++.h> // This will work only for g++ compiler.
#include <iostream>
#include <vector>
#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i < (int)(n); ++i) // 0 based indexing starts with 1
#define for11(i, n) for (int i =... | ALGO | 0.999725 | 4.206241 |
407e0adb-1642-4245-93e2-184a69d8e477 | Rizwansheik666/owl | 2917-count-pairs-whose-sum-is-less-than-target/count-pairs-whose-sum-is-less-than-target.cpp | class Solution {
public:
int countPairs(vector<int>& nums, int target) {
int cnt=0;
for(int i=0;i<nums.size();i++){
for(int j=i+1;j<nums.size();j++){
if(nums[i]+nums[j]<target) cnt++;
}
}
return cnt;
}
}; | ALGO | 0.999938 | 5.973045 |
868f9ec8-dc46-4028-8259-7e3c6090a12c | DGtal-team/DGtal | examples/geometry/volumes/fullConvexityAnalysis3D.cpp | /**
* @file geometry/volumes/fullConvexityAnalysis3D.cpp
* @ingroup Examples
* @author Jacques-Olivier Lachaud (\c <EMAIL> )
* Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
*
* @date 2021/06/20
*
* An example file named fullConvexityAnalysis3D
*
* This file is part of the DGtal libr... | ALGO | 0.993879 | 7.574437 |
f72edecd-ad43-477d-9666-57c59a0ef49f | MartinMSPedersen/Cplusplus-snippets | palidrom/BigInteger.cpp | #include <iostream>
#include <string>
#include "BigInteger.h"
BigInteger::BigInteger()
{
int i;
for (i=0; i<BIntMax; i++) digits[i]=0;
size=0;
}
BigInteger::BigInteger(signed int value)
{
int i;
for (i=0; i<BIntMax; i++) digits[i]=0;
i=0;
while (value!=0) {
digits[i]=value%10;
... | ALGO | 0.977627 | 5.601456 |
7bc46e42-141f-4812-b5e9-2cceea355360 | heoji1/opencvProject | Region/LaplacianGray.cpp | #include <iostream>
#include <opencv2/opencv.hpp>
#include <math.h> /* exp */
#define IM_TYPE CV_8UC3
using namespace cv;
// Image Type
// "G" for GrayScale Image, "C" for Color Image
#if (IM_TYPE == CV_8UC3)
typedef uchar G;
typedef cv::Vec3b C;
#elif (IM_TYPE == CV_16SC3)
typedef short G;
typedef Vec3s C;
#el... | ALGO | 0.997834 | 5.11272 |
7aa348c3-3e8b-4116-9d26-148326a5cdf7 | ishandutta2007/codeforces | zayin/normal/1616/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define mt make_tuple
#define rep(i,begin,end) for (__typeof(begin) i=(begin),_end=(end),_step=1-2*((begin)>(end));i!=_end;i+=_step)
// OUTPUT
template<class a, class b>
ostream& operator << (ostream& os, const pair<a,b>& p) {
os<<"("<<p.first<<",... | ALGO | 0.999919 | 4.140726 |
e301b4d4-002c-4953-bbfb-bcd4f793d213 | deepam20050/competitive-programming | solutions/102694A.cpp | // AC
#include "bits/stdc++.h"
using namespace std;
const int N = 3e5 + 5;
vector < int > g[N];
int dist[N];
bitset < N > vis;
queue < int > q;
int bfs (int x) {
memset(dist, 0, sizeof dist);
vis.reset();
vis[x] = 1;
q.emplace(x);
int node = 0;
int len = -1;
while (!q.empty()) {
int u = q.front();... | ALGO | 0.998338 | 3.814537 |
6f9c9f0f-e7bb-40c1-b991-97ca969f7689 | Anup0099/450DSA_Question | 1547-minimum-cost-to-cut-a-stick/1547-minimum-cost-to-cut-a-stick.cpp | class Solution {
public:
int f(int i,int j,vector<int>& cuts,vector<vector<int>>& dp){
if(i>j) return 0;
if(dp[i][j]!=-1) return dp[i][j];
int mini=1e9;
for(int ind=i;ind<=j;ind++){
int cost= cuts[j+1]-cuts[i-1]+f(i,ind-1,cuts,dp)+f(ind+1,j,cuts,dp);
mini=min(mini,cost);
}
return dp[i][j]=m... | ALGO | 0.999864 | 5.56373 |
b0ab8d51-0993-44ec-b645-57c7ee7ef4ff | pgupta11/HessianforML | cpp/thirdparty/eigen/doc/examples/Tutorial_BlockOperations_corner.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::Matrix4f m;
m << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10,11,12,
13,14,15,16;
cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl;
cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << ... | ALGO | 0.998689 | 4.092313 |
991319c2-5522-4fa3-80cf-938b6460ad3d | haranjackson/phd | code/cpp/src/system/energy/multi.cpp | #include "../../etc/debug.h"
#include "../../scipy/newton_krylov.h"
#include "../objects.h"
#include "eos.h"
#include "mg.h"
Vec obj(double ρ, double e, double λ, Vec2r x, Par &MP1, Params &MP2) {
Vec2 ret;
double p = x(0);
double ρ1 = x(1);
double ρ2 = (1 - λ) / (1 / ρ - λ / ρ1);
double e1 = E_1(ρ1, p, M... | ALGO | 0.999732 | 3.923007 |
6af0c402-b0d5-4007-9c7a-704e7f605e19 | shashankvrma/Codes | sort_a_vector_using_recursion.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
void insert(vector<int> &v, int temp){
if(v.size()==0 || v[v.size()-1] <= temp){
v.push_back(temp);
return;
}
int val = v[v.size()-1];
v.pop_back();
insert(v,temp);
v.push_back(val);
}
void sort(vector<int> &v)... | ALGO | 0.999975 | 4.629927 |
1f0133dc-8448-4d4c-895e-c8dfb6a6e485 | MartinSkachkov/Data-structures-and-algorithms | Seminars/Test-prep/Solutions3/Trees/print_childre.cpp | #include "tree-utils.h"
#include <iostream>
using namespace std;
template <typename T>
void printChildren(const Tree<T> *t) {
if (t == nullptr) {
return;
}
if (t->left == nullptr && t->right == nullptr) {
cout << t->data;
}
printChildren(t->left);
printChildren(t->right);
}
i... | ALGO | 0.888068 | 5.351305 |
edfccdbe-ae85-4b52-bed0-cc3f481e8e05 | psandbrook/white-star | deps/gdal/ogr/ogrsf_frmts/dgn/dgnstroke.cpp | #include "dgnlibp.h"
#include <cmath>
CPL_CVSID("$Id: dgnstroke.cpp 1dcdb5c8f617002a6e034d4d98dfdf080f709325 2018-01-14 01:50:09Z Kurt Schwehr $")
constexpr double DEG_TO_RAD = M_PI / 180.0;
/************************************************************************/
/* ComputePointOnArc() ... | ALGO | 0.990549 | 5.840092 |
5ff690a7-5046-4e8b-a6a5-9ef4c971ac7a | tanishq6818/DSA | POTD APRIL 21ST/GFG POTD.cpp | // Given an array of size n and a range [a, b]. The task is to partition the array around the range such that the array is divided into three parts.
// 1) All elements smaller than a come first.
// 2) All elements in range a to b come next.
// 3) All elements greater than b appear in the end.
// The individual elements... | ALGO | 0.999965 | 5.766801 |
d9e60d21-57f4-46e5-a188-4c870386ed1f | Kwon770/icon_c_lesson | soyeon/1011_mission.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
int a, b;
while (1){
scanf("%d %d", &a, &b);
if (a !=0 || b != 0)
printf("%d\n", a + b);
else
break;
}
return 0;
}
int solve1() {
int n, i;
scanf("%d", &n);
for (i = 1; i < 10; i++)
printf("%d * %d = %d\n", n, i, n * i);
return ... | ALGO | 0.998544 | 3.105571 |
4e170dbc-6575-440e-932d-ea61128aebb9 | vintitres/aoc2021 | enhance.cpp | #include<iostream>
#include<queue>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<map>
#include<list>
#include<climits>
#include<set>
#include<sstream>
#include<vector>
#include<stack>
#define PAD 55
using namespace std;
tuple<char, int> enh(vector<string> &img, const string &alg, char space = '.') {
... | ALGO | 0.999756 | 4.150409 |
333762b2-2e35-4df7-b026-ce5e948eb2a8 | maxlambertini/Warp2010 | libnoise/src/noiseutils.cpp | #include <fstream>
#include <noise/interp.h>
#include <noise/mathconsts.h>
#include "noiseutils.h"
#include <random>
#include <map>
#include <vector>
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
using namespace noise;
using namespace noise::model;
using namespace noise::module;
// Bitmap head... | TOOL | 0.901075 | 5.567014 |
01a93b04-4953-4248-9472-342d2be355bb | iamsuryakant/100-days-of-code | C++/skyscrapper.cpp |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int h;
long count = 0;
stack<pair<int, int>> s;
for (int i = 0; i < n; i++)
{
cin >> h;
while (!s.empty() && h > s.top().first)
s.pop();
if (!s.empty() && h == s.top().first)
... | ALGO | 0.999837 | 3.691492 |
0de58e08-1d9f-4e11-abae-57c1bb4d6ad5 | ZoeL21/Coursework_Imperial_College | Exam_Practice/Cplusplus_Exam_Practice/C++_intro/Ex6/Int_Arrays/arrays.cpp | #include "arrays.h"
#include <iostream>
using namespace std;
void input_array(int array[],int n){
cout<<"Enter "<<n<<" integers separated by a space."<<endl;
for(int i = 0; i < n; i++){
cin>>array[i];
}
cout<<"Thank you"<<endl;
}
void display_array(int array[],int n){
for(int i = 0; i < n;i++){
... | TOOL | 0.950795 | 3.631745 |
e6194432-823f-45c1-a0b0-2877c281f3a2 | SuperStarKang/Be_The_Monster | 1629.cpp | // #include <iostream>
// using namespace std;
// int arr[10];
// int check_double(int arr[], int idx) {
// for (int i=0; i<idx; i++) {
// if (arr[idx] == arr[i])
// return (idx-i);
// }
// return 0;
// }
// int main(void) {
// int A,B,C;
// cin>>A>>B>>C;
// int tmp = A;
// int i=1;
// int cnt;
// ar... | ALGO | 0.999971 | 3.671582 |
1858266f-25a0-434a-83f3-0d240996e012 | ctk0418/data_static | src/1/4-1-4.cpp | #include <windows.h>
#include <math.h>
#include <stdio.h>
#include <malloc.h>
double ret_function4_pdf(double x)
{ double ret_function;
ret_function=exp(-0.5*x*x);
return(ret_function);
}
int main() {
double ret_function; // ƭ
double lower,upper,inc,w,y,x1,sum;
// upperOܼƪW lowerOܼƪU
i... | ALGO | 0.999646 | 3.800231 |
a5f6f03f-6072-4421-8457-311d71cd1ab8 | orlandoisay/Competitive-Programming | COJ/2652.cpp | #include <stdio.h>
int g,b,k;
int main() {
scanf("%d %d %d",&g,&b,&k);
int teams = g/2 < b ? g/2 : b;
k -= g - (teams*2);
k -= b - teams;
g -= g - (teams*2);
b -= b - teams;
teams = g/2 < b ? g/2 : b;
if(k>0) {
while(k%3)
k++;
teams -= k/3;
}
pr... | ALGO | 0.999674 | 3.632176 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.