uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d2b84183-c5df-4b31-b57f-6682a94e063a | Many2333/image_segmentation | boost_1_63_0/libs/multi_index/perf/test_perf.cpp | #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <algorithm>
#include <assert.h>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/ne... | TOOL | 0.854297 | 7.568899 |
7cfb6dde-ce54-40d5-a484-aabc2638fa3f | klaymen1n/portal-sdk-2013 | src/utils/vbsp/boundbox.cpp | #include "vbsp.h"
#include "BoundBox.h"
//#include "hammer_mathlib.h"
//#include "MapDefs.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
float V_rint(float f)
{
if (f > 0.0f) {
return (float) floor(f + 0.5f);
} else if (f < 0.0f) {
return (float) ceil(f - 0.5f);
} el... | TOOL | 0.88008 | 7.529393 |
f758218b-237a-43fd-8e4b-b888b566d83d | madhav-bits/Coding_Practice | leetMinOperReduceXZero.cpp | /*
*
//******************************************1658. Minimum Operations to Reduce X to Zero.************************************************
https://leetcode.com/problems/minimum-operations-to-reduce-x-to-zero/
*******************************************************************TEST CASES:***************************... | ALGO | 0.999959 | 6.172458 |
3ace7d1e-7441-4f2d-8ff7-d1bcb9374241 | natsalete/desafios-de-codigo-do-beecrowd | beecrowd-1-iniciante/1048 - Aumento de Salรกrio.cpp | #include <stdio.h>
#include <stdlib.h>
int main() {
double salinc, salfim, reajuste;
scanf("%lf", &salinc);
if (salinc > 0 && salinc <= 400.00){
salfim = salinc * 1.15;
reajuste = salfim - salinc;
printf("Novo salario: %.2lf\nReajuste ganho: %.2lf\nEm percentual: %d %%\n", salfim,... | ALGO | 0.999625 | 3.773715 |
ade26f10-1a32-4a8b-8160-ac81624306b9 | Lotuses-robot/Codes | Contest/zsyz/20231017/B/B.cpp | template<typename T>
void read(T &r) { r = 0; static char ch, last; ch = getchar(), last = 'z'; while (ch < '0' || ch > '9') last = ch, ch = getchar(); while (ch >= '0' && ch <= '9') r = (r << 1) + (r << 3) + (ch ^ 48), ch = getchar(); r = (last == '-') ? -r : r; }
template<typename T, typename...Ts>
void read(T &arg, ... | ALGO | 0.999653 | 3.27056 |
3c7f1bdd-4ad9-4d1a-8b50-5072a4d76ffb | zhenqihu/CS106B-22Summer | Assignment/Assignment 6/Demos/ApportionmentGUI.cpp | #include "Apportionment.h"
#include "GUI/MiniGUI.h"
#include "Utilities/CSV.h"
#include <iomanip>
using namespace std;
namespace {
const string kNotSelected = "-";
const int kInvalidChoice = INT_MIN;
const string kBaseDir = "res/apportionment/";
const string kFileExtension = ".csv";
/* Loads the c... | TOOL | 0.886162 | 6.43124 |
6e7563a8-8e4d-4a49-a1ca-fd53a38b5068 | vucongtuanduong/cpp-codeptit | sort/cpp0418/cpp0418.cpp | #include <iostream>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
void testCase();
void testCase2();
void testCase3();
int main () {
int t;
cin >> t;
while (t--) {
testCase3();
cout << endl;
}
}
void testCase() {
int n,m;
cin >> n >> m;
int a[n];
... | ALGO | 0.999974 | 3.04117 |
858f3b27-858e-4278-9438-266dc6a60419 | art-daq/artdaq-database | artdaq-database/ConfigurationDB/dispatch_ucondb.cpp | #include "artdaq-database/ConfigurationDB/common.h"
#include "artdaq-database/ConfigurationDB/dispatch_ucondb.h"
#include "artdaq-database/ConfigurationDB/options_operations.h"
#include "artdaq-database/BasicTypes/basictypes.h"
#include "artdaq-database/DataFormats/shared_literals.h"
#include "artdaq-database/JsonDoc... | TOOL | 0.850074 | 6.838654 |
a355d5e8-55ec-4eec-825c-67f14147cc8a | sinian666/code_41_25 | cpp_ๅฏๆฌ6/chapter_stack_and_queue/queue.cpp | /**
* File: queue.cpp
* Created Time: 2022-11-28
* Author: qualifier1024 (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
/* ๅๅงๅ้ๅ */
queue<int> queue;
/* ๅ
็ด ๅ
ฅ้ */
queue.push(1);
queue.push(3);
queue.push(2);
queue.push(5);
queue.push(4);
cout << "้ๅ q... | TOOL | 0.892603 | 5.1045 |
d59f7bed-9433-4d09-9842-3eedbc92b316 | hamilton8415/FreeSurfaceHydrodynamics | examples/ExcitingForceExample.cpp | #include <Eigen/Dense>
#include <boost/numeric/odeint.hpp>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <gnuplot-iostream.h>
#include <iostream>
#include <limits>
#include <csignal>
#include <string>
#include <unistd.h>
#include <vector>
#include <memory>
#include <FreeSurfaceHydrodynamics/config.h>... | ALGO | 0.981013 | 5.882484 |
8653d60c-5ca2-4558-be39-c406bb2ba02b | projectxcel/projectxcl | src/chainparams.cpp | #include <chainparams.h>
#include <chainparamsseeds.h>
#include <consensus/merkle.h>
#include <hash.h> // for signet block challenge hash
#include <tinyformat.h>
#include <util/system.h>
#include <util/strencodings.h>
#include <versionbitsinfo.h>
#include <assert.h>
#include <boost/algorithm/string/classification.hp... | CONFIG | 0.930492 | 6.573786 |
27107ee5-3db3-4c6f-b213-40299f4d739f | stuck-in-a-local-optimum/dataStructure_and_algorithms | binaryTree/BST/catalanNumbers.cpp | #include <iostream>
using namespace std;
//CATALAN NUMBERS: Cn = Sum(Ci.Cn-i) for i=0 to n-1
//C0 = 1, C1=1
//example:
// C2 = C0.C1 + C1.C0 = 2
// C3 = C0.C2 + C1.C1 + C2.C0 = 5
// C4 = C0.C3 + C1.C2 + C2.C1 + C3.C0 = 14
//returns nth catalan //we will optimize it in DP
int catalan(int n){
if(n==0 || n==1){... | ALGO | 0.999698 | 5.248899 |
b1026338-e4d0-43fe-9319-af589526ee96 | Xu-Jack11/ACM-Learning | CodeForces/Round 1037 Div.3/2126C.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int h=a[k-1],t=1;
sort(a.begin(),a.end());
while(h!=a.back())
{
int tmp=*upper_bound(a.begin(),a.end(),h);
if(tmp-h<=h... | ALGO | 0.999969 | 4.331224 |
f32878aa-610c-41c1-9ed5-3f4c9032ec8f | salmonfishycooked/CP | luogu/problem/P4716/P4716.cpp | #include <bits/stdc++.h>
using i64 = long long;
class ZhuLiu {
public:
struct Edge {
int u, v;
i64 w;
};
int n;
std::vector<Edge> edges;
i64 sum;
explicit ZhuLiu(const int n) : n(n), sum(0) {}
void addEdge(const int u, const int v, const i64 w) {
edges.push_back... | ALGO | 0.999907 | 4.586237 |
487098f4-7ca9-44da-8893-11c700162dd3 | PrachieNaik/DSA | DP/KingdomWar/KingdomWar.cpp | /*
Problem statement: Two kingdoms are on a war right now, kingdom X and kingdom Y. As a war specialist of kingdom X, you scouted kingdom Y area.
A kingdom area is defined as a N x M grid with each cell denoting a village.
Each cell has a value which denotes the strength of each corresponding village.
The strength ca... | ALGO | 0.999997 | 5.213113 |
e3791a37-123d-4e1c-a476-bcd9a8331819 | Bkmakwana2002/Youtube-Videos-Codes | Minor_reduction.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
void solve()
{
// Now lest solve the problem
// we will take the input in string for esay itertaion
// you can do it with number the concept will be same
string s;
cin>>s;
int n = s.size();
// now there will be two cases... | ALGO | 0.999914 | 5.700569 |
186a6f50-ef7f-41cc-9775-c15477cd5a04 | raincross7/code-similarity | codes/train_code/problem382/problem382_236.cpp | #include<atcoder/all>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>
using namespace std;
using namespace atcoder;
#define ll long long
#define... | ALGO | 0.999661 | 4.223143 |
3a418394-3b74-410d-952a-b6f9ebfdb7fc | chaudharyaryanpanwar/LearningDSA | RecursionLearning/BinaryEquivalent.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
void binaryEquivalent(int n ){
if (n==0)return ;
binaryEquivalent(n/2);
cout << (n%2) << " ";
}
int main() {
binaryEquivalent(7);
return 0;
} | ALGO | 0.999988 | 4.727527 |
95e57b4e-f326-4d46-9090-14e58ad55bd6 | QuMIke/PCL_PRACTICE | Registration/IterativeClosestPointNonLinear.cpp | /*
This document demonstrates using the Iterative Closest Point algorithm in order to incrementally register a series of point clouds two by two.
The idea is to transform all the clouds in the first cloudโs frame.
This is done by finding the best transform between each consecutive cloud, and accumulating these transfo... | ALGO | 0.98423 | 7.408054 |
0fab81cb-fb71-4709-8fb2-2a31205b3a9e | tanishka2004/DSA | BS/Aggresive_cows.cpp | bool canweplace(vector<int> &nums, int dist, int k){
int n = nums.size();
int cnt_cows = 1;
int last_cow = nums[0];
for(int i = 0; i<n; i++){
if(nums[i] - last_cow >= dist){
cnt_cows++;
last_cow = nums[i];
}
if(cnt_cows >= k) return true;
}
return ... | ALGO | 0.999997 | 5.179036 |
23aafd1f-6998-410e-aefa-74d88f313518 | Remonhasan/tle-eliminators-cp-sheet-solution | 900/A-Odd-Divisor.cpp | #include<bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define ll long long
#define lli long long int
#define vi vector < int >
#define vl vector < long long >
#define PR pair < int, int >
#define RAB(i, a, b) for (int i = a; i < b; i++)
#define brain for(int i=0;i<n;i++)
... | ALGO | 0.998971 | 4.873137 |
ac169db6-0b90-473c-8b2a-59565ccac895 | Thanh-Fourteen/FHD_Ver3_Buoi2 | B27.cpp | #include<stdio.h>
int main() {
int N;
scanf("%d", &N);
printf("%02d", N % 100);
}
| ALGO | 0.978038 | 3.002539 |
6264ff9b-b286-4c9f-ac5d-a56e8b3d4194 | yinniyin/Coursera-Algorithmic-Toolbox | week4/inversions.cpp | #include <iostream>
#include <vector>
using std::vector;
using std::swap;
int64_t get_number_of_inversions(vector<int> &a, vector<int> &b, size_t left, size_t right) {
int64_t number_of_inversions = 0;
if (right <= left + 1) return number_of_inversions;
size_t ave = left + (right - left) / 2;
number_of_inversi... | ALGO | 0.999938 | 4.474201 |
325c0cb8-2102-4d3b-b7bd-7a6659795e83 | Survedog/AlgorithmSolutions | Baekjoon/2618.cpp | /*
* Problem: https://www.acmicpc.net/problem/2618 (๊ฒฝ์ฐฐ์ฐจ)
* ๋ถ๋ฅ: ๋์ ๊ณํ๋ฒ
*
* ๊ฒฝ์ฐฐ์ฐจ์ ์์น๋ ๋ฐ๋์ ์์์ ํน์ ์ฌ๊ฑด์ด ์ผ์ด๋ ์ฅ์์ด๋ฏ๋ก, ๋ฉ๋ชจ์ด์ ์ด์
์ ํ, ์ด ๋ฒํธ ๋์ ์ฌ๊ฑด์ด๋ ์์์ ์ ๋ํ ์ธ๋ฑ์ค๋ก ๊ฒฝ์ฐฐ์ฐจ์ ์์น๋ฅผ ํํํ๋ฉด ๋ฉ๋ชจ๋ฆฌ ๊ณต๊ฐ์ ์ ์ฝํ ์ ์๋ค.
* ์ฒ์์ ๊ฒฝ์ฐฐ์ฐจ1, 2์ ์์น ๋ฐ ๋ค์ ์ฌ๊ฑด์ ๋ฒํธ๋ฅผ ๋ฉ๋ชจ์ด์ ์ด์
ํ๋ ๋์ ๊ณํ๋ฒ์ ์ํํ๋ ค ํ์ผ๋, ์ธ ๊ฐ์ ์ต๋ ํฌ๊ธฐ๊ฐ ๋๋ฌด ์ปค ์๊ฐ๊ณผ ๋ฉ๋ชจ๋ฆฌ ๊ณต๊ฐ์ด ๋ถ์กฑํ ๊ฒ์ด๋ผ ์๊ฐํ๋ค.
* ์ด๋ ๋งค ๋ฐ๋ณต์์ ๋ฐ๋ก ์ด์ ์ฌ๊ฑด๊น์ง์ ๋ฉ๋ชจ๋ง ํ์ํ๋ค๋ ์ฌ์ค์ ์ด์ฉ... | ALGO | 0.999986 | 4.265234 |
89689343-2c44-415a-b3fe-0d5caa008e36 | mohitbabani/CP-Probelm-Solutions | Contests/cc code senso/Games_of_Wasseypur.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll,ll>
#define ld long double
#define pb push_back
#define ull unsigned long long
#define inf LLONG_MAX
#define all(vec) vec.begin(),vec.end()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fr(i,b,a) for(ll i=b;i>=0;i--)
#define IOS ios_ba... | ALGO | 0.999995 | 5.128763 |
2f500eee-89ae-4b3e-a0be-6561acf5b187 | manavtore/Leethub | 330-patching-array/patching-array.cpp | class Solution {
public:
int minPatches(vector<int>& nums, int n) {
int cnt=0,i=0;
long long maxNum=0;
while (maxNum<n){
if (i<nums.size() && nums[i]<=maxNum+1)
maxNum+=nums[i++];
else{
maxNum+=maxNum+1;cnt++;
}
}
return cnt;
}
}; | ALGO | 0.999853 | 6.526264 |
3d612d4b-057a-441d-942c-075bee01051a | ZZAMBAs/baekjoon | brute-force/problem_1025.cpp | /*
//
// Created by AppDeveloper on 2022-10-26.
//
#include <iostream>
using namespace std;
int N, M, team = -1, board[9][9];
char ins;
bool isSquare(int num){
int s = 0, e = 31623;
while (s <= e){
int m = (s + e) / 2;
int cmp = m * m;
if (cmp == num)
return true;
... | ALGO | 0.999964 | 5.382296 |
f0ebb5ca-902b-4bca-a818-a384c8664a65 | amanhex/Leetcode-Solutions | 287. Find the Duplicate Number.cpp | /*
Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive.
There is only one repeated number in nums, return this repeated number.
You must solve the problem without modifying the array nums and uses only constant extra space.
Example 1:
Input: nums = [1,3,4,2,2... | ALGO | 0.999988 | 6.84072 |
c60e06b6-3159-4b30-b209-a882ae1e4a42 | raveeshsamkaria/DSA | DoWhileLoop/Q5.cpp | // Print char from 'A'to'Z' & 'Z'to'A' using Do While Loop.
#include <iostream>
using namespace std;
int main() {
char i;
cout << "Alphabets from (A-Z) are:\n";
i=65;
do {
cout<<i<<" ";
i++;
} while(i<=90);
cout << "\nAlphabets from (a-z) are:\n";
i=95;
do {
cou... | TOOL | 0.933794 | 3.362455 |
fc1af6aa-c7a7-4a74-9240-41f3657e5881 | Shuo-Niu/Cpp_Coding_Practice | tree/suspects.cpp | #include <stdio.h>
#include "union_find_set.c"
#define MAXN 30000
int main() {
int n, m, k;
cin >> n >> m; /* n, number of students; m, number of societies */
while(n > 0) {
ufs_t* ufs = ufs_create(MAXN);
while(m--) {
int x, y;
int rx, ry;
cin >> k; /* k... | ALGO | 0.999207 | 4.113915 |
be2d0071-6f89-4e4a-8a8e-715f4a653b71 | QiE2035/DataStruct | ClassDesign/Homework/Sort.cpp | /**
* @file Sort.cpp
* @author ๆๆ็ปด (่ฎก็ฎๆบ212-15)
* @brief ๅฟซ้ๆๅบ ๅ ๆๅบ
* @version 0.1
* @date 2022-12-07
*
* @copyright Copyright (c) 2022
*
*/
#include <bits/stdc++.h>
using namespace std;
/**
* @brief ๆฐๆฎ็ฑปๅ
*
*/
typedef int DataType;
/**
* @brief ๅฟซ้ๆๅบๅๅฒ
*
* @param R ๅพ
ๆๅบๅ
ๅฎน
* @param low ไฝไธๆ
* @param high ... | ALGO | 0.999884 | 4.769677 |
15edf5f4-2920-4416-97e2-46b9744d5836 | SanketMarathe2001/Cpp-Tutorial | Graph & Trees/CodeForces_GregandGraph.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 510;
const int INF = 1e9+10;
long long dist[N][N];
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
cin>>dist[i][j];
}
}
vector<int> del_order(n);
for(int i=0;i<n;i++){
cin>>del_order[i];
}
reverse(del_order.begin(),d... | ALGO | 0.999953 | 3.759822 |
95ebfbe9-5c1c-4366-b137-b36cb65d546f | Rishabhcodes65536/RISHABH_CP | distinctOR.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define int long long
#define lb lower_bound
#define ub upper_bound
#define eb empla... | ALGO | 0.999905 | 4.908105 |
720f834b-ef8f-4cc3-9dd3-d62bb9b3260e | manikanta2901/ubuntu | .history/SRM/placementPractice/HackerRank/DataStructure/MergeTwoSortedArrays_20210310191923.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *next;
};
void printList(struct Node *a){
cout << "List : ";
while(a != NULL){
cout << a->data << " ";
a = a->next;
}
cout << endl;
}
Node* GetInput(int size){
struct Node *temp,*head = NULL;
... | ALGO | 0.999852 | 3.581266 |
aa7c2041-fcc3-48be-b7e2-4c0d6bc91fc5 | Sakshi123u/DSA | Tree/inserting_BST_recurrsion.cpp | #include<iostream>
using namespace std;
// Node class to represent each node
class node{
public:
node *lchild;
int data;
node *rchild;
};
// BST_tree class to manage BST operations
class BST_tree{
private:
node *root;
int key;
public:
// Constructors
BST_tree();
BST_tree(in... | ALGO | 0.999433 | 6.991965 |
ab762e20-3075-4009-baf1-8b159f9c6353 | AlejandroCancheKu/EjerciciosProgramacionEstructurada | Funciones/FuncionSuma(Ejemplo 4).cpp | #include <stdio.h>
#include <conio.h>
#include <locale.h>
int Suma(); //Prototipo de la funcin
main(){
int Respuesta;
setlocale(LC_CTYPE,"Spanish");
Respuesta=Suma();
printf("\nEl resultado de la suma es: %d",Respuesta);
printf("\nPulse cualquier tecla para terminar...");
getch();
return 0;
} //... | TOOL | 0.963153 | 3.967849 |
73a520a7-8fd8-42b2-a9a1-f32741819712 | rylahs/Study_Previous | CPP,CodingTest/Baaarking/0x04/PS/1158.cpp | // 0x04. ์ฐ๊ฒฐ ๋ฆฌ์คํธ
// Written by : Rylah
// Date : 2022.02.02
// 1158. ์์ธํธ์ค ๋ฌธ์
// https://www.acmicpc.net/problem/1158
// https://www.acmicpc.net/source/38457298
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
queue<int> q;
fo... | ALGO | 0.999996 | 4.604703 |
ea02653b-b790-44f2-b31c-c00f40527ced | derekli-NJ/Learn-to-Walk-with-Genetic-Algorithm | src/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp | #include <Box2D/Dynamics/Joints/b2PrismaticJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Linear constraint (point-to-line)
// d = p2 - p1 = x2 + r2 - x1 - r1
// C = dot(perp, d)
// Cdot = dot(d, cross(w1, perp)) + dot(perp, v2 + cross(w2, r2) - v1 - cross(w1, r1))
// = -dot... | ALGO | 0.997419 | 7.704068 |
d64478d1-f07d-4b70-9be7-7d2afe16567d | TanYongF/algorithm | ๅ
ถไป/ๅๆบๆ็ญ่ทฏๅพ2.cpp | #include <iostream>
#include <climits>
using namespace std;
int n, m, start, endIndex;
int ways[2501][2501];
long long dist[2501];
bool visited[2501] = {false};
int main(){
cin >> n >> m >> start >> endIndex;
//่ทฏๅพ้ป่ฎคไธบๆๅคงๅผ
for (int i = 0; i <= 2500; i++)//init
for (int j = 0; j <= 2500; j++)
ways[i][j] = INT_MA... | ALGO | 0.999721 | 3.889408 |
14acebe1-98ee-4bd0-93df-3aad08f2f03a | ProjectMatrixx/android_frameworks_av | media/libheadtracking/VectorRecorder.cpp | #include "media/VectorRecorder.h"
namespace android::media {
// Convert data to string with level indentation.
// No need for a lock as the SimpleLog is thread-safe.
std::string VectorRecorder::toString(size_t indent) const {
return mRecordLog.dumpToString(std::string(indent, ' ').c_str(), mMaxLocalLogLine);
}
/... | TOOL | 0.914727 | 6.953985 |
ec6b039c-6bf4-4335-8336-4f857191baf6 | alexandraback/datacollection | solutions_5634947029139456_0/C++/gabrielinelus/main.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int N,L;
int v[20];
int priza[20];
int app[20];
int tstCASE;
int binaryto10(char c[20])
{
int x = L;
int put = 0,rez = 0;
for(int i = x - 1; i >= 0; --i,++put)
rez += (1<<put)*(c[i]-48);
return rez;
}
int nrb(int x)
{
int nrb = 0... | ALGO | 0.999926 | 3.586805 |
a458263c-fa5c-4cc6-9333-c49990da58e7 | Alvi847/Ejercicios_FAL | Divide y vencerรกs/Elemento_mayoritario/main.cpp | // Nombre del alumno .....
// Usuario del Juez ......
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
using namespace std;
// funciรณn que resuelve el problema
int resolver(const vector<int>& v, int ini, int fin) {
// Casos base
if(ini == fin) return 0;
if(ini + 1 == fin) retur... | ALGO | 0.999989 | 4.380513 |
f89a9629-a806-4e22-9a1d-73d868255d97 | Jeffrin2005/Dynamic_Programming | House Robber.cpp | class Solution {
private:
int solve(vector<int>& nums, int i, vector<int>& dp) {
if(i >= nums.size()) return 0;
if(dp[i] != -1) return dp[i];
int pick = solve(nums, i+2, dp) + nums[i];
int nonPick = solve(nums, i+1, dp);
return dp[i] = max(pick, nonPick);
}
public:
... | ALGO | 0.999956 | 5.96514 |
2df50e97-56c4-4475-b875-a4f980d3bf8d | rutu-1010/Cpp-DSA | Pointers/pass_by.cpp | #include<iostream>
using namespace std;
int change(int a){
a = 20; //passs by value
cout<<a<<"\n";
}
int change_by_pointer(*ptr){ //pass by reference pointer
*ptr = 20;
cout<<ptr;
}
int change_by_reference(int ¶){
para = 20;
cout<<para;
}
int main(){
int a = 10;... | ALGO | 0.999128 | 3.55024 |
f02d654c-1ff8-4d82-9981-af30a992a5ea | silverfoxpt/CFRep | CODE_PROBLEM/NASTYA_AND_DOORS.cpp | #include <algorithm>
#include <utility>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <climits>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <random>
#include <cmath>
using namespace... | ALGO | 0.999971 | 3.664304 |
4b6984d8-91e1-4a81-8f99-179feeca0a12 | hztttt/Synergistic_Optimization | lammps_DeepSPIN/src/KOKKOS/pair_dpd_tstat_kokkos.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Matt Bettencourt (NVIDIA)
------------------------------------------------------------------------- */
#include "pair_dpd_tstat_kokkos.h"
#include "atom.h"
#include "atom_kokkos.h"
#include "memory_k... | ALGO | 0.992285 | 6.468029 |
5a538c09-de4c-463e-902a-f5c283c13ad9 | ishandutta2007/codeforces | strawberryc/normal/1672/F1.cpp | #include <bits/stdc++.h>
template <class T>
inline void read(T &res) {
res = 0; bool bo = 0; char c;
while (((c = getchar()) < '0' || c > '9') && c != '-');
if (c == '-') bo = 1; else res = c - 48;
while ((c = getchar()) >= '0' && c <= '9')
res = (res << 3) + (res << 1) + (c - 48);
if (bo) res = ~res + 1... | ALGO | 0.999992 | 3.75197 |
62623f1c-c2f0-43fd-bc4a-93e40cf85e32 | HonestFreak/blind75 | 12_num_of_1bits.cpp | //leetcode 191
#include<iostream>
using namespace std;
//Brian Kernigham's Algorithm
//clear the rightmost set until the number becomes 0
int hammingWeight(uint32_t n) {
int count=0;
while(n!=0){
n &= (n-1); //clearing the rightmost set
count++;
}
return coun... | ALGO | 0.999726 | 5.684436 |
a5c8a3e4-92cd-4c53-a198-1ec1facc8a5c | JN513/codigosc- | c++/troca3.cpp | #include <iostream>
using namespace std;
int main()
{
int n, temp, res = 0;
cin >> n;
temp = n/100;
res += temp;
if(temp)
{
n = n - (temp * 100);
}
temp = n/50;
res += temp;
if(temp)
{
n = n - (temp * 50);
}
temp = n/25;
res += temp;
if(temp)
{... | ALGO | 0.99846 | 4.085068 |
08a04711-35f4-47e5-80d2-bfed561108fd | SwathiM77/DSA | Bit Manipulation/Find the two numbers in array which are non-repeating.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> twoNonRepeatingNumbers(int arr[], int n){
sort(arr,arr+n);
vector<int>res;
int i=0;
for(i=0;i<n-1;i++){
if(arr[i] != arr[i+1]){
res.push_back(arr[i]);
}
else{
i++;
}
}
if(arr[i-1] !... | ALGO | 0.999937 | 3.768872 |
d91679a4-473f-4993-8f9a-17778267ed70 | ishandutta2007/codeforces | swistakk/normal/229/D.cpp | #include <iostream>
#include <set>
#include <vector>
#include <map>
#include <algorithm>
#define M 8192
#define N 5005
#define INF 1000000000
using namespace std;
// int drz[2*M];
int h[N];
int dp[N][N];
int pre[N];
int ziom[N];
int palec[N];
int main()
{
ios_base::sync_with_stdio(0);
int n;
cin>>n;
for... | ALGO | 0.999831 | 3.29662 |
8cdda0df-77ec-4380-8d4c-135b92ba6f6e | ankit7248/Dsa_Basic_Ques_Abdul_Bari | linkedlist/prac.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
}
*first = NULL;
class Linkedlist
{
public:
Node *p, *t;
void create(int A[], int x)
{
first = new Node;
first->data = A[0];
first->next = NULL;
p = first;
for (int i = 1... | ALGO | 0.999981 | 4.49174 |
c5f35c49-f827-4e89-af6c-fafc22c6a215 | SzymKwiatkowski/bev-lidar | src/bev_lidar_offline_node.cpp | #include <sstream>
#include <vector>
#include <errno.h>
#include <assert.h>
#include <sensor_msgs/msg/point_cloud2.hpp>
#include <sensor_msgs/msg/camera_info.hpp>
#include "bev_lidar/cloud_filter/cloud_filter.hpp"
#include "bev_lidar/bev_lidar_offline_node.hpp"
#include <pcl_conversions/pcl_conversions.h>
#include <c... | DATA | 0.869223 | 5.503966 |
ee6202bd-527d-4f97-97ee-fe8278f66bf5 | marcandreB/Algo_Question2 | ConsoleApplication3/ConsoleApplication3/tests.cpp | #include "jeu.hpp"
#include <algorithm>
#include <assert.h>
#include <iostream>
#include <string>
// Retourne la somme des degats de plusieurs monstres
// Theta(n)
unsigned int degat(const std::vector<Monstre>& monstres) {
unsigned int degat = 0;
for (std::vector<Monstre>::const_iterator i = monstres.begin(); i !... | ALGO | 0.997164 | 4.143665 |
65d5de17-993b-4652-bf77-0c25988b1fc9 | M4ur0MP/Project_IOT | Projects/Marlin-2.1.1/Marlin/src/gcode/motion/G5.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(BEZIER_CURVE_SUPPORT)
#if AXIS_COLLISION('I') || AXIS_COLLISION('J')
#error "G5 parameter 'I' or 'J' collision with axis name."
#endif
#include "../../module/motion.h"
#include "../../module/planner_bezier.h"
/**
* Parameters interpreted according to:
* https://li... | ALGO | 0.90634 | 7.580794 |
5fdabc33-0c0a-4c6b-b129-6b9890bb686d | ivan-gavran/antlab | system_0/ros_simulation/src/navigation-indigo-devel/amcl/src/amcl/map/map_cspace.cpp | #include <queue>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "map.h"
class CellData
{
public:
map_t* map_;
unsigned int i_, j_;
unsigned int src_i_, src_j_;
};
class CachedDistanceMap
{
public:
CachedDistanceMap(double scale, double max_dist) :
distances_(NULL), scale... | ALGO | 0.999762 | 4.932097 |
adfc5652-74a9-40e0-a524-b760ff42da3d | ShubhangiAwasthi-2004/CPP-Practice | MinCostHouses.cpp | //Given a 2D array houses[][], consisting of n 2D coordinates {x, y} where each coordinate represents the location of each house,
//the task is to find the minimum cost to connect all the houses of the city.
//The cost of connecting two houses is the Manhattan Distance between the two points (xi, yi) and (xj, yj)
//i.... | ALGO | 0.999976 | 6.372543 |
feff0fa1-a90d-47b9-aed1-30ef4c8192f2 | Xilinx/llvm-aie | libcxx/test/std/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp | // bitset<N>& operator^=(const bitset<N>& rhs); // constexpr since C++23
#include <bitset>
#include <cassert>
#include <cstddef>
#include <vector>
#include "../bitset_test_cases.h"
#include "test_macros.h"
template <std::size_t N>
TEST_CONSTEXPR_CXX23 bool test_op_xor_eq() {
std::vector<std::bitset<N> > const ca... | TEST | 0.952254 | 7.404771 |
da8cb5be-3b3a-4281-9b8b-5eea6b62d681 | jun-pac/PS | 241111/4set/E.cpp |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define cediv(a,b) ((a)%(b)==0?((a)/(b)):((a)/(b))+1)
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(i,b) rng(i,0,b-1)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
#define per(i,b) gnr(i,b-1,0)
#define pb push_back... | ALGO | 0.998824 | 4.119609 |
db386532-caa7-434f-bfef-dd4b10beffcf | Almoontasir/C--C-plus-plus-ProblemSolving | recursion/14th.cpp | #include<bits/stdc++.h>
using namespace std;
int binarySearch(int *a,int l,int r,int item)
{
int m;
if(l<=r)
{
m = l+(r-l)/2;
if(a[m]==item)
return m;
else if(a[m]>item)
return binarySearch(a,l,m-1,item);
else if(a[m]<item)
return binarySea... | ALGO | 0.999964 | 4.538149 |
0dae8c81-d7b7-4ad3-be12-04c228578e72 | jellytech3438/uva-oj | uva10038/quesion.cpp | #include <cstdlib>
#include <iostream>
#include <map>
#include <math.h>
using namespace std;
int main(int argc, char *argv[]) {
int n;
while (cin >> n) {
int ns[n];
int prev;
bool isjelly = true;
for (int i = 0; i < n; i++) {
cin >> ns[i];
}
map<int, int> cnt;
for (int i = 0; i ... | ALGO | 0.999767 | 3.9775 |
c88a0193-3f4b-4b35-adfb-2faea504787e | HYBB-rash/algorithm | PAT_Advan/1079.cpp | // ๆ ็้ๅ DFS ็ๅบ็จ
#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
using namespace std;
const int N = 1e6 + 10;
int e[ N ], ne[ N ], h[ N ], idx = 0;
map<int, int> prods;
void add( int a, int b ) { e[ idx ] = b, ne[ idx ] = h[ a ], h[ a ] = idx++; }
int n;
double rate, price;
double sum = 0;... | ALGO | 0.999636 | 3.981864 |
38a3562a-5a36-4cb1-8c4f-ff34dd827825 | Vaishnavi-redddy/Problem-statements | 10.Longest_Palindromic_Sequence.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<vector<int>>dp;
bool isPalindrome(string str)
{
int m=str.size(),left=0,right=m-1;
while(left<=right)
{
if(str[left]!=str[right])
{
return false;
}
left++;
right--;
}
return true;
}
st... | ALGO | 0.999947 | 5.638382 |
b18038fc-f48b-4615-8aee-c8799a437a12 | TarcioPassosFreitas/Banco-Bita | Mobile/banco_bita_mobile/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.995204 | 6.786404 |
387ddabc-bb47-428f-ac49-04f766309094 | sunilsy08/leetcode-submissions | 1672-richest-customer-wealth/1672-richest-customer-wealth.cpp | class Solution {
public:
int maxWealth(vector<vector<int>>a, int i, int &max){
if(i >= a.size()) return max;
int x = maxWealth(a, i+1, max);
int sum = 0;
for(int j=0;j<a[0].size();j++)
sum += a[i][j];
if(sum >= max){
max = sum;
}
... | ALGO | 0.999639 | 5.703923 |
8dbdb4ca-8d26-43ea-b3f3-592df1abdabb | quinnvoker/godot-qurobullet | servers/physics_3d/godot_body_pair_3d.cpp | /**************************************************************************/
/* godot_body_pair_3d.cpp */
/**************************************************************************/
/* This file is part of: */
/* ... | ALGO | 0.994263 | 4.408396 |
f34f268c-177b-42d4-a610-010eadbf46bb | 222464/ERL | ERL/source/ERL/simulation/EvolutionaryTrainer.cpp | #include <erl/simulation/EvolutionaryTrainer.h>
#include <erl/field/Field2DGenes.h>
#include <algorithm>
using namespace erl;
EvolutionaryTrainer::EvolutionaryTrainer()
: _runsPerExperiment(1),
_numElites(3),
_greedExponent(2.0f)
{}
void EvolutionaryTrainer::create(size_t populationSize,
const Field2DEvolverSetti... | ALGO | 0.98937 | 6.200506 |
ff7ec7a3-5f0c-4a07-b28a-cb5f176d3141 | komaljot/Practice-GFG | Basic/Bit Difference/bit-difference.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:
// Function to find number of bits needed to be flipped to convert A to B
int countBitsFlip(int a, int b){
// Your... | ALGO | 0.999556 | 5.721462 |
1e19d48e-b7dd-4a94-a781-3c08378a946b | sidjha57/Coding-Data-Transfer | Competitive/C++/Unacademy/Tries/Print_unique_prefix.cpp | //template
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//typedef trie<strin... | ALGO | 0.99991 | 4.681313 |
fa91c61c-132f-4f17-b59b-9a7bb6a161fa | AbhiGaur2002/CODSOFT | WORDCOUNT.cpp | #include<iostream>
#include<fstream>
using namespace std;
int main()
{ cout<<"Created by Abhi Gaur\n\n";
cout<<"Enter the file name\n";
string p;
cin>>p;
ifstream file(p);
if(file)
{
cout<<"The file exists\n";
char c[40];
int cnt=0;
while(!file.eof())//eof=end of file
{ file>>... | TOOL | 0.851081 | 3.451832 |
62c2032d-903c-4ca8-85a3-811c4557aa42 | sanoopsandy/BasicOCR | libraries/eyes-two/src/main/jni/hydrogen/src/utilities.cpp | /* smart sharpen
* PIX *edgemask = pixThreshedSobelEdgeFilter(pix8, 16, 2, L_ALL_EDGES);
* PIX *enhanced = pixUnsharpMasking(pix8, UNSHARP_HALFWIDTH, UNSHARP_FRACTION);
* PIX *blended = pixBlendWithGrayMask(normalized, enhanced, edgemask, 0, 0);
*/
#include "leptonica.h"
#include "utilities.h"
void numaJoin(NUMA ... | TOOL | 0.9458 | 4.649297 |
ecddaec4-1e2d-4197-ab1c-0e01ca6a8b29 | yalue/hip_plugin_framework | src/third_party/rodinia_plugins/dwt2d/dwt.cpp | #include <assert.h>
#include <errno.h>
#include <error.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
#include "plugin_hip_utilities.h"
#include "plugin_utilities.h"
#include "common.h"
#include "dwt.h"
#include "dwt_plugin_state.h"
#include "hip_common.h"
#include "hip_dwt.h"
inl... | ALGO | 0.893694 | 5.45763 |
00d89936-d883-4f12-bbe1-a8c8b01f25d5 | rakeshakkineni/Term2_P5_CarND_MPC_Project | src/Eigen-3.3/doc/examples/make_circulant2.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
// [circulant_func]
template<class ArgType>
class circulant_functor {
const ArgType &m_vec;
public:
circulant_functor(const ArgType& arg) : m_vec(arg) {}
const typename ArgType::Scalar& operator() (Index row, Index col) const {
Index index = ... | ALGO | 0.998923 | 5.538595 |
50fb92af-4cb0-4760-9202-a87124ff24dd | lcultx/fork-om3d | 3DObjectManipulation/3rdparty/pbrt/shapes/nurbs.cpp | // shapes/nurbs.cpp*
#include "stdafx.h"
#include "shapes/nurbs.h"
#include "shapes/trianglemesh.h"
#include "paramset.h"
#include "texture.h"
// NURBS Evaluation Functions
static int KnotOffset(const float *knot, int order, int np, float t) {
int firstKnot = order - 1;
int knotOffset = firstKnot;
while (... | ALGO | 0.998376 | 5.228212 |
6aba95d8-1350-41bb-9248-d09518ca2c80 | dzungpng/material-point-method-jello-simulation | Deps/libigl/include/igl/copyleft/cgal/assign_scalar.cpp | IGL_INLINE void igl::copyleft::cgal::assign_scalar(
const CGAL::Epeck::FT & cgal,
CGAL::Epeck::FT & d)
{
d = cgal;
}
IGL_INLINE void igl::copyleft::cgal::assign_scalar(
const CGAL::Epeck::FT & _cgal,
double & d)
{
// FORCE evaluation of the exact type otherwise interval might be huge.
const CGAL::Epeck::... | TOOL | 0.877884 | 6.449433 |
3e90588a-33b8-4f32-ab56-0da58e0f8636 | backsani/Coding-Test | ํ๋ก๊ทธ๋๋จธ์ค/2/1844.โ
๊ฒ์โ
๋งตโ
์ต๋จ๊ฑฐ๋ฆฌ/๊ฒ์โ
๋งตโ
์ต๋จ๊ฑฐ๋ฆฌ.cpp | #include <vector>
#include <queue>
using namespace std;
int solution(vector<vector<int> > maps)
{
int answer = 0;
queue<pair<pair<int, int>, int>> q;
vector<vector<bool>> visited(maps.size(), vector<bool>(maps[0].size(), false));
visited[0][0] = true;
vector<pair<int, int>> direction = {{-1, ... | ALGO | 0.999851 | 5.133182 |
e5843037-7c24-4d0d-85da-7ad432d3f26e | Hamilton-Liu/JSU-Data-Structure-And-Algorithm-Design | Assignments/Assignment_01_List/src/revisal/test3/test3.cpp | #include <iostream>
#include <assert.h>
using namespace std;
#include "Status.h"
#include "Node.h"
#include "LinkList.h"
template <class DataType>
void Display(const DataType & e)
{ cout << e << " "; }
//3-2
template <class DataType>
int Frequency(LinkList<DataType> &list, DataType &e){
if(list.IsEmpty())
... | ALGO | 0.996602 | 3.739385 |
2ac8727a-6d56-4aab-a274-c78b49391786 | perman0519/Problem_Solving | 0x0C/6603.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int ret[6];
void recur(int cur, int start, vector<int>& vec) {
if (cur == 6) {
for (int i = 0; i < 6; i++) {
cout << ret[i] << ' ';
}
cout << '\n';
return;
}
for (int i = start; i < vec.size(); i++) {
ret[cur] = vec[i];
r... | ALGO | 0.999527 | 3.94919 |
3bfef1ff-4c22-4941-8d8a-fa616140725e | BrandonShute/DataStructuresAndAlgorithmsSpecialization | AlgorithmicToolbox/src/main/resources/coursera.downloads/week4_divide_and_conquer/4_number_of_inversions/inversions.cpp | #include <iostream>
#include <vector>
using std::vector;
long long get_number_of_inversions(vector<int> &a, vector<int> &b, size_t left, size_t right) {
long long number_of_inversions = 0;
if (right <= left + 1) return number_of_inversions;
size_t ave = left + (right - left) / 2;
number_of_inversions += get_n... | ALGO | 0.999902 | 4.447427 |
61de938d-aee1-4d73-8d41-4a66b3f2a08f | bxck75/Python_Helpers | dlib_local/examples/least_squares_ex.cpp | /*
This is an example illustrating the use the general purpose non-linear
least squares optimization routines from the dlib C++ Library.
This example program will demonstrate how these routines can be used for data fitting.
In particular, we will generate a set of data and then use the least squares ... | ALGO | 0.999881 | 7.50285 |
934d4a15-42a6-480d-b9d1-b380eba4b50e | AnoTherK-ATK/sorting-experiment | code/experiment.cpp | #include <bits/stdc++.h>
#include <chrono>
// using namespace std;
using std::chrono::high_resolution_clock;
using std::chrono::duration_cast;
using std::chrono::duration;
namespace quicksort{
#include "QuickSort.h"
}
namespace mergesort{
#include "MergeSort.h"
}
namespace heapsort{
#include "HeapSort.h"... | ALGO | 0.997891 | 5.206427 |
10f8ccfa-8ddc-4612-b760-28092cdfb621 | Taejin1221/Problem-Solving | Baekjoon/Baekjoon20173.cpp | // Baekjoon20173.cpp
// https://www.acmicpc.net/problem/20173
#include <iostream>
using namespace std;
using pii = pair<int, int>;
pii getIndegree(int direction, bool isPrev) {
if (isPrev) {
if (direction == 0)
direction = 3;
else if (direction == 1)
direction = 2;
else if (direction == 2)
direction ... | ALGO | 0.999993 | 4.123871 |
cffc1595-883f-4dde-a001-1adcb28dbe9b | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Gemma/top0-100/get-biggest-three-rhombus-sums-in-a-grid-Solution.getBiggestThree/177767_DoS.cpp | static bool decode_openldap_dereference(void *mem_ctx, DATA_BLOB in, void *_out)
{
void **out = (void **)_out;
struct asn1_data *data = asn1_init(mem_ctx);
struct dsdb_openldap_dereference_result_control *control;
struct dsdb_openldap_dereference_result **r = NULL;
int i = 0;
if (!data) return false;
control = ... | ALGO | 0.991846 | 4.255876 |
e6af928a-1c5a-4d8a-94db-71e76c3781a4 | rossmarinaro/spaghyeti_source-engine | src/vendors/box2d/src/collision/b2_chain_shape.cpp | #include "../../include/box2d/b2_chain_shape.h"
#include "../../include/box2d/b2_edge_shape.h"
#include "../../include/box2d/b2_block_allocator.h"
#include <new>
#include <string.h>
b2ChainShape::~b2ChainShape()
{
Clear();
}
void b2ChainShape::Clear()
{
b2Free(m_vertices);
m_vertices = nullptr;
m_count = 0;
}
... | ALGO | 0.97459 | 6.524336 |
964d55bf-d515-47d4-9d80-b5173d80e1bc | chowon986/Study | ๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ/๋์ ํ์ ์/๋์ ํ์ ์.cpp | // ๋์ ํ์ ์.cpp
#include <iostream>
#include <string>
using namespace std;
int main()
{
float sumScore = 0;
float sumSubject = 0;
for (int i = 0; i < 20; i++)
{
string a, b, c;
cin >> a >> b >> c;
float temp = 0.f;
if (c == "A+") temp = 4.5f;
else if (c == "A0") temp = 4.0f;
else if (c == "B+") tem... | ALGO | 0.998436 | 3.83082 |
8bed5c8d-09aa-4404-9451-a17ac904ffec | neverac/2020summer | ไธชไบบ่ต9/A/26790659_3019210117_A.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int a[200005];
int main(){
int n;
scanf("%d",&n);
int i;
for(i=0;i<2*n;i++){
scanf("%d",a+i);
}
sort(a,a+2*n);
long long int x=a[n-1]-a[0],y=a[2*n-1]-a[n],ans=x*y;
x=a[2*n-1]-a[0];
for(int i=1;i<n;i++){
y=a[i+... | ALGO | 0.999936 | 3.312222 |
f0e55721-5a45-41dd-bdb1-160c99f715ac | rnk00/code-tree | 250226/๋ ๊ฐ์ ๊ฒฉ์ ๋น๊ตํ๊ธฐ/compare-two-grid.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, M;
cin>>N>>M;
vector<vector<int>> A(N, vector<int>(M));
for(int i{0};i<N;i++){
for(int j{0};j<M;j++){
cin>>A[i][j];
}
}
vector<vector<int>> result(N, vector<int>(M));
for(int i{0};i<... | ALGO | 0.998862 | 3.297761 |
0007e20e-fb2a-4bfc-a1a4-8212bbf96b04 | Anttonii/leetcode-solutions | cpp/1727-largest-submatrix.cpp | class Solution
{
public:
int largestSubmatrix(vector<vector<int>> &matrix)
{
int ans = 0;
for (int j = 0; j < matrix[0].size(); j++)
for (int i = 1; i < matrix.size(); i++)
if (matrix[i][j] == 1)
matrix[i][j] += matrix[i - 1][j];
for (int ... | ALGO | 0.99992 | 5.154913 |
82a977da-c9a3-4552-9b65-e5893df34cd0 | Abiral3/Numerical-Methods | Lab4/Guass elimination method.cpp | #include <stdio.h>
#include <math.h>
#define MAX 10
int elim(int n, float a[MAX][MAX], float b[MAX])
{
int i, j, k;
float factor;
for (k = 1; k <= n - 1; k++)
{
for (i = k + 1; i <= n; i++)
{
factor = a[i][k] / a[k][k];
for (j = k + 1; j <= n; j++)
{... | ALGO | 0.999899 | 3.390232 |
2e3e8011-3b7b-4241-acfe-0a6117af3923 | SharifdotG/SharifdotG-s-CodeVault | Codeforces/800/1399B - Gifts Fixing/1399B_GiftsFixing.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int testCases;
cin >> testCases;
while (testCases--) {
int numberOfGifts;
cin >> numberOfGifts;
int giftsA[numberOfGifts], giftsB[numberOfGifts];
int minGiftsA = INT_MAX, minGiftsB = INT_MAX;
for (int i =... | ALGO | 0.999974 | 4.582042 |
da84fa48-d7dd-4808-ad91-8bb605c5fcb1 | klpkvx/LeetCode | 1030-smallest-string-starting-from-leaf/1030-smallest-string-starting-from-leaf.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.999995 | 6.504007 |
0e0ab7b7-09eb-476e-9608-f31402e7d704 | yuyangh/LeetCode | 723. Candy Crush.cpp | //
// Created by Yuyang Huang on 10/9/20.
//
#include "LeetCodeLib.h"
/*
* 723. Candy Crush
* Medium
*
* This question is about implementing a basic elimination algorithm for Candy Crush.
*
* Given a 2D integer array board representing the grid of candy,
* different positive integers board[i][j] represent diff... | ALGO | 0.999949 | 7.304118 |
e1d6c7b8-8178-410e-88dd-6757582e6dfa | BaoCQSE62960/pos_res_android | 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.998693 | 6.797273 |
633f7688-cbb5-4ad9-984a-6e58112f0d6b | daspushpita/athenak_updates | src/shearing_box/orbital_advection.cpp | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <utility>
#include "athena.hpp"
#include "globals.hpp"
#include "parameter_input.hpp"
#include "mesh/mesh.hpp"
#include "coordinates/cell_locations.hpp"
#include "shearing_box.hpp"
#include "mhd/mhd.hpp"
#include "remap_fluxes.hpp"
//---------------... | ALGO | 0.975196 | 5.121428 |
586703a0-1a92-4347-9e3c-6e2808c2b141 | Omkar-Peshkar/Codingbox | Basics/Q36.cpp | // Q36 wap to add 2 binary numbers?
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
using namespace std;
string binnaryconvertor(int n)
{
int i,j=1,q,r;
string a,no;
while(n>0)
{
q=n/2;
r=n%2;
n=q;
a+=to_string(r);
j++;
}
for(int k=j;k<=8;k++)
... | ALGO | 0.999944 | 4.234804 |
c126156f-2bfa-4fa2-a7fb-7561fd9f37aa | kaushlendra112/Sorting-Algorithms | insertionSort.cpp | #include<iostream>
using namespace std;
void insertionSort(int arr[],int n){
for(int i=0; i<n; i++){
int j=i;
while(j>0 && arr[j]<arr[j-1]){
int temp = arr[j];
arr[j] = arr[j-1];
arr[j-1] = temp;
j--;
}
... | ALGO | 0.99997 | 5.38102 |
1ebfddd3-7cd1-48c9-826c-1a614683881d | OleksiiTimofieiev/fun_with_c- | max_consecutive_one.cpp | #include <iostream>
#include <vector>
using namespace std;
int max_consecutive_one(vector<int> & nums)
{
int max_len = 0;
int n = nums.size();
int i = 0;
while (i < n)
{
if (nums[i] == 1)
{
int current_len = 1;
int r = i + 1;
while (r < n && nums[r] == 1)
{
++r;
++current_len;
}
i... | ALGO | 0.999732 | 5.680149 |
3ab2e0a0-f64c-4bfa-800a-8c1375289c4e | ishandutta2007/codeforces | ac-evil/normal/1467/A.cpp | #include <bits/stdc++.h>
const int N = 100005;
int T, n;
int main() {
for (scanf("%d", &T); T; T--) {
scanf("%d", &n);
if (n == 1) puts("9");
else if (n == 2) puts("98");
else {
printf("989");
for (int i = 4; i <= n; i++) printf("%d", (6+i)%10);
puts("");
}
}
return 0;
} | ALGO | 0.999828 | 4.309794 |
eed75e2d-a919-4f6b-a7f1-83b92db1b378 | abhishek18008/leetcode_problems | 2583.kth-largest-sum-in-a-binary-tree.cpp | /*
* @lc app=leetcode id=2583 lang=cpp
*
* [2583] Kth Largest Sum in a Binary Tree
*/
// @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) :... | ALGO | 0.99998 | 6.325361 |
0f357d39-23ed-467c-9806-84c95859a2c4 | Sachin-Wani/Leetcode-challenges | July Challenge/Day 5 - Hamming Distance.cpp | '''
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.
Given two integers x and y, calculate the Hamming distance.
Note:
0 โค x, y < 231.
Example:
Input: x = 1, y = 4
Output: 2
Explanation:
1 (0 0 0 1)
4 (0 1 0 0)
โ โ
The above arrows p... | ALGO | 0.999934 | 6.008407 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.