uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
32420b83-b44c-4605-908b-84af2452820e | Crazy-German/BlastIntegration | PhysX-main/physx/source/geomutils/src/contact/GuFeatureCode.cpp | #include "GuConvexEdgeFlags.h"
#include "GuFeatureCode.h"
using namespace physx;
using namespace Gu;
static FeatureCode computeFeatureCode(PxReal u, PxReal v)
{
// Analysis
if(u==0.0f)
{
if(v==0.0f)
{
// Vertex 0
return FC_VERTEX0;
}
else if(v==1.0f)
{
// Vertex 2
return FC_VERTEX2;
}
els... | ALGO | 0.968305 | 6.409337 |
74acc6b8-3f92-48a1-a250-f40646a8666b | oldlick/CompetitiveProgramming | atcoder/3 ABC/129/B.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
using namespace std;
int abs(int a){
if(a<0){
a*=-1;
}
return a;
}
int main(){
int num=0;
vector<int> weight;
cin>>num;
for(int i=0;i<num;i++){
int tmp;
cin>>tmp;
weight.push_back(tmp);
}
int min=-1;
for(int ... | ALGO | 0.999994 | 3.763818 |
6b002a3b-7bc0-4074-81f4-c02e88de64be | arukan02/TUT_Software_Enshuu2 | report4/Q2/eigen-3.4.0/lapack/cholesky.cpp | #include "lapack_common.h"
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info))
{
*info = 0;
if(UPLO(*uplo)==INVALID) *info = -1;
else if(*n<0) ... | ALGO | 0.999355 | 6.004565 |
984b0456-7db7-4841-801e-7fb755b4b405 | Arif-462/algorithom_cpp | Week 7 Introduction to Dynamic Programming/Module 23 Lab Assignment 2/Q-1 Fibonacci number.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1001;
int dp[N];
// Memorization Method:
int fib(int n)
{
// base case
if(n <= 2 )
{
return 1;
}
if(dp[n] != -1)
{
return dp[n];
}
int ans = fib(n-1) + fib(n-2);
dp[n] = ans;
return ans;
}
int ma... | ALGO | 0.999993 | 5.0681 |
96572d1b-1a70-4f25-9678-21e24561e769 | praymeta/Code-Up-Algorithm | BOJ_1085_EscapeFromARectangle.cpp | #include <iostream>
using namespace std;
int main(void) {
int x, y, w, h;
cin >> x >> y >> w >> h;
cout << min(x, min(y, min(w - x, h - y)));
}
| ALGO | 0.995995 | 3.590319 |
2158e1ad-7321-446e-8772-c348cdcf433c | SanskarKansal/Code | CP/B_Square_Pool.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
long long s;
cin>>n>>s;
int ans=0;
for(int i=0;i<n;i++){
int dx,dy;
long long x,y;
cin>>dx>>dy>>x>>y;
long long v = (1LL*dx*x -... | ALGO | 0.999416 | 3.599822 |
5f5715bd-08b4-467f-bce7-d41101d79bd0 | ishandutta2007/codeforces | rfpermen/normal/1216/E1.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(ll i=n;i<=N;++i)
#define rap(i,n,N) for(ll i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#defin... | ALGO | 0.999687 | 4.134703 |
e4e8b83f-cdf7-494e-a72d-6b9bc024a268 | wsdqy1234/CarND-LMPC-Project | src/main.cpp | #include <math.h>
#include <uWS/uWS.h>
#include <chrono>
#include <iostream>
#include <fstream>
#include <thread>
#include <vector>
#include "Eigen-3.3/Eigen/Core"
#include "Eigen-3.3/Eigen/QR"
#include "MPC.h"
#include "LMPC.h"
#include "json.hpp"
#define MAX_LAP_NUM 8
using json = nlohmann::json;
// The Angle and ra... | WEB | 0.884015 | 4.393312 |
a8d928aa-58c3-429c-9f59-92bf40735e10 | 123456-manvi/Coding | Count Elements With Maximum Frequency.cpp | class Solution {
public:
int maxFrequencyElements(vector<int>& nums) {
vector<int>Count(101);
int maxFreq=0;
int total=0;
for(int &num:nums)
{
Count[num]++;
int freq=Count[num];
if(freq>maxFreq)
{
ma... | ALGO | 0.99983 | 5.775195 |
fee24e65-ad27-4315-bff2-580d86e48297 | dipender-singh/CN-DSA-AND-C-SOLUTIONS | TREES QUESTIONS/no_of_nodes_greator_than_x.cpp | /*
Count nodes
Send Feedback
Given a tree and an integer x, find and return the number of nodes which contains data greater than x.
Input format:
The first line of input contains data of the nodes of the tree in level order form. The order is: data for root node, number of children to root node, data of each of child n... | ALGO | 0.999952 | 5.054038 |
7e6bd3d7-b4e9-4e59-9c1a-6c8b45627238 | edger330/huawei-works | poc-fpga-12channel-stable/fp1/hardware/sdaccel_design/examples/vadd_rtl/src/xcl2.cpp | #include <unistd.h>
#include <limits.h>
#include <sys/stat.h>
#include "xcl2.hpp"
namespace xcl {
std::vector<cl::Device> get_devices(const std::string& vendor_name) {
size_t i;
std::vector<cl::Platform> platforms;
cl::Platform::get(&platforms);
cl::Platform platform;
for (i = 0 ; i < platforms.si... | TOOL | 0.929965 | 3.694713 |
4b520b4d-0cd9-42ea-baee-fbce18b1073e | xdestiny110/Leetcode | 2678.老人的数目.cpp | /*
* @lc app=leetcode.cn id=2678 lang=cpp
*
* [2678] 老人的数目
*/
// @lc code=start
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
class Solution {
public:
int countSeniors(std::vector<std::string>& details) {
return std::count_if(details.begin(), details.end(), [](const s... | ALGO | 0.963269 | 6.101422 |
a2673c06-978c-4be9-97ff-271c29f5704e | Sahanasnarayan/Leetcode | problems/max_consecutive_ones_iii/solution.cpp | class Solution {
public:
int longestOnes(vector<int>& nums, int k) {
// sliding window approach
int i = 0, j = 0;
while (i < nums.size()) {
if (nums[i] == 0) k--; //u flip the zero and decrement k
if (k < 0) {
// to flipback the one's to zero's'
i... | ALGO | 0.999945 | 6.215402 |
e1ad927a-cad4-494d-ab28-be6528eda51e | PANDA-CODER-3110/leetcode_hard_way | 0240-search-a-2d-matrix-ii/0240-search-a-2d-matrix-ii.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int row = matrix.size() ;
int col = matrix[0].size() ;
int i=0 , j= col-1 ;
while(i<row && j>=0)
{
if(matrix[i][j]==target) return true ;
else if(matrix[i][j]<ta... | ALGO | 0.999942 | 6.161529 |
cd653cfa-e2bf-45a1-ac76-6b33ad9a3a73 | anupamkaul/robot_slam | practice/localization/kalman/eigenLib/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.999359 | 3.9114 |
c8edd95d-def3-4646-af5c-eaf7b82e891d | ScarWar/Final_Projcet | main_aux.cpp | #include <cstdio>
#include <cstdlib>
#include <opencv2/core/mat.hpp>
#include "SPImageProc.h"
#include "main_aux.h"
extern "C" {
}
#define FEATURE_FILE_TYPE ".feats"
#define ERR_MSG_CREATE_FILE "Unable to create file"
#define ERR_MSG_OPEN_FILE "Unable to open file"
#define ERR_MSG_WRITE_FILE "Error while writing to... | TOOL | 0.940463 | 5.460257 |
0a58d914-18db-49d6-81f3-1587fb65b90e | Rishikewalya/GeeksforGeeks-Problems | Difficulty: Basic/Sum of first n terms/sum-of-first-n-terms.cpp | //{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
int sumOfSeries(int n) {
// code here
if(n == 0){
return 0;
}
return pow(n,3) + sumOfSerie... | ALGO | 0.999118 | 6.109058 |
91ce82ac-ed97-435a-bb2d-e7b251519495 | AmeyaVS/SystemC_DEPRECATED | systemc-regressions/tests/systemc/misc/unit/data/datawidth_signed/extension/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.982325 | 5.296924 |
7439f9c4-cb63-4e04-9106-7019c6e57721 | ishandutta2007/codeforces | uryuuu/normal/1217/A.cpp | #include<iostream>
#include<stdio.h>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<time.h>
#include<cstdlib>
typedef long long ll;
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define ... | ALGO | 0.999692 | 3.382005 |
9b9899b2-ce12-487b-b110-451df41c0d1b | fbumanglag71/C-Plus_Stock-Commission | Mod3Project2.cpp | /*Author: Francisco Bumanglag
Project: Stock Commission
Assignment: Module 3 Project 2
Course: C++ Santa Ana College
Class: CMPR120 Dr. Tahir Aziz
Date: February 21, 2024*/
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
//declarations
double sharesStock = int();
double perShare = int(... | TOOL | 0.91617 | 5.111302 |
b98b5425-1b0d-41f0-b6a3-35391a3cd7c4 | haohaibo/tutorial | PAT/group_tianti/test.cpp | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main(int argc, char* argv[]) {
int x = 2, y = 31;
long max;
max = pow(x, y) - 1;
long fact = 1;
int fact_num = 13, i = 13;
while (i >= 1) {
fact *= i;
--i;
}
cout << "fact(" << fact_num << ") is... | ALGO | 0.999483 | 4.20698 |
70b8b6e6-5632-4537-b174-6756aeae17a2 | vfolunin/archives-solutions | LeetCode/3606.cpp | class Solution {
bool checkCode(string &code) {
for (char c : code)
if (!isalnum(c) && c != '_')
return 0;
return !code.empty();
}
bool checkLine(string &line) {
return line == "electronics" || line == "grocery" || line == "pharmacy" || line == "restauran... | ALGO | 0.999238 | 5.538813 |
48719762-ccc6-44de-8fe2-5ad1e8ab98b8 | prachi260605/DSA_Questions_Leetcode | 792-binary-search/binary-search.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int s=0,e = nums.size()-1;
return solve(nums,s,e,target);
}
int solve(vector<int> nums, int s, int e, int k){
int mid = s+(e-s)/2;
//base case
if(s>e) return -1;
if(nums[mid]==k) re... | ALGO | 0.999971 | 5.945446 |
b40451d4-879a-4837-afa5-da552fa85060 | Rovinota/Codeforces-Solutions | Codeforces Random Problem(800-1000)/A. Game with Cards.cpp | #include <bits/stdc++.h>
using namespace std;
void solve () {
int n;
cin >> n;
int a[n];
int alice_m_c = 0;
for (int i = 0; i < n; i++){
cin >> a[i];
alice_m_c = max (alice_m_c, a[i]);
}
int bob_m_c = 0;
int m;
cin >> m;
int b[m];
for (int i = 0; i < m; i++) {
cin >> b[i];
bob_m_c = max(bob_m_c, b[i]... | ALGO | 0.999991 | 4.066072 |
0d58d64a-fa23-4f08-b232-0b14d4a04a9e | electricalArt/SomeOldCppProjects | VasilievAN_Programmirovanie_na_c++/chapter6_classes-and-objects-use/6.q3_cirle-list.cpp | /*
* =====================================================================================
*
* Filename: 6.q3_list-circle.cpp
*
* Description: describes a list like circle
*
* Version: 1.0
* Created: 06/18/20 21:33:51
* Revision: none
* Compiler: g++
*
* Auth... | ALGO | 0.980847 | 3.535839 |
24fe7e43-0cb6-49a1-b611-d106a5bcfa65 | Yejin-Moon/algorithm | C++/Class/vector.cpp | #include <iostream>
#include <vector>
int main()
{
std::vector<int> vec {1,2,3,4,5};
vec.push_back(1);
vec.push_back(2);
vec.insert(vec.begin(), 0);
for (auto const &ele: vec)
std::cout<<ele<<' ';
return 0;
}
| ALGO | 0.931707 | 3.658586 |
1be1571d-48de-4a3f-b552-e424eb498822 | Pritanjan/LeetCode-2.0 | K Sum Paths - GFG/k-sum-paths.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node *buildTree(string str)
{
// Corner Case
... | ALGO | 0.999925 | 6.559605 |
28a339be-189f-43d5-800e-6b7926438450 | sidorovfiseg/labs-studies | algorithms/Lab/task7/main.cpp | #include "iostream"
#include "string"
#include "vector"
std::vector<int> prefix(const std::string& text) {
std::vector<int> pi(text.length());
pi[0] = 0;
int k;
for (int i = 1; i < text.length(); i++) {
k = pi[i - 1];
while (k > 0 && text[i] != text[k]) {
k = pi[k - 1];
... | ALGO | 0.999919 | 5.143062 |
d0bfcb48-9f40-4f02-a5bc-360cb12a4141 | silencelee/leetcode | algorithm/912.sort-an-array.cpp | /*
* @lc app=leetcode id=912 lang=cpp
*
* [912] Sort an Array
*
* https://leetcode.com/problems/sort-an-array/description/
*
* algorithms
* Medium (62.70%)
* Likes: 302
* Dislikes: 211
* Total Accepted: 57.3K
* Total Submissions: 91.5K
* Testcase Example: '[5,2,3,1]'
*
* Given an array of integers... | ALGO | 0.999996 | 6.308362 |
63465ffb-1672-4010-8c09-3e971f0fca41 | ZihengZZH/LeetCode | cpp/IntegerToRoman.cpp | /*
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
Symbol I V X L C D M
Value 1 5 10 50 100 500 1,000s
*/
#include <iostream>
#include <string>
using namespace std;
string intToRoman(int num) {
string res;
int count,div,rem... | ALGO | 0.995803 | 6.663193 |
e4988755-a281-4d1d-a95f-f3f044823aed | shivansh00/GfG-POTD | 2024-01-03 Smallest window containing 0, 1 and 2.cpp | class Solution {
int O12[3]= {-1, -1, -1};
int len= INT_MAX;
public:
int smallestSubstring(string S) {
// Code here
for (int i= 0; i < S.length(); i++) {
O12[S[i]-'0']= i;
if (O12[0] != -1 and O12[1] != -1 and O12[2] != -1)
len= min(len, *max_element... | ALGO | 0.999861 | 5.124375 |
73f123c6-9f6c-44a9-a342-2061790435d8 | ermolaevv/ppc-2024-autumn | tasks/seq/sadikov_I_gather/src/ops_seq.cpp | #include <iostream>
#include <random>
#include "seq/sadikov_I_gather/include/sq_task.h"
sadikov_I_gather_seq::SumByRowsTask::SumByRowsTask(std::shared_ptr<ppc::core::TaskData> taskData)
: Task(std::move(taskData)) {}
bool sadikov_I_gather_seq::SumByRowsTask::validation() {
internal_order_test();
return taskD... | ALGO | 0.912137 | 5.606082 |
5d21de7d-7b40-4dbd-a497-c9e72ce9d567 | piyush1146115/Competitive-Programming | Uva Oj/1727 Counting Weekend Days.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string mon, day;
int i, j, k, test;
scanf("%d", &test);
while(test--){
cin >> mon >> day;
if(mon == "APR" || mon == "JUN" || mon == "SEP" || mon == "NOV"){
if(day == "FRI"){
printf("10\n");
... | ALGO | 0.999626 | 3.925865 |
d062951a-69b9-49e4-9bba-07549e097df3 | crystalchavez99/WGU-C867-Scripting-and-Programming-Applications | branches/stringLetter.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string userInput;
char firstLetter;
getline(cin, userInput);
cin >> firstLetter;
if (userInput.at(0) == firstLetter) {
cout << "Found match: " << firstLetter << endl;
}
else {
cout << "No match: " << firstLetter ... | ALGO | 0.996548 | 4.23378 |
646a7445-c8f2-47ec-a471-73533e3568b0 | sb-ncbr/golem | ui/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.998617 | 6.783336 |
d4719a5b-834f-4b9d-8934-80d286f36129 | pankajm05/DSA | Matrix/template.cpp | template<typename T>
class matrix {
public:
int n, m;
vector<vector<T>> mat;
matrix(int _n, int _m, T v = T(0)) : n(_n), m(_m) {
mat.resize(n);
for (int i = 0; i < n; i++) {
mat[i].assign(m, v);
}
}
explicit matrix(vector<vector<T>> &a) : n(a.size()), m(a[0].size()) {
assert(!a.empty())... | ALGO | 0.999843 | 4.65283 |
d58463c0-6144-4a7d-84b2-4b924c68aa37 | shivkaraman/DSA | 02_Strivers A-Z DSA sheet/02_Array/21_SpiralPrinting.cpp | // https://leetcode.com/problems/spiral-matrix/description/
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
class Solution {
public:
vector<int> spiralOrder(vector<vecto... | ALGO | 0.999968 | 6.130524 |
81cfb22f-2dce-4a03-bcd4-e5dd3ef0bc5e | walkccc/LeetCode | solutions/1898. Maximum Number of Removable Characters/1898.cpp | class Solution {
public:
int maximumRemovals(string s, string p, vector<int>& removable) {
int l = 0;
int r = removable.size() + 1;
while (l < r) {
const int m = (l + r) / 2;
const string removed = remove(s, removable, m);
if (isSubsequence(p, removed))
l = m + 1;
else
... | ALGO | 0.999201 | 6.158385 |
72cbfc96-b312-4b8e-944d-83aca115d151 | shinichivuong/BombOnlineResource | frameworks/cocos2d-x/extensions/Particle3D/PU/CCPUSimpleSpline.cpp | #include "CCPUSimpleSpline.h"
#include "base/ccMacros.h"
NS_CC_BEGIN
//---------------------------------------------------------------------
PUSimpleSpline::PUSimpleSpline()
{
// Set up matrix
// Hermite polynomial
_coeffs.m[0] = 2;
_coeffs.m[1] = -2;
_coeffs.m[2] = 1;
_coeffs.m[3] = 1;
_co... | ALGO | 0.996125 | 6.902122 |
e117f4c8-aac7-44ad-aef5-1f8745af7fd3 | Blackmane/adventofcode | 2024/day17/main.cpp | /**
* @file main.cpp
* @project advent of code
*
* @author Niccolò Pieretti
* @date 17 Dec 2024
*
****************************************************************************
*
* _ _ o __ __ __ _ o _ ,_ _
* / |/ ... | ALGO | 0.975153 | 6.260386 |
3f3c5b7a-6f25-41d1-a821-893df5b0eca3 | ishandutta2007/codeforces | tutis/normal/922/C.cpp | /*input
5 3
*/
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_... | ALGO | 0.99999 | 3.952032 |
6484faf5-a1b4-422d-975b-ee85ab8e26ef | mustakimur/OS-CFI | llvm-src/lib/CodeGen/MachineTraceMetrics.cpp | #include "llvm/CodeGen/MachineTraceMetrics.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SparseSet.h"
#include "llvm/CodeGen/MachineBasicBlock.... | TOOL | 0.98821 | 7.901118 |
263e25f1-c19a-447d-a0e1-b46d5a243836 | chandan2853/problem-solving | codeforces/677A.cpp | #include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n,k;
cin>>n>>k;
int result=0;
for(int i=0;i<n;i++){
int a;
cin>>a;
//cout<<result<<endl;
if(a<=k){
result+=1;
}
... | ALGO | 0.999745 | 3.017572 |
dc0457bb-b879-4e64-b76e-1bb034791cd6 | AntonyMoes/ACID | lib/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp | #include "Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h"
#include "Box2D/Common/b2BlockAllocator.h"
#include "Box2D/Dynamics/b2Fixture.h"
#include "Box2D/Collision/Shapes/b2ChainShape.h"
#include "Box2D/Collision/Shapes/b2EdgeShape.h"
#include <new>
b2Contact* b2ChainAndPolygonContact::Create(b2Fixture* fixtureA... | ALGO | 0.988686 | 6.330417 |
a3869e42-9d7f-461e-befe-8de1cc987407 | anmolchauhanji/DSA | sorting/insertion_sort.cpp | #include <iostream>
using namespace std;
int main()
{
int swapp = 0;
int arr[] = {5, 4, 2, 5, 4, 52};
int n = sizeof(arr) / sizeof(arr[0]);
for (int i = 1; i < n; i++)
{
int key = arr[i];
int j = i - 1;
while (j >= 0 && arr[j] > key)
{
arr[j + 1] = arr[j];
j--;
}
arr[j + 1]... | ALGO | 0.999979 | 3.511089 |
ba469d57-e6fa-4e1f-93f0-74e016814075 | shantanushrivastava/c-imp- | rec_isSorted.cpp | #include<iostream>
using namespace std;
bool isSorted(int arr[],int n,int i){
if(i==n-1){
return true;
}
if(arr[i]>arr[i+1]){
return false;
}
return isSorted(arr,n,i+1);
}
int main(){
int arr1[5]={1,2,3,4,5};
int arr2[5]={2,3,1,4,5,};
cout <<isSorted(arr1,5,0)<<endl;... | ALGO | 0.999888 | 4.749461 |
265dc651-8ac7-445d-ad73-28759fc93c8c | lobofoltran/logica-atividade-1-e-2 | n2-atividade2.cpp | #include<iostream>
int main () {
float c = 0;
float f = 0;
std::cout << "Digite a temperatura em graus celsius: \n";
std::cin >> c;
// formula
f = ( 9 * c + 160 ) / 5;
std::cout << "Temperatura convertida: " << f;
return 0;
}
| TOOL | 0.907226 | 3.993203 |
de67d3e1-7544-4346-b7d9-8ca254ed2f04 | alexandraback/datacollection | solutions_5658282861527040_0/C++/Chieh/pB.cpp | #include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
int cases;
scanf("%d", &cases);
for( int tt = 1; tt <= cases; tt++ )
{
int a, b, c, cnt = 0;
scanf("%d %d %d", &a, &b, &c);
for( int i = 0; i < a; i++ )
for( int j = 0; j < b; j++ )
... | ALGO | 0.998288 | 3.978334 |
a8b7c913-d933-472d-bedf-91f46bdaf21d | max777xam/MyCodes | C++/复习/1.4编程基础之逻辑表达式与条件分支/奇偶数判断.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
if (n % 2 == 0)
{
cout << "even" << endl;
}
else
{
cout << "odd" << endl;
}
return 0;
} | ALGO | 0.998717 | 3.814691 |
303d5b74-1843-4f5e-bee4-bef269cfeda9 | stratton-oakcoin/oakcoin | src/miner.cpp | #include "miner.h"
#include "amount.h"
#include "chain.h"
#include "chainparams.h"
#include "coins.h"
#include "consensus/consensus.h"
#include "consensus/merkle.h"
#include "consensus/validation.h"
#include "hash.h"
#include "validation.h"
#include "net.h"
#include "policy/policy.h"
#include "pow.h"
#include "primiti... | ALGO | 0.982186 | 5.896866 |
1598b13d-e74a-44ea-95db-23dafc5d0843 | Syed-56/DSA | Arrays/Basic/twoPointer.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> pairSum(vector<int> nums, int target) {
int n = nums.size();
int start=0;
int end=n;
vector<int> pair;
sort(nums.begin(), nums.end());
while (start < end) {
int sum = nums[start] + nums[end];
... | ALGO | 0.999843 | 5.070974 |
f1feaed9-5021-497d-a352-64f51d91c07f | AndyLCQ/CoursBTSCPP | TP3/tableau.cpp | #include "tableau.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
/**Saisie tableau**/
void saisietableau(int tab[],int taille)
{
int i;
for(i=0;i<taille;i++)
{
cout<<"Entrez la valeur d'une case : \n";
cin>>tab[i];
}
}
/**Calcule max**/
... | ALGO | 0.996565 | 3.317525 |
9e3c26cc-2c90-46ca-87a7-75fb5531db7b | ganghe74/algo | baekjoon/1821_수들의 합.cpp | #include <bits/stdc++.h>
using namespace std;
int N, F;
int a[11], d[11][11];
bool c[11];
int f() {
int ret = 0;
for (int i=0;i<N;++i) {
ret += d[N][i] * a[i];
}
return ret;
}
bool choice(int idx) {
if (idx == N) {
if (f() == F) return true;
return false;
}
for (in... | ALGO | 0.999938 | 3.110782 |
66831a30-a1a0-4af3-bd33-5037a705d456 | funnydog/AoC2020 | day5/day5.cpp | #include <algorithm>
#include <cassert>
#include <fstream>
#include <vector>
#include <fmt/format.h>
using namespace std;
static int find_id(const string& line)
{
int value = 0;
for (auto letter : line)
{
switch (letter)
{
case 'B':
case 'R':
value = value << 1 | 1;
break;
case 'F':
case 'L':
... | ALGO | 0.999348 | 5.839629 |
01272f56-369f-42f4-b78b-f090a19f7f12 | kunidesuyo/competitive-programming | ABC/201~250/243/D.cpp | #include <bits/stdc++.h>
#include <cmath>
#define all(x) (x).begin(),(x).end()
using ll = long long;
const ll INF = 1LL<<60;
const int inf = INT_MAX / 2;
using namespace std;
int main() {
ll n, x;
cin >> n >> x;
string s;
cin >> s;
stack<char> t;
for(int i = 0; i < n; i++) {
if(s[i]... | ALGO | 0.999874 | 4.439267 |
af741ce0-239b-4065-9159-568983558f09 | Ishrak-Tawsif/Accepted-Codes | Ishrakk_Tawsif-ac/LightOJ/1210/12223219_AC_204ms_6268kB.cpp | #include<bits/stdc++.h>
using namespace std;
int dx[8]={0,0,1,-1,1,1,-1,-1};
int dy[8]={1,-1,0,0,1,-1,1,-1};
/*#pragma comment(linker,"/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#define sf(nn) scanf ("%d", &nn)
#def... | ALGO | 0.999584 | 4.401749 |
03658fa9-c6c7-4b32-a9a3-a100ea0f2f6a | waniyaazhar/OOP-leetcode | 12-integer-to-roman/integer-to-roman.cpp | class Solution {
public:
string intToRoman(int num) {
vector<pair<int ,string>> valToRoman = {
{1000, "M"}, {900, "CM"}, {500, "D"}, {400, "CD"},
{100, "C"}, {90, "XC"}, {50, "L"}, {40, "XL"},
{10, "X"}, {9, "IX"}, {5, "V"}, {4,"IV"}, {1, "I"}
};
string roman = "";
for (c... | ALGO | 0.999827 | 6.652234 |
41ecdd73-763e-4802-ade1-96013ee1eb36 | VictorHugoMA/UFU_repositorio | RP/URI/1164_num_perfeito.cpp | #include<stdio.h>
int main(){
int cont=1, fim, num, i, soma;
scanf("%d", &fim);
while(cont<=fim){
soma=0;
scanf("%d", &num);
for(i=1; i<num; i++){
if(num%i==0){
soma+=i;
}
}
i... | ALGO | 0.999825 | 3.933269 |
92094120-7452-4738-b106-8357b7318931 | kornyellow/aoc-2021 | 17/main.cpp | #include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
int calcHighestPosition(int y_1) {
int current_y = 0;
for(int current_y_spd = (-y_1) - 1; current_y_spd != 0; current_y_spd--) {
current_y += current_y_spd;
}
return current_y;
}
unsigned int findAllPath(int min_x, in... | ALGO | 0.998833 | 5.056324 |
66543110-679f-450c-9c12-c958dd979461 | lovelyoverflow/2023MORAIContest | src/navigation/global_planner/src/quadratic_calculator.cpp | #include <global_planner/quadratic_calculator.h>
namespace global_planner {
float QuadraticCalculator::calculatePotential(float* potential, unsigned char cost, int n, float prev_potential) {
// get neighbors
float u, d, l, r;
l = potential[n - 1];
r = potential[n + 1];
u = potential[n - nx_];
d... | ALGO | 0.999865 | 4.837963 |
76384830-fc97-47a2-861b-19e5d62be4ed | Lord-Kelsier/cppchip8 | cpu.cpp | #include "cpu.h"
#include <iostream>
#include <string>
void CPU::drawSprite() {
/*The graphics system:
The chip 8 has one instruction that draws sprite to
the screen. Drawing is done in XOR mode and if a pixel
is turned off as a result of drawing, the VF register is
set. This is used for collis... | ALGO | 0.930108 | 5.490976 |
71ef0064-8cd2-4689-a1c8-a938c8f153e7 | alexandraback/datacollection | solutions_6377668744314880_0/C++/kojingharang/Cs.cpp | #include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#incl... | ALGO | 0.999909 | 4.690876 |
072f7107-3807-4c27-ba91-44108cd3ec8f | showmic96/Online-Judge-Solution | LightOJ/1125/10909454_AC_64ms_2288kB.cpp | // In the name of Allah the Most Merciful.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[205][25][15];
ll n , q , d , m;
vector<ll>v;
ll f(ll i , ll mod , ll c)
{
if(mod<0)mod+=d;
if(c==m){
if(mod==0)return 1;
return 0;
}
if(i>=n)return 0;
if(dp[i][m... | ALGO | 0.999848 | 3.500243 |
f866c4ac-5516-4c9c-a4a2-052120adb93f | Hz188/experiments | algorithms/online-judge/Aizu/ALDS1_2_A.cpp | #include <iostream>
using namespace std;
// 使用flag的冒泡排序法
int bubbleSort(int A[], int N) //包含N个元素的0起点的数组A
{
int sw = 0; // swap count
bool flag = 1; // 存在顺序相反的两个元素,若某次循环没有这个标记了,就说明没有这次循环进行交换了,说明交换结束了
for (int i = 0; flag; i++) // i 未排序部分的起始位置下标
{
flag = 0;
for... | ALGO | 0.999921 | 4.008538 |
c8ceadb5-6664-4a79-a40e-856881decb87 | PatriciaHaloiu/VF | tools/boost_1_80_0/libs/contract/example/n1962/vector.cpp | //[n1962_vector
#include <boost/contract.hpp>
#include <boost/bind.hpp>
#include <boost/optional.hpp>
#include <boost/algorithm/cxx11/all_of.hpp>
#include <boost/type_traits/has_equal_to.hpp>
#include <boost/next_prior.hpp>
#include <vector>
#include <functional>
#include <iterator>
#include <memory>
#include <cassert>... | TOOL | 0.974975 | 6.730009 |
ca657304-489f-4735-bd74-af32401c00b9 | Bostrix/FSL-mcflirt | newimage/miscmaths/armawrap/tests/newmat/tmtg.cpp |
//#define WANT_STREAM
#define WANT_MATH // for sqrt
#include "include.h"
#include "newmatap.h"
#include "tmt.h"
#ifdef use_namespace
using namespace NEWMAT;
#endif
void trymatg()
{
// cout << "\nSixteenth test of Matrix package\n";
// cout << "\n";
Tracer et("Sixteenth test of Matrix pac... | TEST | 0.975786 | 5.045958 |
bd5e4c34-fcad-4dfd-9001-401cde7a6922 | liaohuangg/RfCgraTrans | llvm/clang-tools-extra/clangd/unittests/SyncAPI.cpp | #include "SyncAPI.h"
#include "index/Index.h"
namespace clang {
namespace clangd {
void runAddDocument(ClangdServer &Server, PathRef File,
llvm::StringRef Contents, llvm::StringRef Version,
WantDiagnostics WantDiags, bool ForceRebuild) {
Server.addDocument(File, Contents, Ver... | TOOL | 0.944078 | 7.786447 |
2dd13ec1-4a55-40e5-a311-8f67077818fb | gabrielsilva18/Estrutura_dados1 | PIlha_Fila_atividades/ex05.cpp | /*#include <iostream>
using namespace std;
struct Node {
double data;
Node* next;
};
struct Pilha {
Node* top;
int size;
};
Pilha criaPilha(int capacidade) {
Pilha novaPilha;
novaPilha.top = nullptr;
novaPilha.size = 0;
return novaPilha;
}
void empilha(double valor, Pilha* p) {
N... | ALGO | 0.999918 | 4.742591 |
07eaee00-7e5c-459d-9fcd-163dd02e94b0 | aniruddhakj/leetcode | C++/SearchInABinarySearchTree/searchInABinarySearchTree.cpp | // Author : Aniruddha Krishna Jha
// Date : 14/04/2022
/*******************************************************************************
You are given the root of a binary search tree (BST) and an integer val.
Find the node in the BST that the node's value equals val and return the subtree rooted with that node.
If s... | ALGO | 0.999998 | 6.552671 |
2aee61f0-2067-4a6c-8ee9-cd2c40467d6b | raincross7/code-similarity | codes/train_code/problem500/problem500_419.cpp | #include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(... | ALGO | 0.999662 | 3.553349 |
2bfafeb3-b850-42bd-8cfe-cda05f122b93 | Kgotta-contribute/Leetcode | Daily Temperatures/s.cpp | #include <vector>
#include <stack>
using namespace std;
class Solution {
public:
vector<int> dailyTemperatures(vector<int>& temperatures) {
int n = temperatures.size();
vector<int> result(n, 0); // Initialize the result array with 0s
stack<int> st; // Use a stack to store the indices of temp... | ALGO | 0.999993 | 6.864658 |
231ced4d-1364-4868-b4cb-870aa8d89c1f | shayolk/GeeksforGeeks-Solutions | Coin Change.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
scanf("%d", &t);
while(t--) {
int m;
scanf("%d", &m);
vector<int> a(m);
for(int& i: a) {
scanf("%d", &i);
}
int n;
scanf("%d", &n);
vector<long long> dp(n+1);
... | ALGO | 0.999857 | 3.581894 |
41bfcf57-1bb4-40ea-a4aa-71638fb4a4b8 | sinian666/codes_102_3 | cpp_副本10/chapter_backtracking/preorder_traversal_i_compact.cpp | /**
* File: preorder_traversal_i_compact.cpp
* Created Time: 2023-04-16
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
vector<TreeNode *> res;
/* 前序遍历:例题一 */
static void preOrder(TreeNode *root) {
if (root == nullptr) {
return;
}
if (root->val == 7) {
// 记录解
res... | ALGO | 0.999928 | 5.602506 |
024365cd-4b81-4052-ad47-dcc69d0ba691 | nikhilsharma270027/Striver-A2Z-DSA-Sheet | 3. Arrays/Easy/4) Remove duplicates from Sorted array.cpp | // Brute Force Approach
#include<bits/stdc++.h>
using namespace std;
int removeDuplicates(int arr[], int n) {
set < int > set;
for (int i = 0; i < n; i++) {
set.insert(arr[i]);
}
int k = set.size();
int j = 0;
for (int x: set) {
arr[j++] = x;
}
return k;
}
int main() {
int arr[] = {1,1,2,2,2,3... | ALGO | 0.999877 | 5.733614 |
e58b8b1c-2026-42df-938d-04beff900614 | AruzhanBazarbai/pp1 | dopy/dz_3/variant_5/A_2.cpp | #include <iostream>
#include <cmath>
#include <set>
using namespace std;
int main(){
int n, su;
cin >> n;
int a[n][4];
for(int i=0; i<n; i++){
for(int j=0; j<4; j++){
cin >> a[i][j];
}
}
set <int> s;
for(int i=0; i<n; i++){
for(int j=0; j<4; j++){
... | ALGO | 0.997234 | 3.449614 |
a4662f0d-e09b-4557-9131-ab612b6e04de | sarvex/leetcode-fortran | solution/2400-2499/2491.Divide Players Into Teams of Equal Skill/Solution.cpp | class Solution {
public:
long long dividePlayers(vector<int>& skill) {
sort(skill.begin(), skill.end());
int n = skill.size();
int t = skill[0] + skill[n - 1];
long long ans = 0;
for (int i = 0, j = n - 1; i < j; ++i, --j) {
if (skill[i] + skill[j] != t) return -1... | ALGO | 0.999962 | 5.40264 |
684d6743-fa99-4317-bea8-086eaaec2dc6 | katushapvlva/HW_2022 | homework2/hw2.cpp | // Подключаем библиотеки
#include <iostream>
#include <fstream>
#include <utility>
#include <vector>
#include <cmath>
int main(int argc, char** argv) {
if (argc == 2) {
// Чтение файла
std::ifstream infile(argv[1]);
std::vector < std::pair < double, double >> partition;
d... | ALGO | 0.999829 | 4.182071 |
71e40b5a-3d37-4f3f-9e15-c84b811769e4 | JohnWestlund/ohpc | tests/apps/hpcg/src/ComputeDotProduct.cpp |
//@HEADER
// ***************************************************
//
// HPCG: High Performance Conjugate Gradient Benchmark
//
// Contact:
// Michael A. Heroux ( <EMAIL>)
// Jack Dongarra (<EMAIL>)
// Piotr Luszczek (<EMAIL>)
//
// ***************************************************
//@HEADER
/*!
@file Compute... | ALGO | 0.996708 | 6.880975 |
22a921a1-c55d-41e5-960f-741c74074fd6 | sohardforaname/ACM_ICPC_practice | codeforces/1270/1270A.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int num[4], q[4];
vector<int>ans;
void solve()
{
int n, k1, k2;
scanf("%d%d%d", &n, &k1, &k2);
int maxn1 = 0, maxn2 = 0;
for (int i = 1; i <= k1; ++i)
{
scanf("%d", &n);
maxn1 = max(maxn1, n);
}
for (int i = 1; i <= k2; ++i)
{
scanf("%d"... | ALGO | 0.999909 | 3.626213 |
2bf717e9-6231-4d90-8f44-630c6c923632 | Xikai-Liu/Leetcode-Algorithm | P20.cpp | class Solution {
public:
bool isValid(string s) {
stack<char> zf;
for (int i=0;i<s.size();i++){
if (s[i]=='(' || s[i]=='[' || s[i]=='{') zf.push(s[i]);
if (s[i]==')'){
if (zf.empty()) return false;
if (zf.top()!='(') return false;
... | ALGO | 0.998944 | 6.080444 |
2f4ba56b-5bc3-434a-9f35-af881883d3a5 | Ozan7146/C-Works | Untitled2.cpp | #include<iostream>
using namespace std;
template <class temp>
temp add(temp a,temp b)
{
return a+b;
}
int main(){
double y=8.7,x=9,z;
z=add(x,y);
cout << z <<endl;
return 0;
}
| ALGO | 0.993612 | 3.886598 |
4b55b805-6566-431a-83c0-6a3f35e6ca1f | jl3937/leetcode | SymmetricTree.cpp | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool isSymmetric(TreeNode* root) {
// Start typing your C/C++ solution below
// DO NOT write int... | ALGO | 0.999909 | 6.449495 |
12d1ddaa-ed9f-4c2f-9488-47169185febf | hanzala-sohrab/CP | CSES/Graph-Algorithms/02_Labyrinth.cpp | #include<bits/stdc++.h>
using namespace std;
int n, m, rA, cA, rB, cB;
char labyrinth[1001][1001];
bool visited[1001][1001];
char paths[1001][1001];
vector<char> shortestPath;
bool is_valid(int r, int c) {
if (r < 0 or r >= n or c < 0 or c >= m or visited[r][c] or labyrinth[r][c] == '#')
return false;
return true... | ALGO | 0.999986 | 4.343733 |
9c7de981-5ed9-46c5-b6ba-5bb79bfeb0df | ShivanshS635/C-Programs | prime_or_not.cpp | //Prime Or Not..
#include<stdio.h>
#include<math.h>
int main()
{
int n,ctr=0,i;
printf("ENTER NUMBER:");
scanf("%d",&n);
for(i=2;i<=sqrt(n);i++)
{
if(n%i==0)
{
ctr=1;
break;
}
else
{
ctr=0;
}
}
if(ctr==0)
{
printf("%d IS A PRIME NUMBER.",n);
}
else
{
printf("%d IS NOT A PRIME NUMBER.... | ALGO | 0.999631 | 3.238859 |
abf04859-537f-49fc-807a-ca48de65becf | amsraman/Competitive_Programming | Facebook Hacker Cup/2021/Qualification Round/A2.cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int t, n, k, cost[26][26];
string s;
int main() {
freopen("consistency_chapter_2_input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
cin >> t;
for(int _ = 1; _ <= t; _++) {
cin >> s >> k;
n = s.length(... | ALGO | 0.999531 | 3.858311 |
4ba3d7a2-63ed-4113-a7dd-c3641110e898 | ahmedibrahim404/CompetitiveProgramming | Different Algorithms/LCA 2/main.cpp | #include<bits/stdc++.h>
using namespace std;
/**
some nice solution for LCA
for lca(p, q)
if(level[p]>level[q]) swap up for p
else if(level[p]<level[q]) swap up for q
else swap up for both till p=q
but this code complexity is O(height)
good idea is to j... | ALGO | 0.999997 | 4.345637 |
5981648f-332b-4dce-8702-3def5747f385 | alexandraback/datacollection | solutions_5769900270288896_0/C++/nakari1124/B-small-1.cpp | #include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
typedef long long i64;
typedef i64 nkr_int;
typedef pair<i64, i64> pi;
typedef vector<nkr_int> vi;
typedef vector<vi> vvi;
#define pb push_back
#define ite... | ALGO | 0.999857 | 3.605559 |
8db7cdf8-5074-4a09-8c6b-52abe007d674 | IntelLabs/iHRC | compiler/src/llvm-3.3/tools/clang/test/SemaTemplate/ackermann.cpp | // RUN: %clang_cc1 -fsyntax-only -verify %s
// expected-no-diagnostics
// template<unsigned M, unsigned N>
// struct Ackermann {
// enum {
// value = M ? (N ? Ackermann<M-1, Ackermann<M, N-1> >::value
// : Ackermann<M-1, 1>::value)
// : N + 1
// };
// };
template<unsigned M, u... | ALGO | 0.903324 | 5.812396 |
0f08ca15-16fd-4c4e-9a47-950c96aa7b37 | luyuan2002/leetcodes | leetcodes/src/cn/xiaoyes/leetcode-main/solution/0100-0199/0118.Pascal's Triangle/Solution.cpp | class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> ans;
for (int i = 0; i < numRows; ++i)
{
vector<int> t(i + 1, 1);
for (int j = 1; j < i; ++j) t[j] = ans[i - 1][j] + ans[i - 1][j - 1];
ans.push_back(t);
}
... | ALGO | 0.999965 | 5.722437 |
1e949df9-87b7-4dd5-8827-d50c61da0b35 | fayek2025/graph-algo | topological_sort/crossing.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX 1e9
int main() {
int T;
cin >> T;
while (T--) {
int A, B, n;
cin >> n;
vector<int> X(n), Y(n), R(n);
vector<int> mark_1(n, 0), mark_2(n, 0), vis(n, 0), dist(n, MAX);
vector<vector<int>> g(n);
for (... | ALGO | 0.999851 | 4.424152 |
bfc08b32-7725-4509-8115-d46361c9aca3 | protik0939/codeforces_problemset | 900 Ratings/B_AB_Flipping.cpp | /*
________________________________________________________________
.......
....... ...
.. .......... .
. . .
. .. ,*.////.
. .... ..****
,*,** //,,.***
*,,,,..,,.,*
,....... | ALGO | 0.997782 | 4.64061 |
fca4126e-d834-4b6e-b664-b46dddf6b362 | anzup/gameutils | ios/folly/stats/detail/DoubleRadixSort.cpp | #include <folly/stats/detail/DoubleRadixSort.h>
#include <algorithm>
#include <cstring>
namespace folly {
namespace detail {
// Convert floats to something comparable via radix sort.
// See http://stereopsis.com/radix.html for details.
static uint8_t getRadixBucket(double* f, uint8_t shift) {
uint64_t val;
memcp... | ALGO | 0.99832 | 7.089055 |
6c3f9651-2315-47e7-91a1-2170232911eb | PrithwishJana/CoTran | CodeGen/data/transcoder_evaluation_gfg/cpp/CHANGE_BITS_CAN_MADE_ONE_FLIP.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
bool f_gold ( string str ) {
int zeros = 0, ones = 0;
for ( char ch : str ) ( ch == '0' ) ? ++ zeros : ++ ones;
return ( zeros == 1 || ones == 1 );
}
//TO... | ALGO | 0.989675 | 5.464274 |
a62a8f7b-7167-417c-a534-2d864d73aa07 | Mycticount-X/Data-Structure-and-Algorithm-MC-S25 | Project/TheOknum1.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXOK 100
struct Oknum {
char name[101];
int palak;
int jarak;
};
Oknum Heap[MAXOK];
int size = 0;
void swap (Oknum* a, Oknum* b) {
Oknum t = *a;
*a = *b;
*b = t;
}
void MinHeapify (int i) {
int min = i;
int left = i*2+1;
int right = i*2+2... | ALGO | 0.99891 | 3.677267 |
b82bc240-0e03-4b5c-b71a-7ffc88461526 | Amir227/tasks | prefix_func.cpp | #include <cstdio>
#include <vector>
#include <string>
#include <iostream>
using namespace std;
vector<int> prefix_function (string s) { // O(n^3);
int n = (int) s.length();
vector<int> pi (n);
for (int i=0; i<n; ++i)
for (int k=0; k<=i; ++k)
if (s.substr(0,k) == s.substr(i-k+1,k))
pi[i] = k;
return... | ALGO | 0.999755 | 3.875456 |
d58bdfa7-3e5f-49ca-a62d-908c8d93dafe | kritikkandwal/2nd_year | all_deletion_grounded_header.cpp | // deletion & insertion grounded header
#include<iostream>
using namespace std;
struct node{
int data;
node* next;
node(int val){
data=val;
next=NULL;
}
};
node*insertAthead(node*header,int val){
node*n=new node(val);
n->next=header->next;
header->next=n;
header->data++;
... | ALGO | 0.998671 | 3.571452 |
3d40c79d-9d7e-49be-8ce1-38adf8ab15a9 | Arish82/Daily_Leetcode_Questions | Detect cycle in an undirected graph - GFG/detect-cycle-in-an-undirected-graph.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to detect cycle in an undirected graph.
bool dfs(int vertex,int parent,vector<int> &vis,vector<int> adj[]){
vis[vertex]=1;
bool ans=false;
for(int child: adj... | ALGO | 0.999968 | 6.26351 |
44e9f6af-9dcb-4617-94f6-289922d65517 | SeungWoo-You/POSTECH | Basic Programming/2022 Fall/assignment 1/assn1.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define MAXPLAY 10
#define CHIP 50
#define QUESTMARK 63
#define MAX_CARD_NUM 10
#define MIN_CARD_NUM 1
#define NOPAIR 1
#define DOUBLE 2
#define STRAIGHT 3
#define TRIPLE 4
#define CALL 0
#define FOLD -1
#define USER 456
#define COM 123
void print_game_status(i... | ALGO | 0.997385 | 3.613656 |
d3f50583-5d19-4445-90b4-b9ed80ea210b | pkuxxy/LeetCode | leetcode_forthtime/堆排序.cpp | #include<iostream>
#include<vector>
#include<string>
#include<string.h>
//#include<queue>
using namespace std;
void fixup(int a[], int i) //
{
if(!a || i <= 0)
return;
int tmp = a[i];
int j = (i-1)/2;
while(j >= 0 && i != 0) //i != 0Ϊ-1/2 = 0;
{
if(a[j] > tmp)
break;
a[i] = a[j];
i = j;
j = (i-1)/2;
... | ALGO | 0.999904 | 3.607546 |
311edd86-3099-4986-9231-74acb490d218 | Adarshsingh2k/30-Days-Of-Code | String/Longestcommnprefix approach 2.cpp | /*
Longest Common Prefix in an Array
Easy Accuracy: 49.03% Submissions: 7165 Points: 2
Given a array of N strings, find the longest common prefix among all strings present in the array.
Example 1:
Input:
N = 4
arr[] = {geeksforgeeks, geeks, geek,
geezer}
Output: gee
Explanation: "gee" is the longest com... | ALGO | 0.999587 | 5.719055 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.