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 |
|---|---|---|---|---|---|---|---|
fabacc6c-4982-45a0-8b30-04f5b2d9ef7f | le-incroyable1-dev/competitiveProgramming | codeforces/1768B.cpp | #include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
typedef long long ll;
typedef long double ld;
#define pii pair<ll,ll>
#define vi vector< ll >
#define vvi vector< vi >
#define vpi vector< pii >
#define vvpi vector< vpi >
#... | ALGO | 0.999893 | 3.846096 | {
"github_metadata": {
"branch": "main",
"commit_count": 463,
"repo_created_at": "2021-04-19T05:06:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9c74e8aa7c... |
f930aaea-af09-4f74-8e78-86d3c6da1428 | sauravjaiswa/Coding-Problems | Codeforces/AdvertisingAgency.cpp | //Advertising Agency
#include<bits/stdc++.h>
#define lli unsigned long long int
#define mod 1000000007
using namespace std;
//Taken from codeforces solution need to understand logics behind these functions
lli fast_pow(lli a, lli p) {
lli res = 1;
while (p) {
if (p % 2 == 0) {
a = a * 1ll * a % mod;
... | ALGO | 0.999992 | 3.997651 | {
"github_metadata": {
"branch": "master",
"commit_count": 47,
"repo_created_at": "2020-11-01T11:56: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": "c5a97afe7... |
06cbcdf0-532d-4cee-91d6-9d1879f923c4 | Tarunagg1/competitive_programing | gfg-problemsoftheday/Swap Kth nodes from ends.cpp | // Swap Kth nodes from ends
// Medium Accuracy: 46.75% Submissions: 31575 Points: 4
// Given a singly linked list of size N, and an integer K. You need to swap the Kth node from the beginning and Kth node from the end of the linked list. Swap the nodes through the links. Do not change the content of the nodes.
// ... | ALGO | 0.999968 | 4.792689 | {
"github_metadata": {
"branch": "master",
"commit_count": 1108,
"repo_created_at": "2021-02-09T15:02:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 1,
"pull_requests": 1
},
"file_meta": {
"content_id": "42b07f3... |
dbc4ccad-b58f-41c9-9dad-33023730d8cd | JianqiaoLu/code | exercise1.cpp | #include<stdio.h>
#include<math.h>
int main()
{
// int a,b,c;
// double avg;
// scanf("%d%d%d", &a,&b,&c);
// avg = (a+b+c) /3.0;
// printf("%.3f",avg );
// return 0;
// int a;
// double tep;
// scanf("%d", &a);
// tep = 5.0 * (a - 32) /9.0;
// printf("%.3f",tep );
// return 0;
// int n;
... | ALGO | 0.999964 | 3.518746 | {
"github_metadata": {
"branch": "main",
"commit_count": 26,
"repo_created_at": "2021-01-11T06:22:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1cf0a4d2bb6... |
7cf1b75a-d2aa-46dd-b7f7-e3fb63e2c46a | fura2/competitive-programming-codes | yukicoder/1331.cpp | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
class mint{
static const int MOD=1e9+7;
int x;
public:
mint():x(0){}
mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }
mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
mint& operator-=(const mint& m){ ... | ALGO | 0.999949 | 3.464102 | {
"github_metadata": {
"branch": "main",
"commit_count": 225,
"repo_created_at": "2021-05-05T15:14:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7dba0a0b99... |
02c3ea4c-7666-46c5-bc9f-882d9dc54cd4 | devWangBin/CV-image_processing | Harris corner detection/Harris(Gauss_or_not)&Shi-Tomasi&Fast.cpp | #include<opencv2/opencv.hpp>
#include<vector>
#include <iostream>
using namespace cv;
using namespace std;
//全局变量
Mat src, src_gray;
int thresh = 200;
double myHarrisThrehold_ave = 10000000000;
double myHarrisThrehold_Gauss = 1000000000000;
void Shi_Tomasi_demo(Mat& srcImage, int max_cornerNum);
void Fast_demo(Mat& ... | ALGO | 0.984428 | 4.728128 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2018-10-13T11:23:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 21,
"forks": 27,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "33d27d4... |
0ccd8a95-3cc4-47cb-96e2-3a695becb88c | GersonCavalheiro/OpenMPSnapshot | May2023/RepCPP/31732163/partition.cpp |
#include "trinity/partition.h"
namespace trinity {
Partit::Partit(int max_graph_size, int max_part_size) {
max.capa = max_graph_size;
max.part = std::max(6, max_part_size);
nb.cores = omp_get_max_threads();
sync.offset = new int[nb.cores];
task.cardin = new int[max.part];
task.subset = new int* [max.part];
for (i... | ALGO | 0.961971 | 5.505637 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2024-08-19T17:35:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5da4b50796... |
0b750c74-9906-4c69-9afd-c593edfe0677 | codebhendi/codeZ | DAA/ConvexHull.cpp | #include <bits/stdc++.h>
using namespace std;
double xy[2][100000];
double yx[2][100000];
//**********************************************************************************************************************//
// convex hull
//****************************************************************************************... | ALGO | 0.999984 | 3.974493 | {
"github_metadata": {
"branch": "master",
"commit_count": 31,
"repo_created_at": "2015-04-22T23:01:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bbd084af9... |
89ebf664-535d-466c-8f84-1a52437ff2a3 | NathanChenJiabin/Basic-Computer-Vision-algo | binary segementation via Graph cut/graphCuts.cpp | #include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <fstream>
#include "maxflow/graph.h"
#include "image.h"
using namespace std;
using namespace cv;
// This section shows how to use the library to compute a minimum cut on the following graph:
//
// SOURCE
// / \
// 1/ ... | ALGO | 0.999101 | 4.255589 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2018-10-18T08:16: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": "4d3eedd72e... |
cf371799-a773-43f0-9822-71e571c8d416 | ishandutta2007/codeforces-m | maximumshot/normal/1716/F.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = 998244353;
inline int sum_(int a, int ... | ALGO | 0.999859 | 4.756598 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-06-06T01:03: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": "ece57b6a3cd4... |
2a692167-45fe-4530-bd5b-6085eee22b83 | GIBIS-UNIFESP/BIAL | bial/inc/ClusteringIFT.hpp | /* Biomedical Image Analysis Library
* See README file in the root instalation directory for more information.
*/
/**
* @date 2012/Sep/08
* @brief IFT algorithm for clustering purposes.
*/
#ifndef BIALCLUSTERINGIFT_H
#define BIALCLUSTERINGIFT_H
#include "BucketQueue.hpp"
#include "DegeneratedIFT.hpp"
#include "... | ALGO | 0.999542 | 6.114439 | {
"github_metadata": {
"branch": "master",
"commit_count": 186,
"repo_created_at": "2016-10-03T02:55:05.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 10,
"forks": 4,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "6950017a... |
bf6f13e3-0319-4185-9820-7441af52df02 | ankitsri98/Graph-Theory | Binary tree/Binary Search Tree/Merge 2 BSTs.cpp | struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};*/
void util(Node* root, stack<Node* > &st){//putting left diagonal in stack for comparison
Node* cur=root;
while(cur!=NULL){
st.push(cur);
cur=cur->left;
... | ALGO | 0.999998 | 5.629271 | {
"github_metadata": {
"branch": "master",
"commit_count": 108,
"repo_created_at": "2019-09-13T11:19:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "95a5d21e... |
57c5af0d-2594-4aa3-9601-bed34c953727 | 100sarthak100/DataStructures-Algorithms | Code/GS/tappingRainWater.cpp | // Given an array arr[] of N non-negative integers representing
// height of blocks at index i as Ai where the width of each block
// is 1. Compute how much water can be
// trapped in between blocks after raining.
// Input:
// 2
// 4
// 7 4 0 9
// 3
// 6 9 9
// Output:
// 10
// 0
// Explanation:
// Testcase 1: Wa... | ALGO | 0.999969 | 6.377269 | {
"github_metadata": {
"branch": "master",
"commit_count": 40,
"repo_created_at": "2020-05-25T14:43:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 5,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "57c0bf241... |
08a38855-65e5-40ac-b534-7c8a089f0d79 | veronikaEve/LearnCpp | week2/6/e6.cpp | #include <iostream>
using namespace std;
const char PLAYER_1 = 'O';
const char PLAYER_2 = 'X';
int winningStates[8][3][2] = {
{{0, 0}, {0, 1}, {0, 2}},
{{1, 0}, {1, 1}, {1, 2}},
{{2, 0}, {2, 1}, {2, 2}},
{{0, 0}, {1, 0}, {2, 0}},
{{0, 1}, {1, 1}, {2, 1}},
{{0, 2}, {1, 2}, {2, 2}},
{{0, 0},... | ALGO | 0.998995 | 4.607091 | {
"github_metadata": {
"branch": "main",
"commit_count": 68,
"repo_created_at": "2021-11-12T08:20: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": "77f332a14b8... |
e0c825d9-54eb-4bb5-b4c7-d717ce1f37ad | vishalgupta95/leets_code | ibillion.cpp |
/*
We have N different apps with different user growth rates. At a given time t, measured in days, the number of users using an app is g^t (for simplicity we'll allow fractional users), where g is the growth rate for that app. These apps will all be launched at the same time and no user ever uses more than one of the... | ALGO | 0.999793 | 4.815665 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2022-03-26T05:05: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": "161f8dccc7db... |
8ac70961-c11e-47bc-a703-95876fd7d6ac | hobin01/baekjoon | c++/11409.cpp | #include <iostream>
using namespace std;
// no stl mcmf
int n, m;
const int INF = (1 << 31) - 1;
const int MAX_NODE = 802; // 0 : source, 801 : sink, 1 ~ 400 : 직원, 401 ~ 800 : 일
const int WORK_IDX = 400;
const int SOURCE = 0;
const int SINK = 801;
bool graph[MAX_NODE][MAX_NODE]; // 연결 여부만 체크
int cap[MAX_NODE][MAX_... | ALGO | 0.999884 | 3.930286 | {
"github_metadata": {
"branch": "master",
"commit_count": 298,
"repo_created_at": "2020-11-07T14:59:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5e24ea34... |
a9ba7d28-1e80-489a-961a-464d371e9c09 | saarang123/Competitive-Programming | codeforces/52C.cpp | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
// ----------------------------------------Defines and Template-------------------------------------//
#define int long long
#define double long double
#define f first
... | ALGO | 0.999868 | 4.70022 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2021-05-13T07:29:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 11,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "667e5606... |
7ee9d393-8b25-4f72-a3b0-1cc8cd124f5e | hsingh17/MazeSolver | src/MazeSolver.cpp | #include "MazeSolver.h"
#include <algorithm>
MazeSolver::MazeSolver(Maze& m) : m(m) {
SolveMaze(m.Start());
BuildPath(m(m.End().GetPrev().first, m.End().GetPrev().second));
}
void MazeSolver::SolveMaze(Node& start) {
start.SetG(0);
// Calculate h_cost of start. h_cost = f_cost since g_cost = 0
start.SetH(a... | ALGO | 0.999622 | 5.187823 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2019-06-19T20:04: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": "dae0b7c2e... |
41bc15f7-ff8f-414e-aa7f-abdbcb454fe9 | md143rbh7f/competitions | topcoder/srm/453/TheTournamentDivOne.cpp | #include <vector>
using namespace std;
typedef vector<int> vi;
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
vi pts;
int w, d, INF = 1000000, nd[50];
bool dec( int i )
{
while( nd[i]>=0 && (pts[i]-d*nd[i])%w ) nd[i]--;
return nd[i]>=0;
}
struct TheTournamentDivOne
{
int find( vi _pts, ... | ALGO | 0.999897 | 3.649824 | {
"github_metadata": {
"branch": "master",
"commit_count": 628,
"repo_created_at": "2013-08-29T15:52:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 9,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "36efecef... |
ef8794d8-c4da-4332-8cc9-66c65850d769 | sstar2257/PAT-Sort | tree/1135.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
struct node {
int data;
int black;//到根节点的黑色数
int left;
int right;
};
vector<node> tree;
int len;
void build(int prel, int prer) {
if (prel >= prer) {
return;
}
int key = abs(tree[prel].data);
int i;
for (i = prel + 1; i <= prer; i... | ALGO | 0.99999 | 4.367691 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2019-04-05T08:22:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "df62a157e... |
0392e8a0-7901-4787-921b-17bd3eb58afa | yao996186979/ProgramProblems | programproblems/reverseInteger.cpp | //
// reverseInteger.cpp
// programproblems
//
// Created by 姚东 on 2018/12/5.
// Copyright © 2018 姚东. All rights reserved.
//
#include "reverseInteger.hpp"
#include <math.h>
/* 翻转越界问题解决方案
情况1:中间欲加值越界(欲加值=结果位*结果未倍数)
情况2:相加最终结果越界
*/
int reverseInteger(int x){
bool isRight = x > 0;
x = fabs(x);
int x_ca... | ALGO | 0.997248 | 4.079623 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2018-12-05T02:30:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9734f23590... |
91d83f5b-21bf-4d03-9040-e9e3b78886ae | Jordan-Betcher/CPPAssignment2 | Assignment2/src/OrderedLinkedList.h | //============================================================================
// Name : OrderedLinkedList.h
// Author : <NAME>
// Date : 10/23/2017
// Description : OrderedLinkedList a LinkedList that inserts based on comparative operators
//==========================================================... | ALGO | 0.937548 | 5.772577 | {
"github_metadata": {
"branch": "master",
"commit_count": 42,
"repo_created_at": "2017-10-18T14:09:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "96f36464d... |
ab8f61bc-4204-4064-9950-d3bdfb749668 | prateekshyap/DSA | Greedy/LC_2358_MaxNumOfGroupsEnteries.cpp | /*
https://leetcode.com/problems/maximum-number-of-groups-entering-a-competition/submissions/
2358. Maximum Number of Groups Entering a Competition
*/
class Solution {
public:
int maximumGroups(vector<int>& grades) {
int n = grades.size();
if(n==1 || n==2) return 1;
/*
int g... | ALGO | 0.999773 | 5.564935 | {
"github_metadata": {
"branch": "main",
"commit_count": 655,
"repo_created_at": "2021-05-19T17:53:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 15,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a26b27456... |
5d6f2b94-72ee-4ccf-a0da-88450644e350 | foldl/chatllm.cpp | src/custom_ops.cpp | #include "ggml.h"
#include <algorithm>
#include <cmath>
#include <codecvt>
#include <cstring>
#include <fcntl.h>
#include <fstream>
#include <iomanip>
#include <functional>
#include <random>
#include "layers.h"
#undef MIN
#undef MAX
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
... | ALGO | 0.92814 | 3.453165 | {
"github_metadata": {
"branch": "master",
"commit_count": 602,
"repo_created_at": "2023-12-02T08:48:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 665,
"forks": 49,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "76a7f... |
a3ae11f8-3375-44ae-abee-48d450a7bfaa | eidelmanj/concurrent-object-synthesis | c++/actualMain.cpp | #include "tree.h"
#include "pretty.hh"
#include "search.hh"
#include "pretty.hh"
#include "tree_interface.hh"
#include <vector>
#include <stdlib.h>
#include <cassert>
#include <cstring>
#include <fstream>
#include <sstream>
#include <algorithm>
#ifdef __cplusplus
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif... | TOOL | 0.988978 | 3.279688 | {
"github_metadata": {
"branch": "master",
"commit_count": 252,
"repo_created_at": "2016-05-12T13:45:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "969b06fc... |
d20d95ed-5c6e-48e5-aa73-075cf7d707c6 | souvikbera/algorithms | course 2/week 1/scc_cou2_week1.cpp | #include <stdio.h>
#include<conio.h>
#include <iostream>
#include <vector>
#include <stack>
#include<algorithm>
#include <string>
using namespace std;
#define SIZE 875714
struct str {
vector<int> source;
vector<int> dest;
bool visited;
int comp;
};
vector<int> SCC;
vector <int> top;
stack<int> st... | ALGO | 0.999801 | 4.001333 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2017-06-21T19:57: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": "9b6886236e... |
89a6c78f-f045-4ad5-867a-b47b48a09e91 | baeslee/BaekJoon | 백준/Silver/2667. 단지번호붙이기/단지번호붙이기.cc | // 03_BFS_DFS
// p2667. 단지번호붙이기
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
int ans, N;
int map[27][27];
int v[27][27];
vector <int> ex;
int dr[4] = { 1,-1,0,0 };
int dc[4] = { 0,0,1,-1 };
void bfs(pair<int, int> p)
{
int n = 1;
queue<pair<int, int>... | ALGO | 0.999985 | 3.689039 | {
"github_metadata": {
"branch": "main",
"commit_count": 102,
"repo_created_at": "2025-04-27T02:36: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": "bf3f69b256... |
4ec0a912-3343-4c4a-a666-45db692270a5 | amitkparida/ProgrammingBasics | ProblemSolving/searching.cpp |
/*
Let say we have an array of numbers.In this array every element is dependent on its previous element by - 1, 0 or +1.
arr = [4, 3, 4, 5, 6, 7, 6, 5, 4, 3]
find = 7
5
arr = [4, 3, 4, 5, 6, 7, 6, 5, 4, 3]
find = 8
- 1
Find if the number is present or not, If present return the first occurrence index of the number ... | ALGO | 0.999984 | 4.957671 | {
"github_metadata": {
"branch": "master",
"commit_count": 240,
"repo_created_at": "2022-10-16T20:50:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5b905476... |
6eedfc94-2418-44e3-b424-1d51860833e1 | herndon/FNALComp | Tracking/include/InitializeHelix.hh | #ifndef Tracking_InitializeHelix_hh
#define Tracking_InitializeHelix_hh
//============================================================================
// InitializeHelix.hh
// header with class definition of the InitializeHelix from 3 points
//
// Author <NAME>, University of Wisconsin,
// Fermi N... | ALGO | 0.992604 | 4.377968 | {
"github_metadata": {
"branch": "master",
"commit_count": 236,
"repo_created_at": "2014-06-03T16:26:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ae99ba0e... |
aba4b00a-7abc-47ce-852a-a40b2bf93b01 | olethrosdc/beliefbox | src/statistics/DirichletFiniteOutcomes.h | /* -*- Mode: C++; -*- */
// copyright (c) 20012 by <NAME> <<EMAIL>>
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the ter... | ALGO | 0.942869 | 5.978927 | {
"github_metadata": {
"branch": "master",
"commit_count": 1611,
"repo_created_at": "2015-03-20T15:15:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 5,
"issues": 4,
"pull_requests": 0
},
"file_meta": {
"content_id": "d3d2f39... |
cec9c392-f1a6-4e6d-9574-495183bf9727 | NewdawnALM/MySnake | Node.h |
using namespace info;
// 节点类:
class node {
const char *snake_char; // 节点的字符
short step; // 节点的长度(横向)
COORD cd; // 节点所在的坐标(用来在屏幕上对应的位置绘画出来)
short dir = stop; // 节点前进的方向,也表示前一个节点在哪个方向
bool virt = 0; // 是否为虚拟节点(不会画出来)
public:
node(const char *... | TOOL | 0.976538 | 3.919152 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2016-03-04T08:33:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "11a06f143... |
79d3fd6a-3225-44df-99c0-15fc7508c131 | ninad-moree/DataStructuresAlgorithms | Stack/0071-SimplifyPath.cpp | /*
You are given an absolute path for a Unix-style file system, which always begins with a slash '/'. Your task is to transform this absolute path into its
simplified canonical path.The rules of a Unix-style file system are as follows:
A single period '.' represents the current directory.
A double peri... | ALGO | 0.999878 | 5.899398 | {
"github_metadata": {
"branch": "main",
"commit_count": 1213,
"repo_created_at": "2023-12-12T04:49:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "34eabce21... |
17965af2-fe69-4350-aa67-a4efa9a9d5e8 | DanielPolt/BlackJack-Program | daniel_polt_blackjack.cpp | /*
Solution to blackjack project
Solution written by <NAME>.
*/
//This program uses object-oriented programming for a simple game of blackjack between the user and the computer
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <random>
#include <chrono>
#include "Card.h"
#incl... | ALGO | 0.944568 | 4.177926 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2020-09-12T20:13: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": "81259d796e... |
d53dabbe-1de2-4d04-bc80-52957da81ffa | titaneric/problem | UVa/Volumn 121/12100.cpp | #include <iostream>
#include <queue>
#include <array>
#include <algorithm>
using namespace std;
int main()
{
int total;
scanf("%d", &total);
while (total--)
{
int n, m;
scanf("%d%d", &n, &m);
queue<int> task_queue;
queue<int> pos_queue;
array<int, 10> priority... | ALGO | 0.999967 | 3.385871 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2019-03-30T18:54:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cbd9b9ca7... |
fe373420-c03f-4f35-8148-1e76f82a0dd5 | trilinos/Trilinos | packages/kokkos-kernels/sparse/impl/KokkosSparse_spadd_symbolic_impl.hpp | //@HEADER
// ************************************************************************
//
// Kokkos v. 4.0
// Copyright (2022) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Governmen... | ALGO | 0.998681 | 7.774212 | {
"github_metadata": {
"branch": "master",
"commit_count": 104031,
"repo_created_at": "2015-11-16T19:39:16.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1299,
"forks": 593,
"issues": 263,
"pull_requests": 61
},
"file_meta": {
"content_id":... |
98a9001e-6660-4993-886f-e35e5e16be4e | asksaurabh/Leetcode_Prep | 02_Dynamic_programm/01_frog_atMost_k.cpp | #include <bits/stdc++.h>
using namespace std;
// TOP DOWN
// int frogJump(int index, int k, vector<int> &height, vector<int> &dp) {
// if (index == 0) return 0;
// if (index == 1) return abs(height[1] - height[0]);
// if (dp[index] != -1) return dp[index];
// int minCost = INT_MAX;
// for (int step = 1; step <... | ALGO | 0.99988 | 4.771104 | {
"github_metadata": {
"branch": "main",
"commit_count": 353,
"repo_created_at": "2022-02-04T19:27:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "978540f934... |
409038e6-d409-4e08-9fe8-032d71313e25 | bbb1293/baekjoon | 백준/Gold/15999. 뒤집기/뒤집기.cc | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int n, m;
char grid[2000][2001];
bool is_fixed[2000][2000];
long long power(int k) {
if (k == 0) {
return 1;
}
if (k == 1) {
return 2;
}
long long ret = power(k / 2);
if (k & 1) {
return ((... | ALGO | 0.999986 | 4.045033 | {
"github_metadata": {
"branch": "main",
"commit_count": 498,
"repo_created_at": "2022-02-01T14:25:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9485b97241... |
26ca2294-32c8-4356-83ce-a9892bf5fe2e | conlacda/algo-practice | cses/1668.cpp | /*
https://cses.fi/problemset/task/1668/
Sử dụng duyệt DFS()
Mỗi khi duyệt tới 1 node thì đánh dấu số team cho nó (mặc định là 1)
Nếu node u được duyệt graph[u] = [v,...]. Có team[u]==team[v] -> ko thỏa mãn
còn nếu ko thì đánh dấu u =1 thì v=2, u=2 => v=1
*/
#include<bits/stdc++.h>
using namespace std;
int n, v;
vect... | ALGO | 0.999991 | 4.492162 | {
"github_metadata": {
"branch": "master",
"commit_count": 427,
"repo_created_at": "2020-11-22T14:26:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f6ac3415... |
9e28d087-44b3-4d10-98ab-ec0309c2b0fd | mishu-maisha/again-cpp | STLmap.cpp | #include <iostream>
#include<map>
#include<unordered_map>// have to add this header file
using namespace std;
int main(){
map<string,int> m;
//m[key]=value
m["tv"]=100;
m["laptop"]=100;
m["headphones"]=50;
m["tablets"]=120;
m["watch"]=50;
//m.insert({"camera",25});//passes as pair
... | TOOL | 0.943302 | 3.848954 | {
"github_metadata": {
"branch": "main",
"commit_count": 21,
"repo_created_at": "2025-03-15T10:11:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9a7d6e9958f... |
c0c7615f-04a4-49b1-b1db-34608a8bb418 | amaitou/DataStructures | linkedlist/doublylinkedlist/doublylinkedlist.cpp |
#include <iostream>
using namespace std ;
template <typename T>
class dll
{
private :
struct node
{
T d ;
node *next = nullptr ;
node *prev = nullptr ;
} ;
node *head = nullptr ;
public :
void _display() ;
void _append(T v) ;
void _remove(T v) ;
void _insert(int p , T v) ;
void _rem... | ALGO | 0.999081 | 4.931741 | {
"github_metadata": {
"branch": "main",
"commit_count": 68,
"repo_created_at": "2021-01-12T17:08:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 43,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ad99a1a798... |
334493cb-74ba-4247-b3fa-d98001f03f33 | gjainiitr/Algorithms-and-Data-Structres | Matrix/Spirally-Traversing-a-Matrix.cpp | // Problem URL :- https://practice.geeksforgeeks.org/problems/spirally-traversing-a-matrix-1587115621/1
#include <iostream>
using namespace std;
#define SIZE 30
void spirallyTraverse(int m, int n, int ar[SIZE][SIZE]);
int main() {
int T = 0;
scanf("%d",&T);
while(T--)
{
int m,n;
scanf("%d",&... | ALGO | 0.999654 | 4.907466 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2020-07-06T11:56:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "71918e4055... |
f7d69bd6-13d1-4bca-a0ea-83a69ef53aa0 | MohamedAfifii/SLAM-and-navigation-using-ROS | src/rikobot_filters/src/kalman_filter.h |
//Perform a kalman filter udpate step and return the current estimate of the pose
#include <Eigen/Dense>
#include "my_lib.h"
using namespace Eigen;
Vector3d k, mu = Vector3d::Zero();
Matrix3d G, sigma = Matrix3d::Zero(), R = 1e-3*Matrix3d::Identity(), I = Matrix3d::Identity();
RowVector3d c(0,0,1);
double Q = 1e-6;... | ALGO | 0.999483 | 5.243036 | {
"github_metadata": {
"branch": "master",
"commit_count": 43,
"repo_created_at": "2018-03-30T13:14:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d8bf59501... |
932991eb-b384-4858-a746-9fe26cfc1482 | Oodysseass/txt_data_structures | unsorted.h | #ifndef UNSORTED_H
#define UNSORTED_H
#include <iostream>
#include <string>
#include <chrono>
using namespace std;
using namespace std::chrono;
/**
* Class denoting an unsorted matrix with words.
*/
class Unsorted
{
private:
long long unsigned int wordsAdded;
string* words;
public:
/**
* Initiali... | ALGO | 0.956772 | 4.321567 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2022-03-13T19:43:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7bb7bc48ce92... |
28fcf894-453c-481c-baa0-9c0ce66aa78e | roca12/gpccodes | Codigos estudiantes por lenguaje/C++/Bryann Valderrama/Algoritmos de Busqueda/findPair.cpp | #include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
bool findPair(int lista[], int x, int tamanio)
{
int i = 0, j = 0;
while (i < tamanio && j < tamanio)
{
if (i != j && lista[j] - lista[i] == x)
{
cout << "Par encontrado (" << lista[j] << "-" << lista[i] << ")" << ... | ALGO | 0.999774 | 4.798194 | {
"github_metadata": {
"branch": "master",
"commit_count": 2009,
"repo_created_at": "2020-06-08T15:37:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 6,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "73c34b5... |
77f2f7a3-fab8-4e4f-a5fb-5c0ac17494c0 | micahbow/ShortCut | mainwindow.cpp | #include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(std::vector<cityNode*> & cityNodes,std::vector<std::vector<std::pair<double,int>*>> edges, QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
scene = new QGraphicsScene(this);
ui->graphicsVie... | ALGO | 0.96558 | 5.16471 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2021-04-16T21:27:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "79957ac89719... |
ef9a8b21-1a64-4b56-a9d4-7ccc6ca2998a | kaestro/algorithms_v2 | daily/april/week4/0420/sw-5650 so.cpp | #include <stdio.h>
#include <string.h>
#include <vector>
using vi = std::vector<int>;
using vvi = std::vector<vi>;
typedef struct {
int widx;
int row;
int col;
} point;
vvi block;
point WormHole[10];
const int UP = 1, RIGHT = 2, DOWN = 3, LEFT = 4;
// left down
int Block_1(int dir) {
int ans;
s... | ALGO | 0.999563 | 3.963011 | {
"github_metadata": {
"branch": "master",
"commit_count": 119,
"repo_created_at": "2020-03-17T01:54:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5e552d78... |
99769ef5-8ebf-44c6-9dd6-bf1cb12912fd | Charen523/Charen-Algorithm | C++17/백준/Silver/2667. 단지번호붙이기/단지번호붙이기.cc | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
vector<pair<int, int>> dir = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
int bfs(vector<vector<int>>& v, int x, int y) {
int n = v.size();
int result = 1;
queue<pair<int, int>> q;
q.push({x, y});
v[x][y] = 0;
while (!q... | ALGO | 0.999997 | 4.300058 | {
"github_metadata": {
"branch": "main",
"commit_count": 327,
"repo_created_at": "2024-09-07T03:02:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4ea23f50b1... |
c97264b5-061c-444b-aa09-5e6b7b3fbbc7 | DLR-RM/SID-SLAM | include/Tracker/CeresTracker.h |
#ifndef IDNAV_CERESTRACKER_H
#define IDNAV_CERESTRACKER_H
#include "../Frame.h"
namespace IDNav{
class CeresTracker {
public:
void estimatePoseCoarse(vecPt& hgpForTracking_, vecFt& featuresForTracking_, typeFrame& trackedFrame_, dataType poseGuess_ [6]) const;
void estimatePose(vecPt& hgpFor... | ALGO | 0.915748 | 6.508934 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-05-24T09:49:00.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "f64ffc736482f... |
90422da9-3d53-4e69-8ce0-d1552a5fb924 | letrungkien211/Algorithms | Codejam/2013/practice/p4.cpp | #include <cstdio>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
class Data{
public:
int A;
int B;
int operator[](int i) const{
return i==0 ? A : B;
}
int &operator[](int i) {
return i==0 ? A : B;
}
};
bool process(const vector<Data> &dat... | ALGO | 0.999292 | 4.15927 | {
"github_metadata": {
"branch": "master",
"commit_count": 31,
"repo_created_at": "2014-02-09T12:31:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "841f5e58f... |
5c1940cf-e664-4531-84e9-f5f3ae6cb274 | mysql/mysql-server | sql/join_optimizer/bit_utils.h | /* Copyright (c) 2020, 2025, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is designed to work with certain software (including... | ALGO | 0.971571 | 7.680204 | {
"github_metadata": {
"branch": "trunk",
"commit_count": 186679,
"repo_created_at": "2014-09-26T09:31:03.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 11540,
"forks": 4072,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "... |
484993ab-8d75-47cb-a1af-e1ee3ce7b9d0 | sharhp21/algorithm | baekjoon/섬의 개수.cpp | #include<iostream>
#include<queue>
#include<algorithm>
using namespace std;
int a[50][50];
int d[50][50];
int dx[8] = { -1, -1, -1, 0, 1, 1, 1, 0 };
int dy[8] = { -1, 0, 1, 1, 1, 0, -1, -1 };
int n, m;
void bfs(int x, int y, int cnt) {
queue<pair<int, int>> q;
q.push(make_pair(x, y));
d[x][y] = cnt;
while (!q.empt... | ALGO | 0.999921 | 4.082661 | {
"github_metadata": {
"branch": "master",
"commit_count": 93,
"repo_created_at": "2018-11-24T05:48:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8f12e3651... |
99727571-bc67-4a14-96d9-e6355cf18065 | purple-vine/codes | code before 6-11/Luogu/P4139 上帝与集合.cpp | #include <cstdio>
using namespace std;
int phi(int n){
int ans = n;
for(int i = 2; i * i <= n; i++) if(n % i == 0) {
ans = ans / i * (i-1); while(n % i == 0) n /= i;
}
if(n > 1) ans = ans / n * (n-1);
return ans;
}
int qpow(int a, int b, int p){
int ans = 1;
for(; b; b >>= 1) {if(b & 1) ans = 1ll * ans * a % ... | ALGO | 0.999762 | 4.546396 | {
"github_metadata": {
"branch": "master",
"commit_count": 272,
"repo_created_at": "2022-06-11T08:54: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": "606b60dd... |
38817626-d4da-432e-9be4-83bf3cc9454a | baltzell/kinfit | KinFitter.h | #ifndef KinFitter_h
#define KinFitter_h
#include <limits>
#include "TVectorD.h"
#include "TMatrixD.h"
#include "TLorentzVector.h"
#include "KinParticle.h"
#include "KinConstraint_EnergyMomentum.h"
#include "KinConstraint_InvMass.h"
#include "KinConstraint_MissingMass.h"
// Kinfitter class
// This class implemtent t... | ALGO | 0.955921 | 5.116716 | {
"github_metadata": {
"branch": "master",
"commit_count": 73,
"repo_created_at": "2022-10-30T16:47:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ad4532149... |
dbbaa0f2-e6db-45df-a218-11945255dca9 | bingquanLi/legged_perceptive | quadruped_locomotion-master/quadruped_wbc/src/Wbic.cpp | //
// Created by chenzheng on 23-11-3.
//
#include "quadruped_wbc/Wbic.h"
#include <qpOASES.hpp>
#include <switched_model_interface/core/Rotations.h>
namespace quadruped {
vector_t Wbic::update(const vector_t& stateMeasured, const vector_t& inputMeasured, const vector_t& stateDesired, const vector_t& inputDesired,
... | ALGO | 0.999217 | 4.703658 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-05-09T07:39:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "430d625548f0... |
d05c872d-2a53-40ce-b76f-a67ee4ba138f | ishandutta2007/codeforces-c | cheetose/normal/909/F.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c... | ALGO | 0.999929 | 3.398495 | {
"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": "877cbfb2806f... |
61a8972e-1103-4ec8-b9d1-31dd410ccc96 | DevC21/Algorithm_Study | Programmers/Level 2/49994.cpp | #include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
set<string> vis;
int solution(string dirs) {
int answer = 0;
pair<int, int> cur = {0, 0};
//양방향을 기록하기 위해서 XY/X'Y' <-> X'Y'/XY 를 모두 저장한다.
string prev = "";
for(auto x : dirs){
// prev는 XY 좌표 저장
prev = "";... | ALGO | 0.999852 | 4.345983 | {
"github_metadata": {
"branch": "main",
"commit_count": 326,
"repo_created_at": "2023-02-05T10:53: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": "94aa1d3f98... |
09d24363-0aef-46ae-a245-dcba389d9c3e | ishandutta2007/codeforces-e | emengdeath/normal/1260/E.cpp | #include <cstdio>
#include <algorithm>
#include <iostream>
#include <queue>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <unordered_map>
using namespace std;
int n;
int sum[100];
int a[500000], b[500000];
long long f[500000][20];
long long ans;
int main() {
scan... | ALGO | 0.999778 | 3.377373 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:34: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": "8be4ad74e61b... |
5ea898a5-3474-46a0-a7b4-4181038f55bc | mesax1/Data-driven-last-mile-routing | GRASP_TW/src/metaheuristic/methods/neighborhood.h | #pragma once
#include "../model/solution.h"
class TSPNeighborhood{
public:
bool first_improvement;
std::string id;
TSPNeighborhood(bool first_improvement = false, const std::string& id = "");
~TSPNeighborhood();
virtual std::shared_ptr <TSPSolution> search_neighbors(std::shared_ptr <TSPSolution> ... | ALGO | 0.999533 | 5.216293 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2022-06-24T00:59:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6699665421aa... |
cece4582-d468-4fcb-95d9-dfece0525bea | Damonnnn/Developer-Career | Practice/Unordered Containers/main.cpp | #include<iostream>
#include<unordered_set>
#include<numeric>
#include<string>
#include "hashval.h"
using namespace std;
class Customer {
private:
string fname;
string lname;
long no;
public:
Customer (const string& fn, const string& ln, long n) : fname(fn), lname(ln), no(n) {}
friend ostream& operator << (ostream... | ALGO | 0.990068 | 5.280267 | {
"github_metadata": {
"branch": "master",
"commit_count": 39,
"repo_created_at": "2016-11-01T05:29:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c9ee9d62b... |
f34d6e70-ddd8-49ee-a7e0-f5830a4ab477 | Maison-de-la-Simulation/heraclespp | src/gravity/gravity.hpp | // SPDX-FileCopyrightText: 2025 The HERACLES++ development team, see COPYRIGHT.md file
//
// SPDX-License-Identifier: MIT
//!
//! @file gravity.hpp
//!
#pragma once
#include <algorithm>
#include <utility>
#include <stdexcept>
#include <Kokkos_Core.hpp>
#include <grid.hpp>
#include <kokkos_shortcut.hpp>
#include <no... | ALGO | 0.930061 | 7.185812 | {
"github_metadata": {
"branch": "main",
"commit_count": 1054,
"repo_created_at": "2025-03-20T08:37:11.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 10,
"forks": 2,
"issues": 5,
"pull_requests": 2
},
"file_meta": {
"content_id": "5fb58f2d3... |
482524e5-315b-46d9-a3b3-362607c898b9 | jelmerbe/Financial-Computing-II | CPP/Homework4/Homework4.hpp | #ifndef __Homework4_hpp__
#define __Homework4_hpp__
/**
* @file Homework4.hpp
* @author <NAME> (<EMAIL>)
* @brief Homework 4: standard and barrier options on a stock.
* @version 1
* @date 2021-02-12
*
* @copyright Copyright (c) 2021
*
*/
#include "cfl/AssetModel.hpp"
#include "cfl/Data.hpp"
/**
* @mainpage... | ALGO | 0.987903 | 6.892514 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-05-05T10:12: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": "c3a4cefaeafc... |
f1fc62d9-0673-4f2b-99e4-6c901f650069 | woshiluo/algorithm_competition | cf/old/1117/C.cpp | #include <cstdio>
inline long long Aabs(long long a){return a < 0? (0 - a): a;}
const long long N = 1e5 + 1e4;
long long x1, y1, x2, y2, dx, dy, n, tmp, ans, mid;
char str[N];
int main(){
scanf("%lld%lld", &x1, &y1);
scanf("%lld%lld", &x2, &y2);
scanf("%lld", &n);
scanf("%s", str + 1);
for(long long i = 1; ... | ALGO | 0.999962 | 3.712358 | {
"github_metadata": {
"branch": "master",
"commit_count": 67,
"repo_created_at": "2019-01-06T05:21: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": "1ebb3fddb... |
ba8c6b43-e3b7-4d96-9578-eedf21246ca0 | DavidWisdom/NAM | verticalpriority.cpp | #include "verticalpriority.h"
namespace NAM
{
VerticalPriority* VerticalPriority::instance = nullptr;
std::mutex VerticalPriority::mutex;
VerticalPriority* VerticalPriority::getInstance() {
if (instance == nullptr) {
mutex.lock();
if (instance == nullptr) {
instance = new VerticalPriority();
}
mutex.unlock(... | ALGO | 0.998935 | 4.940041 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2022-08-18T11:17:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4d9bdb182fba... |
778987f9-c282-4769-8bcd-e632d4cfd15f | godotengine/godot | thirdparty/jolt_physics/Jolt/Physics/SoftBody/SoftBodySharedSettings.cpp | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
// SPDX-FileCopyrightText: 2023 <NAME>
// SPDX-License-Identifier: MIT
#include <Jolt/Jolt.h>
#include <Jolt/Physics/SoftBody/SoftBodySharedSettings.h>
#include <Jolt/Physics/SoftBody/SoftBodyUpdateContext.h>
#include <Jolt/ObjectStream/TypeDeclarations.... | ALGO | 0.951979 | 6.163581 | {
"github_metadata": {
"branch": "master",
"commit_count": 76043,
"repo_created_at": "2014-01-04T16:05:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 98972,
"forks": 22820,
"issues": 5000,
"pull_requests": 3866
},
"file_meta": {
"content... |
48746386-1b19-4fa7-a30c-7f1aec1af252 | RasPlex/OpenPHT | xbmc/screensavers/rsxs-0.9/src/hyperspace/spline.cc | /*
* Really Slick XScreenSavers
* Copyright (C) 2002-2006 <NAME>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be ... | ALGO | 0.984257 | 5.156938 | {
"github_metadata": {
"branch": "openpht-1.9",
"commit_count": 25886,
"repo_created_at": "2015-11-08T18:03:47.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 599,
"forks": 106,
"issues": 178,
"pull_requests": 2
},
"file_meta": {
"content_id... |
fe35d11d-a562-4a2a-8067-f5d410aa6baa | 5an7y/CPProblemGenerator | Problems/Tecnicas/DosPunteros/BuscandoPokemones/case_generator.cpp | #include <iostream>
#include "Generator.hpp"
#include "Random.hpp"
std::string usableLetters;
int main(int argc, char *argv[]) {
Generator::init_generator(argc, argv);
/*
Use Generator::case_in<< to put elements in case input.
Use Generator::case_out<< to put elements in case output.
... | ALGO | 0.958789 | 3.313494 | {
"github_metadata": {
"branch": "main",
"commit_count": 32,
"repo_created_at": "2023-05-07T15:15: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": "66f2c0110fa... |
d88058d5-24b0-4064-8e4b-78e9d6db8b78 | slava-sh/code-plagiarism-detector | data/final-02/sources/u206347_489_F_8733437.cpp | #include <bits/stdtr1c++.h>
#define MAX 505
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
#define dbg(x) cout << #x << " = " << x << endl
using namespace std;
int n, m, MOD = 100000007;
char str[MAX];
long long dp[MAX][MAX];
bool visited[MAX][MAX], ar[MAX][MAX];
long long ... | ALGO | 0.999982 | 3.665461 | {
"github_metadata": {
"branch": "master",
"commit_count": 135,
"repo_created_at": "2015-04-26T21:39:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6e9b1668... |
237e8bc9-a1e9-4e5e-8fcf-243f2482259c | diesuki4/Algorithm_Learn | 프로그래머스/Level 3/불량 사용자/main.cpp | #include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <regex>
using namespace std;
void rDFS(vector<vector<string>>& candidates, set<string> current, set<set<string>>& result);
int solution(vector<string> user_id, vector<string> banned_id);
int main(int argc, char* argv[])
{
cout << ... | ALGO | 0.997656 | 4.327672 | {
"github_metadata": {
"branch": "main",
"commit_count": 458,
"repo_created_at": "2022-07-11T22:39:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f64b49d9ba... |
8766dd50-1352-446b-a0bd-da81c48d1d0b | projeto-de-algoritmos/Final_Chega_Mais_Perto | Headers/Grafo.h | #pragma once
#include <iostream>
#include <list>
#include <queue>
#define INFINITO 10000000
using namespace std;
class Grafo
{
private:
int V; // número de vértices
// ponteiro para um array contendo as listas de adjacências
list<pair<int, int> > * adj;
public:
// construtor
Grafo(int V)
{
this->V = V; //... | ALGO | 0.999464 | 3.70223 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2022-09-15T00:17:51.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "212589bc3e68f... |
53d8ec37-b6a7-43b0-b32e-8ba3312422bb | skyich/CS321 | MPI9Matr12.cpp | #include "pt4.h"
#include "mpi.h"
#include <cmath>
int k; // количество процессов
int r; // ранг текущего процесса
int m, p, q; // размеры исходных матриц
int na, nb; // размеры полос матриц
int *a_, *b_, *c_; // массивы для хранения исходных матриц в главном процессе
int *a... | ALGO | 0.999755 | 3.452723 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-12-29T17:38:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "38cc64b6c3... |
d5f68818-19b8-4a00-86ab-5cc3f9c9b78e | LDAP/parallel_levenshtein | implementation/naive_levenshtein.hpp | #pragma once
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <thread>
#include <vector>
#include "implementation/levenshtein_penalty_functions.hpp"
template <class PenaltyClass = levenshtein::KBDistance> class NaiveLevenshtein {
public:
NaiveLevenshtein(PenaltyClass penalt... | ALGO | 0.99342 | 6.855577 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2022-09-14T09:18: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": "0a939095ff16... |
7a7658b3-a568-47d5-9517-1a9d6255a0b0 | BlackFrog-w/CPlusToolLibrary | sort/quick_sor/main.cpp | /*
* @Author: BlackFrog
* @Date: 2022-10-23 00:00:18
* @LastEditTime: 2022-10-24 23:58:13
* @Description:
* 快速排序
* 参考链接:
* https://interviewguide.cn/notes/03-hunting_job/03-algorithm/01-basic-algorithm/02-04-%E5%8D%81%E5%A4%A7%E6%8E%92%E5%BA%8F.html
*
* Copyright (c) 2022 by BlackFrog, All Rights Reserved.
... | ALGO | 0.99997 | 5.440992 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2022-06-12T11:20:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d4978cff1... |
52e3486f-f731-4ab3-a66e-f05ac8a0183c | Aryan-Satija/DSA | LINKED LIST/singly linked list/partitionLL.cpp | // LEETCODE -> Partition List
#include <bits/stdc++.h>
using namespace std;
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) {}
};
ListNode* partition(ListNode* head, int x... | ALGO | 0.999994 | 5.515829 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T13:38:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c3e5264f318f... |
0f2fad2d-94db-4f7d-87f4-5138211e5b02 | sebastianjk-t/sdl2-collection | snek.cpp | #include <SDL.h>
#include <vector>
#include <queue>
using namespace std;
vector<vector<int>> addBerry(vector <vector <int>>& grid, bool isPortal)
{
srand(time(NULL));
vector<vector<int>> portal;
int head[2] = {rand() % (int) (grid.size() - 2) + 1, rand() % (int) (grid[0].size() - 2) + 1};
while (grid[head[0]][... | ALGO | 0.990985 | 4.808155 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2022-03-07T10:38:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5fd9b6cbc7b... |
95e339de-474b-43f0-b3ba-6d39eb548d21 | anurag-shekhar/Competitive-Programming | Leetcode/Problems/906.SuperPalindromes/SuperPalindromes.cpp | /*
****************************************************************
* Author : <NAME>
* Email : <EMAIL>
*
* Github : https://github.com/anurag-shekhar
* LinkedIn : https://www.linkedin.com/in/anurag-shekhar/
*
* File Name : SuperPalindromes.cpp
* Created on : Wed May 12 2021
**********************************... | ALGO | 0.999683 | 5.733366 | {
"github_metadata": {
"branch": "master",
"commit_count": 408,
"repo_created_at": "2021-05-07T22:33:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 7,
"pull_requests": 0
},
"file_meta": {
"content_id": "66314855... |
c5b0fde6-a791-4864-98da-a1e891cea85b | xingrong/leetcode-solutions | c++/svr/ValidNumber.cpp | class Solution {
public:
bool isNumber(const char *s) {
bool res = false;
if(s == NULL) return false;
while(*s == ' ') ++s;
if(*s == '\0') return false;
if(*s == '+' || *s == '-') ++s;
const char *head = s;
bool hasE = false;
bool hasP = false;
... | ALGO | 0.930255 | 4.409151 | {
"github_metadata": {
"branch": "develop",
"commit_count": 11,
"repo_created_at": "2018-08-20T08:11:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "174e8461... |
e28ab493-d76e-4e26-9cce-98350806511b | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/10/1031/personal_submission/cf590a_if.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void solve() {
int n;
cin >> n;
vector<int>a(n);
for(int i = 0; i < n; i++){
cin >> a[i];
}
vector<int>p(n, -1);
p[0] = a[0];
p[n - 1] = a[n - 1];
vector<int>b;
vector<int>tar;
tar.push_back(0);
t... | ALGO | 0.999991 | 3.737476 | {
"github_metadata": {
"branch": "main",
"commit_count": 20410,
"repo_created_at": "2024-02-26T01:04:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 478,
"forks": 302,
"issues": 0,
"pull_requests": 7
},
"file_meta": {
"content_id": "e50e... |
1cafe204-e71d-4919-a859-c59d7799d7e0 | huynhtuan17ti/competitive-programming | online_judge/codeforces/1555E/sol.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
#define mp make_pair
#define fi first
#define se second
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
template <typ... | ALGO | 0.999982 | 4.374058 | {
"github_metadata": {
"branch": "main",
"commit_count": 404,
"repo_created_at": "2021-01-01T07:15:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9278d3b520... |
8e134c0b-10fe-4e13-987a-a46a2a63e06b | HugoLeRoy94/Hexagon2 | Ham.h | #ifndef Ham_h
#define Ham_h
struct Ham{
std::map<std::pair<Node*, Node*>, Spring*> springs;
std::vector<Spring3*> springs3;
double Eflip=0;
void CheckSteadiness(VecDoub_I &x, double EmaxSpring, double EmaxSpring3)
{
Doub Nrj(0.);
for(auto& it: springs){
Nrj=it.second->ComputeNRJ(x);
if(N... | ALGO | 0.995264 | 4.282485 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2020-10-20T08:22:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "30c058f91... |
c2d0bc63-ca3a-40e5-a299-8413f42c8ae3 | LutzGross/esys-escript.github.io | trilinos_source15/packages/nox/test/epetra/LOCA_Brusselator/Brusselator.H | //@HEADER
// ************************************************************************
//
// LOCA: Library of Continuation Algorithms Package
// Copyright (2005) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or o... | ALGO | 0.998333 | 6.164253 | {
"github_metadata": {
"branch": "master",
"commit_count": 5724,
"repo_created_at": "2020-08-10T02:31:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 34,
"forks": 15,
"issues": 63,
"pull_requests": 0
},
"file_meta": {
"content_id": "17c3... |
fa1b3666-4b45-4531-a908-7654cf5a8d2d | Just-Koi/c-- | zadanie.cpp | #include <iostream>
#include <cmath>
#include <string>
using namespace std;
/*
- Klient podaje pieniądze
- Kasjer sprawdza ilość pieniędzy oraz produkt
- Odejmuje wartość piniędzy od kosztu produktu
*/
void shopee(string product, int price){
cout << "Pański produkt to " << product << ", jego koszt to " <<... | TOOL | 0.909261 | 3.76686 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2022-10-24T15:04:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b3d5698f1c3... |
4a5029bd-d65b-4fc8-bf5a-9e45b2d105fd | balajiofficial/CompetitiveProgramming | Codeforces/658A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
int n, c;
cin >> n >> c;
int a[50], b[50];
for(int i= 0; i <n; ++i)
cin >> a[i];
for(int i =0; i < n; ++i)
cin >> b[i];
int d = 0, e = 0;
for(int i = n - 1; i >= 0;--i) {
e += max(0, a[i] - c * b[i]);
if (i != 0)
b[i - 1... | ALGO | 0.999991 | 3.145693 | {
"github_metadata": {
"branch": "main",
"commit_count": 135,
"repo_created_at": "2020-12-14T09:57:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "af880b76ca... |
310b9de1-5211-402e-8945-fef532983e48 | ishandutta2007/codeforces-k | ko_osaga/normal/1534/C.cpp | #include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
using lint = long long;
using pi = pair<int, int>;
const int MAXN = 3000005;
const int mod = 1e9 + 7;
struct disj{
int pa[MAXN];
void init(int n){
iota(pa, pa + n + 1, 0);
}
int find(int x){
retu... | ALGO | 0.999939 | 4.326175 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T06:06: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": "ed8dd6064f68... |
383b4a15-43d8-4d45-845f-47d2685912d0 | jesiv/soTp1 | tp1/simusched/sched_rr2.cpp | #include "sched_rr2.h"
#include "basesched.h"
#include <iostream>
using namespace std;
SchedRR2::SchedRR2(vector<int> argn) {
// Round robin recibe la cantidad de cores y sus cpu_quantum por parámetro
int cantCores = argn[1];
cout << "cantidad de cores " << cantCores << endl;
queue<int> q;
vector<int> v;
f... | ALGO | 0.994668 | 3.697524 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2015-08-26T00:00: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": "04f16c438... |
6353d874-4ed4-47f0-9e2d-d8bb750521f4 | Fede-ai/Neural-network-visualization | Neural-network-visualization/src/layer.h | #pragma once
#include <vector>
#include <SFML/Graphics.hpp>
class Layer
{
public:
//input layer is not a layer
//layer obj contains the nodes and the wheights between the nodes of this layer and the previus one
Layer(int inSizeBef, int inSizeAft);
void setRandomLayerValues();
static int random(int min, int max);... | ALGO | 0.967494 | 3.50475 | {
"github_metadata": {
"branch": "main",
"commit_count": 26,
"repo_created_at": "2023-08-14T13:44:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5ed30962039... |
47b703eb-28ee-47d6-af29-fe461a8a1a93 | mohit-thakre/DSA | DAY48/Solution142.cpp | #include <iostream>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
class Node
{
public:
int data;
Node *left;
Node *right;
Node(int val)
{
this->data = val;
this->left = NULL;
this->right = NULL;
}
};
int LCA(Node *root, Node *p, Node *q)
{
... | ALGO | 0.999998 | 5.630884 | {
"github_metadata": {
"branch": "main",
"commit_count": 65,
"repo_created_at": "2024-12-16T16:30:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "189c4646076... |
cb2d2e06-703f-4af9-9911-47de1b9d066f | bauerca/maxwell | src/MxEMSimHierarchy.cpp |
#include "MxEMSimHierarchy.h"
#include "MxDimVector.hpp"
#include "MxGrid.h"
template<size_t DIM>
MxEMSimHierarchy<DIM>::MxEMSimHierarchy(const MxEMSim<DIM> * aSim, int approxLevels) :
levels(approxLevels), fineSim(aSim) {
MxEMSim<DIM> * simPtr;
MxGrid<DIM> * gridPtr;
if (approxLevels > 1) {
// coarsen fr... | ALGO | 0.936727 | 4.7568 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2012-07-21T00:58:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "59b70b67c... |
0a7c981a-5dfa-495b-8c5f-617a458e1fa4 | smnahidhasan/Competitive-Programming | Leetcode/88. Merge Sorted Array.cpp |
/*
Author's Handle : Crazy_Dreamer
Author's Name : <NAME>
*/
#include<bits/stdc++.h>
using namespace std;
#define ll int
#define dl double
#define forn(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define ... | ALGO | 0.99997 | 3.583078 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2022-05-13T02:54:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8d579a83c4d... |
1279e3ca-35de-498e-a478-dcfd0d064126 | checkedc/checkedc-clang | libcxx/test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp |
//===----------------------------------------------------------------------===//
//
// 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
//
//===--------------------------... | TEST | 0.954461 | 7.472187 | {
"github_metadata": {
"branch": "main",
"commit_count": 456547,
"repo_created_at": "2016-06-07T20:43:32.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 506,
"forks": 79,
"issues": 161,
"pull_requests": 1
},
"file_meta": {
"content_id": "394... |
c0f5c0bc-79cb-4762-87da-26c45a3f7b18 | ishandutta2007/codeforces-z | zh0ukangyang/normal/1476/C.cpp | #include<bits/stdc++.h>
#define L(i, j, k) for(int i = j, i##E = k; i <= i##E; i++)
#define R(i, j, k) for(int i = j, i##E = k; i >= i##E; i--)
#define ll long long
#define ull unsigned long long
#define db double
#define pii pair<int, int>
#define mkp make_pair
using namespace std;
const int N = 1e6 + 7;
const db eps ... | ALGO | 0.999935 | 4.026754 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:43:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "26001507a88e... |
7ea8ee87-5805-44f6-af9b-d2fdab11bfb9 | GowthamSatya/DSA | DSA Sheets/A2Z DSA Striver Sheet/Arrays/Medium/count_subarray_sum=k.cpp | #include <bits/stdc++.h>
using namespace std;
int findAllSubarraysWithGivenSum(vector<int> &arr, int k)
{
// Write Your Code Here
// to store the sums of previous elements
map<int, int> preSum;
// to get the current sum
int sum = 0;
// final count of subarrays
int cnt = 0;
// start ... | ALGO | 0.999865 | 5.569994 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-08-01T10:54:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "47f72dd326a9... |
fd82b83a-48d7-4fc3-bb4f-437d833904e0 | Shawn-Ogbomo/BSC | ch_17/exercises/ch17_exercises/exercise14/exercise14.cpp | //14. Could the “list of gods” example from §17.10.1 have been written using a
//singly - linked list; that is, could we have left the prev member out of Link ?
//Why might we want to do that? For what kind of examples would it make
//sense to use a singly - linked list ? Re - implement that example using only a
//sing... | ALGO | 0.990685 | 5.13818 | {
"github_metadata": {
"branch": "main",
"commit_count": 351,
"repo_created_at": "2022-10-15T12:10: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": "b4ec1c8527... |
ba1aff6b-b83a-4f4a-a9d6-ebba20dc3916 | TISparta/online-judge-solutions | UVa/Competitive_Programming_Exercises/06-String_Processing/04-String-Processing-With-Dynamic-Programming/01-Classic/10066.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e2 + 10;
int n1, n2, arr1[MAX_N], arr2[MAX_N], dp[MAX_N][MAX_N];
int lcs () {
for (int i = 1; i <= n1; i++) {
for (int j = 1; j <= n2; j++) {
if (arr1[i - 1] == arr2[j - 1]) dp[i][j] = 1 + dp[i - 1][j - 1];
else dp[i][j] = max(dp[i -... | ALGO | 0.999492 | 4.260685 | {
"github_metadata": {
"branch": "master",
"commit_count": 121,
"repo_created_at": "2017-09-10T04:52:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6b4322b7... |
84daafa6-8d03-4db7-8a7e-4004703d8453 | avikodak/Algorithms | src/tutorials/nptel/DSAndAlgo/lecture02/growthstrategy.h | /*****************************************************************************************************************
* File Name : growthstrategy.h
* File Location : C:\Users\AVINASH\Desktop\CC++\Programming\src\tutorials\nptel\DSAndAlgo\lecture02\growthstrategy.h
* Created on : Dec 29, 2013 :: 6:11:54 PM
... | ALGO | 0.999758 | 3.702251 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2013-12-17T18:33:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "481a097e3... |
cee21ef8-724d-4df5-958b-d2663ae946a7 | weolar/miniblink49 | third_party/pdfium/third_party/agg23/agg_curves.cpp |
//----------------------------------------------------------------------------
// XYQ: 2006-01-22 Copied from AGG project.
// TODO: This file uses intensive floating point operations, so it's NOT suitable
// for platforms like Symbian OS. We need to change to FIX format.
//---------------------------------------------... | ALGO | 0.998316 | 4.944786 | {
"github_metadata": {
"branch": "master",
"commit_count": 1788,
"repo_created_at": "2016-09-27T03:41:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7578,
"forks": 1142,
"issues": 340,
"pull_requests": 6
},
"file_meta": {
"content_id": ... |
67c2e306-7787-491f-b085-d23e9baa2f44 | ZhenyingZhu/ClassicAlgorithms | src/CPP/src/leetcode/HouseRobberII.cpp | /*
* [Source] https://leetcode.com/problems/house-robber-ii/
* [Difficulty]: Medium
* [Tag]: Dynamic Programming
*/
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
// [Solution]: Maintain two arrays, first rob nums[0], second rob nums[1]. So even the first... | ALGO | 0.999893 | 5.563609 | {
"github_metadata": {
"branch": "master",
"commit_count": 484,
"repo_created_at": "2014-09-14T08:09:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ea764198... |
0b734ae5-9ad4-45ce-ac4c-e9cd3e02d341 | danielsofran/UBB | A3/Sem5/PPD/LABS/lab5/lab5/sumv1.cpp | //#include <mpi.h>
//#include <iostream>
//#include <vector>
//
//using namespace std;
//
//int main(int argc, char** argv) {
// int err = MPI_Init(&argc, &argv);
//
// int world_size;
// MPI_Comm_size(MPI_COMM_WORLD, &world_size);
//
// int world_rank;
// MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
//
/... | ALGO | 0.999858 | 5.244525 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2024-07-06T21:24: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": "27e098c24f... |
2e7a797f-1b5a-40f4-8790-0a445f4d78ec | tonkev/pancake-engine | pancake/src/util/quad_tree.cpp | #include "util/quad_tree.hpp"
#include "util/aabb.hpp"
using namespace pancake;
BaseQuadTree::BaseQuadTree(const Vec2f& centre, float size, float min_size)
: _centre(centre), _size(size), _min_size(min_size) {}
bool BaseQuadTree::aabbCast(const Vec2f& box_centre,
const Vec2f& box_ext... | ALGO | 0.951569 | 7.253018 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2024-04-24T19:45: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": "f82387ae382... |
e8434659-3541-48cb-820c-d259152b5f49 | SyedT1/Practice-Problems | LockOuts/LockOut/LockOut4/morning jogging.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <unordered_map>
#define nline '\n'
#define len(s) ll((s).size())
#define pb push_back
#define pp pop_back
using namespace std;
using ll = long long int;
using par = pair<ll, ll>;
ostream &operator<<(ostream &out, vecto... | ALGO | 0.999928 | 3.890011 | {
"github_metadata": {
"branch": "main",
"commit_count": 148,
"repo_created_at": "2021-04-18T16:52: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": "4b3530c5ec... |
8456e798-f268-4bd9-b166-a44b8a5d9fe9 | luciazhxng/hw1 | split.cpp | /*
CSCI 104: Homework 1 Problem 1
Write a recursive function to split a sorted singly-linked
list into two sorted linked lists, where one has the even
numbers and the other contains the odd numbers. Students
will receive no credit for non-recursive solutions.
To test your program write a separate .cpp file and #inc... | ALGO | 0.999925 | 5.80385 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-01-13T23:54: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": "15f5e9d62d28... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.