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 |
|---|---|---|---|---|---|---|---|
2a4d2cb1-8975-4574-9826-c7d792dba88f | Frankwyd/OREDev | OREData/ored/scripting/models/blackscholes.cpp | /*
Copyright (C) 2019 Quaternion Risk Management Ltd
All rights reserved.
This file is part of ORE, a free-software/open-source library
for transparent pricing and risk analysis - http://opensourcerisk.org
ORE is free software: you can redistribute it and/or modify it
under the terms of the Modified BSD License... | ALGO | 0.949493 | 7.672103 | {
"github_metadata": {
"branch": "master",
"commit_count": 23758,
"repo_created_at": "2025-06-02T04:17:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3df74d... |
0bb00d1c-227e-4429-aee6-021129beb521 | falgunmpatel/Algorithms-to-learn-in-2023 | Searching/Binary_Search/Code.cpp | #include <iostream>
#include <vector>
using namespace std;
int bruteForceBinarySearch(vector<int> &arr, int target) {
int left = 0;
int right = arr.size() - 1;
while (left <= right) {
int mid = left + (right - left) / 2;
if (arr[mid] == target) {
return mid; // Element found
... | ALGO | 0.999995 | 6.594542 | {
"github_metadata": {
"branch": "main",
"commit_count": 91,
"repo_created_at": "2023-10-14T14:05:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 9,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b59906196b1... |
5e793a2c-12d9-4bc2-afb7-d1bd81377c24 | sunnyajit/my_codechef_sol | Another Game.cpp | #include <bits/stdc++.h>
using namespace std;
// code written by sunny
int main() {
int test_cases;
cin >> test_cases;
while (test_cases--) {
int num_elements;
cin >> num_elements;
vector<int> original_array(num_elements), sorted_array(num_elements);
for (int i... | ALGO | 0.999976 | 5.204339 | {
"github_metadata": {
"branch": "main",
"commit_count": 97,
"repo_created_at": "2024-11-09T19:35:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c9971f00984... |
920489e5-4fe4-468b-a44f-af7f1090de22 | darkmatter-ucsd/cylinterp | cylinterpcpp/src/Physics.cc | #include "Physics.hh"
RTPC::RTPC(Interpolator* field,
std::vector<double> &vd_E,
std::vector<double> &vd_vd,
double sag,
int n_cath_wires,
double r_max_det){
m_field = field;
m_dvd_E = vd_E;
m_dvd_vd = vd_vd;
m_dsag = sag;
m_in_cath_wires... | ALGO | 0.991205 | 5.47811 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2022-08-30T01:05:49.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "01b327a5a32d... |
4ae54306-708c-4a1e-9ee4-2f7909953076 | theproudswan/institute | 1-semester/computer-technologies/7-lab/code.cpp | #include <iostream>
#include <cstring>
#define SIZE 256
using namespace std;
int main(){
int i = 0; // Счётчик
char first_string[SIZE] = {0}; // Массив для хранения первой строки
char second_string[SIZE] = {0}; // Массив для хранения второй строки
int second_string_length = 0; // Длина первой строки... | ALGO | 0.999827 | 3.619614 | {
"github_metadata": {
"branch": "main",
"commit_count": 98,
"repo_created_at": "2021-02-25T10:26:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "2a52edff5d0... |
79bdb80b-c205-40f6-a0cb-8c124ceeef03 | ChaituBoi/DS-implementation | MinHeap.cpp | #include <iostream>
using namespace std;
#define MAX 1000
#define leftChild(x) 2*x+1
#define rightChild(x) 2*x+2
#define parent(x) x/2
class Heap{
private:
int minHeap[MAX] = {0xFFFF};
int lastInd = -1;
public:
Heap()
{
for(int ind=0;ind<MAX;ind++)
minHeap[ind]=0xFFFF;
}
int getSiz... | ALGO | 0.999171 | 4.171279 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-10-16T03:12: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": "3348ff3856ed... |
08bb2972-a6f4-4e09-952f-80fd85fa9272 | SleepyWoodpecker/ECE-3 | smooth_try.ino | #include "ECE3.h"
// this version is slow, but works!
const int LED_RF = 41;
#define NUM_SENSORS 8
#define KP 0.005
#define KD 0.02
#define ERROR_TERM_TOLERANCE 100
#define TURN_COUNTS 3
#define TURN_TIMEOUT_MILLIS 500
#define BLACK_LINE_TRESHOLD 1600
#define SPLIT_BLACK_LINE_COUNT 3
#define IS_END 2300
#define LE... | ALGO | 0.996257 | 4.203036 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2025-05-13T14:29: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": "7b7b1175515... |
9f64620f-1da2-4bbb-a84f-9e708682440d | Ahmad-Mtr/Data_Structures | LinkedLists/LinkedList_fromScratch.cpp | #include <iostream>
using namespace std;
struct Node {
int data;
Node *next;
};
Node *head = NULL;
void add_1st(int data) {
struct Node *newnode = new Node;
newnode->next = head;
newnode->data = data;
head = newnode;
}
void add_last(int data) {
struct Node *newnode = new Node;
newnod... | ALGO | 0.985567 | 4.702361 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2023-03-16T11:14:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2c16965e7... |
358e965f-523c-493d-8fe0-d5721299aef5 | JinyangLi01/AdaptiveDynamicArray_20220318 | Experiments/TroubleShooting/LLmemory/deleteLL.cpp | #include <iostream>
#include <fstream>
#include <chrono>
#include <random>
#include <algorithm>
#include "../../../../DataStructures/LinkedList.h"
#include <vector>
using namespace std;
// using namespace Seq;
typedef std::chrono::high_resolution_clock::time_point TimeVar;
#define duration(a) std::chrono::duration_cast... | ALGO | 0.991727 | 4.511819 | {
"github_metadata": {
"branch": "main",
"commit_count": 178,
"repo_created_at": "2022-03-27T07:35: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": "6b74e9be23... |
7f8ff824-ca42-4245-88a9-8c566ac356d3 | moqsad/solved-problems | UVA/10405_Largest Common Sequence.cpp | #include "bits/stdc++.h"
using namespace std;
int lcs(void);
char arr1[1010], arr2[1010], arr[1010][1010];
int value[1010][1010], depend;
int main()
{
int ans;
while(gets(arr1))
{
gets(arr2);
ans = lcs();
printf("%d\n", ans);
}
return 0;
}
int lcs(void)
{
int a, b, c... | ALGO | 0.99991 | 3.955574 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2016-08-05T12:29: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": "76d709bf12... |
312d5c24-fd1d-42c9-b632-3e7ed76764ec | apommerening/CanopyShotNoise | Auxiliaries.cpp | //
// Auxiliaries.cpp
//
//
// Initially created by <NAME> on 17.01.2013. Common functions outsourced by <NAME> on 26.04.2018.
// Copyright 2018 Philodendron International. All rights reserved.
//
#include <Rcpp.h>
#include <cmath>
#include "Auxiliaries.h"
using namespace Rcpp;
using namespace std;
/*
* Calculat... | ALGO | 0.998938 | 5.254801 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2021-06-27T15:10:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "14ff2a512c2f... |
4fdb4bc7-0cef-41de-845f-c8aa8f71f2c8 | skywoodsz/ComputerVision_Hw | Hw4_Photometric-Stereo/main.cpp | /*
* 功能:photometric stereo
* Created by ZhangTianlin on 2021/10/14.
*/
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/opencv.hpp"
#include <Eigen/Dense>
#include <Eigen/Core>
#include <iostream>
#... | ALGO | 0.982173 | 4.470453 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2021-09-21T07:58: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": "17cc5576c... |
105191ad-ace6-4f88-b814-f8f3b6d38ef5 | dreaming12580/ialgorithm | leetcode/cpp/lengthOfLIS2.cpp |
public int lengthOfLIS(int[] nums) {
int[] top = new int[nums.length];
// 牌堆数初始化为0
int piles = 0;
for (int i = 0; i < nums.length; i++) {
// 要处理的扑克牌
int poker = nums[i];
/***** 搜索左侧边界的二分查找 ****/
int left = 0, right = piles;
while (left < right) {
int mid = (left + right) / 2;
... | ALGO | 0.999686 | 3.914516 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-04-24T01:37:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1b75a9082830... |
aab09ca1-5aed-4615-9c0e-9fc7e0478f15 | gvernard/verykool | include/sourcePlane.hpp | #ifndef SOURCE_PLANE_HPP
#define SOURCE_PLANE_HPP
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <iostream>
/*
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/geometry/algorithm... | ALGO | 0.942153 | 5.894802 | {
"github_metadata": {
"branch": "develop_v3.0",
"commit_count": 123,
"repo_created_at": "2019-06-04T16:23:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fd... |
1244ee12-41e8-426d-b5fc-0bc151015661 | staugust/leetcode | cpp/hackranker/h27.cc | /*
* https://www.hackerrank.com/challenges/bomber-man/problem
*/
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <deque>
#include <queue>
using namespace std;
vector<string> bomberMan(int n, v... | ALGO | 0.999947 | 4.45054 | {
"github_metadata": {
"branch": "master",
"commit_count": 32,
"repo_created_at": "2017-09-28T08:03:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f6ded6122... |
a142c8d2-28c6-4133-a9cb-9b3da4c6d1f5 | jasonpfi/AlgoProject3b | dictionary.h | /*
* Team: fitsmu
* <NAME>
* <NAME>
*
* dictionary.h: Contains all of the declarations for the methods and fields of
* a dictionary object
*/
#pragma once
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include "heap.h"
// Class declaration
class dictionary
{
public:... | ALGO | 0.926067 | 4.992387 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2018-10-30T03:28:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "964bc6f1b... |
4b8dfa46-74b1-4310-abdd-7e3e39612edd | PawanKmr470/DSA_Practice_Set | DSA_CPP/10_Problems/DP07_EqualSumPartition.cpp | #include <iostream>
#include <vector>
using namespace std;
// REF : https://www.geeksforgeeks.org/partition-problem-dp-18/
// https://leetcode.com/problems/partition-equal-subset-sum/
// NOTES :
// Same as subset sum problem only the difference is that -
// if the array can be divided into equal sum th... | ALGO | 0.99914 | 5.606515 | {
"github_metadata": {
"branch": "main",
"commit_count": 25,
"repo_created_at": "2024-08-09T23:41:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ebc9743bc84... |
95bfffba-4b38-4e72-8bb2-3e44d778d0c3 | stpmZel/SLAU_4sem | solvers_data.cpp | //
// Created by Stepan on 04.03.2023.
//
#include "src/CSR_matrix.h"
#include "src/CSR_solver.h"
#include <fstream>
#include <vector>
#include "src/Vector.h"
int main(){
// std::vector<point<double>> DOK;
// DOK.push_back({0,0,10});
// DOK.push_back({0, 1, 1});
// DOK.push_back({0,2,0});
// DOK.push_... | ALGO | 0.999336 | 3.003736 | {
"github_metadata": {
"branch": "master",
"commit_count": 27,
"repo_created_at": "2023-02-08T23:31:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "f2370c9ea... |
818bddbb-f006-418e-bdc6-2cf75fb15af3 | soyeb-jim285/codes | vjudge/Cut The Polygon.cpp | #include <bits/stdc++.h>
#include <deque>
using namespace std;
typedef long long ll;
typedef long double ld;
// mt19937 rnd(239);
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
ll area(vector<pair<ll, ll>> &vc) {
ll res = 0;
for (int i = 0; i < vc.size(); i++) {
res += vc[i].first * vc[(i ... | ALGO | 0.999982 | 4.338321 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2024-11-07T17:24:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c65986d9384... |
c61ec422-7ca9-480d-aa29-2a903c54c76b | far2121/data_structures_assignment | 1.d Deletion of an element.cpp | #include <stdio.h>
#define MAX 100
void deleteElement(int arr[], int *size, int position);
int main()
{
int arr[MAX] = {1, 2, 3, 4, 5}; // Example array
int size = 5; // Current size of the array
int position;
printf("Enter the position to delete (1 to %d): ", size);
scanf("%d", &position);
... | ALGO | 0.997714 | 5.057676 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-11-06T11:28:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a1b839304b8b... |
f7226a89-6e78-4094-ab70-15ca39e4550b | shihaozhaosiue/SLAM-project_shihao | codegen/mex/helperVisualSLAMCodegen/averagePrecision.cpp | //
// Academic License - for use in teaching, academic research, and meeting
// course requirements at degree granting institutions only. Not for
// government, commercial, or other organizational use.
//
// averagePrecision.cpp
//
// Code generation for function 'averagePrecision'
//
// Include files
#include "avera... | ALGO | 0.999471 | 6.102064 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-04-30T02:34:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8d902a3ef57d... |
68e0ca74-53cd-483e-a5af-54d71e657b08 | PawelLipski/bspline-singularities-galois | cube.cpp | #include "cube.h"
#include "coord.h"
#include <vector>
#include <iostream>
using namespace std;
// A general hyper-cube for any number of dim_cnt.
Cube::Cube() {}
Cube::Cube(int dims): dim_cnt(dims) {
bounds.resize(dims * 2);
neighbors.resize(dims * 2);
}
Cube::Cube(Coord l, Coord r, Coord u, Coord d): dim_cnt(2... | TOOL | 0.940943 | 3.869173 | {
"github_metadata": {
"branch": "master",
"commit_count": 249,
"repo_created_at": "2015-10-28T09:12:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "11226557... |
91733d6e-e87c-48bf-bf78-a5f87f34adcf | bhan-zju/Probot_Anno | probot_real/src/ik.cpp | // 求解逆运动学
#include <string>
#include <ros/ros.h>
#include <moveit/move_group_interface/move_group_interface.h>
#include "ikfast.h"
#include "probot_anno_manipulator_ikfast_moveit_plugin.cpp"
#include "std_msgs/String.h"
#include <iostream>
using namespace ikfast_kinematics_plugin;
#define pi 3.142
//定义一个全局变量call,初始值... | TOOL | 0.955008 | 4.424877 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2020-03-20T02:11:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e8e0cb011... |
f3fccc3f-eae6-41a5-999a-298566d0895a | Aizaz-Ahmad/Coding-Problems | find-minimum-in-rotated-sorted-array.cpp | //https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/
class Solution {
public:
int findMin(vector<int>& nums) {
int low = 0, high = nums.size() - 1;
while (low < high) {
//get mid element
int mid = low + (high - low) / 2;
//check if mid is not unde... | ALGO | 0.99999 | 6.381183 | {
"github_metadata": {
"branch": "main",
"commit_count": 78,
"repo_created_at": "2022-01-03T09:19:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c9aa22b207a... |
35cb7216-4b78-48bf-bfec-dbde4a733912 | su8y/PS-ATTACK | korsua/solved.ac/12919_A와 B 2.cpp | #include <bits/stdc++.h>
using namespace std;
/* https://www.acmicpc.net/problem/12919 A와 B 2
* 2^N ( 0 < N < 25)
* - solve(s+ 'A')
* - solve(s+ 'B'.reverse())
* N^4
* testcase
BA
BAA
=> 1
ABA
ABAA
=> 1
ABA
AABA
=> 0
AB
BABB
=> 1
AB
BBAB
=> 0
BA
BABB
=> 0
BA
BBAB
=> 1
BA
BABBB
=> 0
*/
string s, t;
bool solve(... | ALGO | 0.999983 | 4.702474 | {
"github_metadata": {
"branch": "main",
"commit_count": 302,
"repo_created_at": "2022-11-03T11:00:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 7,
"issues": 5,
"pull_requests": 2
},
"file_meta": {
"content_id": "32159e153a... |
14940919-d986-416a-9be6-ee77ab964b52 | a2k34lttct/vnoi_solution | olp_ct24_path.cpp | /*Code by <NAME>*/
#include <bits/stdc++.h>
#define pb push_back
#define reverse(x) reverse(x.begin(), x.end())
#define ff first
#define ss second
#define BIT(x, i) (((x) >> (i)) & 1)
#define MASK(i) (1LL << (i))
#define bit_count(x) __builtin_popcount(x)
#define bit_countll(x) __builtin_popcountll(x)
#define fto(i, ... | ALGO | 0.999986 | 3.822438 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-12-22T14:55: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": "3282c00bcae4... |
7a64c2fd-8e7b-4db9-9d3e-3f651aae28a1 | green-fox-academy/Hordon13 | week-02/day-01/PrintAdresses/main.cpp | #include <iostream>
void printArray(int[], int);
int main() {
// Create a program which accepts five integers from the console (given by the user)
// and store them in an array
// print out the memory addresses of the elements in the array
int input[5];
for (int i = 0; i < 5; ++i) {
std:... | TOOL | 0.976862 | 4.262461 | {
"github_metadata": {
"branch": "master",
"commit_count": 320,
"repo_created_at": "2019-04-02T14:21:35.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "935e102d6... |
5e4d56fd-e859-48cc-9937-2dc552fdb9cd | cbliu111/stoch_mean_field | algorithms/bswleap1.h | //
// Created by cbl on 1/23/23.
//
#ifndef SIM_BSWLEAP_H
#define SIM_BSWLEAP_H
/*
Bound step weight method
sequential importance sampling with mean-field randomization
rejection control is used to avoid small weight samples
weight above threshold is always accepted
this method is approximate
*/
#include "timer.h"
#... | ALGO | 0.99982 | 6.260394 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-02-17T08:48:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "11ac149047d9... |
7289f933-d6dc-4069-acec-facec8efdf95 | ChenliangLi205/LeetCode | Q114FlattenBinaryTreetoLinkedList.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void flatten(TreeNode* root) {
helper(root);
}
TreeNode* helper(TreeNode* ... | ALGO | 0.999979 | 5.619748 | {
"github_metadata": {
"branch": "master",
"commit_count": 93,
"repo_created_at": "2018-10-18T13:00: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": "0764aabbe... |
f74ef91e-3ffc-4b61-86a5-030f55920a2b | salvatore356/template-matching | ComputerVision/TemplateMatching/TemplateMatching.hpp | //
// TemplateMatching.hpp
// ComputerVision
//
// Created by Salvatore on 9/8/23.
//
#ifndef TemplateMatching_hpp
#define TemplateMatching_hpp
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <vector>
#include <limits>
#include "../Utils/Utils.hpp"
namespace TemplateMatching {
struct Match... | ALGO | 0.985331 | 5.471775 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-08-09T13:18:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3008a8c15e25... |
fdf65c65-f889-4af6-823f-3649431b01ff | silver-birch-wawa/PAT | 算法学习/专题拓展/Stack.cpp | #include <bits/stdc++.h>
using namespace std;
// 最大值
#define N 100010
// 块的大小
const int sqrtN=316;
vector<int>s;
int block[N]={0};
// 存储块的数据,设为sqrtN会报错....
int table[N]={0};
// 存储对应取值的数据
void findMedian(){
if(s.empty()){
cout<<"Invalid"<<endl;
return;
}
int i,j;
int counts=0;
int target=0;
if(s.s... | ALGO | 0.999863 | 4.136055 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2018-03-25T13:42:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "05b64a1fd... |
83614de6-2a78-47e9-af60-24d35788cf6f | cran/capybara | src/02_center_variables.cpp | #include "00_main.h"
// Method of alternating projections (Halperin)
void center_variables_(mat &V, const vec &w, const list &klist,
const double &tol, const int &max_iter,
const int &iter_interrupt, const int &iter_ssr) {
// Auxiliary variables (fixed)
const size_t I ... | ALGO | 0.999867 | 5.993145 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2025-03-24T12:58:06.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "226c812956e... |
5e5c394d-a8b5-438e-aa2d-26003d997c83 | abdulvahidgok/bezier-curve | core/bezier_curve/bezier_curve.cpp | #include "bezier_curve.h"
#include <cmath>
#include <vector>
static std::vector<std::vector<double>> precompute_binomial_coeff(int n) {
std::vector<std::vector<double>> binom_coeff(n + 1, std::vector<double>(n + 1, 0));
for (int i = 0; i <= n; ++i) {
binom_coeff[i][0] = binom_coeff[i][i] = 1.0;
... | ALGO | 0.999667 | 6.952899 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2024-06-10T00:20:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "63f58aec06... |
be3425ff-060f-43d6-84fa-27954e17c398 | sudhirpatel2024/DSA_with_C_C-dsa | array/Max_Min_Sum_Avg.cpp | #include <iostream>
using namespace std;
struct array
{
int a[10];
int size;
int length;
};
void display(struct array arr)
{
int i;
for (i = 0; i < arr.length; i++)
{
printf("%d\n", arr.a[i]);
}
}
int Max(struct array arr)
{
int max;
int i;
max = arr.a[0];
for (i = 0; i <= arr.length; i++)
{
if (max ... | TOOL | 0.983457 | 3.634737 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2023-03-13T16:06:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "11ecfdb79be8... |
eecb1167-2a36-41a5-8c07-50fcdba7d37e | renzov/Red_Crown | SPOJ/DISTANCE.cpp | #include<cstdio>
#include<climits>
#include<algorithm>
using namespace std;
const int MAXN = 100005;
const int DIM = 7;
int P[MAXN][DIM];
int main(){
int N, D;
scanf("%d %d", &N, &D);
for ( int i=0; i < N; ++i )
for ( int j=0; j < D; ++j )
scanf("%d", P[i] + j);
int res = 0;
int mini, maxi;
int x;
fo... | ALGO | 0.99994 | 3.440082 | {
"github_metadata": {
"branch": "master",
"commit_count": 166,
"repo_created_at": "2012-06-03T15:15:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3b1846a2... |
5ea42f09-dd27-478a-9ce2-ebb9a4e96af5 | BastiBernal/Programacion_Competitiva_I | 04D-Abnormal 89s.cpp | #include <iostream>
#include <cstring>
#define MaxL 200005
using namespace std;
char A[MaxL], B[MaxL];
int P[MaxL];
// Función para construir la tabla KMP (prefijo-sufijo)
void KMPTable(char *pattern) {
int patternLength = strlen(pattern);
int i = 1, j = -1;
P[0] = -1;
while (i < patternLength) ... | ALGO | 0.999765 | 5.232411 | {
"github_metadata": {
"branch": "main",
"commit_count": 32,
"repo_created_at": "2024-09-11T22:59: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": "0fc429c09d0... |
4b081072-2e14-403c-921d-9befdaad6ada | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/07/0706/personal_submission/cf1023e_tiger2005.cpp | int main() {
int n; cin >> n;
auto get = [&] (int a, int b, int c, int d) {
printf("? %d %d %d %d\n", a, b, c, d);
fflush(stdout);
return read<string>();
};
string s1 = "", s2 = "";
int x = 1, y = 1;
for (int i = 1; i < n; i ++) {
if (get(x + 1, y, n, n) == "YES")
++ x, s1 += 'D';
... | ALGO | 0.999847 | 3.14004 | {
"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": "0421... |
1eb788f0-33bc-4651-add0-a0bea64f92ef | researchmm/tasn | tasn-mxnet/3rdparty/mkldnn/src/common/softmax.cpp | /*******************************************************************************
* Copyright 2016-2018 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apa... | ALGO | 0.967195 | 6.631996 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2019-03-29T02:02:36.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 218,
"forks": 39,
"issues": 16,
"pull_requests": 6
},
"file_meta": {
"content_id": "c7db27... |
a83be8b2-00e0-48b8-9092-f895381f7ab3 | madewithlinux/image_stuff | cpp/src/libs/types.h | //
// Created by j0sh on 11/15/15.
//
#ifndef IMAGE_STUFF_TYPES_H
#define IMAGE_STUFF_TYPES_H
#include <complex>
#include <cstring>
#include "util/matrix.h"
#include "util/vect.h"
namespace image_utils {
using namespace util;
using util::matrix;
using util::assert_same_size;
using std::sqrt;
using std::sin;
using ... | TOOL | 0.912012 | 5.686015 | {
"github_metadata": {
"branch": "master",
"commit_count": 131,
"repo_created_at": "2015-11-16T21:25:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "da4e8122... |
f5e8cc19-425d-4638-adcc-12e8cd2843f4 | humma-irshad/data_structures | bst.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
};
Node* root = NULL;
void create() {
Node* temp = new Node();
cout << "Enter the node data:\n";
cin >> temp->data;
temp->left = NULL;
temp->right= NULL;
if(root =... | ALGO | 0.999947 | 5.450956 | {
"github_metadata": {
"branch": "main",
"commit_count": 31,
"repo_created_at": "2022-07-17T08:45: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": "0def70ab0f4... |
6849b6f9-327b-46d6-96a3-0edb536af63d | pkw3322/CodingStudy | week02/BOJ4179.cpp | #include<iostream>
#include<queue>
using namespace std;
int r,c,ret = -1;
char mtx[1000][1000];
int dx[4] = {-1,1,0,0};
int dy[4] = {0,0,-1,1};
queue<pair<int,int> >person;
queue<pair<int,int> >fire;
int main(){
cin >> r >> c;
for(int i = 0; i < r; i++){
for(int j = 0; j < c; j++){
cin >... | ALGO | 0.999936 | 3.898499 | {
"github_metadata": {
"branch": "main",
"commit_count": 440,
"repo_created_at": "2023-01-02T12:17:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ebe4ec606a... |
5edc749c-6021-4dca-9594-c4dfecb624da | manch1n/leetcode | 112.路径总和.cpp | /*
* @lc app=leetcode.cn id=112 lang=cpp
*
* [112] 路径总和
*
* https://leetcode-cn.com/problems/path-sum/description/
*
* algorithms
* Easy (45.70%)
* Total Accepted: 14.6K
* Total Submissions: 32K
* Testcase Example: '[5,4,8,11,null,13,4,7,2,null,null,null,1]\n22'
*
* 给定一个二叉树和一个目标和,判断该树中是否存在根节点到叶子节点的路径,这... | ALGO | 0.999893 | 5.811579 | {
"github_metadata": {
"branch": "easy",
"commit_count": 77,
"repo_created_at": "2019-04-05T08:51: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": "8d795637f52... |
1a767cd8-6050-4269-b18f-5359c6183d48 | yasirnabil534/Shakil-Vaia-Code-Temporary | All Code/Maximum XOR Subset sum_1272.cpp | //<NAME>
//Md. <NAME>
//Dept. of ICT, Comilla University
#include<bits/stdc++.h>
using namespace std;
#define i64 long long int
#define u64 unsigned long long int
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
#define repc(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)
#define repr(i,a,b) for(_... | ALGO | 0.999981 | 3.629347 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2017-10-23T13:13:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5a8125bad4... |
435ba683-57cf-4899-9ef8-e507d024765c | DenisAltruist/algorithms | suffix-array.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> buildSuffixArray(const vector<int>& s, int alphabetSize) {
int n = s.size();
vector<int> c(n), cnt(n), p(n), pn(n), cn(n);
vector<int> chIsUsed(alphabetSize), compressedIdxByCh(alphabetSize);
for (int i = 0; i < n; ++i) {
chIsUsed[s[i]... | ALGO | 0.999773 | 4.154043 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2019-02-21T14:18: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": "58442383b3... |
902f0ae5-e6e1-45f5-8889-0b76ec5c5412 | kaloronahuang/KaloronaCodebase | Templates/Template-NOI/PersisitentAhoCorasickAutomaton.cpp | // PersisitentAhoCorasickAutomaton.cpp
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 200;
int n, ch[MAX_N][26], ptot, link[MAX_N], tag[MAX_N], stk[MAX_N], tail;
char org[MAX_N], tmp[MAX_N], cstk[MAX_N];
void insert(char *str)
{
int p = 0;
for (int i = 1; str[i]; i++)
{
if... | ALGO | 0.999986 | 4.052814 | {
"github_metadata": {
"branch": "master",
"commit_count": 554,
"repo_created_at": "2018-11-02T01:32:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 12,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0319458... |
53e2c5e5-529b-4fa9-b1cd-996dd2867c22 | GambitBSM/gambit_1.0 | contrib/Delphes-3.1.2/external/fastjet/plugins/SISCone/split_merge.cc | ///////////////////////////////////////////////////////////////////////////////
// File: split_merge.cpp //
// Description: source file for splitting/merging (contains the CJet class) //
// This file is part of the SISCone project. //
... | ALGO | 0.968508 | 5.801974 | {
"github_metadata": {
"branch": "release_1.0",
"commit_count": 8272,
"repo_created_at": "2017-05-23T22:47:45.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 13,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5... |
4df0ab6f-9626-4580-97e1-311498ab98de | YurchenkovGA/cs-lab02 | main.cpp | #include <iostream>
using namespace std;
int main()
{
cout << "Enter A and B: ";
double a, b;
cin >> a >> b;
cout << "A + B = " << a + b << '\n'
<< "A - B = " << a - b << '\n'
<< "A * B = " << a * b << '\n'
<< "A / B = " << a / b << '\n';
return 0;
if (a>b)
cout <<... | ALGO | 0.984213 | 3.477813 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2020-03-24T16:18:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9053d6229... |
540954b7-14e7-4839-9c59-ba43dd058284 | yangzeyu23/C--Summer | 8_1-dynamicarray.cpp | //实现动态数组库
#include <iostream>
#include <cstdlib>
#include "8_1-dynamicarray.h"
struct Array
{
int size;
int* data;
};
ArrayPtr CreateArray(int size)
{
auto arr = new Array;
arr->size = size;
arr->data = new int[size];
return arr;
}
int ArraySize(const ArrayPtr& arr)
{
return arr->size... | ALGO | 0.999002 | 5.093751 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2025-06-27T06:00:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8ed6405ea22... |
7bc10537-0975-4b5e-8a30-d59e37b423f2 | TCGBench/TCGBench | data/partially_correct_code/partially_correct_code_canonical/P4777/80-100_2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> P;
const int N = 1e5 + 10;
const int INF = 2e9;
ll m[N], a[N];
ll exgcd(ll a, ll b, ll &x, ll &y) {
if(b == 0) {
x = 1, y = 0;
return a;
}
ll g = exgcd(b, a % b, x, y);
int z = x; x = y; y = z - y... | ALGO | 0.999958 | 3.878736 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-05-16T11:23:45.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b9edf26ef7806... |
5ce7298b-0c0d-4709-a5b9-03c971ecb79b | matr1XD/Programming-MIG-4 | ImmerseAlgebra/vector.cpp | //za da cuvame vector treba da chuvame samo krajna tocka, pocetnata sekgoas da ni e (0,0)
//ako ne e vo (0,0) ke ja odneseme
//tocka vo prostor == vektor vo prostor odnosno tockata e vrvot na vektorot
// |v| = sqrt(x^2 + y^2 + ... ) Euclid distance
// tg(a) = y / x
// dot product e merka za slicnost megu vektori
// do... | TOOL | 0.994719 | 4.475881 | {
"github_metadata": {
"branch": "main",
"commit_count": 35,
"repo_created_at": "2024-09-18T21:37:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5a132d5eb19... |
f76c20e1-d2a7-414a-8f5f-7a696ae3391b | Marsgoat/leetcode-practice | Dynamic_Programming/1155.Number-of-Dice-Rolls-With-Target-Sum/1155.cpp | #include <iostream>
using namespace std;
class Solution {
public:
int numRollsToTarget(int n, int k, int target) {
const int MOD = 1e9 + 7;
int dp[n + 1][target + 1];
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= target; j++) {
for (... | ALGO | 0.99997 | 5.728541 | {
"github_metadata": {
"branch": "main",
"commit_count": 127,
"repo_created_at": "2023-12-25T06:14:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a1ac11d4dd... |
436992e4-34d9-4501-a42d-6f0520bfa51f | lin-toto/licoris | entropy_coder/rans_interface.cpp | /* Copyright 2020 InterDigital Communications, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable... | ALGO | 0.984885 | 7.325032 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2023-07-02T13:06:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 2,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "0ad447047aee... |
ed69378a-bdf9-4783-b92d-177ee6cf4362 | preetcoder12/DSA-Mastery | Tree/MaxDepth.cpp |
#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 *createtree(node *root)
{
cout << "Enter the data : " << endl;
int data;
ci... | ALGO | 0.999749 | 4.536325 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-02-05T19:19: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": "6c62b27e0c22... |
6cf3cc15-79a8-451d-9188-daef5fd89100 | dream4789/Computer-learning-resources | 操作系统/实验报告/RW_W/console.cpp | #include <windows.h>
#include <iostream>
#include <winbase.h>
#include <stdlib.h>
using namespace std;
unsigned short ReaderID = 0; //读者编号
unsigned short WriterID = 0; //写者编号
int nReaders = 0; // 当前读者数
bool p_ccontinue = true; //控制程序结束
// 定义互斥量和信号量
HANDLE mutex, wMutex;
DWORD WINAPI Reader(LPVOID); /... | ALGO | 0.995868 | 3.99655 | {
"github_metadata": {
"branch": "main",
"commit_count": 62,
"repo_created_at": "2023-12-24T23:28:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b2de72b4c62... |
5bacff6d-74f1-4a35-8f26-447392777b22 | FranSagasti2609/Programacion2_CPP | Unidad 2 - TAD/STD_UNORDERED_MAP/main.cpp | #include <iostream>
#include <unordered_map>
//Definicion sustituta a contains.
void contiene(std::unordered_map <int, std::string> map, int key){
std::unordered_map <int, std::string>::iterator busqueda = map.find(key);
if(busqueda!= map.end()) std::cout << "Elemento encontrado con la key ingresada. " << busqued... | TOOL | 0.97313 | 4.197491 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2023-05-31T02:19: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": "5031eebe81a... |
e8abe604-d973-4eff-a60a-ff5d74ab1a95 | ishandutta2007/codeforces-s | scanhex/normal/626/E.cpp | #include <bits/stdc++.h>
using namespace std;
using nagai = long long;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int>a(n);
for(auto& x : a) cin >> x;
sort(a.begin(),a.end());
long double res = 0;
vector<int> rs = {a[0]};
vector<nagai> pref(n + 1);
for(int i =... | ALGO | 0.999986 | 3.579212 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:07: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": "d9fef11a6f6f... |
d6a7f5c5-1241-45cf-b998-9ef2c4ef4379 | wizardassassin/1brc | main.cpp | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <thread>
#include <unordered_map>
#include <utility>
#include <vector>
#define BUFFER_SIZE 64
#define LOCATION_SEEK 10000
#define MIN_TEMP -1000
#... | TOOL | 0.965241 | 4.238275 | {
"github_metadata": {
"branch": "main",
"commit_count": 8,
"repo_created_at": "2024-07-03T03:23: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": "eae62c97ed9c... |
bc750e13-4796-48a5-86f6-7e1cd9fc718b | Amankr027/6Companies30Days- | Microsoft/Evaluate_Reverse_Polish_Notation.cpp | /*
You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation.
Evaluate the expression. Return an integer that represents the value of the expression.
Note that:
The valid operators are '+', '-', '*', and '/'.
Each operand may be an integer or another expression.
T... | ALGO | 0.999634 | 5.829675 | {
"github_metadata": {
"branch": "main",
"commit_count": 92,
"repo_created_at": "2023-01-02T15:56: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": "8e8893451b0... |
4071fda6-aceb-44ae-9501-5f4f9eb58f91 | parthgmjain/Blackjack | main.cpp | #include <iostream>
#include <random>
#include "blackjack.h"
using namespace std;
const int INITIAL_HAND_SIZE = 2;
const int MAX_HAND_SIZE = 21;
void initializeHand(string hand[], int& handSize, string cardsArray[], int& cardIndex) {
for (int i = 0; i < INITIAL_HAND_SIZE; ++i) {
hand[handSize++] = cardsA... | ALGO | 0.993431 | 5.486461 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-23T03:14:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8485b9d4797f... |
9cc90664-c001-4422-b0f0-bd7a0e932795 | tfhe/tfhe | src/test/test-addition-boot.cpp | #include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <sys/time.h>
#include "tfhe.h"
#include "polynomials.h"
#include "lwesamples.h"
#include "lwekey.h"
#include "lweparams.h"
#include "tlwe.h"
#include "tgsw.h"
using namespace std;
// ******************************... | ALGO | 0.913369 | 4.037088 | {
"github_metadata": {
"branch": "master",
"commit_count": 514,
"repo_created_at": "2016-05-19T16:49:29.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1281,
"forks": 181,
"issues": 36,
"pull_requests": 3
},
"file_meta": {
"content_id": "398... |
083391da-2f85-4897-890d-44befd5d2cca | JongssLee/codetree-TILs | 241031/k개의 벽 없애기/remove-k-walls.cpp | #include <iostream>
#include <stack>
#include <utility>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
int board[109][109] = { 0, };
int n, k, wall_cnt=0;
int r, c;
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
vector<pair<int, int>> wall;
int main() {
cin >> n >> k;
for ... | ALGO | 0.999978 | 4.414955 | {
"github_metadata": {
"branch": "main",
"commit_count": 92,
"repo_created_at": "2024-09-13T00:01: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": "1dcd382bf72... |
0ed448b1-df4d-4a2f-95d3-402cae1b1971 | kamyu104/LeetCode-Solutions | C++/minimum-non-zero-product-of-the-array-elements.cpp | // Time: O(min(p, logM))
// Space: O(1)
class Solution {
public:
int minNonZeroProduct(int p) {
static const int MOD = 1e9 + 7;
// max_num = 2^p-1
uint32_t max_num_mod = submod(powmod(2, p, MOD), 1, MOD); // max_num % MOD
// pair_num = max_num-1
uint32_t pair_product_mod ... | ALGO | 0.999933 | 5.84316 | {
"github_metadata": {
"branch": "master",
"commit_count": 19395,
"repo_created_at": "2018-10-11T17:38:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4939,
"forks": 1616,
"issues": 1,
"pull_requests": 55
},
"file_meta": {
"content_id": ... |
e423db00-a322-4a18-a9f4-26a7787eb7b3 | Alex23013/4semestre | mundoGrilla/HolaMiniWin-linux/Conejos.cpp | #include <iostream>
#include <string>
#include <vector>
#include <chrono>
#include <sstream>
#include <random>
#include <algorithm>
#include <utility>
#include <map>
#include "Cliente.cpp"
using namespace std;
struct Grilla {
char animal;
int hierba;
Grilla() {
animal = 'v';
hierba = 0;
}
};
class Conejo {
p... | ALGO | 0.976731 | 3.652164 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2017-07-11T17:50: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": "27db2c2fd0... |
e25c74c7-2e8c-4ca5-bd48-9895686c977a | NguyenDucHieuPT/CompetitiveProgramming | 200ProgrammingExercises/Bai013.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
string value[1000];
int Max = 0;
void FindNumber()
{
int Const = 1;
while (Max)
{
int n = Const;
while ( n > 0)
{
if ( n % 2)
{
value[Const] = "4" + value[Const];
... | ALGO | 0.999845 | 4.47 | {
"github_metadata": {
"branch": "main",
"commit_count": 125,
"repo_created_at": "2024-06-09T06:16:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 0,
"pull_requests": 4
},
"file_meta": {
"content_id": "855cd446f6... |
8c1c7a18-92d4-4685-9581-4a62eae6d34c | XPerianer/hyrise | src/lib/storage/vector_compression/fixed_size_byte_aligned/fixed_size_byte_aligned_compressor.cpp | #include "fixed_size_byte_aligned_compressor.hpp"
namespace opossum {
std::unique_ptr<const BaseCompressedVector> FixedSizeByteAlignedCompressor::compress(
const pmr_vector<uint32_t>& vector, const PolymorphicAllocator<size_t>& alloc,
const UncompressedVectorInfo& meta_info) {
const auto max_value = meta_in... | TOOL | 0.943909 | 6.679109 | {
"github_metadata": {
"branch": "master",
"commit_count": 1579,
"repo_created_at": "2019-11-27T09:36:58.000Z",
"is_fork": true,
"is_org_owned": false,
"forked_from": "hyrise/hyrise",
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id"... |
8d7143d2-0c5a-43cf-9846-ea1213a511d9 | mohammad-majoony/codeForces-submits | B. Inversions 2/main.cpp | // When i wrote this code, only me and God knew how it works. Now only God knows...
// https://codeforces.com/edu/course/2/lesson/4/3/practice/contest/274545/problem/B
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MAJOONI ios_base::sync_with_stdio(0), ci... | ALGO | 0.999987 | 3.769703 | {
"github_metadata": {
"branch": "master",
"commit_count": 81,
"repo_created_at": "2023-04-27T10:13:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4301b4c71... |
1a931b08-d493-4b35-9cb4-74cc0dfe1257 | aaronpo97/cpp-practice | recursion/linear_search.cpp | #include <vector>
#include <iostream>
/**
* Linear search algorithm using iteration.
*
* \param v The vector to search.
* \param item The item to search for.
*
* \returns The index of the item if found, otherwise -1.
*
* \example
* \code
* std::vector<int> numbers = {1, 2, 3, 4, 5};
* int indexA = linear_se... | ALGO | 0.999905 | 6.661378 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-06-19T03:09: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": "0e4bd12c960b... |
169f5694-d3b1-4605-9c23-8bb0dd9e911c | thegamer1907/Code_Analysis | CodesNew/4342.cpp | #include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define lll long long
using namespace std;
const int N = 5e5 + 229;
const int M = 1e9 + 7;
string t[N];
int sz[N];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifdef LOCAL
fr... | ALGO | 0.999998 | 3.977488 | {
"github_metadata": {
"branch": "master",
"commit_count": 73,
"repo_created_at": "2019-05-24T10:35:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "33385de68... |
8303d7dc-45bf-411f-9662-656f2fb391a5 | tmastercoding/clang | USACO/Bronze/BronzePractice-C/s11.cpp | // Out of Place 15594
#include <iostream>
using namespace std;
// int isAsc(int* arr, int size);
int main(){
int size;
cin >> size;
int heights[size];
int temp;
int outIdx;
int cnt = 0;
for(int idx =0 ; idx < size; idx++){
cin >> temp;
heights[idx] = temp;
}
int ... | ALGO | 0.999966 | 4.87426 | {
"github_metadata": {
"branch": "main",
"commit_count": 28,
"repo_created_at": "2023-10-01T10:39:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "a668662d25d... |
eb03c1de-fdd1-4f31-b37f-34ab161ba3f0 | jeete121/Coding | Programs/Practice/Prac/GraphAlgorithms/grid_challenge.cpp | #include <bits/stdc++.h>
using namespace std;
string gridChallenge(vector<string> grid)
{
int n = grid.size();
for (int i = 0; i < n; i++)
{
sort(grid[i].begin(), grid[i].end());
}
char arr[n][n];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < grid[i].size(); j++)
... | ALGO | 0.999984 | 4.644847 | {
"github_metadata": {
"branch": "master",
"commit_count": 95,
"repo_created_at": "2023-05-06T10:00:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d710d59a8... |
0a1de543-5696-40b8-8127-6085ee1a2a34 | aniketjain0317/competitive | Contests/Codeforces/1500s/1516 - #717, Div 2/C.cpp | // Problem
//
#include <bits/stdc++.h>
using namespace std;
#if defined(_USE_MATH_DEFINES) && !defined(_MATH_DEFINES_DEFINED)
#define _MATH_DEFINES_DEFINED
#define M_E 2.71828182845904523536
#define M_LOG2E 1.44269504088896340736
#define M_LOG10E 0.434294481903251827651
#define M_LN2 0.69314718055... | ALGO | 0.999943 | 3.78195 | {
"github_metadata": {
"branch": "master",
"commit_count": 46,
"repo_created_at": "2020-01-25T02:29:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c9f93f2c6... |
4972bd91-e174-4494-a20f-d78e6506f10b | Shashankiitr/Nongamba- | Codechef/Bucket_Game.cpp | #include <bits/stdc++.h>
//#define int long long
using namespace std;
void solve(){
int N; cin >> N; vector<int> V(N);
int ones = 0, odds = 0; // odds are excluding 1
for(int i = 0; i < N; i++){
cin >> V[i];
if(V[i] == 1) ones++;
else if(V[i] % 2 == 1) odds++;
}
int A, B;
A = (ones + 1)/2; B = ones/2;
if(o... | ALGO | 0.99999 | 4.220491 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2024-02-04T10:11:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e5c0b7d77fd... |
e9569a0e-b718-41dd-a18d-3b5cb2489474 | Joqsan/Leetcode | 133. Clone Graph.cp | #include <vector>
#include <unordered_map>
#include <queue>
using namespace std;
class Node
{
public:
int val;
vector<Node*> neighbors;
Node()
{
val = 0;
neighbors = vector<Node*>();
}
Node(int _val)
{
val = _val;
neighbors = vector<Nod... | ALGO | 0.99992 | 6.04267 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2021-05-13T21:34:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "02f3208dd8... |
586d1f81-4978-462a-a35c-6da70c438bba | Pauchpock/UTC-GI | SY31/TP2/code/wifibot_modules.u/src/cluster.cpp | // Includes, project.
#include "cluster.hpp"
// Includes, standard.
#include <iostream>
void
sy31::computeClusters(std::vector<sy31::Cluster>& clusters, std::vector<sy31::vec2d> const& points)
{
// Packages.
using namespace std;
// Sortie de l'algorithme: clusters de points.
clusters.resize(0);
// Critere... | ALGO | 0.999896 | 5.0975 | {
"github_metadata": {
"branch": "master",
"commit_count": 73,
"repo_created_at": "2016-04-23T18:49:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "798350622... |
62e438b9-313d-45e1-b14c-1440185b89fd | crespo2014/cpp-exam | ch06/t6_02.cpp | /*What will happen when you attempt to compile and run the following code?*/
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void printer(int i)
{
cout << i << ", ";
}
int main()
{
int mynumbers1[] = { 3, 9, 0, 2 };
int mynumbers2[] = { 6, 1, 4, 5 };
vector<int> v1(7);
sort(my... | ALGO | 0.999499 | 3.178625 | {
"github_metadata": {
"branch": "master",
"commit_count": 57,
"repo_created_at": "2014-11-17T18:37: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": "ff7f86917... |
3b6816c0-591e-4174-9116-f76b8b0bf3c2 | erjiaqing/my_solutions | cf/671/b.cpp | #include <algorithm>
#include <iostream>
using namespace std;
const int maxn = 500000 + 1;
int c[maxn], c2[maxn];
long long n, k, avg, flg;
long long check(long long mi)
{
long long ret = 0;
for (int i = 0; i < n; i++)
if (c[i] <= mi)
ret += mi - c[i];
return ret;
}
long long check2(long long mx)
{
long long r... | ALGO | 0.999985 | 3.677058 | {
"github_metadata": {
"branch": "master",
"commit_count": 341,
"repo_created_at": "2014-05-27T06:30:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "968ff028... |
2b20a697-b53a-4f9c-ac68-c71069ad4f26 | ishandutta2007/codeforces-e | enkognit/normal/1153/D.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define fr front()
#define pb push_back
#define len length()
#define pll pair<ll,ll>
#define sqr(a) ((a)*(a))
#define pu push
#define ld long double
#define pld pair<ld,ld>
#define y1 Enkognit
//#define {cout.flush()}... | ALGO | 0.999886 | 3.420507 | {
"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": "d21969653efe... |
32c8a97b-499b-41fd-b3bc-dd69d89a8407 | OpenSees/OpenSees | SRC/reliability/analysis/analysis/OptimizationAnalysis.h | /* ****************************************************************** **
** OpenSees - Open System for Earthquake Engineering Simulation **
** Pacific Earthquake Engineering Research Center **
** **
** ... | ALGO | 0.923739 | 4.674919 | {
"github_metadata": {
"branch": "master",
"commit_count": 8721,
"repo_created_at": "2018-09-12T00:49:34.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 667,
"forks": 719,
"issues": 42,
"pull_requests": 23
},
"file_meta": {
"content_id": "6f... |
a211ba23-c3c8-4736-b8e3-b5e843044246 | yangyilincn83/CodePractise | CodeInterview/Misc_FindBiggestRectangle.h | #pragma once
#include <iostream>
#include <cassert>
#include <algorithm>
using namespace std;
namespace Algorithm
{
/*
* This function is to find the biggest rectangle between two points at x axis. heights[i] represents the height at i on the x axis
* The rectangle area between i and j is defined as mi... | ALGO | 0.999849 | 5.359622 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2016-10-14T05:19: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": "e4e62622d9... |
f9a1da97-5137-4d8c-8433-49d69b8792db | mprofetto/Webserv | server/TcpListener.hpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* TcpListener.hpp :+: :+: :+: ... | WEB | 0.929361 | 4.965428 | {
"github_metadata": {
"branch": "master",
"commit_count": 270,
"repo_created_at": "2024-02-14T12:16: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": "e69b9428... |
2b2c1da5-3c73-4262-a5b8-02c0ba0423ff | Shahraaz/CP_S5 | codeforces/1140/e/e.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "/debug.h"
#else
#define db(...)
#endif
#define all(v) v.begin(), v.end()
#define pb push_back
using ll = long long;
const int NAX = 2e5 + 5, MOD = 998244353;
const int kmod = 998244353;
int mul(int a, int b, int mod = kmod)
{
return (long long... | ALGO | 0.99999 | 4.866494 | {
"github_metadata": {
"branch": "master",
"commit_count": 219,
"repo_created_at": "2019-07-15T23:57:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "03c4d962... |
24dfb9e1-864e-4e6b-8cd4-229983ab7298 | EmperorNao/4SEM | CompMath/IterationMethod/Iteration.cpp | #include "Iteration.h"
double vector_norm(std::vector<double> arr, int norm) {
if (norm <= 0) {
double max = abs(arr[0]);
for (int i = 1; i < arr.size(); ++i) {
if (abs(arr[i]) > max) {
max = abs(arr[i]);
}
}
return max;
}
else {
double value = 0;
for (int i = 0; i < arr.size(); ++i)... | ALGO | 0.999962 | 4.431433 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2021-11-21T20:15: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": "5feb33ee7a... |
083874fa-66b0-473e-ade2-648450159196 | openLB/openLB | src/functors/lattice/blockReduction3D2D.h | /* This file is part of the OpenLB library
*
* Copyright (C) 2017 <NAME>
* E-mail contact: <EMAIL>
* The most recent release of OpenLB can be downloaded at
* <http://www.openlb.net/>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public Li... | ALGO | 0.914707 | 6.783535 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-11-03T07:46:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 40,
"forks": 15,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "17b5e8a3... |
6fcae3dd-6b14-4a93-b701-3cb1dca16839 | Janmansh/CompetitiveProgramming | Atcoder/ABC201/problem3/problem3.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define pb push_back
#define mod 1000000007
#define mp make_pair
ll fact[200005];
ll powermod(ll x,ll y){
if(y==0) return 1;
ll temp = powermod( x,y/2 )%mod;
if( y%2 ){
return (((temp*temp)%mod)*x%mod);
}
return (tem... | ALGO | 0.999849 | 4.004701 | {
"github_metadata": {
"branch": "main",
"commit_count": 34,
"repo_created_at": "2021-05-29T18:42:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2327c19aeb8... |
173781ce-6aae-45cb-a09b-c38318f00269 | qiongz/BLQH | Monolayer/lanczos_hamiltonian.cpp | #include"lanczos_hamiltonian.h"
inline void swap(Vec *a,Vec *b,Vec *c) {
*a=*b;
*b=*c;
}
lhamil::lhamil() {}
lhamil::lhamil(const Mat &_H,long _nHilbert,long _lambda, unsigned _seed):H(_H),nHilbert(_nHilbert),lambda(_lambda),seed(_seed) {}
lhamil::lhamil(long _lambda,unsigned _seed) {
lambda=_lambda;
... | ALGO | 0.992227 | 5.119017 | {
"github_metadata": {
"branch": "master",
"commit_count": 146,
"repo_created_at": "2018-03-19T09:05:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "88cc9f29... |
d557277f-7d0c-4318-9ee7-639adb39d256 | anish-rajan/Cp-algos | practice/dp/bal_substr.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define N 100005
int main()
{
ll n;
cin >> n;
string s;
cin >> s;
ll cnt0 = 0, cnt1 = 0;
vector<ll> bal(n);
for (ll i = 0; i < n; i++)
{
cnt0 = s[i] == '0' ? cnt0 + 1 : cnt0;
cnt1 ... | ALGO | 0.999985 | 3.347478 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2020-05-19T07:45:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "93ad0e2d9... |
5ed4182a-a3f1-4dc4-90b6-f76e18a555fd | Wendo55/ProyectoFinalEnC- | ProyectoFinalEnC++/ProyectoFinalEnC++.cpp | // ProyectoFinalEnC++.cpp : //
#include <iostream>
using namespace std;
//Menu
void menu();
//lineales
void ListaSimples();
void ListaDobles();
void Circulares();
void ListaDobleCirculares();
void Pilas();
void Colas();
//No lineales
void Arboles();
void Grafoos();
//Metodos de ordenamiento
void BubbleS();
void Inse... | ALGO | 0.987025 | 3.972023 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2022-12-08T23:19: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": "557c778e9c... |
572bdea1-8ba5-4191-9b6a-dbadddc49ad8 | voe09/CPPPlayGround | 2024/array/42.cpp | class Solution {
public:
int trap(vector<int>& height) {
int n = height.size();
vector<int> left(n, 0), right(n, 0);
left[0] = height[0], right[n-1] = height[n-1];
for (int i = 1; i < n; i++) {
left[i] = max(height[i], left[i-1]);
right[n - i - 1] = max(height... | ALGO | 0.999996 | 6.902258 | {
"github_metadata": {
"branch": "master",
"commit_count": 221,
"repo_created_at": "2017-05-01T19:21:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b4a3f109... |
4112dc6f-8a9e-4125-86c7-f3eb189585b5 | GaryDoooo/kaitou_codes | not_kaitou/daily_challenge/prime_sum.cpp | #include <bits/stdc++.h>
using namespace std;
int res = 0, n;
bool *gen_prime_map(int up_limit) {
bool *prime;
prime = (bool *) malloc((up_limit + 1) * sizeof(bool));
memset(prime, 1, up_limit * sizeof(bool));
for (int i = 3; i <= sqrt(up_limit); i += 2 ) {
if (prime[i])
for (int j =... | ALGO | 0.999977 | 4.109988 | {
"github_metadata": {
"branch": "main",
"commit_count": 255,
"repo_created_at": "2021-03-28T16:55: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": "0085219b32... |
d4679161-5e62-4744-8efd-d67bc11a444c | kodsnack/advent_of_code_2019 | nerarith-c++/day2/2b.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> program;
int code;
char comma;
while (cin >> code) {
cin >> comma;
program.push_back(code);
}
int lookingfor = 19690720;
for (int noun=0; noun <= 99; noun++) {
for (int verb=0; verb <= 99; verb++... | ALGO | 0.99954 | 3.592948 | {
"github_metadata": {
"branch": "master",
"commit_count": 919,
"repo_created_at": "2019-11-24T10:08:42.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 7,
"forks": 39,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "638476a2... |
66369f7b-2260-4f71-b04e-9781d2727a1b | Pahlavonjon/ADDS_2022_1.1 | week1/practical1/main.cpp | #include <iostream>
#include <string>
#include <random>
#include <ctime>
#include "Player.h"
#include "Person.h"
#include "Computer.h"
using namespace std;
int main(){
srand(time(0));
int user_score = 0;
int computer_score = 0;
int score_to_win = 3;
Person User("Me");
Computer The_Computer("Bot"... | ALGO | 0.921452 | 3.553415 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2022-07-21T09:35:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "14bbfa46e039... |
eca0c406-c6fa-4982-bcdc-0b556deefc9e | HowardChengUleth/Contest | uva/544.cc | #include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <map>
#include <string>
using namespace std;
class UnionFind
{
struct UF { int p; int rank; };
public:
UnionFind(int n) { // constructor
howMany = n;
uf = new UF[howMany];
... | ALGO | 0.999841 | 3.984627 | {
"github_metadata": {
"branch": "master",
"commit_count": 600,
"repo_created_at": "2020-05-11T16:38:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "88c930eb... |
3b7a94f6-4927-4327-a6b8-31717967d7c5 | debsourav33/GeeksForGeeks-DP | Minimum edits in String optimized.cpp | #include<bits/stdc++.h>
#include<string.h>
using namespace std;
int dp[1000][1000];
int call(string a, string b, int m, int n){
if(m==0&&n==0)
return 0;
if(m==0)
return n; //n remove needed
if(n==0)
return m; //m remove needed
if(dp[m][n]!=-1)
return dp[m][n];
i... | ALGO | 0.999938 | 4.276594 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2018-03-27T14:06:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4782441a55... |
d290d17d-e84a-4608-b113-6e9d960b2976 | RajaKunalPandit1/Practice_questions | worst case of QuickSort .cpp | The worst case of QuickSort occurs when the picked pivot is always one of the corner elements in sorted array. In worst case, QuickSort recursively calls one subproblem with size 0 and other subproblem with size (n-1). So recurrence is
T(n) = T(n-1) + T(0) + O(n)
The above expression can be rewritten as
T(n) = T(n-1... | ALGO | 0.999928 | 6.001286 | {
"github_metadata": {
"branch": "main",
"commit_count": 254,
"repo_created_at": "2021-04-05T05:36:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2dae954673... |
d812c5ae-ff6e-4c64-8914-ca731315d7a1 | SAMYAK99/CS-180 | C++/ShellSort.cpp | #include <iostream>
using namespace std;
// shell sort implementation
int shellSort(int arr[], int N)
{
for (int gap = N/2; gap > 0; gap /= 2)
{
for (int i = gap; i < N; i += 1)
{
//sort sub lists created by applying gap
int temp = arr[i];
int j;
for (j = i; j >= gap && arr[j - gap]... | ALGO | 0.999964 | 4.660616 | {
"github_metadata": {
"branch": "main",
"commit_count": 2051,
"repo_created_at": "2020-10-13T20:14:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 152,
"forks": 395,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "b5329... |
ae793153-4643-473e-864b-aa9ed358929a | FerdinanSilaen/Tugas-Besar-Algoritma-Struktur-Data | Latihan Live Coding/latihan1.cpp | #include <iostream>
using namespace std;
int main (){
int n = 7;
int data [n] = {12, 5, 5, 3, 8, 10, 11};
int cari = 12;
bool ketemu = false;
int i;
for (i = 0; i < n; i++){
if (data [i] == cari){
ketemu = true;
break;
}
}
cout << "\t Sekue... | ALGO | 0.999731 | 5.011704 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2024-05-14T03:00:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9d27088179f... |
46f66eca-58c3-42d3-8759-d2c6bc80d134 | DmitriyMosk/osms-rgr | cpp_code/signal/src/am.cpp | #include "signal.hpp"
#include "trigonometry.hpp"
// https://www.nonstopsystems.com/radio/pdf-hell/article-AM-mod-demod.pdf
namespace am {
std::vector<double> modulate(std::shared_ptr<Signal> signal, uint bitLevel) {
std::vector<bool> *buff = signal->GetBuffer();
std::vector<double> modulatedWav... | ALGO | 0.998404 | 5.257106 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-12-20T14:00:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c26794918d49... |
e2bb5ef2-10a3-4543-95bc-79f5b18e95f6 | FABhishek/CodeforcesContests | morningJogging.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
// Policy based data structure
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long int
#define pii pair<ll,ll>
#define rep(i,s... | ALGO | 0.999909 | 3.135605 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2021-06-15T16:58: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": "1cb718b5ba... |
4bde013e-bec6-4039-8823-71b2fa166664 | ks1ksi/ps | 백준/Gold/9576. 책 나눠주기/책 나눠주기.cc | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool cmp(pair<int, int> p1, pair<int, int> p2) {
return p1.second < p2.second;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;
vector<... | ALGO | 0.999929 | 4.658319 | {
"github_metadata": {
"branch": "master",
"commit_count": 198,
"repo_created_at": "2023-01-10T05:36: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": "ff31e8cb... |
a102a84d-0e3a-4434-9690-e427f727a7ee | mistaek/competitive-programming-solutions | cf/1801A.cpp | /*
1801A
WIP
*/
#include <iostream>
using namespace std;
int main(){
int m[20][20];
int cnter = 0;
for(int i = 0; i < 200; i += 2){
for(int j = 0; j < 200; j+=2){
m[i][j] = 4*cnter + 0;
m[i][j+1] = 4*cnter + 1;
m[i+1][j] = 4*cnter + 2;
m[i+1][j+1]... | ALGO | 0.99935 | 3.4448 | {
"github_metadata": {
"branch": "main",
"commit_count": 55,
"repo_created_at": "2022-05-14T21:49:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1992cc7b052... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.