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 |
|---|---|---|---|---|---|---|---|
8ddb8ec5-b941-41f4-b83e-7191a562f2ac | Isaac-Graham/AlgorithmExercise | leetcode/editor/cn/[152]maximum-product-subarray.cpp | //给你一个整数数组 nums ,请你找出数组中乘积最大的非空连续子数组(该子数组中至少包含一个数字),并返回该子数组所对应的乘积。
//
// 测试用例的答案是一个 32-位 整数。
//
// 子数组 是数组的连续子序列。
//
//
//
// 示例 1:
//
//
//输入: nums = [2,3,-2,4]
//输出: 6
//解释: 子数组 [2,3] 有最大乘积 6。
//
//
// 示例 2:
//
//
//输入: nums = [-2,0,-1]
//输出: 0
//解释: 结果不能为 2, 因为 [-2,-1] 不是子数组。
//
//
//
// 提示:
//
//
// 1 ... | ALGO | 0.999991 | 6.131551 | {
"github_metadata": {
"branch": "master",
"commit_count": 111,
"repo_created_at": "2019-06-14T04:34: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": "f2f31a4d... |
181523b2-0be7-4ae2-bc7e-19f5d27c322b | Aryan-Kumar-Thakur/GFG-DSA-Submissions | Difficulty: Medium/Median of two sorted arrays/median-of-two-sorted-arrays.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
//Position this line where user code will be pasted.
class Solution {
public:
int SumofMiddleElements(vector<int> &arr1, vector<int> &arr2) {
// code here
int n=arr1.size... | ALGO | 0.999964 | 5.751668 | {
"github_metadata": {
"branch": "main",
"commit_count": 723,
"repo_created_at": "2023-10-02T05:59: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": "c4925467a8... |
67450c39-0379-425e-9099-351333a309e8 | kaorulego5x/comp | blue/who_says_a_pun_z.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define repd(i, n) for(ll i = n-1; i >= 0; i--)
#define ford(i, a, b) for(ll i = a; i >= ll(b); i--)
#define fora(i, I) for(const auto& i:I)
#define all(x) x.begin(), x.end()
#define PB push_back
#define ... | ALGO | 0.999938 | 4.226828 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2022-10-14T11:08:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3a270dfb6... |
ccf8050e-dd77-42a8-b486-420ef47d9552 | achintsetia/Spoj | INVCNT.cpp | #include <iostream>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
#define FASTIO 1
#if FASTIO
/////////////////////
////// INPUT ////////
////////////////////
class INPUT {
static const int BUFSIZE = 1<<16;
static char buf... | ALGO | 0.999788 | 4.19986 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2013-11-16T09: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": "ee1165706... |
cab5b17a-0fa4-42d8-8dd4-b0f94cb72771 | haozzzzzzzz/osgEarthX | environment/build/3rdParty/include/geos/geos/index/intervalrtree/SortedPackedIntervalRTree.h | /**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as p... | ALGO | 0.986972 | 6.986564 | {
"github_metadata": {
"branch": "master",
"commit_count": 28,
"repo_created_at": "2015-09-19T06:19:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 75,
"forks": 48,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "dcc878a... |
c0c114ee-9480-404a-82fe-459c780c6572 | AudityGhosh/Leetcode | 102-binary-tree-level-order-traversal/102-binary-tree-level-order-traversal.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999973 | 6.057176 | {
"github_metadata": {
"branch": "main",
"commit_count": 541,
"repo_created_at": "2022-02-03T05:46: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": "a5840b4412... |
859688b6-7001-41b7-9101-ce7bccfcfcd5 | RounakRajSingh620/DSA | Polymorphism.c++ | #include <iostream>
using namespace std;
class A
{
public:
void sayHello()
{
cout << "Hello from A" << endl;
}
// function overloading
int sayHello(char name)
{
cout << "Hello from A" << endl;
return 1;
}
void sayHello(string name)
{
cout << "Hello " ... | TOOL | 0.960903 | 4.628133 | {
"github_metadata": {
"branch": "main",
"commit_count": 172,
"repo_created_at": "2023-07-28T11:32: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": "b174f84e24... |
bf7b0322-ac5f-4cf9-936e-a02ce22b7fca | vogonsorg/Doom-Legacy | legacy_one/trunk/src/p_sight.c | // Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id$
//
// Copyright (C) 1993-1996 by id Software, Inc.
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
//
// This program is free software; you can redistribute it and/or
// modify i... | ALGO | 0.977711 | 4.581052 | {
"github_metadata": {
"branch": "master",
"commit_count": 1625,
"repo_created_at": "2022-05-11T22:58:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "5d78372... |
9ed531ff-9a68-47d3-8e49-15511205e0aa | pritchardjr/lbg_luminosity_function | code/galaxies_mc/spline.cc | /* multipole.cc
*
* spline a data set with x-values x[] and y-values y[] of length n
*
*/
#include <math.h>
#include <iostream>
#include <fstream>
#include "dnumrecipes.h"
#include "spline.h"
using namespace std;
/*********************************************************************
**************** Construct... | ALGO | 0.996877 | 5.149444 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2014-04-02T21:52:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cf8ea83fa... |
4c5e3277-f8aa-4550-b36b-e64e0ccf76ea | nguyentuss/Competitive-Programming | CP/OnlineJudge/CSES/1190.cpp | //#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma,popcnt")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define int long long
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vect... | ALGO | 0.999949 | 4.859665 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2025-01-20T04:18: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": "9fe3851e8bda... |
857fb3fb-eb3a-44a0-bfee-0474d1aaea49 | Roberto09/Competitive-Programming-Training | Problemas Codeforces/Connect.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef pair<ii, ll> iii;
typedef vector<ii> vii;
typedef vector<pair<ii, ll>> viii;
#define FOR(i, a, b) for(ll i=ll(a); i<ll(b); i++)
#define ROF(i, a, b) for(ll i=ll(a); i>=ll(b); i--)
#define pb pus... | ALGO | 0.999855 | 3.849897 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-08-17T13:40: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": "e8e2df800e... |
f6c431c6-6055-48e8-9efd-0621e214b239 | cosmo-organization/midasml2 | include/allfunctions.h | #ifndef ALLFUNCTIONS_H
#define ALLFUNCTIONS_H
#include <armadillo>
using namespace arma;
#ifndef LD_ESTIMATE_SKELETON
#define LD_ESTIMATE_EKELETON
arma::vec fastols(const arma::vec & Y, const arma::mat & X, double intercept);
arma::vec fastals(const arma::vec & Y, const arma::mat & X, double intercept, double tau, doub... | ALGO | 0.958692 | 3.231071 | {
"github_metadata": {
"branch": "master",
"commit_count": 33,
"repo_created_at": "2020-09-16T04:39:32.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "b1b3a3dc0d... |
c2450bad-d01f-4905-ab0d-cf3e24efacc1 | mrG7/mesecina | include/Moebius_diagram_2/include/CGAL/predicates/Moebius_diagram_ftC2.h | #ifndef CHR_MOEBIUS_DIAGRAM_FTC2_H
#define CHR_MOEBIUS_DIAGRAM_FTC2_H
CGAL_BEGIN_NAMESPACE
template <class RT>
bool
compare_on_oriented_lineC2 (const RT &a, const RT &b,
const RT &x1, const RT &y1,
const RT &x2, const RT &y2)
{
const RT _0 = 0;
switch (CGAL_NTS sign (b)) {
case CGAL::ZERO: break;... | ALGO | 0.996923 | 5.640508 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2015-09-25T23:03: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": "60b11561ab... |
4954a602-3370-4e15-bf07-2f46a8e28baa | UvaCsl/HemoCell | helper/octree.h | /*
This file is part of the HemoCell library
HemoCell is developed and maintained by the Computational Science Lab
in the University of Amsterdam. Any questions or remarks regarding this library
can be sent to: <EMAIL>
When using the HemoCell library in scientific work please cite the
corresponding paper: https://d... | ALGO | 0.98968 | 4.888403 | {
"github_metadata": {
"branch": "master",
"commit_count": 1787,
"repo_created_at": "2017-12-19T12:08:52.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 47,
"forks": 20,
"issues": 3,
"pull_requests": 2
},
"file_meta": {
"content_id": "6befb2... |
5e90c6a8-1a72-4d98-8d69-2bf757efafa1 | praathamgupta/cpp | Two pointers/distinctinteger2.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
// subarray of A good if the
// number of different integers in that subarray is exactly B.
// exactly k = atmost k - atmost (k-1)
int atmost(int k, vector<int> &a)
{
int i = 0;
int j = 0;
int cnt = 0;
map<int, int> mp;
while (j < ... | ALGO | 0.99997 | 4.820171 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-07-15T06:00: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": "c82a209b7d71... |
dcfd5ae5-1d67-41d1-9af3-42fd7e8795c0 | haz/fd-multisearch | downward/VAL/Analyser.h | #ifndef __ANALYSER
#define __ANALYSER
#include <vector>
#include <iostream>
using std::vector;
using std::ostream;
#include "ptree.h"
#include "VisitController.h"
namespace VAL {
class extended_pred_symbol : public pred_symbol {
private:
int initialState;
int goalState;
vector<operator_*> preconds;
vector<oper... | ALGO | 0.953961 | 5.487495 | {
"github_metadata": {
"branch": "emil-new-integration",
"commit_count": 630,
"repo_created_at": "2020-04-06T00:45:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_... |
d50d0cec-be3a-4a62-882a-fae3c1de51b6 | eggag32/Competitive-Programming | CSES/Alpine valley (23 points).cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i... | ALGO | 0.999776 | 3.854253 | {
"github_metadata": {
"branch": "master",
"commit_count": 24,
"repo_created_at": "2020-09-24T22:38: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": "94cc3554f... |
2db1f216-25f9-4ecc-b24b-43ac1630f087 | gotliebel/mipt | contest4cpp/j.cpp | /*#include <iostream>
#include <string>
class CartesianTree {
public:
struct Node {
Node* parent_;
Node* left_child_;
Node* right_child_;
std::pair<int, int> key_priority_;
int size_;
Node() = default;
Node(const std::pair<int, int>& key_prior, const int& size = 1)
: parent_(null... | ALGO | 0.999939 | 5.454857 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2022-06-30T12:41: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": "c31214c5a428... |
3ed499e1-ae16-4a7f-825c-e00d23921669 | LinNego/algorithm_of_exmaple | ch7/UVa1602.cpp | //UVa1602.cpp
#include <set>
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
struct Ceil {
int x, y;
Ceil(int x, int y): x(x), y(y) { }
bool operator<(const Ceil &rhs) const {
return x < rhs.x || (x == rhs.x && y < rhs.y);
}
};
typedef set<Ceil> Polyomino;
const int maxn = 10;
i... | ALGO | 0.999712 | 4.294225 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2020-01-10T08:01: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": "5d67900e1... |
e1777617-7c6b-49f5-8d3b-6a2392f416d3 | dolanjp/Albany_3DM_Master | src/Tsunami/evaluators/Tsunami_BoussinesqParameters.hpp | //*****************************************************************//
// Albany 3.0: Copyright 2016 Sandia Corporation //
// This Software is released under the BSD license detailed //
// in the file "license.txt" in the top-level Albany directory //
//**************************************... | TOOL | 0.975562 | 5.592234 | {
"github_metadata": {
"branch": "master",
"commit_count": 11834,
"repo_created_at": "2018-12-19T05:47:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d4daa5... |
5a0b43e7-6b9b-4044-be64-4202433d1ade | kmjp/procon | codeforce/edu/041-060/056/g.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999656 | 4.422663 | {
"github_metadata": {
"branch": "master",
"commit_count": 3966,
"repo_created_at": "2015-02-15T11:25:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 12,
"forks": 2,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "f639a7... |
142f3063-9ebf-4c36-ba76-1fe8b64dc3d0 | Tracktion/tracktion_engine | modules/tracktion_engine/3rd_party/airwindows/DeHiss/DeHissProc.cpp | /* ========================================
* DeHiss - DeHiss.h
* Copyright (c) 2016 airwindows, All rights reserved
* ======================================== */
#ifndef __DeHiss_H
#include "DeHiss.h"
#endif
void DeHiss::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
{
float* in1 ... | ALGO | 0.968288 | 4.6764 | {
"github_metadata": {
"branch": "develop",
"commit_count": 1984,
"repo_created_at": "2018-11-09T12:40:42.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1299,
"forks": 170,
"issues": 31,
"pull_requests": 3
},
"file_meta": {
"content_id": "a... |
8bf83224-7ff2-4a79-87dd-f5403ef45172 | SerjoGon/ControlStructures | Pointers/Serch in arrays with pointers/main.cpp | #include<iostream>
using namespace std;
int left_bound(int arr, int n, int x)
{
int left = -1;
int right = n;
while (right - left > 1)
{
int middle = (left + right) / 2;
if (arr[middle] < x)
{
left = middle;
}
else right = middle;
}
return 0;
}
/*int find(int arr[], int n, int x)
{
for (int i = 0;... | ALGO | 0.999921 | 4.190105 | {
"github_metadata": {
"branch": "master",
"commit_count": 72,
"repo_created_at": "2022-03-18T16:46:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3b59bbe8d... |
c01fb78a-3311-4ded-8af5-63d0a354c771 | mahfuz1703/Problem-Solving | CodeChef/CodeChef_Streak.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define loop(x,n) for (int i = x; i < n; i++)
#define print(x) cout << x << "\n"
void solve(){
int s; cin >> s;
int o, a, ans, n;
o = a = ans = 0;
loop(0, s){
cin >> n;
if (n != 0) ans++;
... | ALGO | 0.999932 | 4.401316 | {
"github_metadata": {
"branch": "main",
"commit_count": 110,
"repo_created_at": "2023-01-26T19:18:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "367a18ac29... |
ac92c637-7ba1-488d-bd7e-208e6f357c8b | Jun0S2/AlgorithmStudy | 백준/2024_Algorithm/2606_바이러스.cpp | /**
* https://www.acmicpc.net/problem/2606
* 일반 그래프
*/
#include <iostream>
#include <vector>
using namespace std;
int N; // 컴퓨터 수
int M; // 연결된 컴퓨터의 간선
vector<vector<int>> computers;
vector<bool> visited;
int infected = 0;
void dfs(int start)
{
visited[start] = true;
infected++; // 이 컴퓨터는 감염됨
// 얘랑 인접... | ALGO | 0.999972 | 4.491061 | {
"github_metadata": {
"branch": "main",
"commit_count": 356,
"repo_created_at": "2021-12-22T12:42:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f3c81ae49a... |
413ea1e5-7f63-4464-a89e-fbf75f054811 | Chiki1601/Hackerearth-Solutions | Algorithms/Graphs/Depth first search/Matrix and Volume.cpp | #include<bits/stdc++.h>
using namespace std;
bool visit[101][101][101];
int a[101][101][101], x, y, z, count1;
vector<pair<int, pair<int, int>>>vec;
void dfs(int i, int j, int k)
{
count1--;
if(i > 1 && a[i - 1][j][k] == 0 && visit[i - 1][j][k] == false)
{
visit[i - 1][j][k] = true;
dfs(i - 1, j, k);
}
if(j ... | ALGO | 0.999815 | 3.92039 | {
"github_metadata": {
"branch": "main",
"commit_count": 1808,
"repo_created_at": "2022-09-09T09:13:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 14,
"forks": 2,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "2ac48aa0... |
2dafbd77-2af6-4147-94fd-1d801481c879 | amiradridi/Job-Resume-Matching | venv/Lib/site-packages/torch/include/ATen/ops/searchsorted_cuda_dispatch.h | #pragma once
// @generated by torchgen/gen.py from DispatchKeyFunction.h
// NB: The implementing C++ file is RegisterDispatchKey.cpp
// The only #includes we need are for custom classes that have defaults in the C++ API
#include <c10/core/MemoryFormat.h>
#include <c10/core/Scalar.h>
#include <ATen/core/Reduction.h>
... | ALGO | 0.990527 | 6.563415 | {
"github_metadata": {
"branch": "master",
"commit_count": 91,
"repo_created_at": "2022-08-05T15:27:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 122,
"forks": 34,
"issues": 2,
"pull_requests": 2
},
"file_meta": {
"content_id": "bbd58f... |
5d6d6c51-1e6f-4056-b1ea-9a83c7cfae3b | manasbis10/code | B_2_Bouquet_Hard_Version.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
int mod = 1e9+7;
int mod_add(int a, int b, int m) {return (a % m + b % m) % m;}
int mod_mul(int a, int b, int m) {return (a % m * b % m) % m;}
int mod_sub(int a, int b, int m) {return ((a % m - b % m) + m) % m;}
int bin_exp(int base, i... | ALGO | 0.999991 | 4.126078 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2025-04-18T19:45: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": "bb8d982ebaf1... |
8748f521-ccd9-47e3-a876-8603ee93972b | bin2415/Bitype | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | //===- SLPVectorizer.cpp - A bottom up SLP Vectorizer ---------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | ALGO | 0.990531 | 3.312012 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2018-09-07T02:56:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 14,
"forks": 2,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "0a2fe8f9... |
0eea4d39-1d45-4840-8fd2-e10f2f25e835 | Mahmoud-Ismail98/LeetCode-Problem-Solving-cpp | Array_Hashing_problems/242_Valid_Anagram.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
bool isAnagram(string s, string t) {
if (s.size() != t.size()) {
return false;
}
// Count the frequency of each character in s
unordered_map<char, int> freq;
for (char ch : s) {
f... | ALGO | 0.999458 | 6.246638 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2024-03-20T22:34: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": "6f116a0a2... |
07fbc886-f50b-4147-8d14-607793707d88 | suhaskvittal/qontra | dependencies/pymatching/src/pymatching/sparse_blossom/driver/io.cc | // Copyright 2022 PyMatching Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ... | ALGO | 0.98717 | 6.861705 | {
"github_metadata": {
"branch": "main",
"commit_count": 729,
"repo_created_at": "2022-08-23T21:03:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3e6582a59a... |
cb62154b-9816-49ba-84ea-9b4093f996fd | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/05/0524/personal_submission/cf301b_tsreaper.cpp | #include <bits/stdc++.h>
#define INF ((long long) 1e18)
#define MAXN 100
using namespace std;
int n, D, A[MAXN + 10], X[MAXN + 10], Y[MAXN + 10];
long long g[MAXN + 10][MAXN + 10];
int main() {
scanf("%d%d", &n, &D);
for (int i = 2; i < n; i++) scanf("%d", &A[i]);
for (int i = 1; i <= n; i++) scanf("%d%d... | ALGO | 0.999373 | 3.467202 | {
"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": "ef95... |
f90af0de-4f68-446e-90f4-b97099dbae0b | Autumnal-Joy/leetcode | 3001-4000/3235/main.cpp | #ifdef LEETCODE
#include <bits/stdc++.h>
using namespace std;
#endif
static auto _ = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return 0;
}();
#ifdef LEETCODE
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
explicit TreeNode(const int x) : val... | ALGO | 0.999957 | 5.691787 | {
"github_metadata": {
"branch": "main",
"commit_count": 649,
"repo_created_at": "2024-09-27T15:34:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "57e6f1a24e... |
8e74ff07-1bad-4c3e-bcf2-8a13a2d3ab8f | kylichist/piaa | lb3/main.cpp | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> getMatrix(const string& s1, const string& s2,
int insertCost, int deleteCost, int replaceCost) {
cout << "Calculating Levenshtein distance matrix" << endl << endl;
... | ALGO | 0.999958 | 5.388802 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2025-02-05T15: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": "2df6007e8... |
35ee5fab-3c83-49a9-b8a1-3419a0b2eccb | root-project/root | tmva/tmva/src/DNN/Architectures/Reference/ActivationFunctions.hxx | // @(#)root/tmva/tmva/dnn:$Id$
// Author: <NAME> 10/07/16
/*************************************************************************
* Copyright (C) 2016, <NAME> *
* All rights reserved. *
* ... | ALGO | 0.994493 | 6.620575 | {
"github_metadata": {
"branch": "master",
"commit_count": 93033,
"repo_created_at": "2013-06-27T10:46:59.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2899,
"forks": 1363,
"issues": 467,
"pull_requests": 269
},
"file_meta": {
"content_id"... |
9a4424aa-9b46-4f51-b4d8-43a9f958380c | hello-sources/Coding-Training | HZOJ_Answer/OJ566上网统计.cpp | /*************************************************************************
> File Name: OJ566上网统计.cpp
> Author: ltw
> Mail: <EMAIL>
> Github: https://github.com/hello-sources
> Created Time: Sat 08 Aug 2020 11:52:36 AM CST
************************************************************************/
#include <iostre... | ALGO | 0.999747 | 3.439518 | {
"github_metadata": {
"branch": "master",
"commit_count": 1403,
"repo_created_at": "2020-03-11T17:01:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "10e8084... |
159d7533-d318-4d54-b9c9-5ff7f38be140 | Code-Cube-NITP/Competitive-Programming | roundEdu85/a.cpp | #include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define int long long int
using namespace std;
#define pii pair <int, int>
#define mii map<int, int>
#define pb push_back
#define deb(x) cout << #x << " " << x << endl
#define deb2(x, y) cout << #x ... | ALGO | 0.999755 | 3.642313 | {
"github_metadata": {
"branch": "master",
"commit_count": 92,
"repo_created_at": "2020-05-03T14:04:48.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b3ff5d3978... |
8d418359-9dd4-49e0-acbe-345881847dc8 | rolandjansky/athena | Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.h | /*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MUON_MUONLAYERAMBIGUITYSOLVERTOOL_H
#define MUON_MUONLAYERAMBIGUITYSOLVERTOOL_H
#include <vector>
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
#include "MuonCombinedToolInterfaces/IMuonLayerAmbiguit... | TOOL | 0.939725 | 5.910737 | {
"github_metadata": {
"branch": "master",
"commit_count": 100549,
"repo_created_at": "2022-08-07T05:54:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7325d... |
0a798b48-9cc7-4b66-af3e-1ae0647dc1c0 | yumiweidemao/CS-225-Projects | CA_road/include/graph.h | #pragma once
#include <vector>
#include <iostream>
#include "edge.h"
using std::vector;
class Graph {
public:
/***** Constructor functions *****/
Graph() {list_ = NULL; size_ = 0;}
Graph(int size) {list_ = NULL; size_ = size;}
Graph(int size, const vector<Edge> & edges) {
... | ALGO | 0.978033 | 6.166819 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2022-05-03T03:46: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": "2f9324d2ae3... |
6876beeb-b26b-4fb2-b788-ff3951628e99 | lessandro/nbis | misc/nistmeshlab/vcglib/vcg/space/index/aabb_binary_tree/base.h | /****************************************************************************
* VCGLib o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyri... | ALGO | 0.99654 | 5.739351 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2011-09-21T11:13:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 80,
"forks": 81,
"issues": 0,
"pull_requests": 3
},
"file_meta": {
"content_id": "b3a7b50c... |
20f45325-c092-49f2-b5b4-e5db35efd228 | franzflasch/FH_MA_motion_detect | src/aruco_env.cpp | /*
* aruco_env.cpp
*
* Created on: Jun 9, 2014
* Author: franz
*/
#include <aruco_env.h>
#include <opencv2/calib3d/calib3d.hpp>
#include <math.h>
vector<Marker> arucoEnv::getMarker(void)
{
return Markers;
}
int arucoEnv::searchForMarkerId(int markerIdToSearch)
{
for (unsigned int i=0;i<Markers.size();i++... | TOOL | 0.979354 | 4.361997 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2014-08-10T08:22: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": "14fed2e013... |
054349e0-44bd-4934-b661-d9b867308298 | alanzw/ulib-win | app/unumerical/umatrix.cpp | #include <iostream>
#include <cmath>
using namespace std;
#include "umatrix.h"
void Matrix::setMatrix(double* rmatr)
{
for (int i=0; i<index*index; i++)
{
*(MatrixA+i) = rmatr[i];
}
}
Matrix::Matrix(int dims)
{
index = dims;
MatrixA = new double[index*index];
}
Matrix::~Matrix()
{
d... | ALGO | 0.999518 | 3.348157 | {
"github_metadata": {
"branch": "master",
"commit_count": 328,
"repo_created_at": "2015-04-24T07:49:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 2,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "a70b6a83... |
e6a123fd-bc23-46be-82c8-f08a88bb7da2 | rakeshranjandas/Algorithms-Practice | _code/Atcoder-BeginnerContest162/selecthalf.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x) cout << #x << " " << x << endl;
typedef long long int ll;
#define N 200001
ll ans = 0;
ll a[N];
int choose, n;
unordered_map<int, unordered_map<int, ll>> dp;
unordered_map... | ALGO | 0.999941 | 3.755609 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2020-08-03T18:03: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": "f238a64493... |
0d4f3d20-6504-4245-b1a5-45b6e81f7c5d | michaelgranberryii/Cpp-Data-Structures-Class | Project2/stack.h | #include <iostream>
#include "maze.h" // for Pair
#ifndef STACK_H_
#define STACK_H_
#define MAX_STACK_SIZE 1024
#define STACK_WIDTH 5 // assuming single digit pair members
class Stack {
public:
Stack() {
this->head = 0; // first empty slot
}
~Stack() {
}
// returns true if stack is empty, and false o... | TOOL | 0.906959 | 4.411041 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2021-02-13T00:39:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f86894406e2... |
4483d3d8-3521-4126-95d9-0b018aaaed2a | billkondo/Competitive_Programming | Codeforces/922D.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
const int maxn = 1e5 + 10;
int n;
string s[maxn];
struct word {
ll S, H;
int id;
};
bool operator < (word a, word b) {
return a.S * b.H > b.S * a.H;
}
vector<word> S;
ll solve() {
sort(S.begin(), S.end())... | ALGO | 0.999637 | 3.389306 | {
"github_metadata": {
"branch": "master",
"commit_count": 98,
"repo_created_at": "2017-06-23T09:29: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": "ea54a691d... |
4ee514bd-167b-4e5b-a319-f2b9a8127775 | srele96/sk-experiments | cpp/experiments/algorithms/src/binary_search_iterative.cpp | #include <iostream>
#include <vector>
namespace algorithm {
namespace result {
constexpr std::size_t not_found = -1;
}
} // namespace algorithm
namespace algorithm {
std::size_t binary_search(const std::vector<int>& numbers, int number) {
std::size_t begin = 0;
std::size_t end = numbers.size() - 1;
while (... | ALGO | 0.999795 | 6.212014 | {
"github_metadata": {
"branch": "develop",
"commit_count": 229,
"repo_created_at": "2022-03-01T21:22:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 145,
"pull_requests": 2
},
"file_meta": {
"content_id": "ea9a3... |
0b9d3ccd-7969-4cb5-8ea7-c7487627625e | edguer/cpp-algorithms | book/Chapter 1/question5.cpp | #include <bits/stdc++.h>
#include "utils.hpp"
#include <charconv>
using namespace std;
string str = "abcdhhhhhherjjjj";
string new_str;
//O(n), space O(2n)
void CompressNewString()
{
char *last_char = NULL;
unsigned short int last_char_count = 0;
for (int i = 0; i < str.length(); i++)
{
if (la... | ALGO | 0.999941 | 4.384202 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2022-07-01T15:51: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": "a2716875c3... |
36ef7735-2d7f-463d-9eea-7f3f713aac17 | chromium/chromium | ash/public/cpp/tab_cluster/correlation_clusterer.cc | // Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/public/cpp/tab_cluster/correlation_clusterer.h"
#include <map>
#include <optional>
#include <set>
#include "ash/public/cpp/tab_cluster/undirected_graph.h"
#incl... | ALGO | 0.999712 | 7.603747 | {
"github_metadata": {
"branch": "main",
"commit_count": 1609541,
"repo_created_at": "2018-02-05T20:55:32.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 21189,
"forks": 7786,
"issues": 0,
"pull_requests": 120
},
"file_meta": {
"content_id":... |
359e65dd-1ecb-43ce-8d1c-5d805fe8e485 | Krewn/KRowReduction | main.cpp | #include <iostream>
//<NAME>//Febuary 2013
using namespace std; //I could call classes but this is all about containment
int i,j,ki,kj,k; //no need to reinitialize on each loop, as oposed to the arrays & const ints.
int main(){top:
bool b=1;
cout<<"####################... | ALGO | 0.999454 | 3.219091 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2013-12-16T06:58:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dce294195a... |
36d31f6e-05b8-4112-9f1e-66c2faadf641 | OrigenesZhang/cppprimer | chapter 7/ex7.3/main.cpp | #include <iostream>
struct Sales_data {
std::string bookNo;
unsigned units_sold = 0;
double revenue = 0;
std::string isbn() const {
return bookNo;
}
Sales_data& combine(const Sales_data&);
double avg_prive() const;
};
Sales_data& Sales_data::combine(const Sales_data &rhs) {
... | TOOL | 0.918307 | 4.832627 | {
"github_metadata": {
"branch": "master",
"commit_count": 92,
"repo_created_at": "2018-01-14T13:55: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": "8b445579c... |
c9e02791-7f9f-4981-874a-7067680c5760 | thesagardahiwal/DSA | DFS_BFS.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
using namespace std;
// Define a structure to represent a graph node
struct GraphNode {
string name;
vector<GraphNode*> neighbors;
GraphNode(string n) : name(n) {}
};
// Function to perform Depth-Fir... | ALGO | 0.999754 | 6.316825 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-05-01T17:02: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": "0f43774b5147... |
3046937c-75e0-4892-b749-131d74c516cf | araafario/WorkshopGrafikaKom | 2d Transformation/Source.cpp | #include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <iostream>
#define dalam 0
#define transisimasuk 1
#define luar 2
#define transisikeluar 3
using namespace glm;
using namespace std;... | ALGO | 0.938487 | 4.316551 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-03-30T07:19: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": "b04cbc158659... |
c23cff51-0c1e-4c76-8534-243409583b29 | fupengfei058/algorithm | Leetcode/15. 3Sum.cpp | /*3Sum:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.*/
class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
vector<vector<int>> res;
int n = nums.size();
if (n ... | ALGO | 0.999927 | 5.913284 | {
"github_metadata": {
"branch": "master",
"commit_count": 116,
"repo_created_at": "2017-11-16T02:54:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 70,
"forks": 30,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e9ceb9... |
75d8fd95-9c1c-4879-b48c-1fb037eaa638 | wwwwodddd/Zukunft | luogu/P1707.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, mod;
ll mul(ll x, ll y)
{
ll re = 0;
for (; y > 0; y >>= 9)
{
re = (re + y % 512 * x) % mod;
x = x * 512 % mod;
}
return re;
}
void mul(ll a[11][11], ll b[11][11]) {
ll w[11][11] = {};
for (int i = 0; i < 11; i++) {
for (int k = 0; k... | ALGO | 0.999906 | 3.471344 | {
"github_metadata": {
"branch": "master",
"commit_count": 206,
"repo_created_at": "2018-12-31T17:17:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "92f7d19... |
f7864e7d-08ad-41f8-9abd-785bb0ce1869 | barbara-aguilar/foundations_cpp | exercicio13.cpp | //Um instituto está realizando uma pesquisa para descobrir a idade e o peso médios da população de um bairro.
//Cada entrevistado informa seu peso e sua idade e, quando for informado 0 para o peso, o recebimento de dados deve ser interrompido
//e devem ser exibidas a quantidade de entrevistados, a média de peso e a m... | TOOL | 0.974771 | 3.221246 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2021-05-20T01:08: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": "a16c0a783... |
4ce95cd1-cf63-48b9-ad65-e525233e845d | JamesKarter99/__olympiad | P/acmp/Решение олимпиадных задач/6. ДП/Динамика - 3/A. Сумма степеней двойки.cpp | /*
* ------------ Сумма степеней двойки ------------
& динамика - 3
~ двумерная_динамика ~ одномерная_динамика
? решение за O(n*log(n)). Чтобы избежать дублирования разложений, слагаемые будем размещать в порядке неубывания. Итак, сначала найдем степень двойки такую, что она наибольшая из меньших, чем n, степеней двойк... | ALGO | 0.99999 | 4.974091 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2021-03-31T04:44:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e06197cd2a... |
d2558fd5-e8bb-4752-82bb-d17a7eb153d2 | sharmista2shastry/Data-Structures-and-Algorithms | Dynamic Programming/CoinTower.cpp | //Using Memoization
int helper(int n, int x, int y, int *ans)
{
if(n == 1 || n == x || n == y)
return 1;
if(n < 0)
return 0;
if(ans[n] != -1)
return ans[n];
int a, b, c;
a = helper(n-1, x, y, ans) ^ 1;
b = helper(n-x, x, y, ans) ^ 1;
c = helper(n-y, x, y, ans) ^ 1;
if(a == 1 || b == 1 || c == 1)
{
... | ALGO | 0.99979 | 4.454021 | {
"github_metadata": {
"branch": "main",
"commit_count": 295,
"repo_created_at": "2023-04-23T10:30: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": "6abb7e3920... |
d2591b67-239f-4ddf-b4d9-09b4c7a957bd | furtherun/PATest | PAT_Advanced/1067 Sort with Swap(0, i) (25分).cpp | /*
1067 Sort with Swap(0, i) (25分)
我这样写是对题目描述进行模拟,
事实上,我们还有许多解法,比如它并不关注过程,也就是说。
我们只需要寻找环路,一共能分成几个环,考虑0从一个环跳跃到另一个环路。
甚至是,每次只考虑于pos[0]进行交换,也就是说,每次不是操作0(题目是每次操作0,让0回到pos[0])
可以转化为一直操作pos[0]处的元素,让它调整为0
*/
#include<iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
void changePos(vector<... | ALGO | 0.999997 | 3.891527 | {
"github_metadata": {
"branch": "master",
"commit_count": 228,
"repo_created_at": "2019-04-11T00:05:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "abc59e42... |
ae245cbb-8c60-42bd-a4fc-2c1abf421566 | liuyubobobo/Play-Leetcode | 1001-1500/1219-Path-with-Maximum-Gold/cpp-1219/main.cpp | /// Source : https://leetcode.com/problems/path-with-maximum-gold/
/// Author : liuyubobobo
/// Time : 2019-10-05
#include <iostream>
#include <vector>
using namespace std;
/// Backtrcking
/// Time Complexity: O(2^(m*n))
/// Space Complexity: O(m*n)
class Solution {
private:
int R, C;
const int dirs[4][2... | ALGO | 0.999146 | 5.603851 | {
"github_metadata": {
"branch": "master",
"commit_count": 2592,
"repo_created_at": "2016-12-01T17:08:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2732,
"forks": 718,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "48... |
39bf2e70-adf4-4572-bd7a-154ca1faac94 | CheshtaK/DS-Algo | JugglingAlgorithm/main.cpp | //Juggling algorithm for array rotation
#include <iostream>
using namespace std;
int gcd(int a, int b){
if(b == 0)
return a;
else
return gcd(b, a%b);
}
void leftRotate(int a[], int n, int d){
for(int i=0; i<gcd(d, n); i++){
int temp = a[i];
int j = i;
while(1){
... | ALGO | 0.999983 | 4.268064 | {
"github_metadata": {
"branch": "master",
"commit_count": 62,
"repo_created_at": "2018-05-26T09:41: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": "e9d5cd612... |
4e1fe041-a9d3-44f8-8692-3adfd3b06f90 | Satish-Raut/DSA-in-C- | code_298_BFS.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
void BFS(const vector<vector<int>>& AdjList, vector<int>& ans) {
queue<int> q;
vector<bool> visited(AdjList.size(), false);
q.push(0);
visited[0] = true;
while (!q.empty()) {
int node = q.front();
q.pop();... | ALGO | 0.999993 | 6.225788 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2025-01-30T10:05:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cd2f8137eb4c... |
3aa229c0-03bd-46e7-bbc0-c03b2e8c84c0 | Hsnayrus/ECE551-Suryansh | Assignments/Attempt/097_binsrch/test-bsearch.cpp | #include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include "function.h"
#include "search.cpp"
int binarySearchForZero(Function<int, int> * f, int low, int high);
class MyFunc : public Function<int, int> {
virtual int invoke(int arg) { return arg; }
};
class CountedIntFn : public Function<i... | TEST | 0.983054 | 5.889941 | {
"github_metadata": {
"branch": "main",
"commit_count": 187,
"repo_created_at": "2024-01-11T00:39:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "aedf5105a6... |
54e70cd0-ef22-4ce1-9ac2-5a8b435afaa4 | blackbeardONE/CheggHero | coursehero_auto_reg/txtsource/478.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
#define fill(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define sz(x) (int)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i =... | ALGO | 0.999865 | 3.6334 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2018-09-17T03:12:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 18,
"forks": 8,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7ecf91b6e... |
3ff4c6b9-b059-47e6-b0e6-825a50d34f1e | pandakkkk/DataStructures-Algorithms | Graphs/Union Find/684. Redundant Connection.cpp | /*
____ _ _ _ _ __ __ _ _ _
| _ \(_)___| |__ __ _| |__ | |__ | \/ | __ _| | |__ ___ | |_ _ __ __ _
| |_) | / __| '_ \ / _` | '_ \| '_ \ | |\/| |/ _` | | '_ \ / _ \| __| '__/ _` |
| _ <| \__ \ | | | (_| | |_) | | | | | | | | (_| | | | | | (_) | |_| | | (_| |
|_| \_\... | ALGO | 0.999875 | 5.054717 | {
"github_metadata": {
"branch": "main",
"commit_count": 64,
"repo_created_at": "2021-10-09T20:54:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "83ff49a1fe4... |
86718f6a-e4a7-4582-a165-2faba51ff4d1 | alexvargas01/Algoritmos | Tareas/MochilaBB/MochilaBB.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct node{
int niv;
int va;
int pa;
int vp;
vector<bool> inc;
bool operator<(const node &otro) const{
return vp < otro.vp;
}
};
struct obj{
int valor, peso, valpeso;
};
// PESO = Peso de la mochila
// VOptimo = Valo... | ALGO | 0.999969 | 4.390447 | {
"github_metadata": {
"branch": "master",
"commit_count": 27,
"repo_created_at": "2020-02-21T18:26: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": "21f008ef6... |
e71b8360-7404-4514-b7ea-0afabfa9ddde | Djeb/Dijkstra-Algorithm | flib.h | #include <queue>
#include <utility>
#include <climits>
#include <cmath>
#ifndef INF
#define INF INT_MAX
#endif
namespace flib{
class Orientation{
public:
Orientation(){
this->lon = 0.0;
this->lat = 0.0;
}
Orientation(float &lon, float &lat){
... | ALGO | 0.999917 | 4.354863 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2015-06-30T13: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": "48a6121f7f... |
cb9faf1e-a1f6-4f6f-ab0f-6742aeae9908 | Tora416/MultiCodeEmbed | dataset/dataset_raw/gcj_cpp/wwt15/3264486_5654742835396608_wwt15.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
int main() {
freopen("C-small-1-attempt0.in", "r", stdin);
freopen("C.out", "w", stdout);
int T;
scanf("%d", &T);
for (int Case = 1; Case <= T; Case++) {
ll N, K;
scanf("%lld%lld", &N, &... | ALGO | 0.999535 | 4.679297 | {
"github_metadata": {
"branch": "master",
"commit_count": 57,
"repo_created_at": "2025-07-10T08:38: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": "c79f2a742... |
2c93b835-b51d-4500-9ba4-25ec6266c16a | gefeng/cp | cses/planets_quries_2.cpp | #include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
constexpr int LOG = 20;
void run_case() {
int N, Q;
std::cin >> N >> Q;
std::vector<int> A(N);
std::vector<std::vector<int>> G(N);
for(int i = 0; i < N; i++) {
std:... | ALGO | 0.99973 | 4.974121 | {
"github_metadata": {
"branch": "main",
"commit_count": 980,
"repo_created_at": "2022-07-19T19:38: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": "c861508973... |
e0dee9dd-dae1-43e3-8039-7fdde84711ea | kvzhao/Templates_uni10 | uni10/src/uni10/uni10_lapack_cpu/tools_lapack_cpu/uni10_linalg_cpu_dz.cpp | #include <limits.h>
#include "uni10/uni10_error.h"
#include "uni10/uni10_lapack_cpu/tools_lapack_cpu/uni10_tools_cpu.h"
#include "uni10/uni10_lapack_cpu/tools_lapack_cpu/uni10_linalg_cpu_z.h"
#include "uni10/uni10_lapack_cpu/tools_lapack_cpu/uni10_linalg_cpu_dz.h"
#ifdef MKL
#define MKL_Complex8 std::complex<float>
... | TOOL | 0.982946 | 4.954371 | {
"github_metadata": {
"branch": "master",
"commit_count": 53,
"repo_created_at": "2016-12-02T07:34: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": "d9a61690e... |
3db5fba1-29e8-4c94-ad72-4546f5e0dbfc | zhangmeishan/EGN3LDG | BiOP.h | #ifndef BIOP_H_
#define BIOP_H_
/*
* BiOP.h:
* a simple feed forward neural operation, binary input.
*
* Created on: June 11, 2017
* Author: mszhang
*/
#include "Param.h"
#include "MyLib.h"
#include "Node.h"
#include "Graph.h"
#include "ModelUpdate.h"
class BiParams {
public:
Param W1;
Param W2;
... | DATA | 0.99755 | 5.798176 | {
"github_metadata": {
"branch": "master",
"commit_count": 89,
"repo_created_at": "2016-07-23T11:25:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 32,
"forks": 17,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a37f5a1... |
30f9d3c5-6046-49ee-9017-c46c808b7cea | andrewbytecoder/linux-sys | data_structure_sqlite/example/数据结构和算法_小甲鱼/第五十三讲 赫夫曼编码C语言实现/huffman/pQueue.cpp | #include "pQueue.h"
#include <stdlib.h>
#include <stdio.h>
void initPQueue(pQueue **queue)
{
//We allocate memory for the priority queue type
//and we initialize the values of the fields
(*queue) = (pQueue *) malloc(sizeof(pQueue));
(*queue)->first = NULL;
(*queue)->size = 0;
return;
}
void addPQueue(pQueue **qu... | ALGO | 0.982843 | 4.579659 | {
"github_metadata": {
"branch": "dfew",
"commit_count": 155,
"repo_created_at": "2017-08-18T14:59:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 50,
"forks": 34,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "62f74d8a... |
0328759d-5c4c-48e8-ab84-dd8865dd7234 | surf-excel/Codeforces | B_Battle_Cows.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define read(a) for(auto &i: a) cin >> i
#define mod 1000000007
#define nline '\n'
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t=1;
cin >> t;
while(t--){
int n, k;
cin >> n >> k;
v... | ALGO | 0.999935 | 3.792967 | {
"github_metadata": {
"branch": "main",
"commit_count": 38,
"repo_created_at": "2024-07-16T04: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": "edfd153f506... |
b973c185-ba41-4bf2-a0b2-de91015e0a30 | zaphodbbrx/assignment_array_algorithms | main.cpp | #include <iostream>
#include <vector>
#include "misc.h"
void task1(){
/*
Задача 1
Вам даётся массив целых чисел. Необходимо найти такие два индекса i и j в этом массиве,
что сумма a[i], a[i+1], a[i+2], … a[j] будет максимально возможной и вывести их.
Пример:
a = {-2,1,-3,4,-1,2,1,-5,4}
... | ALGO | 0.99977 | 3.689632 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2021-07-31T10:08:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "081beac850... |
1fff4c4e-4a95-4b09-bd0c-8d9160d30e34 | deepanshu-cmd/DSA-with-C-repo | C++(Level_3)/3_Recursion/Recursion_12.cpp | //? Bubble sort with recurison.
#include <iostream>
#include <iomanip>
using namespace std;
void bubbleSort(int arr[], int length)
{
//* Base case.
if (length == 0 || length == 1)
return;
//* Processing.
for (int i = 0; i < length; i++)
{
if (arr[i] > arr[i + 1])
swap(... | ALGO | 0.999587 | 5.528897 | {
"github_metadata": {
"branch": "master",
"commit_count": 40,
"repo_created_at": "2024-07-04T13:22: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": "772e3075a... |
114a3581-55b0-45de-8afd-d9afc2c5f891 | wqrqwerqrw/acm_code | cf/1209/b.cpp | // Author : Wqr_
// Time : 19/09/15
#include <bits/stdc++.h>
#define iofuck std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
bool beg[110];
int a[110], b[110];
int main() {
int n;
cin >> n;
string str;
cin >> str;
int cur = 0;
for (i... | ALGO | 0.999908 | 3.322159 | {
"github_metadata": {
"branch": "master",
"commit_count": 109,
"repo_created_at": "2019-03-28T10:09: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": "de1f9cda... |
b1e35839-cf25-4efb-8693-8f67d7207233 | Hunterdii/GeeksforGeeks-POTD | May 2025 GFG SOLUTION/May-22.cpp | class Solution {
public:
int minDeletions(string &s) {
int n = s.size();
vector<int> dp(n), prev(n);
for (int i = n - 1; i >= 0; --i) {
dp[i] = 1;
for (int j = i + 1; j < n; ++j)
dp[j] = s[i] == s[j] ? prev[j - 1] + 2 : max(prev[j], dp[j - 1]);
... | ALGO | 0.999969 | 5.878528 | {
"github_metadata": {
"branch": "main",
"commit_count": 3732,
"repo_created_at": "2024-03-09T09:48:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 202,
"forks": 54,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5e940... |
4e0625b1-b245-46b6-b79a-09e5c180e32c | encrypted-def/basic-algo-lecture | Appendix A/solutions/15312.cpp | // Authored by : scsc3204
// Co-authored by : -
// http://boj.kr/1f4d8438f46a4078bbfe1bdd2ab092e5
#include <bits/stdc++.h>
using namespace std;
string s[2];
int p[4002][4002];
int cnt[] = {3, 2, 1, 2, 3, 3, 2, 3, 3, 2,
2, 1, 2, 2, 1, 2, 2, 2, 1, 2,
1, 1, 1, 2, 2, 1};
int main() {
ios::sync... | ALGO | 0.999996 | 3.736018 | {
"github_metadata": {
"branch": "master",
"commit_count": 1862,
"repo_created_at": "2020-02-19T10:47:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2560,
"forks": 601,
"issues": 1,
"pull_requests": 4
},
"file_meta": {
"content_id": "4d... |
7f54e46c-fb3e-435f-95cd-f0e90147bcb0 | Net-Set/cpp | codeforces/Way_to_long_word.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long int;
#define db(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define f(i,n) for(ll i=0;i<(n);++i)
#define fA(i,a,n) for(ll... | ALGO | 0.999869 | 3.399387 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2021-05-06T03:11:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f00225db0a40... |
5094da98-6a26-42ba-9b70-a64c1d7dae9a | ykrislt15368/div3-734 | B2.cpp | /*.........................*
*..................___....*
*.../|...../|...../...\...*
*../.|..../.|..../........*
*....|......|...|.........*
*....|......|..|..___.....*
*....|......|..|./...\....*
*....|......|..|/.....\...*
*....|......|..\...../....*
*..__|__..._|_..\___/.....*
*.........................*
... | ALGO | 0.999962 | 3.568234 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-07-24T06:25:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "32abefde2b06... |
4c742c74-891a-46a5-b53f-9429e6e00c75 | basu-96/Competitive-Programming | CRDGAME.cpp | // Problem link - https://www.codechef.com/JULY20B/problems/CRDGAME
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define lli long long int
#define vi vector<int>
#define vll vector<lli>
#define pb push_back
#define all(v) ... | ALGO | 0.999978 | 4.247717 | {
"github_metadata": {
"branch": "master",
"commit_count": 68,
"repo_created_at": "2016-05-28T15:51:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "98f4dd96a... |
3fc3049b-a9f4-4d4d-bb82-a1937e858606 | prasachin/DSA | Linkedlist/implementationDoubly.cpp | #include <bits/stdc++.h>
using namespace std;
/* TYPES */
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vi vector<int>
#define vll vector<long long>
#define vs vector<string>
#define vvll vector<vector<long long>>
#define vpi vector<pair<int, int>>
#define vpll vector<... | ALGO | 0.999844 | 4.355511 | {
"github_metadata": {
"branch": "master",
"commit_count": 48,
"repo_created_at": "2024-05-11T12:02:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "629dc790b... |
09309e0d-9244-4804-9996-925984499c88 | Brohammad/leetcodechallenges | PrimalFear.cpp | #include <iostream>
#include <vector>
using namespace std;
const int MAXN = 1e6 + 1;
// Step 1: Sieve of Eratosthenes
vector<bool> sieve(int n) {
vector<bool> isPrime(n, true);
isPrime[0] = isPrime[1] = false;
for (int i = 2; i * i < n; i++) {
if (isPrime[i]) {
for (int j = i * i; j <... | ALGO | 0.999717 | 5.663589 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2025-06-01T11:28: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": "5a266e90d08c... |
9520cfb6-e64f-47f6-b147-9bec37abecfa | theDreamBear/algorithmn | algorithm/test/x.cpp | class hash_heap {
private:
vector<int> _indexes;
unordered_map<int, int> _index_map;
const vector<int> _data;
function<bool(int, int)> _cmp;
int sz;
int get_value(int index) {
return _data[index];
}
void heap_down(int i = 0) {
if (sz <= 1) {
return;
... | ALGO | 0.999962 | 5.440728 | {
"github_metadata": {
"branch": "master",
"commit_count": 1074,
"repo_created_at": "2019-02-24T04:03:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c6494aa... |
0bd90c93-db5d-4984-8d20-41d2c3070617 | kresle/poj | poj_1077/poj_1077_Astar.cc |
/**
* 八数码问题,就和八皇后问题一样,在高中的时候绝对做过。
* 而且当时老师教的应该就是A*算法,十多年过去了,自己居然还是在原地踏步。
*
*/
#include <iostream>
#include <vector>
#include <bitset>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
struct asNode
{
// string state;
char rr, cc;
asNode *parent;
char chgByPar; //[0..... | ALGO | 0.999978 | 4.317626 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2019-04-19T06:52: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": "87bd70e6b... |
c7a4f7ef-f16a-4c36-a7fe-d4f9a046835b | wjanaszek/CNC | Kalkulator.h | #ifndef KALKULATOR_H
#define KALKULATOR_H
#include <list>
#include <stack>
#include <queue>
#include "liczbyZespolone.h"
using namespace std;
/*
Klasa przeksztalcająca wejscie do postaci ONP. Wykonujaca obliczenia.
*/
class Kalkulator
{
public:
virtual void doONP(char * wejscie, int & index, int dlWejscia, stac... | ALGO | 0.930484 | 4.524683 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2016-10-29T12:10: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": "7be513f639... |
41981918-742c-44dc-861e-74043f89fc67 | harbinzhang/flux_swap | hw2/mainc.cpp | #include <omp.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <stack>
#include <utility>
#include "g.h"
#include <queue>
#include <stack>
using namespace std;
static const int s = 12;
static const double fai = 1e-4;
class Node
{
public:
double first, second;
double ga, gb;
bool ga_valid, gb_... | ALGO | 0.999975 | 3.429884 | {
"github_metadata": {
"branch": "master",
"commit_count": 122,
"repo_created_at": "2017-10-04T00:21: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": "eab72c83... |
7b9182a0-1a06-43a3-8b3d-ca0f339623e8 | ilejn/ndf | ndf.cpp | #include <string_view>
#include <iostream>
#include <memory>
#include <vector>
#include <functional>
#include <algorithm>
// Normal Disjunction Form builder
using String = std::string;
class ASTFunction;
using ASTPtr = std::shared_ptr<ASTFunction>;
using ASTs = std::vector<ASTPtr>;
struct ASTFunction
{
String ... | ALGO | 0.999636 | 7.288219 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2020-12-02T21:20:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3b52115652bb... |
0c19585e-5336-4fce-a9dc-c834112319c6 | ankitthakur90/DSA-Linked-List-CPP | circular_link_list/circularLInkLIst.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data){
this->data = data;
this ->next = NULL;
}
};
void append(Node* &Head,Node* &Tail,int data){
Node* temp = new Node(data);
Node* curr = Head;
while (curr->next!=Head)
{
... | ALGO | 0.995894 | 4.156437 | {
"github_metadata": {
"branch": "main",
"commit_count": 23,
"repo_created_at": "2023-09-03T18:33: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": "2182acf39e2... |
57c08174-6754-4232-b6bc-91a9f8d5b678 | miaomiaocoder/CodePractice | acwing/AcWing839.cpp | #include <algorithm>
#include <iostream>
using namespace std;
const int N = 1e5 + 10;
int h[N], ph[N], hp[N], cnt;
void heap_swap(int a, int b) {
swap(ph[hp[a]], ph[hp[b]]);
swap(hp[a], hp[b]);
swap(h[a], h[b]);
}
void down(int u) {
int t = u;
if (u * 2 <= cnt && h[u * 2] < h[t]) t = u * 2;
... | ALGO | 0.999764 | 4.216755 | {
"github_metadata": {
"branch": "main",
"commit_count": 158,
"repo_created_at": "2022-04-18T04:49:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d1ed0edd35... |
69114096-e13d-432c-9f67-387be8bd00e8 | sirupsen/informatics | ncpc/2011/E-ls/ncpc-e-ls.cpp | #include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
using namespace std;
string file_name, pattern;
short dp[105][105];
bool match(size_t index, size_t pattern_index)
{
if(index >= file_name.size() || pattern_index >= pattern.size())
return false;
if(pattern[pattern_ind... | ALGO | 0.998855 | 3.50695 | {
"github_metadata": {
"branch": "master",
"commit_count": 74,
"repo_created_at": "2012-04-22T09:34:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 9,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "92d1f7edf... |
3e28f60c-e765-463b-a725-bc4e555065f4 | nagaakira/221112011_DFTT | 221112011_闫皓_作业2/02_bonus_2.cpp | /*
程序设计_2023_第二次作业
title:02_bonus_2.cpp
石头剪刀布游戏
用 while, do while, switch, if 等结构编写石头剪刀布游戏
将玩家和电脑的“石头”“剪刀”“布”用数字 0、1、2 取代,计算玩 家输入值与电脑随机值的差,作为判定依据。电脑随机值可用 rand() % 3 生成
*/
#include <iostream>
#include <cstdlib>
#include <ctime>
int main() {
srand(time(0));
int player, computer;
int playerScore = 0, com... | ALGO | 0.991128 | 4.03995 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2023-10-05T18:57: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": "9fa88eafb79... |
abb249a7-620c-4160-a9f2-5806367fd594 | abhiXsliet/Solved-DSA-Problems | Leetcode Daily Challenge/023-May-2025/001-maximum-number-of-tasks-you-can-assign.cpp | // https://leetcode.com/problems/maximum-number-of-tasks-you-can-assign/
#include <bits/stdc++.h>
using namespace std;
class Solution {
private:
int isPossible(vector<int> &tasks, vector<int> &workers, int pills, int strength, int mid) {
multiset<int> mst(begin(workers), begin(workers) + mid);
... | ALGO | 0.999994 | 5.772885 | {
"github_metadata": {
"branch": "main",
"commit_count": 2156,
"repo_created_at": "2023-07-29T13:17:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "50ccc01e5... |
95c4a340-663c-4788-b1c2-c2534f7e6302 | zezo-mohamed22/LeetCode | 622-design-circular-queue/622-design-circular-queue.cpp | class MyCircularQueue {
public:
struct ListNode
{
int val;
ListNode* next;
ListNode(int x)
{
val = x;
next = NULL;
}
};
ListNode* front = NULL;
ListNode* rear = NULL;
int max_size;
... | ALGO | 0.999375 | 5.540508 | {
"github_metadata": {
"branch": "main",
"commit_count": 612,
"repo_created_at": "2022-05-31T19:56:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fbc7c64423... |
f28e8b0b-66d4-47e9-a22e-12f94812f1ed | lemursauce/language_practice-unix_commandline_tools | cpp/common.cpp | #include <memory.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "common.h"
// simple functions
bool isWhiteSpace(char c) {
return (c == ' ' || c == '\n' || c == '\r' || c == '\t');
}
int intStrLen(size_t val) {
int len = 0;
while (val) {
++len;
... | TOOL | 0.900259 | 4.613925 | {
"github_metadata": {
"branch": "master",
"commit_count": 23,
"repo_created_at": "2024-07-12T19:51: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": "60348bcf7... |
90270db2-c1b2-4cba-95ad-6d9c3996158a | qk12/ACM | Greedy Algorithm/装箱问题.cpp | // ybt 1226
#include <iostream>
using namespace std;
int main()
{
int a, b, c, d, e, f;
int base[4] = {0, 5, 3, 1};
while (cin >> a >> b >> c >> d >> e >> f)
{
if (a + b + c + d + e + f == 0)
break;
int ans = f + e + d + (c + 3) / 4;
int x = 5 * d + base[c % 4];
... | ALGO | 0.99955 | 3.086675 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-10-04T06:01: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": "813af0c718... |
7b8750d9-7bc5-43a8-bf65-a8392721b2e1 | tonoysheikh/comparative-programming-cpp- | hacker rank/string anagram.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mod 1000000007
#define pi 3.1415926535897932384626433832795
void yes() { cout<<"YES\n"; }
void no() { cout<<"NO\n"; }
void solve()
{
int len;
cin >> len;
vector<string... | ALGO | 0.999929 | 4.271798 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-06-05T17:49: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": "e702d3d952d4... |
2eb9b9da-0a67-4ceb-8cae-1cc9e38f1582 | PlamenStilyianov/Quant | Fin Eng C++ course/DesignCPP/include/Bisection.h | //
//
// Bisection.h
//
//
template<class T>
double Bisection(double Target,
double Low,
double High,
double Tolerance,
T TheFunction)
{
double x=0.5*(Low+High);
double y=TheFunction(x);
do
{
if (... | ALGO | 0.999966 | 5.679851 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2016-02-04T00:25:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 429,
"forks": 206,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "a3850b... |
cefdaba2-a6e5-462a-bd77-eb03db50b95d | yywwann/ACM-git | CodeForces/Codeforces Round #616 (Div. 2)/A.cpp | #include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
bool ff;
int n, T;
char s[100005];
inline int read()
{
int x = 0; char ch = getchar();
while (ch > '9' || ch < '0') ch = getchar();
while (ch >= '0' && ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48),
ch ... | ALGO | 0.999896 | 3.198813 | {
"github_metadata": {
"branch": "master",
"commit_count": 77,
"repo_created_at": "2018-11-20T10:06:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "569d013b5... |
8e2e8783-57a4-43ce-a2e7-d9519b991f60 | NanGong-WenYa/Algorithm_Courses | DataStructure_Course/103102.cpp | #include<iostream>
#include<stack>
#include<vector>
using namespace std;
class BinaryTreeNode {
public:
BinaryTreeNode() { LeftChild = RightChild = 0; }
BinaryTreeNode(const char& e) { data = e; LeftChild = RightChild = nullptr; }
BinaryTreeNode(const char& e, BinaryTreeNode* l, BinaryTreeNode* r) { data... | ALGO | 0.99983 | 4.296665 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2023-09-14T14:39: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": "e03c24ab6b8... |
536bb4b2-0043-43fa-9b07-67f32d93b20e | habanero-rice/hclib | test/performance-regression/full-apps/qmcpack/src/Estimators/Experimental/OneBodyDensityMatrix.h | //////////////////////////////////////////////////////////////////
// (c) Copyright 2004- by <NAME>
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
// <NAME>
// National Center for Supercomputing Applications &
// Materials Comp... | ALGO | 0.98589 | 5.556288 | {
"github_metadata": {
"branch": "master",
"commit_count": 705,
"repo_created_at": "2014-08-11T16:15:45.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 71,
"forks": 36,
"issues": 11,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5d812... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.