uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3202ea6d-448f-4570-915c-5f41a11eeab1 | KrSaksh/My-Leetcode-Solutions | 0075-sort-colors/0075-sort-colors.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
int l = 0, m = 0, h = nums.size() - 1;
while(m <= h)
{
if(nums[m] == 0)
{
swap(nums[l], nums[m]);
l++;
m++;
}
else if(nums[m] == 1)
... | ALGO | 0.999918 | 6.057169 |
778ac2ac-5242-4bd3-8e50-90d15cdc832c | Himanshu4776/leetcode-submissions | 57-insert-interval/2023-01-16 22.00.04 - Accepted - runtime 17ms - memory 17.2MB.cpp | class Solution {
public:
vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval) {
int new_r = newInterval[1];
int new_l = newInterval[0];
auto it = upper_bound(intervals.begin(), intervals.end(), newInterval, [&] (const vector<int>& v1, const vector<int>& v2) {
... | ALGO | 0.99999 | 6.260245 |
df25b9cf-012c-4eac-a53b-8ab4bca0ff70 | weihaoysgs/vins-fast | vins/thirdparty/eigen/doc/examples/tut_arithmetic_matrix_mul.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d mat;
mat << 1, 2,
3, 4;
Vector2d u(-1,1), v(2,0);
std::cout << "Here is mat*mat:\n" << mat*mat << std::endl;
std::cout << "Here is mat*u:\n" << mat*u << std::endl;
std::cout << "Here is u^T*mat:\n" << u.transpo... | ALGO | 0.999266 | 3.818773 |
2e01031b-4996-43c3-b1c8-269db00a2135 | Suryash-Jha/Codeforces | Big_Segment.cpp | //Question link: https://codeforces.com/problemset/problem/242/B
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(i, n) for(int i=0;i<n;i++)
#define deba(i, a, n) fo(i, n){cout << a[i] << " ";}
#define pb push_back
#define mod 1e9 +7
#define w(x) int x; cin>>x; while(x--)
#define endl "\n"... | ALGO | 0.999948 | 4.269496 |
e11a6a4d-1b44-4960-80d7-f16c3e353b9b | lakshay2000/450DSA | 26_1.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
string isSubset(int a1[], int a2[], int n, int m);
int main()
{
int t;
cin >> t;
while (t--)
{
int n, m;
cin >> n >> m;
int a1[n], a2[m];
for (int i = 0; i < n; i++)
{
cin >> a1[... | ALGO | 0.999981 | 5.956096 |
d6aa23b8-6ad2-48d6-bffc-140d25661221 | Pulakesh5/_DSA_ | NOVEMBER 24/24 November/Kadane's Algorithm gfg.cpp | class Solution {
public:
// Function to find the sum of contiguous subarray with maximum sum.
int maxSubarraySum(vector<int> &arr) {
// code here...
int maxSum = INT_MIN, sum = 0;
for(int num:arr)
{
sum += num;
maxSum = max(maxSum, sum);
if(s... | ALGO | 0.999678 | 5.904973 |
d6a46360-a746-4e5e-8903-e8583081cede | FZhg/CS106X | assign-5-pqueue/assign-5-pqueue/lib/StanfordCPPLib/io/filelib.cpp | /*
* File: filelib.cpp
* -----------------
* This file implements the filelib.h interface. All platform dependencies
* are managed through the platform interface.
*
* @version 2016/11/20
* - small bug fix in readEntireStream method (failed for non-text files)
* @version 2016/11/12
* - added fileSize, readEnt... | TOOL | 0.898867 | 6.468188 |
de144928-25bf-4b7f-9852-6ca78c13ba3b | ahadulalam1005118/problemSolving | lightoj/1025.cpp | //
// Created by ahad on 5/31/18.
//
#include<iostream>
#include<algorithm>
#include <vector>
#include <cstring>
using namespace std;
unsigned long long int memo[1600][1600];
unsigned long long int count_pallindrome(string str, int start, int end) {
if(start > end) return 0;
if(start == end) return 1;
if(m... | ALGO | 0.999792 | 5.209888 |
79b230c6-bb6c-4e5d-af3a-b560e541abd0 | it-dieuanh/CompetitiveProgramming_bydieuanh | dsu_xayduongnoi.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int n, k, a[103][103], par[103], sz[103], res = 0, cnt = 0;
vector<pair<int, pair<int, int>>> adj;
vector<pair<int, int>> chon;
int findpar(int k) {
if (k == par[k]) return k;
return par[k] = findpar(par[k]);
}
void join(int a, int b) {
a = fin... | ALGO | 0.99991 | 3.962752 |
a7ad651a-7e01-4fcb-ae6b-2886639078cb | jurohd/Data-structure | hm/hw4/operations.cpp | #include <iostream>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <algorithm>
// I hate typing out "unsigned"
typedef unsigned int uint;
// FUNCTION PROTOTYPES
int arithmetic_operations();
int array_operations();
bool close_enoug... | TOOL | 0.970435 | 3.255398 |
f82b1e3c-bd57-4cd8-9cb9-6a3eeebc1be7 | Shuv25/DSA | 4Seraching/18OccurenceCount.cpp | #include <iostream>
using namespace std;
int firstoccur(int arr[], int start, int end, int find)
{
if (start > end)
{
return -1;
}
int mid = (start + end) / 2;
if (arr[mid] > find)
{
return firstoccur(arr, start, mid - 1, find);
}
else if (arr[mid] < find)
{
... | ALGO | 0.999751 | 5.249428 |
c2d940c0-db29-4f8f-b7f4-6debd5fe27e2 | einsteinpan/nttu_second | pa.cpp | #include <iostream>
using namespace std;
long long total_swaps;
const int MAX_N = 1000;
void merge(int heights[], char classes[], int left, int mid, int right) {
int n1 = mid - left + 1;
int n2 = right - mid;
int left_heights[MAX_N];
char left_classes[MAX_N];
int right_heights[MAX_N];
char rig... | ALGO | 0.999879 | 4.78273 |
1c6b71f5-b7ae-4395-b23e-a28d40090061 | rbharadwaj9/sudoku | Solve.cpp | /* Solve.cpp */
/* File implements functions that solve the sudoku puzzle. */
/* 15 June, 2020 */
/* Rajiv Bharadwaj */
#include "Solve.h"
Solve::Solve(Board &board_in) : board(board_in)
{}
void Solve::solve(const Coordinate curr_coordinate, uint8_t possible_number)
{
/* #ifdef DEBUG */
/* if (curr_coo... | ALGO | 0.999786 | 6.42708 |
8d2a20fc-ee7e-4ac7-bf8e-f62f75a87122 | Rain-716/CS-Programming | RPG.cpp | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
double i,ai,j,aj,n;
cin>>i>>ai>>j>>aj>>n;
double ans=ai*pow(aj/ai,(n-i)/(j-i));
cout<<fixed<<setprecision(6)<<ans<<endl;
return 0;
} | ALGO | 0.999758 | 3.11404 |
31615b46-df1d-4e73-9479-27b62fc248f9 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/minimum-cost-to-buy-apples-Solution.minCost/177780_DoS_Exec_Code_Overflow.cpp | GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
GfxColorSpace *colorSpaceA) {
GfxIndexedColorSpace *indexedCS;
GfxSeparationColorSpace *sepCS;
int maxPixel, indexHigh;
Guchar *lookup2;
Function *sepFunc;
Object obj;
double x[gfxColorMaxComps];
double y[gfxColorMaxComps];
int i, j,... | ALGO | 0.939256 | 5.59729 |
2d6a6e4b-12a6-43bf-af9a-e379d9d0a72d | hoanghunglam/Study | PracticeCode_PTTKGT/XluythuaNChiaDeTri.cpp | //Do phuc tap O(log(n))
#include<iostream>
using namespace std;
int power(int a,int n)
{
if(n==0) return 1;
else if(n%2==0) return power(a*a,n/2);
else return a*power(a*a,n/2);
}
int main()
{
cout<<power(4,3);
}
| ALGO | 0.999771 | 4.550051 |
a99af334-5f62-4756-9e40-33b507faf352 | NN0X/PasswordGenerator | src/index.cpp | #include <iostream>
#include <vector>
void makeIndexesUnique(std::vector<int>& indexes, bool verbose=false)
{
if (verbose)
{
std::cout << "Making indexes unique\n";
}
for (size_t i = 0; i < indexes.size(); i++)
{
for (size_t j = i + 1; j < indexes.size(); j++)
{
if (indexes[i] == indexes[j])
{
ind... | TOOL | 0.893052 | 5.62651 |
d65108dc-9b67-4a91-a85e-68dc56ef22fe | nontanan-linux/robinz_ws | src/nav2_smac_planner/src/smoother.cpp | #include <ompl/base/ScopedState.h>
#include <ompl/base/spaces/DubinsStateSpace.h>
#include <vector>
#include <memory>
#include "nav2_smac_planner/smoother.hpp"
namespace nav2_smac_planner
{
using namespace nav2_util::geometry_utils; // NOLINT
using namespace std::chrono; // NOLINT
Smoother::Smoother(const SmootherP... | ALGO | 0.999783 | 5.880992 |
2e6576ab-78e5-4f84-83e2-636cacb5ad01 | nodays0502/Algorithm_Study | programmers/완주하지 못한 선수.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
string solution(vector<string> participant, vector<string> completion) {
sort(participant.begin(),participant.end());
sort(completion.begin(),completion.end());
int i;
for(i =0;i<completion.size();i++)
{
if( part... | ALGO | 0.999058 | 5.144365 |
dc52314c-1786-41e4-8ba8-99bf78980923 | Bidhit74/DSA-With-C- | DAY 6/Lacture - 7 Introduction_to_Vectors/vectorInput.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> vec; // Declare a single vector
for(int i = 0; i < 5; i++){
int value; // Temporary variable to hold input
cin >> value;
vec.push_back(value); // Add the value to the vector
}
for(int i = 0; i ... | ALGO | 0.989728 | 3.494302 |
615cd7e7-a531-4f78-8644-e3c3d8bc44f3 | ifangfeng/mracs | src/covar.cpp | // covariance of different halo bin
#include"mracs.h"
void halo_envi_match(std::string ifn, std::vector<Particle>& hl, std::vector<Particle>& vd
, std::vector<Particle>& st, std::vector<Particle>& fl, std::vector<Particle>& kt);
int main(){
read_parameter();
auto dms = read_in_DM_3vector("/data0/MDPL2/d... | ALGO | 0.988336 | 3.693963 |
c3a9ed67-5f5f-4135-bc23-ec96e506b706 | zjukk/LeetCode-is-my-son | 113-PathSumII.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
vector<vector<int> > pathSum(TreeNode *root, int sum) {
vector<vector<int>> res;
vector<int> out;
helper(root, sum, out, res);
return res;
}
void helper(... | ALGO | 0.999984 | 5.339787 |
66242a77-caac-42d5-aef3-e1b3d4c14e60 | StyNW7/Code_Challenge_Resources | LeetCode/Medium/523. Continuous Subarray Sum.cpp | // Link: https://leetcode.com/problems/continuous-subarray-sum/description/
class Solution {
public:
bool checkSubarraySum(vector<int>& nums, int k) {
int n = nums.size();
unordered_map<int, int> remainderMap;
int cumulativeSum = 0;
// Step 1: Initialize Remainder Map
... | ALGO | 0.999946 | 6.742533 |
06ceee7c-6a95-447c-841d-2cd88c5b8ecb | yoshikiri/kyo-pro | aoj/ALDS1/7c.cpp | #include <iostream>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
struct Node {
int id, parent, left, right;
};
Node t[25];
void preorder(Node node) {
std::cout << ' ' << node.id;
if (node.left != -1) preorder(t[node.left]);
if (node.right != -1) preorder(t[node.right]);
}
void inorder(Node node) {
... | ALGO | 0.999981 | 4.664216 |
ed5239c2-58cd-4e19-8b53-e4c2d56aebcf | ishandutta2007/codeforces | nachia/normal/1400/C.cpp | #include<bits/stdc++.h>
using namespace std;
using UL = unsigned int;
using ULL = unsigned long long;
using LL = long long;
#define rep(i,n) for(int i=0; i<(n); i++)
void loop(){
string S; cin>>S;
int x; cin>>x;
int N=S.size();
string W; W.resize(N,'1');
rep(i,N){
if(S[i]=='0'){
if(i-x>=0) W[i-x]='0';
if(... | ALGO | 0.999741 | 3.83922 |
a5bb4f2b-9f8b-46a5-8349-6e7b86b784e9 | moses-smt/mgiza | experimental/alignment-enabled/MGIZA/src/transpair_model3.cpp | /*--
transpair_model3: representation of a translation pair for model3 training
allowing for fast access (esp. to t table).
Franz Josef Och (30/07/99)
--*/
#include "transpair_model3.h"
#include <algorithm>
transpair_model3::transpair_model3(const Vector<WordIndex>&es, const Vector<WordIndex>&fs, tmodel<COUNT, PROB>&... | ALGO | 0.999447 | 5.396562 |
fe38a22c-b068-4d70-800e-ad2d9d140bb2 | alexander050211/problem-solving | atcoder/abc-373/e.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
#define F first
#define S second
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
ll n, m, k;
vector<pll> arr;
ll ans[200005];
bool g(ll x)
{
}
ll f(ll x)
{
ll st = 0, en = k;
while (st < en)
{
if (en - st == 1)
... | ALGO | 0.999995 | 4.139499 |
7ab8f75c-8832-42da-bdc7-cad617974d0c | larry-chunhui/dataStructure | leetcode/reverse.cpp | #define INT_MAX 10000000
#define INT_MIN -10000000
class Solution {
public:
int reverse(int x) {
int rev = 0;
while (x != 0) {
int pop = x % 10;
// x /= 10;
x=x/10;
// if (rev > INT_MAX/10 || (rev == INT_MAX / 10 && pop > 7)) return 0;
// if (rev < IN... | ALGO | 0.99991 | 5.265346 |
ec70df1c-6605-4f76-b386-b94851382cb4 | SSKsaan/Problem-Solving | Codeforces/AppleTree.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define SSK ios_base::sync_with_stdio(0); cin.tie(0);
const int N = 2 * (1e5+5);
vector<int> g[N];
vector<int> leaf;
void Dfs(int node, int parent)
{
if(node!=1 && g[node].size()==1) leaf[node] = 1;
for(int child : g[node])
... | ALGO | 0.999818 | 4.255778 |
78c1572a-fa27-4da8-81bb-982d0a7dd732 | joehyeonmin/KW_Project | Advanced_Programming/HW4/TuringMachine.cpp | #include "TuringMachine.h"
#include <iostream>
using namespace Turing;
Transition::Transition(const std::string& curr_s, char read_s, char write_s, Move m, const std::string& next_s)
: curr_state{ curr_s }, read_symbol{ read_s }, write_symbol{ write_s }, move{ m }, next_state{ next_s }
{
}
Table::Table()
{
}
Tabl... | ALGO | 0.995411 | 3.941916 |
db2cb2c1-beab-42a9-b9b5-2d40f9775a35 | ADITYAGABA1322/Daily-LeetCode-Challenge-Solution | 1818-maximum-score-from-removing-substrings/1818-maximum-score-from-removing-substrings.cpp | class Solution {
public:
int maximumGain(string s, int x, int y) {
// Ensure "ab" always has more points than "ba"
if (x < y) {
// Swap points
int temp = x;
x = y;
y = temp;
// Reverse the string to maintain logic
reverse(s.begi... | ALGO | 0.999915 | 6.321484 |
b20fba33-12c7-4cda-973e-ec3f2a5e146a | MatijaEskicWork/Algorithmic-Problems | CodeforcesContests/CF_div2_632/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define BIGINF (int) 4e18 + 7
#define MOD7 1000000007
#define MOD9 1e9 + 9
#define INF (int)2e9 + 7
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) sca... | ALGO | 0.99954 | 3.467117 |
b59df953-886c-49ea-a23d-ace727a1d6cb | cauetrd/competitive-programing | strings/hash(tiagodfs).cpp | // String Hash template
// constructor(s) - O(|s|)
// query(l, r) - returns the hash of the range [l,r] from left to right - O(1)
// query_inv(l, r) from right to left - O(1)
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MOD 1000000009
struct Hash {
const ll P = 31;
int n; strin... | ALGO | 0.999998 | 5.109957 |
31ce3e09-d84f-4329-b2cc-57278dd5d44d | ishandutta2007/codeforces | benq/normal/1704/H1.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = long double; // or double, if TL is tight
using str = string; // yay python!
// pairs
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;
#define mp make_pair
#define f first
#define s second
#define tcT template<c... | ALGO | 0.999792 | 3.420989 |
3967e9c0-4cc3-436a-8b40-75e2dd895eb8 | SLAPaper/LeetCode | 2 Add_two_numbers/Solution.cpp | #include <iostream>
#include <list>
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
class Solution
{
pu... | ALGO | 0.999848 | 6.380224 |
c57c1ed9-e0b8-4eaf-8766-d9e67f700f6b | guodashun/leetcode_answer | answer_cpp/question_123.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int n = prices.size();
int dp_i10 = 0, dp_i20 = 0;
int dp_i11 = INT_MIN, dp_i21 = INT_MIN;
for (int i = 0; i < n; i++) {
dp_i10 = max(dp_i10, dp_i11 + prices[i]);
dp_i11 = max(dp_i11, dp_i20 - price... | ALGO | 0.999719 | 5.309766 |
69cc8995-36db-4ec9-986d-3eec71262f30 | soli1411/hackerrank-solution | Algorithms/Warmup/Simple Array Sum.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {int n,i;
cin>>n;
int a[n];
for (i=0;i<n;i++)
cin>>a[i];
n=0;
while (i--)
n+=a[i];
cout<<... | ALGO | 0.99986 | 3.269549 |
354c676c-1bfd-4416-9492-42b46fed9008 | kaist-ina/BWA-MEME-pipeline | test/fmi_test.cpp | #include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <omp.h>
#include <string.h>
#include "bwa.h"
#include "FMI_search.h"
#ifdef VTUNE_ANALYSIS
#include <ittnotify.h>
#endif
#define QUERY_DB_SIZE 1280000000
int myrank, num_ranks;
int main(int argc, char **argv) {
#ifdef VTUNE_ANALYSIS
__itt_pause();... | ALGO | 0.986752 | 4.743565 |
0d19f1b6-672a-4f98-a656-f13ede4821b5 | dilenpt/ExprLang-Evaluator-CPP | CMSC 330/subexpression.cpp | // Student Name: Dilen Patel
// Date: March 1, 2025
// Project: CMSC 330 Project 2
// Description: Modified to support all operators
#include <iostream>
#include <sstream>
using namespace std;
#include "expression.h"
#include "subexpression.h"
#include "operand.h"
#include "plus.h"
#include "minus.h"
#include "multip... | TOOL | 0.939219 | 6.21754 |
bd61c36e-a842-4545-9d95-b6389f75d45a | ashgen/Greeks | extern/kdb-templates/thirdparty/vcpkg/toolsrc/src/vcpkg/base/strings.cpp | #include <vcpkg/base/checks.h>
#include <vcpkg/base/strings.h>
#include <vcpkg/base/util.h>
namespace vcpkg::Strings::details
{
// To disambiguate between two overloads
static bool is_space(const char c) { return std::isspace(static_cast<unsigned char>(c)) != 0; }
// Avoids C4244 warnings because of char<... | TOOL | 0.974542 | 4.226537 |
6bd9938c-5a17-43a9-b2be-0d817048d750 | cxhscst2/Project-Euler | 249/249.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i(a); i <= (b); ++i)
#define dec(i, a, b) for (int i(a); i >= (b); --i)
#define MP make_pair
#define fi first
#define se second
typedef long long LL;
int n = 1548136;
LL f[1548999];
LL ans = 0;
inline void up(LL &a, LL &b){
a += b;
i... | ALGO | 0.99973 | 3.741678 |
5f9bd30a-76e8-457c-b0f3-a4456d1a2896 | IAmBlackHacker/Algorithms | Hashing/Chaining.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <windows.h>
#include <graphics.h>
#define TABLE_SIZE 10
using namespace std;
namespace Chaining
{
int calK(char *name)
{
int K=0;
for(int i=0;i<strlen(name);i++)
{
K+=(int)name[i];
}
return K;... | ALGO | 0.99897 | 3.07571 |
a8e36734-7771-4d7e-b55f-cc979640cb5c | Pulisaiteha/saitejacodes | deltion ofan array.cpp | #include<iostream>
using namespace std;
main()
{
int n,arr[5],loc,i;
cout<<"enter array size "<<endl;
cin>>n;
cout<<"enter array elements :"<<endl;
for(i=0;i<n;i++)
{
cin>>arr[i];
}
cout<<"inserted array elements are"<<endl;
for(i=0;i<n;i++)
{
cout<<arr[i]<<"\n";
}
cout<<"enter location to delete ele... | ALGO | 0.99948 | 3.051525 |
dd5c014c-a5c8-4fa2-86c2-e5d4cdc09ae8 | matrixx-alpha/android_frameworks_av | media/module/codecs/amrwb/dec/src/normalize_amr_wb.cpp | /*
------------------------------------------------------------------------------
Filename: normalize_amr_wb.cpp
Date: 12/10/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------------------------------------------------------... | ALGO | 0.997817 | 5.778057 |
38548684-b383-4e87-ab56-5d0434566aac | MouryaPeddineni/Leetcode | 0199-binary-tree-right-side-view/0199-binary-tree-right-side-view.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.999813 | 6.245129 |
f01b1074-87a3-4db3-909f-86f65731b5d7 | AKashton/CSCE-211-HW-problems | CURRY_assignment_3/CURRY_problem_5/Main.cpp | ///////////////////////////////////////////////////////////////////
// CSCE A211
// Ashton Curry
// Due Date: 11/8/22
// Assignment #3 Problem 5: Maze Class
// Purpose: use classes instead of functions to represent the maze solution from problem 2 homework 2.
///////////////////////////////////////////////////////////... | ALGO | 0.997897 | 5.913361 |
cb0d9273-0bcf-4844-b823-14fc944f7cbd | jmlevin7878/mlpack2 | src/mlpack/methods/softmax_regression/softmax_regression_function.cpp | /**
* @file softmax_regression_function.cpp
* @author Siddharth Agrawal
*
* Implementation of function to be optimized for softmax regression.
*/
#include "softmax_regression_function.hpp"
using namespace mlpack;
using namespace mlpack::regression;
SoftmaxRegressionFunction::SoftmaxRegressionFunction(
const... | DATA | 0.998855 | 7.526086 |
ab16e066-002c-438e-a2db-f4ff51bc6a17 | Mehedi-Hasan-Rabbi/Online-Judge-Solution | CodeForces/2063 A. Minimal Coprime.cpp | // In the name of Allah the merciful.
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "algo/Debug.h"
#else
#define dbg(...)
#endif
typedef long long ll;
typedef unsigned long long ull;
#define endl '\n'
#define efficient() ios_base::sync_with_stdio(0); cin.tie(0);
#... | ALGO | 0.999929 | 4.197516 |
9b4d7ab5-0fad-4f73-a96f-d9b2991edd43 | JJJoonngg/Algorithm | 백준/10973_이전순열.cpp | //
// Created by 김종신 on 2020/02/29.
//
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> input;
int main() {
cin.tie(NULL);
cout.tie(NULL);
std::ios::sync_with_stdio(false);
cin >> N;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
input.push_back(a);
}
... | ALGO | 0.999958 | 4.520107 |
0853d802-e6ec-4f0c-8301-73a484df55eb | PrernaSingh587/Leetcode-questions | 272-closest-binary-search-tree-value-ii/272-closest-binary-search-tree-value-ii.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.999998 | 5.474069 |
bddccd1e-07c8-443f-af10-8590944e1251 | aharoJ/playground-cpp | learning_c++/old_stuff/BroCode/math_functions.cpp | #include <iostream>
#include <cmath>
int main ( )
{
double x = 3.14 ;
double y = 4 ;
double z ;
// z = std :: max ( x , y ) ;
// z = std :: min ( x , y ) ;
// z = pow ( 2 , 4 ) ;
// 2 sqrt ( 9 ) ;
// z = abs ( -3 ) ;
// z . round ( x ) ;
// z = ceil ( x ) ;
z = floor ( x ) ;
... | ALGO | 0.992763 | 3.660286 |
48f5fbbd-e48a-499d-96ec-48fe921c81e3 | Sailesh75/Dynamic-Programming | Fibonnaci/BottomUpFibonacci.cpp | #include <iostream>
#include <chrono>
#include <iomanip>
long long bottomUpFibonacci(int n) {
if (n <= 1) return n;
long long prev1 = 0, prev2 = 1, result = 0;
for (int i = 2; i <= n; i++) {
result = prev1 + prev2;
prev1 = prev2;
prev2 = result;
}
return result;
}
int main(... | ALGO | 0.996776 | 7.223994 |
0916c79b-505f-41d9-b188-10d3da453a8f | m4oughi/100DaysofCode | pureCPP/0037. Day 37/Standard Template Library Basics/033. Iterators - Bidirectional Iterator/008. Reversing Elements Using stdreverse_copy/main.cpp | #include <iostream>
#include <forward_list>
#include <iterator>
#include <algorithm>
int main() {
std::forward_list<int> numbers = {1, 2, 3, 4, 5};
std::cout << "Reversed elements: ";
std::reverse_copy(numbers.begin(), numbers.end(), std::ostream_iterator<int>(std::cout, " "));
std::cout << "\n";
... | TOOL | 0.998928 | 4.743909 |
d2882088-3936-470d-9b6a-5b65b8ab416c | guoliqiang/coding | third_part/boost/boost_1_53_0/libs/numeric/ublas/doc/samples/vector_slice_project.cpp | #include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v (3);
for (int i = 0; i < 3; ++ i)
project (v, slice (0, 1, 3)) (i) = i;
std::cout << project (v, ... | ALGO | 0.988895 | 3.176859 |
72d4d699-9336-407e-b853-7dafb0b22af0 | Sonu08-Sto/Data-Structure-Algorithms | Floyd's_cycle_detection.cpp | #include<iostream>
using namespace std;
struct Node{
int data;
Node *next;
Node(int x)
{
data=x;
next=NULL;
}
};
bool Reverse(Node *head){
Node *slow=head,*fast=head;
while(fast != NULL && fast->next != NULL){
slow= slow->next;
fast=fast->next->next;
... | ALGO | 0.999931 | 3.15551 |
492528be-9576-4bd3-bcc9-011efb938fe7 | avi78/Alpha-A1-_notes | Day1/prog9.cpp | #include <iostream>
using namespace std;
int strLength(const char* str){
if(*str=='\0')
return 0;
return 1+ strLength(str+1);
}
int main()
{
char str[1000];
cin.getline(str, 1000);
int length = strLength(str);
cout<<length<<endl;
return 0;
} | ALGO | 0.963258 | 3.386885 |
352cdfbb-00ed-4a8e-aac6-3813a9fcc982 | raashidanwar/cp-contest | CF/1455/B.cpp | /*
In the name of ALLAH
Author : Raashid Anwar
*/
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
const int M1 = 998244353;
const int M2 = 1000000007;
mt19937 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());
void solve() {
int x;
cin >> x;
int k = 0, y = 0;
while... | ALGO | 0.999913 | 4.835071 |
d68f7853-fe11-4f3a-819a-4e13258e5ad8 | zhushaoben/training | 2020暑假训练/2020牛客暑期多校训练营(第十场)/A.Permutation.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int fa[N];
int Find(int x){return x==fa[x]?x:fa[x]=Find(fa[x]);}
int main(){
int n;
while(~scanf("%d",&n)){
for(int i=1;i<n;i++)fa[i]=i;
for(int i=1;i<n;i++){
int u=Find(i),v=Find(i*2%n);
if(u!=v){
if(u>v)swap(u,v);
fa[v]=u;
}
v=Find(i*3... | ALGO | 0.999853 | 3.290317 |
535bf4f7-3a45-4720-890f-5e1022cf2a38 | ishandutta2007/codeforces | galen_colin/normal/1557/D.cpp | #include "bits/stdc++.h"
using namespace std;
// #pragma GCC optimize("O3")
// #pragma GCC target("avx2")
/*
find my code templates at https://github.com/galencolin/cp-templates
also maybe subscribe please thanks
*/
#define send {ios_base::sync_with_stdio(false);}
#define help {cin.tie(NULL);}
#define f first
#... | ALGO | 0.999974 | 3.584541 |
cf77b5a2-9348-49af-a26e-e9085b7b7e5f | Scrubpai/Competitive-Programming | AtCoder/ABC178/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef complex<double> pnt;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, pii> pp;
typedef double ld;
typedef long double lld;
#define INF 0x3f3f3f3f ... | ALGO | 0.999906 | 4.121242 |
97a332ec-6a73-465e-9e50-c735aa515371 | bhara2104/Cplusplus | POTD/2331_evaluate_boolean_tree.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.999968 | 6.234373 |
08ca8466-2ca9-4045-8052-66c88f8f6796 | solareenlo/atcoder | 05_AtCoder-Beginner-Contest/abc115/D/main.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<ll> p(51), b(51);
ll f(ll n, ll x) {
if (n == 0) return (x <= 0) ? 0 : 1;
if (x <= 1 + b[n-1]) return f(n-1, x-1);
else return p[n-1] + 1 + f(n-1, x-2-b[n-1]);
}
int main() {
ll n, x; cin >> n >> x;
p[0] = b[0] = 1;
for (int i = 0; i < 5... | ALGO | 0.99993 | 4.561468 |
2cc09cd6-949b-43cf-a348-5c7dc114ce5e | AmeerAboMukh/Assignment3 | igl/angular_distance.cpp | IGL_INLINE double igl::angular_distance(
const Eigen::Quaterniond & A,
const Eigen::Quaterniond & B)
{
assert(fabs(A.norm()-1)<FLOAT_EPS && "A should be unit norm");
assert(fabs(B.norm()-1)<FLOAT_EPS && "B should be unit norm");
//// acos is always in [0,2*pi)
//return acos(fabs(A.dot(B)));
return fmod(2.... | ALGO | 0.983655 | 5.057438 |
d3d290b5-13ea-400e-99d1-4d80cc0e1f8f | Satzyakiz/CP | Graphs/Flyod_Warshall.cpp | // All pair shortest path problem
// The problem is to find shortest distances between every pair
// of vertices in a given edge weighted directed Graph. The Graph is
// represented as Adjancency Matrix, and the Matrix denotes the
// weight of the edegs (if it exists) else INF (1e7).
// Input
// 2
// 2
// 0 25
// INF 0... | ALGO | 0.99927 | 3.878959 |
117849c9-a57a-4e99-b7dd-2f3878bec6ab | ishandutta2007/codeforces | andreikkaa/normal/1644/E.cpp | /*
* C++11 code template for contests.
* @author: Andrei Kalendarov
* @e-mail: <EMAIL>
*/
//#define ANDREIKKAA_ALLOCATOR
const int _ML = 500;
const char _inpf[] =
#if defined(ANDREIKKAA)
"input.txt"
#else
""
#endif
;
const char _outf[] =
#if defined(ANDREIKKAA)
""
#else
""
#endif
;
#if defined(ANDREI... | ALGO | 0.999389 | 4.623811 |
b01d79ed-fd19-4401-909a-b1087120d1aa | T-R0D/Past-Courses | CS302/PA08/PA08/Doxygen/test9.cpp | //--------------------------------------------------------------------
//
// Laboratory 9 test9.cpp
//
// Test program for the operations in the Binary Search Tree ADT
//
//--------------------------------------------------------------------
using namespace std;
#include <ios... | TEST | 0.989874 | 6.089522 |
a4f511c8-cee2-43b6-b462-9b15ec461146 | hex108/leetcode | minimum_depth_of_binary_tree/test.cpp | #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include "test.h"
#include "minimum_depth_of_binary_tree.h"
using namespace std;
int main()
{
Solution solution;
//Test cases
//Error test cases from leetcode.com
return 0;
}
| ALGO | 0.99962 | 6.346615 |
b2e8f2f6-6fd5-49a6-af4a-75e47a1160d5 | habib-e/All-Problem-Solving-code-with-name | pending...cola.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,sum=0,k=3,res=0,rem=0,rem1=0,rem2=0;
while(scanf("%d",&n)!=EOF)
{
rem=n;
res=n;
while(rem>=k)
{
rem1=rem%k;
rem/=k;
res+=rem;
rem+=rem1;
// rem2+=rem1;... | ALGO | 0.999984 | 3.045551 |
79e2ec6f-97f7-4458-bb23-bbfa1a8b6c64 | AyushSR7558/Leetcode | 653-two-sum-iv-input-is-a-bst/two-sum-iv-input-is-a-bst.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999995 | 6.553959 |
fa9ba15c-2680-4f97-8315-3f6d84fcfc2a | kahfiaulia/cpp | tabelfungsi.cpp | #include <iostream>
using namespace std;
float f (float x);
int main(){
float x;
cout << "--------------------------------" << endl;
cout << " x f(x)" << endl;
cout << "--------------------------------" << endl;
x = 10.0;
while (x <= 15.0){
cout << x << " " << f(x) << endl;
x = x + 0.2;
}
cout <... | ALGO | 0.983301 | 4.173867 |
a13a66f8-c496-4c0d-a41c-ed4b02b89caa | NekoPixel/system_media | audio_utils/ChannelMix.cpp | #include <audio_utils/ChannelMix.h>
namespace android::audio_utils::channels {
/**
* The ChannelMix code relies on sparse matrix optimization for speed.
*
* This requires -ffast-math to be specified.
*/
/*
Implementation detail:
We "compute" the channel mix matrix by constexpr computation,
but alternatively ... | TOOL | 0.87771 | 7.64839 |
c4419f75-f4d7-4d4b-9b40-e97508b149b7 | 7566565794/must_do_stack | lru_cache.cpp | deque<int>dq;
map<int,int>m;
int size;
LRUCache::LRUCache(int N)
{
//Your code here
dq.clear();
m.clear();
size = N;
}
/*Sets the key x with value y in the LRU cache */
void LRUCache::set(int x, int y)
{
//Your code here
if(m.find(x)==m.end()){
if(dq.size()==size){
i... | ALGO | 0.998228 | 5.148119 |
2dfb03d1-3b53-4bfc-9a5a-50358f0f0a2f | Omair95/A_prototype_MPEG-G_encoder | boost_1_66_0/libs/date_time/example/gregorian/print_holidays.cpp | /* Generate a set of dates using a collection of date generators
* Output looks like:
* Enter Year: 2002
* 2002-Jan-01 [Tue]
* 2002-Jan-21 [Mon]
* 2002-Feb-12 [Tue]
* 2002-Jul-04 [Thu]
* 2002-Sep-02 [Mon]
* 2002-Nov-28 [Thu]
* 2002-Dec-25 [Wed]
* Number Holidays: 7
*/
#include "boost/date_time/gregorian/gre... | TOOL | 0.952652 | 6.390407 |
0c69fdc3-60e3-4629-8f70-bf68036c6cd3 | TomasWP/SO | 2º Ano/Aula 3/lesson-3/code/bounded-buffer/main.cpp | /*
* An implementation of the bounded-buffer problem
*
* NC producers and NC consumers communicate through a fifo.
* The fifo has a fixed capacity.
* NI items will be produced by the producers and consume by the consumers.
* An item is composed of 2 equal integers, ranging from 1 to NI.
*/
#include <stdio.h>
#i... | ALGO | 0.96248 | 4.847226 |
32a3079f-ada1-4aff-9dc6-ff55df1bb826 | osinoyan/blackhole | final/final/sphere.cpp | #include "sphere.hpp"
#define PI 3.14159265
bool sphere::hit(const ray& r, float t_min, float t_max, hit_record& rec) const {
// write something here ...
float f_a = dot(r.direction(), r.direction());
float f_b = 2.0 * dot(r.direction(), (r.origin() - center));
float f_c = dot((r.origin() - center), (r.... | ALGO | 0.972913 | 5.551422 |
e860dfe7-350a-4480-ae05-4c86d94ea7ad | lunarpulse/CarND-Term2 | ModelPredictiveControl/src/Eigen-3.3/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/LinearAlgebr... | ALGO | 0.933198 | 4.152793 |
ca800f47-16e1-4c59-93fc-f1abe47263d4 | mmhriyad/uva | 784_Maze_Exploration.cpp | #include <stdio.h>
#include <string.h>
#define MAXL 40
#define MAXC 100
#define MAXDIR 4 //8
#define GETMAX(x, y) (x>y ? x : y)
int T, m, n;
char arr[MAXL][MAXC];
const char blank = ' ', endc = '_', wall = 'X', point = '*', paint = '#';
//int dir[MAXDIR][2] = {{-1,-1}, {-1,0}, {-1,1},
//{0,-1}, {0, 1},
//{1,-1}, {... | ALGO | 0.999872 | 3.296823 |
2158b889-bb0f-4de2-975c-ba392c0e0760 | KaiDD27/IOI2024 | cses.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n; i++) cin >> b[i];
int result = 2 * n;
for (int offset = -1000; offset <= 1000; offs... | ALGO | 0.999884 | 4.19627 |
a0bb3971-06be-4cb5-a522-7c2883748c58 | Genopatiparn/ENGCE117 | LAB5/5.2.cpp |
#include <stdio.h>
#include <string.h>
struct studentNode {
char name[20] ;
int age ;
char sex ;
float gpa ;
struct studentNode *next ;
} ;
void InsNode( struct studentNode **preNode, char n[], int a, char s, float g );
void GoNext( struct studentNode ***ptr ) ;
void DelNode( struct studentNode *... | TOOL | 0.947253 | 3.527601 |
ef4c116d-1bfa-4eae-9d5f-f1a927905af7 | ishandutta2007/codeforces | toxel/normal/703/E.cpp | #include<bits/stdc++.h>
#define ll long long
const int N = 1010;
const int M = 8000000;
const int INF = 0x7f7f7f7f;
template <typename T>
T extendedeuclid(T a, T b){
return b ? extendedeuclid(b, a % b) : a;
}
std::vector <ll> vec;
int n;
std::pair <int, ll> dp[N][N * 7];
std::pair <std::pair <int, int>, bool> pre[N... | ALGO | 0.999975 | 3.529575 |
19681003-6eef-4d4e-9ff4-e4c3eaec98cc | MarcoSiciliano23/LSN-Siciliano987771 | ES.4/NSL_SIMULATOR/SOURCE/random.cpp | /****************************************************************
*****************************************************************
_/ _/ _/_/_/ _/ Numerical Simulation Laboratory
_/_/ _/ _/ _/ Physics Department
_/ _/_/ _/ _/ Universita' degli Studi di Milano
_/ _/ ... | TOOL | 0.990662 | 3.137182 |
21baeb46-9b05-42e8-a2eb-be34b1c8dbea | mohitkumarraj/preparation | bitmanupulation.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
void displaybit(int n){
int i,mask;
for(i=31;i>=0;i--){
mask=1<<i;
putchar(n&mask?'1':'0');
}
}
int getbit(int num,int pos){
int mask=1<<pos;
return (num&mask)?1:0;
}
int setbit(int num,int pos){
// int mask=1<<pos;
// return (num|ma... | ALGO | 0.996915 | 4.131079 |
79493995-35c6-44bb-9960-4386e7898b13 | deussbelli/C-basic | EXAM.cpp | /////////////////////////////ЗАВДАННЯ 1/////////////////////////////
////////////////////////////////////////////////////////////////////
// Визначити шаблонну функцію, яка підраховує кількість елементів,
відмінних від вказаного i-го елемента в масиві. Передбачити перехоплення винятків при невірному значенні i.//
#i... | TOOL | 0.959995 | 3.763333 |
823a30f4-a670-468a-b002-39a268aa06ee | aroraadivya/LeetCode-Questions | 2552-maximum-sum-of-distinct-subarrays-with-length-k/2552-maximum-sum-of-distinct-subarrays-with-length-k.cpp | class Solution {
public:
long long maximumSubarraySum(vector<int>& nums, int k) {
int n = nums.size();
unordered_set<int> elements;
long long current_sum = 0;
long long max_sum = 0;
int begin = 0;
for (int end = 0; end < n; end++) {
if (elements.f... | ALGO | 0.999964 | 6.375224 |
702df436-d6f8-4d4e-9154-50cd8fc71cb8 | samuraiexx/competitiveProgramming | cf/957/a.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define st first
#define nd second
#define db(x) cerr << #x << " = " << x << endl
#define _ << ", " <<
typedef long long ll;
int main(){
int n;
string s;
cin >> n >> s;
bool ok = 0;
if(s[0] == '?' or s.back() == '?') ok = 1;
for(int i = 0;... | ALGO | 0.999992 | 3.276855 |
e1323fcc-fce2-45a5-abe3-bcc878a20898 | daeunohh/leetCode_top150 | leetCode_top150/1_merge_sort.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
if(m == 0) {
nums1 = nums2;
return;
}
if(n == 0) return;
bool isEnd2End = false;
auto end = nums1.end() - 1;
auto end1 = nums1.begin() + m - 1... | ALGO | 0.999893 | 5.007095 |
35c518c6-d219-482e-8cf7-6c614967c550 | YamiOG/Chassis2D | extern/Box2D/src/dynamics/b2_edge_polygon_contact.cpp | #include "b2_edge_polygon_contact.h"
#include "box2d/b2_block_allocator.h"
#include "box2d/b2_fixture.h"
#include <new>
b2Contact* b2EdgeAndPolygonContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
{
void* mem = allocator->Allocate(sizeof(b2EdgeAndPolygonContact));
... | ALGO | 0.989332 | 6.890633 |
316342e5-53d9-48b6-a505-669c3beb175f | ssaannzzhhiikk/PP1 | Lab 9/bforce S.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n , m;
cin >> n;
vector<int> array;
for(int i = 0;i < n;i++){
cin >> m;
auto it = find(array.begin() , array.end() , m);
if(!array.empty() && it != array.end()){
continue;
}array.push_back(m);
... | ALGO | 0.999973 | 4.471706 |
43722bd9-df42-4d54-91dd-dc832e0b6ba7 | yeswanthsairaghuram/LeetCode | 1476-count-negative-numbers-in-a-sorted-matrix/1476-count-negative-numbers-in-a-sorted-matrix.cpp | class Solution {
public:
int countNegatives(vector<vector<int>>& grid) {
int cnt = 0;
for (int i = 0; i < grid.size(); i++) {
for (int j = 0; j < grid[0].size(); j++) {
if (grid[i][j] < 0) {
cnt++;
}
}
}
retu... | ALGO | 0.999984 | 6.391978 |
f7dfa3d8-d993-469e-ac7b-ea9dcc1ca6cb | omar-3/Algorithms-Sequential-Parallel-Distributed | ch2/Insertion_Sort/algorithm.cpp | #include <vector>
#include <iostream>
#include <algorithm>
template<class T>
std::vector<T> insertion_sort(std::vector<T> List) {
typedef typename std::vector<T>::iterator iterator; // see this https://en.cppreference.com/w/cpp/language/dependent_name
// I'm using iterators because you can sublist... | ALGO | 0.999958 | 4.906751 |
acd5283c-f5bd-4901-b4ad-83a84f7ff370 | rohandarandale1144/GFG_to_GitHub | Easy/Subarray with given sum/subarray-with-given-sum.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find a continuous sub-array which adds up to a given number.
vector<int> subarraySum(vector<int>arr, int n, long long s)
{
// Your code here
long long left, ... | ALGO | 0.999955 | 5.532938 |
b26e4482-ff0a-499a-8e0e-85301f0b4ea2 | nsmith0310/Programming-Challenges | C++/Project Euler/e2.cpp | #include <iostream>
#include <vector>
int main(){
int total = 0;
std::vector <int> fib;
fib.push_back(1);
fib.push_back(1);
for (int i=2;i<1000;i++){
int val = fib[i-1]+fib[i-2];
if (val>4000000){
return total;
}
else{
if (val%2==0){
total+=val;
}
fib.push_back(val);
}
}
return total... | ALGO | 0.999977 | 4.669593 |
0ac8e294-83c0-4dcf-934f-7d11b42b34f4 | vaneela/Ds-algo | CodeStudio/Subsequence_of_string.cpp | void solve(string str,string temp, int i, vector<string>&ans){
if(i>=str.size()){
if(!temp.empty())
ans.push_back(temp);
return;
}
// ex cll
solve(str,temp,i+1,ans);
// in cll
temp+=str[i];
solve(str,temp,i+1,ans);
}
vector<string> subsequences(string str){
... | ALGO | 0.99977 | 5.67909 |
7eb99427-ddcd-456c-b899-d8c114c8fbb3 | victorgao001/programming-contest-resources | templates/graph/other/main.cpp | #include <bits/stdc++.h>
using namespace std;
int gr[5][5]= {{0,1,0,0,0},
{1,0,1,1,0},
{0,1,0,1,0},
{0,1,1,0,1},
{0,0,0,1,0}};
typedef pair<int,int> pii;
int prim()/**adj list mst*/
{
int V,E,a,b,c;
typedef pair<int,int> pii;
cin>>V>>E;
v... | ALGO | 0.999966 | 3.682079 |
4f7dfaf8-a32c-4298-b305-d23e6e8f1581 | TheMexicanCreator/Cplusplus-course | if_else.cpp | //"If-else" in C++
#include <iostream>
using namespace std;
int main() {
//Use "int" to declare a variable
int n1;
int n2;
int sum = 0;
cout << "Enter the first number: " << endl;
cin >> n1;
cout << "Enter the second number: " << endl;
cin >> n2;
sum = n1 + n2;
cout << sum;
}
| TOOL | 0.959113 | 3.416213 |
69261d35-f153-4ffa-98ce-0f419ffaf652 | mandalsudipti/competitive_programming | codeforces/Lost tree.cpp | #include<bits/stdc++.h>
using namespace std;
void get_edge(vector<int>& nodes , set<vector<int>>& edge , int n)
{
int distance ;
for(int i = 0 ; i < nodes.size() ; i++)
{
cout<<"? "<<nodes[i]<<endl;
fflush(stdout);
for(int j = 1 ; j <= n ; j++)
{
cin>>distance ;
... | ALGO | 0.999918 | 3.26219 |
d177dc7b-ad6e-4921-b787-bb171bc3a59a | yitianhao/gpu_sched_new | gpu-sched-centralcontrol/minor/boost_1_61_0/libs/compute/perf/perf_bolt_exclusive_scan.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <bolt/cl/scan.h>
#include <bolt/cl/copy.h>
#include <bolt/cl/device_vector.h>
#include "perf.hpp"
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
bolt::cl::control ctrl = bo... | ALGO | 0.883619 | 3.964213 |
3eaa3826-8a64-4ac7-9813-fcaad6421d76 | i-m-samarth-cs/CPP-Codes-Diploma | Second.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
struct Point {
int x, y;
Point(int _x = 0, int _y = 0) : x(_x), y(_y) {}
// Compare points by x-coordinate
bool operator<(const Point& other) const {
if (x != other.x) return x < other.x;
... | ALGO | 0.999962 | 6.043963 |
5cc2eb75-249c-43d3-9af5-836badac5223 | Khanhnguyen2408/Tin-hoc-cs-2 | C04046-BRT.cpp | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
int cmp(const void *a,const void *b){
int *x=(int*)a;
int *y=(int*)b;
return *x-*y;
}
int main(){
int t;
scanf ("%d",&t);
while (t--){
int n;
scanf ("%d",&n);
int a[n];
for (int i=0;i<n;i++){
scanf ("%d",&a[i]);
}
qsort(a,n,sizeof(int),cmp);
... | ALGO | 0.999308 | 3.124404 |
bfbe2449-b2dd-4439-a99d-8e861140ba95 | ishandutta2007/codeforces | cdkrot/normal/1237/C1.cpp | // Dmitry _kun_ Sayutin (2019)
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::cerr;
using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;
using std::queue;
using std::pair;
using std::make_pair;
using std::tuple;
using std::make_tuple;
using std::get;
using ... | ALGO | 0.999989 | 4.10462 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.