uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
cf535e24-ecf9-494e-9368-13c6766dce71 | JunBe/C- | Ch06/Swap_ByValue.cpp | #include <iostream>
using namespace std;
void swap_byvalue(int n1,int n2)
{
int tmp;
tmp = n1;
n1 = n2;
n2 = tmp;
}
int main() {
int num1=1;
int num2=3;
swap_byvalue(num1, num2);
cout << "num1 is " << num1 << " and num2 is " << num2 << endl;
//swap_byvalueδ .
return 0;
} | ALGO | 0.999352 | 4.50611 |
7d92e2b1-0c68-4c2c-8493-8b1145eb3b4b | azharmarmu/suresh_tutorials | flutter/whatsapp/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.997373 | 6.76073 |
0effbd64-d3bc-4d13-9bc4-f5d6ba0eb412 | partho-das/CompetitiveProgrmming | DCC_Halcyon/icpc_2022/F.cpp | #include <bits/stdc++.h>
using namespace std;
//____________________________________________________________________________________________________________________________________
#define PI 2*acos(0.0)
#define pf printf
#define sc scanf
#define ff first
#define ss second
#define pb push_back
typedef long long l... | ALGO | 0.998245 | 3.992557 |
8d5f36b9-891f-4c39-8162-d7ab5a0d1fab | DivyanshMittal-exe/CSES | Graph Algorithms/Flight Discount/code.cpp | #pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
#define SHUF(v) shuffle(all(v), RNG);
// ----------------------<DEBUG>---------------------------
void __print(int x) {cerr << x;}
void __print(long x) {cerr <... | ALGO | 0.999888 | 4.918144 |
03a4f7f9-818b-4fcf-a648-ca0f74357370 | sanghoon23/Algorithm | QBaekJoon_210426_기업투자/ConsoleApplication1_Test/ConsoleApplication1_Test.cpp | #include "pch.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
using namespace std;
#define FASTIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int N, M, Row, Board[301][21], Dp[301][21], Ord[301][21];
int main()
{
FASTIO;
cin >> N >> M;
for (int j = 1; j <= N; ++j)
{
c... | ALGO | 0.999995 | 3.341483 |
64c60807-af30-4ed5-81af-6b94021da00e | Diren52/Data-Abstraction-and-structures | WindAndSolar/WindandSolar.cpp | #include "WindandSolar.h"
WindandSolar::WindandSolar()
{
// initializing the map
}
WindandSolar::~WindandSolar()
{
// deleting the map
}
double WindandSolar::maxValue(unsigned month, unsigned year)
{
Collect<double> c;
int countc = 0;
BinarySearchTree<double> myTree;
double tempMax=0;
whil... | ALGO | 0.978764 | 4.630976 |
d9bfbd29-d455-44ee-af2d-9b3c5c9ffd80 | fadak9999/api_map | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998809 | 6.763549 |
8aa214bb-41f5-417f-a57c-714041962ff5 | SelimAltn/Problem-Solving | Algorithms Level 4/Problem #60/Problem #60.cpp | #include <iostream>
using namespace std;
struct stDate {
short Day, Month, Year;
};
struct stPeriod {
stDate StartDate, EndDate;
};
short ReadNumber(string message, short from, short to, string Error_message) {
short number;
do
{
cout << message << endl;
cin >> number;
if (number<from || number>to)
cout... | ALGO | 0.998357 | 3.301833 |
35283d82-42cf-4d17-9572-6ddae9246f30 | 2012615/parallel_1 | opt2_0.cpp | //#include <iostream>
//using namespace std;
//
//
//int main()
//{
// int a[10], sum = 0, sum1 = 0, sum2 = 0;
// for (int i = 0; i < 10; i++)
// {
// a[i] = i;
// }
// for (int i = 0; i < 10; i+=2)
// {
// sum1 += a[i];
// sum2 += a[i + 1];
// }
// sum = sum1 + sum2;
// cout << sum << endl;
// return 0;
//}
| ALGO | 0.998285 | 3.02853 |
1616145f-f73d-43c6-8f1a-d31a6664c91e | karimUzden09/Bresenham-fill-implementation | CV_test_GUI/include/Filler.cpp | #include "Filler.hpp"
uchar* Filler::fill_image_rec_ver
(
uchar* image_data,
int x,
int y,
uint32 pixel_brightness,
uint32 filler_color
)
{
// доступ к элементам массива осущетвляется в виде [x + y * filler_rows] эта запись эквивалаента записи [i][j]
if (image_data[x + y * filler_rows] >= pixel_brightness) // п... | TOOL | 0.854289 | 5.203016 |
14e3af02-11bf-44c9-ba81-c5898f28637a | moadabdou/MTensor_v2 | src/ops/cpu/binary/le.cpp | #include <stdexcept>
#include <algorithm>
#include <iostream>
#include <MTensor/tensorImpl.hpp>
#include <MTensor/ops.hpp>
#include <MTensor/utils/braodcast.hpp>
namespace mt {
namespace ops{
int64_t Le::count = 0;
Le::Le(bool inc_counter )
{
if(inc_counter){
m_name = "Le"+std::to_str... | ALGO | 0.929889 | 6.00994 |
f2ab76fd-2e08-4e6a-9f5c-d247951e1ee5 | P2-718na/mandlebrot | src/main.cpp | #include <SFML/Graphics.hpp>
#include <iostream>
#include <complex>
#define SCALE 200.f
#define WIDTH 600
#define HEIGHT 600
#define OFFSET_X 150
#define OFFSET_Y 0
#define MAX_RECURSION_DEPTH 32
using namespace std;
int cabs(complex<float> n) {
return sqrt(real(n)*real(n) + imag(n)*imag(n));
}
int computeMandelbr... | ALGO | 0.965384 | 5.111047 |
d5a92c70-7b1d-4338-8b4e-dcb09699c37d | utkarshmaken/cp | div2_C/715.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define f(i,a,b) for(int i = a;i<b;i++)
#define rep(i,a,b) for(int i = a;i<=b;i++)
#define fd(i,a,b) for(int i = a;i>b;i--)
#define repd(i,a,b) for(int i = a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define ... | ALGO | 0.999971 | 3.921477 |
70387e43-a436-4042-b147-4d0a1071125b | manikanta2901/ubuntu | .history/practice/cpp/Leetcode/Cpp/AddTwoNumbers_20210308211456.cpp | #include<bits/stdc++.h>
using namespace std;
struct ListNode{
int val;
ListNode *next;
};
void printList(struct ListNode *a){
cout << "List : ";
while(a != NULL){
cout << a->val << " ";
a = a->next;
}
cout << endl;
}
class Solution {
public:
ListNode* addTwoNumbers(ListNod... | ALGO | 0.999897 | 4.92045 |
8c356eab-fd35-4f2e-b6b8-8ea1217c7842 | ValeriiKoniushenko/TheFlower | dependencies/boost_1_80_0/libs/math/example/policy_ref_snip11.cpp | // Note that this file contains quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
#include <iostream>
using std::cout; using std::endl;
// Setting (approximate) precision 25 bits in a single function call using make_policy.
//[policy_ref_snip11
#include <boost/math... | ALGO | 0.989899 | 4.634211 |
c810fe15-7b9d-4af7-bb3f-40af989090f9 | JBlakd/self-study | dijkstra-path-minimum-effort/minimum_effort_path.cpp | #include <cmath>
#include <iostream>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;
class Solution {
public:
int minimumEffortPath(vector<vector<int>>& heights) {
int rows = heights.size();
int cols = heights[0].size();
vector<pair<int, int>> directions = {{-1,... | ALGO | 0.999946 | 6.212145 |
f1663501-8093-4d7f-8a2e-4aba794b345f | ronakgadhiya09/CP-DSA | LeetCode/104.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.999554 | 6.514373 |
16d8fcae-9ad6-407e-a38f-a96899e3983a | JaroDomcio/Aizo_project | Dijkstra.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <chrono>
#include <iomanip>
#include <climits>
struct Edge {
int start, end, weight;
Edge() : start(0), end(0), weight(0) {}
Edge(int s, int e, int w) : start(s), end(e), weight(w) {}
};
class Graph ... | ALGO | 0.954668 | 4.364332 |
a572728a-0efb-43e2-9c3c-518f56a169cb | kaushiklucky/cpp-programing | 5.functions/factorial2.cpp | #include<iostream>
using namespace std;
int main(){
int x;
cout<<"Enter the number : ";
cin>>x;
int fact=1;
for(int i=1; i<=x; i++){
fact*=i;
cout<<fact<<endl;
}
} | ALGO | 0.999963 | 3.951153 |
2b0d6236-2b4d-4541-a4bd-b6486494ef01 | GaurangRastogi/Codeforces | E_Split_Into_Two_Sets.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
typedef long long int ll;
void solve(){
ll n,a,b;
cin>>n;
unordered_map<ll,ll>um{};
for(int i=0;i<n;i++){
cin>>a>>b;
um[a]=b;
um[b]=a;
}
}
int main(){
int t;
cin>>t;
while(t--){
solve();
}
} | ALGO | 0.999505 | 4.002306 |
1f193dfd-c869-4eeb-ad02-b86cd5b5c286 | BrayanQuinonez/CalculatorCPP | CalculatorTuto/Calculator.cpp | #include "Calculator.h"
double Calculator::Calculate(double x, char oper, double y)
{
switch (oper)
{
case '+':
return x + y;
case '-':
return x - y;
case '*':
return x * y;
case '/':
return x / y;
default:
return 0.0;
}
}
| TOOL | 0.977661 | 4.664323 |
b2ea9868-c0a6-4783-88c3-9ca6974fba4c | zizhaozhang/graph-fast-segmentation | toolkits/SE/private/edgeBoxesMex.cpp | #include "mex.h"
#include "math.h"
#include <algorithm>
#include <vector>
using namespace std;
#define PI 3.14159265f
int clamp( int v, int a, int b ) { return v<a?a:v>b?b:v; }
// trivial array class encapsulating pointer arrays
template <class T> class Array
{
public:
Array() { _h=_w=0; _x=0; _free=0; }
virtual ~... | ALGO | 0.999787 | 6.181386 |
99eb1010-dd32-431e-a5cd-2e93ae0f7540 | karanjakhar/technical_training | prime_descending.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
bool isPrime(int num){
bool prime = true;
for(int i = 2; i <= sqrt(num); i++){
if(num % i == 0){
prime = false;
break;
}
}
return prime;
}
bool greaterP(int a, int b){
return a > b;
}
int main(){
std::vector<int> v;
map<int,int>mp;
int... | ALGO | 0.999583 | 4.649035 |
12a529d5-a257-478d-b76f-30f1ac8b6cf0 | OrchidRock/algorithm_study | poj/2367_CleaningShift.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
vector<pair<int,int> > cows;
int N,T;
int ans = 0;
void solve(int index){
if(cows[index].second >= T) return;
int nextindex = -1;
int m = cows[index].second;
for(int i=index+1;i<N;i++){
if(cows[i].first > cows[index].... | ALGO | 0.999984 | 4.154601 |
c90f3d9d-4731-4fc3-94bd-966c2030df24 | kantujjwal/FlutterQuiz | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
d990d5db-faa2-47e0-bd2f-1bf9033356ca | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-cot-gpt4/Codenet/p00207/336256809/response_1.cpp | #include <iostream>
#include <stack>
using namespace std;
typedef pair<int, int> pii;
int C[102][102];
void meiro(int W, int H, int c) {
stack<pii> dfs_stack;
dfs_stack.push({W, H});
while (!dfs_stack.empty()) {
pii top = dfs_stack.top();
dfs_stack.pop();
if (top.first <... | ALGO | 0.998558 | 4.755512 |
e67566c5-2d3e-483e-ba75-42054b9d21ce | SaeedJannati/LeetCodeProblems | LeetCodeProblemsCpp/LeetCodeProblemsCpp/Problems/LeetCode215FindKthElement.cpp | #include "LeetCode215FindKthElement.h"
#include <queue>
void LeetCode215FindKthElement::Run()
{
}
int LeetCode215FindKthElement::findKthLargest(std::vector<int>& nums, int k)
{
auto size=static_cast<int>(nums.size());
std::priority_queue<int, std::vector<int>, std::less<>> maxHeap;
for(int i=0;i<size;i++... | ALGO | 0.999541 | 4.919946 |
a5b121b8-8f98-4ad9-b80e-99073479e4fa | Alex11555/Aplicatii_C | Code blocks/1234/main.cpp | #include <iostream>
using namespace std;
int V[100],n;
int citire(int V[],int m)
{
int i;
for(i=1;i<=m;i++)
cin>>V[i];
}
int div(int p,int u)
{
int a,b,m,i;
if(p==u)
return V[p];
else
{
m=(p+u)/2;
a=div(p,m);
b=div(m+1,u);
if(a>b)
r... | ALGO | 0.999784 | 3.809758 |
1f27dda2-d923-46c1-95d7-336a7762bac7 | jukaradayi/GTgen | GTgen/share/edge_swap.cpp | #include <stdexcept>
#include<iostream>
#include <unordered_set>
#include <utility>
#include <vector>
#include "edge_swap.hpp"
namespace swapper {
EdgeSwap::EdgeSwap () {}
EdgeSwap::EdgeSwap (std::vector<swapper::Edge> edge_vect, std::unordered_set<swapper::Edge> edge_set) {
//EdgeSwap::EdgeSwap (std::u... | ALGO | 0.971169 | 4.90906 |
fe7d32ad-0666-437c-ad53-a3097e6f5e77 | FengISU/DEM_project | lib/atc/Vector.cpp | #include "DenseVector.h"
namespace ATC_matrix {
///////////////////////////////////////////////////////////////////////////////
//* performs a matrix-vector multiply with optional transposes BLAS version
void MultMv(const Matrix<double> &A, const Vector<double> &v, DenseVector<double> &c,
const bool At, do... | TOOL | 0.970837 | 5.638691 |
5b5943d1-97b5-4246-a35b-e518c6192150 | meIwata/CPP-20250512 | ch08/CallByaddr1.cpp | #include <iostream>
using namespace std;
// [J禡쫬ŧi
int Turbo(int *);
int main()
{
int Speed,NewSpeed;
cout << "пJlt:";
cin >> Speed;
NewSpeed=Turbo(&Speed); // [t
cout << "[tt:" << NewSpeed << endl;
cout << "lt:" << Speed << endl;
system("pause");
return 0;
}
int Turbo(int *MySpeed) // [t 10
{
cout <... | ALGO | 0.960415 | 3.145689 |
ef084d20-05c8-45d0-b282-1a860a1a7175 | AyaseCore/Noggit3 | Noggit3libs/Boost/libs/functional/hash/examples/books.cpp | #include "./books.hpp"
#include <boost/functional/hash.hpp>
#include <cassert>
// If std::unordered_set was available:
//#include <unordered_set>
// This example illustrates how to use boost::hash with a custom hash function.
// For full details, see the tutorial.
int main()
{
library::book knife(3458, "Zane Gre... | TOOL | 0.89155 | 6.406029 |
5eb44c05-8cab-493f-aad7-cae64fe542a6 | Emon239/Data-Structure | DS_Lab-5/p2.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int val) {
data = val;
next = nullptr;
}
};
class LinkedQueue {
private:
Node* front;
Node* rear;
public:
LinkedQueue() {
front = rear = nullptr;
}
void enqueue(int va... | ALGO | 0.995634 | 5.896405 |
47d27809-4782-4ded-bc63-592febb52e8b | Krstar233/krits-code-workplace | Cpp/leetcode/514.cpp | #include <string>
#include <queue>
#include <map>
#include <iostream>
#define INT_MAX 0x7fffffff;
using namespace std;
class Solution {
public:
string key;
int min_path;
map<string, string> left_table;
map<string, string> right_table;
string left(string s){
if (!left_table[s].empty())
... | ALGO | 0.999976 | 4.425346 |
9be0b5db-cb7d-40d8-b08c-e33b6aab5f3c | Susilkandu/DSA | day 1 sorting/bubble_Sort/hw1.cpp | // Sort an Give array in Descending order
/*
given unsorted array is arr[]={45,43,55,1,64,99}
*/
// Driver code
#include <iostream>
using namespace std;
int main()
{
int arr[6] = {6,5,4,3,2,1};
int arrSize = 6;
// via below code we are sorting this array by bubble sort in decreasing order
for (int i = ... | ALGO | 0.999346 | 4.240606 |
492f3348-c42a-4bd4-ad4f-88de6d0b95e7 | sarvex/leetcode-small-basic | solution/0800-0899/0816.Ambiguous Coordinates/Solution.cpp | class Solution {
public:
vector<string> ambiguousCoordinates(string s) {
int n = s.size();
vector<string> ans;
auto f = [&](int i, int j) {
vector<string> res;
for (int k = 1; k <= j - i; ++k) {
string l = s.substr(i, k);
string r = s.s... | ALGO | 0.999294 | 5.501046 |
adbd210f-2a39-4d93-8e88-e73a1be90a10 | mohith-bacha/leetcode-problems | 2579-count-total-number-of-colored-cells/2579-count-total-number-of-colored-cells.cpp | class Solution {
public:
long long coloredCells(int n) {
long long out=1;
if(n==0){
return 0;
}
if(n==1){
return out;
}
for(int i=1;i<n;i++){
out=out+4*i;
}
return out;
}
}; | ALGO | 0.999991 | 5.267248 |
4334c5da-80a1-4034-a9fb-916a8dcc8569 | deepak-ky/cpp-codes | cpp-codes/relative_sorting.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define varname(name) #name
#define mod 1000000007
#define wer(x) cout<<"\n"<<varname(x)<<" here : "<<x
#define test int t;... | ALGO | 0.999992 | 3.302768 |
43ee57cc-daea-4837-a3a5-fdab68e8cb65 | JohnSmoit/BinaryTree | stage1tests.cpp | #include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include "BinaryTree.h"
//#define USE_MAIN_2
#ifdef USE_MAIN_2
using namespace std;
using namespace bst;
vector<string> ReadFromFile(string fileName)
{
ifstream inputFileStream(fileName);
vector<string> values;
if (!inputFileStream.is_o... | TOOL | 0.940392 | 3.989765 |
a30ab5b4-2941-49bd-8d42-53185862a2db | moin-zaman/CP | STL/Sort_Array_02/main.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int arr[5] = {2, 5, 7, 3, 1};
// sort(arr, arr+5);
sort(arr+2, arr+5);
for(int i = 0; i < 5; i++)
{
cout << arr[i] << "\t";
}
// sort(arr, arr+4);
//
// for(int i = 0; i < 5; i++)
// {
// cout... | ALGO | 0.998342 | 3.206633 |
6bb556f3-9bb6-4135-986d-11aae75440c6 | Priyanshu-Pandat/leetcode_-problems-by-me | Print N-bit binary numbers having more 1s than 0s - GFG/print-nbit-binary-numbers-having-more-1s-than-0s.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
void solve(int one , int zero , string op , int N , vector<string> &v ) {
if(N ==0 ) {
v.push_back(op);
return ;
}
string op1 = op;
op1.pus... | ALGO | 0.999915 | 6.392988 |
b60c9a6a-4fd3-4fb7-8467-e9d91789ef9b | ML4SE2022/group3 | data/walkccc-1666132586/C++/605 Can Place Flowers.cpp | class Solution {
public:
bool canPlaceFlowers(vector<int>& flowerbed, int n) {
if (n == 0)
return true;
for (int i = 0; i < flowerbed.size(); ++i)
if (flowerbed[i] == 0 && (i == 0 || flowerbed[i - 1] == 0) &&
(i == flowerbed.size() - 1 || flowerbed[i + 1] == 0)) {
flowerbed[i] ... | ALGO | 0.999985 | 7.120314 |
b78adcf7-c371-4369-ac07-cb0a9d9d239e | shumbul/DSA-Series | Two-Pointers/1. Valid Palindrome.cpp | /*
https://leetcode.com/problems/valid-palindrome
*/
class Solution {
public:
bool isPalindrome(string s) {
bool ans;
int n = s.size();
int i = 0,j = n - 1;
while(i<j){
if(!isalnum(s[i])){
i++;
}
else if(!isalnum(s[j])){
... | ALGO | 0.99986 | 6.763307 |
abbf1290-99f4-4cad-9329-1f6716f80f1b | xiaotian777888/TokenCore | TokenCore/crypto/hmac_sha512.cpp | #include "hmac_sha512.h"
#include "sha512.h"
void HMACSHA512(const uint8_t* input, size_t length, const uint8_t* key, size_t key_length, uint8_t digest[HMACSHA512_DIGEST_LENGTH])
{
HMACSHA512CTX context;
HMACSHA512Init(&context, key, key_length);
HMACSHA512Update(&context, input, length);
HMACSHA512Final(&context,... | ALGO | 0.99556 | 6.337982 |
5260099d-0af5-4f03-9270-a1a32b46a3f6 | JayBee-098/DS-EMULATOR4 | desmume/src/frontend/windows/pathsettings.cpp | #include <windowsx.h>
#include <shlwapi.h>
#include <shlobj.h>
#include <commctrl.h>
#include <time.h>
#include <stdlib.h>
#include "main.h"
#include "path.h"
#include "pathsettings.h"
extern bool autoLoadLua;
#define HANDLE_DLGMSG(hwnd, message, fn) \
case (message): return (SetDlgMsgResult(hDlg, uMsg, ... | TOOL | 0.851798 | 4.768781 |
23e4a226-50c5-41c4-9fc5-03749c8b1431 | PtCu/practice | OJ/luogu/P1081.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int h[maxn];
struct Node
{
int id, dis;
Node() : id(0), dis(INT_MAX) {}
};
Node min_2[maxn][2];
int n;
int dis_ab[2]; // 1是a, 0是b
//int max_extend[maxn];
float travel(int s, int x)
{
int cnt = 1;
int d = 0;
memset(dis_ab, 0, si... | ALGO | 0.999958 | 3.574397 |
3e784c04-9b6c-4985-8892-6cc697e4fb9f | saurabh060792/comp-prog | Algorithms/Graph/Tree/iteratively_remove_lowest_degree_vertex.cpp | #include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <climits>
#include <queue>
using namespace std;
#define MAX 4000006
typedef long long int lli;
typedef pair<int, int> pii;
struct vertex {
int parent, degree;
bool visited;
};
void dfs(int u, int p);
vertex V[MAX];
int n, m... | ALGO | 0.999956 | 4.859618 |
324e8aa6-5670-43c6-b6ce-8b3b1759f4ea | BOUDADM/TOOLING-APPLICATION-CPP | IDPINGER/encryption.cpp | #include "encryption.hpp"
#include <cctype>
std::string encrypt_word(const std::string& word, int shift) {
std::string encrypted_word = word;
for (char& c : encrypted_word) {
if (std::isalpha(c)) {
c = 'A' + (c - 'A' + shift) % 26;
}
}
return encrypted_word;
}
| TOOL | 0.988274 | 6.456567 |
fb8d5f27-c3d9-49e0-b3ac-e680baa2f973 | alanzhao1/chromium-libcxx | test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14
// <numeric>
// Became constexpr in C++20
// template<class InputIterator, class OutputIterator, class T>
// OutputIterator inclusive_scan(InputIterator first, InputIterator last,
// OutputIterator result, T init);
//
#include <algorithm>
#inc... | TEST | 0.970702 | 7.113359 |
e95fb064-9694-4908-8497-c5e1bd757c76 | sarvex/leetcode-ocaml | solution/2500-2599/2539.Count the Number of Good Subsequences/Solutoin.cpp | int N = 10001;
int MOD = 1e9 + 7;
long f[10001];
long g[10001];
long qmi(long a, long k, long p) {
long res = 1;
while (k != 0) {
if ((k & 1) == 1) {
res = res * a % p;
}
k >>= 1;
a = a * a % p;
}
return res;
}
int init = []() {
f[0] = 1;
g[0] = 1;
... | ALGO | 0.999992 | 5.555541 |
52224509-4489-473e-a958-7d0ca0930291 | FreeEric001/CSP | S/6/身高问题.cpp | #include <iostream>
#include <map>
#include <cstring>
using namespace std;
map<pair<int,int>, bool> did_visit; //防止题目的神仙条件来两次一样的
int d[10001]; //d是差分数组
int n, p, h, m, a, b;
int main() {
cin >> n >> p >> h >> m;
memset(d, 0, 10001); //d[0]=0
for(int i = 1; i <= m; i++) {
cin >> a >> b;
... | ALGO | 0.99976 | 3.321065 |
5e297e79-b2dd-4dbe-99c7-022115a84a52 | YanFeiGao/ToCppPrimer | CppPrimer_Practice/exercise1_16.cpp | // CppPrimerPractice.cpp: ̨Ӧóڵ㡣
//
#include "stdafx.h"
#include <iostream>
int main()
{
int sum = 0, value = 0;
std::cout << "please input some numbers,press Ctrl+Z End" << std::endl;
while (std::cin >> value)
{
sum = value + sum;
}
std::cout << "The sum is " << sum << std::endl;
}
| TOOL | 0.872847 | 3.315297 |
1daac22f-63c8-45bf-94f6-eadbebbb49b6 | yuxiandeng/CodingPractice | Leetcode/33SearchinRotatedSortedArray/33SIRSA.cpp | #include <vector>
using namespace std;
int main()
{
vector<int> nums = {4,5,6,7,0,1,2};
int target = 3;
int left = 0, right = nums.size() - 1;
// binary search
// find which side is sorted
while (left < right)
{
int mid = (left + right) / 2;
if (nums[mid] > target)
{
if (nums[left] <= nums[mid])
{... | ALGO | 0.999963 | 5.777885 |
a78d98b2-fc77-4b2e-9969-7db0a2fce090 | balr0g/mame-rr | src/tools/regrep.cpp | /***************************************************************************
Regression test report generator
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <new>
#include <assert.h>
#include "os... | TOOL | 0.89903 | 6.817189 |
e930a80a-5f70-4593-b638-721dddd123ca | Anshika91/codechef_practice | chef and spell.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
unsigned long t,a,b,c;
cin>>t;
while(t--)
{
cin>>a;
cin>>b;
cin>>c;
unsigned long sum1 = a+b;
unsigned long sum2 = b+c;
unsigned long sum3 = c+a;
unsigned long maxsum = sum1>sum2?(sum1>sum3?sum1:... | ALGO | 0.999621 | 4.289363 |
51b3518b-59a8-41d4-8051-1c9f9420b202 | Log-in-off/leetcode | 881_boats_to_save_people/main.cpp | #include <iostream>
#include <cassert>
#include <vector>
#include <map>
#include <algorithm>
class Solution {
public:
int numRescueBoats(std::vector<int>& people, int limit) {
std::sort(people.begin(), people.end());
int start = 0;
int end = people.size()-1;
int answer=0;
while(start <= end)
{
... | ALGO | 0.999987 | 5.939936 |
ccad1e5f-5c8f-4e94-a425-1567d6205d10 | RahulLodhi12/Data-Structure-and-Algorithm | Binary Tree/Postorder_Traversal.cpp | // Level Order Traversal (Breadth First Search or BFS) of Binary Tree
#include<bits/stdc++.h>
using namespace std;
class node{
public:
int data;
node* left;
node* right;
node(int d){
this->data = d;
this->left = NULL;
this->right = NULL;
}
};
node* createTr... | ALGO | 0.999949 | 5.403522 |
cfd9b828-87dd-4d03-a08c-218bdbfcb5e3 | wjddlsy/Algorithm | Baekjoon/baek_9465_스티커/main.cpp | #include <iostream>
int arr[2][100];
int cache[100][3];
int maxScore(int n){
int ret;
cache[1][0]=0;
cache[1][1]=arr[0][1];
cache[1][2]=arr[1][1];
for (int i=2; i<=n; ++i){
cache[i][0]=std::max(cache[i-1][1], cache[i-1][2]);
cache[i][1]=std::max(cache[i-1][2], cache[i-1][0])+ar... | ALGO | 0.99986 | 3.982823 |
4e65b6c5-b351-4f18-b736-09633d442ec9 | m-lyon/LearningCPlusPlus | Section_8_References_and_Enum/1_Enum_Type/example.cpp | #include <iostream>
using namespace std;
/* enum - enumeration - 0 1 2 3 4 */
enum dayOfWeek {M = 1, TU, W, TH, F, SA, SN};
string getDay(dayOfWeek);
int main()
{
dayOfWeek d = M;
/*cout << d << endl;
cout << dayOfWeek(W) << endl;
*/
int i;
cout << "Enter the day of a week " << endl;
//....... | TOOL | 0.990173 | 3.166883 |
7255b250-194f-4cfc-bc73-9ddfc6f60769 | LMonfiero/CECS-275-Programming-and-Data-Structures-in-CPP | Labs/Lab_5/Lab5.cpp | /*Lab 5.cpp
Louis Monfiero
016336266
2/26/19
Descr: Introduction to pointers; Use pointers to arrays to manipulate an array
*/
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <string>
using namespace std;
//Descr: dynamically populates an array with the amount input by a user
... | ALGO | 0.992054 | 4.051919 |
984819ed-f12a-48fd-b13e-0fd09ed7d900 | Ashish-Chokhani/Competitive_Programming | Codeforces/660C.cpp | #include <bits/stdc++.h>
using namespace std;
bool isPossible(int len, int k, vector<int> &arr, int n)
{
int cnt = 0;
for (int i = 0; i < len; i++)
{
if (arr[i] == 0)
cnt++;
}
if (cnt <= k)
return true;
int j = len, i = 0;
while (j < n)
{
if (arr[i] =... | ALGO | 0.999992 | 4.131246 |
4ecc4283-e2da-4918-a09b-a5e6ac568f27 | dye8128/ABC | 350D.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using str = string;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using vc = vector<T>;
template<class T>using vvc = vc<vc<T>>;
using vint = vc<int>;
using vll = vc<ll>;
using vstr = vc<str>;
using vpint = vc<pint>;
using vpll... | ALGO | 0.999979 | 3.781927 |
23f020fa-5cf0-4dee-9ebf-cf525af40649 | cainingw/gem5_adaptive_routing | src/systemc/tests/systemc/misc/synth/combo/switch5/switch5.cpp | /*****************************************************************************
switch5.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/****************************************************************************... | TOOL | 0.98155 | 4.533247 |
f4a4f841-b1c4-4e88-9b1d-eb1c223b944f | priya0498/Leetcode | 0056-merge-intervals/0056-merge-intervals.cpp | class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
vector<vector<int>> ans;
if(intervals.size()<=1){
return intervals;
}
sort(intervals.begin(), intervals.end());
ans.push_back(intervals[0]);
// ans==[1,3]
for... | ALGO | 0.999999 | 5.874816 |
34355f0a-e986-4fbb-a4ab-001f9dec69de | ssk4988/Coding | CodeForces/practice/E1957.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<ld>;
using vii = vector<pii>;
using vll = vector<pll>;
using vvi = vector<vi>;
#define f first
#define s se... | ALGO | 0.999924 | 4.522096 |
e4f8b560-e781-425f-82af-a03cf0ac6c63 | binarysculptor/wallet | src/crypto/scrypt.cpp | #include "crypto/scrypt.h"
#include "uint256.h"
#include "utilstrencodings.h"
#include <openssl/sha.h>
#include <string>
#include <string.h>
#include <stdint.h>
static inline void be32enc(void *pp, uint32_t x)
{
uint8_t *p = (uint8_t *)pp;
p[3] = x & 0xff;
p[2] = (x >> 8) & 0xff;
p[1] = (x >> 16) & 0x... | ALGO | 0.998799 | 5.312294 |
18ac4b39-95bc-49ea-8e5a-f4da17c2f174 | PavanNR958/Object-Oriented-Programming-Using-CPP | Problems/Part 4/Task8.cpp | #include<iostream>
using namespace std;
class A{
int a;
public:
A(int a ){
this->a=a;
}
int fun(){
return a*a;
}
int fun(int x){
return x*x;
}
int fun(int x, int y){
cout<<(x*y)<<endl;
}
};
class B : public A{
int a,b;
pu... | TOOL | 0.914454 | 4.586899 |
b8f4f8d4-8343-4023-bdcf-818a8b33b034 | Asik-Ifthaker-Hamim/LeetCode-Stack-Problems-Solution | Min Stack.cpp | class MinStack {
public:
stack<int>st;
stack<int>s_min;
MinStack() {
int x;
}
void push(int val) {
st.push(val);
if(s_min.empty() || val<=s_min.top())
{
s_min.push(val);
}
}
void pop() {
if(st.top()==s_min.top())
{
s_m... | ALGO | 0.999913 | 6.157342 |
a22fc834-7173-4542-ab8b-78c0730db37a | AmirUCR/ALLEGRO | src/utils/boost_1_81_0/libs/compute/example/transform_sqrt.cpp | //[transform_sqrt_example
#include <vector>
#include <algorithm>
#include <boost/compute/algorithm/transform.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/functional/math.hpp>
namespace compute = boost::compute;
int main()
{
// get default device and setup context
compute::devic... | ALGO | 0.99856 | 5.25276 |
0f4bc478-fbce-4745-8243-23a069182252 | alpha74/iIB | Programming/Two_Pointers/Diffk.cpp | // Start two pointers from 0 and 1. Move the pointers accordingly.
int Solution::diffPossible(vector<int> &A, int B)
{
long long int i = 0, j = 1 ;
int ret = 0 ;
while( i < A.size() && j < A.size() && ret == 0 )
{
long long int diff = A[j] - A[i] ;
if( diff == B && i != j )
ret = 1 ;
... | ALGO | 0.999971 | 4.619737 |
c9049915-10da-4631-9279-6c42a3f80de1 | saikiran2508/leetcode | 51-N-Queens.cpp | /*
N-Queens: place n queens such that no 2 queens atk each other, return all soln's
Place queens per row, try all possibilities & validate for further rows, backtrack
Time: O(n!)
Space: O(n^2)
*/
class Solution {
private:
unordered_set<int> cols; //for Columns
unordered_set<int> negDiag; ... | ALGO | 0.999787 | 6.079541 |
b4188702-2f74-4c6f-ae29-70cc223ffb9c | z3usleo/core | dep/src/g3dlite/BinaryInput.cpp | /**
@file BinaryInput.cpp
@author Morgan McGuire, graphics3d.com
Copyright 2001-2007, Morgan McGuire. All rights reserved.
@created 2001-08-09
@edited 2005-02-24
<PRE>
{
BinaryOutput b("c:/tmp/test.b", BinaryOutput::LITTLE_ENDIAN);
float f = 3.1415926;
int i = 1027221;
std::string... | TOOL | 0.859647 | 5.516302 |
50238513-d01e-4409-bdcc-76da6b1a82e9 | VachelChen/- | BJFU_234/BJFU_234/main.cpp | #include <iostream>
#define ok 1
#define error 0;
const int maxn = 110000;
using namespace std;
struct sqlist{
int *elem;
int length;
};
int InitSqlist(sqlist &l){
l.elem = new int[maxn];
if(!l.elem) return error;
l.length = 0;
return ok;
}
int createSqlit(sqlist &l,int n){
for (int i=0;... | ALGO | 0.999352 | 3.531871 |
71798216-387c-41eb-9f47-74e86f0b6b3f | Ritik-Yadav07/Leetcode | Minimum element in a sorted and rotated array - GFG/minimum-element-in-a-sorted-and-rotated-array.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int findMin(int arr[], int n){
//complete the function here
int low=0;
int high=n-1;
int res = INT_MAX;
while(low<=high)
{
... | ALGO | 0.999869 | 6.013793 |
b2ba63e1-2c05-4e71-a18f-3fd52f6046c5 | kito-cheng/LLVM-SVE | lib/CodeGen/BranchFolding.cpp | #include "BranchFolding.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/Code... | ALGO | 0.998253 | 6.636938 |
05e044f8-504c-4563-817d-8bbd6e699f35 | Mindjolt2406/Competitive-Programming | Codeforces/577/C.cpp | /*
Rathin Bhargava
IIIT Bangalore
*/
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.... | ALGO | 0.999997 | 4.533449 |
5c8b02e5-2212-443c-a136-577fd839b314 | cadets/freebsd | contrib/llvm-project/llvm/lib/CodeGen/EdgeBundles.cpp | #include "llvm/CodeGen/EdgeBundles.h"
#include "llvm/ADT/Twine.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/r... | TOOL | 0.857235 | 7.518672 |
f2bb0f45-2c06-4c5e-bbeb-b35cd200427c | DionysiosB/CodeForces | 0001-0099/11B-JumpingJack.cpp | #include <cstdio>
int main(){
long n; scanf("%ld\n", &n);
if(n < 0){n = -n;}
long sum(0), ans(0), p(1);
for(p = 1; sum < n; sum += p, p++, ans++);
long diff = sum - n;
if(n == 0){puts("0");}
else if(diff % 2 == 0){printf("%ld\n", ans);}
else if((diff + p) % 2 == 0){printf("%ld\n", ans... | ALGO | 0.99997 | 3.571761 |
3aba6b42-3970-48ea-bfbe-f57bd57c69b2 | SrB30/Competitive-Programming | UVA/10611 - The Playboy Chimp1.cpp | #include <stdio.h>
int n, noc[50000], height;
int beg1, beg2;
void bsearch()
{
int end1, end2, mid1, mid2;
beg1=beg2 = 0;
end1=end2 = n-1;
mid1 = mid2 = (beg1+end1)/2;
while(beg1<=end1 || beg2<=end2)
{
if(beg1<=end1) {
if(height <= noc[mid1])
end1 = mid1-... | ALGO | 0.999974 | 3.263709 |
82087cc6-6fa0-419c-b5bb-c615a0962ee4 | HyeonjungYun/Algorithm | 프로그래머스/2/84512. 모음 사전/모음 사전.cpp | #include <string>
#include <vector>
using namespace std;
int currentAlp(char tmp)
{
if (tmp == 'A') return 1;
if (tmp == 'E') return 2;
if (tmp == 'I') return 3;
if (tmp == 'O') return 4;
if (tmp == 'U') return 5;
}
int calNumber(char tmp, int index)
{
if (index == 0) return 1 + (currentAlp(tm... | ALGO | 0.999624 | 5.035729 |
267fbeb1-0f73-4900-bc10-f4b75a51b66c | kimsj0302/algorithm_study | algospot/POLY.cpp | #include<iostream>
#define MOD 10000000
using namespace std;
int DP[101][101];
int poly(int n, int under) {
if (n == under) return 1;
if (DP[n][under] != -1) return DP[n][under];
int sum = 0;
for (int i = 1; i <= n - under; i++) {
int add = i + under - 1;
add *= poly(n - under, i);
add %= MOD;
sum += add;
... | ALGO | 0.999772 | 3.666304 |
fc62d88f-3d18-4f3d-97ad-e39649a056e4 | P0L3NARUBA/roblox-2016-source-code | Network/raknet/Source/CommandParserInterface.cpp | #include "CommandParserInterface.h"
#include "TransportInterface.h"
#include <string.h>
#include "RakAssert.h"
#include <stdio.h>
#if defined(_WIN32)
// IP_DONTFRAGMENT is different between winsock 1 and winsock 2. Therefore, Winsock2.h must be linked againt Ws2_32.lib
// winsock.h must be linked against WSock32.li... | TOOL | 0.927187 | 5.357182 |
aabfcee1-3073-4983-9562-5abb6f577664 | ssk4988/Coding | UCFPT/23hsptonline/sky.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<ld, ld>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<ld>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;
using vv... | ALGO | 0.999234 | 3.895551 |
10c06b40-d878-4859-a077-fd8b02b3aa0b | Sudhir769/leetcode-solutions | 2803-modify-graph-edge-weights/modify-graph-edge-weights.cpp | class Solution {
public:
vector<vector<int>> modifiedGraphEdges(int n, vector<vector<int>>& edges, int source, int destination, int target) {
int INF = 2e9;
unordered_map<int, vector<pair<int, int>>> nodeNeighMp;
for (auto& edge : edges) {
int firstNode = edge[0], se... | ALGO | 0.999919 | 6.265033 |
45c23911-bcd8-4535-a212-835c52e85369 | ThomasLECAMPION/CoursMASTER-LICENCE | Codage_Compression/TP3/prediction2.cpp | #include <stdio.h>
#include "cmath"
#include "image_ppm.h"
int main(int argc, char* argv[])
{
char cNomImgLue[250], cNomImgEcrite[250];
int nH, nW, nTaille;
if (argc != 3)
{
printf("Usage: ImageIn.pgm ImageOut.pgm \n");
exit (1) ;
}
sscanf (argv[1],"%s",cNomImgLue) ;
sscanf (argv[... | ALGO | 0.999057 | 3.529174 |
0ad9e25a-5291-448d-b031-7a62e55569cc | marston2yu/leetcode | PartitionEqualSubsetSum.cpp | #include "PartitionEqualSubsetSum.h"
#include <numeric>
bool canPartition(vector<int> &nums) {
// Calculate sum of numbers.
int sum = accumulate(nums.begin(), nums.end(), 0.0);
if (sum % 2) return false; // Not possible to divide a odd sum into two equal part.
// 0-1 package problem. Choosing numbers that add... | ALGO | 0.999865 | 5.850848 |
f4632f19-7f7e-421a-b1ac-d9dd1f3515fd | PlasmaControl/FreeMHD | OpenFOAM-v2206/ThirdParty/sources/boost/boost_1_74_0/libs/compute/perf/perf_stl_is_permutation.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
// create ve... | TEST | 0.923508 | 5.791606 |
790f8bf4-f9fd-40e0-9ee4-602b243300ea | bioyoshoo/atcoder | Boot-camp/Easy/69.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string S; cin >> S;
int N = S.size();
int ans = 0;
for (int i = 0; i < N;) {
if (i + 1 < N && S[i] != S[i + 1]) {
ans++;
i++;
}
else if (i + 3 < N && S[i] == S[i + 1]) {
ans += 2;... | ALGO | 0.999912 | 3.830751 |
f09920aa-b6b2-4356-b1cb-1030b5d486fe | GamerDude27/halo-source | mp/src/game/server/point_playermoveconstraint.cpp | #include "cbase.h"
#include "saverestore_utlvector.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define SF_TELEPORT_TO_SPAWN_POS 0x00000001
//-----------------------------------------------------------------------------
// Purpose:
//------------------------------------... | TOOL | 0.905484 | 5.566079 |
690a08fb-55c8-4318-9a52-75ee1abec4e5 | gavin-white/Wordle-Utility | src/structures/SuffixTree.cpp | #include <algorithm>
#include "structures/SuffixTree.hpp"
#include "structures/PrefixTree.hpp"
SuffixTree::SuffixTree(PrefixTree* delegate) {
this->delegate = delegate;
}
SuffixTree::~SuffixTree() {
delete delegate;
}
SuffixTree* SuffixTree::buildTree(std::vector<std::string> words) {
std::vector<std::st... | ALGO | 0.946391 | 6.086102 |
fefa5ab9-bb93-4806-8f06-1ca3a83a4a7c | YanbingXu/leetcode-cpp | 111.二叉树的最小深度.cpp | /*
* @lc app=leetcode.cn id=111 lang=cpp
*
* [111] 二叉树的最小深度
*/
// @lc code=start
/**
* 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),... | ALGO | 0.999963 | 7.006246 |
6b0d8199-be3a-4434-8e5a-93f7c0675e4c | csh-apprentice/Time_Based_SL | lib/linalg/zlacgv.cpp | #ifdef __cplusplus
extern "C" {
#endif
#include "lmp_f2c.h"
int zlacgv_(integer *n, doublecomplex *x, integer *incx)
{
integer i__1, i__2;
doublecomplex z__1;
void d_lmp_cnjg(doublecomplex *, doublecomplex *);
integer i__, ioff;
--x;
if (*incx == 1) {
i__1 = *n;
for (i__ = 1; i__... | ALGO | 0.900694 | 5.198954 |
87359408-8882-43b3-a2d9-6649b821e3a4 | ThisIsGagan19/daily_code_challenge | gfg/2024_4_april/c++/04_sum_of_all_substrings_of_number.cpp | // CODE
#define MOD 1000000007
class Solution {
public:
long long sumSubstrings(string s) {
int n = s.size();
long long res;
vector<long long> dp(n, 0);
dp[0] = s[0] - '0';
res = dp[0];
for(int i = 1; i < n; i++) {
dp[i] = ((dp[i - 1... | ALGO | 0.999968 | 6.143209 |
74b51804-5912-4eb6-9672-ed7ac3690093 | Exxxasens/Programming | Practice/18/C++/Project/Project.cpp | #include <iostream>
#include <string>
#include <vector>
int countSymbol(std::vector<std::string>, char);
int countAllSymbols(std::vector<std::string>);
int main() {
std::vector<std::string> words {
"hallo",
"klempner",
"das",
"ist",
"fantastisch",
"fluggegecheimen"
};
std::string in;
std::cin >> in... | ALGO | 0.998794 | 4.026775 |
8fd5bd69-718d-4817-a66b-543981fa9016 | iamsaquib2508/Competitive-Programminng | Codeforces/CF 1141 B.cpp | #include<bits/stdc++.h>
#define ffr(i,a,b) for(i=a;i<b;i++)
#define ffrr(i,a,b) for(i=a;i<=b;i++)
#define pb push_back
#define mm(a,b) memset(a,b,sizeof(a))
#define ll long long int
#define pf printf
using namespace std;
int main()
{
int n, i, x;
cin >> n;
int cnt=0, ans=0, fst=0;
cin >> x;
if(x==... | ALGO | 0.999959 | 3.422756 |
d8ae0519-2531-433d-b387-4e5143f8cd85 | iagozag/competitive_programming | contests/cf/contest/2035/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define int ll
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const int MAX = 2e5+10, MOD = 1e9+7;
void solve(){
int n, k = 0; cin >> n;
vector<int> ans(n); ... | ALGO | 0.999988 | 4.248641 |
2acc8aab-f3c2-407d-a9f7-21eed50ca584 | tachyon83/code-rhino | DAY100~199/DAY175-BOJ3184-양/yunkyu.cpp | //양
//https://www.acmicpc.net/problem/3184
#include <iostream>
#include <string>
#include <utility>
#include <memory.h>
#include <queue>
using namespace std;
int r, c;
int wolf = 0, sheep = 0;
string field[250];
bool visited[250][250];
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };
void BFS(int x, int y) {
int i... | ALGO | 0.999979 | 5.220703 |
831201bb-bd01-44a4-b31a-34aa7b1c3367 | mmaxim/Simontacchi | src/engine/x86.cpp | //Mike Maxim
//Assembler routines to help bitboards
#include <board.h>
// Locate first set bit in the bitboard (bit 1 is MSB)
int NO_PROLOG Board::bb_firstset(bitboard word) {
#ifdef WIN32
__asm {
cmp dword ptr[8+esp], 1h
sbb eax, eax
mov edx, dword ptr[8+esp+eax*4]
bsr ecx, edx
... | ALGO | 0.963325 | 5.813816 |
efd1451e-4134-4a48-9bc2-a2796f44aaa7 | HarshCasper/NeoAlgo | C-Plus-Plus/ds/Ascending_priority_queue.cpp | /*
AIM :: TO IMPLEMENT ASCENDING PRIORITY QUEUE
WHAT IS ASCENDING PRIORITY QUEUE ?
In ascending order priority queue, a lower priority number is given as a higher priority in a priority.
For example, we take the numbers from 1 to 5 arranged in an ascending order like 1,2,3,4,5; therefore,
the ... | ALGO | 0.999737 | 4.739437 |
e42001ea-8c09-45b6-8d51-65c4fda3b2cd | duongdr/training-c | Sort_Vector.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
bool User_Def(int item1, int item2);
int main()
{
vector<int> v = {9, 5, 6, 2, 7, 1};
cout << "Before sorting: ";
for_each(v.begin(), v.end(), [](int x) {
cout << x << " ";
});
sort(v.begi... | ALGO | 0.999659 | 4.564666 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.