uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
987a569f-4be8-4084-b35f-a106870a8209 | akirago/at_coder | tree/TreeNode.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <cstdlib>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(long (i) = 0; (i) < (long) (n); (i)++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,a,b) for(long i=(a);i<(b... | ALGO | 0.999573 | 4.042311 |
9f30600b-288a-4b8d-b0a3-c1bab1cdb422 | argon17/CFPractice | Jan2025/2025-01-22/E_Romantic_Glasses.cpp | #include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include <algo/debugger.h>
#else
#define debug(...) {};
#endif
#define int long long
#define endl '\n'
using namespace std;
void solve()
{
int n;
cin >> n;
set<int> s;
bool ans = false;
int cur = 0;
for (int i = 0; i < n; ++i)
{
s.insert... | ALGO | 0.998924 | 4.65034 |
5fd8b91d-9248-4c98-a65c-0ea1a56a8ca5 | haribo841/Cpp-challenges | ConsoleApplication1/097 Days in a Month.cpp | //Create a function that takes the month and year (as integers) and returns the number of days in that month.
#include "097 Days in a Month.h"
int days(int month, int year) {
int lapYear = false;
if ((year % 4) == 0) {
if ((year % 100) == 0)
{
if ((year % 400) == 0) {
lapYear = true;
}
else {
lap... | ALGO | 0.993441 | 5.576928 |
d4878ce5-b288-4199-8b19-335a2c8f2391 | MisterSchmitz/Simple-HTTP-Server | src/Parser.cpp | #include <assert.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
#include <stdlib.h>
#include "Parser.hpp"
/*HTTP request and response messages are plain-text, consisting of a
header section and an optional body section. The header section... | WEB | 0.918978 | 4.340743 |
543e1bf4-b68c-48fb-b539-406bb9409fb2 | whoseJam/threadpoolTest | DAG/main.cpp | #include <iostream>
#include <assert.h>
#include <ctime>
#include <mutex>
#include "Pool.h"
using namespace std;
int R(int l, int r) {
return rand() % (r - l + 1) + l;
}
const int N = 1005;
vector<int> G[N];
Thpool pool = {4};
int mark[N];
struct Data {
int id;
atomic<int> ind;
} D[N];
void solve(Data& myData... | ALGO | 0.998902 | 4.297045 |
ad2e11cc-496a-485d-9d11-0e86951faeac | gauravkumar22927/comp_coding | remove_dub_map.cpp | #include<iostream>
#include<unordered_map>
using namespace std;
void remove_dub(int arr[],int n){
unordered_map<int,int> um;
for(int i =0 ;i<n;i++){
if(um.count(arr[i])){
continue;
}
else{
um.insert(pair<int,int> (arr[i],1));
cout << arr[i] << " ";
}
}
}
int main(){
int arr[]... | ALGO | 0.9993 | 4.671452 |
a2146d42-71d1-465e-beaa-7ee5e8776de7 | alokgoldy/leetcode-1000-questions-challenge | Array/wiggle_sort.cpp | Question Link - https://leetcode.com/problems/wiggle-sort-ii/
class Solution {
public:
void wiggleSort(vector<int>& nums) {
vector<int>v(nums);
sort(v.begin(),v.end());
int n = nums.size();
int j,k=n-1;
n%2==1? j = n/2 : j =n/2 - 1;
... | ALGO | 0.999983 | 5.690536 |
0f872693-5ca5-4255-95fc-74cfb8d68c13 | Prateek-rajput-007/GFG-Practice | Hard/Aggressive Cows/aggressive-cows.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int solve(int n, int k, vector<int> &stalls) {
// Write your code here
int start=1, end=0, pos=0,count=0,ans, mid;... | ALGO | 0.999998 | 6.0421 |
d0a67175-94d2-45dc-87b9-897581435433 | hbs-harsh/LeetCode-problem | 62-UniquePaths/62-UniquePaths.cpp | // Last updated: 7/14/2025, 2:55:48 PM
class Solution {
public:
int uniquePaths(int m, int n) {
vector<vector<int>>dp(m,vector<int>(n,0));
dp[0][0]=0;
for(int i=0;i<m;i++){
dp[i][0]=1;
}
for(int j=0;j<n;j++){
dp[0][j]=1;
}
for(int i=... | ALGO | 0.999925 | 6.663059 |
556b98bb-81fb-4ede-b4a3-616d232dd3ec | rzmv/opencv_test | modules/video/src/tracking/tracker_nano.cpp | // This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
// Author, HongLinChu, <EMAIL>
// Adapt to OpenCV, ZihaoMu: <EMAIL>
// Link to original inference code: https://github.com/HonglinChu/NanoTrack
// Link to original training repo: https://github.com/... | ALGO | 0.987312 | 6.437628 |
3ca3100c-8716-4a77-9efa-0d2900f8c4c8 | 123pk/100DaysCodingChallenege | Day97/Minimum element to add to given sum.cpp | /*
Pltform :- Leetcode
Problem :- Minimum elemnts to add to given sum
Contest :- Weekly contest 231
*/
class Solution {
public:
int minElements(vector<int>& nums, int limit, int goal) {
long long tot=0;
for(int i=0;i<nums.size();++i){
tot+=nums[i];
}
if(tot==goal)return ... | ALGO | 0.999979 | 5.46455 |
35731317-de61-4050-9055-e25a73fc644f | Ttdne/Applied-Algorithm | Discrete_Math/ONTHI/forfun.cpp | #include<bits/stdc++.h>
using namespace std;
map<string, int> dem;
int main(){
set<string> ngay;
string day;
string time;
string name;
string ques;
while(cin>> day){
if(day == "*") break;
cin>>time>>name>>ques;
dem[day]++;
ngay.insert(day);
}
for(auto day... | ALGO | 0.975574 | 3.489357 |
a347d150-264c-4569-8e53-72da4ee44c89 | LiquidSmooth-Extended/android_frameworks_av | media/libstagefright/codecs/amrnb/common/src/pred_lt.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "pred_lt.h"
#include "cnst.h"
/*----------------------------------------------------------------------------
; MACROS
; Define module specifi... | ALGO | 0.999645 | 6.592406 |
a9e5e5a3-8133-47a4-a25d-1274244970a4 | devanshmittalexe/DSA_practice | 2312-most-frequent-number-following-key-in-an-array/most-frequent-number-following-key-in-an-array.cpp | class Solution {
public:
int mostFrequent(vector<int>& nums, int key) {
unordered_map<int,int>a;
int x,y=0;
for(int i=0;i<nums.size()-1;i++){
if(nums[i]==key){
a[nums[i+1]]++;
if(a[nums[i+1]]>y){
y=a[nums[i+1]];
... | ALGO | 0.999998 | 5.756615 |
0e80358f-204d-41cc-a883-0f83fc5618c2 | HimanshU-Singh6/ds_lab | Expt55_searchBST.cpp | #include <iostream>
using namespace std;
// Definition for a binary tree node.
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int value) : val(value), left(nullptr), right(nullptr) {}
};
// Function to insert a new node into the BST
TreeNode *insert(TreeNode *root, int value)
{
... | ALGO | 0.999993 | 6.897558 |
bddf42d4-45b0-458e-b81e-86798e9e5e2a | nguyencatdinh/TestCaseGeneration | TestCaseGeneration/OUTPUT/OUT_FOR Unsolvable 6.cpp/Unsolvable 6.cpp | int foo(int n)
{
int result = 0;
if ((n > 0))
result = sin(30) + 4;
else
result = cos(60) - 6;
return result;
}
| TOOL | 0.939602 | 3.713548 |
f9deb489-4d8c-4c8f-a42a-d3710a66ab34 | David-Durst/csknow | analytics/src/lib/queries/inference_moments/inference_latent_place.cpp | //
// Created by durst on 4/20/23.
//
#include "queries/inference_moments/inference_latent_place.h"
#include "indices/build_indexes.h"
#include "file_helpers.h"
#include "bots/analysis/learned_models.h"
namespace csknow::inference_latent_place {
struct LatentPlaceData {
int64_t player, startTick;
... | DATA | 0.949159 | 5.498519 |
73d01384-b086-477d-b27c-867bdefaf396 | AntonioSilva03/Projeto-CG | FASE3/src/utils/bezier.cpp | #include "bezier.hpp"
#include "ponto.hpp"
#include <math.h>
#include <iostream>
#include <vector>
Ponto calculateBezierPoint(std::vector<Ponto> pontos, float u, float v){
Ponto res = novoPonto(0, 0, 0);
for (int w = 0; w < 4; w++){
for (int t = 0; t < 4; t++){
float U, V;
U =... | ALGO | 0.998597 | 5.280927 |
c10ff970-6f8e-49b9-aaf7-b1c27f9bd9a8 | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J00258/explore/explore.cpp | #include <bits/stdc++.h>
using namespace std ;
char a[1e+3][1e+3] ;
bool soe[1e+3][1e+3] ;
void meterlo ()
{
}
int main ()
{
freopen("explore.in", "r", stdin) ;
freopen("explore.out", "w", stdout) ;
int n ;
cin >> n ;
while (n--)
{
int ans = 0, n, m, k, x, y, d ;
memset(soe... | ALGO | 0.998908 | 4.427029 |
062c47f5-4fcd-4cc8-a72f-d28a55c8c1bc | ishandutta2007/codeforces | trivialman/normal/1066/F.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
#define N 200010
#define LL long long
class point{
public:
int x=0,y=0;
bool operator<(point a){return max(this->x,this->y)<max(a.x,a.y);}
bool operator>(point a){return max(this->x,this->y)<max(a.x,a.y... | ALGO | 0.999868 | 4.340973 |
4169e47b-a4a4-40e8-a533-728732d78e5d | Distrotech/openldap | servers/slapd/back-ndb/modify.cpp | /* modify.cpp - ndb backend modify routine */
/* $OpenLDAP$ */
/* ACKNOWLEDGEMENTS:
* This work was initially developed by Howard Chu for inclusion
* in OpenLDAP Software. This work was sponsored by MySQL.
*/
#include "portable.h"
#include <stdio.h>
#include <ac/string.h>
#include <ac/time.h>
#include "back-ndb.... | TOOL | 0.958148 | 5.910692 |
bb7c0df9-0ebd-49df-b68d-a5de0d0b7ae0 | thisisiron/Algorithm | BOJ/C++/BOJ_2577.cpp | #include <cstdio>
int A, B, C;
int answer[10];
int main() {
scanf("%d", &A);
scanf("%d", &B);
scanf("%d", &C);
A *= B * C;
while(A!=0){
answer[A%10]++;
A /= 10;
}
for(int i=0;i<10;i++){
printf("%d\n", answer[i]);
}
return 0;
}
| ALGO | 0.999917 | 3.83918 |
78a4bde3-729d-41ec-8907-b009f7bab4f6 | TheDev05/CARDIO | Domains/DP/LC322/Backtrack.cpp | #include <bits/stdc++.h>
using namespace std;
int getCount(std::vector<int> &num, int k, int index)
{
if (index >= num.size())
return (k == 0) ? 0 : 1e5;
int val1 = 1e5, val2 = 1e5;
if (k - num[index] >= 0)
val1 = 1 + getCount(num, k - num[index], index);
val2 = getCount(num, k, index ... | ALGO | 0.999992 | 4.534236 |
42ce8e49-20cd-4195-956a-9eeaa722c18c | tesla-69/Leetcode-Problems | 2415-count-the-number-of-ideal-arrays/count-the-number-of-ideal-arrays.cpp | const int MOD = 1e9 + 7, MAX_N = 1e4 + 10,
MAX_P = 15; // There are up to 15 prime factors
int c[MAX_N + MAX_P][MAX_P + 1];
vector<int> ps[MAX_N]; // List of prime factor counts
int sieve[MAX_N]; // Minimum prime factor
class Solution {
public:
Solution() {
if (c[0][0]) {
retu... | ALGO | 0.999985 | 5.693111 |
0a67fd13-dcf1-4a05-baa8-e4bb9590ed68 | jackcrane/slucam-mts | Marlin/src/libs/vector_3.cpp | #include "../inc/MarlinConfig.h"
#if ABL_PLANAR || ENABLED(AUTO_BED_LEVELING_UBL)
#include "vector_3.h"
#include <math.h>
/**
* vector_3
*/
vector_3 vector_3::cross(const vector_3 &left, const vector_3 &right) {
return vector_3(left.y * right.z - left.z * right.y, // YZ cross
left.z * right... | TOOL | 0.854167 | 7.234634 |
b6cbea91-2dc7-44c6-913a-9adbc9b1029a | thegamer1907/Code_Analysis | Graphs/2876.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int32_t MAX_N = 1e5;
class Graph {
private:
class Node {
public:
bool isVisited;
int32_t id;
vector< Node* > v;
void Init(int32_t id = 0) {
this->id = id;
isVisited = false;
v.clear();
}
};
public:
int32_t cnt... | ALGO | 0.999878 | 5.155099 |
b6a245da-92ef-4d01-b46d-d365b4a50dd2 | UMANG-GAKHAR/Challenges-Bitmasking | Average of Sliding Windows.cpp | #include <bits/stdc++.h>
using namespace std;
class MovingAverage {
public:
/** Initialize your data structure here. */
queue<int> q;
int ms;
int sum;
MovingAverage(int size) {
ms=size;
sum=0;
}
double next(int val) {
q.push(val);
sum+=val;
if(q.size(... | ALGO | 0.999779 | 4.560696 |
85dcf7aa-451e-45fc-9f02-0bd5b717f572 | ryan597/ProgrammingPrinciplesPracticeCpp | Chapter4/example5_whileloop.cpp | #include <iostream>
#include <cmath>
int main(){
int i = 0;
while(i<100){
std::cout << i << '\t' << pow(i, 2) << '\n';
++i;
}
} | TOOL | 0.932957 | 3.720114 |
318256fa-0e97-41cd-b772-a11c071697bc | ks0727/AtCoder-Archive | ABC/351-400/377/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
int main(){
int h = 8,w=8;
vector<string> s(h);
rep(i,h) cin >> s[i];
vector<bool> rows(h),cols(w);
rep(i,h)rep(j,w){
if(s[i][j] == '#'){
rows[i] = true;
cols[j] = true;
}
... | ALGO | 0.997146 | 4.170947 |
9555004c-57c0-4947-8f46-e9df130610a9 | NahorskyiIKM723v/lab14-var16 | lab14/lab14.cpp | #include <iostream>
#include <Windows.h>
using namespace std;
bool isPrime(int num) {
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
if (num <= 1) return false;
if (num == 2) return true;
if (num % 2 == 0) return false;
for (int i = 3; i * i <= num; i += 2) {
if (num % i == 0) return fal... | ALGO | 0.999243 | 4.782759 |
c2c9c27d-75fd-4b20-8a89-49bba5764a62 | SiddharthJain78799/DSA_Leetcode | 088-merge-sorted-array.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int idx = m+n-1 , i=m-1, j=n-1;
while(i>=0 && j>=0) {
if(nums1[i]>=nums2[j]) {
nums1[idx--]=nums1[i--];
}
else {
nums1[idx--]=nums2[j--];
... | ALGO | 0.999945 | 5.182643 |
9f1d6bb7-f156-4cef-aca1-8f0f8fc7e22e | Arvln/LeetCode | Tree/110.Balanced-Binary-Tree/110.Balanced-Binary-Tree.cpp | class Solution {
bool ret=true;
public:
bool isBalanced(TreeNode* root) {
dfs(root);
return ret;
}
int dfs(TreeNode *node)
{
if (node==NULL) return 0;
int left=dfs(node->left);
int right=dfs(node->right);
if (abs(left-right)>1) ret=false;
retu... | ALGO | 0.999932 | 6.484928 |
38ad3fc7-878c-466e-a822-e71a197163be | Tasnimmumu/C-Work | Assignment01_CSE225LAB_Tasnim Hossain_1912128042/Assignment_Task03/Tasnim_1912128042_Task3.cpp | /*Name: Tasnim Hossain
ID: 1912128042
Course: CSE225L; Section: 02
Date: 09/11/2020 */
/* Task 3: Ask user for two integers, 𝑎𝑎 and 𝑏𝑏. Then swap (interchange) the values of 𝑎𝑎 and 𝑏𝑏.
That means, 𝑎𝑎 should get the value of 𝑏𝑏 and 𝑏𝑏 should get the value of 𝑎𝑎.*/
#include <iostream>
#include <conio.h>... | ALGO | 0.99685 | 3.667583 |
5c6441b1-f5c6-4965-b8a0-b1a4e813f6ca | Mauricio-0312/Laboratorio_de_algoritmos_2 | Contest_1/bracket_sequence.cpp | /*
Alumno: Mauricio Fragachan
Carnet: 2010265
El razonamiento que utilice para resolver este ejercicio es el siguiente:
Primero, se debe leer la secuencia de brackets dada. Luego, se crea un vector que almacene los brackets de apertura
que se vayan encontrando en la secuencia. Adicionalmente, se debe llevar un contad... | ALGO | 0.999866 | 4.233551 |
7c5aa5fe-fe8e-44a5-8e73-a1a7457c6071 | puruz14/CP-Practice | 04 Jan/C_Songs_Compression.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long long n,m;
cin>>n>>m;
long long a[n],suma=0,sumb=0;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
a[i]=x-y;
suma+=x;
sumb+=y;
}
sort(a,a+n,greater<int>());
if(suma<=m){
cout<<0<<endl;
... | ALGO | 0.999999 | 3.808044 |
9f0c6d13-5dc0-49fc-8e2c-d182f139b19b | akshat-o5/Data-Structures-and-Algorithms | Revision/HashMaps/FindElementOccuresOnlyOnceInSortedArray.cpp | // https://www.geeksforgeeks.org/problems/find-the-element-that-appears-once-in-sorted-array0624/1
//{ Driver Code Starts
// Driver code
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
int findOnce(int arr[], int n)
{
//code here.
unordered_map<in... | ALGO | 0.999876 | 5.756039 |
c4149558-ecb0-43d1-a66c-9b87a85f4a55 | suhas4122/Competitive-Programming | Kickstart-E/C.cpp | #include <bits/stdc++.h> // This will work only for g++ compiler.
using namespace std;
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
templ... | ALGO | 0.999759 | 4.370888 |
f99d7a6e-ce64-468a-96e1-70fb94b2be43 | nitcse2018/daa-nikki0508 | DAA/dynamicpgm.cpp | #include <iostream>
using namespace std;
int ary[10][10], completed[10], n, cost = 0;
void takeInput()
{
int i, j;
cout << "Enter the number of places: ";
cin >> n;
cout << "\nEnter the Cost Matrix\n";
for (i = 0; i < n; i++)
{
cout << "\nEnter Elements of Row: " << i + 1 << "\n";
... | ALGO | 0.999608 | 3.931982 |
863582fe-48dc-408e-ae6a-792bd4d12fdc | Hackerboy321/DSA-with-Cpp | 10. Recurrsion/Classical Question/P4_Binary_string_problem.cpp | #include <iostream>
using namespace std ;
void Binary_string(int n , string ans , int last_place )
{
if(n== 0)
{
cout<<ans<<endl;
return ;
}
if(last_place != 1)
{
Binary_string(n-1, ans + '1', 1 ) ;
Binary_string(n -1 , ans + '0', 0) ;
}
else
{
... | ALGO | 0.999979 | 5.036606 |
67c9d777-b5f3-4044-b871-604b427d2a15 | Hassan-Ali-Soomro/Cpp-Assignments- | Lab-9/task10.cpp | /*******************
Programming Fundamentals-Lab
Lab-9
Code written By: Hassan Ali
*******************/
#include <iostream>
using namespace std ;
int main()
{
int N, temp ;
bool order = true ;
cout << "Enter a value for N: " ;
cin >> N ;
int arr [N] ;
cout << "Enter " << N << " Integers: " ;
for (int i=0 ; ... | ALGO | 0.999561 | 4.694976 |
73c1c03c-5231-4567-a84a-bfc8915f74d4 | xinyuang/Udacity_cpp | algorithm/recursion/113. Path Sum II.cpp | class Solution {
vector<vector<int>> res;
vector<int> path;
public:
vector<vector<int>> pathSum(TreeNode* root, int sum) {
recursion(root, sum, path);
return res;
}
void recursion(TreeNode* root, int sum, vector<int> path) {
if (root == NULL) return;
if (root->val == ... | ALGO | 0.99999 | 6.017355 |
d2274145-646b-4ca0-8226-f8409f891036 | BrendanGlancy/akron | old/semester-5/cpp/1/Gaddis-CPP_10e_SourceCode/Chapter 14/FeetInches Version 3/Pr14-10.cpp | // This program demonstrates the FeetInches class's overloaded
// relational operators.
#include <iostream>
#include "FeetInches.h"
using namespace std;
int main()
{
int feet, inches; // To hold input for feet and inches
// Create two FeetInches objects. The default arguments
// for the constructor will be ... | TOOL | 0.960106 | 4.805691 |
aa1aad2a-b791-4611-a86c-7ad99a5d0b46 | zhenliatbrown/Multiscale_Coupling | src/MC/fix_tfmc.cpp | /* ----------------------------------------------------------------------
Contributing author: Kristof Bal (University of Antwerp, Belgium)
------------------------------------------------------------------------- */
#include "fix_tfmc.h"
#include <mpi.h>
#include <string.h>
#include <math.h>
#include <float.h>
#in... | ALGO | 0.912085 | 6.086711 |
84b82524-abfd-4b1f-85e4-4f47c32ce674 | Oein/PS | acmicpc/1____/18___/188__/1887_/18870/18870.cpp | #include <vector>
#include <algorithm>
#include <queue>
#include <iostream>
#include <map>
#include <set>
#include <math.h>
#include <numeric>
#include <cassert>
#include <stack>
#include <cstring>
using namespace std;
typedef long long ll;
typedef unsigned long ull;
typedef pair<int, int> pii;
#define interface str... | ALGO | 0.999974 | 3.893402 |
00e98bdf-b616-4fbf-b856-1c6f79108dd1 | Sameer25-py/DataStructures_subs | PA-1/main.cpp | #include "LinkedList.cpp"
#include "luckyDraw.cpp"
#include <iostream>
#include <cstdlib>
#include <memory>
using namespace std;
int main(){
int arr[5] = {1,2,3,4,5};
luckyDraw l(5);
l.populateTable(arr);
//l.transferStack();
for(int i=0;i<5;i++){
cout << l.table_1.pop()<<endl;
}
... | ALGO | 0.99007 | 3.36138 |
107217fc-59fe-47a9-bcd8-ca3ee72c5262 | ishandutta2007/codeforces | timsei/normal/1081/F.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 305;
int n, t, A[N], x, ans[N], Rev[N], now;
int Q(int l, int r) {
cout << "? " << l <<" " << r << endl;
fflush(stdout);
cin >> x;
return x;
}
void rev(int l, int r) {
for(int i = l; i <= r; ++ i) {
if(ans[i] != -1) ans[i] = 1 - ans[i];
... | ALGO | 0.999959 | 3.344819 |
913d2af4-f15a-4599-b034-f1c9c51f93af | shourya-trikha-12/CS636-Analysis-Of-Concurrent-Programs | Project/Testcases/test2.cpp | #include <iostream>
#include <thread>
#include <mutex>
using namespace std;
int main() {
int x = 1, y = 2;
mutex m1, m2;
auto swap_xy = [&]() {
lock(m1, m2);
lock_guard<mutex> lock1(m1, adopt_lock);
lock_guard<mutex> lock2(m2, adopt_lock);
int temp = x;
x = y;
... | ALGO | 0.999288 | 6.190508 |
7ff51a4a-4b36-4d71-ba41-4a15f686766e | Martin-CaesarP/algoritma-struktur-data | pertemuan9 &10 &11/tugas/pangkat euy.cpp | #include<iostream>
using namespace std;
int pangkat(int x, int y){
if(y==0){
return 1;
}
else{
return x * pangkat(x,y-1);
}
return x;
return y;
}
int main(){
int x;
int y;
cout<< "nilai x= ";cin>>x;
cout<< "nilai y= ";cin>>y;
cout<< "4 dipangkatkan 3 = "<<pangkat(x,y);
}
| ALGO | 0.999723 | 4.393714 |
452dfd63-9a0a-4dc0-84a8-7a78d3801aeb | Atharvarana29/cpp-coding-practice | c++ coding practice/sort01array.cpp | #include <iostream>
#include <vector>
using namespace std;
void sortZerosAndOnes(vector <int> &v)
{
int zeros_count=0;
for( int ele : v)
{
if(ele==0)
{
zeros_count++;
}
}
}
int i=0;
for(int i=0;i<v.size;i++)
{
if(i<zeroes_count)
{
... | ALGO | 0.999947 | 4.115119 |
47eb6869-df3c-4f6d-ae43-8b47bb5f8646 | BuseVarkan/algorithms_take_home_exams | the5.cpp | #include "the5.h"
/*
in the5.h "struct Room" is defined as below:
struct Room {
int id;
char content;
vector<Room*> neighbors;
};
*/
void DFS(Room* v, vector<int>& path)
{
if(char(v->content)=='-') v->content = '+';
if(char(v->content)=='*') return;
if(!path.empt... | ALGO | 0.999738 | 3.866661 |
ec74a23c-1a06-4ed9-85cc-c03c27a60940 | Halliburton-Landmark/xulrunner-24.0 | content/media/dash/DASHReader.cpp | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* DASH - Dynamic Adaptive Streaming over HTTP
*
* DASH is an adaptive bitrate streaming technology where a multimedia file is
* partitioned into one or more segments and delivered to a client u... | TOOL | 0.876327 | 5.308695 |
c3ac134a-f75d-4eb4-ad4a-1ac29318b49d | devmpemba/dhis2-practical-interview | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
83a697d9-c3f6-4ed0-9108-ca072daf4036 | TINY-KE/active_object_slam | Thirdparty/DBoW2/DBoW2/FORB.cpp | #include <vector>
#include <string>
#include <sstream>
#include <stdint-gcc.h>
#include "FORB.h"
using namespace std;
namespace DBoW2 {
// --------------------------------------------------------------------------
const int FORB::L=32;
void FORB::meanValue(const std::vector<FORB::pDescriptor> &descriptors,
FOR... | ALGO | 0.994199 | 6.565643 |
c2707ba6-bda3-4428-a603-0289e67f1cfb | jmisrbackup/monarch_active_perception | active_perception_controller/src/particle_filter.cpp | #include <active_perception_controller/particle_filter.h>
/** Default constructor
*/
ParticleFilter::
ParticleFilter
()
{
map_ = NULL;
ran_generator_ = gsl_rng_alloc(gsl_rng_taus);
}
ParticleFilter::
ParticleFilter
(const nav_msgs::OccupancyGrid *map)
{
map_ = map;
// Compute free space in map
... | ALGO | 0.982974 | 5.534191 |
dcf6ba34-737b-4287-8076-608c2534a6d2 | pkuzw/LeetCode-Zhao-Wei- | Elimination Game.cpp | ///@file Elimination Game
///@author Wei Zhao
///@date 2016.09.23
///@version 1.0
///@version 1.1
///@version 1.2
/*
There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afterward until you reach the end of the list.
Repeat the previous ... | ALGO | 0.999974 | 5.9073 |
484e13be-5605-46d3-84de-21cbbed39693 | ajaxlt/OnlineProgram | 剑指Offer/最长不含重复字符的子字符串.cpp | #include <iostream>
#include <string>
using namespace std;
/*
* 来源: 剑指Offer
* 题目: 最长不含重复字符的子字符串
*
* 描述:
* 从字符串中找出一个最长不含有重复字符的子字符串,输出其长度
*
* 思路:
* 限尾dp法,
* dp[i] = dp[i - 1] + 1 -> if str[i] not exist before or ... str[i] exist, and distance of duplication over length
* dp[i] = i - exits[i] -> else
*/
class S... | ALGO | 0.998752 | 4.621038 |
b5d3466d-4d57-4465-8121-1afbc5d2dcc2 | manikanta2901/ubuntu | .history/imp/cpp/Algorithm/DynamicPrograming/BinomialCoefficient_20210117163544.cpp | //Its is similar to fabinocci series
#include<bits/stdc++.h>
using namespace std;
int GetBinomialValue(int n, int k){
int dp[n + 1][k + 1];
for(int i = 0; i <= n; i++){
for(int j = 0; j <= min(k,i); j++){
if(j == 0 || j == i){
dp[i][j] = 1;
}else{
... | ALGO | 0.999989 | 5.008811 |
2ba7b853-c7b5-43ab-b3d4-cefe3be4a7b0 | hurourou2001/Back_To_Space_Station | Space_station.cpp | // Project Identifier: 950181F63D0A883F183EC0A5CC67B19928FE896A
// Space_station.cpp
// project1
//
// Created by ROUROU on 2023/1/14.
//
#include<getopt.h>
#include<cstdlib>
#include<string>
#include<vector>
#include<string>
#include<iostream>
#include<deque>
#include<cstring>
#include<sstream>
#include"Space_stat... | ALGO | 0.997232 | 3.530474 |
eff83787-c07e-443e-8283-b7c49d5ca7c1 | nikhil-x24/DSA_Practics | Day_66-Graph1/1-adjMatrix.cpp | #include <iostream>
using namespace std;
class Graph{
bool** adjMatrix;
int numVertices;
public:
Graph(int v){
this->numVertices = v;
adjMatrix = new bool*[numVertices];
for(int i=0; i<numVertices; i++){
adjMatrix[i] = new bool[numVertices];
for(int j=0... | ALGO | 0.996969 | 5.352025 |
062fdec6-fe94-416f-938c-4a449fd993b4 | Samiul-Hossain/LeetCode | 206-reverse-linked-list/206-reverse-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:
ListNode* reverseList... | ALGO | 0.999706 | 5.583438 |
e335a18f-722c-4901-b147-0f9217b840f8 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/july/ChefAndDragonDens_20200712231308.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<unordered_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 ... | ALGO | 0.999983 | 4.36133 |
638992e4-7b81-40f5-b1a7-9d00514b4d84 | koosaga/olympiad | POI/poi95_slo.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 222;
const int inf = 1e6;
int n, dp[MAXN][MAXN];
string s, t[MAXN];
int main(){
cin >> s >> n;
dp[0][0] = 1;
for(int i=1; i<=n; i++){
cin >> t[i];
for(int j=0; j+t[i].size() <= s.size(); j++){
if(s.substr(j, t[i].si... | ALGO | 0.999997 | 4.029758 |
637b548c-90fc-4178-9dc8-0398f54ea36c | xzhseh/miniob | unittest/lower_bound_test.cpp | //
// Created by Wangyunlai on 2022/9/5.
//
#include <vector>
#include "gtest/gtest.h"
#include "common/lang/lower_bound.h"
using namespace common;
TEST(lower_bound, test_lower_bound)
{
int items[] = {1, 3, 5, 7, 9};
const int count = sizeof(items) / sizeof(items[0]);
std::vector<int> v(items, items + count);
... | TEST | 0.950926 | 5.721594 |
951a7835-cfaa-41b6-a428-ab61302127c3 | chenzhou06/project-euler | problem10/c.cpp | #include <iostream>
#include <cmath>
#include <ctime>
#define NUM 2000000
using namespace std;
bool isPrime(long long n) {
long long i;
for (i = 2; i < (long long)sqrt(n)+1; i++) {
if (n % i == 0) return false;
}
return true;
}
int main() {
clock_t start = clock();
long long i, sum = ... | ALGO | 0.999384 | 4.228981 |
29d7ac16-833f-4b05-8e78-dc49eb2f6b49 | joaqs123/Coding-Practice | Euler_Project_Practice/palindrome.cpp | #include <iostream>
using namespace std;
int main() {
int product;
int reverse, remainder;
int palindrome_highest = 0;
for (int i = 999; i>100; i--){
for (int j = 999; j>100; j--){
product = i * j;
int temp = product;
reverse = 0;
while(temp > 0... | ALGO | 0.999985 | 6.854109 |
a55b84ea-def8-42e5-81be-ea8e4ad8045a | darrylteo/cp4-solutions | 3 Problem Solving Paradigms/2. Divide and conquer/b. Bisection Method and BSTA (Easier)/carefulascent.cpp | #include <bits/stdc++.h>
using namespace std;
// algebra not bisection. speed = dist / time
struct shield {
int lower, upper;
double factor;
};
int main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//freopen("error.txt", "w", stderr);
ios::sync_with_stdio(fa... | ALGO | 0.999625 | 3.950922 |
9fe8521b-3876-42ac-ba35-67bda3d1a1b0 | y-suraj/Leetcode-problems-solutions | Arrays/15._3Sum.cpp | class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
sort(nums.begin(), nums.end());
int n = nums.size();
vector<vector<int>> res;
for(int i=0; i<n; i++){
if(i>0 && nums[i]==nums[i-1]) continue;
int l = i+1, r = n-1;
while(l... | ALGO | 0.999952 | 6.189356 |
6d82fd38-d653-49ae-878a-d74a7093b939 | openasic-org/xkISP | src/cmc.cpp | #include "cmc.h"
uint14 cmc_clip(int21 a, int lower, int upper){
uint14 result;
if(a < lower)
result = lower;
else if (a > upper)
result = upper;
else
result = a;
return result;
}
void cmc(top_register top_reg, cmc_register cmc_reg, stream_u36 &src, stream_u42 &dst) {
u... | ALGO | 0.988854 | 4.450537 |
e7c39b5c-41ea-43f4-bf5e-d610b571f3be | Nasir-Uddin-Mollah/XPSC_Club | week7/day1/Maximise_Score.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> v(n);
for (auto &&i : v)
{
cin >> i;
}
vector<int> dif(n - 1);
dif[0] = abs(v[0] - v[1]);
dif[n - 2] ... | ALGO | 0.999953 | 4.537342 |
94115ec1-9916-42fb-85f2-214a4b9702ff | mascot6699/Code-X | STL/minmax.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main () {
pair<int,int> result = std::minmax({1,2,3,4,5});
std::cout << "minmax({1,2,3,4,5}): ";
std::cout << result.first << ' ' << result.second << '\n';
return 0;
}
| ALGO | 0.999406 | 4.45533 |
066f95e3-eaf3-4e09-9d45-04da594ec979 | AymanAzzam/AC-Circuit-Solver | eigen/unsupported/doc/examples/MatrixPower_optimal.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix4cd A = Matrix4cd::Random();
MatrixPower<Matrix4cd> Apow(A);
std::cout << "The matrix A is:\n" << A << "\n\n"
"A^3.1 is:\n" << Apow(3.1) << "\n\n"
"A^3.3 is:\n" << Apow(3.3) << "\n\n"
... | ALGO | 0.99878 | 3.415202 |
b70abc8a-7dc0-4cec-815b-bbc49230b5e2 | iRobot42/Codewars | 7 kyu/Lost number in number sequence.cpp | #define V2
#ifdef V1
#include <numeric>
int findDeletedNumber( std::list< int > s, std::list< int > m ) {
return s.back() * ++s.back() / 2 - accumulate( m.cbegin(), m.cend(), 0 );
}
#elif defined( V2 )
#include <numeric>
int findDeletedNumber( std::list< int > s, std::list< int > m ) {
s.splice( s.cend(), m );
... | ALGO | 0.991206 | 4.131635 |
f5df8a63-2562-46c4-8119-c1772a0420bd | coldEr66/online-judge | ZJ/b480.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n)... | ALGO | 0.999986 | 3.503935 |
626301f5-f9d8-4daa-999b-024c150eb806 | AnuragPatel1/Codeforces-Problem | B_Subsequence_Update.cpp | #include <bits/stdc++.h>
using namespace std;
#define PI (3.141592653589)
#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i,j) for(int i = 0; i<j; i++)
#define rrep(i,j) for(int i = j; i>=0; i--)
#define all(x) x.begin(), x.end()
#define print(x) cout << x << endl
#define YES co... | ALGO | 0.999897 | 3.950886 |
203cdf58-8888-405b-8efa-6f4a208991e9 | SolidDogor/Repaso-CPP | CPP CURSO 1/ALGORITMO BASICO/CLASE 5/Ejercicios Propuestos Alejandro Olivos clase5/EjercicioPropuesto1.cpp | //libreria de e/s de datos
#include <iostream>
using namespace std;
main(){
//declarar variables
int opc;
string num;
//entrada
cout<<"Ingresar su nmero del [1-5]:";cin>>opc;
//proceso
switch(opc){
case 1:num="Uno";break;
case 2:num="Dos";break;
case 3:num="Tres";break;
case 4:num="Cuatro";break;
case... | TOOL | 0.954352 | 3.969788 |
e7a09cab-c078-4cab-ae65-5147bf0e549e | Ashokav008/LeetCode | Detect cycle in a directed graph - GFG/detect-cycle-in-a-directed-graph.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool isCyclic(int node,vector<int>adj[],vector<int>&vis){
vis[node]=1;
for(auto child : adj[node]){
if(!vis[child]){
if(isCyclic(child,adj,vis))
... | ALGO | 0.999862 | 6.359522 |
f984930b-a734-4641-9c41-9f15360cb3cc | aphrim/codeforces-workspace | completed/1100/fun-wth-even-subarrays.cpp | #include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T> istream& operator>>(istream& in, vector<T>& a) {for(auto &x : a) in >> x; return in;};
template<typename T> ostream& operator<<(ostream& out, vector<T>& a) {for(auto &x : a) out << x << ' '; return out;};
template<typename K,... | ALGO | 0.999861 | 4.388273 |
e63fecc9-65e3-47f8-a020-600f741cc04c | tylerfilla/umsl-competition-2019 | prog5.cpp | /*
* Tyler Filla
* OPC19 - Program 5
*/
// Bunch o' headers
// These were prepared before the competition, so many may be unneeded
#include <algorithm>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
... | ALGO | 0.999331 | 4.501994 |
0a469c05-3b63-442d-bdae-f6d93a3e47f6 | sir-rasel/Online_Judge_Problem_Solve | Lightoj/lightoj_1249.cpp | #include <bits/stdc++.h>
using namespace std;
struct input{
string name;
int l,h,w,vol;
};
bool comp(input a,input b){
if(a.vol<b.vol) return true;
return false;
}
int main(){
int test,cs=1;
scanf("%d",&test);
while(test--){
int n;
scanf("%d",&n);
input arr[n+5],th... | ALGO | 0.999811 | 3.590643 |
4c666d0b-bb25-48bf-86d7-0a86280fc5c1 | pandey-abhinav/comp-prog | kattis/blackfriday.cpp | // C LIBRARIES
#include <cstring>
#include <cmath>
// C++ LIBRARIES
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
// MACROS
#define INF std::numeric_limits<int>::max()
#define EPS 1e-9
#define MAX_N 1000005
////////////////////////////////////////////... | ALGO | 0.999952 | 5.087674 |
82b947b7-b329-4ec4-9d15-00da19f4fa9b | AlgorithmStudy2021/algorithm | programmers/level2/2021.06.07~2021.06.13(10주차)/점프와 순간이동/점프와순간이동_ggongchi765.cpp | #include <iostream>
using namespace std;
int solution(int n)
{
int ans = 1;
while(n!=1)
{
if(n%2==0)
n=n/2;
else
{
ans++;
n--;
}
}
return ans;
} | ALGO | 0.999704 | 5.157366 |
ae3bf645-0b61-4d2f-9aac-515613a9e32a | an-sla/hse-algorithms-and-data-structures | Lecture 3_12.04.22/RSQ.cpp | #include <iostream>
#include <vector>
// Подсчёт базовых префиксных сумм:
int main() {
size_t vect_size;
std::cin >> vect_size;
std::vector<int> a;
for (size_t i = 0; i < vect_size;
++i) { // Заполняем исходный вектор из потока ввода
int temp;
std::cin >> temp;
a.push_back(temp);
}
std::... | ALGO | 0.999929 | 5.3789 |
45418f0e-aef2-45a7-b3ee-dff55465bf89 | ugozapad/xray-2212 | xrLC/xrMU_Model_Calc_lighting.cpp | #include "stdafx.h"
#include "fitter.h"
union var
{
int i;
float f;
bool b;
operator float() { return f; }
operator int() { return i; }
operator bool() { return b; }
var& operator = (float _f) { f=_f; return *this; }
var& operator = (int _i) { i=_i; return *this; }
var& operator = (bool _b) { b=_b;... | ALGO | 0.969873 | 4.747691 |
75825193-4a22-4a39-a4ff-079859e2a3c8 | Keisuke-eng/opencv-haarcascades | samples/cpp/intelligent_scissors.cpp | #include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
struct Pix
{
Point next_point;
double cost;
bool operator > (const Pix &b) const
... | ALGO | 0.998499 | 6.061769 |
8e494661-113e-4ba5-a5a9-397ef70cc9c1 | Xushi8/Code | 2024/August/niuke7/k.cpp | // 2024/08/06 14:18:49
#ifdef LOCAL
#include <basic_std_lib.h>
#else
#include <bits/stdc++.h>
#endif
using namespace std;
constexpr int P = 1e9 + 7;
// assume -P <= x < 2P
int norm(int x)
{
if (x < 0)
x += P;
if (x >= P)
x -= P;
return x;
}
template <class T>
T qpow(T a, int b)
{
T res ... | ALGO | 0.999965 | 4.803009 |
eff9a1f0-6f39-41bb-9031-abcaa16a4537 | Shrey4125/CPP-Practicals | Practicals/Practical-7/Practical-7.2/Practical-7.2(1)/Practical-7.2(1).cpp | /*Question: A data analysis firm is developing a tool to process large text files and extract key statistics, such as
the total number of characters, words, and lines. This tool is essential for tasks like document indexing,
text summarization, and data validation. Given the varying sizes of input files, the system mus... | TOOL | 0.971976 | 5.605958 |
b049467a-5613-4ac2-8fac-0e7a89007f2b | pratyakshacode/Data-Structures---C-and-Java | begin/NStack.cpp | #include<bits/stdc++.h>
using namespace std;
class NStack{
int * arr;
int * top;
int* next;
int freespot;
int n,s;
public:
NStack(int S,int N){ //S -> size of main array ...... and ..... N-> total no. of stack to be implemented
s = S;
n = N;
arr = new i... | ALGO | 0.999391 | 3.899993 |
9baff327-5202-4c70-a5ce-ac2d22371b13 | HandongProblemSolvers/Problem-Solving | problems/Greedy algorithm/BOJ 11509/배하람.cpp | #include <cstdio>
int n;
const int _size = 1000001;
int a[_size],count[_size];
int main(void)
{
scanf("%d",&n);
for(int i=1; i<=n; i++) scanf("%d",&a[i]);
for(int i=1; i<=n; i++){
if(count[a[i]+1]){
count[a[i]+1]--;
count[a[i]]++;
} else {
count[a[i]]++... | ALGO | 0.999857 | 3.893087 |
e06a4d19-9fa4-4d9f-9f37-f5c3693647e5 | GitCodeBoy/unreal-editor-dev | Engine/Plugins/Experimental/Water/Source/Runtime/Private/GerstnerWaterWaves.cpp | #include "GerstnerWaterWaves.h"
#include "GerstnerWaterWaveSubsystem.h"
#include "WaterModule.h"
#include "Engine/Engine.h"
// ----------------------------------------------------------------------------------
void FGerstnerWave::Recompute()
{
const float Gravity = 980.0f;
const float Dispersion = 2.0f * PI / WaveL... | ALGO | 0.941285 | 6.203157 |
c92ed153-e15a-4935-a3b1-db47f231365b | ishandutta2007/codeforces | vladprog/normal/1181/A.cpp | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>
#ifndef ONLINE_JUDGE
//#define DEBUG
#endif
#ifdef DEBUG
#define IFD(...) __VA_ARGS__
#define IFN(...)
#define L cout<<__LINE__<<"\n";
#define PRINT(...) __VA_ARGS__ cout<<__LINE__<<" :... | ALGO | 0.999884 | 3.93331 |
d8801507-6422-4347-a034-1b4cf3bd412d | Kevin923/cpp_learningnotes | 二刷-7二叉树/7二叉搜索树的修改与构造/669.修剪二叉搜索树_递归.cpp | /*
* @lc app=leetcode.cn id=669 lang=cpp
*
* [669] 修剪二叉搜索树
*/
// @lc code=start
/**
* 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), ... | ALGO | 0.999982 | 7.160625 |
feda74d0-88fc-4867-8c38-15162f9ad1c1 | JungHyaechang/Algorithm | 프로그래머스/1/68644. 두 개 뽑아서 더하기/두 개 뽑아서 더하기.cpp | #include <algorithm>
#include <vector>
using namespace std;
vector<int> solution(vector<int> number)
{
// 2개 뽑아서 합 vector로
vector<int>answer;
for (int i = 0; i < number.size() - 1; i++) {
for (int j = i + 1; j < number.size(); j++) {
int k = number[i] + number[j];
auto it = find(answer.begin(), answer.end... | ALGO | 0.99989 | 5.388423 |
2b4318fd-2cce-4206-b0ed-064576c908db | Vishal6811/DAA-Practical | daapractical/knapshap01Problem.cpp | /* A Naive recursive implementation of
0-1 Knapsack problem */
#include <bits/stdc++.h>
using namespace std;
// A utility function that returns
// maximum of two integers
int max(int a, int b) { return (a > b) ? a : b; }
// Returns the maximum value that
// can be put in a knapsack of capacity W
int knapSack(int W, i... | ALGO | 0.999993 | 5.849602 |
2aa3024c-f839-4b5a-b919-a5574068193c | scycy2/Reduction-of-A-General-Graph-to-Have-Minimum-Number-of-Edges | example/OtherLayoutMethod/kamada_kawai.cpp | #include "kamada_kawai.hpp"
#define MAX_VERTEX_ITERS_COUNT 50
KamadaKawai::KamadaKawai(Graph *g, double k, double energy_threshold) {
vector<vector<int>> distances = floyd_warshall(g);
this->g = g;
this->energy_threshold = energy_threshold;
int size = g->getNumberOfVertices();
// find bigges... | ALGO | 0.999959 | 5.320709 |
ac94fdb6-0759-4940-b20b-ebab9bb94514 | HeonSeok98/CPP | cpp09/ex02/PmergeMe.cpp |
#include "PmergeMe.hpp"
PmergeMe::PmergeMe(char** argv) : timeVector(0), timeList(0), timeDeque(0) {
for (int i = 1; argv[i]; i++) {
if (!isNumber(argv[i])) {
throw AnyError();
}
dataVector.push_back(atoi(argv[i]));
dataList.push_back(atoi(argv[i]));
dataDeque.push_back(atoi(argv[i]));
}
for (unsigne... | ALGO | 0.999167 | 4.878346 |
9ce327c7-71e6-4291-a4f5-ca64353419d3 | wm-kim/Problem_Solving | PS/Project1/Baekjoon/2263.cpp | #include <iostream>
#include <algorithm>
#include <vector>
const int MAX = 100001;
using namespace std;
int N, inorder[MAX], postorder[MAX], idx[MAX];
void GetPreOrder(int inStart, int inEnd, int postStart, int postEnd)
{
if (inStart > inEnd || postStart > postEnd) return;
int root = postorder[postEnd];
int rootIdx ... | ALGO | 0.999996 | 4.71488 |
278aa648-7213-4ae4-9caa-4005cc7e985e | fabianjust/classroom-exo | Classroom-Exo/signal_generator.cpp | #include "signal_generator.h"
// Private function declarations
static void initStep(SignalGenerator_t* sig);
static void initRamp(SignalGenerator_t* sig);
static void initSine(SignalGenerator_t* sig);
static float generateStepSignal(SignalGenerator_t* sig);
static float generateRampSignal(SignalGenerator_t* sig);
stat... | TOOL | 0.893855 | 6.067382 |
b8788723-a5d8-4706-a010-8301a2456e6b | ChoonHean/Kattis | src/combinationlock.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
const int in... | ALGO | 0.99962 | 4.292241 |
c81912fd-61ec-43cb-83e5-055c8ba6df50 | mapu/toolchains | llvm-3.8.0-r267675/lib/Analysis/CFLAliasAnalysis.cpp | // N.B. AliasAnalysis as a whole is phrased as a FunctionPass at the moment, and
// CFLAA is interprocedural. This is *technically* A Bad Thing, because
// FunctionPasses are only allowed to inspect the Function that they're being
// run on. Realistically, this likely isn't a problem until we allow
// FunctionPasses to... | TOOL | 0.85903 | 7.775931 |
9773b32b-2327-40c8-bcaf-a291a6cbf201 | arp1561/competitive-programming | codechef/remiss.cpp | #include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
int T; cin>>T;
while(T>0)
{
int a,b; cin>>a>>b;
cout<<max(a,b)<<" "<<max(a,b)+min(a,b)<<endl;
T--;
}
}
| ALGO | 0.999829 | 4.417256 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.