uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
148a3635-545e-417d-bfb0-15ec628c1d80 | aadityabhetuwal/CSE-1002-Problems | practice problems 5/customer_discount.cpp | #include <iostream>
#include <vector>
#include <cmath>
#define ll long long
#define ull unsigned long long
using namespace std;
class customer{
public:
string name;
ll mob;
string address;
int id;
int num;
int *bills;
customer() { }
virtual ~customer(){ free(bills);}
void get(... | ALGO | 0.876372 | 3.380088 |
1ea1eda6-fad7-44ea-b94e-22f7664dc732 | reswitched/switch-oss | webkit_3.27.11/WebCore/platform/audio/EqualPowerPanner.cpp | #include "config.h"
#if ENABLE(WEB_AUDIO)
#include "EqualPowerPanner.h"
#include "AudioBus.h"
#include "AudioUtilities.h"
#include "VectorMath.h"
#include <algorithm>
#include <wtf/MathExtras.h>
namespace WebCore {
EqualPowerPanner::EqualPowerPanner()
: Panner(PanningModelType::Equalpower)
{
}
void EqualPower... | ALGO | 0.960917 | 7.368928 |
bc1784a2-5dc6-4115-a087-7370aae61621 | ishandutta2007/codeforces | tmwilliamlin168/normal/1000/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mxN=3e5, mxQ=4e5;
int n, q, eu[mxN-1], ev[mxN-1], dep[mxN], fo[mxN], dt[20][2*mxN-1], dti, pew[mxN];
ll a[mxN], w[mxN-1], smp[mxN], smp2[mxN], pmp[mxN];
vector<int> adj[mxN];
void dfs1(int u, int p) {
dep[u]=p==-1?0:dep[p]+1;
fo[u]=dti;
... | ALGO | 0.999962 | 4.049319 |
35a48eae-071a-4353-93f3-cec92557415a | Reriiii/marisaoj-practice | level-3/DSU/318.cpp | #include <bits/stdc++.h>
#define NAME ""
#define i32 int
#define i64 int64_t
#define u32 unsigned int
#define u64 unsigned long long
#define ll long long
#define ld long double
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<vector<int>>
#define vec vector
#define fi first
#define se second
// #def... | ALGO | 0.999815 | 5.214225 |
bfb26370-295d-4114-b712-0e2e084c779c | shruti-sonone-24/usual-coding | stack/Nearest Greater to Right (Stack) .cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
vector<int>v;
stack<int>s;
for(int i=n-1;i>=0;i--)
{
if(s.size()==0)
{
v.push_back(-1);
}
else if(s.size... | ALGO | 0.999996 | 4.3186 |
6b5bad69-c499-4d15-ac5d-dd6c4ceb4463 | satyajit-patel/CrackYourInternship | Mathematical/Easy/628. Maximum Product of Three Numbers.cpp | class Solution {
public:
// n <= 1e4 => O(n^2)
int maximumProduct(vector<int>& nums) {
std::sort(nums.begin(), nums.end());
int n = nums.size();
// common sence
return std::max(nums[n-1]*nums[n-2]*nums[n-3], nums[n-1]*nums[0]*nums[1]);
}
}; | ALGO | 0.99977 | 5.570593 |
9f15301d-b77d-4e78-805c-f9a065cd8cf7 | foresterfx/COMP2710 | project2_jfw0006.cpp | /***********************************************************************************************
* AUTHOR: Joseph Forester Warren
* DATE: 02/07/20
* COURSE: COMP2710-001
* AU ID: JFW0006
* FILE NAME: project2_jfw0006.cpp
* COMPILE: g++ project2_jfw0006.cpp -o p2
* RUN: ./p2
*
* GOALS:
* To learn "while" and "do-while"... | ALGO | 0.865556 | 5.454516 |
5f7467d2-2adc-42aa-82bf-ba23a96cb44c | ayushkr012/6Companies30Days | Goldman Sachs/1765 Map of Highest Peak.cpp | /*
Question : You are given an integer matrix isWater of size m x n that represents a map of land and water cells.
If isWater[i][j] == 0, cell (i, j) is a land cell.
If isWater[i][j] == 1, cell (i, j) is a water cell.
You must assign each cell a height in a way that follows these rules:
The height of each cell must b... | ALGO | 0.999992 | 6.385387 |
73a5b3f6-11a7-4e1e-9dcd-42dc668ef1f0 | JESSE-max1/LinkedLists | RotateALList.cpp | class Solution {
public:
ListNode* rotateRight(ListNode* head, int k) {
if(!head) return NULL;
int len = findlen(head);
k = k%len;
if(k == 0)return head;
int p = len-k,i = 0;
ListNode* temp=head, *prev = NULL;
while(i<p){
i++;
prev = te... | ALGO | 0.999958 | 5.665609 |
9425eb6e-9b47-43cb-845b-ec372527023f | xiaowei942/doubango | branches/1.0/wince/wcecompat/src/args.cpp | #include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include "ts_string.h"
#include "args.h"
typedef enum {
TOK_ERROR = -1,
TOK_NULL = 0,
TOK_REDIR,
TOK_STRING
} ArgType;
// redirection symbols allowed:
// < 0< redirect file to stdin
// > 1> redirect stdout to file
// 2> redirect st... | TOOL | 0.941644 | 4.547482 |
d9f99025-ba96-4471-816b-34724f0c2c4c | dendisuhubdy/blaze | blazemark/src/eigen/TMat3Vec3Mult.cpp | //=================================================================================================
//=================================================================================================
//*************************************************************************************************
// Includes
//****... | ALGO | 0.998628 | 4.921988 |
55fb3a70-57c2-4d49-ba1b-d4a5aa80adfd | Makhuta/vsb-skola | OSY/Cviceni/01 - 23_09_2024/scitacka.cpp | #include <stdio.h>
#include <iostream>
#include <ostream>
#include <string.h>
#include <vector>
#include <math.h>
#include <string>
int main(int argc, char* argv[]) {
std::cout << "Hello, world!" << std::endl;
int number, output = 0;
//std::scanf("%d", &number);
while(std::scanf("%d\n", &number) != E... | ALGO | 0.99035 | 3.840699 |
564021fa-581b-4395-a024-4a5155f1ffeb | janicema0702/mars-lander-simulation | spring.cpp | // runtime - 2.778s without optimizer
// runtime - 1.093s with optimizer
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main() {
// declare variables
double m, k, x, v, t_max, dt, t, a;
vector<double> t_list, x_list, v_list;
// mass, spring constant, initial position and v... | ALGO | 0.999419 | 4.996754 |
22387503-012c-4f94-9750-77b08e8f8b72 | dabaosod011/Practise | Cpp/test_accumulate.cpp | #include <iostream>
#include <vector>
#include <numeric>
#include <string>
int abs_sum(int sum, int a)
{
return sum + (a >=0 ? a: -a);
}
int main()
{
std::vector<int> data;
data.push_back(1);
data.push_back(2);
data.push_back(3);
data.push_back(4);
data.push_back(5);
data.push_back(-6)... | ALGO | 0.998846 | 5.327424 |
bc067f81-9218-4e7d-8914-26851801149b | Lizh-ts/APCS-Class | 7.巴士站基本評測(APCS一迴圈窮舉與絕對值).cpp | #include<iostream>
#include<math.h>
//https://zerojudge.tw/ShowProblem?problemid=f312
using namespace std;
int main(){
int j,k,l=1000,n;
cin>>j;
int a[j],b[j];
for (int i=0;i<j;i++){
cin>>a[i]>>b[i];
}
for (int i=0;i<j-1;i++){
n=abs(a[i]-a[i+1])+abs(b[i]-b[i+1]);
if(k<=n){
k=n;
}
if(l>=n){
l=n;
... | ALGO | 0.999982 | 3.190249 |
7b64a777-34e0-49bc-8679-b174bdb2131e | google-code-export/prssr | share/fs.cpp | #include <afx.h>
#include "fs.h"
//
// Creates path for file 'fileNamePath'
//
BOOL CreatePath(const CString &fileNamePath) {
// remove file name
int slashPos = fileNamePath.ReverseFind('\\');
CString strPath = fileNamePath.Left(slashPos + 1);
// create path
int start = 0;
int pos = strPath.Find('\\', start);
... | TOOL | 0.893977 | 4.050708 |
97d93f9e-5774-44fc-9dac-961ecbc1a592 | ClaudioRMalvino/Comp_Physics_Newman_cpp | chapter_2/exercise_2_11a.cpp | /**
* @file binomial_coefficient.cpp
* @brief Exercise 2.11: Binomial Coefficients Part a)
*
* From: Computational Physics by Mark Newman
*/
#include <boost/multiprecision/cpp_int.hpp> // Dealing with large factorials
#include <iostream>
#include <ranges>
#include <string>
// Namespace declerations
namespace mp =... | ALGO | 0.998429 | 7.186917 |
303738f0-4456-4400-85c3-6c581be272b7 | sarvex/leetcode-d | solution/0000-0099/0082.Remove Duplicates from Sorted List II/Solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* deleteDupli... | ALGO | 0.999988 | 5.902059 |
00ec9cf5-a484-46bf-b9da-a2426d398536 | zohaib166/DataStructure | Tree/TreeTraversal.cpp | #include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
using namespace std;
typedef struct _node {
struct _node *left;
int data;
struct _node *right;
} Node;
Node *root = NULL;
queue <Node*> tq;
void create() {
int num;
Node *p, *temp;
printf("Enter the data for root: ");... | ALGO | 0.999808 | 4.23944 |
1527f958-2d50-4b04-a060-55386d0d5547 | abhi1607IIT/Basic-Codes | chararray.cpp | #include <iostream>
using namespace std;
int length(char in[]) {
int i = 0;
while (in[i] != '\0') {
i++;
}
return i;
}
bool isPal(char in[]) {
int l = length(in);
int s = 0;
int e = l - 1;
while (s < e) {
if (in[s] != in[e]) {
return false;
}
s++;
e--;
}
return true;
}
void substring(char in[]... | ALGO | 0.998842 | 3.465906 |
bbeec7be-71ef-4955-a246-0adce6099036 | osirisQdt2810/algorithms | src/leetcode/cheatsheet/solution/0700-0799/0743.Network Delay Time/Solution2.cpp | class Solution {
public:
const int inf = 0x3f3f;
int networkDelayTime(vector<vector<int>>& times, int n, int k) {
vector<vector<vector<int>>> g(n);
for (auto& t : times) g[t[0] - 1].push_back({t[1] - 1, t[2]});
vector<int> dist(n, inf);
dist[k - 1] = 0;
priority_queue<ve... | ALGO | 0.999931 | 6.000522 |
80f973c1-8aa6-4cdf-b171-8596161e2c04 | Farhan-Afsar/Data-Structure-Algorithm | calculator.cpp | #include<bits/stdc++.h>
using namespace std;
int pres(char ch){
if(ch == '+' || ch == '-')
return 0;
else if(ch == '*' || ch == '/')
return 1;
return -1;
}
int main(){
string str,ans;
cin >> str;
stack<char> st;
for(int i = 0; i < str.size(); i++){
char c... | ALGO | 0.999982 | 3.840462 |
8c439dd8-2b82-457c-8e26-1c02b05a2d11 | ss-coder30/Leetcode-Questions | 0442-find-all-duplicates-in-an-array/0442-find-all-duplicates-in-an-array.cpp | class Solution {
public:
vector<int> findDuplicates(vector<int>& nums) {
vector<int> ans;
int n = nums.size();
sort(nums.begin(), nums.end());
for(int i = 0; i<n-1; i++){
if(nums[i] == nums[i+1]){
ans.push_back(nums[i]);
... | ALGO | 0.999992 | 5.753249 |
b77fb219-ecee-435f-b923-1880bed97876 | readul-islam/DSA_C_Plus_Plus | Lecture_08/binary_search/find_smallest_letter.cpp | /*
You are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characters in letters.
Return the smallest character in letters that is lexicographically greater than target. If such a character does not exist, return the first character ... | ALGO | 0.999971 | 5.315933 |
ec19811b-986e-4ccd-8012-30959d4127a0 | Jack-Punter/4coder_custom_tree_sitter | 4coder_code_index_listers.cpp | /*
4coder_code_index_listers.cpp - Listers for exploring the contents of the code index.
*/
// TOP
struct Tiny_Jump{
Buffer_ID buffer;
i64 pos;
};
CUSTOM_UI_COMMAND_SIG(jump_to_definition)
CUSTOM_DOC("List all definitions in the code index and jump to one chosen by the user.")
{
char *query = "Definition... | TOOL | 0.89639 | 4.212975 |
c508c0cf-7bdc-4f18-ba1e-b0b93a8451a9 | vgbhj/practice-archive- | leetcode/2976. Minimum Cost to Convert String I/main.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
long long minimumCost(string source, string target, vector<char>& original, vector<char>& changed, vector<int>& cost) {
long long sm = 0;
int n = cost.size();
vector<pair<pair<char, char>, int>> v(n);
for(int i ... | ALGO | 0.999931 | 5.468594 |
ff997c39-d539-4fe3-b8ef-1a24df9d7bbf | adilahmad17/Obfuscuro | llvm/llvm-4.0.0.src/tools/clang/test/SemaTemplate/ackermann.cpp | // RUN: %clang_cc1 -fsyntax-only -verify %s
// expected-no-diagnostics
// template<unsigned M, unsigned N>
// struct Ackermann {
// enum {
// value = M ? (N ? Ackermann<M-1, Ackermann<M, N-1> >::value
// : Ackermann<M-1, 1>::value)
// : N + 1
// };
// };
template<unsigned M, u... | ALGO | 0.887788 | 5.80083 |
ae7aadf2-5a50-4a0e-9e8f-ea4090342057 | aidevpin/core | src/cryptonote/wild_keccak.cpp | // keccak.c
// 19-Nov-11 Markku-Juhani O. Saarinen <<EMAIL>>
// A baseline Keccak (3rd round) implementation.
#include <cryptonote/wild_keccak.h>
namespace crypto
{
const uint64_t keccakf_rndc[24] =
{
0x0000000000000001, 0x0000000000008082, 0x800000000000808a,
0x8000000080008000, 0x000000000000808b, 0x0... | ALGO | 0.999701 | 6.822344 |
ca890cd1-521b-4f86-bc7c-ae37842f1e15 | abufarhad/Programming | Eid marathon (DP + GEOMETRY)/knapsack prblm.cpp |
//! Bismillahi-Rahamanirahim.
/** ========================================**
** @Author: Md. Abu Farhad ( RUET, CSE'15)
** @Category:
/** ========================================**/
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long
#define scl(n) scan... | ALGO | 0.999983 | 3.636427 |
7cbc675d-4da9-4df4-85a6-79e86e795bab | maurycortes/InterviewBit | InterviewBit/Trees/MinDepthOfBinaryTree.cpp | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
int depth(TreeNode *A){
if(!A)
return INT_MAX;
if(!A->left && !A->right)
return 1;
return 1+min(depth(A-... | ALGO | 0.999764 | 6.2877 |
3186b020-3f14-4ea6-a1f7-fd2f3afc0d55 | Ishwar-Sanap/DSA-Practice | Linked List/cnt_Noes_in_Loop.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *next;
Node(int x)
{
data = x;
next = NULL;
}
};
int countNodesinLoop(Node *head)
{
// Code here
Node *slow = head;
Node *fast = head;
int cnt = 0;
while (fast && fast->next)
{
... | ALGO | 0.999928 | 3.96539 |
43d4736a-0b0c-4017-bdef-95f82ef9508c | aashish-cloud/CodeCat-x-LeetCode | intersection-of-two-arrays/intersection-of-two-arrays.cpp | class Solution {
public:
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
vector<int> ans;
set<int> st1(nums1.begin(), nums1.end());
set<int> st2(nums2.begin(), nums2.end());
for(int n : st2) {
if(st1.count(n))
ans.push_back(n);
... | ALGO | 0.999792 | 5.685059 |
f29c1f60-f9c7-4c6a-b107-4c4cf5759a7a | L1quid/Explosivo | agg/src/agg_bezier_arc.cpp | #include <math.h>
#include "agg_bezier_arc.h"
namespace agg
{
// This epsilon is used to prevent us from adding degenerate curves
// (converging to a single point).
// The value isn't very critical. Function arc_to_bezier() has a limit
// of the sweep_angle. If fabs(sweep_angle) exceeds pi/2 the cur... | ALGO | 0.990638 | 7.376216 |
cc0053a3-0082-4b28-b9b8-937379a4c046 | Jumaruba/FEUP-MIEIC-TPS | FEUP-AEDA-TPS/Exercises/aeda1920_fp09/Tests/aposta.cpp | #include "aposta.h"
#include <iostream>
#include <sstream>
using namespace std;
// a alterar
bool Aposta::contem(unsigned num) const
{
return (numeros.find(num) != numeros.end());
}
//a alterar
void Aposta::geraAposta(const vector<unsigned> & valores, unsigned n)
{
int total = 0;
auto it = valores.begin... | ALGO | 0.932608 | 4.654262 |
85b37709-bb4c-4bcc-af18-36f0e42f9340 | Jherlil/winkeyultra | secp256k1/Point.cpp | #include "Point.h"
#include "secp256k1/SECP256K1.h"
#include <vector>
static Int P; // Módulo da curva
static Secp256k1 *secp256; // Instância global para acessar GTable
// Inicializa o campo SecpK1
void InitSecpK1() {
P.SetBase16("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F");
Int::Setup... | ALGO | 0.989517 | 5.018937 |
835523be-4190-4fa6-83ae-63621d70f7af | DPradyun/Cisco_Kshitij_2025 | Solution-PS4.cpp | // Solution for problem statement 4
#include <iostream>
#include <vector>
using namespace std;
// Function to generate Pascal's Triangle
vector<vector<int>> generatePascalsTriangle(int numRows) {
vector<vector<int>> triangle;
for (int row = 0; row < numRows; row++) {
vector<int> currentRow(row + 1, ... | ALGO | 0.99953 | 7.222475 |
5f25c673-d875-4116-8c4a-09843a494767 | monish001/CPP-Programs | InterviewBit/trees/preorder/main.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
//vector<int> Solution::inorderTraversal(TreeNode* root) {
vector<int> inorderTraversal(Tre... | ALGO | 0.999991 | 5.484532 |
272433fc-9dce-493f-b11d-5f3392cced5a | diverse-project/samplingfm | tools/z3/src/qe/qe_mbp.cpp | #include "qe/qe_mbp.h"
#include "qe/qe_arith.h"
#include "qe/qe_arrays.h"
#include "qe/qe_datatypes.h"
#include "ast/rewriter/expr_safe_replace.h"
#include "ast/ast_pp.h"
#include "ast/ast_util.h"
#include "ast/rewriter/th_rewriter.h"
#include "model/model_v2_pp.h"
#include "ast/expr_functors.h"
#include "ast/for_each_... | ALGO | 0.999263 | 5.159612 |
932ffc42-f543-48ee-b0e2-d220627bd197 | wyfish/deeplearning4j_study | libnd4j/include/ops/declarable/generic/broadcastable/reverse_subtract.cpp | //
// @author <EMAIL>
//
#include <op_boilerplate.h>
#if NOT_EXCLUDED(OP_reversesubtract)
#include <ops/declarable/generic/helpers/BroadcastHelper.h>
#include <ops/declarable/CustomOperations.h>
namespace nd4j {
namespace ops {
BROADCASTABLE_OP_IMPL(reversesubtract, 0, 0) {
auto x = INPUT_VA... | ALGO | 0.90608 | 6.344339 |
389ddf7b-e735-47f3-a76b-affe3eef90f2 | kaepr/competitive-programming-solutions | dynamic_programming/count_palindromic_substrings.cpp | // https://leetcode.com/problems/palindromic-substrings/
// https://www.youtube.com/watch?v=XmSOWnL6T_I
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
class Solution {
public:
int countSubstrings(string s) {
int n = s.length();
vector<vector<int>> dp(n, vector<int>(n, 0));
// rows contain... | ALGO | 0.999976 | 6.304079 |
805d24d6-d043-4569-97be-5b2b08ca6f0a | sailfishos-mirror/llvm-project | llvm/lib/Transforms/IPO/MergeFunctions.cpp | #include "llvm/Transforms/IPO/MergeFunctions.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DerivedTypes.h"
#include "... | TOOL | 0.989462 | 7.10739 |
60b80412-24d8-4330-9e15-d64cd5794d3e | Deepanshi-17/Data-Structures-and-Algorithms | kahnsAlgo.cpp | /*TC -> O(V + E) + O(V) + O(V + E)
SC -> O(V) + O(V) + O(V)
*/
class Solution
{
public:
//Function to return list containing vertices in Topological order.
vector<int> topoSort(int V, vector<int> adj[])
{
queue<int>q;
vector<int>indegree(V,0);
for(int i = 0; i < V; i++)
{
for(int... | ALGO | 0.999992 | 6.088823 |
04a616ed-3a3f-447a-8d2b-0aa5b3840f47 | rizwanrockzz/rizwan | C++ by Rizwan/bitmanupulation/unique1.cpp | #include <bits/stdc++.h>
using namespace std;
// FINDING A UNIQUE NUMBER IN AN ARRAY USING BITWISE OPERATOR
//
int unique(int arr[], int n)
{
int xorsum = 0;
for (int i = 0; i < n; i++)
{
xorsum = xorsum ^ arr[i];
}
return xorsum;
}
int main()
{
// int arr[] = {1, 2, 3, 4, 1, 2, 3};
... | ALGO | 0.998656 | 5.143075 |
91e05a46-4443-4ce1-bcbc-b03b2d427588 | ADDY69O/LeetCode | 1550-three-consecutive-odds/1550-three-consecutive-odds.cpp | class Solution {
public:
bool threeConsecutiveOdds(vector<int>& arr) {
int count =0;
int maxi = 0;
for(int i=0;i<arr.size();i++){
if(arr[i]%2!=0){
count++;
maxi = max(count , maxi);
if(maxi >=3){
return ... | ALGO | 0.999777 | 5.504286 |
59bce42a-8f96-4108-9113-72d2abefe6b7 | Rishi19Pandey/Recursion_-_Dynamic_Programming | Reccursion/knapsack.cpp | // knapsack.cpp
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int knapSack(int i , vector<int> &p , vector<int> &w, int wt){
if(i == p.size()){
return 0 ;
}
else if(w[i]>wt){
knapSack(i+1,p,w,wt);
}
else
return max(p[i]+knapSack(i,p,w,wt-w[i]) ,... | ALGO | 0.999944 | 5.081072 |
ba735a1e-b050-4a3f-a621-5cdc2e382fce | KattoRan/applied_algorithms | TINHOC/oE/b/noinhanh.cpp | #include<bits/stdc++.h>
#define fu(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
const int N=1e6+7;
int n,a[N];
long long s;
template<typename T> inline void read(T& x)
{
x=0;
char c=getchar();
int tam=1;
while(!isdigit(c)&&c=='-')
c=getchar();
if(... | ALGO | 0.999556 | 3.032093 |
2df3259b-802f-4c11-aaca-6e0415eaac46 | Ankit-CSE-01/git_github | cpp/c++ pw/quadrantques.cpp | // #include<iostream>
// using namespace std;
// int main(){
// int x, y;
// cout<<"Enter x and y :";
// cin>>x>>y;
// if(x>0 && y>0)
// {
// cout<<"1st Quadrant";
// }
// else if(x<0 && y>0)
// {
// cout<<"2nd Quadrant";
// }
// else if(x<0 && y<0)
// {
// ... | ALGO | 0.997531 | 3.349398 |
b14bcc5d-89c8-443a-867f-f6f4c8a9eba6 | ishandutta2007/codeforces | ashishgup/normal/702/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
const int N = 1e5 + 5;
const int LG = 40;
int n, k;
int a[N];
int par[LG][N], mn[LG][N], sum[LG][N];
void precompute()
{
for(int i = 1; i < LG; i++)
{
for(int j = ... | ALGO | 0.999978 | 3.562284 |
a642c7fb-7948-4cf8-88c5-26b2a55ba640 | mahadi-zulfiker/DS-Exam | Pairs.cpp | #include<bits/stdc++.h>
using namespace std;
bool customComparator(const pair<string, int>& a, const pair<string, int>& b) {
if (a.first == b.first) {
return a.second > b.second;
}
return a.first < b.first;
}
int main(){
int N;
cin >> N;
vector<pair<string, int>> pairs(N);
for (in... | ALGO | 0.999743 | 4.732336 |
c6abe47f-bb2b-41e1-b59a-a9a9c47385b5 | kim1992/CarND_Highway_Driving | src/Eigen-3.3/bench/vdw_new.cpp | #include <iostream>
#include <Eigen/Core>
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &inter... | ALGO | 0.999488 | 3.519938 |
c372db9c-32cf-4cde-b2e9-0f5c12040582 | dcseal/finess | lib/1d/LaxWendroff/DFluxFunc.cpp | #include "tensors.h"
// This is a user-supplied routine that sets the
// Jacobian of the Flux Function
//
// The expected format is Dflux.get(:, i, j) = \partial f_i, \partial q_j.
//
// Simple advection equation, f'(q) = u
// Burger's equation, f'(q) = q
// Acoustics equation, f'(q) = [0 1; 1 0]
//
// In... | ALGO | 0.909416 | 5.639319 |
cec99c5f-3298-4365-a028-9887184fd5f1 | xavierolivenza/Nes_Pinball | Nes_Pinball/Box2D/Box2D/Collision/b2BroadPhase.cpp | #include <Box2D/Collision/b2BroadPhase.h>
b2BroadPhase::b2BroadPhase()
{
m_proxyCount = 0;
m_pairCapacity = 16;
m_pairCount = 0;
m_pairBuffer = (b2Pair*)b2Alloc(m_pairCapacity * sizeof(b2Pair));
m_moveCapacity = 16;
m_moveCount = 0;
m_moveBuffer = (int32*)b2Alloc(m_moveCapacity * sizeof(int32));
}
b2BroadPha... | TOOL | 0.86794 | 6.892823 |
641e6d9d-b4ee-492e-b7ce-9ffbfb7ebd19 | wewark/Codeforces-Gyms-Solutions | Solutions/101061 - Higher Institute for Applied Sciences and Technology Collegiate Programming Contest 2016/F.cpp | // 101061 - Higher Institute for Applied Sciences and Technology Collegiate Programming Contest 2016
// 101061F
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector... | ALGO | 0.999943 | 4.51946 |
bb99ef26-6400-407d-a514-e633d109b9e6 | Aleksander-Gushchin/Bernal-Fowler_Counter | src/permutationlib/permutation.cpp | #include "permutation.h"
#include <list>
#include <algorithm>
#include <iostream>
#define __TEST
Permutation::Permutation()
{
}
Permutation::Permutation(const std::vector<int16_t> & _perm) : perm(_perm) {}
Permutation Permutation::operator*(const Permutation& p)
{
if (perm.size() != p.perm.size())
throw 1;
... | ALGO | 0.984568 | 5.427919 |
783f77a1-5de4-493a-a23a-3cf86db71435 | 2khs21/boj | 프로그래머스/4/1843. 사칙연산/사칙연산.cpp | #include <vector>
#include <string>
using namespace std;
int maxDP[102][102];
int minDP[102][102];
int N;
char ops[102];
#include <iostream>
void DP(){
for (int len = 1; len < N; len++){
for (int i = 0; i <= N - len; i++){
int j = i + len;
for (int... | ALGO | 0.999988 | 4.864211 |
33d0f1b7-4b7a-4ce5-afb5-fe0e0a15b2e1 | Mulusu/Advent_of_Code-Solutions | 2018/days/day2.cpp | #include <vector>
#include <string>
#include <algorithm>
std::string part1(std::vector<std::string>);
std::string part2(std::vector<std::string>);
std::vector<std::string> day2(std::vector<std::string> input){
std::vector<std::string> answer;
answer.push_back(part1(input));
answer.push_back(part2(input));
return ... | ALGO | 0.99992 | 5.838923 |
08639b55-d7db-42ab-881a-3611fd06844b | Dduarte5555/Supercomp-Projeto | MPI/AbordagemMPI.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include <random>
#include<fstream>
#include <chrono>
#include <mpi.h>
using namespace std;
using namespace std::chrono;
vector<vector<int>> LerGrafo(const string& nomeArquivo, int& numVertices) {
ifstream arquivo(nomeArquivo);
int numArestas;
arquiv... | ALGO | 0.999542 | 5.851257 |
d9bf838a-d0a2-494d-92be-9e15dd2b489b | Zu-rin/AtCoder | AtCoder_Beginner_Contest/ABC205/ABC205D.cpp | #include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30
using namespace std;
... | ALGO | 0.999845 | 3.576517 |
04989925-debc-4024-89e8-5e6537da09d5 | Sudhir769/LeetCode-GFG-Daily | 18 Feb 2024/lc-/Solution.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<ll,ll>
class Solution {
public:
int mostBooked(int n, vector<vector<int>>& A) {
vector<int> roomcnt(n,0);
set<int> s;
priority_queue<pi,vector<pi>,greater<pi>> q;
sort(A.begin(),A.end());
int... | ALGO | 0.999972 | 5.430863 |
553e6def-f14c-4d27-823c-1d102d127f29 | priyamore18/PrepInsta_DSA | DSA/Year is a Leap Year or Not6.cpp | #include<iostream>
using namespace std;
int main(){
int year;
cout<<"enter the year";
cin>>year;
if(year%4000==0){
cout<<"it is leap year";
}
else if((year%4==0)&&(year%1000!=0)){
cout<<"it is leap year";
}
else{
cout<<"it is not leap year";
}
}
| ALGO | 0.999596 | 3.130776 |
fd50b83d-f3ca-44bd-a09c-838e79b93c82 | Etrav05/Machine-Learning-Nearest-Neighbour | Group_6_Lab_8_9_Evan_Cole_Liv/Position.cpp | #include "menu.h"
#include "Position.h"
#include "NN_Classifier.h"
double Position::calculateDistance(vector<double>& trn, vector<double>& tst) { // calculate between given point and another point (trn = training, tst = testing)
double distance = sqrt(pow(trn[0] - tst[0], 2) + pow(trn[1] - tst[1], 2) + pow(trn[2] - ... | ALGO | 0.980971 | 3.004861 |
7a374cbd-3623-4784-abdb-3ec978b4e83d | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3676_25.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, t;
cin >> n >> t;
int dp[30][5][11][2];
for (int i = 1; i <= 4; ++i) {
dp[1][i][1][1] = 1;
}
for (int i = 2; i <= n; ++i) {
for (int j = 1; j <= t; ++j) {
for (int now = 1; now <= 4; ... | ALGO | 0.999963 | 3.838783 |
9fe1fe6d-f205-4975-a839-7c71d35c47ca | Taeyeon-0/Algorithms-Data-Structures | LeetCode(副本)/链表/09.环形链表.cpp | /*
给你一个链表的头节点head ,判断链表中是否有环。
如果链表中有某个节点,可以通过连续跟踪next指针再次到达,则链表中存在环。 为了表示给定链表中的环,评测系统内部使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。注意:pos 不作为参数进行传递 。仅仅是为了标识链表的实际情况。
如果链表中存在环 ,则返回true 。 否则,返回false 。
*/
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
// 思路:快慢指针,慢指针走1步,快指针走两步... | ALGO | 0.999864 | 5.437959 |
4ad22695-a022-468c-8b9a-56fe13477694 | alpeshjamgade/algorithms | dp/A.01knapsack/a.01knapsack.cpp | /*
Given a set of items, each with a "weight" and a "value",
determine the number of each item to include in a collection/knapsack
so that -> "the total weight is less than or equal to a given limit"
and "the total value is as large as possible".
*/
#include <bits/stdc++.h>
#define ll long long
#define ld long dou... | ALGO | 0.999999 | 4.94402 |
21f5650b-d0c4-458e-9860-7a17c83602ce | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_2821_7.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 50 + 3;
int n, m, x[2 + (1)][MAXN], y[2 + (1)][MAXN], a[MAXN];
vector<int> v[2 + (1)][4 + (1)];
bitset<MAXN> mark[2][MAXN];
void go(int q) {
iota(a, a + m, 0);
sort(a, a + m, [q](int w, int e) { return x[q][w] < x[q][e]; });
for (int t = 0; t < m; t++... | ALGO | 0.999979 | 3.569645 |
e1654591-4cab-459f-8629-b56b74ab9542 | xuyuandong/parallel_sentence_mining | src/mt_string_operation.cpp | /*
* mt_string_operation.cpp
*
* Created on: 2010-4-13
* Author: yuandong.xu
*/
#include "mt_string_operation.h"
#include <vector>
#include <string>
#include <set>
using namespace std;
namespace mt_parallel{
namespace StringOperation{
/** Split the given string by delimit */
vector<string> split(const s... | TOOL | 0.883786 | 4.655651 |
b0a2a4c8-0789-4809-8b7d-371bcd425b2f | subhasish/Algo | 09.BinaryTree/17.BinaryTreeLocking.cpp | /*
* 17.BinaryTreeLocking.cpp
*
* Problem: Design APIs to lock or unlock nodes in binary tree.
* A node cannot be locked if any of its descendant or ancestor is locked.
* Example: All leafs can be locked simultaneously.
*
* Assume each node can store its parent.
*
* Created on: Jan 15, 2018
* ... | ALGO | 0.999897 | 5.687465 |
22d2a6bc-4551-4bf8-990b-530f582de7f5 | dawangran/dorado-0.9.6 | dorado/torch_utils/trim.cpp | #include "trim.h"
#include <htslib/sam.h>
#include <spdlog/spdlog.h>
#include <algorithm>
#include <sstream>
namespace dorado::utils {
int trim(const at::Tensor& signal, float threshold, int window_size, int min_elements) {
const int min_trim = 10;
const int num_samples = static_cast<int>(signal.size(0)) - ... | ALGO | 0.99615 | 7.288549 |
79eda222-8ec5-46f7-90ce-4a255f97fcee | csl-iisc/SUV-MICRO24 | llvm/libcxx/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp | // UNSUPPORTED: c++03
// <algorithm>
// template<class T>
// pair<T, T>
// minmax(initializer_list<T> t);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
int main(int, char**)
{
assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)));
assert((std::minmax({1, 3, 2}) == std::pair<i... | TEST | 0.965296 | 5.835735 |
0692fcdc-fe5f-4d88-8586-5579f85fc03d | varunpatel0704/c-- | miscelleneous/ADA_pr5.cpp | #include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
int knapsack(int W, vector<int>& wt, vector<int>& val, int n, vector<vector<int>> &K) {
for (int i = 0; i <= n; ++i) {
for (int w = 0; w <= W; ++w) {
if (i == 0 || w == 0) {
K[i][w] = 0;
} ... | ALGO | 0.999997 | 5.391977 |
5c3f8090-7a1b-427c-bf62-2ad95b142ba4 | ishandutta2007/codeforces | crtsir/normal/977/F.cpp | #include"bits/stdc++.h"
using namespace std;
int n,a[200005],par[200005],d[200005];
map<int,int>mp;
int main()
{
cin>>n;
memset(par,-1,sizeof(par));
for(int i=0;i<n;i++)
{
cin>>a[i];
if(mp.count(a[i]-1))
{
d[i]=d[mp[a[i]-1]]+1;
par[i]=mp[a[i]-1];
}
else
d[i]=1;
mp[a[i]]=i;
}
int best=0;
vect... | ALGO | 0.999985 | 3.641965 |
6b82b2d0-d317-425c-bf86-be7f84296ac0 | vincentlaguna/learn-c-cpp | c++/vectors_cpp/vector_review.cpp | #include <iostream>
#include <vector>
int main() {
int sum = 0;
int product = 1;
std::vector<int> numbers = {2, 4, 3, 6, 1, 9};
for (int i = 0; i < numbers.size(); i++) {
if (numbers[i] % 2 == 0) {
sum = sum + numbers[i];
}
else {
product = product * numbers[i];
}
}
std::cou... | ALGO | 0.999637 | 5.403634 |
434a5740-3552-428b-8d4b-1f849bbced72 | HarryHosono/ABC | ABC346/a/sol.cpp | /**
* auther: deviceF
* created: 23.03.2024 19:36:54
**/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> b(n - 1);
for (int i = 1; i < n; i+... | ALGO | 0.999899 | 3.823963 |
092f81d0-dc7f-4e6a-83f6-dcc72adad18d | mbfibat/cses-solution | Solutions/CSES 1138/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int n, q;
int a[200001];
vector<int> adj[200001];
int top = 0;
int f[200001];
int st[200001], ed[200001];
void dfs(int u, int p, int cur)
{
st[u] = ++top;
f[u] = cur;
for (int v : adj[u])
if (v != p)
dfs(v, u, cur + a[v]);
ed[u] = top;
}
... | ALGO | 0.999594 | 4.281093 |
402caa3f-be90-43d9-9a48-b23ac7c4b710 | eriser/boost | libs/graph/test/betweenness_centrality_test.cpp | // Authors: Douglas Gregor
// Andrew Lumsdaine
#include <boost/graph/betweenness_centrality.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <vector>
#include <stack>
#include <queue>
#include <boost/property_map/property_map.hpp>
#include <boost/test/minimal.hpp>
#include <boost/random/uniform_01.hp... | TEST | 0.940224 | 7.690928 |
d4b9d47e-2548-45ae-9fa9-23d049307e14 | MIJ-codes/MIAD2108053_CSE282 | Codes/Experiment_03/Example_02.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
struct node
{
int data;
node *next;
node *bak;
node (int x)
{
data = x;
next = nullptr;
bak = nullptr;
}
node (int x, node *f, node *b)
{
data = x;
next = f;
bak = b;
}... | ALGO | 0.999495 | 4.03641 |
d387a012-93a6-4581-9e6e-56859aaf8009 | amannnn17/Leetcode | 0238-product-of-array-except-self/0238-product-of-array-except-self.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int n= nums.size();
vector<int>prefix(n);
vector<int>suffix(n);
prefix[0]=nums[0];
for(int i=1;i<n;i++){
prefix[i]=prefix[i-1]*nums[i];
}
suffix[n-1]=nums[n-1];
for... | ALGO | 0.999968 | 6.256842 |
cea14b25-b851-4fb3-a6da-97cb90d1d70b | 52ai/StickToGithub | InterviewBook/8.3(4).cpp | #include <iostream>
#include <stdio.h>
void histogram(char *src){
int i;
int hist[256];
for(i=0;i<256;i++){
hist[i]=0;
}
while(*src != '\0'){
hist[*src] ++;//*src字符隐式转为ascii值作为数组的坐标,++表示ascii从48开始累加
src++;
}
for(i=0;i<256;i++){
if(hist[i]) printf("ascii值:%d,字符:%c,出现次数:%d\n",i,i,hist[i]);
//整型数组坐标i通... | ALGO | 0.858607 | 3.151733 |
db64ec9d-0854-426b-9dd9-8e5dd3b3cba1 | rhit-schielaj/CompetitiveProgramming | rectangletiling.cpp | #include <bits/stdc++.h>
using namespace std;
// Basic rectangle class
struct rect
{
long long W, H;
rect(long long width, long long height)
{
W = width;
H = height;
}
};
// Basic rectangle comparator for max-heap based off the smallest rectangle side
struct rectComp
{
bool operat... | ALGO | 0.999941 | 4.016346 |
ed7f03d1-a6ea-49f0-89ac-2af1e0c56c6b | swarnalii/LeetCode | duplicate-zeros/duplicate-zeros.cpp | class Solution {
public:
void duplicateZeros(vector<int>& arr) {
int len = arr.size();
int cnt = 0;
for(int i = 0; i < len; i++){
if(arr[i] == 0)
cnt++;
}
int inc_len = len + cnt - 1;
for(int i = len - 1, j = inc_len; i>=0 and j>... | ALGO | 0.999956 | 6.021521 |
32b7dfdf-42e9-4fac-9e95-5ccad1c821f3 | Fredo-Ronan/Simple_Person_Detection | person_detect.cpp | #include <opencv4/opencv2/opencv.hpp>
#include <opencv4/opencv2/dnn.hpp>
#include <opencv4/opencv2/highgui/highgui.hpp>
#include <opencv4/opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <vector>
using namespace cv;
using namespace dnn;
using namespace std;
const String prototxt_path = "/path/to/your_project... | DATA | 0.887307 | 6.286127 |
2fa31a4e-0db6-4c2c-ab87-90c3aebe0302 | TheDangerD0802/30-Days-Coding-Challenge---WCC | 2-Pointer/Max Consecutive Ones.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int n = nums.size();
if(n==0)
return 0;
int ans=0,count = 0;
for(int i=0;i<n;i++)
{
if(nums[i]==1)
{
ans++;
count = max(ans,count);
... | ALGO | 0.999972 | 6.044924 |
6699b912-23c1-4ff4-9193-e44ccc4ba30b | DanileRond/p3 | src/get_pitch/pitch_analyzer.cpp | /// @file
#include <iostream>
#include <math.h>
#include "pitch_analyzer.h"
using namespace std;
/// Name space of UPC
namespace upc {
void PitchAnalyzer::autocorrelation(const vector<float> &x, vector<float> &r) const {
for (unsigned int l = 0; l < r.size(); ++l) {
/// \HECHO Compute the autocorrelation ... | ALGO | 0.986263 | 4.946026 |
56e0dfed-dbfc-422d-9f28-815f7594e399 | TeslaRom-N/system_core | adb/usb_linux.cpp | #define TRACE_TAG USB
#include "sysdeps.h"
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/usb/ch9.h>
#include <linux/usbdevice_fs.h>
#include <linux/version.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include... | TOOL | 0.978037 | 6.615421 |
d20dab5e-2201-4ad1-96ce-c98906ad598a | Ahmad-AlDeeb/Problem-Solving | University Training/Menofia/Sheets/#2 Sheet/O - Directional Move.cpp | // problem link: https://codeforces.com/gym/102942/problem/A?f0a28=1
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define dd double
#define ld long double
#define PQ priority... | ALGO | 0.99999 | 4.159571 |
bb28f462-700a-4175-b7f5-661257c41758 | byte19/Leetcode | Distinct palindromic substrings - GFG/distinct-palindromic-substrings.cpp | //{ Driver Code Starts
// C++ program to find all distinct palindrome sub-strings
// of a given string
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution{
public:
int palindromeSubStrs(string S) {
set<string> set;
int N=S.size();... | ALGO | 0.999853 | 6.413004 |
e8fbf3d3-e4f5-44d7-bb43-7f8edca0ad8b | zzun-d/Algorithm | 프로그래머스/lv2/12913. 땅따먹기/땅따먹기.cpp | #include <iostream>
#include <vector>
#include <iostream>
using namespace std;
int mymax(int n, vector<int> lst) {
int answer = 0;
for (int i=0; i<4; i++) {
if (i == n) continue;
if (lst[i] > answer) answer = lst[i];
}
return answer;
}
int solution(vector<vector<int> > land)
{
int... | ALGO | 0.999033 | 4.750356 |
b92ccc7e-831f-4d98-a15f-18d1bc2b5cca | Dzy0726/Data-Structure-Course-Design | 2.两个有序链表序列的交集/2_两个有序链表序列的交集.cpp | #include <iostream>
#include <cstring>
#include <stdlib.h>
using namespace std;
struct linklist
{
int num;
struct linklist * next;
};
typedef linklist* link;
link create()
{
//带表头的节点 通过sub增加元素 所以sub一开始就要指向头结点 头结点不存任何东西 head赋值给q q指针指向head的位置
link head = (link)malloc(sizeof(struct linklist));//创建头结点... | ALGO | 0.999936 | 3.334128 |
b89b85dd-3bb9-4238-ac23-73251fc64de1 | Keycatowo/NTHU-OJ | 1994 - I2P(II)2020_Lee_Mid2_Practice/11438 list/main.cpp | #include<algorithm>
#include<cstddef>
#include<cstdlib>
#include<iostream>
#include<new>
#include<stdexcept>
#include<string>
#include<utility>
#include"function.h"
#ifdef ONLINE_JUDGE
#include"NTHUOJLock"
#endif
namespace
{
extern std::size_t current_memory_size;
extern std::size_t peak_current_memory_size;
extern... | TOOL | 0.952273 | 4.430207 |
7c7dca2c-c94b-4bc1-8aa1-f2ac4bbdbe16 | ishandutta2007/codeforces | shzhang/normal/875/A.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int n; vector<int> ans;
scanf("%d", &n);
for (int i = max(n - 150, 1); i <= n; i++) {
char s[15];
sprintf(s, "%d", i);
int dsum = 0;
for (int x = 0; s[x]; x++) {
dsum += s... | ALGO | 0.999453 | 3.409616 |
cf31a5fa-3677-43c2-8a8b-8895b71d377b | AlonsoPaulino/competitive-programming | Codeforces/k-Tree.cpp | #include <bits/stdc++.h>
#define pi acos(-1)
#define sz(x) (int) x.size()
#define pii pair<int, int>
#define mii map<int, int>
#define vi vector<int>
#define mp make_pair
#define pb push_back
#define popb pop_back
#define mset(v, x) memset(v, x, sizeof(v))
#define mset2d(v, x, n) memset(v, x, sizeof(v[0][0]) * n * n)
#... | ALGO | 0.999826 | 4.169707 |
c0bbb847-1f71-40fa-8926-2aca87e8c5b8 | wentingzz/Practices | LeetCode/921. Minimum Add to Make Parentheses Valid.cpp | class Solution {
public:
int minAddToMakeValid(string s) {
int count = 0, res = 0;
for(char& c: s){
if(c == '(') count++;
else{
if(count == 0) res++;
else count--;
}
}
return res + count;
}
};
| ALGO | 0.999636 | 6.065965 |
9fbd55ee-68b0-43ee-9cdd-e5d46b6c2f07 | jinjoh/NOOR | blender/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp | #include "btSphereTriangleCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "SphereTriangleDetector.h"
btSphereTriangleCollisionAlgorithm::btSphe... | ALGO | 0.99897 | 6.869744 |
f2a9dbff-722d-4af8-a940-876e71498dd0 | zhangsz1998/Library-Management | book_mgmt.cpp | #include <book_mgmt.h>
#include <vector>
#include <QString>
#include <QRegularExpression>
#include <algorithm>
#include <QTextCodec>
#include <QCryptographicHash>
#include <QByteArray>
QDomDocument doc;
std::vector<Book> booklist,*pbooklist;
QDomNode firstNode;
QDomNodeList list;
extern QDate systemDate;
//数据文件目录与路径,... | TOOL | 0.961728 | 3.421268 |
e7fa695c-3c8f-41c0-88e0-39d6718022cf | zhangshiyun/LAMMPS_STABLE | LAMMPS_STABLE/pair_lj_charmm_coul_long.cpp | /* ----------------------------------------------------------------------
Contributing author: Paul Crozier (SNL)
------------------------------------------------------------------------- */
#include "math.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "pair_lj_charmm_coul_long.h"
#include "... | ALGO | 0.999901 | 6.26275 |
123f405b-f351-41e1-98c6-c1e6ee78fdcb | troyliu0105/eigen | doc/tutorial.cpp | #include <Eigen/Array>
int main(int argc, char *argv[])
{
std::cout.precision(2);
// demo static functions
Eigen::Matrix3f m3 = Eigen::Matrix3f::Random();
Eigen::Matrix4f m4 = Eigen::Matrix4f::Identity();
std::cout << "*** Step 1 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl;
// demo non-static set.... | TOOL | 0.892269 | 4.180893 |
f367ac31-4de7-46dd-9007-a8a6ee0909f9 | godely/Problems | UVa/11086.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
#define fr(a,b,c) for (int a = b; a < c; a++)
#define rp(a,b) fr(a,0,b)
#define cl(a,b) memset(a,b,sizeof a)
#define sf(a) scanf("%d", &a)
#define sf2(a,b) scanf("%d%d", &a, &b)
#define... | ALGO | 0.999514 | 3.562589 |
10f49666-061f-47cb-99d2-2d0d3cd09546 | gaolu/Leetcode | bestTimeToBuyAndSellStock.cpp | class Solution {
public:
int maxProfit(vector<int> &prices) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(prices.size() == 0)
return 0;
int low = prices[0];
int profit = 0;
for(int i = 1; i < prices.size(); i++){
... | ALGO | 0.999006 | 5.982126 |
499ce6d5-32d0-4002-8fdd-487972159228 | NullAwe/competitive-programming | codeforces/random/LevkoAndStrings.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1e9 + 7;
int main() {
int n, k; cin >> n >> k;
string str; cin >> str;
vector<ll> p(n + 1); p[0] = 1; for (int i = 1; i <= n; ++i) p[i] = p[i - 1] * 26 % MOD;
vector<int> arr(n); for (int i = 0; i < n; ++i) arr[i] = str[i] - '... | ALGO | 0.999993 | 4.835371 |
3d9521e9-e5dd-407a-aff6-def2d398ad5b | Jaskamalkainth/Codeforces | unfairpool.cpp | #include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <cassert>
#include <list>
#include <tuple>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <a... | ALGO | 0.999946 | 3.056405 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.