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 |
|---|---|---|---|---|---|---|---|
98f372f1-b3c5-4b64-aa20-43bd440749c6 | ulhaspawar/DSA | src/longest_string_chain.cpp | #include <algorithm>
#include <vector>
#include <unordered_map>
#include <string>
using namespace std;
unordered_map<string, pair<string, int>> initMap(const vector<string> &strs);
vector<string> getStringChain(const unordered_map<string, pair<string, int>> &map);
string findLongestChainStart(const unordered_map<stri... | ALGO | 0.999988 | 5.417662 | {
"github_metadata": {
"branch": "main",
"commit_count": 35,
"repo_created_at": "2022-02-23T13:59: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": "95b63890218... |
d75fdf42-c84c-45bb-9262-575ce4c5f937 | bebac/fuzzy-octo-avenger | src/player_queue.h | // ----------------------------------------------------------------------------
//
// Filename : player_queue.h
//
// Author : <NAME> <<EMAIL>>
// Copyright (C) 2014
//
// --- Description: -----------------------------------------------------------
//
//
// -------------------------------... | ALGO | 0.964341 | 6.872482 | {
"github_metadata": {
"branch": "master",
"commit_count": 110,
"repo_created_at": "2014-08-31T19:47: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": "86e3d7e6... |
9f22bcbb-f9dd-4f85-96e7-ac122d285f8b | qhb1001/For-that-dream | Online Contest/NanNing2018/B.cpp | /**
*
* Written by Air
* 寒域
* 数论模板
*
* 需要include:
* vector
* cstdlib
* Algorithm
* cstring
*
* **/
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdlib>
using namespace std;
class NumberTheory {
public:
// 预打标后的数的最小因子
s... | ALGO | 0.999918 | 4.052993 | {
"github_metadata": {
"branch": "master",
"commit_count": 126,
"repo_created_at": "2018-04-11T00:45:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c5ca8eca... |
c9038df3-11ba-4aae-a1b8-5524728685a2 | hra06/Data-Structures-Using-Cpp | Dynamic Programming 1/stairCase.cpp | // A child is running up a staircase with n steps and can hop either 1 step, 2 steps or 3 steps at a time. Implement a method to count how many possible ways the child
// can run up to the stairs. You need to return all possible number of ways.
// Time complexity of your code should be O(n).
#include <iostream>
using ... | ALGO | 0.999967 | 4.081892 | {
"github_metadata": {
"branch": "master",
"commit_count": 61,
"repo_created_at": "2020-06-25T12:11:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c013a5276... |
8bd66320-6626-4b55-8fcb-4a84503cde1d | Laanith/DSA | Graphs/Medium/TopologicalSort_GFG.cpp | #include<bits/stdc++.h>
#include<algorithm>
#define ll long long
#define PYES cout<<"YES"<<endl
#define PNO cout<<"NO"<<endl
#define PMINUS cout<<-1<<endl
#define vi vector<int>
#define vll vector<long long>
#define vpi vector<pair<int,int>>
#define vs vector<string>
#define qi queue<int>
#define si stack<int>
#define ... | ALGO | 0.999993 | 4.504853 | {
"github_metadata": {
"branch": "main",
"commit_count": 350,
"repo_created_at": "2023-08-08T04:08: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": "28c3a7d534... |
cba917ee-64c1-4ecd-8672-8d5279ad1335 | apache/cloudberry | src/backend/gporca/libgpopt/include/gpopt/search/CJobGroupExpressionImplementation.h | //---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2011 EMC Corp.
//
// @filename:
// CJobGroupExpressionImplementation.h
//
// @doc:
// Explore group expression job
//---------------------------------------------------------------------------
#ifndef ... | ALGO | 0.987208 | 6.942099 | {
"github_metadata": {
"branch": "main",
"commit_count": 71549,
"repo_created_at": "2023-05-24T06:58:16.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1000,
"forks": 167,
"issues": 104,
"pull_requests": 50
},
"file_meta": {
"content_id": "6... |
4321223a-f3fd-4b83-9ffe-833957e6deaa | PFelsen/Bachelor_Thesis_Karlsruhe_2024 | mpp/src/lib1_math/spectrum/IASpectrum.cpp | #include "IASpectrum.hpp"
#include <IACInterval.hpp>
template<typename IAMATRIX, typename EVALUES, typename EVECTORS>
void EVrealEnclosures(const IAMATRIX &A, const IAMATRIX *B, const EVALUES &l, const EVECTORS &x,
IAEigenvalueEnclosures &Lambda) {
int R = l.size();
double r0 = 0.0;
double... | ALGO | 0.975643 | 6.165043 | {
"github_metadata": {
"branch": "main",
"commit_count": 96,
"repo_created_at": "2024-06-27T15:14:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "63f8db0284c... |
fa6774d5-6341-44c9-a937-51a5b89499db | pseong/ProgramSolving | Codeforces/Codeforces Round #796 (Div. 2)/C.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pi=pair<int, int>;
using pll=pair<ll, ll>;
ll gcd(ll a, ll b) { for (; b; a %= b, swap(a, b)); return a; }
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T; cin >> T;
while (T--) {
int n; cin >> n;
vecto... | ALGO | 0.999977 | 3.951412 | {
"github_metadata": {
"branch": "main",
"commit_count": 2105,
"repo_created_at": "2021-01-25T02:47: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": "00532e040... |
c677e4b1-29f1-4c59-9e66-b0a4dc15e5cf | farokhmahmoodi/c_plus_plus_programming_challenges | ch6 Functions/6-7 Most Fuel Efficient Car.cpp | /*Three cars drive a 500 mile route. Write a program that inputs the car make and the number of gallons of fuel used by each car.
After calling a calcMPG() function once for each car, have main determine and display which car was the most fuel efficient and how many miles per gallon it got. The calcMPG() function shou... | ALGO | 0.998277 | 5.678441 | {
"github_metadata": {
"branch": "main",
"commit_count": 894,
"repo_created_at": "2023-11-17T18:55:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a4d44f2121... |
1791a32d-fd90-4809-a8e6-af60fbcc1d7f | watemus/cp-prog | codeforces/cf639/A.cc | //
// Created by watemus on 03.05.2020.
//
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ff first
#define ss second
using ll = long long;
using ld = long double;
#define int ll
constexpr ll INF... | ALGO | 0.999754 | 5.278479 | {
"github_metadata": {
"branch": "master",
"commit_count": 52,
"repo_created_at": "2020-03-24T15:44:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0365e4a07... |
97cc9c21-4e9a-4e0a-b665-db236ecdaff0 | DHEERAJHARODE/Hacktoberfest2024-Open-source- | binary_tree.cpp | //Constructing a binary tree using structure and implementing various operations
//OPERATIONS: preorder, postorder, inorder traversal by creating structures
#include<iostream>
#include<iomanip>
using namespace std;
struct binaryTree{
int val;
struct binaryTree* l; //left branch
struct binaryTree* r; //r... | ALGO | 0.999943 | 4.766305 | {
"github_metadata": {
"branch": "main",
"commit_count": 945,
"repo_created_at": "2020-10-03T04:58:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 473,
"forks": 3840,
"issues": 177,
"pull_requests": 1367
},
"file_meta": {
"content_id": "... |
b8f01b4b-27e9-45a7-a3aa-0001eea4d7a8 | rask24/atcoder_prac | archive/a.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N, M;
cin >> N >> M;
vector<vector<int>> X(M);
vector<vector<bool>> exist(N, vector<bool> (N, false));
for (int i = 0; i < M; ++i) {
int k;
cin >> k;
X[i].resize(k);
for (int j = 0; j < k; ++j) {
cin >> X[i][j];
--X[i][j];
}
}
for (i... | ALGO | 0.999984 | 4.067845 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2022-12-02T14:43: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": "02228b5a242a... |
e429144c-8891-4ece-aa7a-bbc741fbc31d | MuhammadAffanWahid/Polynomials | Source.cpp | #include<iostream>
#include<fstream>
using namespace std;
#include<windows.h>
#include "POLYN.h"
void coolor(int k)
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, k);
}
//
//void Readpoly(int& poly_size, POLYN*& polynomials, const char* FN)
//{
// ifstream read(FN);
// rea... | ALGO | 0.999168 | 4.014151 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-09-28T10:56: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": "1070a423844f... |
1a3c00d5-fba7-4c1a-ad73-6f0003b555cd | ziglang/zig | lib/libcxx/include/__functional/compose.h | // -*- 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.905864 | 7.609705 | {
"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... |
6e5e057e-f466-4f1a-9f31-b581d17f49e5 | nodang/2022_Algorithm | samsung_algorithm/17141.cpp | #include <iostream>
#include <deque>
#include <cmath>
#include <cstring>
using namespace std;
typedef struct {
int x, y;
} Coord;
typedef struct {
int x, y, cnt;
} BFS;
int N, M;
int arr[52][52];
int virus[52][52];
int check[52][52];
int dx[] = { 1, 0, -1, 0 };
int dy[] = { 0, 1, 0, -1 };
deque<Coord> dq; //바이러스... | ALGO | 0.999894 | 3.439266 | {
"github_metadata": {
"branch": "master",
"commit_count": 65,
"repo_created_at": "2022-01-04T19:59: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": "604866881... |
2d39764c-c8b3-4365-9c1f-a429d29d93c3 | LeontiiMaksimov/Zipf | source.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
bool sortbysec(const std::pair<std::string, long long>& a,
const std::pair<std::string, long long>& b)
{
return (a.second > b.second);
}
void addCount(std::string word, std::vector<s... | ALGO | 0.999586 | 4.259074 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2022-10-23T19:29:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9e79564b77bf... |
2891618f-df00-4a8a-91a9-20b46ee8ebef | gp-b2g/frameworks_base | core/jni/android_hardware_fm.cpp | /*
* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, ... | TOOL | 0.904009 | 5.531693 | {
"github_metadata": {
"branch": "master",
"commit_count": 64428,
"repo_created_at": "2013-02-05T19:51:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 12,
"forks": 29,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "6ee2... |
859b9b64-fccb-48dd-a922-3135d5fae09f | nhattran2003/nhatt17 | 1.17.cpp | #include<stdio.h>
#include<conio.h>
#include<math.h>
struct Diem
{
float X;
float Y;
};
typedef struct Diem DIEM;
void NhapDiem(DIEM &);
void XuatDiem(DIEM);
float TinhKhoangCachGiua2Diem(DIEM, DIEM);
float TinhKhoangCachGiua2DiemTheoOx(DIEM, DIEM);
float TinhKhoangCachGiua2DiemTheoOy(DIEM, DIEM);
DIEM TimD... | ALGO | 0.997653 | 3.736959 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-03-05T07:17: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": "17e6f55d613f... |
4e7bc453-fe6b-4a3c-9a9b-9a73924a980d | arcsi1989/TrackingMicroscopySystem | src/tracker/Utils.h | /*
Copyright (c) 2014, <NAME>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
This software is provided 'as-is', without any express or implied warranty... | ALGO | 0.999513 | 6.601666 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2019-07-02T12:42: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": "b895fec70... |
780b2a65-c5e9-47e3-bda0-ccdb52ea01f3 | TelegramMessenger/Telegram-iOS | third-party/openh264/third_party/openh264/src/codec/decoder/core/src/get_intra_predictor.cpp | /*!
* \copy
* Copyright (c) 2009-2013, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the abo... | ALGO | 0.999455 | 5.68445 | {
"github_metadata": {
"branch": "master",
"commit_count": 28524,
"repo_created_at": "2018-11-14T18:06:49.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 6895,
"forks": 1916,
"issues": 531,
"pull_requests": 45
},
"file_meta": {
"content_id":... |
31f21679-de54-4318-a975-078a98a4a921 | TudorCalinCS/ProblemSolvingVault | reverseInteger.cpp | #include <climits>
#include <stdlib.h>
#include <corecrt_math.h>
/*
Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0.
Assume the environment does not allow you to store 64-bit integers (signe... | ALGO | 0.999883 | 5.407598 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2024-01-04T13:33: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": "bf02a9b78... |
6eeb09b2-df58-41d4-bda7-85a1cfab87ba | chr1shr/am225_examples | 2b_lapack+krylov/rbf.hh | #ifndef RBF_HH
#define RBF_HH
#include <cstdlib>
#include "conj_grad.hh"
class rbf : public conj_grad {
public:
/** Number of specified points. */
const int n;
/** The type of radial function to use. */
const int type;
/** The square length scale of the radial function. */... | ALGO | 0.991239 | 5.965743 | {
"github_metadata": {
"branch": "master",
"commit_count": 118,
"repo_created_at": "2018-02-16T18:50:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 26,
"forks": 9,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1c18003... |
aacfbfcd-8050-4c73-a1ed-d6bba019fd8e | miladmikeal/c-plus-plus | labs/Lab5_Mikeal_Milad/main.cpp | /****************************************************************
** Program name: Recursive Functions
** Author: <NAME>
** Date: 10/19/18
** Description: This program demonstrates recursion by recursively
* reversing a string, recursively adding the elements in an
* array, and recursively calculating a numbers trian... | ALGO | 0.995289 | 6.191097 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2019-12-18T01:32:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "10e06a13ae... |
440b35bc-d888-44aa-b074-a9c4bfb000f6 | Daniel-192211044/CSA5166-Cryptography | 9.cpp | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#define SIZE 5
void generatePlayfairKeyMatrix(char key[], char matrix[SIZE][SIZE]) {
int used[26] = {0};
used['J' - 'A'] = 1; // Treat 'I' and 'J' as the same letter
int keyLen = strlen(key);
int x = 0, y = 0;
for (int i = 0; i < keyLen; i... | ALGO | 0.999977 | 5.314847 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-09-12T03:56:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "01f5900bedf9... |
e32ad3b0-a132-4bbf-ad87-5e15d6da47c8 | matsuyo7/travel-list-CS163-Prog3- | table.h | #include <iostream>
#include <cctype>
#include <cstring>
#include <fstream>
//<NAME>, CS163, 5/19/23, Program 3
//The purpose of this file is to create a hash function and hash table
//where each index of will point to the head of a LLL of travel locations.
//The data organized will allow other programmers to examine... | TOOL | 0.920703 | 4.561472 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2024-03-07T20:53:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "be35e295ef... |
332db9e0-0b9f-4008-bf55-8390856887fc | panditavishu/aps-repository | efficientorderprocessing.cpp | #include <iostream>
#include <queue>
#include <string>
using namespace std;
// Define a structure for Order
struct Order {
string orderId;
int priority; // Higher priority means more urgent
// Constructor
Order(string id, int p) : orderId(id), priority(p) {}
// Operator overload for comparison
... | ALGO | 0.999398 | 7.227654 | {
"github_metadata": {
"branch": "main",
"commit_count": 21,
"repo_created_at": "2024-07-08T05:02: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": "dbc04d292ff... |
7e025a73-d63c-4cd0-ad2d-044d8418286a | ishandutta2007/codeforces-c | cz_xuyixuan/normal/1340/A.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); }
template <typename T> void read(T &x) {
x = 0; int f = 1;
char c = getchar();
for (; !isdigit(c);... | ALGO | 0.999982 | 4.189372 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:17: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": "8662d361a713... |
63675771-6672-431b-88ae-bdf23d349d5e | shikhasingh0101/Data-structure | DSA.cpp/4.postfixexpression.cpp | // Evaluate Postfix Expression using Stack ADT.
#include <iostream>
#include <stack>
#include <string>
#include <cctype>
using namespace std;
int performOperation(int operand1, int operand2, char operation) {
switch (operation) {
case '+': return operand1 + operand2;
case '-': return operand1 - ope... | ALGO | 0.999697 | 6.457469 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2024-01-31T05:18: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": "a29b901e9a5c... |
763515c6-3c4e-4d85-938c-337c2cb38b04 | jeonyeohun/PS-With-CPP | BOJ/P11663_PointOnLine.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<long long> points;
long long binarySearch(long long target, long long N, bool isStart) {
long long head = 1;
long long tail = N;
long long mid = 0;
if (!isStart) {
while (head <= tail) {
mid = (... | ALGO | 0.99998 | 4.873981 | {
"github_metadata": {
"branch": "master",
"commit_count": 317,
"repo_created_at": "2019-12-17T04:38: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": "3de66261... |
1c95bb5a-f40c-48af-a747-e7df85ecac03 | sudo12-3/DAA_Assignment2 | src/Algorithm4.cpp | #include <iostream>
#include <vector>
#include <unordered_set>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <chrono>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <string>
using namespace std;
using namespace std::chrono;
// Type definitions for improved... | ALGO | 0.999883 | 6.839756 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-04-28T17:37: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": "fe1486118ffa... |
7c43d3ed-0220-45f0-82b6-e17a1bab210f | davideberly/GeometricTools | GTE/Mathematics/OBBTreeOfTriangles.h | // <NAME>, Geometric Tools, Redmond WA 98052
// Copyright (c) 1998-2025
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
// https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
// File Version: 8.0.2025.05.10
#pragma once
// Read the comments in OBBTree.h ... | ALGO | 0.998776 | 7.32142 | {
"github_metadata": {
"branch": "master",
"commit_count": 562,
"repo_created_at": "2020-09-15T18:45:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1278,
"forks": 234,
"issues": 5,
"pull_requests": 1
},
"file_meta": {
"content_id": "22f... |
70725c06-5030-4c02-a3d0-0472c362c4c2 | DrSwad/CP | Submissions/Codeforces/1581/brute.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m;
int x[N], y[N];
int added[N];
int pref[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
int psum = 0;
for (int qq = 1; qq <= m; qq++) {
... | ALGO | 0.999814 | 4.110569 | {
"github_metadata": {
"branch": "master",
"commit_count": 65,
"repo_created_at": "2019-10-12T13:53:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 21,
"forks": 5,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "d7a54a06... |
d16a1818-abe1-4f18-9b22-8418804141a8 | yousuf-cse-bd/RandomCodes | TwoReturnValueFromFunctionUsingPointer.cpp | #include <iostream>
using namespace std;
void twoReturnValuesWithoutXtraVariable(int * sum, int * sub)
{
* sum = *sum + *sub;
* sub = * sum - *sub - *sub;
}
void twoReturnValues(int x, int y, int * sum, int * sub)
{
*sum = x + y;
*sub = x - y;
}
int sumAndSub(int x, int y, int * sum, int * sub)
{
... | ALGO | 0.998539 | 4.874086 | {
"github_metadata": {
"branch": "master",
"commit_count": 356,
"repo_created_at": "2022-06-19T05:11:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d2c050f8... |
fc53811f-7c0a-4206-a4b7-86afdd19d5e7 | rstanchak/astar-cpp | src/AStar.hpp | #ifndef ASTAR_HPP
#define ASTAR_HPP
#include "Graph.hpp"
namespace AStar {
/**
* A* heuristic function for estimating cost from start to end
*
* A necessary property of the A* heuristic function is that it is
* *admissible*. I.e. the heuristic shall not overestimate the cost
*/
class Heuristic {
public:
... | ALGO | 0.998978 | 6.04888 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2019-05-29T03:09:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f9a4bdbed... |
edd8400f-92fa-458c-b8db-084d600b845d | kacredolo/AoC_2016 | Challenge17/Challenge17.cpp | /*
Note: Actually got to use a heuristic! Was wondering if A* or similar would come around...
Rank
Part1: 169
Part2: 186
--- Day 17: Two Steps Forward ---
You're trying to access a secure vault protected by a 4x4 grid of small rooms connected by doors. You start in the top-left room (marked S), and you can access th... | ALGO | 0.999892 | 5.940839 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2017-12-28T08:05: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": "4d0693da2b... |
7ed21a2c-82ae-4ac1-bdbc-ea7334582e0f | S-N-O-R-L-A-X/MyEarlyCodes | LC0019/main.cpp | #include <bits/stdc++.h>
using namespace std;
/**
* 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 Solut... | ALGO | 0.999854 | 5.579854 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2021-12-01T15:39: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": "bebe26865b55... |
1b34ddea-5a9d-40c8-8498-0432d970e265 | theDreamBear/algorithmn | leetcode/1046.最后一块石头的重量.cpp | /*
* @lc app=leetcode.cn id=1046 lang=cpp
*
* [1046] 最后一块石头的重量
*/
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace st... | ALGO | 0.999816 | 5.586719 | {
"github_metadata": {
"branch": "master",
"commit_count": 1074,
"repo_created_at": "2019-02-24T04:03: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": "8dc09f6... |
76e67e7b-3057-4ca8-89d6-5207c44a17e5 | radio-astro/casa | code/guitools/Histogram/FitterGaussian.cc | //# Copyright (C) 2005
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# op... | TOOL | 0.989621 | 6.42684 | {
"github_metadata": {
"branch": "master",
"commit_count": 18139,
"repo_created_at": "2015-08-20T09:27:16.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 7,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5bd5a91... |
ccb61e05-9f0d-431f-aa41-3b007174eab4 | himittal09/competitive | LeetCode/Compeditions/Weekly/172/print-words-vertically.cpp | #include <iostream>
#include <sstream>
#include <vector>
using namespace std;
class Solution {
public:
string rtrim (string& str)
{
size_t end = str.find_last_not_of(" ");
return (end == string::npos) ? string("") : str.substr(0, end+1);
}
vector<string> printVertically(string s) {
... | ALGO | 0.999572 | 4.894015 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2019-06-24T13:20: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": "f2d1301ff... |
03aeaf2f-a428-4868-a2e5-caac45151efd | UMich-CURLY/Lie-MPC-AMVs | casadi-linux-matlabR2014b-v3.5.5/include/casadi/core/casadi_cache.hpp | // NOLINT(legal/copyright)
// SYMBOL "cache_check"
template<typename T1>
int cache_check(const T1* key, T1* cache, int* loc, casadi_int stride, casadi_int sz, casadi_int key_sz, T1** val) { // NOLINT(whitespace/line_length)
char match;
int i, c;
casadi_int k;
T1 *lkey;
// Walk through cache location... | ALGO | 0.99292 | 5.679823 | {
"github_metadata": {
"branch": "main",
"commit_count": 30,
"repo_created_at": "2023-05-15T16:02:13.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 49,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "538a4cda8f9... |
be2559a5-22c9-4867-9be1-feade8446444 | nipierre/SiSD_G4_Simulation | SiSD/include/CrosstalkGenerator.hh | /*
\file CrosstalkGenerator.hh
\brief Simulation of crosstalk between strips
*/
#ifndef CROSSTALKGENERATOR_HH_
#define CROSSTALKGENERATOR_HH_
#include <vector>
#include "SymMatrix.hh"
/*!
* \class CrosstalkGenerator
* \brief Simulates the crosstalk between neighbour strips.
* For a strip i the charge Q is... | ALGO | 0.953956 | 5.404315 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2015-02-27T14:48:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b8cff1d639... |
6ec83d1c-d396-4983-8876-a12dd82d65f4 | ammarhakim/gkeyll | gyrokinetic/zero/ambi_bolt_potential_cu.cu | /* -*- c++ -*- */
extern "C" {
#include <gkyl_alloc.h>
#include <gkyl_alloc_flags_priv.h>
#include <gkyl_ambi_bolt_potential.h>
#include <gkyl_ambi_bolt_potential_priv.h>
}
// CUDA kernel to set device pointers to l2g, RHS src and solution
// kernels. Doing function pointer stuff in here avoids troublesome
// cudaMem... | ALGO | 0.957751 | 5.026681 | {
"github_metadata": {
"branch": "main",
"commit_count": 8178,
"repo_created_at": "2020-11-23T20:03:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 30,
"forks": 7,
"issues": 88,
"pull_requests": 6
},
"file_meta": {
"content_id": "267eff7... |
6aaaf5c6-6853-4f64-b0aa-f9831b2e01a3 | kanikachouhan0027/DSA | 54_stack/stack_implementation_linkedlist.cpp | #include<iostream>
using namespace std;
class Node
{ public:
int data;
Node* next;
Node(int element)
{
this->data=element;
this->next=NULL;
}
~Node()
{
}
};
class Stack
{
public:
Node* tail;
Node* head;
Stack()
{
this->tail=NULL;
this->head=NULL;
}
void pu... | ALGO | 0.999319 | 4.12194 | {
"github_metadata": {
"branch": "main",
"commit_count": 16,
"repo_created_at": "2024-08-01T12:02: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": "69a84702705... |
3ab3b31a-87b1-4eb4-af8d-3dee0f3fd695 | MartinKaraivanov/CppAlgorithms | Esenen 2012/naiShirokiLodki_A2_Esenen_2012.cpp | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
int broiEzera;
int broiKanali;
int broiPitaniq;
struct DanniZaSaseda{
int otKade;
int koiE;
int shirochina;
DanniZaSaseda(int otKade, int koiE, int shirochina)
: otKade(otKade), koiE(koiE), shirochina(shirochina)
{
... | ALGO | 0.999957 | 4.163597 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2021-07-24T13:37:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5a5aff66d71a... |
25ada8e6-128c-4be6-97c2-2ba12776ced2 | mathobey/proga_homework | plant.cpp | #include <bits/stdc++.h>
#include "plant.h"
using namespace std;
Plant::Plant(){}
Plant::Plant(string name, pair <double,double> acid, pair <double,double> solar, pair <double,double> temp,
pair <double,double> humid, vector <pair <int,int> > places){
this->name=name;
this->acid=acid;
this->solar... | ALGO | 0.975064 | 4.108283 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-06-05T13:58:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5befb5066c83... |
7942c30d-cb04-4e89-a624-f5b1397440f6 | R-penguins/UVa-Online-Judge-Solutions | 297.cpp | /**
* AOAPC II Example 6-11 Quadtrees
*/
#include <bits/stdc++.h>
using namespace std;
string tree;
int cnt;
auto img = vector<vector<bool>>(32, vector<bool>(32, false));
void draw(int &pos, int r, int c, int w)
{
char cur = tree[pos++];
if (cur == 'p')
{
draw(pos, r, c + w / 2, w / 2);
... | ALGO | 0.996669 | 4.69558 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2019-08-22T02:37: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": "5011c033e... |
8950f913-3064-4f31-9bab-b078a39a1ba6 | shaihitdin/CP | Olymp/CF/1HUNGER/E.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2e4 + 10, bpr = 1e9 + 7;
int b[N][19];
double ans[N], precalc[61];
int ans_c[N][19];
int c[N][19];
bool prime[61];
int n, m, a[N];
int pw[61][7];
int kth_prime[19];
bool divv[N][61];
int main () {
#ifdef LOCAL
freopen ("in", "r", stdin);
freopen ("out"... | ALGO | 0.999992 | 4.063772 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2017-01-22T16:38:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b47bba136... |
13aee559-32e3-4ca4-a13d-156df2373b04 | urisinger/Game-Of-Life | OpenGL first project/src/GameOfLife.cpp | #include "GameOfLife.h"
unsigned int Game::CountNeighbors(int row, int col) const
{
unsigned int counter = 0;
for (int i = -1; i <= 1; ++i) {
for (int j = -1; j <= 1; ++j) {
if (j == 0 && i == 0) continue;
counter += currentBoard.find({ row + i, col + j }) != currentBoard.end();
}
}
return counter;
}
... | ALGO | 0.997223 | 5.217916 | {
"github_metadata": {
"branch": "master",
"commit_count": 36,
"repo_created_at": "2023-02-28T11:49: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": "08e8a6317... |
bbed382d-6ad5-4db7-8bcb-3825884cde86 | Priyanshu-PM/leetcode | 10-regular-expression-matching/regular-expression-matching.cpp | class Solution {
private:
int solve(int i, int j, string pattern, string text, vector<vector<int>>& dp)
{
// base cases
if(i >= pattern.size() && j >= text.size()) return 1;
if(i >= pattern.size() && j < text.size()) return 0;
// memoization
if(dp[i][j] != -1) ret... | ALGO | 0.999957 | 5.557068 | {
"github_metadata": {
"branch": "main",
"commit_count": 1131,
"repo_created_at": "2024-03-01T16:44:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9a8db52b2... |
f7d01acd-511e-40c4-bf03-ec4ae444292f | ishandutta2007/codeforces-c | couplefire/normal/1474/F.cpp | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define int long long
using namespace __gnu_pbds;
const int mod = 998244353;
vector <int> power(int len, int val)
{
if(val == 1)
{
return vector <int>(len, 1);
}
vector <int... | ALGO | 0.999922 | 4.492404 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:17: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": "d051344c4e21... |
611a81ef-8f88-42d0-9aee-20015b6f2f65 | balagithubaccount/cpp-program-my-workout | string-programs/33-frequency-char-str.cpp | // Write a Cpp programming to count of each character in a given string.
#include <iostream>
#include <string>
using namespace std;
void count_each_char(string str, int n)
{
int i, j, count, temp, k=0;
string store;
for(i=0; i<n; i++)
{
temp = 1, count = 0;
for(j=0; j<i; j++)
{
... | ALGO | 0.999784 | 5.234895 | {
"github_metadata": {
"branch": "master",
"commit_count": 378,
"repo_created_at": "2023-01-31T00:55:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "ed42f88d... |
195f476f-ba5f-49af-a616-dda90dfade55 | dimasteva/Petlja-Zbirka2 | Chatpter3/Page 625.cpp | /*
Task: Non-decreasing distances of adjacent elements
Write a program that rearranges the elements of a given array so that, after calculating the array of absolute differences between adjacent elements of the resulting array, a non-decreasing sequence is obtained.
Input: The length of the array `n` (1 ≤ n ≤ 50000... | ALGO | 0.999999 | 5.381485 | {
"github_metadata": {
"branch": "main",
"commit_count": 474,
"repo_created_at": "2023-12-09T16:05: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": "7c930c3a4b... |
3a831abf-bbc8-41f1-8999-ef26745c59b6 | pingowl/Algorithm | 백준/Silver/1992. 쿼드트리/쿼드트리.cc | #include <bits/stdc++.h>
using namespace std;
char a[65][65];
string s;
int n;
string go(int y, int x, int size){
if(size==1) return string(1, a[y][x]);
char b = a[y][x];
string ret = "";
for(int i=y; i<y+size; i++){
for(int j=x; j<x+size; j++){
if(b != a[i][j]){
... | ALGO | 0.999964 | 4.513453 | {
"github_metadata": {
"branch": "main",
"commit_count": 184,
"repo_created_at": "2023-07-06T07:24:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8e40237759... |
f8187bb3-aeb8-4323-b4d1-712937880f7e | memainfKata/kata | spread_packing/exo_Thomas_3mai.c++ | #include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;
int checkIfInf(vector<int> param1, vector<int> param2, int *count_param1, int *count_param2);
int main();
int tri(vector<int> param1, vector<int> param2);
int checkTheBiggest(vector<int> param1, vector<int> param2);
int tri_insertion(vector... | ALGO | 0.99898 | 3.297116 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2022-05-09T20:18:50.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ff813c170f257... |
7e6bee60-bf46-4e56-aadb-5cf50810396a | hutanmihai/FMI | Anul I/Semestrul II/StructDate/Laborator/lab3ex2.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
int v[200001];
bool check(int x) {
int currentValue = 0;
for (int i = 1; i <= n; i++) {
if (v[i] <= currentValue) {
currentValue++;
} else if (x > 0) {
currentValue++;
x--;
}
}
if (curre... | ALGO | 0.999997 | 4.3473 | {
"github_metadata": {
"branch": "main",
"commit_count": 21,
"repo_created_at": "2023-02-19T23:31: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": "82f438e37c6... |
d45d106c-9643-4728-a65a-b09730a48560 | Didarulisalmdidar/Segment-Tree | Segment Tree/CSES - 1649.cpp | /// Dynamic Range Minimum Queries
#include<bits/stdc++.h>
using namespace std;
#define left st,(st+en)/2,nd+nd
#define right (st+en)/2+1,en,nd+nd+1
const int MAX=200005;
long long tree[MAX*4];
long long ar[MAX+5];
void buildTree(int st,int en,int nd)
{
if(st==en)
{
tree[nd]=ar[st];
return;
... | ALGO | 0.999926 | 4.715707 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-12-15T16:05: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": "dbcf081e305d... |
c23e71cc-6bf2-41d7-bd52-d40af85882cd | walkccc/LeetCode | solutions/3409. Longest Subsequence With Decreasing Adjacent Difference/3409.cpp | class Solution {
public:
int longestSubsequence(vector<int>& nums) {
const int mx = ranges::max(nums);
// dp[num][diff] := the length of the longest subsequence ending in `num`
// s.t. the last absolute difference between consecutive elements is `diff`
vector<vector<int>> dp(mx + 1, vector<int>(mx + ... | ALGO | 0.999488 | 5.786633 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2019-02-23T15:46:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1254,
"forks": 437,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "184a6a9... |
07632b31-ed0b-4a31-a82b-5f351bb48ce1 | Hengdang-Killer/DSA-Solutions | 0874-walking-robot-simulation/0874-walking-robot-simulation.cpp | class Solution
{
public:
int robotSim(vector<int>& commands, vector<vector<int>>& obstacles)
{
unordered_set<int> ust;
for(auto &itr : obstacles)
ust.insert(itr[0] + 30001*itr[1]); // hashed value to reduce memory
pair<int, int> curPos = {0, 0};
int ans = 0;
... | ALGO | 0.999969 | 4.786824 | {
"github_metadata": {
"branch": "main",
"commit_count": 1042,
"repo_created_at": "2024-01-21T12:40:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cecb96b81... |
30f8dab1-a9cf-42f9-acff-d3619f9916eb | SrjAdhikari/DSA-With-CPP | 12_Linked_List/Linked_List_Level-1/02_Create_LL_Using_Array.cpp | #include <iostream>
using namespace std;
// Definition of the Node class, which represents an element in the linked list.
class Node {
public:
int data; // Variable to store the data of the node
Node* next; // Pointer to the next node in the linked list
// Constructor to initialize the node ... | ALGO | 0.999908 | 6.247677 | {
"github_metadata": {
"branch": "main",
"commit_count": 504,
"repo_created_at": "2024-05-14T10:53:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "38cf02cc64... |
9f74201f-5fca-49e0-95a4-ca021f76ecf5 | BJoozz/new | coloring.cpp | #include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define pb push_back
using ll =long long;
const int inf=1e9,MAX=1003;
void minn(int &a,int b){if(b<a) a=b;}
#define cnt(u) __builtin_popcount(u)
using ii = pair < int , int >;
vector < int > pr[MAX];
vector < ll > vec;
ll getd(ii u,ii v){
... | ALGO | 0.999994 | 3.843867 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-05-28T14:02: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": "d8807a9b4159... |
257530cf-d4f9-4785-9913-50a1c16c1827 | yryrgogo/data-structure-algorithm | atcoder/ABC/1/132ABC-C.cpp | // #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <tuple>
#include <map>
#include <cassert>
using namespace std;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using vll ... | ALGO | 0.999975 | 4.358835 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2022-07-27T12:36:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "adf709ac2f15... |
6474c7c8-2ce6-44a2-acee-3c799c5b5d59 | pandavgupta/DSA_Question_practice | Leetcode_Practice/N-Queen.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution{
public:
bool isSafe(vector<int> path, int row, int col){
for(int i = 0; i < path.size(); i++){
if(path[i] == col || (path[i] - row + i) == col || (path[i] + row - i) == col ) return false;
}
return true;
}
void help... | ALGO | 0.999939 | 5.101526 | {
"github_metadata": {
"branch": "main",
"commit_count": 282,
"repo_created_at": "2021-08-20T16:18:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "634490b7cd... |
b102a94d-4fee-4c80-a64e-e9ad46381cfa | Divyanshu-Patel/Programming | Contest/Perfect_Permutation.cpp | #include<bits/stdc++.h>
using namespace std;
void ques()
{
long long n, k;
cin >> n >> k;
vector<int> vector1;
for (long long i = 1; i <= n; i++){
vector1.push_back(i);
}
if (n == 1){
cout << 1 << endl;return;
}
if (k == n - 1){
swap(vector1[0], vector1[1]);
... | ALGO | 0.99997 | 4.427354 | {
"github_metadata": {
"branch": "master",
"commit_count": 278,
"repo_created_at": "2021-08-22T10:40:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ec0ed012... |
7e5b0f4a-9023-43af-9dc4-68d50a74ee7e | elifpulukcu/CSES-Solutions | Sorting-and-Searching/DistinctNumbers.cpp | /*
CSES Problem Set
Link: https://cses.fi/problemset/task/1621
Problem: Distinct Numbers
Description:
You are given n integers. Your task is to count how many distinct values exist among them.
Approach:
1. Read the integer n.
2. Read n integers into a data structure (e.g., an unordered_set or... | ALGO | 0.999758 | 5.560923 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2024-12-19T19:47:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7e4946a5ec1... |
d9b3545a-cfdd-4657-bdec-d7b8b5fe9533 | Devansh0112/cplusplus-practice | trie.cpp | #include <iostream>
#include <unordered_map>
#include <string>
class TrieNode
{
public:
std::unordered_map<char, TrieNode *> children;
bool word_end;
TrieNode() : word_end(false) {}
};
class Trie
{
private:
TrieNode *root;
public:
Trie()
{
root = new TrieNode();
}
void inser... | ALGO | 0.998758 | 5.755187 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2021-03-14T18:53: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": "e187afc53... |
5d51fa2d-ff32-44d3-989b-86632a3da10c | ItsMoss/BBnate-Arduino | Functions/Declarations.ino | // DEFINE ALL MY FUNCTIONS
float *ReadSignal() {
/*
Reads in analog signals and continuously sums them in increments
of 50 values to obatin a running list of sums.
:return float v_signal: array containing cumulative sums of signal (V)
*/
const int Length = 20; // manageable size for gathering en... | ALGO | 0.908748 | 3.405303 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2016-10-02T18:48: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": "031fbaa7b2... |
13423004-127a-43b7-b891-e44c1a8447a7 | abhay-nosran/Huffman-File_Compression-File_Decompression | src/compressor.cpp | #include<bits/stdc++.h>
#include <fstream>
// #define C '!'
#define C '\xFF'
using namespace std;
class huffmantreeNode{
public :
huffmantreeNode * left ;
huffmantreeNode * right ;
char character ;
int frequency ;
huffmantreeNode(int frequency , char character){
this -> frequ... | ALGO | 0.999944 | 4.680263 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2024-12-25T13:25:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e3189c8fa9f... |
a2d97068-9990-4f10-9fbe-dc6d311f64b8 | nirkonky/RoboticsLab | HelloRobot/STC.cpp |
#include "STC.h"
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include "lodepng.h"
#include "defines.h"
using namespace std;
STC::STC(Map &map, position startPos):map(map),startPosition(startPos) {}
void STC::buildWorkingMap() {
Grid coarseGrid = map.getCoarseGrid();
workingMap.resize(coarseGrid.siz... | ALGO | 0.995411 | 3.50057 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2016-01-30T19:28: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": "c093d4f4dc... |
2c60b598-dd1c-482d-8d4d-8d287aaa16b1 | edouardmaz/archi3 | sketch_mar6a.ino | int sizem = 63;
int bp1 = 2;
int bp2 = 3;
int bp3=18;
int bp4=19;
//const int buzz=14;
int muco;
#include <DFRobot_RGBMatrix.h> // Hardware-specific library
#include <Wire.h>
//#include "MeAuriga.h"
#define OE 9
#define LAT 10
#define CLK 11
#define A A0
#define B A1
#define C A2
#define D A3
#d... | TOOL | 0.921592 | 3.911312 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2025-03-10T12:50:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a51bf35884e... |
e05ef513-1401-4532-8bc1-757b2c055d7e | alexandraback/datacollection | solutions_5688567749672960_0/C++/rantd/1B-A.cpp | #include <bits/stdc++.h>
using namespace std;
#define repu(i, a, b) for (int i = (a); i < (b); ++i)
#define repd(i, a, b) for (int i = (a); i > (b); --i)
#define mem(a, x) memset(a, x, sizeof(a))
#define all(a) a.begin(), a.end()
#define uni(a) a.erase(unique(all(a)), a.end())
#define count_bits(x) __builtin_popcount(... | ALGO | 0.999805 | 4.165533 | {
"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": "6a6402eee... |
88afed6e-6203-4e09-87e0-5426dde231c3 | andrey-popov/bnn-hep | bnn-hep/src/Config.cpp | #include "Config.hpp"
#include "utility.hpp"
#include <cstdlib>
#include <algorithm>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
using std::exit;
Config::Config(string const &fileName, Logger &log_):
log(log_)
{
// Read the configuration file
try
{
cfg.readFile(fil... | CONFIG | 0.968494 | 5.313942 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2013-07-15T21:40:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "18b1cb4d2... |
8f07b9a1-b134-41aa-bce9-a05f030681b5 | saladnga/LeetCode-Problems | 0098-validate-binary-search-tree/0098-validate-binary-search-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.999847 | 6.497942 | {
"github_metadata": {
"branch": "main",
"commit_count": 482,
"repo_created_at": "2025-01-14T03:33:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6f20412208... |
cffe3af0-676c-4cad-918e-078474a5638c | catlover018/cpp | vnoi/fc127_robot.cpp | #include <bits/stdc++.h>
//#define int long long
using namespace std;
const int maxN = 1e3 + 5;
int n, m;
vector<vector<int>> a;
long long k;
void read() {
cin >> n >> m;
a.resize(n + 1);
for(int i = 1; i <= n; ++i) a[i].resize(m + 1);
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= m; ++... | ALGO | 0.999986 | 3.413437 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2023-11-30T02:27: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": "cb8b6241234... |
c9f3cc7d-78a3-4d80-8d23-71e928ba930e | haowanwuyifan/data_structure_and_algorithm | 回溯算法/luogu1443.cpp | /*------------------------------------------------------------------------------
* @file LUOGU1443.CPP
* @author FIRMWARE TEAM
* @date 2024/01/05 17:13:40
* @brief THIS FILE PROVIDES ALL THE FIRMWARE FUNCTIONS.
* -----------------------------------------------------------------------------
/* Define to ... | ALGO | 0.999647 | 3.347806 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2023-12-18T04:36: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": "c4ad9555530e... |
55137373-6bf4-4474-bb8b-9ca4e51554ba | jsj2008/lithtech | runtime/shared/src/compress.cpp | //
// compress.cpp - compression routines for common types
//
// Copyright (C) 2001 LithTech All Rights Reserved.
//
// NOTE: this module also used by the Autoview library
// Please do not start including engine headers willy-nilly
#include "bdefs.h"
#include "compress.h"
#include "packetdefs.h"
class CCompre... | TOOL | 0.951345 | 6.926987 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2013-03-10T02:09:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 280,
"forks": 114,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f6abbc... |
7e19fd4f-ddcd-419f-8f7a-27e626e3a61e | PBPaschoal/CPlusPlus | Exercicio 4 letra z/Exercicio 4 letra z/Exercicio 4 letra z.cpp | //Exercicio 4 letra z.cpp : Este arquivo contém a função 'main'. A execução do programa começa e termina ali.
//Exercicio 4 letra z. Do livro ALGORITMOS - Lógica para desenvolvimento de programação de computadores. 29º Edição.
//<NAME> e <NAME>
//Ler dois valores numéricos inteiros (representados pelas variáveis A e B)... | ALGO | 0.9969 | 4.052654 | {
"github_metadata": {
"branch": "master",
"commit_count": 60,
"repo_created_at": "2019-10-19T02:09:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c12d4160d... |
9624b9c4-c58f-4ec2-95d7-d5b549c439e4 | radarced/Cpp | LeetCode/TwoSumCount/main.cpp | //Given a list of integers, count the number of unique pairs (i, j) where:
// nums[i] + nums[j] == target
/*vector<int> nums = {1, 2, 3, 2, 1};
int target = 4;
Valid pairs:
(1, 3)
(2, 2)
(3, 1)
So, total: 3 pairs*/
#include <vector>
#include <iostream>
#include <unordered_map>
int main()
{
}
int TwoSum(std::vect... | ALGO | 0.999688 | 6.042631 | {
"github_metadata": {
"branch": "main",
"commit_count": 9,
"repo_created_at": "2025-07-11T11:36:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "93d6304f48b9... |
66da4a42-ff8c-462f-9ff8-ea99079056dd | 113bommy/PathRepair | variable_trace/cpp/cpp_code/cpp_correct/cpp_correct_test_30_2.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
long long n, ans = 1e9 + 7;
string s;
cin >> n >> s;
bool flag = 1, f = 0;
for (long long i = 0; i < n / 2; ++i) {
if (s[i] != s[n - i - 1]) {
flag = 0;
break;
}
}
if (flag) {
cout << "0\n";
return;
}
for (long lo... | ALGO | 0.999952 | 4.148647 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2024-11-11T15:46: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": "13060e3ac45... |
d4c63ba5-0f81-444b-896b-88e4e827610d | daophuc2k3/baitap_project1 | tuan 4/hash_over_strings.cpp | #include <bits/stdc++.h>
using namespace std;
// Hàm tính giá trị hash của chuỗi s modulo m
unsigned long long compute_hash_code(const string& s, int m) {
int k = s.length();
unsigned long long hash_code = 0;
// Duyệt qua từng ký tự trong chuỗi
for (int i = 0; i < k; i++) {
// Cập nhật gi... | ALGO | 0.999975 | 5.623756 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2024-04-01T03:07: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": "9329e6419f... |
6089978d-c487-47ec-8672-42e596c32d25 | utiasASRL/steam | samples/BSplineTrajectoryExample.cpp | /**
* \file BSplineTrajectoryExample.cpp
* \author <NAME>, Autonomous Space Robotics Lab (ASRL)
*/
#include <iomanip>
#include <iostream>
#include "lgmath.hpp"
#include "steam.hpp"
using namespace steam;
/** \brief Example that loads and solves simple bundle adjustment problems */
int main(int argc, char** argv) ... | ALGO | 0.974711 | 6.400131 | {
"github_metadata": {
"branch": "master",
"commit_count": 445,
"repo_created_at": "2015-07-10T21:39:17.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 104,
"forks": 14,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5e7109... |
edd27379-a6d7-41a4-b1f3-0ddfe4b7139e | BhuvaneshShan/Self-adaptive-mutation-and-fitness-eval-time-in-evolutionary-robotics | include/contrib/LioLib/liogenetics/genetics/EMeans.h | /*
* $Id: EMeans.h $
*
* Created on: 8 Dec. 2009
* Author: delarbop
*
* Copyright (c) 2010
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code... | ALGO | 0.999275 | 6.088093 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2015-01-13T18:56:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "834571d0d0... |
ba18c828-3083-4fe9-8401-0abf56876b3f | sergiy777/RHG | QWERTY76.cpp | #include "stdafx.h"
#include <iostream>//подрубает cin cout
using namespace std;//устанавливаем пространство имен std что бы не писать std:cin а писать просто cin
int main()//точка входа в прогу
{
int n=0,count =0, summ=0;//n - само считываемое число, count - количество прочитанных чисел, summ - сумма считанных чисел н... | ALGO | 0.999629 | 3.605193 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2013-05-21T12:36:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b3d835f5af... |
646ece2d-4a3c-46aa-8248-7b78e3d7c752 | RobinGenshin/GenshinLib | src/damage_calculation.cpp | #include "damage_calculation.h"
#include <memory>
#include <string>
#include <functional>
#include "component.h"
#include "sim.h"
#include "damage_event.h"
#include <algorithm>
#include "enemy.h"
#include "enum_maps.h"
float DamageCalculation::StandardCalculate(DamageEvent& dE, Sim& sim) {
float dmg = 0;
for (auto&... | ALGO | 0.985535 | 4.816858 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2021-07-26T17:38:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "43ea27ddaf02... |
35b179a6-4fa0-4566-b407-52174a314bd4 | tddPractice/BackJoon_Algorithm | 7576_토마토/tomato.cpp | /*
2018 Feb 02, made by Moon
*/
#include <iostream>
#include <queue>
using namespace std;
int N;
int M;
int main() {
cin >> M >> N;
int val = M * N;
int tomato[102][102] = { 0 };
int day = -1;
queue<pair<int, int>> queue;
bool boolean;
for (int i = 0; i <= N + 1; i++) {
for (int j = 0; j <= M + 1; j++) ... | ALGO | 0.999996 | 3.76123 | {
"github_metadata": {
"branch": "master",
"commit_count": 358,
"repo_created_at": "2017-12-19T07:11:23.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 6,
"forks": 5,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "f926deacd... |
c685f5c2-8f3e-4c0f-b2a8-8c709ed781ac | abhishek18124/PPCPPNov2022 | 05 - April/Lecture 36/006BinaryTree_CheckBST.cpp | /*
Given a binary tree, design an algorithm to check if is a BST or not.
*/
#include<iostream>
#include<climits>
using namespace std;
class TreeNode {
public:
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int val) {
this->val = val;
this->left = this->right = NULL;
}
};
int findMinimum(TreeNode* r... | ALGO | 0.999981 | 5.296184 | {
"github_metadata": {
"branch": "main",
"commit_count": 46,
"repo_created_at": "2022-12-10T14:17:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "98021ddb7a6... |
c4759106-950a-4032-bc86-61f662659ed7 | tbrown122387/pf | examples/hilb_sort_pf.cpp | #include <fstream> // for ifstream
#include <pf/resamplers.h> // for sys_hilb_resampler and mn_resampler
#include "data_reader.h"
#include "hilb_sort_pf.h" // function header
#include "svol_bs.h" // for bootstrap comparison filter
#include "svol_sisr_hilb.h" // sisr filter for svol with hilbert sort resampli... | ALGO | 0.954853 | 5.919533 | {
"github_metadata": {
"branch": "master",
"commit_count": 216,
"repo_created_at": "2018-04-19T15:37:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 60,
"forks": 17,
"issues": 11,
"pull_requests": 0
},
"file_meta": {
"content_id": "b5e72... |
dda3ade5-f972-44a0-b3b4-0a505b461f52 | JoseJuanSE/Implementations | Interview problems/Word_Boggle.cpp | //Problem: https://practice.geeksforgeeks.org/problems/word-boggle/0
#include <bits/stdc++.h>
using namespace std;
vector< vector< char > > boggle;
int a,b,t,n;
unordered_map<int,unordered_map<int,bool> >vis;
string current;
bool val(int i,int j,int index){
if(i<0 or i>=a)
return 0;
if(j<0 or j>=b)
... | ALGO | 0.994862 | 3.670665 | {
"github_metadata": {
"branch": "master",
"commit_count": 83,
"repo_created_at": "2020-04-30T16:16:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f936417c8... |
aa1f5d6f-a226-4a2a-9a7d-6fd46547d901 | Tekiter/Algorithm | snippet/cpp/String/Trie.cpp | #include <string>
#include <vector>
using namespace std;
class TrieNode {
vector<TrieNode*> children;
bool term;
public:
TrieNode() : term(false) {
children.assign('Z'-'A'+1, nullptr);
}
~TrieNode() {
for (auto p : children) {
if (p != nullptr) {
... | ALGO | 0.998729 | 4.524875 | {
"github_metadata": {
"branch": "master",
"commit_count": 28,
"repo_created_at": "2020-07-12T10:02:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "76ddae3da... |
6711b4a3-198d-4b73-b21f-d48af93570a6 | ethz-adrl/control-toolbox | ct_models/include/ct/models/HyQ/generated/miscellaneous.cpp | #include <iit/rbd/utils.h>
#include "miscellaneous.h"
using namespace iit::HyQ;
using namespace iit::HyQ::dyn;
iit::rbd::Vector3d iit::HyQ::getWholeBodyCOM(
const InertiaProperties& inertiaProps,
const HomogeneousTransforms& ht)
{
iit::rbd::Vector3d tmpSum(iit::rbd::Vector3d::Zero());
tmpSum += inert... | ALGO | 0.997624 | 6.372421 | {
"github_metadata": {
"branch": "v3.0.2",
"commit_count": 1871,
"repo_created_at": "2019-04-25T21:55:23.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1596,
"forks": 332,
"issues": 59,
"pull_requests": 4
},
"file_meta": {
"content_id": "3f... |
47174152-287d-40ed-856a-074051245e7d | meng789987/alg | codes/lc/lc0428.cpp | #include "pch.h"
/*
* tags: tree, design
* Time(n), Space(n)
* 1. serialize each node as "val;children count;"
* 2. serialize each node as "level;val;"
*/
// Definition for a Node.
class Node {
public:
int val = NULL;
vector<Node*> children;
Node() {}
Node(int _val, vector<Node*> _children) {
va... | ALGO | 0.997693 | 5.630415 | {
"github_metadata": {
"branch": "master",
"commit_count": 172,
"repo_created_at": "2018-05-28T02:19: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": "f99c4a5e... |
769c41e5-660f-4167-b843-bfe18f55607b | holounic/university | algos-and-data-structures/labs/lab-5/C.cpp | #include <iostream>
#include <vector>
using namespace std;
size_t log_n;
vector <int> d;
vector <vector<int> > dp, min_path;
int get_min(int u, int v)
{
if (d[v] > d[u])
swap(u, v);
int res = INT_MAX;
for (int i = log_n; i >= 0; i--)
{
if (d[u] - (1 << i) >= d[v])
{
... | ALGO | 0.999961 | 4.145035 | {
"github_metadata": {
"branch": "master",
"commit_count": 171,
"repo_created_at": "2019-09-14T12:52:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9a22dcfb... |
bcbd6116-29ad-41e8-9e2d-e4b406c2a55e | YunxJeong/codetree-TILs | 240523/되돌아오기 2/come-back-2.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
string str;
int x = 0, y = 0, result = 0, dir = 3;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
cin >> str;
for(int i = 0; i < str.length(); i++)
{
if(str[i] == 'L')
{
... | ALGO | 0.999936 | 4.002327 | {
"github_metadata": {
"branch": "main",
"commit_count": 580,
"repo_created_at": "2024-05-09T09:02: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": "3538d7a792... |
bf028d89-ed2d-48c9-a5c2-2db47ac3ace6 | SeonggukPark/BOJ | boj/[1780] 종이의 개수/cpp/1780.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#define INF 987654321
#define endl '\n'
using namespace std;
int cnt[3];
void cut_paper(const vector<vector<int>> & grid, int x, int y, int len){
int color = grid[x][y];
bool is_same = true;
// 격자 색 모두 같은지 check
for (int i = x... | ALGO | 0.999705 | 4.610865 | {
"github_metadata": {
"branch": "main",
"commit_count": 91,
"repo_created_at": "2024-03-18T16:35:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7a1ec595953... |
36b35285-f9b5-4d2f-a065-ab40719a6912 | RaghavSekhri/cpp-programs | snake game/ADJNJSD.CPP | #include<iostream>
#include<vector>
#include<stdlib.h>
#include<windows.h>
#include<conio.h>
#include<ctime>
#include<stdio.h>
using namespace std;
char items[]={'A','B','G','M','P','L','A','R','E','C'};
int score=0;
class Snake;
class Food;
class Boundary
{
protected:
char Board[32][52];
public:
Boundary()
... | TOOL | 0.977576 | 3.613142 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2018-12-27T10:05:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c22b5f360... |
d7e9fd0a-2f05-440f-8099-83a3ebdc94be | romi2002/RobottoFirmware | src/Kinematics/MecanumKinematics.cpp | //
// Created by abiel on 7/28/20.
//
#include "MecanumKinematics.h"
MecanumWheelVelocities
MecanumKinematics::toWheelSpeeds(const Twist2D &vel, const Translation2D ¢erOfRotation) const {
if (centerOfRotation != prevCoR) {
MecanumWheelValues<Translation2D> newValues;
newValues.frontLeft = whee... | TOOL | 0.958357 | 5.859728 | {
"github_metadata": {
"branch": "master",
"commit_count": 62,
"repo_created_at": "2020-05-14T05:10: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": "0d9c1a3a5... |
c92ac1fc-266d-474d-8029-fcfd746e62b2 | khallark/Cpp-DSA-Questions | Data structures/Graph/Questions/Number_of_Enclaves.cpp | #include <iostream>
#include <queue>
using namespace std;
int numEnclaves(vector<vector<int>>& grid) {
int m = grid.size(), n = grid[0].size();
vector<vector<int>> dirs = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
queue<vector<int>> q;
for(int i = 0; i < m; i++) {
if(grid[i][0]) grid[i][0] = 0, q.push... | ALGO | 0.999946 | 5.551384 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2024-03-15T04:09: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": "e3b94e3702c... |
19002e61-2e95-41d3-84d3-7196d5a375cd | mr-junior/research | tools/graph_generator/uniform_er_generator.cpp | #include <string>
#include <map>
#include <set>
#include <vector>
#include <random>
#include <iostream>
#include <fstream>
#include <functional>
#include <boost/lexical_cast.hpp>
#include <boost/random/variate_generator.hpp>
typedef std::mt19937 random_generator_t;
typedef std::uniform_int_distribution<> distributi... | ALGO | 0.998003 | 4.721034 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2016-08-28T11:22: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": "1ec27395bc... |
e24b974d-ff25-43ed-b0c6-4b6048a2d3d4 | andyprevalsky/USACO | Silver/December-2015-Silver/High-Card-Wins.cpp | #include <fstream>
#include <functional>
#include <vector>
#include <algorithm>
#include <unordered_set>
using namespace std;
class Solution {
private:
int N;
vector<int> Bessie;
vector<int> Elsie;
unordered_set<int> inElsie;
int res = 0;
public:
void readIn() {
... | ALGO | 0.999249 | 3.819549 | {
"github_metadata": {
"branch": "master",
"commit_count": 99,
"repo_created_at": "2018-10-27T16:26:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "26ed05bd4... |
f8f71e1b-d1a9-433d-844a-97a10c42c00f | Vishal-Agarwal12/Competitive-programming-codes | 1915F.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
#ifndef ONLINE_JUDGE
#include "debug.h"
#endif
using ll = long... | ALGO | 0.999931 | 4.72598 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-03-31T02:42: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": "811a7cfc217c... |
8b251933-eac3-45ca-8fcf-b32af9897f45 | Kawser-nerd/CLCDSA | Source Codes/AtCoder/abc008/D/4247670.cpp | #include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <... | ALGO | 0.999853 | 4.018042 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2019-09-30T05:38:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 22,
"forks": 8,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "0f1fda77... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.