uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3f440281-f5cf-4e7f-9537-0190e9fd498c | shelleychen318/syde-121 | assignment1/part2_Shelley_Chen.cpp | /*
Name: Shelley Chen
Student ID: 21002650
Date: September 20, 2022
Course: SYDE 121
Lab Room: DC 1350
Assignment Number: 1
Exercise Number: 2
Filename: part2_Shelley_Chen.cpp
Name of C++ Project: Assignment 1.2
Program Description: Program that takes in a temperature in Farenheit from the user and converts it to Centi... | TOOL | 0.951693 | 5.208742 |
a37a8959-cdbb-4f60-ab80-0260778746a0 | UbiquitousLearning/Benchmark-On-Device-Training | source/backend/cpu/compute/CommonOptFunction.cpp | #include "CommonOptFunction.h"
#include <string.h>
#include <algorithm>
#include <math.h>
#include "math/Vec.hpp"
#include <vector>
int MNNGetC4DivNumber(int h) {
auto remain = h % 4;
if (0 == remain) {
return h / 4;
}
if (4 % remain == 0) {
return h / remain;
}
return h;
}
#ifn... | TOOL | 0.987677 | 5.05611 |
b85a2e1e-e075-40d2-a741-c123b0bb33ba | TranBaLoi/Code_C_plus_plus | PhanTichThuaSoNTo1.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t; cin >> t;
while(t--)
{
int n; cin >> n;
for(int i=2;i<=n/2;i++)
{
int cnt=0;
if(n%i==0)
{
while(n%i==0)
{
cnt++;
n/=i;
}
cout << i << " " << cnt << " " ;
}
}
if(n!=1) cout << n << " " << "1" << endl;
els... | ALGO | 0.999762 | 3.895786 |
63770ef4-19dd-434d-9d87-d68239f1d8a9 | jeyanandhini/phase-1-Chayan-11 | Programming Concepts/Data Structures/Array/Searching Algorithms/linear search.cpp | // Implementing Linear Search Algorithm in Array
#include<iostream>
using namespace std;
int main()
{
int n, key;
cout << "Enter the number of elements to be entered :" << endl;
cin >> n;
int a[1000];
int i;
for(i=0; i<n; i++)
{
cin >> a[i];
}
// Asking the user to enter the element to be searched
co... | ALGO | 0.999802 | 4.317096 |
4e923543-a82c-4ce5-8ed2-c5aec2e05da7 | raincross7/code-similarity | codes/train_code/problem200/problem200_234.cpp | #include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>
#include <cmath>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<vl> vv... | ALGO | 0.999992 | 4.878946 |
bd456383-b1a9-4637-871e-910766dfba8f | vijaymanikantareddy/LeetCode_GFG_solved | 3372-longest-strictly-increasing-or-strictly-decreasing-subarray/3372-longest-strictly-increasing-or-strictly-decreasing-subarray.cpp | class Solution {
public:
int longestMonotonicSubarray(vector<int>& nums) {
int res = 0;
for(int i = 0 ; i < nums.size() ; i++){
int j = i + 1;
int cnt = 1;
while(j < nums.size() && nums[j] < nums[j-1]){
j++;
cnt++;
}
... | ALGO | 0.999848 | 5.812945 |
10d8c0c2-9e2e-48e5-bde1-2a72f462cc96 | bernardoaa/Exercicios_Resolvido-cpp | exercicios-cpp/EX_1.5.cpp | #include <iostream>
using namespace std;
int main(){
//CALCULO DA FUNCAO f(x,y)=2x+3y COM x e y DADOS
float x, y, f;
f=(2*x)+(3*y);
cout << "\t\tCalculo da funcao f(x,y)=2x+3y com x e y dados\n\n";
cout << "Digite o valor de x: ";
cin >> x;
cout << "Digite o valor de y: ";
cin >> y;
cout << "f(x,y) = "... | ALGO | 0.991442 | 4.24242 |
ad4e7930-3942-4f06-87cd-c1b092565522 | Natasha261/Finalexam | Triangle.cpp | #include <iostream>
using namespace std;
// Function to calculate the third angle of a triangle
int ThirdAngle(int angle4, int angle6) {
return 180 - (angle4 + angle6);
}
int main() {
int angle4, angle6;
// Input the two angles
cout << " Enter the first angle of the triangle: ";
cin >> angle4;
... | ALGO | 0.998844 | 6.346747 |
f4258cc4-5931-4de2-8b98-19647a0fdb0a | aurastejeroiu/Basic-C-ALgorithms | P4.18/main.cpp | #include <iostream>
#include <iomanip>
using namespace std;
struct MatriceMN{
int m; //nr de linii
int n; //nr de coloane
int elem[10][10];
};
void CitireMat(MatriceMN &A){
cout<<"da numarul de linii:";
cin >>A.m;
cout<<"da numarul de coloane:";
cin >>A.n;
for(in... | ALGO | 0.999513 | 3.852825 |
0b0c90ea-fed2-4a08-abe1-ce01ac18aa5e | rouph/LOG2810 | TP1/log2810/sommet.cpp | #include "sommet.h"
#include<functional>
#include<array>
//Getters
Node::Node(int number, bool station):
previousNode(NULL)
, bHasStation(station)
, bIsInQueue(false)
{
stationNumber = new int(number);
vehicule* invalidStatus = new vehicule(0, invalidDistance);
vehiculeStatus.push_back(invalidStatus);
}
Node::... | ALGO | 0.987946 | 4.465865 |
35a939da-b735-492b-ad96-3cde7f9a6a19 | alisonprasai/CPP-Assignment | Basic/7.cpp | // For n = 10, write a C++ program that reads the integer n and prints its factorial.
#include<iostream>
using namespace std;
int main(){
int n = 10;
int fact = 1;
for (int i = 1 ; i <= n; i++ ){
fact = fact * i;
}
cout << "The factorial of " << n << " is " << fact << endl;
} | ALGO | 0.995755 | 4.196415 |
352938a2-f6d5-4c9e-85ad-42813addf5ab | Harshstar/LeetCode_Sol | 0081-search-in-rotated-sorted-array-ii/0081-search-in-rotated-sorted-array-ii.cpp | class Solution {
public:
bool search(vector<int>& nums, int target) {
sort(nums.begin(),nums.end());
int low=0,high=nums.size()-1;
while(low<=high)
{
int mid=low+(high-low)/2;
if(nums[mid]==target)
return true;
else if(nums[mid]>tar... | ALGO | 0.999988 | 6.216714 |
dbb2d435-8ec4-4478-b6d9-4a77dd2dffc8 | patmarion/boost-build | boost_1_45_0/libs/graph/example/incremental-components-eg.cpp | #include <iostream>
#include <vector>
#include <boost/foreach.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/incremental_components.hpp>
#include <boost/pending/disjoint_sets.hpp>
using namespace boost;
int main(int argc, char* argv[])
{
typedef adjacency_list <vecS, vecS, undirectedS> Graph... | ALGO | 0.998322 | 6.33074 |
612f4e63-4c3a-470c-924b-6d604a05d82d | IMRAN-5740/Programming-Contest | CodE_CheF/Find_Remainder.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int a,b;
cin>>a>>b;
int res=a%b;
cout<<res<<endl;
}
return 0;
} | ALGO | 0.999624 | 4.002817 |
29d3e8ed-39ee-48af-962c-df5b5ba6fe26 | kritirikhi/DataStructuresAndAlgorithms | ImplementStackWidVector.cpp | // We have to implement a stack with vector
#include <iostream>
#include<vector>
using namespace std;
// class stack
// include vector v of integer type as private memeber so that user can't access it directly
// public member functions include :-
// push() its adds the element to the back of the vector
// ... | ALGO | 0.998934 | 4.61118 |
7f82f88f-17c5-4c3e-b6b8-9def0e27fba7 | zjsxzy/Leetcode | Jump Game II/sol.cpp | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <vector>
#include <cstdio>
#include <string>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <limits.h>
using namespace std;
#define PB p... | ALGO | 0.999994 | 4.419614 |
454725d6-8189-46fb-a59c-b5884a8bd531 | alexandraback/datacollection | solutions_2645486_0/C++/tarunsapra/main.cpp | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<utility>
using namespace std;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pob pop_ba... | ALGO | 0.99982 | 3.057159 |
d77d6d4b-7a40-4271-8233-1d648ec23c0c | jeete121/Coding | Programs/Practice/Practice/prac.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
unordered_set<int> s;
s.insert(5);
s.insert(1);
s.insert(6);
s.insert(3);
s.insert(7);
s.insert(2);
cout << "Elements of unordered_set: \n";
for (auto it : s)
cout << it << " ";
return 0;
}
| ALGO | 0.968198 | 3.976146 |
07d720e8-b6d5-4a8a-92cb-ed2739389e14 | Subsentient/wz2100foundations | src/multisync.cpp | /*
* MultiSync.c
*
* synching issues
* This file handles the constant backstream of net info, checking that recvd info
* is concurrent with the local world, and correcting as required. Magic happens here.
*
* All conflicts due to non-guaranteed messaging are detected/resolved here.
*
* Alex Lee, pumpkin Studio... | TOOL | 0.982296 | 4.412817 |
92e2dcb7-0282-4a50-bb7b-5c248c0d30a0 | prashantkalokhe/Hactoberfest-2022-New | dsa-code/LinkedListH1.cpp | #include <bits/stdc++.h>
#include "header/linkedList.h"
using namespace std;
void printLinkedList(Node* head){
Node* temp = head;
while(temp!=NULL){
cout<<temp->data<<endl;
temp=temp->next;
}
}
Node* takeInput(){
int data;
cin>>data;
Node* head = NULL;
while(data != -1){
... | ALGO | 0.999348 | 4.636735 |
8badea80-4b9d-458f-8fa4-87a692b31de8 | mshong0320/cpp_algorithms | spiral_matrix.cpp | // given a matrix, apply a function spirally clockwise
// eg. |01, 02, 03, 04|
// |05, 06, 07, 08|
// |09, 10, 11, 12|
// |13, 14, 15, 16|
// |17, 18, 19, 20|
//
// -> [1, 2, 3, 4, 8, 12, 16, 20, 19, 18, 17, 13, 9, 5, 6, 7, 11, 15, 14, 10]
// Solved by: MINSUNG CHRIS HONG
// 09/30/2020
/*
Approa... | ALGO | 0.999969 | 7.028243 |
59eccbc6-c76c-475d-8bf3-d2595285c303 | sdobbs/halld_evtgen | src/EvtGenModels/EvtSVP.cpp | #include "EvtGenModels/EvtSVP.hh"
#include <cmath>
EvtSVP::~EvtSVP() {}
std::string EvtSVP::getName()
{
return "SVP";
}
EvtDecayBase* EvtSVP::clone()
{
return new EvtSVP;
}
void EvtSVP::decay_2body(EvtParticle* root)
{
root->initializePhaseSpace(getNDaug(), getDaugs());
// Photon is the first particle and ... | TOOL | 0.899751 | 4.95857 |
f64c2293-dee3-440e-a5a2-d4a286b450bf | ksalesin/point-line-mis | src/ext/openexr/PyIlmBase/PyImath/PyImathBox.cpp | #include "PyImathBox.h"
#include "PyImathVec.h"
#include "PyImathMathExc.h"
#include "PyImathDecorators.h"
#include "PyImathExport.h"
#include <boost/python/make_constructor.hpp>
#include <Iex.h>
#include <ImathBoxAlgo.h>
#include <PyImathTask.h>
#include <vector>
#include "PyImathBoxArrayImpl.h"
namespace PyImath {
u... | TOOL | 0.858074 | 7.597363 |
dbad2555-5547-43e1-8d0f-fdb04fd1f8e6 | voltek62/seo-viz-install | R-Portable/App/R-Portable/library/Rcpp/examples/ConvolveBenchmarks/convolve9_cpp.cpp | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
// this version expands convolve8_cpp by making Vec mimic the structure of
// NumericVector. It peforms well, so this is is not the structure of
// NumericVector that is the problem. So what is it then ?
//
// could it be because NumericVector is... | ALGO | 0.999073 | 6.450036 |
dd5d299d-5b9a-49dc-853d-61da0104a362 | jrosen3/change | hardware/resources/zxing-2.2/cpp/core/src/zxing/oned/Code128Reader.cpp | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#include <zxing/ZXing.h>
#include <zxing/oned/Code128Reader.h>
#include <zxing/oned/OneDResultPoint.h>
#include <zxing/common/Array.h>
#include <zxing/ReaderException.h>
#include <zxing/NotFoundException.h>
#include <zxing/FormatException.h>
#inc... | ALGO | 0.979963 | 5.319136 |
bebe4cb7-1e56-448a-8864-265ea83d8a28 | ahmedyar7/Problems | MissingNumber.cpp | #include <iostream>
using namespace std;
int missingNumber(int n, int array[]);
int main()
{
int array[] = {1, 2, 3, 5};
int n = sizeof(array) / sizeof(array[0]);
cout << missingNumber(n, array);
}
int missingNumber(int n, int array[])
{
int total = 1;
int i;
for (int i = 2; i < (n + 1); i++)
... | ALGO | 0.998971 | 3.796902 |
93d1e388-c760-4d8a-a894-a7c37c45bffc | Khushal41/DSASupreme-1.0- | Week15-Heaps/Lecture2-Heaps/Q2.cpp | // Min Heap
#include <iostream>
#include <queue>
using namespace std;
int main()
{
// min-heap
priority_queue<int, vector<int>, greater<int>> pq;
pq.push(3);
pq.push(6);
pq.push(9);
pq.push(4);
pq.push(8);
cout << "top element: " << pq.top() << endl;
... | ALGO | 0.999017 | 3.922018 |
c14438cf-a0e5-49ba-bb89-2514b387096c | Jafrin-khan/Practice | 0018-4sum/0018-4sum.cpp | class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target) {
sort(nums.begin() , nums.end());
int n = nums.size();
vector<vector<int>> ans;
for(int i = 0 ; i < n ; i++){
if(i != 0 && nums[i] == nums[i-1]) continue;
... | ALGO | 0.999964 | 6.032639 |
97059e10-1cf2-42e4-9ee0-dc049586436e | jhpetrichor/complex_prediction | src/lib/bio_information.cpp | /*
* @Description:
* @Author: jh
* @Date: 2024-04-30 17:11:48
* @LastEditTime: 2024-05-01 22:07:55
*/
#include "../../include/bio_information.h"
BioInformation::BioInformation() {
read_gene_expression();
read_go_slim();
read_subcellular();
}
void BioInformation::read_gene_expression() {
std::... | DATA | 0.879781 | 3.544323 |
f39547db-e5dc-4139-b6af-9f0008650998 | raincross7/code-similarity | codes/train_code/problem011/problem011_59.cpp | #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;
ll gcd(ll a, ll b) {
if (a % b == 0) return... | ALGO | 0.999979 | 4.234543 |
0e27889e-a15e-4fa6-9ad9-d238f754125c | jefferyyellow/UE4 | UnrealEngine-4.26/Engine/Source/ThirdParty/Intel/TBB/IntelTBB-2019u8/src/old/concurrent_queue_v2.cpp | #include "concurrent_queue_v2.h"
#include "tbb/cache_aligned_allocator.h"
#include "tbb/spin_mutex.h"
#include "tbb/atomic.h"
#include <cstring>
#include <stdio.h>
#if defined(_MSC_VER) && defined(_Wp64)
// Workaround for overzealous compiler warnings in /Wp64 mode
#pragma warning (disable: 4267)
#endif
#defi... | TOOL | 0.914705 | 6.943658 |
dbe9a4a9-7b63-4f56-90f0-46ee9e5838ad | minttea25/AlgorithmPractice | Baekjoon/10001-12000/P10844.cpp | // 쉬운 계단 수
// https://www.acmicpc.net/problem/10844
#include <iostream>
#include <vector>
#include <algorithm>
// It includes almost all header files for algorithm practice.
// It is not standard library header of C++, and used on only gcc compiler.
// #include <bits/stdc++.h>
using namespace std;
#define endl '\n'... | ALGO | 0.999795 | 4.880588 |
040bbd7d-03ec-48c6-a5b4-525c7eeb83ca | nickchen111/Leetcode | Heap_PriorityQueue/1488. Avoid Flood in The City.cpp | /*
1488. Avoid Flood in The City
*/
// TC:O(nlgn+n) SC:O(n)
class Solution {
public:
vector<int> avoidFlood(vector<int>& rains) {
int n = rains.size();
set<int> drySet;
unordered_map<int,int> fill;// 湖對應的idx
vector<int> res(n,-1);
for(int i = 0; i<n; i++){
int x =... | ALGO | 0.99996 | 5.847332 |
d001192b-63ff-45d6-a619-786a1f3f4399 | Hongocandy/2023aaib3 | week15/week15-4.cpp | //week15-4.cpp
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
l1=myRevers(l1);
l2=myRevers(l2);
ListNode*ans=new ListNode();
ListNode*now=ans;
int carry=0;
while(l1!=nullptr||l2!=nullptr){
if(l1==nullptr){//}l1(⧹㪩KWӡAbRl1)
... | ALGO | 0.999841 | 5.237752 |
a1a5be6d-d442-4847-88e8-b164376f0c8e | ixvii0iv/ACM-works | ZOJ/zoj3175.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int t;
cin >> t;
while(t--){
int n; cin >> n;
int tmp = sqrt(n);
ll ans = 0;
for(int i=1;i<=tmp;i++){
ans+=n/i;
}
ans<<=1;
ans = ans - n -tmp*tmp;
... | ALGO | 0.999902 | 4.22749 |
f3b1f4e4-bd05-4503-abd3-fa1719e2df45 | maestron/botnets | VirusPack/120-MYSQL-V999/RX-120-MYSQL-V999/Cry.cpp | /* | _ \ \ \/ / / |___ \ / _ \ TesT | \/ |/ _ \| _ \ \ \ / /___ \
| |_) | \ /_____| | __) | | | |_____| |\/| | | | | | | |____\ \ / / __) |
| _ < / \_____| |/ __/| |_| |_____| | | | |_| | |_| |_____\ V / / __/
|_| \_\/_/\_\ BuZ|_|_____|\___/ |_| |_|\___/|____/ BuZ \_/ |_____|
-... | TOOL | 0.852957 | 3.031953 |
7d0d851a-78f4-4c64-8a70-f30d7835eb5b | nicoelayda/competitive-programming | UVa Online Judge/10656. Maximum Sum II.cpp | #include <iostream>
using namespace std;
int main() {
int n;
while (cin >> n && n != 0) {
int num;
bool first = true;
while (n-- != 0) {
cin >> num;
if (num != 0) {
if (first)
first = false;
else
... | ALGO | 0.99957 | 4.864751 |
26b71d48-cd59-4cbe-906c-c7e75a111e2b | rajephon/programmers_training | cpp/level3_integer_triangle.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<vector<int>> triangle) {
int answer = triangle[0][0];
if (triangle.size() == 1)
return answer;
for (int i = 1; i < triangle.size(); i++) {
for (int j = 0; j <= i; j++) {
if (j==0)
... | ALGO | 0.999925 | 5.644967 |
07072748-cda7-4b4a-8020-7e51593aeec2 | zongxinqi/Code | C-C++/acm/模拟3.cpp | #include<iostream>
#include<cstring>
using namespace std;
int main()
{
string s,a,b;
int count = 0;
cin>>s;
while(s != ".")
{
count++;
if(count == 2) a = s;
if(count == 14) b = s;
cin>>s;
}
if(count >= 14) cout<<a<<" and "<< b<<" are inviting you to dinner...";
else if(count >= 2&& count < 14) cout<<a<... | ALGO | 0.999245 | 3.010522 |
881ac839-fade-49d0-9838-140ef10f737e | toshantarora/DataStructurePr | c++language/enterNumber.coninue.cpp | #include <iostream>
using namespace std;
int main()
{
int N,K;
cout << "Enter the N Number: ";
cin >> N;
cout << "Enter the K Number: ";
cin >> K;
for(int i = 0; i <= N; i++)
{
if(i == K)
{
continue;
}
cout << i << endl;
}
} | ALGO | 0.996791 | 3.363726 |
8d00c5f8-4d19-4d0d-a045-1eadd3034bb1 | openjdk/jfx23u | modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/common/unisetspan.cpp | #include "unicode/utypes.h"
#include "unicode/uniset.h"
#include "unicode/ustring.h"
#include "unicode/utf8.h"
#include "unicode/utf16.h"
#include "cmemory.h"
#include "uvector.h"
#include "unisetspan.h"
U_NAMESPACE_BEGIN
/*
* List of offsets from the current position from where to try matching
* a code point or a ... | TOOL | 0.968424 | 7.18779 |
ff7b790a-5aec-4110-8b5c-e4b7be5eb6fe | MichalPiechowiak/Desitation | IndividualProject/Resources/GLM/include/glm/test/perf/perf_matrix_inverse.cpp | #define GLM_FORCE_INLINE
#include <glm/matrix.hpp>
#include <glm/ext/matrix_float4x4.hpp>
#include <glm/ext/matrix_double4x4.hpp>
#include <glm/ext/matrix_relational.hpp>
#include <glm/ext/vector_float4.hpp>
#if GLM_CONFIG_SIMD == GLM_ENABLE
#include <glm/gtc/type_aligned.hpp>
#include <vector>
#include <chrono>
#inclu... | TEST | 0.931252 | 6.41874 |
021f260f-2738-4841-b700-8b89e828f7a3 | 3378950/Algorithm-Template | Data_Structure/Heap_sort.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int N = 1e6 + 10;
int h[N],n,m,siz;
void down(int u) {
int t = u;
if(u * 2 <= siz && h[u * 2] < h[t]) t = u * 2;
if(u * 2 + 1 <= siz && h[u * 2 + 1] < h[t]) t = u * 2 + 1;
if(t != u) {
swap(h[t], h[u]);
down(t);
}... | ALGO | 0.999976 | 3.536927 |
d9498718-3f51-4245-b77a-93e03c80dc37 | Suraj-Dhankad2025/DSA-Problems-Leetcode | 1145-number-of-submatrices-that-sum-to-target/number-of-submatrices-that-sum-to-target.cpp | class Solution {
public:
int numSubmatrixSumTarget(vector<vector<int>>& mat, int target) {
int n = mat.size();
int m = mat[0].size();
vector<vector<int>>pre(n, vector<int>(m, 0));
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
int top = i>0 ? pre[i-1][j]:... | ALGO | 0.999993 | 6.247425 |
3f9ca3b9-815c-4c86-a214-7ba24ddb9631 | pranavajith/CP-Practice | A_Parkway_Walk.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <set>
#include <cmath>
#include <map>
#include <sstream>
#include <deque>
#include <queue>
#include <stack>
#include <algorithm>
#include <limits>
#include <iomanip>
using namespace std;
#define ll long long
ll mod = 1e9 + 7;
// #define TxtIO freopen("input.txt","... | ALGO | 0.999862 | 4.572964 |
52006e28-96eb-4e2b-a394-8302f2031fb7 | zhangchunbao515/leetcode | leetcode-02/82. Remove Duplicates from Sorted List II/s1.cpp | // OJ: https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii
// Author: github.com/lzl124631x
// Time: O(N)
// Space: O(1)
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
ListNode dummy(0), *tail = &dummy;
while (head) {
if (head->next && head->next->val == head->val)... | ALGO | 0.999965 | 6.403426 |
0b2efe44-fa06-47fc-89a5-cc54c3d16c9b | mrshiposha/EditedUE4 | Engine/Source/Runtime/Navmesh/Private/Detour/DetourNavMesh.cpp | #include "Detour/DetourNavMesh.h"
#include "Detour/DetourCommon.h"
#include "Detour/DetourAssert.h"
enum ESlabOverlapFlag
{
SLABOVERLAP_Cross = 1,
SLABOVERLAP_Min = 2,
SLABOVERLAP_Max = 4,
};
inline bool overlapSlabs(const float* amin, const float* amax,
const float* bmin, const float* bmax,
const fl... | ALGO | 0.995996 | 7.472649 |
f5eae1e6-c6fc-4870-b65e-4de90e6634f8 | soundariyav/LeetcodePractice | 506. Relative Ranks.cpp | class Solution {
public:
vector<string> findRelativeRanks(vector<int>& score) {
priority_queue<int> pq; //-->1
vector<string>res; //-->1
for(int i =0;i<score.size();i++) //nlogn
{
pq.push(score[i]);
}
unordered_map<int,int>u_map; //1
int count =1;
... | ALGO | 0.999906 | 5.706228 |
8b41784d-ccaf-4400-b1f6-0e9b858ea317 | walkerL0u15/OnlineJudgeCode | ZeroJudge/a224.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int count,can;
string word;
while(cin>>word){
can=2;
for(int i=0;i<word.size();++i){
if(word[i]>=65&&word[i]<=90)
word[i]+=32;
else if(!(word[i]>=97&&word[i]<=122)){
word.erase(i,1);
... | ALGO | 0.999949 | 3.919568 |
4b7e1a39-0632-4152-9c9f-f33ecbbdebf3 | ishandutta2007/codeforces | sonechko/normal/1178/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
const int N = 2e5 + 11;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n,m;
cin>>n>>m;
ll ans=4;
for (int i=1; i<=n-1; i++)
... | ALGO | 0.99999 | 3.847649 |
849f1a04-f9ed-42a9-b353-730e927c18cc | manikanta2901/ubuntu | .history/SRM/placementPractice/HackerRank/SearchingAlgorithm/minimumLoss_20201022204018.cpp | #include<bits/stdc++.h>
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printMap(map,name,dataStr,data) for(map<dataStr,data>:: iterator it = name.begin(); it != name.end(); it++){ cout << it->first << " " << it->second << endl;}
#define printVector(vect,dataStruct) for(v... | ALGO | 0.999294 | 3.443535 |
7121a28d-6942-4eb4-8568-64051c2b1d9f | RitikSingh30/DSA--AllCode-Problems-solved- | Array/Intersection Of Two Arrays.cpp | #include <bits/stdc++.h>
vector<int> findArrayIntersection(vector<int> &arr1, int n, vector<int> &arr2, int m)
{
vector<int>v ;
int i = 0 , j = 0 ;
while(i<n && j<m){
if(arr1[i]<arr2[j]){
i++ ;
}
else if(arr1[i]>arr2[j]){
j++ ;
}
else{
... | ALGO | 0.999989 | 4.641875 |
cc3ce6e0-7dc3-4b46-98fa-1a5e096efc70 | xSminJx/baekjoon | Gold/G5 12865 : 평범한 배낭.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<pair<int, int>> val(n + 1); // 무게, 가치
vector<vector<int>> dp(n + 1, vector<int>(k + 1));
for (int i = 1; i <= n; i++) cin >> val[i].first >> val[i].second;
for (int i = 1; i <= n; i++) {
for (int j = 1; j ... | ALGO | 0.999984 | 3.939917 |
638f78e9-a8b4-420f-9bdb-e3622ea89690 | SEP-software/SEPlib | oldStuff/interact/qt_cube/flatten_op.cpp | #include<flatten_op.h>
flatten_op::flatten_op(hypercube_float *mod, hypercube_float *dat, float e,
std::vector<pt3> msk,int imaster,std::vector<int> froze){
scale=false;
eps=e;
n1=mod->get_axis(1).n;
n2=mod->get_axis(2).n;
n3=mod->get_axis(3).n;
n123=n1*n2*n3;
mask=new std::vector<int>[n3];
int idept... | ALGO | 0.996362 | 3.480995 |
4104fa88-402b-474c-9cdc-7b61b7c57f57 | walkccc/LeetCode | solutions/431. Encode N-ary Tree to Binary Tree/431-2.cpp | class Codec {
public:
// Encodes an n-ary tree to a binary tree.
TreeNode* encode(Node* root) {
if (root == nullptr)
return nullptr;
TreeNode* rootTreeNode = new TreeNode(root->val);
if (!root->children.empty())
rootTreeNode->left = encode(root->children[0]);
// The parent for the res... | ALGO | 0.997311 | 7.320223 |
a6cd9c46-fcdb-4304-b26c-1d5dbb15e1a4 | rcolleen/289H_assignments | eigen-git-mirror/doc/snippets/JacobiSVD_basic.cpp | MatrixXf m = MatrixXf::Random(3,2);
cout << "Here is the matrix m:" << endl << m << endl;
JacobiSVD<MatrixXf> svd(m, ComputeThinU | ComputeThinV);
cout << "Its singular values are:" << endl << svd.singularValues() << endl;
cout << "Its left singular vectors are the columns of the thin U matrix:" << endl << svd.matrixU(... | ALGO | 0.999843 | 3.463409 |
eb43306a-b12f-4c99-a7ef-0a265c27525b | hacickn/cs201_fundamental_structures_of_computer_science_I | HW4/FlightMap.cpp | /*
* Hacı Çakın
* 21802641
* Cs201 Section 01
*/
#include <fstream>
#include "FlightMap.h"
#include <string>
#include "FlightList.h"
#include "CityList.h"
#include "Stack.h"
#include <sstream>
#include <iostream>
#include <stdexcept>
using namespace std;
FlightMap::FlightMap() {
}
FlightMap::FlightMap(const ... | ALGO | 0.859044 | 4.056648 |
6cecd1e4-9198-4562-9539-ee3c2851a7ad | qk12/Contest | GYM/102059/H-Fractions.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll upper(ll a, ll b)
{
return a / b + ((a % b) ? 1LL : 0LL);
}
int main()
{
ll a, b, c, d;
scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
ll cnt = 0;
for (ll i = 1; i <= 998; +... | ALGO | 0.999457 | 3.952995 |
5e3980fc-29a6-4cdf-959f-96dd94637fbc | ishandutta2007/codeforces | tfg/normal/356/A.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <set>
std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());
int main() {
std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
int n, m;
std::cin >> n >> m;
std::set<int> a;
for(int i = 1; i <= ... | ALGO | 0.999991 | 4.197932 |
5111cc20-a22f-4e4d-89b6-cac0ccee949d | gaixianggeng/algoCode | archive/algoCode/extend.cpp | #include "algoCode.h"
//x的平方根
//7 1 4,2 4,2 3,
int mySqrt(int x) {
cout<<x<<endl;
if (x == 0){
return 0;
}
long left = 1;
long right = x;
while (left<right) {
long mid = (left+right+1)/2;
cout<<left<<":"<<right<<endl;
if ((x/mid)<mid){
right = mid-1;
}else{
left = mid;
}
}
return left;
}
| ALGO | 0.999815 | 3.183001 |
ac55348c-3ea5-4c26-a0ec-c93fd584d6a4 | cindy-cho/Problem-Solving | ICPC Practice/1.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#define endl '\n'
typedef long long ll;
using namespace std;
int main(void){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
n*=2;
int answer=200000;
vector<int> stu(n);
for(int i=0;i<n;i++) cin >> stu[i];
sort(stu.... | ALGO | 0.999955 | 3.85992 |
5d9fad0c-bbd6-431d-8dba-8278874d565a | Virox02/Programming-Courseworks | ICS 45C (Intro to C++) /project2/app/inputs.cpp | #include <iostream>
#include <string>
#include "calculate.hpp"
#include "outputs.hpp"
#include "students.hpp"
//struct Student {
// int id;
// char opt;
// std::string name;
// double score = 0.0;
//char* grade = new char[3]
//char g1 = 'F';
//char g2 = 'F';
//char g3 = 'F';
//};
void Inpu... | TOOL | 0.994183 | 3.085562 |
c693f7f1-c5b0-4355-bb95-5a2419e64a34 | TH-Akash/STL-code-c- | Vector/Aray Of Vector.cpp | #include<bits/stdc++.h>
using namespace std;
void printVce(vector<int>&v){
cout<<"size: "<<v.size()<<endl;
for(int i=0;i<v.size();i++){
cout<<v[i]<<" ";
}cout<<endl;
}
int main(){
int N;
cin>>N;
vector<int>v[N];
for(int i=0;i<N;i++){
int n;
cin>>n;
for(int j... | ALGO | 0.996128 | 4.103085 |
a4673764-b736-4e69-8c3c-9eac3e1236b5 | coding4beginner/Course_Learning-Algorithms | C-Plus-Plus/others/recursive_tree_traversal.cpp | /**
* @file
* @brief Recursive version of Inorder, Preorder, and Postorder [Traversal of
* the Tree] (https://en.wikipedia.org/wiki/Tree_traversal)
*
* @details
*
* ### Iterative Inorder Traversal of a tree
* For traversing a (non-empty) binary tree in an inorder fashion, we must do
* these three things for ev... | ALGO | 0.999626 | 6.518152 |
e7a2237b-dcbc-4a5e-84d8-acc8545e96e1 | rashid642/cp | extra/extra_function.cpp | #include<bits/stdc++.h>
using namespace std;
// #define long long long long
long long giveSqrt(long long x){
long long low = 1, high = 3e9, ans = 1;
while(low<=high){
long long mid = (low+high)/2;
if(mid*mid<=x){
ans = mid;
low = mid+1;
}
else high = mid... | ALGO | 0.999554 | 3.35616 |
33622391-56ff-4f9b-8fde-6e8192a65c74 | nikhil16072003/LeetCode | 125. Valid Palindrome.cpp | class Solution {
public:
bool isPalindrome(string s) {
string k="";
int i;
int n=s.length();
char c;
char x;
string rev;
for(i=0;i<n;i++){
x=s[i];
if(isalnum(x)){
c=tolower(x);
k=k+c;
}
... | ALGO | 0.999553 | 6.137695 |
e4eb0b3d-3329-482a-8472-903cf608c7f8 | iamrahulmeena/DSA | Week 4/level-3/oddoccuring.cpp | #include <iostream>
using namespace std;
int oddoccuring(int arr[], int size){
int start =0;
int end=size-1;
while (start<=end)
{
int mid=start+(end-start)/2;
if (start==end)
{
return arr[end];
}
if (mid & 1)//mid is odd
{
if (arr[mid]==arr[mid-1])
{
... | ALGO | 0.999768 | 4.652537 |
526619e9-0ab5-413b-a897-1f1e3d14642b | Tylereck81/Automated-Pulse-Sensing-Tool- | Hardware/Arduino/Marlin Firmware/Marlin-bugfix-2.0.x/Marlin/src/gcode/probe/G38.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(G38_PROBE_TARGET)
#include "../gcode.h"
#include "../../module/endstops.h"
#include "../../module/motion.h"
#include "../../module/stepper.h"
#include "../../module/probe.h"
inline void G38_single_probe(const uint8_t move_value) {
endstops.enable(true);
G38_move =... | ALGO | 0.946348 | 7.682211 |
ab60996c-664a-4d13-8995-26d330b887b8 | abdullaabdullazade/rio-semifinal-submissions-2025 | Rahidil_Bayramlı_Səbuhi qızı_10.0_15_10BAL_RIO2025_Semifinal_S4.cpp | #include<bits/stdc++.h>
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define pll pair<ll, ll>
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz(v) (ll)(v.size())
#define pb push_back
#define f first
#define s second
u... | ALGO | 0.999894 | 3.758095 |
a2fc4c90-0b70-4649-81da-f62e501b7a3b | atxi/Polymer | lib/miniz.cpp | #include "miniz.h"
#pragma warning(push)
#pragma warning(disable: 4334)
typedef unsigned char mz_validate_uint16[sizeof(mz_uint16) == 2 ? 1 : -1];
typedef unsigned char mz_validate_uint32[sizeof(mz_uint32) == 4 ? 1 : -1];
typedef unsigned char mz_validate_uint64[sizeof(mz_uint64) == 8 ? 1 : -1];
#ifdef __cplusplus
... | TOOL | 0.876124 | 6.911231 |
a973c3ec-c79c-4fdf-acec-b01e28b309cf | chandravamsy25/LEETCODE_SOLUTIONS | 1938-minimum-operations-to-make-the-array-increasing/minimum-operations-to-make-the-array-increasing.cpp | class Solution {
public:
int minOperations(vector<int>& nums) {
int count =0;
if (nums.size()<=1) return 0;
for(int i=1;i<nums.size();i++)
{
if(nums[i]<=nums[i-1])
{
count =count +(nums[i-1]-nums[i])+1;
nums[i]=nums[i-1]+1;... | ALGO | 0.999967 | 6.27123 |
2f79da2d-c877-4a98-8333-0c692dc1e10a | the-lockjaw/a2z-sheet | 04_Binary_Search/0_1D_Arrays/09_search_rotated_array_II.cpp | /*
81. Search in Rotated Sorted Array II
Medium
There is an integer array nums sorted in non-decreasing order (not necessarily with distinct values).
Before being passed to your function, nums is rotated at an unknown pivot index k (0 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums... | ALGO | 0.999965 | 7.220319 |
a6b0da9a-d178-4965-a5eb-2ae2062486e5 | mukulgpt17/CP | CodeForces/733D.cpp | #include<bits/stdc++.h>
#define ull unsigned long long int
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define Loop(i,a,b) for (int i=a;i<b;i++)
using namespace std;
void solve()
{
int n ;
cin>>n;
map<pair<int,int>,pair<int,int>> mp;
vector<vector<int>> ve;
int ind... | ALGO | 0.999946 | 3.713198 |
3c660f99-67c9-4abf-9b5a-c330ade3ef5a | keval511/C-PlusPlus | doiwhile.cpp | #include<iostream>
using namespace std;
int main()
{
int i,j=10,k=10;
do{
for(i=10;i>=j;i++)
{
cout<<k;
k++;
}j++;
cout<<"\n";
}while(j<=4);
} | ALGO | 0.99943 | 3.047925 |
84ef95a3-c714-42fb-9fde-f2b33654de7b | loki-engr/CtrlHair | wrap_codes/wrap_triangle/useful_code/libigl/tutorial/716_HeatGeodesics/main.cpp | #include "tutorial_shared_path.h"
#include <igl/read_triangle_mesh.h>
#include <igl/triangulated_grid.h>
#include <igl/heat_geodesics.h>
#include <igl/unproject_onto_mesh.h>
#include <igl/avg_edge_length.h>
#include <igl/isolines_map.h>
#include <igl/opengl/glfw/Viewer.h>
#include <igl/opengl/create_shader_program.h>
#... | ALGO | 0.884087 | 6.483084 |
fcd3eb24-3eef-4b62-8ee1-5c09005d8533 | ABexit/Multi-Character-StoryTeller | 3D-Speaker/runtime/onnxruntime/feature/feature_functions.cpp | //
// Created by shuli on 2024/3/6.
//
#include "feature/feature_functions.h"
int speakerlab::round_up_to_nearest_power_of_two(int n) {
n--;
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
return n + 1;
}
void speakerlab::init_bit_reverse_index(std::vector<int> &bit_rev_... | ALGO | 0.995594 | 4.858087 |
84796afa-7539-4fd2-a8aa-dbf00b9834ef | ishandutta2007/codeforces | alexxela12345/normal/1207/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 998244353;
int mul(int a, int b) {
return a * b % MOD;
}
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
return a.second < b.second;
}
const int MAXN = 3e5 + 228;
int fact[MAXN];
signed main() {
fact[0] = 1;
for (... | ALGO | 0.999976 | 4.708676 |
2be676db-7784-450f-90c7-a505bdd25ded | amit4996/coding_space | 75-sort-colors/75-sort-colors.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
int n=nums.size();
int count0=0;
int count1=0;
int count2=0;
for(int i=0;i<n;i++)
{
if(nums[i]==0) count0++;
if(nums[i]==1) count1++;
if(nums[i]==2) count2++;
}
... | ALGO | 0.999954 | 6.121169 |
b38affd0-48ee-409e-b551-0e1e61ac29e9 | spidey999/leetcode | 2383-add-two-integers/2383-add-two-integers.cpp | class Solution {
public:
int sum(int num1, int num2) {
return num1+num2;
}
}; | ALGO | 0.995238 | 5.369244 |
3eb5f46b-78ef-4c40-b731-670a04c54e2b | JanAdell/Fisica | Physics2_class1_handout/Box2D/Box2D/Dynamics/Joints/b2RopeJoint.cpp | #include <Box2D/Dynamics/Joints/b2RopeJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Limit:
// C = norm(pB - pA) - L
// u = (pB - pA) / norm(pB - pA)
// Cdot = dot(u, vB + cross(wB, rB) - vA - cross(wA, rA))
// J = [-u -cross(rA, u) u cross(rB, u)]
// K = J * invM * JT
// = inv... | ALGO | 0.975811 | 7.506215 |
64e6d259-9c10-4fc9-bab1-3bb163b01545 | AdiCodLikBoss/LeetCode-Problems-Solutions | Deque_Implementation.cpp | #include <bits/stdc++.h>
using namespace std;
class DoubleLL{
public:
int data;
DoubleLL *next,*prev;
DoubleLL(){
data=-1;
next = prev = NULL;
}
DoubleLL(int x){
data = x;
next = prev = NULL;
}
};
class Deque{
DoubleLL *front,*rear;
pu... | ALGO | 0.999234 | 3.896125 |
a0bba5f6-0b3f-4c1c-9307-2c289f8082c0 | sinian666/code_41_12 | 1cpp/chapter_backtracking/permutations_ii.cpp | /**
* File: permutations_ii.cpp
* Created Time: 2023-04-24
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 回溯算法:全排列 II */
void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &selected, vector<vector<int>> &res) {
// 当状态长度等于元素数量时,记录解
if (state.size() == choices.size... | ALGO | 0.999934 | 5.701356 |
df02ff31-c38b-4403-873a-28436142fa29 | Sahandshoaei/Homework | tamrin 10.2.cpp | #include <iostream>
#include<conio.h>
using namespace std ;
int power (int x,int y){
if (y==0){
return 1 ;
}
else {
return x * power(x,y-1);
}
}
int main(){
int a,b;
cout << " number : " ;
cin >> a ;
cout << " exponent : " ;
cin >> b ;
cout << " result is : " << power (a,b);
getch();
}
| ALGO | 0.999794 | 4.042949 |
149212fe-f16c-463b-aa5a-b4104337d1f6 | numfum/task-opt1 | main.cpp | #include <cassert>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <ctime>
//************************** Helpers and Boilerplate **************************/
#include "basisu_headers.h"
/**
* Helper to return the current time in milliseconds.
*/
static unsigned millis() {
return static_cast<unsigne... | TOOL | 0.85383 | 6.267519 |
d2b4d706-5a32-4b63-90ee-0a54da2e7823 | Krutarth90/CODEFORCES | SOLVED/2107B - Apples in Boxes.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define flp(k,n) for(ll i=(ll)k;i<(ll)n;i++)
#define flm(k,n) for(ll j=(ll)n-1;j>=(ll)k;j--)
#define YES cout<<"YES\n"
#define NO cou... | ALGO | 0.99999 | 4.596516 |
005f1276-5ef4-409e-8a3f-90f29944c151 | sashedher/codec | Leetcode/Cpp_Leet/985.Sum_of_Even_Numbers_After_Queries.cpp | // https://leetcode.com/problems/sum-of-even-numbers-after-queries/
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> sumEvenAfterQueries(vector<int>& nums, vector<vector<int>>& q) {
int m=q.size(), n= nums.size();
int sum=0;
vector<int> res;
... | ALGO | 0.999937 | 6.114146 |
7f131a1e-64d7-4871-bc17-ec0108dadc9a | runqingc/Coding-Practice | leetcode/11. Container With Most Water /main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// move the shorter board inner
int maxArea(vector<int>& height) {
int max_water = 0;
auto i = height.begin(), j = height.end()-1;
while(i<j){
max_water = max(max_water, (int)(j-i)*(min(*i, *j)));
if(*i<*j){
... | ALGO | 0.999675 | 5.638807 |
a4f30cac-2d8a-4765-a4e6-01f1e77f6048 | alexswshin/codePractice | 10819.cpp | // https://www.acmicpc.net/problem/10819
// 2016-08-17
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int calc(vector<int> &a){
int sum = 0;
for(int i = 1 ; i < a.size() ; i++)
{
sum += abs(a[i]-a[i-1]);
}
return sum;
}
int main()
{
int n;
cin >> n;
// setup number vector... | ALGO | 0.999844 | 4.307662 |
2b6b1506-dc9e-4914-a7c6-b9565ba76995 | nakul1010/6companies30Days_Challenge | Goldman Sachs/14_MIN_SIZE_SUBARRAY.cpp | /*14 - Minimum Size Subarray Sum
https://leetcode.com/problems/minimum-size-subarray-sum/
*/
#include<bits/stdc++.h>
using namespace std;
int minSubArrayLen(int arr[],int n,int target)
{
int ans = INT_MAX, curr_sum = 0, i=0, j=0;
while(i<n)
{
curr_sum += arr[i];
cout<<"\ni : "<<i<<" j : "<<j<<" curr_s... | ALGO | 0.999958 | 5.385196 |
5d8a4849-37c1-4578-b32e-46f6da8c0bea | CrazyGuyofDoom/Source-SDK-2013 | template_mp/2013_08_04/src/mathlib/spherical.cpp | #include <math.h>
#include <float.h> // Needed for FLT_EPSILON
#include "basetypes.h"
#include <memory.h>
#include "tier0/dbg.h"
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"
#include "mathlib/spherical_geometry.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
floa... | TOOL | 0.998766 | 5.758006 |
ed217dca-651c-464c-82fc-bb6c07ac4288 | shriharshpatil23/Data-Structures-and-Algorithms | 34-find-first-and-last-position-of-element-in-sorted-array/34-find-first-and-last-position-of-element-in-sorted-array.cpp | class Solution {
public:
vector<int> searchRange(vector<int>& a, int target) {
int start = 0;
int end = a.size()-1;
int mid ;
vector<int> ans(2,-1);
//for 1 st occurence
while(start<=end){
mid = start + (end - start)/2;
if(a[mid]==target){
... | ALGO | 0.999852 | 6.126441 |
13447468-f7f0-4ee8-bfc7-53cbd8aae961 | MainFrameKuznetSov/LeetCode | 877-shortest-path-visiting-all-nodes/shortest-path-visiting-all-nodes.cpp | class Solution {
public:
typedef pair<int,int> pii;
int shortestPathLength(vector<vector<int>>& graph) {
int n=graph.size();
if(n==1)
return 0;
queue<pii>q;
set<pii>vis;
for(int i=0;i<n;++i)
{
q.push({i,1<<i});
vis.insert({i,1... | ALGO | 0.999803 | 5.074931 |
f79bd34b-5e15-423f-a196-721b872a7ad3 | UCASV/ICPC | 02 - Easy/E2.cpp | //11559 Event Planning
#include <iostream>
#include <climits>
using namespace std;
int main(void){
bool flag;
int N, B, H, W, p, a, total, min;
while(cin >> N >> B >> H >> W){
flag = false;
min = INT_MAX;
for(int i = 0; i < H; ++i){
cin >> p;
total = p*N;
... | ALGO | 0.999789 | 3.657206 |
bcacf6c8-ec90-4f24-be4a-59fd2267a09f | Peter2s/Data-structures-ITI-Labs | sort/main.cpp | #include <iostream>
using namespace std;
//pivot from start
int partition(int arr[], int start, int end)
{
int pivot = arr[start];
int i = end+1;
for (int j = end; j > start ; j--) {
if (arr[j] > pivot) {
i--;
swap(arr[i], arr[j]);
}
}
swap(arr[i -1], arr[st... | ALGO | 0.999862 | 4.864691 |
d95694db-3bc9-4835-9398-0b8016f0d6e7 | OzzieIsaacs/winmerge-qt | ext/boost_1_70_0/libs/math/example/gauss_example.cpp | #include <iostream>
#include <cmath>
#include <limits>
#include <boost/math/quadrature/gauss.hpp>
#include <boost/math/quadrature/gauss_kronrod.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/special_functions/relative_difference.hpp>
#include <boost/multiprecision/cpp_bin_float.hpp>
void gauss... | ALGO | 0.99721 | 6.525686 |
c193f691-815a-4590-89f9-f4fdf0d80551 | felipesdias/Extractor-URI-Online-Judge | URI-EN/BEGINNER/2234 - Hot Dogs.cpp | // Author: Felipe Souza Dias <<EMAIL>>
// Name: Hot Dogs
// Level: 1
// Category: BEGINNER
// URL: https://www.urionlinejudge.com.br/judge/en/problems/view/2234
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
printf("%.2lf\n", a * 1.0 / b);
/**
* ... | ALGO | 0.993172 | 3.022363 |
a37cad5e-358c-4c50-a7e1-656462a0f34b | gauravengine/CPP_Freak | Contests/CSES/missing_number.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","... | ALGO | 0.999984 | 4.012072 |
f7c8c961-f02e-4663-97cc-a283453ce0a3 | Paras-Pandey/Competitive-Programming | cp/gg2.cpp | #include"bits/stdc++.h"
using namespace std;
#define go(i, s, n) for (int i=(s), end=(n); i<=end; i++)
#define rgo(i, s, n) for (int i=(s), end=(n); i>=n; i--)
#define getstr getline (cin,str)
#define vi vector <int>
#define vs vector <string>
#define pii ... | ALGO | 0.999954 | 4.424157 |
4492d293-f9f5-410f-9a7d-f4c52746f58b | Aditya-raj123/DSA- | gp.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"enter the term";
cin>>n;
int a = 100 ;
for(int i=1;i<=n;i++){
cout<<a<<endl;
a = a - 3;
}
return 0;
}
| ALGO | 0.999701 | 3.292512 |
f5bfdfaf-899f-4b57-9348-dfd1955f5365 | SPkimdain/clickhouse | ClickHouse-master/src/Processors/Transforms/PartialSortingTransform.cpp | #include <Core/SortCursor.h>
#include <Interpreters/sortBlock.h>
#include <Processors/Transforms/PartialSortingTransform.h>
#include <Common/PODArray.h>
#include <Common/iota.h>
namespace DB
{
namespace
{
ColumnRawPtrs extractRawColumns(const Block & block, const SortDescriptionWithPositions & description)
{
siz... | ALGO | 0.995379 | 7.762332 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.