uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
635f15a1-47a5-4103-aff8-fec0fff33b61 | Annoyshah/Cp-Dsa-Solutions | Chef_loves_Pizza_Chef_loves_halfs.cpp | /*ॐ श्री गणेशाय नमः || */
/* ॐ नमः पार्वती पतये हर हर महादेव */
/* कर्पूरगौरं करुणावतारं संसारसारं भुजगेन्द्रहारम्। सदा बसन्तं हृदयारविन्दे भवं भवानीसहितं नमामि।। */
/* ॐ नमो भगवते वासुदेवाय */
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>... | ALGO | 0.999896 | 4.811425 |
d2e4924d-fbac-4e23-9696-2fdb050eff74 | winterant/Huawei-Codecraft-2022 | round2/SDK_C++/CodeCraft-2022/src/solution.cpp | #include "solution.h"
void Solution::run(const string &output_path = string())
{
/***************************** ******************************/
// userĶ
vector<int> user_degree(db.num_users(), 0);
for (int u = 0; u < db.num_users(); u++)
for (int s = 0; s < db.num_sites(); s++)
if ... | ALGO | 0.995179 | 4.181571 |
a9f809e3-cf90-42bc-953f-7a0cd66adb04 | ishandutta2007/codeforces | hitman623/normal/706/B.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,x[100000],q,m[100000],i,d,las,beg,mid,j;
cin>>n;
for(i=0;i<n;++i)
cin>>x[i];
cin>>q;
for(i=0;i<q;++i)
cin>>m[i];
sort(x,x+n);
for(i=0;i<q;++i)
{ las=n-1;beg=0;mid=(n-1)/2;
... | ALGO | 0.999997 | 4.529126 |
a754aeeb-2b86-4ea1-91b1-6b4192913420 | hasandramali/sauce-engine | ivp/havana/havok/hk_physics/constraint/local_constraint_system/local_constraint_system.cpp | #include <ivp_physics.hxx>
#include <ivp_template_constraint.hxx>
#include <hk_physics/physics.h>
#include <hk_physics/constraint/constraint.h>
#include <hk_physics/constraint/local_constraint_system/local_constraint_system.h>
#include <hk_physics/constraint/limited_ball_socket/limited_ball_socket_bp.h>
#include <hk... | TOOL | 0.88065 | 5.207258 |
9b9d1241-9d15-458e-aa32-d7350813916b | radzhiv25/DSA | LeetCode/palindrome.cpp | #include <iostream>
using namespace std;
void palindrome(int num){
int dup = num;
int rev = 0;
while(num != 0){
int lastDigit = num % 10;
rev = rev * 10 + lastDigit;
num = num / 10;
}
if(num == rev){
cout << "Is palindrome";
}
else{
cout << "Is not ... | ALGO | 0.999862 | 4.350298 |
26d58537-cdeb-46d4-95fb-6e14177e1080 | yaso9/libqsim | src/utils.cpp | #include <arrayfire.h>
__attribute__((visibility("hidden"))) af::array kron(af::array &lhs,
af::array &rhs) {
// This isn't very readable, but it implements the kronecker product with GPU
// acceleration
af::array arr = af::tile(lhs, rhs.dims(1));
arr = af::... | ALGO | 0.961047 | 6.127017 |
3adbf123-2979-4aec-b7c4-72eb3cf12ed8 | ravishankar4288/Apna-Online-Dukaan | practice.cpp/lab08.cpp |
// Online C++ compiler to run C++ program online
#include <iostream>
#include <cstring>
#include <bits/stdc++.h>
using namespace std;
int helper( string s1 , string s2 , int **output){
int m = s1.size();
int n = s2.size();
if(m==0||n==0){
return max( m , n);
}
if(output[m][n]!=-1){
return output[m][n];
}
... | ALGO | 0.999986 | 5.117947 |
c12c3779-2374-49a9-a2a8-fb9042569dd8 | kurpenok/omstu | semester_1/algorithmization_and_programming/Labs/3/Code/3_2.cpp | #include <iostream>
#include <cmath>
double f_1(double x) {
double result = pow(M_E, -x) * log10(sqrt(x + 1));
return result;
}
double f_2(double x) {
double result = x + sin(x);
return result;
}
int main() {
double start = 1;
double stop = 2;
double steps = 11;
double value = 1;
d... | ALGO | 0.974878 | 4.266759 |
8fb9e5a5-b7c2-4563-b4f7-d6bce3b28a98 | ankitanjana23/leetcode | 0074-search-a-2d-matrix/0074-search-a-2d-matrix.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int n = matrix.size();
int m = matrix[0].size();
for(int i = 0 ;i<n;i++){
int j = m-1;
if(matrix[i][j] == target ){
return true ;
}
else if (matri... | ALGO | 0.999982 | 5.933 |
7491aa7c-4ac0-41c3-b312-1631cb541afe | fightforhash/Interview-Prep | JungOl/1157.cpp | #include <iostream>
using namespace std;
void bb(int arr[], int n){
bool swapped;
for (int i = 0; i < n - 1; i++ ){
swapped = false;
for (int j = 0; j < n - i - 1; j++){
if (arr[j] > arr[j+1]){
swap(arr[j], arr[j+1]);
swapped = true;
}
... | ALGO | 0.999923 | 4.539274 |
8120548d-ae0a-4de5-b71e-b9640e1f80fc | michimani/atcoder | abc/201-300/283/cpp/b.cpp | #include <iostream>
#include <vector>
using namespace std;
using ui = unsigned int;
int main()
{
ui n;
cin >> n;
vector<ui> a(n);
for (auto &aa : a)
cin >> aa;
ui q;
cin >> q;
ui cmd, k, x;
for (; q--;)
{
cin >> cmd >> k;
if (cmd == 1)
{
cin >> x;
a[k - 1] = x;
}
... | ALGO | 0.999525 | 4.078511 |
c467c786-d6d6-4927-9925-dab78654a9ff | OSCC-Project/iEDA | src/operation/iTO/source/module/fix_setup/SetupOptimizer_init.cpp | using namespace std;
namespace ito {
void SetupOptimizer::init() {
initBufferCell();
LOG_ERROR_IF(_available_lib_cell_sizes.empty()) << "Can not found specified buffers.\n";
if (!_has_estimate_all_net) {
toEvalInst->estimateAllNetParasitics();
_has_estimate_all_net = true;
} else {
toEvalInst->ex... | ALGO | 0.928446 | 4.316152 |
c21819c5-6f8b-4e5b-b9e4-c2d0535b9b98 | Mothballs017/Experience | C++/Battleship/Battleship.cpp | /*********************************************************************************/
/*** Title: Battleship_mc.cpp ***/
/*** Course: Computational Problem Solving CPET-121 ***/
/*** Developer: Matthew Chu ***/
/*** Data: March 29, 2018 ... | ALGO | 0.92924 | 3.139836 |
5efe0d19-6b49-4388-9ec0-1e51e94024a6 | AYRUS06/code-bucket | data Structure/permutation.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{int t;
cin>>t;
for(int i=0;i<t;i++)
{
int n;
cin>>n;
vector<int> v;
for(int j=0;j<n;j++)
{int a;
cin>>a;
v.push_back(a);
}int k=0;int l=n;
while(l>1)
{
if(upper_bound(v.begin()+k+1,v... | ALGO | 0.999889 | 3.840944 |
f28ebe8c-c746-49ec-9bae-80f9b6be4672 | sumit58591/Leetcode-POTD | Leetcode_1358.cpp | // Leetcode 1358
#include <bits/stdc++.h>
using namespace std;
int numberOfSubstrings(string s) {
unordered_map<char, int> mp;
int i = 0, j = 0, n = s.length(), outputCount = 0;
while(j < n) {
mp[s[j]]++;
while(mp.size() == 3) {
outputCount += n - j;
mp[s[i]]--;
... | ALGO | 0.999977 | 5.731484 |
860cbbac-3ee8-4b5e-ad7e-a14fec68c6fe | samiulalimsaad/Phitron | 2nd Semester/Algorithm/Assignment-2/2.cpp | #include<bits/stdc++.h>
using namespace std;
const long N = 1e5 + 5;
vector<long> adj[N];
bool visited[N];
bool dfs(long u, long target, long l = 0) {
visited[u] = true;
bool found = false;
if (l == target) {
cout << u << " ";
return true;
}
for (long v : adj[u]) {
if (vis... | ALGO | 0.999983 | 5.011382 |
f0a9c805-bdad-47ba-afda-96ad88d5d94b | ishandutta2007/codeforces | wucstdio/normal/700/E.cpp | #include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
struct SAM
{
int child[26];
int fail;
int len;
}tree[400005];
struct Edge
{
int to;
int nxt;
}e[400005];
struct Tree
{
#define lc tree[x].child[0]
#define rc tree[x].child[1]
#define mid ((l+r)>>1)
struct Node
{
int child[2];
int ... | ALGO | 0.999989 | 3.875508 |
1b088668-34e9-477c-9488-a9648af6a133 | FahadHeiji/Course-Projects-PA | FP/Algorithm-02/Problem___1__25/Problem__11/Pro-11.cpp | #include <iostream>
#include <string>
using namespace std;
int ReadPositiveNumber(string Message)
{
int Number = 0;
do
{
cout << Message << endl;
cin >> Number;
} while (Number <= 0);
return Number;
}
int ReverseNumber(int Number)
{
int Remainder = 0, Number2 = 0;
while (Numb... | ALGO | 0.999412 | 4.215579 |
3b43d1e2-3266-453a-a6cb-bab18e0e1877 | annkit-singh/CodeNCode | Arrays/matrixSearch.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
int matrix[n][n];
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin>>matrix[i][j];
}
}
int i=0;int j=n-1;int target;cin>>target;int flag=false;
while(i<n && j>=0){
if(matrix[i][j]==target){... | ALGO | 0.999788 | 4.599586 |
58801026-5fe8-41ff-aa0d-9484d454d2af | dbwls89876/Ru | c++/학교 수업 과제/Sources_7장16장제외/chap14/pizza1.cpp | #include <iostream>
using namespace std;
int main()
{
int pizza_slices = 0;
int persons = -1;
int slices_per_person = 0;
cout << " ԷϽÿ: ";
cin >> pizza_slices;
cout << " ԷϽÿ: ";
cin >> persons;
slices_per_person = pizza_slices / persons;
cout << "ѻ ڴ " << slices_per_person << "Դϴ." << endl;
return 0;
} | ALGO | 0.995017 | 4.82428 |
d05d6fbc-7cd3-41f4-a9e2-a66b1270b8a0 | aditya13902/Leetcode | 300-longest-increasing-subsequence/300-longest-increasing-subsequence.cpp | class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
vector<int>tmp;
tmp.push_back(nums[0]);
for(int i=1;i<nums.size();i++){
if(nums[i]>tmp.back()){
tmp.push_back(nums[i]);
}
else{
int idx=lower_bound(tmp.begin(),tm... | ALGO | 0.999989 | 5.998633 |
16549704-2788-427c-85a9-1d68fb6efdcc | ishandutta2007/codeforces | tadijasebez/normal/1416/D.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define ldb double
template<typename T>void ckmn(T&a,T b){a=min(a,b);}
template<typename T>void ckmx(T&a,T b){a=max(a,b);}
void rd(in... | ALGO | 0.999917 | 4.09996 |
5fa8366a-b878-4819-8337-c20e82a5c56f | RavalSahil1311/Data-Structures-and-Algorithms | Algorithms/RecursiveAlgorithms/2PrintInDecresing.cpp | #include <bits/stdc++.h>
using namespace std;
void Solution(int n)
{
if (n < 1)
{
return;
}
cout << n << " ";
Solution(n - 1);
}
int main(int argc, char const *argv[])
{
int n;
cin >> n;
Solution(n);
return 0;
}
| ALGO | 0.999949 | 4.981063 |
316261c3-66b7-46ab-8b77-8a9491993c21 | hi2tamzid/Algorithms | C++/Prime Factorization of Factorial.cpp | #include <bits/stdc++.h>
using namespace std ;
vector<int> prime ;
int primefactor[1000100] ;
int primes[1000100] ;
void siv()
{
memset(primes, 0, sizeof(primes)) ;
long long n = 1000000 ;
long long sqrt_n = sqrt(n) ;
primes[1] = 1 ;
prime.push_back(2) ;
for(long long i = 4 ; i <= n ; i += 2)
... | ALGO | 0.99926 | 4.758514 |
ac51816a-60ae-4809-a5e9-eb208732cd86 | davidwidjaya/parent_wish | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
dddf1685-fee7-4b44-9c7e-78ba22dd1794 | surabhi555/basic_concepts_of_dsa | BINARY_SEARCH/searchInSortedRotatedArray.cpp | #include <iostream>
#include <vector>
using namespace std;
/*You have been given a sorted array/list 'arr' consisting of ‘n’ elements. You are also given an integer ‘k’.
Now the array is rotated at some pivot point unknown to you.
For example, if 'arr' = [ 1, 3, 5, 7, 8], then after rotating 'arr' at index 3, the arr... | ALGO | 0.999989 | 6.590561 |
a511fda5-6de8-49ee-a160-8a5204473984 | antonyayansi/curso-cpp | practica02/ejercicio1.cpp | #include<iostream>
using namespace std;
int main(){
//Escribe un programa que defina un vector de números y calcule la suma de sus elementos.
int vector[100], nro, suma = 0;
do{
cout << "Ingrese la cantidad de elementos [1,100]:";
cin >> nro;
if(nro >=100 || nro < 0){
... | TOOL | 0.87831 | 3.630317 |
d7c6ac93-10a7-46a8-990d-d3710f01fcec | mmz-zmm/LeetCode | 0131-Palindrome-Partitioning.cpp | class Solution {
public:
vector<vector<string>> lists;
vector<vector<string>> partition(string s) {
if(s.size() == 0)
return lists;
auto len = s.size();
vector<vector<int>> dp(len, vector<int>(len, 0));
for(auto right = 0; right < len; ++right)
{
... | ALGO | 0.999967 | 5.930936 |
a0036523-e80e-4b27-9de0-1d4486c09fab | calgagi/leetcode | 0978/answer.cpp | class Solution {
public:
int maxTurbulenceSize(vector<int>& A) {
int n = A.size();
int streak = 0, best = 0;
for (int i = 0; i < n-1; i++) {
if ((i&1) && A[i] > A[i+1]) {
streak++;
} else if ((i&1) == 0 && A[i] < A[i+1]) {
streak++;
... | ALGO | 0.999424 | 5.908556 |
1a5f6267-1b5a-439b-9792-a71593d5eca9 | gavinband/bgen | 3rd_party/boost_1_55_0/libs/multi_index/example/random_access.cpp | #if !defined(NDEBUG)
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
#endif
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/random_access_index.hpp>
#include <b... | ALGO | 0.911425 | 5.667584 |
d86c32ca-9287-4577-9ca8-9e874416ee48 | NikhilYadavCoder/DSA- | starpatterns.cpp | // #include<bits/stdc++.h>
// using namespace std;
// int main(){
// int n;
// cin>>n;
// for(int i=0;i<n;i++){
// for(int j=0;j<n;j++){
// cout<<"*";
// }
// cout<<endl;
// }
// return 0;
// }
// #include<bits/stdc++.h>
// using namespace std;
// int main(){
// ... | ALGO | 0.999472 | 3.707138 |
7eaf619b-f33c-41b1-835c-e40fcb6f74b5 | InnetaSh/Calculator | CodingCaesar.cpp | #include "CodingCaesar.h"
string CodingCaesar::Coding(string& str, int key)
{
string newText;
key = key % 28;
for (int i = 0; i < str.length(); i++)
{
if (isalpha(str[i]))
{
if (str[i] >= 65 && str[i] <= 90)
{
str[i] += key;
... | ALGO | 0.999794 | 3.897172 |
36734fe6-9b02-499f-8d5f-70277c106366 | SamuelDeal/chapi | common/src/config.cpp | #include "config.h"
#include <fstream>
#include <sstream>
#include "const.h"
#include "stringutils.h"
#include "error.h"
Config::Config(){
}
void Config::load() {
std::ifstream cfgFile(CONFIG_FOLDER "/" CONFIG_FILE);
std::string line;
while(std::getline(cfgFile, line)) {
std::istringstream lineS... | CONFIG | 0.94302 | 5.797525 |
0aa7dcad-6950-4292-85b5-9769e51b01db | sufykhan/Codeforces | 2266-count-number-of-texts/2266-count-number-of-texts.cpp | class Solution {
public:
int COINCHANGE(int sum,int k){
int mod=1e9+7;
vector<int>coin={1,2,3};
if(k==7 || k==9){
coin.push_back(4);
}
int n=coin.size();
vector<vector<int>>dp(n+1,vector<int>(sum+1,0));
for(int i=0;i<=sum;i++){
... | ALGO | 0.999784 | 4.773941 |
43802442-7c91-4594-89a1-158d6316a6a8 | Anshika-111105/DSA-leetcode | 2236-maximum-twin-sum-of-a-linked-list/maximum-twin-sum-of-a-linked-list.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:
int pairSum(ListNode*... | ALGO | 0.999989 | 5.793086 |
45f4b2fe-3dff-4b0d-a041-8c5c8ee7d9b9 | giackserva/leetcoding-challenge | week3/19-search-in-a-rotated-sorted-array/main.cpp | /*
- Search in Rotated Sorted Array -
Suppose an array sorted in ascending order is rotated at some pivot unknown to
you beforehand.
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You are given a target value to search. If found in the array return its index,
otherwise return -1.
You may ... | ALGO | 0.99997 | 6.404675 |
57e5740d-9765-4893-86ff-9453cb3044c6 | naxocist/POSN-IPST | beta/codecube_048.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e6 + 7;
int dp[50004];
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, t, x; cin >> n >> t;
dp[0] = 1;
while(n--) {
int x; cin >> x;
for(int j=t; j>=x; --j) dp[j] += dp[j-x], dp[j] %= mod;
}
cout << dp[t];
} | ALGO | 0.999966 | 4.897437 |
309b34b6-326e-45aa-90c3-e4feebbcdb61 | libMesh/libmesh | contrib/eigen/3.3.9/unsupported/doc/examples/BVH_Example.cpp | #include <Eigen/StdVector>
#include <unsupported/Eigen/BVH>
#include <iostream>
using namespace Eigen;
typedef AlignedBox<double, 2> Box2d;
namespace Eigen {
Box2d bounding_box(const Vector2d &v) { return Box2d(v, v); } //compute the bounding box of a single point
}
struct PointPointMinimizer //how to compute squa... | ALGO | 0.999663 | 6.502348 |
92f812f6-3e60-40f1-b999-eccf0ba8ec8e | topurayhan007/Cplusplus | CSE203 (Data Structure)/BSTcountLeftNode.cpp | #include <iostream>
#include <stack>
#include <queue>
using namespace std;
struct BinaryTreeNode {
int data;
BinaryTreeNode* left;
BinaryTreeNode* right;
};
void insert(BinaryTreeNode*& n, int i) {
if (n == nullptr) {
n = new BinaryTreeNode;
n->data = i;
n->right = nullptr;
n->left = nullptr;
}
e... | ALGO | 0.999938 | 5.209299 |
f3c7692f-a072-4237-a433-7a88d9455d68 | duythanhphan/llvm | lib/CodeGen/ExecutionDepsFix.cpp | #define DEBUG_TYPE "execution-fix"
#include "llvm/CodeGen/Passes.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm... | ALGO | 0.992438 | 7.748562 |
278702dd-baef-422e-9070-3d7e7c2d47ad | Divyanshu9794/GFG_POTD | Difficulty: Medium/Count Inversions/count-inversions.cpp | class Solution {
public:
int cnt =0;
int merge(vector<int> &arr,int low,int mid,int high){
vector<int> temp;
int left = low, right = mid+1;
while(left<=mid && right<=high){
if(arr[left]<= arr[right]){
temp.push_back(arr[left]);
left++;
}
... | ALGO | 0.999962 | 5.611457 |
025542f2-7df2-4c44-a7ca-312d4dd8a8d4 | amritpandey23/DS_LAB_CS5351 | end_lab_exam/END_DS_LAB_207907_P2.cpp | // author: Amrit Pandey, 207907
// date: 08/07/2021
// MCA II SEM Data Structure END LAB Exam
#include <iostream>
#include <limits.h>
using namespace std;
#define QUEUE_MAX 100
int menu()
{
int r;
cout << "Enter 1. Enque 2. Deque 3. Print 4. Exit : ";
cin >> r;
return r;
}
class int_Deque
{
int ... | ALGO | 0.993506 | 4.391729 |
05758941-d0c3-471a-8bc5-49e688695863 | blackrangersoftware/brs-wownero | src/mnemonics/electrum-words.cpp | /*!
* \file electrum-words.cpp
*
* \brief Mnemonic seed generation and wallet restoration from them.
*
* This file and its header file are for translating Electrum-style word lists
* into their equivalent byte representations for cross-compatibility with
* that method of "backing up" one's wallet keys.
*/
#i... | TOOL | 0.91656 | 6.725127 |
8f46ac6e-c5ed-42c6-b774-0af143fee4a4 | Junhyung-Won/flutter-tiktok | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
19a42c0e-b5a1-4ad7-bf5b-8330932cde52 | kmjp/procon | atcoder/past001-040/past013/l.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#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 FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999978 | 4.236441 |
8e0c3fc7-42c5-43d5-9bff-afc37046a1d0 | escape0707/usaco_trainings | race3.cpp | /*
ID: totheso1
LANG: C++14
TASK: race3
*/
#include <algorithm>
#include <fstream>
#include <iterator>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
static ifstream fin("race3.in");
static ofstream fout("race3.out");
#define endl '\n'
template <typename T>
T fin_get() {
return *istre... | ALGO | 0.999296 | 3.936748 |
8e60d932-0850-458a-8620-1da4776290da | rahulsrivastava1/DSA-BASKET | DP/coin_change.cpp | // coin change
// variations of subset sum in unbounded knapsack
// maximum no. of ways
long long int count(int S[], int m, int n){
long long dp[m+1][n+1];
for(int i=0;i<m+1;i++){
for(int j=0;j<n+1;j++){
if(i==0)
dp[i][j]=0;
if(j==0)
... | ALGO | 0.999967 | 4.565621 |
d13e80c1-97b9-4790-b589-a10f2e5fd376 | MoogleAndChocobo/ACM-Learning | SolvedProblems/CodeForces/599A.cpp | #include<cstdio>
int main()
{
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
if(a + b <= c)
printf("%d", 2 * (a + b));
else if(a + c <= b)
printf("%d", 2 * (a + c));
else if(b + c <= a)
printf("%d", 2 * (b + c));
else
printf("%d", a + b + c);
return 0;
} | ALGO | 0.999419 | 4.015811 |
684c2b8e-25e6-4a5f-8f28-f58e450eb9e0 | tmddmddnjs/Baekjoon | 피보나치 수.cpp | #include <iostream>
using namespace std;
int fiboData[45] = { 0, };
int fibo(int n) {
fiboData[0] = 0;
fiboData[1] = 1;
for (int i = 2; i <= n; i++) {
fiboData[i] = fiboData[i - 1] + fiboData[i - 2];
}
return fiboData[n];
}
int main() {
int inputNum;
cin >> inputNum;
cout << fibo(inputNum);
} | ALGO | 0.999963 | 5.083399 |
e30cb22f-a861-40f9-ba5a-b04cb6d7433b | Vishnuy123/cryptography- | 1.cpp | #include <stdio.h>
#include <ctype.h>
// Function to encrypt the string using Caesar Cipher
void caesarCipher(char *text, int shift) {
char ch;
for (int i = 0; text[i] != '\0'; ++i) {
ch = text[i];
// Encrypt uppercase letters
if (isupper(ch)) {
ch = ((ch - 'A' + sh... | ALGO | 0.998588 | 6.535278 |
ea7d0826-fd2e-4234-ac77-2bead9f2bc5b | MiroTheMighty/ObjectOrientedProgramming | Vježba 02/Zadatak 1.cpp | #include<iostream>
void MinMax(int* a, int& min, int& max, int n) {
min = a[0];
max = a[0];
for (int i = 0; i < n; i++) {
if (a[i] < min) {
min = a[i];
}
if (a[i] > max) {
max = a[i];
}
}
}
int main() {
int n, min, max;
std::cout << "Unesite broj elemenata niza: " << std::endl;
std::cin >> n;
... | ALGO | 0.999519 | 4.749412 |
a45e547e-d63b-47f8-8ba9-1627a1984b93 | parag4690/DSA | Topic_3_recursion/20.cpp | #include <iostream>
#include <string.h>
using namespace std;
int getCodes(string input, string output[10000]) {
static int k=1;
if(input.length() == 0){
int y = input[0] - '0';
char p = (char)('a'+y+1);
cout<<"output"<<p<<endl;
output[0] = p;
return 1;
}
... | ALGO | 0.999932 | 3.774954 |
c5920121-c117-43fa-9520-2f289f6bbf75 | LifeIsRightward/Baekjoon | Solved/Bronze/Bronze4_10797.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int n, tmp, cnt = 0;
vector<int> vec;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for (int i = 0; i < 5; i++) {
cin >> tmp;
if (n == tmp) {
cnt++;
}
}
cout << c... | ALGO | 0.999825 | 3.805372 |
36a728cd-285b-4568-a92d-ffa25e04feb3 | devAdhiraj/coding-problems | Other/dmpg15b1.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string phoneNumber;
int iters;
cin >> iters;
cin.ignore();
for(int i = 0; i < iters; i++){
getline(cin, phoneNumber);
if(phoneNumber.length() == 10 && (phoneNumber.substr(0, 3) == "416" || phoneNumber.substr(0, 3) == "6... | ALGO | 0.991814 | 5.178863 |
602680a8-b33f-458a-880e-33a403630be6 | aakashx58/flutter_state_management_no_package | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
eb4d2009-7463-43b4-b317-f9627b16baa0 | royalpranjal/LeetCode | Algorithms/Jewels and Stones.cpp | class Solution {
public:
int numJewelsInStones(string J, string S) {
map<char, int> m;
for(int i = 0; i < J.size(); i++){
if(m.find(J[i]) == m.end()){
m[J[i]] = 1;
}
else{
m[J[i]]++;
}
}
... | ALGO | 0.999501 | 5.838632 |
ba423d4d-6de5-44a0-b516-8a54f01529b4 | kpratyush12345/Striver-SDE-Sheet-Challenge | Day 1/03_Next_Permutation.cpp | // Brute Force (Backtracking Method) - TC: O(n!*n) SC: O(n)
// ------------------------------------------------------------
// Step 1: Find all possible permutations of elements present and store them in ans 2D vector.
// Step 2: Sort the vector and search for the nums vector.
// Step 3: When we find the nums in ans 2... | ALGO | 0.999998 | 6.239564 |
07899f52-c0f6-4265-8567-4835b5850645 | Nikitiwe/Leetcode | 1923-sentence-similarity-iii/1923-sentence-similarity-iii.cpp | class Solution {
public:
bool areSentencesSimilar(string s, string f) {
if (s.size()<f.size()) swap(s, f);
vector<string> a, b;
string t;
for (int i=0; i!=s.size(); i++)
{
if (s[i]!=' ') t+=s[i];
else
{
a.push_back(t);
... | ALGO | 0.99999 | 5.711438 |
77d60c14-4c8b-422e-b857-533ea9d894d6 | varnitkumar4/cpp_code | question of c++/pwarray1.cpp | #include <iostream>
using namespace std;
int main()
{
int arr1[] = {1, 6, 7, 10};
int arr2[] = {0, 1, 3, 8, 11, 12, 15, 18};
int m = 4;
int n = 8;
// code to arrange two sarted array
int result[m + n];
int i = 0; // will help us to iterate on arr1
int j = 0; // will help us to iterate... | ALGO | 0.999921 | 3.712669 |
f00aacb8-40eb-49bb-b7b0-bebbfca9fe19 | Adiihub/DSA | 08 - Binary Search Tree/04_Level_Order_Traversal.cpp | #include<bits/stdc++.h>
#include<queue>
using namespace std;
class node{
public:
int data;
node* left;
node* right;
node(int data){
this->data=data;
this->left=NULL;
this->right=NULL;
}
};
node* BulidTreeLevelOrder( ){
... | ALGO | 0.999926 | 4.328733 |
af829f57-d357-4e1e-86f6-a8e3880d45e7 | lj102800/IvanJobs | zoj/zoj1051.cpp | #include <cstdio>
char cmap[4] = {'.', '!', 'X', '#'};
int dir[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int n = 0;
int D[16]={0};
int culture[20][20]={0};
int k[20][20]={0};
void makek() {
int i, j, m;
for (i = 0; i < 20; ++i){
for (j = 0; j < 20; ++j) {
// culture[i][j]
k[i][j] = culture[i][j];
for ... | ALGO | 0.999534 | 3.954897 |
f31cbe56-5c6d-4c85-8b83-116a107d8d03 | Zelkey17/Numerical-methods | integration.cpp | //
// Created by ash on 28.05.23.
//
#include "utils/functionaluty.h"
#include <cmath>
/// Площадь методом трапеций от a до b с разделением на n частей
double trap_integral(func(f), double a, double b, int n) {
double ans = 0;
for (int i = 0; i < n; i++) {
ans += (f(a + (b - a) / n * i) + f(a + (b - a... | ALGO | 0.999821 | 5.867156 |
4770f1f8-9eba-478d-8813-5db07466b13c | RishiKendai/dsa-practice-focused | day5/maxValTriplet1.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
long long maximumTripletValue(vector<int>& nums) {
if (nums.size() < 2) {
return 0;
}
long long ans = 0;
int indexi = 0;
int indexj = 1;
int n = nums.size();
for (int i = 0; i < n; i++) {
// for I
i... | ALGO | 0.999898 | 5.401637 |
e631db37-7607-4c8f-9c35-e4b639f42206 | Ankit-Dhattarwal/C-plus-Plus- | pattern_q_14.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i = 1;
while (i<=n) {
int space = 1;
while (space<=n-i) {
cout<<" ";
space++;
}
int num = 1;
while (num<=i) {
cout<<num;
num++;
}
... | ALGO | 0.999972 | 3.859411 |
3578ad07-c7f0-42c9-be87-d3eb05169d8d | goldcoin/goldcoin-0.7.5 | BuildDeps/deps/boost/libs/numeric/ublas/doc/samples/symmetric_adaptor.cpp | #include <boost/numeric/ublas/symmetric.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
symmetric_adaptor<matrix<double>, lower> sal (m);
for (unsigned i = 0; i < sal.size1 (); ++ i)
for (unsigned j = 0; j <= i; ++ j)
... | ALGO | 0.993649 | 3.845274 |
6e4d7d49-441b-49bc-b26d-6295713a6082 | xunilrj/sandbox | sources/cpp/watch/watch.cpp | // watch.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
#include <set>
#include <algorithm>
#include <string>
#include <Windows.h>
#include <WinHttp.h>
#pragma comment(lib, "winhttp.lib")
#include <Websocket.h>
struct noncopyable {};
str... | TOOL | 0.901937 | 4.846514 |
b4789130-c2fa-4a9a-a349-7767d0478934 | sourik10/Leetcode-Problems | missingNumber.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
int x=nums[0];
for(int i=1;i<nums.size();i++) x=x^nums[i];
int y=0;
for(int i=1;i<=nums.size();i++) y=y^i;
return x^y;
}
};
| ALGO | 0.999873 | 5.452887 |
90e6255e-2cba-45bc-8347-f3bba18f98c5 | not-a-dev0/Awesome-Quant-Machine-Learning-Trading | C++/valid-word-abbreviation.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
bool validWordAbbreviation(string word, string abbr) {
int i = 0, digit = 0;
for (const auto& c : abbr) {
if (isdigit(c)) {
if (digit == 0 && c == '0') {
return false;
}
... | ALGO | 0.999784 | 6.444862 |
ae5adbfa-5aad-4e9c-91f1-5aa5abf15258 | miguelnitbit1/qwee | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
287cc4c5-6545-4b7c-84e9-4761695f39b0 | 18-RAJAT/LEETCODE | 1420-build-array-where-you-can-find-the-maximum-exactly-k-comparisons/1420-build-array-where-you-can-find-the-maximum-exactly-k-comparisons.cpp | class Solution {
public:
int dp[105][105][105];
int m;
int recur(int fill,int check,int k)
{
//base case
if(k<0)
{
return 0;
}
//pruning
if(check==0)
{
return k==0;
... | ALGO | 0.999988 | 4.729222 |
35ee6db1-0368-4a4a-984b-dea90b65807e | mdhanapal1812/Leetcode-Programming-Challenges | implement_stack_using_queues/MyStack.cpp | class MyStack {
public:
queue<int>q1;
queue<int>q2;
/** Initialize your data structure here. */
MyStack() {
}
/** Push element x onto stack. */
void push(int x) {
q1.push(x);
}
/** Removes the element on top of the stack and returns that element. */
int... | ALGO | 0.999493 | 5.590438 |
c7c1b7fe-ede7-40ee-bee3-18120c2d87fb | risacker/Leetcode_Solutions | 80-remove-duplicates-from-sorted-array-ii/80-remove-duplicates-from-sorted-array-ii.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int i = 2;
if(nums.size()<=2)
return nums.size();
for (int curr = 2; curr < nums.size(); curr++)
{
if (nums[curr] != nums[i-2])
{
nums[i++] = nums[curr];
... | ALGO | 0.999683 | 6.197125 |
464d54e0-e84e-4c26-bf92-2ae3a22a2a9b | mirror-of/inkscape | src/xml/repr-sorting.cpp | /** @file
* TODO: insert short description here
*/
#include "util/longest-common-suffix.h"
#include "xml/repr.h"
#include "xml/node-iterators.h"
#include "repr-sorting.h"
Inkscape::XML::Node const *LCA(Inkscape::XML::Node const *a, Inkscape::XML::Node const *b)
{
using Inkscape::Algorithms::nearest_common_ances... | TOOL | 0.942945 | 6.420933 |
b981bd65-4ac3-4714-a0ed-df5be8de7c31 | hyeonseong0917/Codeforces | 870_div2/870_A.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main() {
// your code goes here
int t=0;
cin>>t;
while(t--){
int N=0;
cin>>N;
vector<int> A;
map<int,int> m; // m[5]=1
for(int i=0;i<N;++i){
int a=0;
cin>>a;
A.push_back(a);
}
int cnt=0;
sor... | ALGO | 0.999777 | 4.187674 |
98e208e9-8df9-4065-897c-1ae31153ebe7 | hitonanode/cplib-cpp | string/test/rolling_hash_lcp.test.cpp | #include "../../modint.hpp"
#include "../rolling_hash_1d.hpp"
#include <cassert>
#include <iostream>
#include <string>
#define PROBLEM "https://yukicoder.me/problems/1408"
using namespace std;
int main() {
cin.tie(nullptr), ios::sync_with_stdio(false);
int N;
cin >> N;
using Hash = PairHash<ModInt99824... | ALGO | 0.999332 | 5.752213 |
899a28a3-8444-47df-bbe4-91995544316e | The-Shresth/Answers_to_codeforces | 2093C_perp.cpp | #include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int repeated_num(int x, int k) {
int dig_count = 0;
int dig_check = x;
while(dig_check != 0) {
dig_count++;
dig_check /= 10;
}
int exp = 1;
for(int i = 0; i < dig_count; i++) {
exp *= 10;
}... | ALGO | 0.999784 | 5.524801 |
ad134b7e-d4de-4beb-8c62-5f3d6974ef5c | Prakul-Agrawal/CSES | Introductory Problems/Number Spiral.cpp | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef long double ldb;
//#define int ll
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<vii> vvii;
#define ff first
#define ss second
... | ALGO | 0.999852 | 4.388295 |
da164a91-4954-4406-8947-af5b4d72ff47 | PedroGarcia-BWH/EDNL | grafos/p7/ej6.cpp | #include "../algoritmos/grafoPMC.h"
#include "../algoritmos/matriz.h"
#include "../algoritmos/alggrafoPMC.h"
#include <vector>
using namespace std;
// aqui en vez de solo ser una ciudad es que sea varias ciudades que tengan transbordo
template <typename tCoste>
matriz<tCoste> tarifa(const GrafoP<tCoste>& tren, const ... | ALGO | 0.996269 | 4.423663 |
5d3a04dc-0b7d-4c8b-8df7-65a7499b5f04 | MingzhenY/code-warehouse | CodingWebsites/URAL/Volume2/1156.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#define inf 0x5fffffff
#define FOR(i,n) for(long long (i)=1;(i)<=(n);(i)++)
#define For(i,n) for(long long (i)=0;(i)<(n);(i)++)
#define out(i) <<#i<<"="<<(i)<<" "
#define OUT1(a1) cout out(a1) <<endl
#def... | ALGO | 0.999966 | 3.853647 |
e1c48fd3-e710-448b-99ca-c5d62d008c47 | horn-ice/hice-dt | z3-4.7.1/src/ast/rewriter/var_subst.cpp | #include "ast/rewriter/var_subst.h"
#include "ast/ast_ll_pp.h"
#include "ast/ast_pp.h"
#include "ast/ast_smt2_pp.h"
#include "ast/well_sorted.h"
#include "ast/for_each_expr.h"
expr_ref var_subst::operator()(expr * n, unsigned num_args, expr * const * args) {
expr_ref result(m_reducer.m());
if (is_ground(n)) {
... | ALGO | 0.899256 | 5.954439 |
f4a34cc3-5452-4af6-9dc2-5fae1ff3a97e | TartanLlama/jork | source/parser.cpp | module;
#include <iterator>
#include <sstream>
#include <vector>
#include <expected>
#include <unordered_map>
#include <optional>
module jork.parser;
using namespace jork;
struct command_desc {
command_desc(std::string l, std::string s, command_type c) :
long_(std::move(l)), short_(std::move(s)), command_(... | TOOL | 0.969311 | 7.117455 |
3f230a0e-3a3b-4ecb-91f4-60b3624a5290 | souravjha1111/code-daily | 704-binary-search/704-binary-search.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int pivot, left = 0, right = nums.size() - 1;
while (left <= right) {
pivot = left + (right - left) / 2;
if (nums[pivot] == target) return pivot;
if (target < nums[pivot]) right = pivot - 1;
else left = pivot + 1;
... | ALGO | 0.999936 | 6.448294 |
1d19a517-0bcd-4a7e-9e43-ac80e6c5efc9 | yfuka86/pc | atcoder/abc4old/abc005/d/abc005_4.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep_r(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rep2(i,sta,n) for(ll i=sta;i<(ll)(n);i++)
#define rep2_r(i,sta,n) for(ll i=(ll)(n)-1;i>=sta;i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp ... | ALGO | 0.999867 | 4.660028 |
76f3aefd-2ddc-45db-b96b-70d620e0d38e | eemoreira/biblioteca-de-problemas | cf/846/c.cpp | #include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void... | ALGO | 0.99999 | 3.956803 |
41d8d832-8894-4725-80b5-01aac7dcf79f | thka2016/e2fsprogs_cmake | system/core/libutils/VectorImpl.cpp | #define LOG_TAG "Vector"
#include <utils/VectorImpl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <log/log.h>
#include "SharedBuffer.h"
/*****************************************************************************/
namespace android {
// -------------------------------------------------... | TOOL | 0.965551 | 7.480603 |
44b20565-9cfb-46df-9326-b2e5ad16b0fd | ishandutta2007/codeforces | siberian/normal/1656/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define pbc push_back
#define pob pop_back()
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define vin(a) for (auto& i : a) cin >> i
// mt19937 rnd(chrono::steady_clock::now().tim... | ALGO | 0.999536 | 4.007107 |
c49f7c37-88bb-4079-93a9-49f477308be5 | CVC4/CVC4-archived | src/theory/quantifiers/quant_epr.cpp | /********************* */
#include "theory/quantifiers/quant_epr.h"
#include "theory/quantifiers/quant_util.h"
using namespace CVC4::kind;
namespace CVC4 {
namespace theory {
namespace quantifiers {
void QuantEPR::registerNode(Node n,
... | ALGO | 0.993528 | 6.968005 |
be7b2ef9-a973-4d71-9680-7505d244e642 | fufexan/programming_year1 | sem2/lab08/FufezanMihai_lab08_07.cpp | /*
* Fufezan Mihai, 2012, lab08, ex 07
*
* A kiosk sells newspapers, magazines and books. Each publication has a name,
* an editorial house, a number of pages, the number of copies and a price (no
* VAT). Write the class that models the publications. Introduce a static member
* named VAT_value (percentage) and a ... | TOOL | 0.977141 | 6.527358 |
961d98f1-aba5-4f70-9c92-4cf1f38aacb2 | sakuya0818/Forma | deps/assimp/code/PostProcessing/SplitLargeMeshes.cpp | /**
* @file Implementation of the SplitLargeMeshes postprocessing step
*/
// internal headers of the post-processing framework
#include "SplitLargeMeshes.h"
#include "ProcessHelper.h"
using namespace Assimp;
// ------------------------------------------------------------------------------------------------
SplitL... | TOOL | 0.887737 | 6.9778 |
550a6909-e1da-4023-8d70-98f4d8b81321 | nono19972020/atcoder | ABC/ABC145/d2.cpp | #include <iostream>
#include <cstdio>
using namespace std;
long long mod = 1e9 + 7;
long long modpow(long long x, long long n) {
x = x%mod;
if(n == 0){
return 1;
}
else if(n%2 == 1){
return(x*modpow(x, n-1))%mod;
}
else{
return modpow((x*x)%mod, n/2)%mod;
}
}
/*コンビ... | ALGO | 0.999975 | 4.454634 |
30db1521-b7be-4ed2-90ce-088b4def786c | PanchoWW/Learnorion | parse/SpeciesParser.cpp | #include "ConditionParserImpl.h"
#include "EnumParser.h"
#include "Label.h"
#include "Parse.h"
#include "ParseImpl.h"
#include "../universe/Species.h"
#include <boost/spirit/include/phoenix.hpp>
#define DEBUG_PARSERS 0
#if DEBUG_PARSERS
namespace std {
inline ostream& operator<<(ostream& os, const FocusType&) { ... | TOOL | 0.909626 | 5.796199 |
f6786cc9-9275-4961-bce5-9cd8dadd0d09 | rishirajsurti/uva | 11566.cpp | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int memo[1101][200][23];
int price[100], favour[100];
int find(int sum, int dk, int count){
if(sum <= 0 || dk < 0 || count <= 0 ) return 0;
int &v = memo[sum][dk][count];
if(v == -1){
if(price[dk/2] <= sum)
v = fin... | ALGO | 0.999543 | 3.049962 |
d3f3d038-306b-4904-ba0c-5b9eb1b5dfb9 | benMcChesney/KinectHacks | FireIce/src/ofxBox2d/src/lib/Box2D/Source/Collision/b2Collision.cpp | #include "b2Collision.h"
// Collision Detection in Interactive 3D Environments by Gino van den Bergen
// From Section 3.4.1
// x = mu1 * p1 + mu2 * p2
// mu1 + mu2 = 1 && mu1 >= 0 && mu2 >= 0
// mu1 = 1 - mu2;
// x = (1 - mu2) * p1 + mu2 * p2
// = p1 + mu2 * (p2 - p1)
// x = s + a * r (s := start, r := end - start)
... | ALGO | 0.999472 | 6.308574 |
5a36acf8-0a43-45f6-98ee-1b363e61fecd | dodgevipert56/FlockingFinal_ASE | src/Flock.cpp | #include "Flock.h"
#include "NGLScene.h"
#include <ngl/Random.h>
Flock::Flock()
{
}
void Flock::cohesion()
{
ngl::Vec3 center;
for(size_t i=0; i<m_boidCollection.size(); ++i)
{
for(auto m:m_boidCollection[i]) // all of the cones
{
center += m->pos;
}
center /=... | ALGO | 0.992278 | 3.572822 |
255e8be7-f52f-4469-b54d-9b19f34c9cc2 | swarnim3103/ADA | dynamic programming/knapsack.cpp | #include <iostream>
#include <set>
#include <vector>
using namespace std;
set<pair<int, int>> mergePurge(set<pair<int, int>>& s1, set<pair<int, int>>& s2, int W) {
set<pair<int, int>> s3;
auto i = s1.begin();
auto j = s2.begin();
while (i != s1.end() && j != s2.end()) {
if (i->first < j->first) ... | ALGO | 0.999998 | 4.959433 |
17f76590-30f9-4258-9ed7-42f33230a3dc | pusnik/robot-human-follower | Tracker/src/boost_1_49_0/libs/math/example/negative_binomial_example1.cpp | // negative_binomial_example1.cpp
// Example 1 of using negative_binomial distribution.
//[negative_binomial_eg1_1
/*`
Based on [@http://en.wikipedia.org/wiki/Negative_binomial_distribution
a problem by Dr. Diane Evans,
Professor of Mathematics at Rose-Hulman Institute of Technology].
Pat is required to sell candy ... | ALGO | 0.999196 | 7.27598 |
064e7b49-59c9-44a0-9aca-aade66af851d | briandrawert/SPH-BVF | src/MISC/compute_msd_nongauss.cpp | /* ----------------------------------------------------------------------
Contributing authors: Rob Hoy
------------------------------------------------------------------------- */
#include <cstring>
#include "compute_msd_nongauss.h"
#include "atom.h"
#include "update.h"
#include "group.h"
#include "domain.h"
#incl... | ALGO | 0.999475 | 6.015337 |
115a4f14-a055-4029-a30a-6442dcf50d92 | saurabh-kd-singh/GFG160 | 2.Strings/17.NonRepeatingCharacters/NonRepeatingCharacters.cpp | #include <vector>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
char nonRepeatingChar(string &s)
{
int charCount[26] = {0};
int n = s.length();
for (int i = 0; i < n; i++)
{
charCount[s[i] - 'a']++;
}
for (int i = 0; i < n; i++)
{
if (cha... | ALGO | 0.998574 | 3.882997 |
b63e99db-5f43-4c53-a87c-ead39333bf6f | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_11802_6.cpp | #include <bits/stdc++.h>
using namespace std;
long long fpm(long long b, long long e, long long m) {
long long t = 1;
for (; e; e >>= 1, b = b * b % m) e & 1 ? t = t * b % m : 0;
return t;
}
template <class T>
inline bool chkmin(T &a, T b) {
return a < b ? a = b, true : false;
}
template <class T>
inline bool c... | ALGO | 0.999929 | 4.011703 |
6590cd85-d4d9-4b89-8d5d-6b94e083b33e | reokoizumi/kyoupro | arugohon/sample/13syou/13-4.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
template<class T> void chmax(T& a, T b) { if (a < b) a = b;}
template<class T> void chmin(T& a, T b) { if (a > b) a = b;}
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
const int INF = 1e+8;
... | ALGO | 0.999979 | 5.019389 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.