uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
db6942ae-9b7f-41c0-9beb-59e0a78ff1d6 | Arvinhahaha/C | [动态规划]拦截导弹3.cpp | #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#define N 300000
using namespace std;
bool cmp(int x,int y)
{
return x>y;
}
vector<int> a,b,c;
int main()
{
b.push_back(0);
int x,i=0,j;
int sum1=0,sum2=0;
while(cin>>x)
a.push_back(x);
vector<int>::iterator it=a.begin();
//ϸ
while(it!... | ALGO | 0.999769 | 3.255076 |
441c176a-062f-4184-b1f6-1e801713caf2 | su-giana/algorithm | baekjoon/5014.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
void init()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
void getCnt(vector<int>& elevator, int s, int u, int d)
{
int n = elevator.size();
deque<int> q;
q.push_back(s);
while(!q.empty())
{
... | ALGO | 0.999916 | 3.883581 |
30008dc2-b9cb-47d6-9fd9-982d5e9ae04a | owlpaw20/CPArchive | NOIP & CSP/[NOIP 2015] 子串.cpp | #include <iostream>
#define endl '\n'
using namespace std;
const int N = 1e3 + 10;
const int M = 2e2 + 10;
const int MOD = 1e9 + 7;
int n, m, K;
int f[M][M];
int s[M][M];
char a[N], b[M];
/* f[i][j][k] = a[1 ~ i] 中选取 k 段,可以匹配 b[1 ~ j] 的方案数
f[i][j][k] = f[i - 1][j][k] 不选 a[i] 的方案数
+... | ALGO | 0.99999 | 4.236659 |
e511e623-962d-4c2e-9fb1-ee8e58800962 | Aditya-A-Pardeshi/Coding-Hands-On | 2 CPP_Programs/6 Problems on N numbers dynamic memory allocation/7_DiffBetween_NoOfEvens_NoOfOdds/Main.cpp | /*
Accept N numbers from user and return difference between frequency of
even number and odd numbers.
Input : N : 7
Elements : 85 66 3 80 93 88 90
Output : 1 (4 -3)
*/
using namespace std;
#include<iostream>
void AcceptArrayElements(int arr[],int iSize)
{
cout<<"Enter array elements:\n";
for(int i=0;i<iSize;i++)
... | ALGO | 0.999558 | 4.996035 |
1b7225b8-6fe1-4c0f-9dcf-b947bc66548c | nikhil16072003/LeetCode | 234. Palindrome Linked List.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:
bool isPalindrome(Lis... | ALGO | 0.999689 | 5.938497 |
e67616c5-585d-4ae8-aa17-2ad2ae1459dd | PKingTeak/Project | NewWorld/NewMap/소스.cpp | #include<iostream>
#include<map>
using namespace std;
int main()
{
map<int, int> NewMap;
NewMap[0] = 10;
NewMap[2] = 5;
NewMap[5] = 1;
NewMap[3] = 1;
NewMap[6] = 1;
NewMap[10] = 1;
//
for (int i = 0; i < 6; i++)
{
cout << NewMap[i]<<endl;
}
} | ALGO | 0.993264 | 3.269669 |
de2f1019-034a-4031-b4e3-a47ed1f54395 | LorenzoMaci/Programmazione-I | Laboratorio/Programmazione 1/Esami/OOP/MZ/Esame_27_04_2022_MZ/esame2.cpp | #include<iostream>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<typeinfo>
#include<cfloat>
#define DIM 15
using namespace std;
class Wheel {
private:
int value;
int default_value;
int num_faces;
public:
Wheel(int initial_value, int num_faces){
valu... | ALGO | 0.981723 | 4.927068 |
555f11a1-9ea0-486f-abd1-994cfe2290b1 | Dollar-coin/Dollar | src/crypto/sha1.cpp | #include <crypto/sha1.h>
#include <crypto/common.h>
#include <string.h>
// Internal implementation code.
namespace
{
/// Internal SHA-1 implementation.
namespace sha1
{
/** One round of SHA-1. */
void inline Round(uint32_t a, uint32_t& b, uint32_t c, uint32_t d, uint32_t& e, uint32_t f, uint32_t k, uint32_t w)
{
... | ALGO | 0.998495 | 7.492628 |
d77fa211-8542-4d94-b758-3b9adda74c25 | itsabhijeetid/gfg-practice | Medium/Longest consecutive subsequence/longest-consecutive-subsequence.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
// arr[] : the input array
// N : size of the array arr[]
//Function to return length of longest subsequence of consecutive integers.
int findLongestConseqSubseq(int arr[], int N)
... | ALGO | 0.999485 | 5.615739 |
59934241-23a2-45db-a18d-ed3c07da354f | lcnzg/lammps-pi | src/USER-OMP/pair_comb_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "pair_comb_omp.h"
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "group.h"
#include "math_e... | ALGO | 0.999818 | 6.622456 |
067ebaef-298d-4e86-90ff-9f0a97b25ddb | AbhayDixitDev/cpp-cybrom | pattern_8.cpp | //Q.4)WAP to draw a pattern
//
//@@@@@
//@ @
//@ @
//@@@@@
//@ @
//@ @
//@@@@@
#include <iostream>
using namespace std;
int main() {
int n = 3; // number of repetitions
for (int i = 0; i < n; i++) {
// top and bottom lines
cout << "@@@@@@\n";
// middle lines
for (int j... | ALGO | 0.993618 | 5.143087 |
3e12011e-a3e8-4193-8293-8b40c4a38411 | Kainat-022/DSA-LAB2 | sum of array element.cpp | //sum of array element eith pointer
#include <iostream>
using namespace std;
int main() {
int integerArray[] = {1, 2, 3, 4, 5};
int* pointerToStart = integerArray;
int totalSum = 0;
for (int index = 0; index < 5; ++index) {
totalSum += *pointerToStart;
pointerToStart++;
}
cou... | ALGO | 0.996216 | 5.456256 |
35f53397-e2fe-4dc8-a374-54e2eee0dc1f | rahul-goel/CompetitiveProgramming | CodeForces/B/2 B.cpp | /*
Created by Rahul Goel.
*/
/*******************************************************************************/
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <un... | ALGO | 0.999974 | 4.845144 |
54c0a9ca-6da3-4ca2-b5ae-57bd7af20f6c | denis-gubar/Leetcode | Array/3187. Peaks in Array.cpp | class Solution {
public:
template<typename T>
struct FenwickTree
{
FenwickTree(size_t N) : N(N)
{
tree.assign(N, {});
}
FenwickTree(vector<T> const& A) : FenwickTree(A.size())
{
for (size_t position = 0; position < N; ++position)
add(position, A[position]);
}
void add(size_t position, T value... | ALGO | 0.99992 | 5.754656 |
5cb92f66-19ad-44b7-a48b-8a6260051f05 | mariolopg/ED-UGR | P5/arboles/abb/usoabb.cpp | #include <iostream>
#include <ABB.h>
using namespace std;
// El programa lee de la entrada estndar un conjunto de enteros hasta el fin
// de la entrada (EOF). Despus los lista todos, ordenados y sin repeticiones
int main (int argc, char *argv[]){
ABB<int> a;
int valor;
ABB<int>::Iterador it;
while (c... | ALGO | 0.996434 | 4.159596 |
027763ee-927f-4486-81f6-ca8d07797d0d | anhdung2k1/datastructure-algorithms | leetcode/rotate_list/main.cpp | #include <bits/stdc++.h>
using namespace std;
//* 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:
L... | ALGO | 0.999952 | 5.613056 |
1f7a288a-2db8-46bf-90e2-0122549f4223 | MCC-24/Funciones | Introduccion/OPERACIONES.cpp | //CANO CARRASCO MONSERRAT
// Programa que hace suma de funciones
#include <iostream>
using namespace std;
void suma (int a, int b);
int main (){
int a,b;
cout <<"escriba un numero para sumar : " <<endl;
cin >> a;
cout <<"escriba otro numero para sumar : " <<endl;
cin >> b;
suma (a... | ALGO | 0.979619 | 4.215382 |
516bffdb-e7d7-4b9e-8c4e-bb9a6ac32740 | edubuenos/trabalhao | 05.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
float checar (float a){
srand(time(NULL));
a = rand() % 5;
return a+1;
}
int main(){
float a= 0;
std::cout << "O numero sorteado e: " << checar(a);
}
| TOOL | 0.985934 | 3.081157 |
8c22489f-adde-4b95-b28c-32e576b85ff1 | lyxuansang91/BigKen | Classes/Handler/MauBinhCardHandler.cpp | #include "MauBinhCardHandler.h"
#include "Utils/TLMNConfig.hpp"
#include "cocos2d.h"
#include "Utils/Common.h"
#include <algorithm>
using namespace cocos2d;
using namespace std;
MauBinhCardHandler::MauBinhCardHandler(){
}
MauBinhCardHandler::~MauBinhCardHandler(){
}
const std::string MauBinhCardHandler::FIRST_BRANC... | ALGO | 0.963057 | 3.075505 |
992ae551-fba3-48aa-b223-b4ce9d9a9c7d | sourav-bhattacharya-github/DSA | DSA/GFG/Hashing/3_Sum_Find_All_Triplets_with_Zero_Sum.cpp | // Link: https://www.geeksforgeeks.org/find-all-triplets-with-zero-sum/
// C++ program to find all triplets with zero sum
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> findTriplets(vector<int> &arr)
{
// Map to store indices for each value
unordered_map<int, vector<int>> map;
// Resu... | ALGO | 0.999762 | 5.358049 |
9147e06e-ab01-4069-bc0c-fb177c46d447 | SDSarker/Data-Structure-and-Algorithm-1 | Informal_codes/Bari/temp.cpp |
#include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node *next;
Node *child;
Node (int x) {
data = x;
next = nullptr;
child = nullptr;
}
};
// function that flattens
// a multilevel linked list
void flattenList(Node *head){
Node* ... | ALGO | 0.999834 | 4.711352 |
c6ec2c7e-e7cd-4e59-8790-3809f9f9673f | priyanshi668/cpp_program | print even no. from1to 100.cpp | #include <iostream>
using namespace std;
int main() {
int sum = 0;
for (int i = 2; i <= 100; i += 2) { // Start from 2 and increment by 2
sum += i;
}
cout << "The sum of all even numbers between 1 and 100 is: " << sum << endl;
return 0;
}
| ALGO | 0.994168 | 4.528623 |
091a00ac-cae9-4532-a43c-bc0830b4ca4b | Artorias17/Online-Judge-Codes | Codeforces/1647D - Madoka and the Best School in Russia.cpp | #include <iostream>
#include <cmath>
using namespace std;
int check(long long target, long long d, long long other){
for(long long i=2; i<=(long long)sqrt(target); i++){
if(target % i == 0 && ((d*i % (d*d) != 0 && other*(target/i) % (d*d) != 0) || (other*i % (d*d) != 0 && d*(target/i) % (d*d) != 0))){
... | ALGO | 0.999691 | 5.663736 |
e454de65-c8d7-4ce7-807a-c4b14e364781 | ad-freiburg/completesearch | src/fuzzysearch/Utils.cpp | #include <string.h>
#include <string>
#include "../fuzzysearch/Utils.h"
namespace FuzzySearch
{
// ____________________________________________________________________________
int utf8_tolower(char* p)
{
// CASE: normal character
if (*p > 0)
{
*p = tolower(*p);
return 1;
}
// CASE: some more complex... | TOOL | 0.930127 | 5.671038 |
04ebbfff-7b2a-40eb-bb55-508b6c09f9a6 | Sakshi-Sunthakar/DSA_Practice | c++/cn2.cpp | #include <iostream>
using namespace std;
int findDuplicate(int arr[], int n){
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(i==j)
{
continue;
}
else
{
if(arr[i]==arr[j])
{
... | ALGO | 0.999843 | 3.801343 |
e71e73f9-283b-4c5a-8e83-c6fcec542bf3 | zhangxiaohu057/SensorsCalibration | online_calib/vins_camera2imu/eigen3/doc/examples/Tutorial_ArrayClass_addition.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(3,3);
ArrayXXf b(3,3);
a << 1,2,3,
4,5,6,
7,8,9;
b << 1,2,3,
1,2,3,
1,2,3;
// Adding two arrays
cout << "a + b = " << endl << a + b << endl << endl;
// Subt... | ALGO | 0.894908 | 3.642258 |
75dad57d-c379-4d85-9621-e44deb839567 | Roonil03/LeetCodeR03 | ProblemStatements/0371. SumOfTwoIntegers/sumofTwoIntegers.cpp | class Solution {
public:
int getSum(int a, int b) {
while(b){
int c = (a&b) << 1;
a = a ^ b;
b = c;
}
return a;
}
}; | ALGO | 0.999914 | 4.957912 |
65c372fe-2b53-4a0e-8d6a-e150b1384be4 | RenouveauOS/android_frameworks_native | cmds/installd/otapreopt_parameters.cpp | #include "otapreopt_parameters.h"
#include <android-base/logging.h>
#include "dexopt.h"
#include "installd_constants.h"
#include "otapreopt_utils.h"
#ifndef LOG_TAG
#define LOG_TAG "otapreopt"
#endif
namespace android {
namespace installd {
static bool ParseBool(const char* in) {
if (strcmp(in, "true") == 0) {... | TOOL | 0.870032 | 7.070576 |
9fe0ccd1-f32a-4e8b-a9ff-435eadd4ef54 | sansriti14/Leetcode | 0935-knight-dialer/0935-knight-dialer.cpp | class Solution {
public:
int knightDialer(int n) {
const int mod = 1e9 + 7;
long dp[n][10];
for(int i=0;i<10;i++) {
dp[0][i] = 1;
}
for(int i=1;i<n;i++) {
dp[i][0] = (dp[i-1][4] + dp[i-1][6])%mod;
dp[i][1] = (dp[i-1][6] + dp[i-1][... | ALGO | 0.999957 | 5.952503 |
341abe44-fdaa-4a35-bf9d-cfe6f5132759 | grx62203/leetcode | 1、acwing/算法基础课/算基-3-spfa-acwing852spfa判断负环.cpp | /*
给定一个 n 个点 m 条边的有向图,图中可能存在重边和自环, 边权可能为负数。
请你判断图中是否存在负权回路。
输入格式
第一行包含整数 n 和 m。
接下来 m 行每行包含三个整数 x,y,z,表示存在一条从点 x 到点 y 的有向边,边长为 z。
输出格式
如果图中存在负权回路,则输出 Yes,否则输出 No。
数据范围
1≤n≤2000
1≤m≤10000
图中涉及边长绝对值均不超过 10000
*/
/*
spfa求负环
1、和bellman算法一样,也是用抽屉原理求负环
2、spfa求负环
初始化邻接链表(有了权重就要多一个数组存储边的权重)
spfa()
for 遍历所有... | ALGO | 0.999902 | 4.384719 |
2eb46b82-86ee-43b1-8ec1-6b23d107d94d | sanskardagade/Cpp-with-DSA | HOMEWORK/DPP 28/question1rec.cpp | #include<iostream>
using namespace std;
void print(int x,int n){
if(x>=n){
cout<<n<<" ";
return;
}
cout<<x<<" ";
print(x+1,n);
cout<<x<<" ";
}
int main(){
int n;
cout<<"Enter n :";
cin>>n;
print(1,n);
} | ALGO | 0.999464 | 4.066159 |
635887ad-dceb-4829-be1f-a0b396fcb95c | Abhaycl/CarND-Path-Planning-3P1 | src/Eigen-3.3/doc/examples/class_CwiseBinaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template binary functor
template<typename Scalar> struct MakeComplexOp {
EIGEN_EMPTY_STRUCT_CTOR(MakeComplexOp)
typedef complex<Scalar> result_type;
complex<Scalar> operator()(const Scalar& a, const Scalar& b... | ALGO | 0.941178 | 6.700232 |
790296f6-70ca-4af5-a026-89454000a971 | BKCoGames/Infinity-Engine | ThirdPartyLibs/boost_1_84_0/libs/sort/benchmark/single/benchmark_objects.cpp | //----------------------------------------------------------------------------
/// @file benchmark_objects.cpp
/// @brief Benchmark of several sort methods with different objects
///
/// @author Copyright (c) 2016 Francisco José Tapia (<EMAIL> )\n
/// Distributed under the Boost Software License, Version 1.0.\n... | TEST | 0.965615 | 6.419522 |
d98c1199-833e-4b4f-8e19-58aa6bf28bdc | BorodiBogdan/Z-Builders-9th-Grade | phi_indicatorulLuiEuler.cpp | #include <iostream>
using namespace std;
int pow(int n, int m)
{
int p=1;
while(m>0) {p=p*n; m--;}
return p;
}
int main()
{
int n,d=2,cn,p=1;
cin>>n;
cn=n;
/* while(cn>1)
{
if(cn%d==0)
{
while(cn%d==0) cn=cn/d;
n=n/d*(d-1); //cu verde
}
... | ALGO | 0.999995 | 4.068556 |
e5c376fc-c4a0-4151-90cb-86d06d56d7f0 | CBN-Project/CBN | src/hash.cpp | #include "hash.h"
#include "crypto/hmac_sha512.h"
#include "crypto/scrypt.h"
inline uint32_t ROTL32(uint32_t x, int8_t r)
{
return (x << r) | (x >> (32 - r));
}
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char>& vDataToHash)
{
// The following is MurmurHash3 (x86_32), see http:... | ALGO | 0.984861 | 4.98316 |
3502e9a5-5765-4c1e-be58-85b0115f9a42 | vdhudenkih/labs | classes/13/main.cpp | ?#include "Pair.h"
#include <iostream>
#include <list>
#include <queue>
#include <numeric>
#include <algorithm>
#include <map>
using namespace std;
void ex_1()
{
cout << " : " << endl;
int n;
cin >> n;
list<Pair> lst;
Pair p;
for (int i = 0; i < n; i++)
{
cin >> p;
lst.push_back(p);
}
//1
Pair sr = acc... | ALGO | 0.997272 | 3.353148 |
90677454-8c56-45c2-81c5-c6c752bcf1d3 | CliffKai/Code_log | LeetCode_log/Daily question/42.cpp | #include <iostream>
#include <vector>
using namespace std;
//方法3:双指针
int trap(vector<int>& height)
{
int r = height.size() - 1,l = 0,rm = 0,lm = 0,ans = 0;
while(l < r)
{
lm = max(lm,height[l]);
rm = max(rm,height[r]);
if(height[l] < height[r])
{
ans += lm - he... | ALGO | 0.999918 | 5.594182 |
6519c252-3f21-4471-88c2-c3c59a758d7a | nandeeshbhatrai/codeforces-chef-problems | D_Find_the_Different_Ones.cpp | #include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target(... | ALGO | 0.999823 | 4.371285 |
7c44c9a9-e775-48e0-911d-bfdf6fb5509d | pairinteraction/pairinteraction | src/cpp/src/diagonalize/DiagonalizerFeast.cpp | #include "pairinteraction/diagonalize/DiagonalizerFeast.hpp"
#include "pairinteraction/enums/FloatType.hpp"
#include "pairinteraction/utils/eigen_assertion.hpp"
#include "pairinteraction/utils/eigen_compat.hpp"
#include <Eigen/Dense>
#include <cmath>
#include <optional>
#include <spdlog/spdlog.h>
#ifdef WITH_MKL
#in... | ALGO | 0.998547 | 6.574709 |
8998ed7a-a435-48da-b17a-329ba57b0223 | Franzzzzzzzz/NDDEM | src/CoarseGraining/Reader-Liggghts.cpp | #include "Reader-Liggghts.h"
//-----------------------------------------------------------
vector<vector<double>> LiggghtsReader::get_bounds()
{
vector<vector<double>> res(2, vector<double>(3,0)) ;
string line ;
do
{
getline(*in, line) ;
}
while ( in->good() && line.find("BOX BOUNDS")==string::npos) ;
i... | TOOL | 0.973256 | 3.915352 |
d33931a6-aab8-496a-a7e7-106455b65061 | Dallasfan9/Dallasfan9-Artist-D-Marlin-FW | Marlin/src/gcode/bedlevel/G35.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(ASSISTED_TRAMMING)
#include "../gcode.h"
#include "../../module/planner.h"
#include "../../module/probe.h"
#include "../../feature/bedlevel/bedlevel.h"
#if HAS_MULTI_HOTEND
#include "../../module/tool_change.h"
#endif
#if ENABLED(BLTOUCH)
#include "../../feature/b... | TOOL | 0.975789 | 6.076293 |
06e28a8e-1044-4bc1-91ac-c47254704d40 | Anxy02/Refuse-Classification-Machine | src/table_arm/src/ar_label_stack.cpp | #include <ros/ros.h>
#include <iostream>
#include <string.h>
#include <string>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdbool.h>
#include <std_msgs/Int8.h>
#include <std_msgs/Float32.h>
#include <std_msgs/String.h>
#include <mo... | TOOL | 0.968094 | 3.255647 |
64d1d3bd-b4d4-4983-9409-fd1fc371b928 | 071yoon/Algorithm | Daily/2022_02/2022_02_18/11656/11656.cpp | #include <algorithm>
#include <vector>
#include <cstring>
#include <iostream>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
string str;
cin >> str;
vector <string> vec;
for(int i = 0; i < str.size(); i++){
string tmp = str.substr(i, str.size());
vec.push_back(tmp);
}
sort(... | ALGO | 0.999976 | 4.709316 |
5b1d3d57-6fe7-47da-bbb1-9f240a4ed661 | lienduo/OSS | boost_1_46_1/libs/math/example/policy_eg_3.cpp | #ifdef _MSC_VER
# pragma warning (disable : 4305) // 'initializing' : truncation from 'long double' to 'const eval_type'
# pragma warning (disable : 4244) // conversion from 'long double' to 'const eval_type'
#endif
#include <iostream>
using std::cout; using std::endl;
//[policy_eg_3
#include <boost/math/distributi... | ALGO | 0.865959 | 4.423095 |
07267bfb-9ed5-4956-94c6-4d667d78a719 | Charul2304/Leetcode_DSA | 1285-balance-a-binary-search-tree/balance-a-binary-search-tree.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.999983 | 6.622752 |
27fb7b72-3b95-4ab6-ae63-eea3d4286b64 | BAHUANNN/C-practice | C++/PAT/pat37.cpp | #include <iostream>
using namespace std;
int main()
{
int a1,a2,a3,b1,b2,b3;
int c1,c2,c3,z1,z2,cha;
int Galleon = 17*29,Sickle =29;
scanf("%d.%d.%d",&a1,&a2,&a3);
scanf("%d.%d.%d",&b1,&b2,&b3);
z1=a1*Galleon+a2*Sickle+a3;
z2=b1*Galleon+b2*Sickle+b3;
if(z1>z2) {cha = z1-z2;cout<<"-";}... | ALGO | 0.998722 | 3.009646 |
0d6297a4-878e-4243-8f5d-06aecca2eea6 | harry-dev98/CompetitiveCodingSolutions | codeforces/233A_PerfectPermutation.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
if(n%2 == 1){
cout<<-1<<"\n";
}
else{
for(int i=n; i>0; i--){
cout<<i<<" ";
}
}
cout<<"\n";
return 0;
} | ALGO | 0.999816 | 4.361535 |
9c169e83-7afd-4738-a877-00ae025c6732 | TD2106/Competitive-Programming | Codeforces/B. Maximum Sum of Digits.cpp | #include <bits/stdc++.h>
#define bug(x) cout << #x << " = " << x << endl
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define reset(x) memset(x,0,sizeof(x))
#define up(i,l,r) for(int i... | ALGO | 0.999836 | 4.33031 |
9b78eb1b-f4c8-4da9-b5d3-3293a0172e8d | p1zzaf/Ckonal | app/config_parser.cpp | #include "config_parser.hpp"
#include <iostream> // For potential debug output
namespace ckonal {
namespace app {
Config ConfigParser::parse(const std::string& filename) {
sections.clear();
std::ifstream infile(filename);
if (!infile.is_open()) {
throw std::runtime_error("Failed to open config fil... | CONFIG | 0.949598 | 7.252061 |
2de551ea-9219-4a91-a3f5-4cc545682b98 | elysia-best/gazebo-classic | deps/opende/GIMPACT/src/gim_tri_tri_overlap.cpp | #include <cmath>
#include "GIMPACT/gim_trimesh.h"
/// \brief check if two values are equal, within a tolerance
/// \param[in] _a the first value
/// \param[in] _b the second value
/// \param[in] _epsilon the tolerance
template<typename T>
inline bool equal(const T &_a, const T &_b,
const T &_epsilon = 1e-6)
{
r... | ALGO | 0.999736 | 7.079327 |
37e0c919-2189-4cfc-8ebd-f2e4ba598ff9 | hareeshghk/leetcode_solutions | 316-remove-duplicate-letters/316-remove-duplicate-letters.cpp | class Solution {
public:
string result;
string removeDuplicateLetters(string s) {
result = "";
stack<char> st;
unordered_map<char, int> lastoccurrence;
unordered_set<char> seen;
for (int i = 0; i < s.length(); ++i) {
lastoccurrence[s[i]] = i;
}
... | ALGO | 0.999992 | 6.91586 |
1a598fd2-aedb-45c5-8b24-e6165b570ed1 | kentjhall/mizu | compat/video_core/shader/decode/half_set.cpp | #include <array>
#include "common/assert.h"
#include "common/common_types.h"
#include "common/logging/log.h"
#include "video_core/engines/shader_bytecode.h"
#include "video_core/shader/node_helper.h"
#include "video_core/shader/shader_ir.h"
namespace VideoCommon::Shader {
using Tegra::Shader::Instruction;
using Tegr... | ALGO | 0.975014 | 7.229051 |
e10952c5-c034-47e8-b5d8-3a366c527e1d | vamcrizer/cpp-ptit | biden/Vietnamese/54.Nhonhat - Lonnhat.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> v;
string minimum(int m, int s){
if(s > m * 9 || m > 1 && s == 0) return "-1";
v.resize(m, 0);
string res = "";
s -= 1;
for(int i = m - 1; i >= 0; i--){
if(s > 9){
v[i] = 9;
s -= 9;
} else {
v[i] = s;
s = 0;
}
}
v... | ALGO | 0.999506 | 4.673201 |
531308d1-439a-4a30-966a-18fabd2eba24 | aksaddleback/s2025cs1b | S05/p04.cpp | #include<iostream>
using namespace std;
void printArray(int a[], int count) {
cout << "Here is the array: \n";
for(int i = 0; i < count; i++) {
cout << *(a + i) << endl;
//cout << a[i] << endl;
}
}
int findMax(int* arr, int size) {
int max = *arr;
for(int i = 1; i <... | ALGO | 0.990047 | 4.466855 |
f477851c-2d5c-40bf-8899-2fde0eecef95 | satyamdash/c-_codes | Lecture-14_BitManipulation/Q2.cpp | #include<iostream>
using namespace std;
int numberofones(int n)
{
int count;
while(n)
{
n=n&(n-1);
count++;
}
return count;
}
int main()
{
int n;
cin>>n;
int ans;
ans=numberofones(n);
cout<< ans;
} | ALGO | 0.999892 | 4.361682 |
efd68de6-11bc-44a4-a7f3-0f8bea074fbd | wzqlalala/games101course | testCode/Eigen3/unsupported/test/BVH.cpp | #include "main.h"
#include <Eigen/StdVector>
#include <Eigen/Geometry>
#include <unsupported/Eigen/BVH>
namespace Eigen {
template<typename Scalar, int Dim> AlignedBox<Scalar, Dim> bounding_box(const Matrix<Scalar, Dim, 1> &v) { return AlignedBox<Scalar, Dim>(v); }
}
template<int Dim>
struct Ball
{
EIGEN_MAKE_ALIGN... | TEST | 0.995284 | 6.645863 |
d10483cc-aeca-401f-8eac-5f43ed56e725 | adamoz1/contactapp | 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.9988 | 6.76073 |
79ddc85f-542f-46ff-b7db-38dfbf3e835e | Dennitz/chdb | src/Processors/QueryPlan/Optimizations/liftUpUnion.cpp | #include <Processors/QueryPlan/Optimizations/Optimizations.h>
#include <Processors/QueryPlan/UnionStep.h>
#include <Processors/QueryPlan/ExpressionStep.h>
#include <Interpreters/ActionsDAG.h>
namespace DB::QueryPlanOptimizations
{
size_t tryLiftUpUnion(QueryPlan::Node * parent_node, QueryPlan::Nodes & nodes)
{
if... | ALGO | 0.916232 | 6.056515 |
1f5047ba-4f74-4fbe-9a77-6c67d9677fea | Ashraful-islam26/CPP | String/string_3.cpp | #include <bits/stdc++.h>
using namespace std;
// Find the First Non-Repeating Character
void firstNonRepeatingCharacter(string s);
int main()
{
string s;
cin >> s;
firstNonRepeatingCharacter(s);
return 0;
}
void firstNonRepeatingCharacter(string s)
{
unordered_map<char, int> freq;
for (char ... | ALGO | 0.999896 | 4.545729 |
91437d49-a916-4544-a535-2f09c105faca | openwebf/samples | demos/nextjs_ssr/app/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.998585 | 6.763549 |
d92a4923-2211-48b1-a606-19027c388547 | sastava007/Tech-Interview-Preparation | Coding Blocks/Recursion and Backtrackking/SumITUp.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define deb(x) cout<<#x<<" "<<x<<"\n";
set<vector<int>> ans;
vector<int> v;
bool sumItUp(int i, int n, int *a, int t)
{
//base case
int j;
if(t==0)
{
ans.insert(v);
return false;
}
for(j=i;j<n;j++)
{
... | ALGO | 0.999902 | 3.356728 |
83a80e9a-71f6-4da4-a04e-e5b0d27c62e4 | cepdnaclk/e20-3yp-FlickNest | symbol_mapping/idle_wave_updown_circle/symbol_mapper_cloned2_inferencing/src/edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.cpp | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h"
#include <algorithm>
#include <cmath>
#include <limits>
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/compatibility.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/cppmath.h"
namespace tflite {
namespace {
... | ALGO | 0.993022 | 7.74844 |
96321496-461b-4aa2-ac57-20ffc805c4a3 | elvircrn/ccppcodes | jump.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <stack>
#include <utility>
#include <map>
#include <cmath>
#include <cctype>
using namespace std;
int to_int(char c)
{
if ('A' <= c && c <= 'Z')
re... | ALGO | 0.994891 | 3.478091 |
ebed0158-c106-4d0e-9ff2-9facf43fc244 | akormous/dsa | 1_Arrays_and_Vectors/CommonElementsIn3Sorted.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
unordered_set<int> intersection(int x[], int y[], int p, int q)
{
unordered_set<int> s;
// two pointer approach to find the intersection
int i = 0, j = 0;
... | ALGO | 0.999664 | 4.805531 |
f6c46be7-7c2b-41cd-8e25-36f37b71ec52 | Saltykub/CP | codeforce/1810C.cpp | #include<bits/stdc++.h>
#define ll long long
#define st first
#define pii pair<ll,ll>
#define nd second
#define pb push_back
using namespace std;
map<int,int> mp;
vector<ll> v;
void solve()
{
int n,c,d;
cin>>n>>d>>c;
ll cost=LLONG_MAX;
ll plus=0;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
if(mp[x]=... | ALGO | 0.998946 | 3.821093 |
eb9366fd-c52c-4112-8154-24d6060c4530 | sachinkumarS-K/bootCamp | Day8-Array/4.2sum.cpp | #include<iostream>
#include <bits/stdc++.h>
using namespace std;
void findPair(vector <int> &arr , int t){
int l = 0, h = arr.size() - 1;
while(l<h){
if((arr[l] + arr[h]) == t){
cout << l << " " << h;
break;
}
... | ALGO | 0.999717 | 4.895314 |
0901c366-60f0-495c-85fe-6be4a64d1be6 | ayaancdry/dsa_implementations | priority_queues/min_heap.cpp | /*
Problem Statement: Given an array of integers, find the K largest elements in the array using a min-heap.
Input Format:
The first line contains two space-separated integers N and K, where N is the size of the array and K is the number of largest elements to find.
The second line contains N space-separated integers ... | ALGO | 0.999991 | 5.819727 |
1c81dbd7-d2b3-48e1-b6f7-6f452d21a5af | nafi103/Solved-Problems | Practice/2024/B_Journey.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
/****************************************************************/
#define int long long
#define pi acos(-1.0)
#define mod 998244353
#define inf... | ALGO | 0.999919 | 4.612654 |
6577cb6e-8989-45b3-ae53-32732b6189e5 | souravdas142/CodingOJPrac | Difficulty: Hard/The Painter's Partition Problem-II/the-painters-partition-problem-ii.cpp | // User function template for C++
class Solution {
public:
int is_possible(vector<int>& arr, int n, int maxTime,int painters) {
int sum = 0;
int painter = 1;
for(int i = 0;i<n;i++) {
sum+=arr[i];
if(sum>maxTime) {
painter++;
sum = ar... | ALGO | 0.99994 | 5.650915 |
d436192e-f7be-40ad-903c-22404d98c38a | ivanlamega/dragon-ball-online-tw-server | Libraries/NtlLib/Shared/PathEngine-5.04/code/libs/Content_Processing/ExternalShapeTraversal.cpp | #include "platform_common/Header.h"
#include "ExternalShapeTraversal.h"
#include "libs/Mesh_Common/interface/Mesh.h"
#include "libs/Mesh_Common/interface/ElementsTraversal.h"
#include "libs/Mesh_Common/interface/PositionForPointInFace.h"
//.... put this somewhere more sensible
template <class tElement, class tOverlay>... | TOOL | 0.892063 | 4.765855 |
e55164ec-d0e8-4a8a-bef1-88a542952806 | harshpreet931/CppRepo | Recursion/StairsJumps.cpp | //
// Created by HARSHPREET SINGH on 26.09.2023.
//
#include <iostream>
using namespace std;
int ways(int n,int m){
if(n==0) return 1;
if(n<0) return 0;
int way = 0;
for(int i=1;i<=m;i++){
way += ways(n-i,m);
}
return way;
}
int main(){
int n = 4; int m = 3;
cout << ways(n,m);... | ALGO | 0.999995 | 5.379347 |
8ff7f90b-56a6-4a1e-9b08-352749327d6a | neojijon/CPlusPlus_Study | 11/regrex02.cpp | #include <iostream>
#include <string>
#include <regex>
int main(){
std::string s("this subject has a submarine as a subsequence");
std::smatch m;
std::regex e(R"(\b(sub)([^ ]*))"); // e("\\b(sub)([^ ]*)");
std::cout << "Target sequence: " << s << std::endl;
while (std::regex_search(s, m, e)) {
... | ALGO | 0.931583 | 3.188233 |
04224f24-58f0-47b5-9229-8a4ec5e300e8 | shreejitverma/SDE-Interview-Prep | LeetCode/C++/sort-integers-by-the-power-value.cpp | // Time: O(n) on average
// Space: O(n)
class Solution {
public:
int getKth(int lo, int hi, int k) {
vector<pair<int, int>> arr;
for (int i = lo; i <= hi; ++i) {
arr.emplace_back(power_value(i), i);
}
auto it = begin(arr) + k - 1;
nth_element(begin(arr), it, end... | ALGO | 0.999989 | 5.837392 |
052f3933-e443-48ef-ad1a-0d7adea6ed54 | pipe0919/flutterfire | packages/firebase_core/firebase_core/windows/messages.g.cpp | #undef _HAS_EXCEPTIONS
#include "messages.g.h"
#include <flutter/basic_message_channel.h>
#include <flutter/binary_messenger.h>
#include <flutter/encodable_value.h>
#include <flutter/standard_message_codec.h>
#include <map>
#include <optional>
#include <string>
namespace firebase_core_windows {
using flutter::Basic... | TOOL | 0.863257 | 7.836062 |
df716bee-0d1b-4772-b827-8f1d8aca531f | kljoshi/C_plus_plus | Exercise/Chapter13/Ex-19.cpp | /*
Trivia Game
In this programming challenge you will create a simple trivia game for two players. The
program will work like this:
• Starting with player 1, each player gets a turn at answering five trivia questions.
(There are a total of 10 questions.) When a question is displayed, four possible
answers are... | ALGO | 0.987943 | 3.900884 |
14c7d3e6-0f59-49cf-a6a1-dd6f405a514d | kuailedeguisu/GeneralKnowledgeSummary | CPlusPlus/cplusplusprimer5_test/ch06/returnExa.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
void swap(int& v1, int& v2)
{
if (v1 == v2)
{
return;
}
int tmp = v1;
v1 = v2;
v2 = tmp;
}
bool str_range(const string& str1, const string& str2)
{
if (str1.size() == str2.size())
{
return str1 == str2;
}... | TOOL | 0.987946 | 3.338055 |
e3d47813-6753-45f5-8338-44fba6e81dfd | dahai78/noip | 第一章编程基础/ch05循环控制/24.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <cstdlib>
using namespace std;
int main(int argc, char** argv) {
int k;
cin >>k;
double sn =0;
int n=1;
while(true){
sn += 1.0/n;
if(sn > k) break;
n++;
}
/*
for(int i=1; sn <=k ;i++)
{
sn += 1.0... | ALGO | 0.999974 | 3.562258 |
a54b8521-faab-4365-8377-6821452d3c69 | shubham-navik/Code-forces | ladder2/Luckey_numbers.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll n;
cin >> n;
// ll ans= pow(2, n + 1) - 2;
// cout << ans;
cout<<(1LL<<(n+1))-2;
} | ALGO | 0.999586 | 3.504048 |
e70969d1-d601-4273-97f3-1f1e47047bd7 | bupt-pris/opencv-mirror | modules/core/src/mathfuncs.cpp | #include "precomp.hpp"
namespace cv
{
static const int MAX_BLOCK_SIZE = 1024;
typedef void (*MathFunc)(const void* src, void* dst, int len);
static const float atan2_p1 = 0.9997878412794807f*(float)(180/CV_PI);
static const float atan2_p3 = -0.3258083974640975f*(float)(180/CV_PI);
static const float atan2_p5 = 0.155... | ALGO | 0.998734 | 3.573189 |
b722a9e0-20aa-48ed-ad57-e44c572573c7 | firiexp/contest_log | atcoder/ABC/147D.cpp | #include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max()... | ALGO | 0.999937 | 4.583782 |
4f0da7c7-43e2-4dd3-8864-1909e79a9376 | Gnaroshi/practice-algorithm-solvedac | With_Levels/Silver/Silver_5/17127.cpp | // problem: 벚꽃이 정보섬에 피어난 이유
// id: 17127
// tag:
// time taken:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
using ll = l... | ALGO | 0.999863 | 3.95979 |
207ae6bc-4c96-4a51-931b-1753e4ff1b37 | aditiarya37/CPP | CLASS QUESTIONS/singleinheritance.cpp | #include<iostream>
using namespace std;
class Base {
public:
int areaT, areaR;
void triangleArea(int b, int h){
areaT = (0.5*b*h);
}
void rectangleArea(int len, int brdt){
areaR = len*brdt;
}
};
class Derived : public Base {
public:
void display(){
cout << "Area o... | TOOL | 0.868551 | 5.957379 |
2710be53-c478-4aeb-a947-3acaea936153 | pimenta9/Competitive-Programming | tap/treino5/problemD.cpp | #include <bits/stdc++.h>
using namespace std;
int main ()
{
int n;
cin >> n;
map<int, int> map1;
for (int i = 0; i < n; i++)
{
int d;
cin >> d;
map1[d]++;
}
int m;
cin >> m;
for (int i = 0; i < m; i++)
{
int t;
cin >> t;
if (ma... | ALGO | 0.999989 | 4.332915 |
a86a3918-7456-4a68-b0e0-9850d42caa2e | sunmd01/cpp_primer | ch03/prog3_41.cpp | #include<iostream>
#include<cstring>
#include<vector>
using std::cout;
using std::cin;
using std::endl;
using std::vector;
using std::begin;
using std::end;
int main()
{
int array[10];
for(int i = 0; i < 10; ++i)
array[i] = i;
vector<int> array1(begin(array), end(array));
for(auto i : array1)
cout << i << ... | ALGO | 0.914826 | 3.309331 |
43b68356-7571-416d-8612-5f5a69f7ecdc | RaviKumar-Nemala/DATA-STRUCTURES | BINARY_TREES/CALCULATING_DIAMETER_OF_THE_BINARY_TREE.CPP | #include<iostream>
using namespace std;
struct node{
int data;
node*left;
node*right;
node(int dup_data){
data=dup_data;
left=NULL;
right=NULL;
}
};
int height(node*root){
if(root==NULL)return 0;
int left=height(root->left);
int right=height(root->right);
return max(left,right)+1;
}... | ALGO | 0.999903 | 5.295293 |
55418614-bbd0-409b-a9c7-9e2c50108a8b | KetchupLover0221/DataStructure | Semester1/Queue/Queue.cpp | #include <iostream>
#include"Queue.h"
using namespace std;
void Yanghui(int n)
{
SeqQueue<int> qa;
qa.EnQueue(1);
qa.EnQueue(1);
for (int r = 2; r <= n; r++)//算n行
{
for (int p = 1; p < r; p++)
{
int h1 = 0, h2 = 0;
qa.GetHead(h1);
qa.DelQueue();
qa.GetHead(h2);
int temp = h1 + h2;
qa.EnQueue... | ALGO | 0.99992 | 3.840583 |
ec2adbd5-e723-4e62-9cac-3db9520f3cd3 | SwetabjaGit/competitive-programming | RGAME.cpp | #include<bits/stdc++.h>
#include<cmath>
using namespace std;
const long long int BIG = 1000000007;
list<long long int> state;
long long int arr[100000];
long long int a[100000];
long long int compute(int k, int i, long long int N){
long long int sum = 0;
state.push_front(a[i+1]);
list<long long int>::iter... | ALGO | 0.999879 | 4.012898 |
07a4f727-77a7-4a14-96db-3579226cbad3 | ishandutta2007/codeforces | davidberard/normal/902/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef pair<ld, ld> pdd;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int N, M;
cin >> N >> M;
vector<int> start(M+1, 0), end(M+1, 0);
for(int i=0;i<N;++i) {
int a, b;
cin >> a... | ALGO | 0.999996 | 4.28723 |
100473dd-1e79-43b7-8e7a-a43f0f8777d5 | souhhcong/Shortest-path-example | Layout.cpp | //Bellman-Ford van AC neu ban luoi code SPFA
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define st first
#define nd second
#define mp make_pair //old C++ gay
const int N = 1e3+5, INF = 1e9+9;
int n, m, k, u, v, w, pos = 0;
int dist[N], cnt[N];
bool visited[N];
vector<pair<int,int> > a... | ALGO | 0.999927 | 4.02989 |
93fab75c-ee73-4874-b5b7-17620c0ff07e | kdhansen/aseta_task_management | test/test_clippoly.cpp | #include <cstring>
#include <iostream>
#include <clippoly/poly.h>
#include <clippoly/poly_io.h>
#include <clippoly/nclip.h>
using namespace ::std;
void
clear(PolyPList &l)
{
PolyPListIter i(l);
while(i())
delete i.val();
}
int
main(int, char *[])
{
// Make my own polys
Poly a(Point(0, 0));
a.add(Point(1, ... | ALGO | 0.984958 | 4.240318 |
ee25d190-70be-4601-bae8-50d90e288316 | amir-hosen7/Sorting | quick_sort.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define Mid(b, e) b + (e - b) / 2
#define inf 1e18
double PI = 2 * acos(0.0);
//----------------------------------------------------... | ALGO | 0.999794 | 3.576877 |
387dc54e-1c82-4625-8021-4667fbd925d3 | delatorrena2016/ParticleSwarmOptimization | POOE_DelatorreN_PSO.cpp | #include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <random>
#include <thread>
using namespace std;
class Particle{
private:
vector<float> m_v, m_x, m_x_b;
float m_fitness, m_pbest;
public:
int ... | ALGO | 0.999928 | 5.18708 |
17d54422-0516-4737-b0e2-6e8ac62447fd | NoumanAhmed01/DSA-for-Developers-Cpp-Nouman | Day-16/Q2.cpp | // Quick Sort.
#include <iostream>
using namespace std;
int partition(int arr[], int si, int ei)
{
int i = si - 1;
int pivot = arr[ei];
for (int j = si; j < ei; j++)
{
if (arr[j] <= pivot)
{
i++;
swap(arr[i], arr[j]);
}
}
swap(arr[i + 1], arr[ei]... | ALGO | 0.99997 | 5.969735 |
737905cb-a19a-4fd0-9d9c-f61f0e9304ab | gnahtcouq/cpp | Chuong 7 Chuoi/remake/Ly Thuyet/Super Calculator/source.cpp | /*
B1: Những số mà độ dài khôngbằng nhau
=> Thêm số 0 vào đầu cho cân bằng
B2: Duyệt từ cuối về đầu của 2 chuỗi số tương ứng
, lấy từng ký tự ở từng vị rí tương ứng
chuyển nó sang số tương ứng rồi cộng lại với nhau
, nếu kết quả > 10 => lấy phần dư và nhớ 1 để c
ộng thêm vào cho lần sau
B3: Cứ thế lặp lại B2 cho đế... | ALGO | 0.999754 | 4.016394 |
d4e9598f-9039-4870-b52e-6ff8a31b053a | nioklay/Markovchin4 | 1(g).cpp | #include <stdio.h>
#include <string.h>
#include <iostream>
int main()
{
char str[80];
int i;
printf("Введите последовательность символов: \n");
fgets(str, sizeof(str), stdin);
printf("Получившаяся последовательность символов: \n");
for (i = 0; i <= sizeof(str); i++)
{
if (str[i] == '*' && str[i+1] == '*')
{
pr... | ALGO | 0.999946 | 3.25335 |
b96eb23a-35ea-4e35-a3e3-235e24ee0d54 | SoftUni/Programming-Basics-Resources | CPlusPlus-Course-SoftUni/4. Complex-Conditions/sols/13.cpp | #include <iostream>
int main() {
int h, x, y;
std::cin >> h >> x >> y;
if ((x < h && y > h) || (x > 2 * h && y > h) || (x < 0) || (x > 3 * h) ||
(y < 0) || (y > 4 * h)) {
std::cout << "outside";
} else if ((x > 0 && x < 3 * h && y > 0 && y < h) ||
(x > h && x < 2 * h && ... | ALGO | 0.99897 | 3.537859 |
af80e5db-4788-4a8b-a5cd-52e3dadf538e | dbsdud00/Biz-2023-505-Android | flutter-000-hello/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.998337 | 6.76073 |
10256fa7-8ec5-4020-99f8-9687a7138c92 | applebuddy/BJAlgorithmStudy | BaekJoonPS/BaekjoonAlgorithmPS/DP/가장긴증가하는부분수열3_12738.cpp | /// MARK: - 가장 긴 증가하는 부분수열3_12738
#if 0
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void theLongestIncreasingSubSequence() {
int N; cin>>N;
vector<int> V(N,0);
for(int i=0; i<N; i++) cin>>V[i];
vector<int> Ans;
for(int i=0; i<(int)V.size(); i++) {
int IDX... | ALGO | 0.999915 | 4.972311 |
690482d2-622b-41d9-ac9c-1211851195f5 | saurav82923/Tree | 617. Merge Two Binary 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.999992 | 6.110576 |
de1a61b2-9153-498b-af78-3c89e827bfe0 | TheIncredibleVee/CP-compilation | Practice/Atoj < 1300 (Extras)/A_Lala_Land_and_Apple_Trees.cpp | #pragma GCC optimize("O3") //https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html (0fast alternative, but more aggressive)
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> //Policy based Data Structrues containter
#include<ext/pb_ds/tree_policy.hpp> //Ordered set
#define gcj "Case #" //For ... | ALGO | 0.999966 | 3.616412 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.