uuid stringlengths 36 36 | repo_name stringlengths 5 133 | relative_path stringlengths 3 3.76k | content stringlengths 282 4.03M | category stringclasses 6
values | algo_rel_score float32 0.9 1 | quality_score float32 3 8.13 | source_meta dict |
|---|---|---|---|---|---|---|---|
5698a8f3-ee29-4b6b-9e6a-c914fc217ce4 | learnhoney/leetcode-solutions- | 0349-intersection-of-two-arrays/0349-intersection-of-two-arrays.cpp | class Solution {
public:
int bs(vector<int> &nums2, int low, int high, int k){
while(low <= high){
int mid = low + (high - low) / 2;
if(nums2[mid] == k){
return mid;
}else if(nums2[mid] < k){
low = mid + 1;
}else{
... | ALGO | 0.999998 | 5.770718 | {
"github_metadata": {
"branch": "main",
"commit_count": 593,
"repo_created_at": "2024-03-10T08:29:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2bb0870d5b... |
7121bed1-f944-485b-82f8-603fa0d527c1 | Jitendra708097/DSA-WITH-C- | queue/dequeue.cpp | // Implementation of dequeue using array
// operations in dequeue
//push_front
//push_back
//pop_rear
//pop_front
// first element in dequeue
// last element in dequeue
// STL dequeue<int>q;
#include<iostream>
using namespace std;
class dequeue
{
public :
int front , rear , size;
int *arr;
dequeue(int n... | ALGO | 0.997296 | 3.865711 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-05-01T17:50:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5c526af5614... |
2a244d2e-09f6-46aa-9053-55e7d62f7d1e | aki-hsk/competitive_programming | shojin/1200-/1300-/1325-/Flatten.cpp | #include<iostream>
#include<vector>
#include<map>
#include<atcoder/all>
using namespace atcoder;
using namespace std;
using mint = modint1000000007;
const int MX = 1e6+5;
struct Sieve {
int n;
vector<int> f, primes;
Sieve(int n=1):n(n), f(n+1) {
f[0] = f[1] = -1;
for (long long i = 2; i <=... | ALGO | 0.999929 | 4.806337 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2022-03-22T12:47:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "34b31db30... |
3e8b8a2a-5369-4343-8f95-46c67b8c21f8 | Meng-Lan/Lan | AOAPC II Beginning Algorithm Contests (Second Edition) (Rujia Liu)/T5_10_U207(AC).cpp | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<utility>
#include<cassert>
#include<cmath>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
const int maxn = 144;
const int n_cut = 70;
double eps = 1e-6;
do... | ALGO | 0.994746 | 3.184965 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2017-06-08T14:52:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "13b0a8a8dd... |
4f79065a-a5dc-4b4c-8e2b-7138c9ba3b77 | stelakhs96/project3 | Brecommendation.cpp | #include <iostream>
#include <vector>
#include <list>
#include <chrono>
#include <random>
#include <cmath>
#include "classes.h"
#include "Brecommendation.h"
#include "tweet_analyzation.h"
#include "hash.h"
#include "search.h"
#include "LSHClustering.h"
using namespace std;
vector< UserKnownCryptos > BCosineLSHRecom(v... | ALGO | 0.999183 | 5.078151 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2019-01-02T16:20:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4dd81af236... |
5a9a7ca7-9182-4a25-9906-1056b33c743a | YasuraLaksitha/DSA | arrays/k_rotate.cpp | //
// Created by ASUS on 01/05/2025.
//
/*
🔁 Question: Rotate an Array by K Positions
Given an array of integers 'a' and an integer 'k', rotate the array to the right by 'k' positions.
Example:
Input: a = [1, 2, 3, 4, 5], k = 2
Output: [4, 5, 1, 2, 3]
Constraints:
- Time Complexity: O(n)
-... | ALGO | 0.999663 | 6.498837 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2025-07-04T04:01:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9ac7dc1e0... |
4a253992-fc78-4086-934b-830201783841 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/MixtralExpert/top0-100/stamping-the-grid-Solution.possibleToStamp/177874_Exec_Code_Overflow.cpp | void aes_crypt_ecb( aes_context *ctx,
int mode,
const unsigned char input[16],
unsigned char output[16] )
{
int i;
unsigned long *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
#if defined(XYSSL_PADLOCK_C) && defined(XYSSL_HAVE_X86)
if( padlock_supports( PAD... | ALGO | 0.996963 | 6.273534 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-03-22T14:39:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "534f4b368f20... |
f8d9a63a-0faa-443e-aa37-5274da5e86cc | vivek-30/cp-and-dsa-zone | CodeForces/Div2/Oct2022_@3/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define inf 2e18
#define minf -2e18
#define mod 1000000007
#define int long long int
#define ld long double
#define all(v) v.begin(), v.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typ... | ALGO | 0.999918 | 3.864981 | {
"github_metadata": {
"branch": "main",
"commit_count": 367,
"repo_created_at": "2023-02-21T17:53:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7f9a2e8016... |
e680e472-a138-431f-9312-20ccdc2e36ab | supin2/Algorithm-Study | programmers/ForKaKAO/2021/level3/합승 택시 요금.cpp | #include <string>
#include <vector>
using namespace std;
#define INF 50000000
int solution(int n, int s, int a, int b, vector<vector<int>> fares) {
int answer = INF;
int dist[201][201];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if (i == j) {
di... | ALGO | 0.999796 | 4.322476 | {
"github_metadata": {
"branch": "master",
"commit_count": 351,
"repo_created_at": "2021-04-11T15:42:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d8c13c71... |
a5a03fed-f1f8-4e51-bacc-8865fc9c1c55 | frankming123/algorithm | pat/advanced/1105 Spiral Matrix.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int n;
vector<int> v;
int matrix[500][500];
int col, row;
bool cmp(int a, int b) {
return a > b;
}
void dfs(int now, int i, int j, int flag) {
if (now >= v.size())
return;
matrix[i][j] = v[now];
if (flag == 0) {
... | ALGO | 0.999999 | 4.131712 | {
"github_metadata": {
"branch": "master",
"commit_count": 113,
"repo_created_at": "2018-07-29T01:36:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b9177123... |
ac3bd867-4294-40f5-9dd8-620bd47493de | jbowen93/cpp_learning | chapter123/grades.cpp | #include <iomanip>
#include <ios>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::string;
using std::streamsize;
using std::sort;
using std::vector;
int main()
{
//Greeting
cout << "Please enter your f... | ALGO | 0.999488 | 4.228416 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2015-05-04T20:55:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "264e9c7b4... |
afa29a62-94d6-4c9f-90e0-fbb6d1d3f26e | zaurus-yusya/Competitive-Programming | atcoder/abc/abc257/abc257/e/main.cpp | #include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << '\n';
using namespace std;
const long long INF = 8e18;
using ... | ALGO | 0.999968 | 3.842999 | {
"github_metadata": {
"branch": "master",
"commit_count": 418,
"repo_created_at": "2019-08-14T07:36:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5e1048b8... |
794199cd-fac5-4a2d-8745-fbca1c97eda6 | milkisZero/algorithm_PS | 백준/Gold/20984. Growing Vegetables is Fun 4/Growing Vegetables is Fun 4.cc | #include <bits/stdc++.h>
#define INF INT_MAX
#define LLINF LLONG_MAX
#define fastio ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL)
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
using ull = unsigned long long;
#define MAX 200000
ll arr[MAX + 3], up[MAX + 3], low... | ALGO | 0.999973 | 4.226541 | {
"github_metadata": {
"branch": "main",
"commit_count": 489,
"repo_created_at": "2023-07-17T01:36:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e8e5699365... |
14ecd4f9-d6ce-4565-af18-b31877d1b188 | Pyboon/leetcode_source | CPP/283.move-zeroes.cpp | /*
* [283] Move Zeroes
*
* https://leetcode.com/problems/move-zeroes/description/
*
* algorithms
* Easy (50.89%)
* Total Accepted: 241.5K
* Total Submissions: 474.4K
* Testcase Example: '[0,1,0,3,12]'
*
*
* Given an array nums, write a function to move all 0's to the end of it while
* maintaining the r... | ALGO | 0.999976 | 6.413513 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2018-01-25T14:47:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a6974a5ddb... |
afea7f8f-b555-4b40-b40e-2c1a2b911e19 | ANARCYPHER/Nuclear-Engineering | Universal-Physics-mod/src/simulation/elements/SUGR.cpp | #include "simulation/ElementCommon.h"
static int update(UPDATE_FUNC_ARGS);
void Element::Element_SUGR() {
Identifier = "DEFAULT_PT_SUGR";
Name = "SUGR";
Colour = PIXPACK(0xFFF9F2);
MenuVisible = 1;
MenuSection = SC_ORGANIC;
Enabled = 1;
Advection = 0.4f;
AirDrag = 0.04f * CFDS;
AirLoss = 0.94f;
Loss = 0.95... | TOOL | 0.933367 | 4.816925 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2022-03-13T23:37:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d7b85e1ca... |
a5828b8d-12c6-4b07-8146-bd8d85e2461f | ishandutta2007/codeforces-i | i_love_tanya_romanova/normal/575/B.cpp | /*
*/
//#pragma comment(linker, "/STACK:16777216")
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory... | ALGO | 0.999633 | 3.891094 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T05:39:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2c4d6ecd1c20... |
f5ce6d6c-ea6e-431e-a6a8-c9584f7d648d | CharlesBryanJr/Starting_Out_With_C_Plus_Plus | Starting Out With C++ Chapter 7 – 2. Rainfall Statistics/helloworld.cpp | /*
Starting Out With C++ Chapter 7 – 2. Rainfall Statistics
Write a program that lets the user enter the total rainfall for each of 12 months into an array of doubles.
The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amou... | TOOL | 0.995011 | 6.170751 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2022-11-08T02:00:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "02f448eef... |
980831fe-4789-4080-a259-11fb74a2b2a7 | AvaLovelace1/competitive-programming | solutions/ccc/cco13p6.cpp | /*
Solution to CCO '13 P6 - Repetitivity by <NAME>
Key concepts: dynamic programming
*/
#include <bits/stdc++.h>
using namespace std;
int MOD;
string s;
int dp[10001][10001];
int findWays(int a, int b) {
if (a < 0 || b < 0) {
return 0;
}
if (dp[a][b] == -1) {
int sum;
... | ALGO | 0.999991 | 4.889807 | {
"github_metadata": {
"branch": "master",
"commit_count": 782,
"repo_created_at": "2018-03-04T18:04:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 1,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "9718358e... |
e8f9887b-809b-464f-957c-51a775517a94 | RiziRajput/Multiple-Choice-Exam-Grading-Program | Project PF.cpp | #include <iostream>
#include <string>
using namespace std;
const int NUM_QUESTIONS = 5;
const int NUM_STUDENTS = 5;
void initializeQuestions(string questions[], string choices[][4], char correctAnswers[])
{
cout << "Enter the questions and choices: \n";
for (int i = 0; i < NUM_QUESTIONS; i++)
{
co... | TOOL | 0.973431 | 4.301854 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-06-30T11:44:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e50d9f55ac3a... |
b2c12100-c8fa-49a2-883f-cb70a273d753 | PuddingZJU/Sign_Language_Recognition | Sign_Language_Recognition_1/libhmm/HMM.h | // Copyright (c) 2006-2009 <NAME>
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENCE file.
#pragma once
#include "State.h"
#include "k_mean.h"
#include <fstream>
#define UNDER_DET 0.001 //For lower bound of the determinant
#define THRESHOLD 1.0e-3 //Convergence thresho... | ALGO | 0.996394 | 5.708473 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2013-11-24T15:33:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "75441aaf6b... |
3b8369ab-a916-4b0f-9c3d-5e75df581072 | hadleyhzy34/data_structure_and_algorithm | dynamic_programming/leet_Code_Dynamic_Programming/221_maximal_square.cpp | //
// 221_maximal_square.cpp
// leet_Code_Dynamic_Programming
//
// Created by Hadley on 15.07.20.
// Copyright © 2020 Hadley. All rights reserved.
//
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <stack>
#include <cstring>
#includ... | ALGO | 0.999405 | 5.552889 | {
"github_metadata": {
"branch": "master",
"commit_count": 117,
"repo_created_at": "2020-09-06T13:38:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "58c06499... |
30767781-6e35-47cb-8a4f-7ba391d23b4e | La-Coruna/PS | baekjoon/3055.cpp | /*
[탈출]
- date: 25.02.03
- 분류: bfs
*/
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int R, C;
int sX, sY;
string board[50];
int water[50][50];
int gosumVis[50][50];
void flood(){
for (int t = 1; ; t++) {
bool cantFloodMore = tr... | ALGO | 0.999884 | 4.059698 | {
"github_metadata": {
"branch": "main",
"commit_count": 256,
"repo_created_at": "2023-07-25T07:17:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "570a3d8d33... |
8d7aafae-6af1-46a1-94f0-efb4ebfb189e | aaddaammgg/CLionProjects | CS3A_Lab_Palindrome/main.cpp | #include <iostream>
bool isPalindrome(std::string word);
int main() {
std::string word;
char again;
do {
std::cout << "Enter a word:" << std::endl;
std::cin >> word;
if (isPalindrome(word)) {
std::cout << word << " is a palindrome.";
} else {
std::... | ALGO | 0.986054 | 5.27795 | {
"github_metadata": {
"branch": "main",
"commit_count": 187,
"repo_created_at": "2021-11-26T19:25:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "20caaaa731... |
57dc0433-0969-4cc6-b7c4-d9c0f9dcd998 | hupender/all_code | codechef/starter_69/q3_finale.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long int
vector<int> decimal_to_binary(int n) {
vector<int> v(30,0);
int i=29;
while(n>0) {
v[i]=n%2;
n/=2;
i--;
}
return v;
}
void solve1(vector<vector<int>> &v,unordered_map<int,int> &m) {
/... | ALGO | 0.999744 | 4.112111 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2023-01-11T10:09:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2ffdcdb7f... |
c8468a17-0cd6-456c-aa08-543f194c2273 | shenmayufei/cplusplus | coursera/strings/week04/homework/kmp/kmp.cpp | #include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using std::cin;
using std::string;
using std::vector;
// Find all occurrences of the pattern in the text and return a
// vector with all positions in the text (starting from 0) where
// the pattern starts in the text.
vector<int> find_pattern(... | ALGO | 0.995843 | 4.42782 | {
"github_metadata": {
"branch": "master",
"commit_count": 225,
"repo_created_at": "2020-03-22T01:55:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1036ff1c... |
1b4a56f4-d97c-4ce8-80d9-c025e8c35fa9 | aosipov91/zaton | src/util/utils.cpp | #include "utils.h"
void swap(float& a, float& b)
{
float temp;
temp = a;
a = b;
b = temp;
b = a;
}
mat4 mat4_transpose(const mat4& m)
{
return mat4(m.e00, m.e01, m.e02, m.e03,
m.e10, m.e11, m.e12, m.e13,
m.e20, m.e21, m.e22, m.e23,
m.e30, m.e31, ... | ALGO | 0.998022 | 5.656788 | {
"github_metadata": {
"branch": "main",
"commit_count": 60,
"repo_created_at": "2021-03-31T05:12:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "688f00cf161... |
e5c322e5-ea25-47ca-b0d5-cc4c19473266 | mitesh-sharma/DSA | LinkedList/.vscode/removeDuplicates.cpp | #include<iostream>
#include <map>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data){
this->data = data;
this->next = NULL;
}
};
//print the linked list
void print(Node* &head){
Node* temp = head;
while(temp != NULL){
cout << temp -> data... | ALGO | 0.999888 | 4.978254 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2022-12-24T19:15:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b42db67cf... |
daccbbf0-a9e2-4a87-9ecc-d59c84dcbb71 | jatin69/coding-practice | Interviewbit/trees/traversals/inorder-traversal-of-cartesian-tree.cpp | /*
* Author : <NAME>
* Date : 30-05-2019
*
* Editor : Dev c++ 5.11
* Compiler : g++ 5.1.0
* flags : -std=c++14
*
* link - https://www.interviewbit.com/problems/inorder-traversal-of-cartesian-tree/
* ref links -
* https://www.geeksforgeeks.org/cartesian-tree/
* https://www.geeksforgeeks.org/construct-b... | ALGO | 0.999972 | 5.257505 | {
"github_metadata": {
"branch": "master",
"commit_count": 80,
"repo_created_at": "2017-10-10T17:19:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3e780f68b... |
bf305ed1-861f-4f45-8358-53171a4bb440 | kingsring/C- | chapter 3/e3-32.cpp | #include<iostream>
#include<vector>
int main()
{
using namespace std;
vector<int> vec;
vector<int> copyv;
int num;
cout << "Enter num add to the vector:";
while(cin >> num )
{
vec.push_back(num);
cout << "Got it:" << num << " Add to the vector.(Tyep a no-figure or Ctrl+Z to... | TOOL | 0.975315 | 3.358512 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2017-09-18T13:30:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6cb6759f7... |
ba3a9633-d1a0-4b50-9323-1b02285e9009 | tmoux/prog-contests | misc/ucf/hspt17/sol/elemental.cpp |
#include <iostream>
using namespace std;
#define endl "\n";
int main() {
int N, t = 1;
while(true) {
cin >> N;
if( N == 0 ) break;
string elem[N];
string s;
for(int i=0;i<N;i++)
cin >> elem[i];
getline(cin, s);
getline(cin, s);
// initialize array to represent whether we can build a string ... | ALGO | 0.994446 | 3.718323 | {
"github_metadata": {
"branch": "master",
"commit_count": 288,
"repo_created_at": "2018-10-21T03:33:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "deb26b1b... |
0b3ca2ca-5378-46f0-88be-2638e02c1e4c | kirill7785/AliceFlow | src AliceFlow/priority_queue.cpp | // Очередь по приоритетам на основе сортирующего дерева
// 12.06.2017 (июнь).
// priority_queue.cpp
// Быстро добавляем элементы, быстро читаем максимальный элемент среди
// имеющихся, быстро удаляем максимальный элемент.
// Всё на массиве и очень быстро потому что без рекурсии.
// Время выполнения логарифмическое.
/... | ALGO | 0.998985 | 3.383584 | {
"github_metadata": {
"branch": "master",
"commit_count": 1490,
"repo_created_at": "2015-10-02T03:45:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c103648... |
72b3d96a-8fab-4368-9d87-35a2f6419ea8 | north-h/Match_code | 2024/Codeforces_-_Codeforces_Round_983_(Div_2)/C_Trinity.cpp | /*
* ==================================================================================
* Author: north_h
* Time: 2024-11-01 22:59:44
*
* Problem: C. Trinity
* Contest: Codeforces - Codeforces Round 983 (Div. 2)
* URL: https://codeforces.com/contest/2032/problem/C
* MemoryL: 256 MB
* TimeL: 2000 ms
... | ALGO | 0.999614 | 4.837908 | {
"github_metadata": {
"branch": "main",
"commit_count": 555,
"repo_created_at": "2023-08-20T03:53:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "efb96ce5b1... |
f3a9743c-d6c8-4bf1-b3ac-10ddb91d438e | rlj1202/problemsolving | baekjoon/14938/main.cpp | #include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
int items[102];
int adj[102][102];
int main() {
int N, M, R;
scanf("%d %d %d", &N, &M, &R);
for (int n = 1; n <= N; n++) {
scanf("%d", items + n);
}
memset(adj, 0x3f, sizeof(adj));
for (int r = 0; r < R... | ALGO | 0.999945 | 4.170854 | {
"github_metadata": {
"branch": "main",
"commit_count": 47,
"repo_created_at": "2019-05-12T13:03:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0f849b15856... |
38d13ed6-f403-4d8e-814e-3c85199e6684 | nono19972020/atcoder | ABC/ABC057/c2.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
long long f(long long a, long long b){
string s1, s2;
s1 = to_string(a);
s2 = to_string(b);
return max(s1.size(), s2.size());
}
vector<long long> divisor(long long n) {
vector<long long> ret;
for... | ALGO | 0.999942 | 4.222957 | {
"github_metadata": {
"branch": "master",
"commit_count": 388,
"repo_created_at": "2020-06-23T07:08:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e96a8dbe... |
9e6c3dac-61cb-4187-bb70-42f8b912bfb4 | amadousalldia/Experimental_code | BoneImageVersionGuillaume/ForPostProcessing_FixedFNumber_3May2021/include/rayTheory.hpp | #ifndef RAYTHEORY_HPP
#define RAYTHEORY_HPP
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include "vecteur.hpp"
#include "utilities.hpp"
#include "minimization.hpp"
#include "structure.h"
/* Apply Snell Descartes law for an Isotropic medium
* Return 1 of refraction occured anf update ... | ALGO | 0.973491 | 4.755186 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2021-12-15T10:47:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1b7fd3bf39... |
df22c87a-6970-4e5d-ac9b-a49ba42462ed | marait123/cses-problemset | powerset.cpp |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <queue>
using namespace std;
#include <map>
#include <stack>
#define MAX_N 100000
#define ll long long
#define OO INT32_MAX
int sum(vector<ll> &vec)
{
ll res = 0;
for (size_t i = 0; i < vec.size(); i++)
... | ALGO | 0.999914 | 3.89018 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2021-03-03T16:34:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d7bf2d8822d5... |
a93335bb-2497-4b09-b226-868c4d444773 | ellishg/RubiksCube | Rubiks/solver.cpp | //
// solver.cpp
// Rubiks
//
// Created by <NAME> on 12/23/14.
// Copyright (c) 2014 <NAME>. All rights reserved.
//
#include "Rubiks.h"
void Rubiks::solveCube() {
/*
* Step 1: Create awesome algorithm that takes the current cube state
* and creates an array of moves to solve the... | ALGO | 0.999952 | 4.497684 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2015-03-23T23:13:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "44588723f4... |
350706b2-0564-4979-87f3-5afa4bcd61af | p1k4-piyush/submissions | CodeforcesCodeforcesRound1030Div.2/E_GridColoring.cpp | // You had to kill me, but it killed you just the same
// Cursing my name, wishing I stayed
// You turned into your worst fears
#include "bits/stdc++.h"
using namespace std;
#ifdef PIKA
#include "/Users/piyushkeshan/Documents/cpp_template_library/template/dbg.cpp"
#else
#define dbg(...)
#endif
typedef int64_t ll;... | ALGO | 0.999872 | 3.488949 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2025-03-24T07:00:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e5afd23a20d... |
7811126e-e3c8-49c7-9c04-9af6ee3a0a6d | vfolunin/archives-solutions | LeetCode/3145.cpp | class Solution {
pair<long long, long long> getBitCountAndSumTo(long long value) {
long long bitCount = 0, sum = 0;
for (int bit = 0; bit < 50; bit++) {
long long halfPeriod = 1LL << bit, period = halfPeriod * 2;
long long curBitCount = value / period * halfPeriod + max(0LL, ... | ALGO | 0.999858 | 5.986913 | {
"github_metadata": {
"branch": "master",
"commit_count": 2367,
"repo_created_at": "2017-11-27T10:19:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 1,
"pull_requests": 5
},
"file_meta": {
"content_id": "2f93985... |
c8fa285c-d140-4bfd-a908-38050f3869ef | ziglang/zig | lib/include/amxfp16intrin.h | /*===------------- amxfp16intrin.h - AMX_FP16 intrinsics -*- C++ -*---------===
*
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
* See https://llvm.org/LICENSE.txt for license information.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
*===----------------------------... | ALGO | 0.932729 | 6.184669 | {
"github_metadata": {
"branch": "master",
"commit_count": 34092,
"repo_created_at": "2015-08-06T00:51:28.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 40012,
"forks": 2915,
"issues": 3389,
"pull_requests": 267
},
"file_meta": {
"content_i... |
a65afb20-aa55-4259-b1e5-a7885fe29fd8 | schwarrx/imsense | supports/computeMaxFeasibleSet.cpp | /*
* computeMaxFeasibleSet.cpp
*
* Created on: Nov 29, 2018
* Author: nelaturi
*/
#include "computeMaxFeasibleSet.h"
#include <assert.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <set>
#include <iterator>
#include <iomanip> // std::setw
#include "helper.h"
af::array getMax... | ALGO | 0.999121 | 5.741489 | {
"github_metadata": {
"branch": "master",
"commit_count": 88,
"repo_created_at": "2014-10-23T02:08:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "667bf1cf4... |
6d473977-8e4e-4f87-b75d-d3ccca291a5f | s2003zy/leetcode | cpp/PartitionList.cpp | class Solution {
public:
void addNode(ListNode* &head,ListNode* &back,ListNode* &theNode)
{
if( head == NULL )
{
head = theNode;
back = theNode;
theNode = theNode -> next;
back->next=NULL;
return;
}
back->next = theNode;... | ALGO | 0.999982 | 5.436587 | {
"github_metadata": {
"branch": "master",
"commit_count": 75,
"repo_created_at": "2014-07-05T07:18:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "45d42a8f6... |
f0239b51-407a-46a2-baa2-b6e588d9d6ad | Kerorohu/PAT_Code | 1025.cpp | #include <iostream>
#include <algorithm>
#include <map>
using namespace std;
struct Node
{
int add, data, next;
}node[100000];
int main() {
map<int, Node> m;
int start, num, k, str;
cin >> start >> num >> k;
for (int i = 0; i < num; i++) {
cin >> str;
cin >> m[str].data >> m[str].next;
}
for (int i = 0; ... | ALGO | 0.999955 | 3.432277 | {
"github_metadata": {
"branch": "master",
"commit_count": 33,
"repo_created_at": "2020-09-13T07:11:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "57933293b... |
3e040678-6281-4bf2-89ec-4a0d281246a9 | briel0/cp-utilities | data-structures/seg.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int combina(int a, int b){
return a + b;
}
struct SegmentTree {
vector<int> original, seg;
int n;
SegmentTree(int size) : original(size + 1), seg(4 * size + 1){
n = size;
}
void build(int node = 1, int l = 1, int r =... | ALGO | 0.999919 | 3.681819 | {
"github_metadata": {
"branch": "main",
"commit_count": 81,
"repo_created_at": "2023-09-12T15:01:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e0e3215eb3a... |
f7715db9-50f8-40f4-a85b-bce117b3fda9 | AdamNbz/cf-solutions | 2063C.cpp | /*
Author : <NAME>
School : University of Information Technology, VNU-HCM
*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define fi first
#define se second
#define el '\n'
#define pb push_back
#define eb emplace_back
#define io() ios_base::sync_with_stdio(0); cin.tie(NU... | ALGO | 0.999818 | 4.893652 | {
"github_metadata": {
"branch": "main",
"commit_count": 184,
"repo_created_at": "2024-08-05T17:28:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0c2bc4456d... |
5ea18c1c-d8c7-402d-8a05-1d7338c1b58f | ishandutta2007/codeforces-z | zeliboba/normal/1616/A.cpp | #include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <unordered_map>
#include <queue>
#include <array>
#include <bitset>
#incl... | ALGO | 0.999307 | 3.8719 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:43:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "05673a361f04... |
ca61c860-eb58-41ec-a840-66fa1f16cdc7 | kchipson/sibsutis | 5 семестр/ArchitectureOfComputingSystems/labs/lab4/main.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <string.h>
#include <stdint.h>
int getParameters(int argc, char *argv[], long long &matrixSize){
for (int i = 1 ; i < argc ; i++)
{
if (strcmp("-s", argv[i]) == 0 || strcmp("--matrix-size", argv[i]) == 0)
{
... | ALGO | 0.995699 | 4.463035 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2021-10-06T08:09:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 19,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3296f778... |
32839116-ec96-4bdb-ae23-fd5e5222b4d0 | JCWiley/Reference-NN | NN.cpp | #include "NN.h"
NN::NN(long idum):seed(idum)
{}
int NN::get_num_input()
{
return num_input;
}
int NN::get_num_hidden()
{
return num_hidden;
}
int NN::get_num_output()
{
return num_output;
}
double NN::get_learning_rate()
{
return learning_rate;
}
//***************************************************
//creates a N... | ALGO | 0.986412 | 3.582738 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2015-11-18T00:02:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "83a1484d25... |
966290cc-6252-4da0-b1fd-a46dd30553c9 | Bowie-State-University/CS-Courses | COSC112_CS1/Source Code/Chapter 16 Source Code/Ch16_bubbleSort.cpp |
//Bubble sort
#include <iostream>
using namespace std;
void bubbleSort(int list[], int length);
int main()
{
int list[] = {2, 56, 34, 25, 73, 46, 89, 10, 5, 16}; //Line 1
int i; //Line 2
bubbleSort(list, 10); //Line 3... | ALGO | 0.999896 | 4.836059 | {
"github_metadata": {
"branch": "master",
"commit_count": 54,
"repo_created_at": "2015-12-18T02:48:49.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 15,
"forks": 13,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9443517a... |
fb2ef7a3-3dec-47b8-964c-73762d91ab51 | SUPERINTIALD/ComputerSystems_CSCI-2400 | lab4-perflab-SUPERINTIALD/FilterMain.cpp | #include <stdio.h>
#include "cs1300bmp.h"
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include "Filter.h"
using namespace std;
#include "rdtsc.h"
//
// Forward declare the functions
//
Filter * readFilter(string filename);
double applyFilter(Filter *filter, cs1300bmp *input, cs1300bmp *output);
int
m... | TOOL | 0.940408 | 4.44769 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2023-11-28T03:08:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d39997890a55... |
ada1e395-fc43-41e8-98ea-78460b43e065 | ErikAguilar15/SQLSendor2 | QueryCompiler.cc | #include "QueryCompiler.h"
#include "QueryOptimizer.h"
#include "Schema.h"
#include "ParseTree.h"
#include "Record.h"
#include "DBFile.h"
#include "Comparison.h"
#include "Function.h"
#include "RelOp.h"
#include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <limits>
using namespa... | TOOL | 0.95577 | 3.071416 | {
"github_metadata": {
"branch": "master",
"commit_count": 103,
"repo_created_at": "2019-03-02T00:22:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "de061f83... |
2d30398d-5eec-45a9-a46f-1e77364f8f60 | chandan11248/DSA | linkedlist/singlyLinked.cpp | #include <iostream>
using namespace std;
class Node {
private:
int val;
Node *next;
public:
Node(int val) : val(val), next(nullptr) {}
static void insertAtHead(Node* &head, int data) {
Node *newNode = new Node(data);
newNode->next = head;
head = newNode;
}
static void... | ALGO | 0.999883 | 6.212045 | {
"github_metadata": {
"branch": "main",
"commit_count": 26,
"repo_created_at": "2025-06-10T17:24:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "292205206bd... |
9da5aca4-a36a-4de8-bd58-3d2b075b5b73 | giovaneaf/CompetitiveProgramming | Contests/South America ICPC/2017/C.cpp | /*
Count frequencies and check the possible cases:
if the least frequent value + 2 is equal to the highest frequent value and all between then are equal to
least frequent value + 1 then you need to change the highest frequent to the least frequent.
else if the least frequent value is one less then all other values the... | ALGO | 0.99998 | 3.610661 | {
"github_metadata": {
"branch": "master",
"commit_count": 90,
"repo_created_at": "2018-04-30T20:31:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "326e47a11... |
d0e37f55-ec84-4e81-8845-53a5e2a7eec0 | jvdss/Biblioteca | library/grafos/bridgeTree.cpp | // BridgeTree
// 2-edge connected component
// For each pair of vertices {A, B} inside the same connected component,
// there are at least 2 distinct paths in edges from A to B (may repeat vertices).
// g: u -> { v, edgeId }
vector<pair<int,int>>> g(MAX);
vector<int> gc[MAX];
int timer;
int tin[MAX], low[MAX], comp[M... | ALGO | 0.999584 | 5.174328 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-05-25T14:10:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bdfcaa5f1602... |
f13df582-1727-4aca-baa5-3a0c8eec5f53 | mtalhaYAYLA/Elginkan_Vakfi_CPP-Kursu | ödevler4/Exercise1.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
// Fonksiyonlar
int varmi(int dizi[], int boyut, int aranan)
{
for (int i = 0; i < boyut; i++)
{
if (dizi[i] == aranan)
{
return 1; // Eşleşen sayı var
}
}
return 0; // Eşleşen sayı yok
}
i... | ALGO | 0.999111 | 3.844023 | {
"github_metadata": {
"branch": "main",
"commit_count": 25,
"repo_created_at": "2023-07-25T09:27:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f8a7ed51203... |
77b91803-c937-4bce-bb2c-7e44d9d71251 | sagarsingla14/Codechef | 271D.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
ll ans = 0;
ll dp[100001][2];
ll t , k , a , b;
ll sum[100001];
// 1859 48096
// 75634 80941
// 27808 89615
// 58867 93494
void fillDP() {
dp[0][0] = 0;
dp[0][1] = 0;
for(ll i = 1 ; i < k ; i++) {
dp[i][1]... | ALGO | 0.999781 | 4.816705 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-09-16T18:20:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8919c1bb66... |
207ff831-13ed-48f9-a3f7-2804a6f518e9 | denangelov/CS31 | Project1/logic_error.cpp | // Code for Project 1
// Report poll results
#include <iostream>
using namespace std; // pp. 38-39 in Savitch 6/e explains this line
int main()
{
int numberSurveyed;
int forNewsom;
int forCox;
cout << "How many registered voters were surveyed? ";
cin >> numberSurveyed;
//logic error #1 - as... | ALGO | 0.993218 | 4.476327 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-11-24T20:45:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "67a173c0ec... |
e5b72a7d-de98-4d15-ba42-7c75cbf3324b | Parvejprv/CPP-DSA-180-Days | Day 018 Functions/misc/homework/2_reverse-a-number-using-function.cpp | /*
Question:-
----------
2. Reverse a Number n using the Function,
Constraints : -5000 <= n <= 5000
*/
#include<iostream>
using namespace std;
// Method to reverse the number
int Reverse(int num) {
int sign = 1;
// Check if the number is negative
if(num < 0) {
sign = -1;
num = -num;
}
if(num > 50... | ALGO | 0.999905 | 4.530018 | {
"github_metadata": {
"branch": "main",
"commit_count": 214,
"repo_created_at": "2024-03-13T11:26:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e476a493b0... |
13a8e280-561e-444a-aceb-a7427457c622 | MansiSMore/CodeChef_Solutions | COMPRESSVD.cpp | /*
Chef recorded a video explaining his favorite recipe. However, the size of the video is too large to upload on the internet.
He wants to compress the video so that it has the minimum size possible.
Chef's video has N frames initially. The value of the ith frame is Ai. Chef can do the following type of operation any... | ALGO | 0.999869 | 5.003503 | {
"github_metadata": {
"branch": "main",
"commit_count": 352,
"repo_created_at": "2021-05-02T14:09:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9efb0cde67... |
cd7e2a6d-8564-4bd5-936d-70f8bb4ea13e | Miyaya/107_minimal-network | minimal-network-kruskal.cpp | #include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
#define N 40
int find_set(int *set, int);
int main()
{
// read the file, generate the graph
// ifstream file("example.txt");
ifstream file("p107_network.txt");
string str;
int weight[N][N] = {0};
if (!file)
{
... | ALGO | 0.999881 | 3.901654 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2022-03-17T17:05:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5e215d0003... |
561d9fee-bde9-4432-9531-17c75fd459e9 | powergee/CompetitiveProgramming | 2019-2021/2학년 2학기/기타/고층 건물.cpp | #include <iostream>
int n;
int heights[50];
double slopes[50][50];
int main()
{
scanf("%d", &n);
for (int i = 0; i < n; ++i)
scanf("%d", heights+i);
for (int i = 0; i < n; ++i)
for (int j = i+1; j < n; ++j)
slopes[i][j] = ((double)heights[j]-heights[i])/(j-i);
in... | ALGO | 0.999986 | 3.77897 | {
"github_metadata": {
"branch": "master",
"commit_count": 834,
"repo_created_at": "2020-05-24T17:14:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0978d11e... |
f679de1f-a5d2-4e2b-a974-09447ea40885 | Shahbaz898414/CP-concept | level-3/Week-2/Question/B. Sheldon and Ice Pieces.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lld long long int
int convert(char s)
{
if (s == '2')
return 5;
else if (s == '9')
return 6;
else
return s - '0';
}
int main()
{
ll n, k;
// cin >> n;
string s, t;
cin >> s >> t;
int c = 0, ac = 0, bc = 0;
int a... | ALGO | 0.99986 | 3.802169 | {
"github_metadata": {
"branch": "master",
"commit_count": 844,
"repo_created_at": "2023-04-14T10:40:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eacc0808... |
18b6597c-8b42-4641-8273-a185daeca58b | yumengwu/LeetCode | algorithms/0005-Longest-Palindromic-Substring/5.cpp | #include "../header.h"
class Solution {
public:
string longestPalindrome(string s) {
if (s.length() == 0) {
return "";
}
int index = 0;
int len = 1;
int oddOrEven = 1;
for (int i = 0; i < s.length(); ++i) {
int odd = searchOdd(s, i);
... | ALGO | 0.999973 | 5.203902 | {
"github_metadata": {
"branch": "master",
"commit_count": 46,
"repo_created_at": "2019-11-20T20:25:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "32405792b... |
68b01f86-d97f-4133-9e8f-12ff03aa0a0f | K1XE/LeetCode | 1.数组/6.螺旋矩阵II/59.螺旋矩阵-ii copy.cpp | /*
* @lc app=leetcode.cn id=59 lang=cpp
*
* [59] 螺旋矩阵 II
*/
// @lc code=start
class Solution {
public:
vector<vector<int>> generateMatrix(int n) {
int l = 0, r = n - 1, t = 0, b = n - 1;
int cnt = 1;
vector<vector<int>> res(n, vector<int> (n, 0));
while (... | ALGO | 0.99994 | 6.590473 | {
"github_metadata": {
"branch": "main",
"commit_count": 183,
"repo_created_at": "2025-04-12T03:26:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2d82c2b159... |
3fba9c77-254c-4bfc-a89b-d927e9270249 | Dendlian/Game_Programming | Step1/Step1_1/01_RSP.cpp | #include <iostream>
#include <time.h>
using namespace std;
// Rock Paper Scissors Game
int main()
{
int nCom, nPlayer;
int cCom = 0;
int cPlayer = 0;
while (1)
{
cout << "1.ROCK 2.SCISSORS 3.PAPER : ";
cin >> nPlayer;
nCom = rand() % 3;
if (nCom == nPlayer)
cout << "DRAW" << endl << endl;
else if ((... | ALGO | 0.998822 | 3.75835 | {
"github_metadata": {
"branch": "main",
"commit_count": 26,
"repo_created_at": "2021-08-12T09:02:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "971c87b5284... |
f946062b-bff8-4ad8-9ed1-1dc9884e5688 | jamesdjuhartono/UVa-Problems | src/p156.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <ctype.h>
using namespace std;
int main()
{
int idx = 0, counter, size = 0;
string input, lc_inp;
string orig[1010], lc[1010];
vector<string> ananagrams;
while(cin >> input && input != "#")
{
orig[id... | ALGO | 0.999164 | 3.6418 | {
"github_metadata": {
"branch": "master",
"commit_count": 54,
"repo_created_at": "2012-12-02T04:39:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4f258408b... |
7f67cc08-75f3-4cb7-8fff-4a567446079a | kwanmo7/algorithm-cpp | ex06/ex06.cpp | #include <iostream>
#include <fstream>
#include <filesystem>
#include <vector>
#include <string>
#include <algorithm>
#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_WARNINGS
namespace fs = std::filesystem;
using namespace std;
static int calc(const string& inputfilename, const string& outputfilename) {
if... | ALGO | 0.976957 | 3.81619 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2024-08-12T06:58:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "663480c1ca5... |
6bfec7a9-c1d7-455d-8adf-d3a9fbbd6b1f | raincross7/code-similarity | codes/train_code/problem416/problem416_261.cpp | #include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;
ll Pow10[11];
char c;
int main() {
Pow10[0] = 1;
for (int i = 1; i < 11; ++i) {
Pow10[i] = Pow10[i -... | ALGO | 0.999899 | 3.453393 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-03-06T05:07:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5e5954a70ff4... |
0841b73a-fc4b-4cce-a423-90572a4a5747 | ehpoppele/Lab9 | BHeap.cc | #include "BHeap.hh"
Heap::Heap(std::vector<HTree::tree_ptr_t> elements)
{
elements_ = elements;
build_heap();
}
int Heap::size() const
{
return elements_.size();
}
//Adds the requested node into the heap structure
//Accomplishes this recursively by checking the value
//of the parent node
void Heap::heapi... | ALGO | 0.952526 | 4.621624 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2018-11-08T08:26:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d13e668884... |
7c7e1849-68d6-4d03-90f5-32dcf68233bc | jabawane1/DataFeeder | main.cpp | #include <tabulate/asciidoc_exporter.hpp>
#include <bits/stdc++.h>
#include <unistd.h>
#include <typeinfo>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <random>
#include <chrono>
#include <thread>
#include <deque>
#include <ctime>
#include <cm... | TOOL | 0.907015 | 4.828868 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-07-01T09:13:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e5a2c8b14f9a... |
8cb842c4-2dcb-4285-9696-3047b33e633f | 1105Lakshya/DSA-TOPIC-WISE | 14_STACK/28_NUMBER_OF_VISIBLE_PEOPLE_IN_QUEUE.cpp | /*
1944. Number of Visible People in a Queue
Hard
1.4K
38
Companies
There are n people standing in a queue, and they numbered from 0 to n - 1 in left to right order. You are given an array heights of distinct integers where heights[i] represents the height of the ith person.
A person can see another person to their ri... | ALGO | 0.999996 | 6.181867 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2023-07-12T17:47:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a8931ddaf518... |
f22de169-c7e2-4fb6-877c-975a34f4a472 | Virajpatil092/CNS-Lab | A2/RailFenceCipher.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
string railFenceEncrypt(string text, int key)
{
if (key <= 1)
return text;
vector<string> rail(key);
int row = 0;
int dir = 1;
for (int i = 0; i < text.length(); i++)
{
rail[row] += text[i];
if (... | ALGO | 0.999973 | 5.120695 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-11-12T07:18:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2402139ccf8b... |
8f7ad54a-52de-44f9-9d0d-057ab90e4c73 | mostafa-saad/MyCompetitiveProgramming | Olympiad/POI/official/2007/code/wag/prog/wags4.cpp | /*************************************************************************}
{* *}
{* XIV OI *}
{* *}
{* Zadanie: <N... | ALGO | 0.999728 | 3.622717 | {
"github_metadata": {
"branch": "master",
"commit_count": 439,
"repo_created_at": "2017-02-05T22:26:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 415,
"forks": 85,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d827e... |
41a61b33-e46c-431a-b6a8-c98341bf6bdc | viennamesh/viennamesh-dev | plugins/vgmodeler/external/meshing/findip.hpp | // find inner point
inline void Minimize (const ARRAY<Vec3d> & a,
const ARRAY<double> & c,
int * act,
Vec<3> & x, double & f,
int * sol)
{
int act1[4];
Mat<3> m, inv;
Vec<3> rs, xmax, center;
f = 1e99;
for (int j = 0; j < 5; j++)
{
for (int hk = 0, k = 0; hk < 4... | ALGO | 0.999928 | 3.87516 | {
"github_metadata": {
"branch": "master",
"commit_count": 1333,
"repo_created_at": "2013-07-25T10:54:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 12,
"issues": 9,
"pull_requests": 0
},
"file_meta": {
"content_id": "ac68a9... |
78f9b1c8-bb0c-4f8e-9c19-fed59b6590c1 | trykilla/Clase_ejers | Examen/philos.cpp | #include <iostream>
#include <thread>
#include <queue>
#include <condition_variable>
#include <vector>
#include <memory>
#include <algorithm>
#include <ctime>
#define NUM_PHILOS 5;
void philo(int id);
std::vector<int> forks;
std::vector<std::thread> v_threads;
std::mutex g_mtx;
std::condition_variable pito;
int mai... | ALGO | 0.992463 | 4.628192 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-05-24T17:37:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "45d8105adc3a... |
34d74670-5aa1-4ff2-86f9-95b9ba2b8104 | Twice22/acceleratedcpp | Chapter7/chapter7.9/chapter7.9/chapter7.9.cpp | // chapter7.9.cpp : définit le point d'entrée pour l'application console.
//
#include "stdafx.h"
#include <stdexcept>
#include <iostream>
#include <vector>
#include <random>
#include <ctime>
using namespace std;
int nrand(int n);
int nrand_aux(int n) {
const int bucket_size = n % RAND_MAX == 0 ? n / RAND_MAX : n /... | TOOL | 0.99384 | 3.671757 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2017-05-29T06:06:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9e1a0a94af... |
f92b480a-958a-4b6a-a130-5538b0ba01c2 | ethliup/MBA-VO | test/test_blur_aware_tracker_modules.cpp | #include "core/common/CustomType.h"
#include "core/common/Random.h"
#include "core/common/Spline.h"
#include "core/common/Time.h"
#include "core/image_proc/Gradient.h"
#include "core/measurements/Image.h"
#include "core/sensors/CameraPinhole.h"
#include "core/states/Transformation.h"
#include "utils/ImShow.h"
#include ... | ALGO | 0.955318 | 5.622474 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2021-08-17T05:32:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 55,
"forks": 6,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "c1c28aabcd7... |
de3d6966-e0ab-4c6c-8bf2-1230ced926ef | NguyenLabJHU/Tahoe-FEM | tahoe/src/elements/continuum/solid/materials/nlcsolver/NLCSolver.h | /*
File: NLCSolver.h
*/
#ifndef _NLC_SOLVER_H_
#define _NLC_SOLVER_H_
#include <iostream>
#include "StringT.h"
#include "dArrayT.h"
#include "LAdMatrixT.h"
#include "NewtonMethodBase.h"
namespace Tahoe {
class NLCSolverWrapperPtr;
class NLCSolver
{
friend class NewtonMethodBase;
public:
// enum variable ... | ALGO | 0.995785 | 6.337633 | {
"github_metadata": {
"branch": "master",
"commit_count": 8283,
"repo_created_at": "2024-02-10T06:20:14.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "78b18bea... |
1bfc2f25-589b-4d05-87cc-b9a6c67c69b5 | ucb-cyarp/vitis | src/Passes/MultiThreadPasses.cpp | //
// Created by <NAME> on 10/4/19.
//
#include "MultiThreadPasses.h"
#include "PrimitiveNodes/Delay.h"
#include "PrimitiveNodes/TappedDelay.h"
#include "General/GraphAlgs.h"
#include "GraphCore/ExpandedNode.h"
#include "Blocking/BlockingDomain.h"
#include <iostream>
#include "GraphCore/Context.h"
void MultiThreadPa... | ALGO | 0.912767 | 5.305191 | {
"github_metadata": {
"branch": "master",
"commit_count": 1054,
"repo_created_at": "2018-06-25T17:34:53.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 43,
"pull_requests": 2
},
"file_meta": {
"content_id": "c072071... |
995eb125-6701-4f8e-92d0-8cead3c85e06 | ChillChiliStudio/Order227 | Order_227/Motor2D/Pathfinding.cpp | #include "Defs.h"
#include "Log.h"
#include "App.h"
#include "PathFinding.h"
PathFinding::PathFinding() : Module(), map(NULL), width(0), height(0)
{
name.assign("pathfinding");
}
// Destructor
PathFinding::~PathFinding()
{
RELEASE_ARRAY(map);
}
// Called before quitting
bool PathFinding::CleanUp()
{
LOG("Freeing ... | ALGO | 0.986834 | 3.330814 | {
"github_metadata": {
"branch": "master",
"commit_count": 826,
"repo_created_at": "2019-03-04T21:11:37.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bef558802... |
fb09bac7-f09c-41a1-bc69-d2b42c5ad4b6 | axelu/leetcode | cpp/01500-01999/longestpalindromicsubsequenceii.cpp |
// 1682. Longest Palindromic Subsequence II
// https://leetcode.com/problems/longest-palindromic-subsequence-ii/
class Solution {
public:
int longestPalindromeSubseq(string& s) {
int n = s.size();
/* good palindrome:
* It is a subsequence of s.
* It is a palindrome (h... | ALGO | 0.999947 | 5.643793 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2021-04-08T21:22:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "21a8e69a8b3... |
4abb5518-66b0-46b9-85f6-614547d03681 | PapaVinS/PapaCoding-HP | AlgoStruk/program-queue.cpp | #include <iostream>
using namespace std;
#define MAX 5
class queue
{
private:
int t[MAX];
int al;
int dl;
public:
queue()
{
dl=-1;
al=-1;
}
void del()
{
int tmp;
if(dl==-1)
{
cout<<"Queue koson... | ALGO | 0.990937 | 3.817626 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2018-12-04T12:31:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8a87ba025... |
c7ea7f4d-6188-433d-8937-554510fcb4c6 | 984727216/oj1 | POJ/3279/12869685_AC_422ms_712kB.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 20;
int res[MAXN][MAXN];
int tmp[MAXN][MAXN];
int state[MAXN][MAXN];
int grid[MAXN][MAXN];
int n, m;
int ans;
const int INF = 0x3f3f3f;
int dist[5][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {0, 0}};
void flip(int x, int y){
... | ALGO | 0.999969 | 3.787024 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2018-04-07T13:21:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f56159356... |
f5d4e4d6-2d8d-49d4-a71d-5b42ee44facb | zhudaiwang/OS_Server_MFC | SERVER/SERVER/DAL_list.cpp | #include "stdafx.h"
#include "list.h"
PLIST_HEADER_T Link_Init()
{
PLIST_HEADER_T pstTopNode =(PLIST_HEADER_T)malloc(sizeof(LIST_HEADER_T));
if (pstTopNode == NULL)
{
return NULL;
}
pstTopNode->nNodeCount = 0;
pstTopNode->pstFirstNode = NULL;
pstTopNode->pstLastNode = NULL;
return pstTopNode;
}
PLIST_NO... | ALGO | 0.957441 | 3.215243 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2014-07-22T03:51:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bfe88813cf... |
d58233b6-d0a4-4814-bb33-b39c7e92e5b4 | alexandraback/datacollection | solutions_5631989306621952_0/C++/mickeyandkaka/main.cpp | #include <cassert>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typede... | ALGO | 0.999982 | 3.834563 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2017-03-08T11:33:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "24de6a94b... |
8a157e12-6160-4fc7-b019-dafdf5622a00 | ivanavd11/Data_Structures_and_Algorithms_FMI_2024-25 | Week 5/Practicum/merge-two-sorted-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* mergeTwoLis... | ALGO | 0.999917 | 6.001221 | {
"github_metadata": {
"branch": "main",
"commit_count": 66,
"repo_created_at": "2024-10-11T18:13:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "76804aedd29... |
c4d91313-92c2-4d8a-ab95-222a8fef8597 | nmatlakhov/Intro-to-Algorithms | Sprint_8/Finals/Old/Code_to_Final_1.cpp | /*
https://contest.yandex.ru/contest/26133/run-report/84059091/
ПРИНЦИП РАБОТЫ:
1) Рекурсивный разворот запакованной строки в полную/обычную строку;
2) Записываем все полные строки в вектор и сортируем его;
3) Возьмем первую строчку из сортированного вектора и последнюю. Найдем минимальную длину из двух строк;
4) Посим... | ALGO | 0.999638 | 4.628725 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2023-07-09T23:35:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "96e4f15917... |
0d9f6ed0-abb5-41d8-aab6-893526786e94 | HExSA-Lab/nautilus | src/legion_runtime/lowlevel_impl.h | /* Copyright 2014 Stanford University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... | TOOL | 0.905334 | 6.149426 | {
"github_metadata": {
"branch": "master",
"commit_count": 853,
"repo_created_at": "2018-08-03T01:53:57.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 46,
"forks": 66,
"issues": 6,
"pull_requests": 2
},
"file_meta": {
"content_id": "08a437f... |
7f97a5e3-8b37-412c-8ea8-02fcef388c4a | MakeContributions/DSA | algorithms/CPlusPlus/Stacks/infix-to-prefix.cpp | /*
Program to convert a infix expression to prefix expression a.k.a Polish Notation.
Infix expression : An expression in which the operator appears between the two operands.
Prefix expression : An expression in which the operator appears before the operands.
*/
/*
LOGIC
1. Initialize the Stack.
... | ALGO | 0.999701 | 5.844396 | {
"github_metadata": {
"branch": "main",
"commit_count": 655,
"repo_created_at": "2020-12-16T13:54:52.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 809,
"forks": 806,
"issues": 79,
"pull_requests": 212
},
"file_meta": {
"content_id": "20be... |
fa6c4eee-13ef-40b2-9a52-2b06c089bf76 | amey16/Just-cp-- | trees/Generic-Trees-1/isSymmetric.cpp | #include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
using namespace std;
struct Node{
int data;
vector<Node*> children;
};
Node* newNode(int data){
Node *temp = new Node;
temp->data = data;
return temp;
}
vector<int> node_root(Node* node,int val){
if(node->da... | ALGO | 0.999989 | 4.21989 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2021-06-22T16:22:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2f6fa0565... |
242bd6ff-3a0a-4536-aeb5-fc0176e09b9a | publicrepo/rtree | MemoryTest.cpp | #include <stdio.h>
#include <memory.h>
#include <crtdbg.h>
#include "RTree.h"
//
// MemoryTest.cpp
//
// This demonstrates a use of RTree
//
// Use CRT Debug facility to dump memory leaks on app exit
#ifdef WIN32
// These two are for MSVS 2005 security consciousness until safe std lib funcs are available
#pragm... | TEST | 0.941041 | 5.206908 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2015-02-22T05:12:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "157f984ddb... |
f4cff562-3bac-4cbf-b2a4-d07626a7cb34 | 2Vedant8/Data-Structures-and-Algorithms-using-Cpp | Arrays/Intersection_of_arrays.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cout << "Enter the no. of elements of 1st Array : " << endl;
cin >> n;
cout << "Enter the no. of elements of 2nd Array : " << endl;
cin >> m;
vector<int> brr(m);
vector<int> arr(n);
cout << "Enter the elements of 1st Ar... | ALGO | 0.99996 | 4.164353 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2023-03-14T14:13:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cd3c6dff5... |
1faeae26-9536-4a77-a567-2ede0d12db65 | shoaibrayeen/Data-Structures-and-Algorithms | DATA STRUCTURES/Binary Tree/Left , Right and Boundary View/code_1.cpp | //
// code_1.cpp
// Data Structure
//
// Created by <NAME> on 19/03/18.
// Copyright © 2018 <NAME>. All rights reserved.
//
#include<iostream>
using namespace std;
struct bnode {
/*
------------------------------------------------------------------------------------------------
objective : cre... | ALGO | 0.999673 | 3.604483 | {
"github_metadata": {
"branch": "master",
"commit_count": 1094,
"repo_created_at": "2018-09-03T08:37:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 34,
"forks": 30,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "94669... |
baa5b878-dd05-4d69-bfec-953e49176c85 | luisfilipels/Estudos-Maratona | NepsAcademy/Utils/ContagemDeInversoes.cpp | //
// Created by luisf on 02/06/2020.
//
#include <bits/stdc++.h>
using namespace std;
int inversions (vector<int> v) {
int inversoes = 0;
for (int i = 0; i < v.size(); i++) {
for (int j = i + 1; j < v.size(); j++) {
if (v[i] > v[j]) {
inversoes++;
}
}
... | ALGO | 0.999895 | 4.963984 | {
"github_metadata": {
"branch": "master",
"commit_count": 52,
"repo_created_at": "2020-05-21T18:58:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4ec4bf804... |
3b1a74d0-452f-4ab8-b274-3e2dcd0b7662 | NadineAB/MPC-Meshing_Point_Clouds | include/CGAL/RS/sign_1.h | // Copyright (c) 2006-2010 Inria Lorraine (France). All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your o... | ALGO | 0.999136 | 6.242764 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2015-12-18T21:22:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 22,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fd5674a4... |
ae2aa57b-7481-4e94-b848-2882682524de | MishkatIT/codeforces-atcoder-submissions | codeforces/242/242C King_s Path.cpp | /*
author : MishkatIT
created : Saturday 2024-02-17-16.13.02
*/
#include<bits/stdc++.h>
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug(_) cout << #_ << " is " << _ << '\n';
#define int long long
using namespace std;
using ll = long long;
using ld = long double... | ALGO | 0.999769 | 4.351566 | {
"github_metadata": {
"branch": "main",
"commit_count": 1762,
"repo_created_at": "2023-10-28T07:54:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "abc1d3887... |
ca553dc4-8dd5-4b4a-a3e5-45de017bfeea | TadasBaltrusaitis/OpenFace | lib/local/LandmarkDetector/include/FaceDetectorMTCNN.h | ///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017, <NAME>, all rights reserved.
//
// ACADEMIC OR NON-PROFIT ORGANIZATION NONCOMMERCIAL RESEARCH USE ONLY
//
// BY USING OR DOWNLOADING THE SOFTWARE, YOU ARE AGREEING TO THE TERMS OF THIS LICENSE AGREEMENT.
// IF YOU D... | TOOL | 0.958648 | 4.176905 | {
"github_metadata": {
"branch": "master",
"commit_count": 733,
"repo_created_at": "2016-03-05T20:08:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7330,
"forks": 1880,
"issues": 339,
"pull_requests": 18
},
"file_meta": {
"content_id": ... |
eda47984-43b3-444c-87dc-a00c46fd70eb | NickWroble/CSCI-2270-Data-Structures | Homeworks/Homework 3/CUBuildingNetwork.cpp | /****************************************************************/
/* CUBuildingNetwork Implementation */
/****************************************************************/
/* TODO: Implement the member functions of class CUBuildingNetwork */
/* This class uses a linked-list of CUBuil... | TOOL | 0.961377 | 4.180688 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-12-06T19:36:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "af590f5c10... |
7c637109-d5b5-4772-9be8-cab4d31b2bb1 | lcy960729/Algorithm_Solution_Collection | Baekjoon/implement/11718.cpp | //
// Created by CY on 2020-09-28.
//
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#define pii pair<int, int>
#define ll long long
#define Int_MAX 1e9
#define LL_MAX 3e18
using namespace std;
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
ios::sync_with... | ALGO | 0.999883 | 4.062588 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2020-10-19T13:03:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "85d12961d31... |
6c73fc09-5a8b-413b-ac70-ce3642bcb81a | KuznetsovKarazin/SBGen-A-High-Performance-Library-for-Rapid-Generation-of-Cryptographic-S-boxes | include/cost_function.h | // Cost functions implementation
#ifndef _COST_FUNCTION_H_
#define _COST_FUNCTION_H_
#include <algorithm>
#include <array>
#include <cstdint>
#include <cassert>
#include "sbox_properties.h"
namespace sbgen {
/**
* @brief Holds S-box cost and nonlinearity
**/
template <typename T>
struct cost_info_t {
// S-box co... | ALGO | 0.990135 | 4.657762 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-11-10T12:37:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "532e54136c6d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.