uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
42cba109-82bc-4783-ad4f-06090c58fe71 | meetrajraulji273/DSA-CPP | Arrays/Medium/longestConsecutiveSequence.cpp | #include<bits/stdc++.h>
using namespace std;
//brute-force-method ---> T.C ---> O(N*N) ---> S.C ---> O(1);
// bool ls(int arr[],int num,int n){
// for(int i=0;i<n;i++){
// if(arr[i] == num){
// return true;
// }
// }
// return false;
// }
// int longestConsecutiveSequence(int a... | ALGO | 0.999755 | 4.613359 |
6cd967a6-16ab-45f6-b3ba-7e6dc09aa0f7 | AbhishekJoshi236/Data-Structure | Sorting/CountingSort.cpp | #include <iostream>
using namespace std;
void print(int a[],int n)
{
for(int i=0;i<n;i++)
cout<<a[i]<<" ";
cout<<"\n";
}
int main()
{
int n=10;
int a[n]={0,7,2,0,5,6,3,4,2,6};
int b[n];
print(a,n);
int key=a[0];
for(int i=0;i<n;i++)
{
if(a[i]>key)
key=a... | ALGO | 0.999993 | 3.616911 |
1842bcd5-9137-4eeb-b695-35f85ece404f | dx404/Distributed_MultiColor_LinearSystem | recycle/haloGS.cpp | // halo.cpp
// read regular
// distribute
// Z-order load
// Z-order send
// tags
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <fstream>
#include <mpi.h>
using namespace std;
#define send_data_tag 2001
#define return_data_tag 2002
#define max3(x, y, z) max(max((x), (y)), (z))
... | ALGO | 0.999702 | 3.436834 |
adfad65d-fbb2-4936-90f9-8d209da7166b | ANISHSINGH0110/Assignment_BTech2026_-2201920100059- | 29_01_25/DSA/863._LeetCode_(All_Nodes_Distance_K_in_Binary_Tree).cpp |
/*
Approach
The task is to find all nodes in a binary tree that are exactly distance K from a given target node.
Key Concepts:
Tree Traversal:
Use DFS to map parent nodes and BFS to explore nodes at distance K.
Parent Mapping:
Since binary trees do not directly support backward traversal, maintain a parent map to a... | ALGO | 0.999992 | 6.502322 |
cd5f6929-13a5-405b-b34b-efa3909bf4c4 | arpangoswami/LeetcodeSolutions | 1081-smallest-subsequence-of-distinct-characters/1081-smallest-subsequence-of-distinct-characters.cpp | class Solution {
public:
string smallestSubsequence(string s) {
int n = s.size();
if(n == 0){
return "";
}
vector<int> lastSeen(26);
for(int i=0;i<n;i++){
lastSeen[s[i] - 'a'] = i;
}
vector<bool> seen(26);
string ans;
fo... | ALGO | 0.999987 | 6.441412 |
62d748ec-4262-4d5c-bbd2-8edbcaf1c9d7 | PURUSHOTM/Coding-NInjas | Coding ninjas DSA C++/Graph-1/Islands.cpp | /*
Islands
Send Feedback
An island is a small piece of land surrounded by water . A group of islands is said to be connected if we can reach from any given island to any other island in the same group . Given V islands (numbered from 0 to V-1) and E connections or edges between islands. Can you count the number of conn... | ALGO | 0.99997 | 5.534661 |
f183f530-e5c0-4a5e-93d3-d8fb129dfeba | sameer91/LeetcodeSolutions | archive/leetcode/97_inrterleavingStrings.cpp | #include "bits/stdc++.h"
#include <numeric>
#include <string>
int main() {
std::string s1, s2, s3;
std::cin >> s1 >> s2 >> s3;
uint count[26];
memset(count, 0u, sizeof(uint)*26);
for (char x : s3) {
count[x - 'a']++;
}
for (char x : s1) {
count[x - 'a']--;
}
for (char x : s2) {
count[... | ALGO | 0.99991 | 4.561432 |
610be83b-325f-4f45-ad04-444ce5f03517 | Schr0dinger0/university_INFORMATIC | C++_scripts/Rev_str.cpp | #include <iostream>
#include <string>
std::string reverseString(const std::string& input) {
if (input.empty()) {
return input;
}
return input.back() + input.substr(0, input.length() - 1);
}
int main() {
std::string inputString;
std::cout << "Введите строку для отражения: ";
std::getlin... | ALGO | 0.993317 | 5.884709 |
1fc04c7c-c87b-46f0-aada-d6975f8a5657 | jehigh-sd/LTE_Cell_Search | HARDWARE/hls_projects/passthrough/passthrough_test.cpp | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "passthrough.h"
struct Rmse
{
int num_sq;
float sum_sq;
float error;
Rmse(){ num_sq = 0; sum_sq = 0; error = 0; }
float add_value(float d_n)
{
num_sq++;
sum_sq += (d_n*d_n);
error = sqrtf(sum_sq / num_s... | ALGO | 0.886531 | 4.420244 |
1158f3e0-fd5f-433b-9e28-0791658cf459 | AnasImloul/Leetcode-Solutions | scripts/algorithms/A/All Possible Full Binary Trees/All Possible Full Binary Trees.cpp | class Solution {
public:
unordered_map<int,vector<TreeNode*>> dp;
int hash(int i,int j){
return (i*21 + j);
}
vector<TreeNode*> fn(int l,int r){
int has = hash(l,r);
if(dp.find(has)!=dp.end()){
return dp[has];
}
vector<TreeNode*> res;
if(r<l){
... | ALGO | 0.999983 | 5.979599 |
00a71263-78ac-42f9-8d7a-b9316066c1c3 | a-kash-rao/CS204_mini_project_1 | 1. Input Output/Separating the instructions/sep.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string code = "add add x5, x6, x7";
size_t pos = 0;
while ((pos = code.find(',')) != string::npos) {
code.erase(pos, 1);
}
istringstream iss(code);
vector<string> words;
string word;
string k;
iss >> k;
while (iss... | ALGO | 0.993477 | 3.524752 |
b2fa5539-7aad-46b2-9d39-57d2adf25925 | an0520a/boj | review/BOJ_11053.cpp | #include <iostream>
#include <vector>
#include <memory.h>
typedef unsigned int u32;
size_t GetMaxLenOfIncreaseSequence(const std::vector<u32>& num_sequence);
size_t GetMaxLenOfIncreaseSequence_comp(const std::vector<u32>& num_sequence, size_t* memo, u32 n_th);
int main()
{
std::ios_base::sync_with_stdio(false);
... | ALGO | 0.999766 | 4.826082 |
9e07ee70-231a-456e-9833-5de7053a4fb0 | coutyou/Online-Judge-Of-DSA | PA4_Whistory.cpp | #include <iostream>
#include <stdio.h>
#include <string.h>
#include <iomanip>
using namespace std;
class MyString
{
public:
char value[1001];
MyString(char value[1001]);
MyString();
~MyString();
bool operator<(MyString &str2);
bool operator>(MyString &str2);
bool operator==(MyString &str2... | ALGO | 0.999972 | 3.639684 |
67e077b0-85aa-4f34-b501-507f17ffc263 | anhuynh95/EECS_560 | Lab03/main.cpp | #include "QuadHash.h"
#include "QuadHash.cpp"
#include "DoubHash.h"
#include "DoubHash.cpp"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream inFile;
inFile.open("data.txt");
if(!inFile)
{
cout<<"Unable to open data.txt or the file is not in the same folde... | TOOL | 0.921913 | 4.125574 |
2b2530cb-0831-449c-9bd9-2f4f02a91511 | tsunho12/codedemo | dsacpp/src/median1/main.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "_share/util.h"
#include "UniPrint/print.h"
#include "vector/vector.h"
#include "random/randomSortedVector.h"
#include "trivialMedian.h"
#include "median.h"
/***************************************************************************... | TEST | 0.998325 | 5.224137 |
40bdc2fa-c663-45ae-9258-6bc2598d0e6e | FernandoBC23/Tech_Challenge_04_Grupo_63 | .venv/Lib/site-packages/prophet/stan_model/cmdstan-2.33.1/stan/lib/stan_math/lib/tbb_2020.3/src/rml/perfor/tbb_simple.cpp | #include <cstddef>
#include <cstdlib>
#include <cstdio>
#include <float.h>
#include <math.h>
#include <time.h>
#include <omp.h>
#include <assert.h>
#include "thread_level.h"
#include "tbb/task.h"
#include "tbb/tick_count.h"
#include "tbb/task_scheduler_init.h"
#if _WIN32||_WIN64
#include <Windows.h> /* Need Sleep *... | TOOL | 0.927547 | 4.476879 |
4a78b2e0-3035-48fa-9cf9-9a164bafbf5d | qcscine/utilities | src/Utils/Utils/DataStructures/Gtf.cpp | #include "Gtf.h"
#include <cmath>
#include <stdexcept>
namespace Scine {
namespace Utils {
namespace {
const double pi = 4.0 * std::atan(1.0);
}
Gtf::Gtf(int l, double expo, double coef) : exponent(expo), coefficient(coef) {
setNormalized(l);
}
void Gtf::setNormalized(int l) {
if (l == 0) {
normalizedCoeffi... | TOOL | 0.883203 | 5.508369 |
6cd0c9bf-bfc9-4ed5-8734-c0285f999f04 | MahajanPreksha/DSA-in-CPP | Arrays & Vectors/squaresofsortedarray.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
void squaresOfSortedArray(vector<int>& v, int n, vector<int>& res){
int left_ptr = 0, right_ptr = n - 1;
while(left_ptr<=right_ptr){
if(abs(v[left_ptr])<abs(v[right_ptr])){
res.push_back(v[right_ptr]*v[right_ptr]);... | ALGO | 0.999869 | 4.619253 |
ec21cbc0-c886-4633-8e78-4e3dcece3c24 | talaalsweiti/leetcode | 1221. Split a String in Balanced Strings.cpp | class Solution {
public:
int balancedStringSplit(string s) {
int cnt =0 , Rcnt =0 , Lcnt =0;
for(int i=0 ;i<s.length();i++) {
if(s[i]=='R'){
Rcnt++;
}
else {
Lcnt++;
}
if(Rcnt==Lcnt){
Rcnt =... | ALGO | 0.999836 | 5.614483 |
0482ed98-98dc-4f3b-b035-813e0f461237 | SharifAkil8/CppBasics | Containers/find.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
vector<int> ages;
ages.push_back(23);
ages.push_back(21);
ages.push_back(18);
ages.push_back(22);
ages.push_back(21);
ages.push_back(19);
ages.push_back(20);
ages.push_back(19);
ages.push_ba... | TOOL | 0.984298 | 4.207701 |
611a67f3-fb8e-4a24-bc3b-8e16bc3731ef | ratea/abc | abc56/b.cpp | #include<iostream>
using namespace std;
int main(){
int w,a,b;
cin>>w>>a>>b;
int ans = b-a-w;
if(a<=b){
if(ans<0){
cout<<0<<endl;
}else{
cout<<ans<<endl;
}
}else{
ans=a-b-w;
//cout<<ans<<endl;
if(ans<0){
cout<<0<<endl;
}else{
cout<<ans<<endl;
}
return 0;
}}
| ALGO | 0.999917 | 3.473173 |
5468ae6a-8ef8-4c79-ad36-0377a5e3f9ed | 2anesh/DSA-PRACTICE | Maximum Sum Circular Subarray.cpp | class Solution {
public:
int maxSubarraySumCircular(vector<int>& A) {
int total_sum=0,curr_sum1=0,curr_sum2=0,mxsum_subary=INT_MIN,minsum_subary=INT_MAX;
for(auto i:A)
{
total_sum+=i; curr_sum1+=i; curr_sum2+=i;
mxsum_subary=max(mxsum_subary,curr_sum1);
... | ALGO | 0.99986 | 5.893822 |
6f361dc5-c995-4f45-8fb8-90def7f07331 | Haobo-CQU/PalletizingRobotArmWithROS | arm_main/src/Solve.cpp | #include "Solve.h"
#include <iostream>
using namespace std;
#define pi 3.14159265
geometry_msgs::Point Solve::solve(geometry_msgs::Point Point_) {
//the "solve" func is a "geometry_msgs::Point"" type func and belong to class "Solve"
//_cam: data from camera, unit is pixel or degree
x_cam = Point_.x;
y_cam = P... | ALGO | 0.998793 | 3.138407 |
6ba840b6-0823-4fad-8602-f13ed97aed24 | P-SUBHAM/LeetCode | Difficulty: Medium/Strongly Connected/strongly-connected.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//Position this line where user code will be pasted.
class Solution {
public:
void kosarajuSccDfs1(vector<vector<int>> &adj, int node,
vector<bool> &vis, stack<int> &st) {
vis[node] = true;
f... | ALGO | 0.998995 | 6.27579 |
fb4d3126-c605-48ed-b82c-54b526081656 | deepin-community/zimg | src/zimg/depth/x86/f16c_sse2.cpp | #ifdef ZIMG_X86
#include <emmintrin.h>
#include "common/align.h"
#include "common/ccdep.h"
#include "f16c_x86.h"
#include "common/x86/sse_util.h"
#include "common/x86/sse2_util.h"
namespace zimg {
namespace depth {
namespace {
inline FORCE_INLINE __m128i mm_blendv_ps(__m128i a, __m128i b, __m128i mask)
{
a = _mm_... | ALGO | 0.988726 | 6.708184 |
346c4857-8f45-4d5d-88f3-bfe372f25a68 | raverie-us/raverie-engine | Code/Systems/Engine/TransformSupport.cpp | namespace Raverie
{
Mat3 GenerateRotationMatrix(Vec3Param facing)
{
Mat3 rotation;
GenerateRotationMatrix(facing, &rotation);
return rotation;
}
void GenerateRotationMatrix(Vec3Param facing, Mat3Ptr matrix)
{
// Generate an orthonormal basis from the facing vector
Vec3 right, up;
Math::GenerateOrthonormal... | ALGO | 0.981998 | 6.31979 |
ae781d3a-b32f-476a-9ea3-aa87dc4882ff | Yashwantyadav1/cincoonic | 1st day/2nd_day.cpp/04_code.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the value of n ";
cin>>n;
for(int i=0;i<n;i++){
if(i==1 || i==2){
cout<<" ";
}
for(int j=0;j<n;j++){
cout<<"*";
}
cout<<endl;
}
} | ALGO | 0.999856 | 3.538027 |
ddef3c67-b869-479c-8f55-e285c65ff187 | tomasmgl/proyec-tree | test.cpp | #include <iostream>
#include "tree.hpp"
#include "NodeN.hpp"
#include "ListaSimple.hpp"
using namespace std;
int main()
{
Tree<int> t = Tree<int>(0);
Lista<int> l;
int n, k;
cin >> n;
for(int i = 0; i < n; i++)
{
cin >> k;
l.insertarFin(k);
}
t.insert(l);
return 0;
}
| ALGO | 0.999488 | 3.84097 |
e6953131-feff-472b-bb19-6fd95a6bf63e | WeiguoMa/PurityFromRandomMeasurement | extern/eigen/bench/sparse_setter.cpp |
// g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 &&
// ./a.out g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05
// -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/Linea... | ALGO | 0.981816 | 4.241481 |
ffc00ba6-7625-442a-99fe-2df203e3f51c | shivesh0307/range-sum-queries | Range_Update_Queries.cpp | // Program to show segment tree to demonstrate lazy
// propagation
#include<bits/stdc++.h>
using namespace std;
#define MAX 800000+5
#define ll long long
ll tree[MAX] = {0};
ll lazy[MAX] = {0};
//us, ue is the range for which we need to calc
//ss,se is the range for which the answer is contained by node at si
void u... | ALGO | 0.999856 | 5.308964 |
9e79fd7a-04a4-4a79-a6ed-44987692fee6 | ihvvbjj/2023aaia3 | week13/week13-2.cpp | #include <iostream>
using namespace std;
int helper(int a,int b){
int ans = 0,carry = 0;
while( a>0 || b>0 ){
int now = a%10 + b%10 + carry;
carry = now/10;
ans += carry;
a /= 10;
b /= 10;
}
return ans;
}
int main()
{
int a,b;
while(cin >> a >> b){
if(a==0 && b==0) break;
int ans = helper(a,b);
... | ALGO | 0.99991 | 3.896995 |
6dd9adf1-8cf7-4571-9870-6c16f727a853 | raj-krishnan-r/Sandbox | railyard/main.cpp | #include <stdio.h>
class Stack
{
int top = 0;
char operators[500];
public:
void push(char c)
{
operators[top++] = c;
}
char pop()
{
if (top < 0)
{
return '!';
}
return operators[--top];
}
char stackTop()
{
return operat... | ALGO | 0.99992 | 4.200979 |
cae8b30f-019b-4768-8655-9cc4f83867a1 | SVizor42/made_2019_algo | assignment_6/11_1/main.cpp | /*
11_1. Цикл минимальной длины
Дан невзвешенный неориентированный граф. Найдите цикл минимальной длины.
Ввод: v: кол-во вершин (макс. 50000), n: кол-во ребер (макс. 200000), n пар реберных вершин.
Вывод: одно целое число равное длине минимального цикла. Если цикла нет, то вывести -1.
*/
#include <iostream>
#include... | ALGO | 0.999525 | 5.093502 |
eacaf759-54dd-4cc2-b577-54772e01eedf | imaadishjain/Advance-DSA | Matrix/Search_in_a_row_wise_sorted_wise_coloumn.cpp | #include<bits/stdc++.h>
using namespace std;
void searchsorted(int **arr, int r, int c, int x)
{
int i=0;
int j=c-1;
while(i<r && j>=0)
{
if(arr[i][j]==x)
{
cout<<"Found and Position="<<"("<<i<<","<<j<<")"<<endl;
return;
}
else if(arr[i][j]>x)
... | ALGO | 0.999907 | 4.48963 |
ee2cba2f-cf90-40f1-934f-056f804e07c2 | RMusyaffa/Zodiac-Prediction-App-Mobile | dev/integration_tests/windows_startup_test/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.99876 | 6.772262 |
5c990700-20e3-4797-ab03-2b2865453eef | ishandutta2007/codeforces | somethingnew/normal/1641/D.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/rope>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define gcd __gcd
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)... | ALGO | 0.999953 | 3.937449 |
691df89f-be59-4043-aa38-7b026793806e | fatcacique/copy | src/ccstruct/quadlsq.cpp | #include "quadlsq.h"
#include "tprintf.h"
#include <cmath>
#include <cstdio>
namespace tesseract {
// Minimum variance in least squares before backing off to a lower degree.
const long double kMinVariance = 1.0L / 1024;
/**********************************************************************
* QLSQ::clear
*
* Fu... | ALGO | 0.998065 | 6.407071 |
b819623d-5de2-456d-8758-e99e404d1084 | mwy3055/Algorithm-codes | algospot/GRADUATION.cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int memoi[10][4096];
int n, k, l, m;
vector<int> preSubject, openSubject;
int bitCount(int num)
{
int bits = 0;
for (int i = 0; i < 32; i++)
if (num & (1 << i))
bits++;
return bits;
}
int solve(int semester, in... | ALGO | 0.999856 | 4.229875 |
ea2000ef-f378-462f-8503-319fa5a1c99f | ZacharyElledgeMCGhee/History-of-coding | EqualStrings.cpp | #include <iostream>
using namespace std;
int main() {
string input1, input1S;
string input2, input2S;
int equal = 1;
cout << "Enter two strings." << endl;
cout << "String 1: "; cin >> input1;
cout << "String 2: "; cin >> input2;
cout << endl;
input1S = input1;
input2S = input2;
for (int i = 0; input1S[... | ALGO | 0.999704 | 3.942899 |
3e17e0fe-cc5e-452c-a05c-d15df78f4f41 | Pram1535/OS-CSA0489 | os1d3Banker’s.cpp | #include<stdio.h>
#include<conio.h>
int max[100][100];
int alloc[100][100];
int need[100][100];
int avail[100];
int n,r;
void input();
void show();
void cal();
int main()
{
int i,j;
printf("********** Banker's Algo ************\n");
input();
show();
cal();
getch();
return 0;
}
void input()
{
int i,j;
printf("Enter the ... | ALGO | 0.999969 | 3.036577 |
d9a0f5e7-5e6a-4c94-a0e2-589c19149a13 | geoffrey-anto/leetcode-solutions | 0146-lru-cache/solution.cpp | // Basically maintain a DLL of size capacity
// if put element is already there leave it else append to head
// if it exceded the cap remove tail and append
// for get if not tjere return -1
// if there remove the ele and append to head
// return the value at key
// For searching in the list use a map to make it fast... | ALGO | 0.999906 | 5.95329 |
12409e4d-b5fd-49d3-a810-8436c63d6316 | shakil-ahmmed-se/shortest_path | message_route.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
vector<int> g[N];
vector<bool> visited(N,false);
vector<int> level(N,0);
vector<int> parent(N,-1);
void bfs(int source){
queue<int> q;
q.push(source);
level[source] = 1;
visited[source] = true;
while (!q.empty())
{
... | ALGO | 0.999996 | 4.45882 |
3dde3912-2992-4ac4-be4a-25dac6d96a5d | motobiubiu/biubiuquik | src/neon/hardSigmoid.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include <arm_neon.h>
#include "help.h"
#include "funNeon.h"
void hardSigmoid(const std::vector<float>& input, std::vector<float>& output) {
for (size_t i = 0; i < input.size(); ++i) {
output[i] = std::max(0.0f, std::min(1.0f,(input[i]+1.0f)/... | ALGO | 0.996275 | 5.385444 |
e17feae3-4842-4593-bef0-12978eb95e11 | kahowang/sensor-fusion-for-localization-and-mapping | 第一章 概述/lidar_localization/third_part/gtsam-4.0.2/gtsam/3rdparty/Eigen/bench/sparse_lu.cpp |
// g++ -I.. sparse_lu.cpp -O3 -g0 -I /usr/include/superlu/ -lsuperlu -lgfortran -DSIZE=1000 -DDENSITY=.05 && ./a.out
#define EIGEN_SUPERLU_SUPPORT
#define EIGEN_UMFPACK_SUPPORT
#include <Eigen/Sparse>
#define NOGMM
#define NOMTL
#ifndef SIZE
#define SIZE 10
#endif
#ifndef DENSITY
#define DENSITY 0.01
#endif
#ifnd... | ALGO | 0.999356 | 4.187482 |
d5d22a42-ec65-4f5d-8118-37accf73543f | solaimanhosen/Compettive-Programming | Hackerrank/A Very Big Sum.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long n, sum = 0, num;
cin >> n;
while(n--){
cin >> num;
sum += num;
}
cout << sum << endl;
}
| ALGO | 0.997596 | 3.779157 |
db275b5a-6cba-4488-ab04-862df6909304 | taskinahmadalfaruqe/CppInJUST | Day-15/CalculateMaxWithTemplate.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
T findMaxNumber(T a, T b, T c)
{
if (a >= b && a >= c)
return a;
else if (b >= a && b >= c)
return b;
else
return c;
}
int main()
{
cout << "Largest (int): " << findMaxNumber(10, 20, 30) << endl;
cout << "L... | ALGO | 0.990379 | 4.330129 |
34924bd8-9e28-4e2e-b42b-c898b30652ed | David810209/Intro-to-Algorithm-2023 | DP/educational dp contest/pc-vacation.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int> vi;
typedef vector<vi> vvi;
signed main()
{
ios::sync_with_stdio(0), cin.tie(0);
int n;
cin >> n;
vi a(n + 1), b(n + 1), c(n + 1);
vvi dp(n + 1, vi(3));
for (int i = 1; i <= n; ++i)
{
cin >> a[... | ALGO | 0.999972 | 4.161219 |
efe1faba-d2f7-4e6c-a411-5e30c0e7239e | CrBillman/LAMMPS | GPU/pair_born_coul_wolf_gpu.cpp | /* ----------------------------------------------------------------------
Contributing authors: Trung Dac Nguyen (ORNL)
------------------------------------------------------------------------- */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "pair_born_coul_wolf_gpu.h"
#include "atom.h"
#includ... | ALGO | 0.99663 | 6.212372 |
f91c80c9-fe4e-4047-97dc-8b12f623bee6 | MZhikoV/03_CPlusPlus_Advanced_SoftUni | 06_Maps_and_Sets_Ex/06. Squares/06. Squares.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
bool isSquareCheck(int a) {
if (a >= 0) {
int check = sqrt(a);
return(check * check == a);
}
return false;
}
int main()
{
array<int>... | ALGO | 0.999723 | 3.942663 |
c09f781c-4b69-449c-885e-28b940a7e3da | koosaga/olympiad | Library/USACO-master/Contests/USACO Solutions/2019-20/Jan/Plat/falling.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
#define mp make_pair
#define f first
#define s second
typedef vector<int> vi;
typedef vector<ll> vl;
... | ALGO | 0.999962 | 3.95575 |
a451aa25-5695-41e3-8bb9-c81768dada32 | live-clones/gmsh | src/numeric/nodalBasis.cpp | #include <limits>
#include <cmath>
#include <algorithm>
#include "nodalBasis.h"
#include "BasisFactory.h"
#include "pointsGenerators.h"
#include "MPrism.h"
namespace ClosureGen {
inline double pow2(double x) { return x * x; }
void rotateHex(int iFace, int iRot, int iSign, double uI, double vI,
do... | ALGO | 0.998829 | 5.053563 |
475d7e5d-6a79-47e3-b984-2896032b68ff | jatin837/leetcode_solutions | 2007-find-original-array-from-doubled-array/2007-find-original-array-from-doubled-array.cpp | class Solution {
public:
vector<int> findOriginalArray(vector<int>& nums) {
if(nums.size()%2)
return {};
vector<int>ret;
map<int, int>mp;
set<int>st(nums.begin(), nums.end());
for(int num:nums)
mp[num]++;
if(mp[0]%2)
return {};
mp[0] /= 2;
for(... | ALGO | 0.99998 | 5.363783 |
852f8e71-7125-4d7f-a66d-9c3be4cb2f76 | Fraunhofer-AISEC/softboundcets-llvm-project | pstl/test/std/algorithms/alg.sorting/sort.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14
#include "support/pstl_test_config.h"
#include <execution>
#include <algorithm>
#include "support/utils.h"
using namespace TestUtils;
#define _CRT_SECURE_NO_WARNINGS
#include <atomic>
static bool Stable;
//! Number of extant keys
static std::atomic<int32_t> KeyCount;
//! One ... | TEST | 0.982299 | 6.967888 |
48159df6-94e3-4189-9f65-922bcb6ee154 | marcelloPuligheddu/libGint | src/fgamma.cpp | #include "fgamma.h"
#define Teps 1.e-13
#define NDERIV_MAX 21
#define DEGREE 13
/*
double* read_c0( int Nder, FILE* stream, int* ldc0_ptr ){
const int patches = 207;
assert( Nder <= NDERIV_MAX );
int size1 = ((Nder + 1)*(DEGREE + 1)*(DEGREE + 2))/2;
int size2 = ((NDERIV_MAX + 1)*(DEGREE + 1)*(DEGREE... | ALGO | 0.999468 | 5.334306 |
57b70728-6e4b-44fd-94eb-fb5efce25ad8 | NadaMohamed2243/ITI-Open-Source-Courses | open source/data structure/lab4/4-1(Binary search( recursive)/main.cpp | #include <iostream>
using namespace std;
int BinarySearch(int arr[] , int low , int high , int key)
{
int mid;
mid = (low+high)/2;
//base case
if(low > high)
{
return -1;
}
// check if the mid is our target value
if(key == arr[mid])
{
return mid;
}
// our t... | ALGO | 0.999778 | 5.203849 |
ce7e8120-c74f-44c5-a071-2d6631be6a50 | G33k1973/CodingGames | CarryOperation.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
void solve(string x, string y, int &ans) {
int n = static_cast<int>(x.size());
int m = static_cast<int>(y.size());
reverse(begin(x), end(x));
reverse(begin(y), end(y));
int i = 0, j = 0, c = 0;
while (i < n&&j < m) {
int fx = x[i] - '0';
int fy... | ALGO | 0.999868 | 5.188464 |
ce925793-96c4-459d-8b9d-0fdafc6d45d8 | Abhijayshah/LeetCode-Practice | 0129-sum-root-to-leaf-numbers/0129-sum-root-to-leaf-numbers.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.999944 | 7.172559 |
c7e552cc-46de-4a22-9bfa-12e898f5ff58 | HanochZhu/vts-browser-unity-plugin | externals/browser/externals/eigen/eigen/unsupported/doc/examples/MatrixSquareRoot.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(2,2);
A << cos(pi/3), -sin(pi/3),
sin(pi/3), cos(pi/3);
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix square root of A is:... | ALGO | 0.999295 | 3.930508 |
1d7d0495-15dd-4f84-82da-b80a6813054b | ArturTanona/CppCodewars | IntegersRecreationOne/integers.cpp | /*
Divisors of 42 are : 1, 2, 3, 6, 7, 14, 21, 42. These divisors squared are:
1, 4, 9, 36, 49, 196, 441, 1764. The sum of the squared divisors is 2500
which is 50 * 50, a square!
Given two integers m, n (1 <= m <= n) we want to find all integers between
m and n whose sum of squared divisors is itself a square. 42 i... | ALGO | 0.99835 | 5.59789 |
928754d2-4992-45dd-8a66-448ad6919ba3 | jl2537358/LopezJose_CSC5_40717 | Class_Lab/MathInstDis/MathInstructorDisagrement/main.cpp | /*
* File: main.cpp
* Author: Jose Lopez
* Created on January 7, 2015, 11:17 AM
* Purpose: how easy computers can make mistakes
*/
//System Libraries
#include <iostream>
using namespace std;
//User Libraries
//Global Constants
//Function Prototypes
//Execution Begins Here!
int main(int argc, char** ar... | TOOL | 0.920978 | 3.487585 |
4900609d-503c-4ec1-a886-5eac17a53330 | Ayush92347/GFG-Solution- | GFG potd question/Aggressive Cows.cpp | class Solution {
public:
int solve(int n, int k, vector<int> &stalls) {
sort(stalls.begin(),stalls.end());
int l=0,r=stalls[n-1]-stalls[0];
int ans=0;
while(l<=r){
int mid=(l+r)/2;
int cow=1;
int last=stalls[0];
for(int i=1;i<n;i++)... | ALGO | 0.999984 | 5.467295 |
4b820d57-55ad-49da-9ba0-18f5dbac176a | istupsm/C-Plus-Plus | divide_and_conquer/karatsuba_algorithm_for_fast_multiplication.cpp | /**
* @file
* @brief Implementation of the [Karatsuba algorithm for fast
* multiplication](https://en.wikipedia.org/wiki/Karatsuba_algorithm)
* @details
* Given two strings in binary notation we want to multiply them and return the
* value Simple approach is to multiply bits one by one which will give the time
*... | ALGO | 0.999923 | 5.746842 |
f7dbbfcf-3f5b-46a7-acf9-c4f633443374 | Mansipawar22/Data-Structure-and-Alogorithim | Data Structure & Algorithim/2. Array/8. Remove Duplicate from Array.cpp | #include<iostream>
using namespace std;
//Naive Solution
int RemoveDuplicates1(int arr[], int size)
{
int temp[size];
temp[0] = arr[0];
int res = 1;
for(int i = 1; i < size; i++)
{
if(temp[res-1] != arr[i])
{
temp[res] = arr[i];
res++;
}
}
fo... | ALGO | 0.999845 | 4.859167 |
f6572b17-993b-481a-b6dd-0d5bce07116c | Arnick-s/Leetcode-problems | 0400-nth-digit/0400-nth-digit.cpp | class Solution {
public:
int count_dig(int n){
return log10(n) + 1;
}
int findDig(int ans,int rem,int dig){
rem++;
while(ans){
if(dig == rem)
{
return ans%10;
}
ans/=10;
dig--;
}
return 0... | ALGO | 0.999918 | 6.21304 |
c1b7ebbe-fcb7-4f5d-8845-2a1ab03c517b | rahulseetharaman/leetcode-solutions | minimum-number-of-taps-to-open-to-water-a-garden/Solution.cpp | // https://leetcode.com/problems/minimum-number-of-taps-to-open-to-water-a-garden
class Solution {
public:
int minTaps(int n, vector<int>& ranges) {
vector<pair<int,int>>arr;
for(int i=0;i<=n;i++) {
arr.push_back(make_pair(max(0, i-ranges[i]), min(n, i+ranges[i])));
}
s... | ALGO | 0.999996 | 5.961312 |
9775474f-f031-4c7c-968b-a3e09d25da0e | niraimozhimadhumitha/CSA5132-Cryptography | 29.SHA operation.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdint.h>
#define STATE_SIZE 25
#define CAPACITY_LANES 16
#define LANE_SIZE 64
typedef struct {
uint64_t state[STATE_SIZE];
} InternalState;
void initializeState(InternalState *state)
{
for (int i = 0; i < STATE_SIZE; i++)
{
state->state[i] = 0;
... | ALGO | 0.998838 | 4.020672 |
3a60d9da-f117-4af3-9799-470d5dd78f09 | Uzer447/Code | Codeforces/Death's Blessing.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> a;
vector<int> b;
ll suma=0;
int maxb=INT_MIN;
for (int i = 0; i < n; i++)
{
int x;
... | ALGO | 0.999949 | 3.277375 |
8df810d5-d31c-49d5-a19b-dfe2275b103e | seqan/seqan | demos/tutorial/iterators/assignment_3_workshop_solution.cpp | #include <iostream>
#include <seqan/sequence.h>
#include <seqan/stream.h>
using namespace seqan2;
// Function to print simple alignment between two sequences with the same length
template <typename TText1, typename TText2>
void printAlign(TText1 const & genomeFragment, TText2 const & read)
{
std::cout << "Alignme... | TOOL | 0.857796 | 4.740314 |
53296f3b-1e75-40a4-bf14-f952c934307b | talhaaeroglu/LeetCode | 141-linked-list-cycle/141-linked-list-cycle.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
if(head == NULL) return false;
ListNode *trav1 = head;
ListNode *trav2 = hea... | ALGO | 0.999849 | 5.128113 |
0eec56c4-21fb-479b-9881-f94eccc45752 | sohardforaname/ACM_ICPC_practice | codeforces/1382/1382C.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
char s1[N], s2[N];
vector<int> ans1, ans2;
void solve()
{
int n;
scanf("%d%s%s", &n, s1 + 1, s2 + 1);
s1[n + 1] = '0';
s2[n + 1] = '0';
ans1.clear();
ans2.clear();
for (int i = 1; i <= n; ++i)
if (s1[i] != s1[i + 1]... | ALGO | 0.999919 | 3.737748 |
060540e8-722c-4aac-b132-2f1bb62db39c | ttl2004/PTIT-CODE | DSA - PTIT/DSA03021 - Tim day so.cpp | #include <bits/stdc++.h>
#define __Tieu_Long__PROPTIT__ int main()
#define Fast(); ios_base :: sync_with_stdio (0); cin.tie(0); cout.tie(0);
#define Tests() int t; cin >> t; while (t --)
#define Test() int t = 1; while (t --)
#define ll long long
#define pb push_back
#define endl '\n'
#define fi first
#define se second... | ALGO | 0.999993 | 3.710909 |
26e0947d-e583-4751-9cb8-ea667ca64f1c | ishandutta2007/codeforces | liuhengxi/normal/1228/E.cpp | #include<cstdio>
#define F(i,l,r) for(int i=l,i##_end=r;i<i##_end;++i)
using namespace std;
const int N=255,MOD=1000000007;
template<typename T>void readmain(T &x)
{
bool neg=false;
unsigned int c=getchar();
for(;(c^48)>9;c=getchar())if(c=='-')neg=true;
for(x=0;(c^48)<10;c=getchar())x=(x<<3)+(x<<1)+(c^48);
if(neg)... | ALGO | 0.999891 | 3.841484 |
354b3a73-9cdd-4dcd-932d-1f71376c62f6 | Abunyawa/contests | 829/b.cpp | // chrono::system_clock::now().time_since_epoch().count()
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define debug(... | ALGO | 0.999851 | 4.65304 |
925da14f-518f-40d8-b543-9f3c49bbeeff | evilraptor/BigInt | main.cpp | #include "Class_BigInt.h"
int main()
{
//std::string str1 = "4574988923784";
//std::string str2 = "7892657887452";
//BigInt number1 = BigInt(str1);
//BigInt number2 = BigInt(str2);
//std::cout << number1 + BigInt(2);
BigInt number3 = BigInt(-2);
BigInt number4 = BigInt(-4);
number3 *=... | ALGO | 0.957116 | 4.299001 |
06a16c8f-25fa-4546-a25d-7fc0da6d7d6f | bluster980/Leetcode-Solutions | Longest Repeating Subsequence - GFG/longest-repeating-subsequence.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int LongestRepeatingSubsequence(string str){
string s = str;
int n = str.size();
int dp[n+1][n+1];
for(int i = 0;i<=n;i++){
dp[i][0] = 0;
}
f... | ALGO | 0.999886 | 6.218704 |
554a25dd-1e39-4283-9a82-4f42ddb15cca | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_9771_6.cpp | include<iostream>
using namespace std;
int main(){
string a;
cin>>a;
if(a=="a" || a=="i" || a=="u" || a=="e" || a=="o")cout<<"vowel"<<endl;
else cout<<"consonant"<<endl;
return 0;
} | ALGO | 0.998792 | 3.382207 |
779d777e-4ec0-4858-9ea6-fae6e8dcedf9 | dlwlgn/Algorithm | 백준/silver5/2751/병합정렬.cpp | #include <stdio.h>
int N, arr[1000001], temp_arr[1000001];
void merge(int start, int end) {
int point1 = start, point2 = (start + end) / 2 + 1;
int count = start;
while (count <= end) {
if (point1 <= (start + end) / 2 && point2 <= end) {
if (arr[point1] <= arr[point2]) {
temp_arr[count] = arr[point1];
... | ALGO | 0.99999 | 4.367634 |
2a09461d-5f4c-481f-9535-fe723a2df385 | ghettocrab/ProjectsOfC- | MirroredArray1.cpp | #include <iostream>
#include <cstring>
using namespace std;
int main() {
int size = 3;
int* a = new int[size];
for (int i = 0; i < size; ++i)
{
cin >> a[i];
}
for (int i = 0; i < size / 2; i++)
{
int n = a[i];
a[i] = a[size - 1 - i];
a[size - 1 - i] = n;
}
for (int i = 0; i < size; ++i)
{
cout << a... | ALGO | 0.999705 | 3.38927 |
94083ae1-6ea6-4695-9d02-6920806b080e | ishandutta2007/codeforces | krk/normal/51/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair <int, int> ii;
const int Maxn = 2005;
int n, m;
vector <ii> E;
int res;
int par[Maxn], siz[Maxn];
vector <int> neigh[Maxn];
vector <int> tneigh[Maxn];
int L[Maxn], P[Maxn];
bool jon[Maxn];
int dp[Maxn];
bool tk[Maxn];
int getPar(int x) { return par[x] == x?... | ALGO | 0.999868 | 4.288487 |
f63508d3-983d-4e13-95aa-d4070e312ea5 | Rajeshnds/Competitive-Programming | codeforces/dragonmas/codeforces(c++)_old/Puzzles.cpp | #include<bits/stdc++.h>
using namespace std;
int n,m,k,j=1;
main(){
cin>>n>>m;
int a[m+1];
for(int i=1;i<=m;i++)cin>>a[i];
sort(a+1,a+m+1);
k=a[m];
for(int i=n;i<=m;i++){
k=min(k,(a[i]-a[j]));
j++;
}
cout<<k;
}
| ALGO | 0.999976 | 3.29612 |
75a3e83f-19df-4ce4-84f2-9db3863e8e4f | raincross7/code-similarity | codes/train_code/problem382/problem382_371.cpp | #define _DEBUG
#include "bits/stdc++.h"
#include <atcoder/all>
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<... | ALGO | 0.999475 | 4.812635 |
2055cca6-d132-4f75-a4f0-c01ecd3b239f | sejalrai23/DSA-Practise | 79-word-search/79-word-search.cpp | class Solution {
public:
bool isValid(int n, int m , int i, int j){
if(i<0 || i>=n || j<0 || j>=m){
return false;
}
return true;
}
bool dfs(vector<vector<char>>& board , string word , int i , int j , int ind, vector<vector<int>>& vis){
if(!isValid(board.size(... | ALGO | 0.999792 | 6.021405 |
016470b3-1cef-4802-834c-9165e7abd690 | BasikBiceps/ConsoleChess | ConsoleChess/PawnMoveBehavior.cpp | #include "PawnMoveBehavior.h"
#include "FigureColor.h"
#include "GameBoardConfiguration.h"
constexpr std::size_t kWhitePawnYStartPosition = 1;
constexpr std::size_t kBlackPawnYStartPosition = 6;
std::shared_ptr<std::vector<FigurePosition>> PawnMoveBehavior::move(const FigurePosition& whereIs, const FigureColor& color... | ALGO | 0.986187 | 5.685802 |
7b50d898-12c1-4d91-99fb-eae8b1fef464 | pythonman1234/StriverDsaSheet | rotateMatrix.cpp | #include<bits/stdc++.h>
void rotateMatrix(vector<vector<int>>&mat){
int n = mat.size();
for(int i=0;i<n-1;i++){
for(int j =i+1;j<n;j++){
swap(mat[i][j],mat[j][i]);
}
}
for(int i=0;i<n;i++){
reverse(mat[i].begin(),mat[i].end());
}
}
| ALGO | 0.999916 | 4.313684 |
56afb5f1-e627-4367-be03-acd6110525af | LeoLewandowski/CIR2_Prog_TP | TD1/TD1_4.cpp | /* Premier programme en C */
#include<stdlib.h>
#include<stdio.h>
typedef unsigned long (*functionType)(unsigned long);
unsigned long factorialWhile(unsigned long n) {
unsigned long current = 2, total = 1;
while (current <= n) {
total *= current;
current++;
}
return total;
}
unsigned long factorialFor(unsign... | ALGO | 0.998984 | 3.343858 |
09f2783c-1938-4071-8437-bb58d3f55f00 | Nakib-Arman/CSE314---OperatingSystem | 3.IPC/.history/main_20250626235351.cpp | #include <iostream>
#include <chrono>
#include <pthread.h>
#include <random>
#include <vector>
#include <unistd.h>
using namespace std;
#define MAX_PHASE1_TIME 20
#define MAX_PHASE2_TIME 20
#define SLEEP_MULTIPLIER 1000
auto start_time = chrono::high_resolution_clock::now();
long long get_time() {
auto end_time ... | ALGO | 0.998791 | 4.601169 |
f5ecfd06-9683-4727-ae5d-17eef3a0a146 | TajwarSaiyeed/problem-solving-codechef-leetcode-codechef | 12-9-2024/Recent contest problems.cpp | /*
Author: Tajwar Saiyeed
Date: 2024-09-12 18:02:36
File: Recent contest problems.cpp
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int tc;
cin >> tc;
while (tc--)
{
int n, st = 0, lt = 0;
cin >> n;
while (n--)
{
string s;
... | ALGO | 0.997876 | 4.587614 |
2a8469cf-932a-4f1c-b90c-81be3f4425bb | Celissa/Legacy-Base | src/lib_exit.cpp | #include "system.h"
void* code_rem_exit_flag( void** argument )
{
room_data* room = (room_data*) argument[0];
int door = (int) argument[1];
int flag = (int) argument[2];
exit_data* exit;
if( room == NULL ) {
code_bug( "Code_Rem_Exit_Flag: NULL Room." );
return NULL;
}
if( fl... | TOOL | 0.867156 | 3.850482 |
7e6e08c3-d31a-4f60-98be-ed86162973b4 | Huangyan0804/vjudge | HDU-6533/HDU-6533.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
#define scanff(n) scanf("%d", &n)
const int N = 2e5 + 10;
ll a[N];
ll k, n, m, p;
int qmi(ll a, ll b)
{
ll ans = 1;
while (b) {
if (b & 1)
a... | ALGO | 0.999953 | 3.279 |
2f699c91-dc12-4c2d-9768-f7a4966f30d2 | TheRoyalMuffinMan/Advent-of-Code | 2024/day2/day_2.cpp | #include <memory>
#include <vector>
#include <string>
#include <cstdint>
#include <fstream>
#include <sstream>
#include <iostream>
#include <getopt.h>
#include <functional>
// Set to 0 to disable debugging
#define DDEBUG 1
typedef struct {
std::vector<std::vector<std::int32_t>> mat;
} InputData;
void solvePartOn... | ALGO | 0.991627 | 5.262008 |
fe273e02-3887-46e9-90b4-f90e61d81cb2 | DANGXingJie/DataStructure | DataStructure/LinkStack.cpp | #include<iostream>
using namespace std;//ʽջ
template < class T>
struct LinkNode {//ڵ
T data; //
LinkNode* link;//ָ
LinkNode(const T& args, LinkNode<T>* ptr = NULL) {
data = args;
link = ptr;
}
};
template < class T>
class LinkedStack {
LinkNode<T>* top;
public:
LinkedStack() {
top = NULL;
}
~Link... | ALGO | 0.989238 | 3.608135 |
f55ca755-dc3e-4d9f-b8a8-fc4377bede09 | lumos706/SYSU_Data_Structures_and_Algorithms | 22336216_Project6/src/main.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <windows.h>
#include "graph.h"
using namespace std;
int main() {
system("color F0");
cout << "ֵ䣺 " << endl;
for (int i = 0; i < 26; i++) {
cout << "" << i << ": " << name[i] << endl;
}
// ߵ
... | ALGO | 0.983483 | 5.169662 |
f447125a-58dd-4291-9686-fa53190322c1 | RajaKunalPandit1/Leetcode_Questions | 2444. Count Subarrays With Fixed Bounds.cpp | Output Status :
Runtime
113 ms
Beats
86.12%
Memory
70.4 MB
Beats
90.20%
class Solution {
public:
long long countSubarrays(vector<int>& nums, int minK, int maxK) {
long res = 0;
bool minFound = false, maxFound = false;
int start = 0, minStart = 0, maxStart = 0;
for (int i = 0; i <... | ALGO | 0.999893 | 5.436152 |
0202ff40-88cf-40c5-bdb6-ddd19b0c1b01 | nirala-mpbf/LeetCoding | 0852-peak-index-in-a-mountain-array/0852-peak-index-in-a-mountain-array.cpp | class Solution {
public:
int peakIndexInMountainArray(vector<int>& arr) {
int n=arr.size(), st=0, en=n-1 , mid;
while(st<en){
mid= st + (en - st)/2;
if( arr[mid] < arr[mid+1]){
st=mid+1;
}
else{
... | ALGO | 0.999979 | 5.705267 |
fdf1b900-49b8-4202-85c1-148cce75f8f3 | ifce-prof-thiago/ip_engenharia_2024.1 | 18.cpp | /*
Crie um programa que receba uma frase e substitua
todas as letras "a" por "e".
*/
#include <iostream>
using namespace std;
int main()
{
string frase;
cout << "Digite uma frase:";
getline(cin, frase);
cout << frase.size() << endl;
for (int i = 0; i < frase.size(); i++)
{
if... | ALGO | 0.969004 | 4.1874 |
835756a2-350f-45c7-9d95-e9226bb97554 | Roy-rom/android_frameworks_av | media/codecs/m4v_h263/enc/src/datapart_encode.cpp | #ifndef H263_ONLY
#include "mp4def.h"
#include "mp4lib_int.h"
#include "bitstream_io.h"
#include "mp4enc_lib.h"
#include "m4venc_oscl.h"
/* ======================================================================== */
/* Function : EncodeFrameDataPartMode() */
/* Date : 09/6/200... | TOOL | 0.888493 | 5.804534 |
f3d17c89-a2d3-4f11-ba23-88a3d6a20627 | Anny-Moon/PCMC | PCMC_lib/source/Utilities.cpp | /** Utilities.cpp
*
* Anna Sinelnikova
* Uppsala,Sweden 2016
*/
#include <math.h>
#include "../include/Utilities.h"
#include <stdlib.h>
#include <stdio.h>
namespace PCA{
bool globalVerbose = true;
double meanValue(int size, const double* values)
{ int i;
double av = 0.0;
for(i=0; i<size; i++)
av += va... | TOOL | 0.997642 | 3.857169 |
02e87330-539f-42a1-90f3-b0b56efdbfc4 | butnik666/hermes2d | tests/benchmarks/screen/main.cpp | #include "hermes2d.h"
#include "solver_umfpack.h"
// This test makes sure that the benchmark "screen" works correctly.
const int P_INIT = 1; // Initial polynomial degree of all mesh elements.
const double THRESHOLD = 0.5; // This is a quantitative parameter of the adapt(...) function and
... | ALGO | 0.993816 | 6.218102 |
d4702428-3d76-4dec-8fd7-5a3e5870d056 | HuangErGou/Dragonball | boost_1_68_0/libs/graph/example/simple_planarity_test.cpp | int main(int argc, char** argv)
{
// This program illustrates a simple use of boyer_myrvold_planar_embedding
// as a simple yes/no test for planarity.
using namespace boost;
typedef adjacency_list<vecS,
vecS,
undirectedS,
property<ver... | ALGO | 0.981427 | 6.244393 |
2d13e2ce-b47c-4065-9f87-e844123a130b | rajeevranjancom/Leetcode_Cpp | 067. Add Binary.cpp | class Solution {
public:
string addBinary(string a, string b) {
int carry = 0;
string s = "";
int i = a.size() - 1;
int j = b.size() - 1;
while(i >= 0 || j >= 0 || carry){
int num1 = i < 0 ? 0 : a[i] - '0';
int num2 = j < 0 ? 0 : b[j] - '0';
... | ALGO | 0.99997 | 6.892557 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.