uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5e98d07e-24ea-4920-b897-418e879c8bec | shubham035/Recursion-and-Backtracking | combination_78_leetcode.cpp | // 78 LEETCODE combination
class Solution {
vector<vector<int>> v;
void solve(vector<int> &nums, vector<int> output,int i,int n ){
// base case
if(i==n){
v.push_back(output);
return;
}
// recursive block
vector<int> ... | ALGO | 0.999825 | 6.111633 |
5ffe2103-9e76-45e3-a3e6-dd0cfa8e9114 | spfrood/CPP-references | Chapters/Assignment_5/programs/Gaddis_8thEd_Chap6_Prob6_KineticEnergy/main.cpp |
/*
* File: main.cpp
* Author: Scott Parker
* Created on February 2, 2017, 9:47 AM
* Purpose: 6. Kinetic Energy
In physics, an object that is in motion is said to have kinetic energy. The
following formula can be used to determine a moving object’s kinetic energy:
* KE = 1/2 m v^2
The variables in the formula... | TOOL | 0.923331 | 5.983144 |
06781922-edfe-4889-b31f-35100b57f093 | ishandutta2007/codeforces | sexpert/normal/1070/H.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> getsubstrings(string s){
set<string> myset;
for(int i=0;i<s.length();i++){
for(int j=1;j+i<=s.length();j++){
string aux = s.substr(i, j);
myset.insert(aux);
}
}
vector<string> ret;
for(auto v:myset)... | ALGO | 0.999691 | 3.877933 |
37648fb9-8414-4728-9b8e-31e421e729a7 | divanshu31/Leetcode | 908-middle-of-the-linked-list/middle-of-the-linked-list.cpp | class Solution {
public:
ListNode* middleNode(ListNode* head) {
ListNode* slowGulli = head;
ListNode* fastGulli = head;
while(fastGulli != NULL && fastGulli -> next != NULL){
slowGulli = slowGulli -> next;
fastGulli = fastGulli->next->next;
}
return slowGulli... | ALGO | 0.999807 | 5.70846 |
3c771353-d2cd-41b8-a56c-9009443a564f | RoseAlice2018/Algorithm2024 | 分类/二叉树/填充每个节点的下一个右侧节点指针.cpp | #include<vector>
#include<stack>
#include<queue>
#include<string>
#include<unordered_map>
#include<unordered_set>
using namespace std;
struct ListNode{
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x):val(x), next(nullptr) {}
ListNode(int x, ListNode *next):val(x), next... | ALGO | 0.999866 | 5.216007 |
d8d8de27-d5df-4748-bba6-23b14cf54f4c | kishanrajput23/Love-Babbar-CPP-DSA-Course | Lectures/Lecture_19/Lecture_Codes/Set/set.cpp | #include<iostream>
#include<set>
using namespace std;
int main() {
set<int> s;
s.insert(5);
s.insert(3);
s.insert(3);
s.insert(3);
s.insert(1);
s.insert(4);
s.insert(2);
s.insert(2);
cout<<"set elements are : ";
for (auto i : s) {
cout<<i<<" ";
}
cout<<endl... | ALGO | 0.986698 | 4.280976 |
a3e344ac-d04a-46f3-a141-755a28be8678 | mailtoharutyunyan/LeetCode-Solutions | solutions/1528. Shuffle String/1528.cpp | class Solution {
public:
string restoreString(string s, vector<int>& indices) {
string ans(s.length(), '.');
for (int i = 0; i < indices.size(); ++i)
ans[indices[i]] = s[i];
return ans;
}
};
| ALGO | 0.997364 | 6.308073 |
8e0fbad2-8436-4514-97bd-ac3c1696ad27 | shu8Cream/atcoder-archive | atcoder.jp/abc190/abc190_a/Main.cpp | /**
* author: shu8Cream
* created: 30.01.2021 20:41:54
**/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
cin.tie(nullp... | ALGO | 0.999868 | 4.643406 |
56cad1fb-4032-4c15-bf34-43a95e0de346 | xyi1023/ShanghaiTech-CS171-final-project | libs/glm/test/gtx/gtx_simd_mat4.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentatio... | TEST | 0.983288 | 6.515547 |
4b9fb883-1b5a-4129-b99b-715ed358ca6a | mn619/cf-practise | E. Subsegments.cpp | #include<bits/stdc++.h>
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define pb push_back
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define FILEIO freopen("/home/aman/Desktop/Kachda/input.txt", "r", stdin); freopen("/home/aman/Desktop/Kachda/output.t... | ALGO | 0.999671 | 3.049073 |
6db7908a-9a32-469b-925e-ab818118a7d6 | staglibrary/stagpy | stag/eigen-3.4.0/doc/examples/tut_matrix_resize.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
MatrixXd m(2,5);
m.resize(4,3);
std::cout << "The matrix m is of size "
<< m.rows() << "x" << m.cols() << std::endl;
std::cout << "It has " << m.size() << " coefficients" << std::endl;
VectorXd v(2);
v.resize(5);
... | ALGO | 0.963278 | 3.882785 |
59d15f29-d537-4af8-9ca9-1f613041b773 | ishandutta2007/codeforces | chenjb/normal/1185/A.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#define rep(i,n) for(int i=1;i<=n;++i)
#define mp make_pair
#define pb push_back
using namespace std;
int main()
{
long long a,b,c,d;
cin>>a>>b>>c>>d;... | ALGO | 0.999592 | 3.469004 |
9d702a03-a07f-44e2-ba78-458bb3d8a662 | jin3811/BAEKJOON | 1456.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MAX = 10000001;
int main () {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
vector<ll> prime;
bool* seive = new bool[MAX];
fill(seive, seive + MAX, true);
seive[0] = seive[1] = false;
for(ll i = 2; ... | ALGO | 0.99982 | 4.598137 |
49ec238b-9c6b-4c32-b9fb-b28d1640129f | reetikasinghh/Pointer-BASICS- | exp8.pointer.cpp | #include <iostream>
using namespace std;
// Function to increment an integer using a pointer
void increment(int *a)
{
(*a)++; // Increment the value pointed to by 'a'
}
// Function to swap two integers using pointers
void swap(int *a, int *b)
{
int t;
t = *a; // Store the value pointed to by 'a' in 't'
... | ALGO | 0.999454 | 5.987911 |
bb1cffe1-bbb3-47f8-8b46-b4ce81d641db | kmjp/procon | codeforce/951-1000/978/d2.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.999812 | 3.734136 |
c6e528e0-7959-4c0b-bdf1-29491e872dda | exopeng/Competitive-Programming | CSES/lis.cpp | #include <bits/stdc++.h>
using namespace std;
//store test cases here
/*
*/
const long long INF = 10000000000;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<long long> a;
vector<long long> d;
for (int i = 0; i < n; i++) {
int b;
cin >> b;
a.pu... | ALGO | 0.999988 | 4.632559 |
813ddce1-4d7e-4827-8cad-2bc6f8d97fd6 | Shivanshu840/POTD | 3372-longest-strictly-increasing-or-strictly-decreasing-subarray/3372-longest-strictly-increasing-or-strictly-decreasing-subarray.cpp | class Solution {
public:
int longestMonotonicSubarray(vector<int>& nums) {
int len = 0;
int count = 0;
for(int i = 1; i<nums.size();i++){
if(nums[i]>nums[i-1]){
count++;
len = max(count,len);
}else{
count = 0;
... | ALGO | 0.999887 | 5.841154 |
ae177db6-97fa-4f11-a9ce-679d01e69552 | saadrafi/XPSC | week06/day5/H_Sum_of_Cubes.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
vector<long long> cubes;
for (long long i = 1; i <= 10000; i++)
{
cubes.push_back(i * i * i);
}
int t;
cin >> t;
while (t--)
{
long long x;
cin >> x;
... | ALGO | 0.999898 | 4.81724 |
7252baaa-7143-49be-aaef-7b8329abcd8a | xdtianyu/android-4.2_r1 | frameworks/av/media/libstagefright/codecs/amrnb/common/src/gc_pred.cpp | /*
Pathname: ./audio/gsm-amr/c/src/gc_pred.c
Functions:
gc_pred_reset
gc_pred
gc_pred_update
gc_pred_average_limited
------------------------------------------------------------------------------
MODULE DESCRIPTION
This file contains the functions that perform code... | ALGO | 0.999663 | 6.225616 |
b3c2ca0e-7de0-49ae-9fc8-f1a727b8f4c9 | Ryb7532/AtCoder | submissions/abc180/c.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define vec vector
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout ... | ALGO | 0.999949 | 4.245319 |
886020c0-811c-4332-b91a-72789e468d4f | Daye-Lee18/cplusplus | HW/HW4/graph.cpp | #include <iostream>
#include "graph.h"
void Vertex::AddToAdjacentList(Vertex* vertex){
//TODO: Add 'vertex' to adjacency list (class member)
adjacency_list_.push_back(vertex);
}
Graph::~Graph(){
for (auto vertex: vertices_) delete vertex; // 할당된 메모리를 지우고
vertices_.clear(); // vector안의 원소들도 지움
}
Ve... | ALGO | 0.965024 | 5.009857 |
1379f859-fbe2-437c-905b-9f5d1666c8a5 | ancoreraj/DataStructure-Algorithm | Queue/FirstNonRepeatingCharProblem.cpp | #include<iostream>
#include<queue>
using namespace std;
//First Non Repeating Character in a Running Stream of Characters
int main(){
queue<int> q;
int freq[27] = {0};
//running a stream until a '.'
char ch;
cin>>ch;
while(ch!='.') {
//logic will go here
//insert in the q and... | ALGO | 0.999725 | 3.896517 |
fe256108-2be3-4e37-b00f-655f1f189cb5 | red4game/AES_MPC | FHEOffline/PairwiseGenerator.cpp | /*
* PairwiseGenerator.cpp
*
*/
#include "FHEOffline/PairwiseGenerator.h"
#include "FHEOffline/PairwiseMachine.h"
#include "FHEOffline/Producer.h"
#include "Protocols/SemiShare.h"
#include "GC/SemiSecret.h"
#include "GC/SemiPrep.h"
#include "Protocols/MAC_Check.hpp"
#include "Protocols/SemiInput.hpp"
#include "Pro... | TOOL | 0.947546 | 6.814385 |
9c683b43-3b98-47cf-8848-782971841f2d | rupi8/WISE | workspace/llm_framework/main_tts/src/runner/eigen-3.4.0/bench/perf_monitoring/trmv_up.cpp | #include "gemv_common.h"
EIGEN_DONT_INLINE
void trmv(const Mat &A, const Vec &B, Vec &C)
{
C.noalias() += A.triangularView<Upper>() * B;
}
int main(int argc, char **argv)
{
return main_gemv(argc, argv, trmv);
}
| ALGO | 0.965598 | 4.868302 |
c56d684a-ffa9-465d-b408-cf27aa1bd5b3 | xiaozhang521/NiuTrans.ST | source/niutensor/tensor/core/math/Unary.cpp | /*
* $Created by: Xu Chen (email: <EMAIL>) 2018-07-31
*/
#include <math.h>
#include "../../XName.h"
#include "../shape/IsSameShaped.h"
#include "Unary.h"
#include "Unary.cuh"
namespace nts{
template<class T>
T UnaryNegate(T x) {
return (T)-x;
}
template<class T>
T UnarySquare(T x)
{
return (T)(x * x);
}... | TOOL | 0.952269 | 6.635534 |
67c87e50-6a0a-4251-bc46-68f65a131e74 | Beatrix-0/Competitive-Programming | DSA Series/Babbar/Pointer/Lecture026 Pointers with Arrays and Functions/1_Pointers_And_Array.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int arr[10] = {23, 122, 41, 67};
cout << "Address of first memory block is : " << arr << endl;
cout << "arr[0] : " << arr[0] << endl;
cout << "Address of first memory block is : " << &arr[0] << endl;
cout << "Step 4th : " << *arr << end... | TOOL | 0.983146 | 3.19677 |
1a749851-f16c-4042-b6b1-dee7a2770f09 | thegamer1907/Code_Analysis | Codes/AC/2070.cpp | #include <bits/stdc++.h>
#include <unordered_map>
#define F first
#define S second
using namespace std;
typedef long long ll;
ll cel(ll x,ll y){
if(x%y==0)return x/y;
return x/y+1;
}
ll POW(ll x,ll y){
if(y==0)return 1;
if(y==1)return x;
ll ans=POW(x,y/2);
ans*=ans;
if(y%2==0)... | ALGO | 0.99969 | 3.425506 |
ad2854e4-fdba-4174-aa26-c9b1f8f65fdb | mukuldeep/cs | cp/CSES/cses_2205.cpp | //
// Created by me on 30-10-2020.
//
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void soln(ll t){
ll n,nb;
cin>>n;
nb=n;
n=1<<n;
for(ll i=0;i<n;i++){
cout<<(bitset<16> (i^(i>>1)).to_string()).substr(16-nb,nb)<<endl;
}
}
int main() {
ll t=1;
// cin>>t;
... | ALGO | 0.999791 | 4.366171 |
e9e888b6-07da-42a3-9b9d-d1beba29b1db | saiharishavula/Competitve-Coding | Hackerrank/Untitled3.cpp | #include<iostream>
#include<stdio.h>
#include<algorithm>
#include<climits>
using namespace std;
int main()
{
long long int n,a,i,k=0,l=0,min=INT_MAX,j;
char s[10];
scanf("%11d",&n);
long long int p[n+1];
for(i=1;i<=n;i++)
{
scanf("%s",&s);
if(s=="PUSH")
scanf("%11d",&a);
if(s=="PUSH")
p[k++]... | ALGO | 0.999446 | 3.581289 |
6d5a698d-fb26-47d0-96b2-f9f1bf396662 | tangjz/Three-Investigators | 2017-09-24/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define pii pair<int, int>
#define all(a) a.begin(), a.end()
typedef long long ll;
const int inf = 1e9;
int n, m;
int b[10000];
ll p[10000];
ll ans[10000];
int main(){
scanf("%d%d", &n, &m);
f... | ALGO | 0.999643 | 3.191328 |
79fb577b-4e79-4f94-b3e0-efb4b0f6d130 | priyanshuanandd/Code_Submissions | NthRootBS.cpp | #include <bits/stdc++.h>
using namespace std;
auto eps = 1e-15;
double multiply(double n, double k)
{
double ans = 1;
for (int i = 0; i < k; i++)
{
ans = ans * n;
}
return ans;
}
int main()
{
double n;
cin >> n;
double p;
cin >> p;
double lo = 0;
double hi = n;
... | ALGO | 0.999845 | 4.341217 |
cd3ef153-05c8-41ea-8fc4-3afe2d9a4329 | sanket0708/SdeSheet | 56-merge-intervals/56-merge-intervals.cpp | class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
vector<vector<int>> ans;
if(intervals.size()==0) return ans;
sort(intervals.begin(),intervals.end());
ans.push_back(intervals[0]);
int j = 0;
for(int i=1;i<... | ALGO | 1 | 6.030611 |
b614b3e4-01ff-4587-8787-f70b9c848fd9 | Pasorra/leetcode | cpp/168. Excel Sheet Column Title/Solution.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution
{
public:
string convertToTitle(int columnNumber)
{
string result = "";
while (columnNumber > 0)
{
int val = (columnNumber - 1) % 26 + 1;
result += static_cast<char>(va... | ALGO | 0.999885 | 5.425487 |
ca7fee30-eff9-4d14-956e-083ab98f4290 | hareshav/Data_structures | Data_structures/AVL_TREE/main.cpp | #include <iostream>
class Node{
public:
Node *left;
int val;
int height;
Node *right;
}*root;
int Height(Node *p){
if(p){
int x=Height(p->left);
int y=Height(p->right);
if(x>y){
return x+1;
}
return y+1;
}
return 0;
}
int balanced(Node *p){... | ALGO | 0.999971 | 5.016091 |
20fe4617-2ac1-4d43-84ff-1e87868c26c0 | Alambabus/STL-code | STL and Pair/functionTemplate.cpp | #include<iostream>
using namespace std;
template <typename T>
/*T myMax(T a,T b)
{
return a>b?a:b;
}*/
T maxElementFromArray(T arr[],T n)
{
T maxi=INT_MIN;
for(int i=0;i<n;i++)
if(arr[i]>maxi)maxi=arr[i];
return maxi;
}
int main()
{
/* cout<<myMax<int>(10,20)<<endl;
cout<<myMax<char>('c',... | ALGO | 0.997717 | 4.107581 |
d9e4b6d8-161c-4827-af3f-a29caf9dab0a | Tarakk/plumed2-CuMD | patches/gromacs-2016.3.diff/src/programs/mdrun/runner.cpp | /*! \internal \file
*
* \brief Implements the MD runner routine calling all integrators.
*
* \author David van der Spoel <<EMAIL>>
* \ingroup module_mdlib
*/
#include "gmxpre.h"
#include "runner.h"
#include "config.h"
#include <assert.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <al... | ALGO | 0.998525 | 4.695445 |
a199ea39-16c0-47c3-abfa-3cfbf1c4fdd8 | fangjinxia/leetcodeOJ | leetcodeOJ/557_ReverseWordsinaStringIII.cpp | class Solution {
public:
string reverseWords(string s) {
string ans = "";
int pos = 0;
int idx = 0;
while((idx = s.find(' ', pos)) != string::npos){
string str = s.substr(pos, idx-pos);
reverse(str.begin(), str.end());
ans += str;
ans +... | ALGO | 0.999975 | 6.150432 |
e19ae442-4a1b-43d9-bc0b-92e7e7d152b2 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5484_3.cpp | #include <bits/stdc++.h>
using namespace std;
string a[103];
int ans;
vector<int> V;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
bool test = false;
while (test == false) {
test = true;
ans++;
for (int i = 0; i < n - 1; i++) {
... | ALGO | 0.999997 | 3.244917 |
1f013ce2-82ca-4c40-a62c-d938106905d2 | denis-gubar/Leetcode | Array/1186. Maximum Subarray Sum with One Deletion.cpp | class Solution {
public:
int maximumSum(vector<int>& arr) {
int const INF = 1 << 30;
int d0 = -INF, d1 = -INF;
int result = -INF;
for (int x : arr)
{
int nd0 = max(d0 + x, x);
int nd1 = max(d1 + x, d0);
d0 = nd0, d1 = nd1;
resul... | ALGO | 0.999903 | 5.814434 |
fe275ddf-84ca-47cf-9f56-57361d5ddb13 | raikrahul/scale_algo_examples | vertPart.cpp | #include <iostream>
#include <vector>
// Structure representing a row in the table
struct Row {
int id;
std::string staticData;
std::string dynamicData;
};
// Function to split a row into static and dynamic parts
std::pair<std::string, std::string> splitRow(const Row& row) {
// Split the row based on ... | TOOL | 0.988648 | 6.741868 |
15670737-e591-4fdc-9c31-3c10a9038bec | pozorvlak/llvm-branchpred | lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | #include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/Target/TargetLowering.h"
using namespace llvm;
namespace {
class VectorLegalizer {
SelectionDAG& DAG;
const TargetLowering &TLI;
bool Changed; // Keep track of whether anything changed
/// LegalizedNodes - For nodes that are of legal width, and that have m... | ALGO | 0.960818 | 7.831363 |
472e9c27-c99b-428a-b5b1-b8896ffc6e6e | yatharthg07/Leetcode_dsa | my-folder/0162-find-peak-element/solution.cpp | class Solution {
public:
int findPeakElement(vector<int>& nums) {
int i=1;
int n=nums.size();
int j=n-2;
if(n==1)
{
return 0;
}
if(nums[0]>nums[1])
{
return 0;
}
else if(nums[n-1]>nums[n-2])
{
... | ALGO | 0.999988 | 5.355906 |
821e388a-900c-4d56-a953-c68bef1e5a69 | raincross7/code-similarity | codes/train_code/problem480/problem480_144.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using Edge = pair<int, long long>;
using Graph = vector<vector<Edge> >;
// K から各点 v への距離 dist[ v ]
void rec(const Graph &G, int v, int p, long long sum, vector<long long> &dist) {
dist[v] = sum;
for (auto e : G[v]) {
if (... | ALGO | 0.999883 | 4.820852 |
4372b435-5fd0-4f33-be8c-1d0467a9d4b6 | Monday1515/Dominik_Durlik | Lab1/zad1/Lab1_CPP.cpp | #include <iostream>
class Car {
private:
std::string make;
std::string model;
int year;
int currentYear;
public:
Car() {
make = "";
model = "";
year = 0;
currentYear = 2023;
}
Car(
std::string make,
std::string model,
... | TOOL | 0.884394 | 6.312753 |
b254ef7b-3c95-4c75-9f05-38316bfdd48c | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2560_2.cpp | #include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) { return a.first > a.first; }
int main() {
int n, w;
cin >> n >> w;
int a[n];
int sum = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += ceil((a[i] * 1.0) / (2.0));
}
if (sum > w)
cout << -1;
else ... | ALGO | 0.999991 | 3.648423 |
0664aa33-95c1-41ed-be1e-6ca0461a8745 | HSarham/Open3D-0.9.0 | 3rdparty/Eigen/doc/examples/class_Block.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::Block<Derived>
topLeftCorner(MatrixBase<Derived>& m, int rows, int cols)
{
return Eigen::Block<Derived>(m.derived(), 0, 0, rows, cols);
}
template<typename Derived>
const Eigen::Block<const Derive... | TOOL | 0.947955 | 5.865374 |
ebbf66b0-f1da-4d82-8128-49bb8ae7cbf8 | praneshp1org/DSA-II-II | sorting/merge.cpp | #include <stdio.h>
#define MAX 50
void display(int a[MAX], int len)
{
int i;
for(i=0; i<len; i++)
{
printf("\t %d", a[i]);
}
}
void merge(int a[MAX], int left, int mid, int right)
{
int i=0, k, p, temp[MAX];
k=left, p=mid+1;
while(left<=mid&&p<=right)
{
if(a[left]<a[p])
{
temp[i++]=a[l... | ALGO | 0.999988 | 4.10774 |
da8a9cea-86d7-468e-a113-58eeb233be38 | VC6378/Codeforces | Chef_and_Icecream.cpp | #include <bits/stdc++.h>
using namespace std;
//Speed
#define fastio() ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int32_t main()
{
int t;
cin>>t;
while(t-->0){
int n;
cin>>n;
int arr[n];
for(int i=0; i<n; i++){
cin>>arr[i];
}
... | ALGO | 0.999582 | 5.350028 |
84044b25-08a7-48aa-91ae-7ea9ec764b65 | axelu/leetcode | cpp/03000-03499/counttripletswithevenxorsetbitsii.cpp |
// 3215. Count Triplets with Even XOR Set Bits II
// https://leetcode.com/problems/count-triplets-with-even-xor-set-bits-ii/
/* goal is to find all triplets that after doing XOR have an even number of set bits
* if we have 2 numbers with even set bits, after doing XOR we still have even number of set bits always
* ... | ALGO | 0.999879 | 6.424526 |
aaff133b-2345-455b-9138-1e7a9a5b6918 | YuvrajSahni/DSA-Practice | Arrays/sorted_array_efficient.cpp | #include <iostream>
using namespace std;
bool sorted(int arr[], int n)
{
for(int i=0;i<n;i++)
{
if(arr[i]>arr[i+1])
{
return false;
}
}
return true;
}
int main()
{
int x[]={2,5,12,11,23};
cout<<sorted(x,5);
return 0;
} | ALGO | 0.999637 | 4.7977 |
5bead4b7-b3b8-4d6f-8cb2-e80fde508548 | BaoZhuhan/Awesome-SE-Box | 00课程技术栈/ACMTrain/Completetion/NewconderGame/20240218/小红的01串.cpp | #include <bits/stdc++.h>
using namespace std;
string a;
int sorce = 0;
struct node
{
int cnt;
int cnt2;
int cot;
};
void bfs()
{
queue<node> q;
node root;
root.cnt = 0;
root.cnt2 = root.cnt;
root.cot = sorce;
q.push(root);
while (!q.empty())
{
node now = q.front... | ALGO | 0.999995 | 4.330464 |
b2ae776b-0c7f-4f04-95bf-f738bd411a2f | vsharkovski/Competitive-Programming | Programs/Codeforces/954D - Fight Against Traffic.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<ll> vl... | ALGO | 0.999527 | 4.92665 |
d1943d36-38ae-4b89-a2e9-45223c0c1ca8 | mayankkaushik187/AlgoViser | LinkedList/lengthOfLoop.cpp | //Function to find the length of a loop in the linked list.
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *next;
Node(int x)
{
data = x;
next = NULL;
}
};
int countNodesHelper(Node *ptr)
{
int count = 1;
Node *temp = ptr;
while (temp->next !=... | ALGO | 0.99989 | 4.554412 |
79e8c3ab-8824-4a0f-a8e6-d28f0bc42c68 | sandeshsuryawanshi/sms-LeetCode | 2439-minimize-maximum-of-array/2439-minimize-maximum-of-array.cpp |
class Solution {
public:
int minimizeArrayValue(vector<int>& nums) {
long ans = 0;
long res = 0;
for(int i = 0;i<nums.size();i++){
ans += nums[i];
res = max(res, (ans+i)/(i+1));
cout<<res;
}
return res;
}
}; | ALGO | 0.999975 | 5.393784 |
c1c5fe9e-1fbb-4ca8-96ab-77b4cff3bced | ishandutta2007/codeforces | datastructures/normal/1280/D.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#define int long long
#define inf 1000000000000000
using namespace std;
struct node{
int a,b;
node operator +(const node &x)const{
node ans;
ans.a=a+x.a;
ans.b=b+x.b;
return ans;
}
bool operator <(const node &x){
return (a<x.a)||(a==x.a&&b<x.b);
}
... | ALGO | 0.999951 | 3.421821 |
fa52af8d-9e33-4af2-afd4-80579247503b | alloranicole/PrintQueue | waitingQueue.cpp | /* Group Number: 1
Members: Geoffrey, Taylor
File Description:
Contains the implimentation for the class
waitingQueue, which represents a queue
of printRequestType items. This queue is
special in one way: it must be able to
reorganize itself so that it is so... | ALGO | 0.994508 | 5.159445 |
505f9d33-a128-4553-8c92-aa726d716732 | StuntStorm/Program-Collection | C++ Programs/BellmanFordAlgorithm.cpp | //BellmanFordAlgorithm
#include<iostream>
using namespace std;
struct edge
{
int u;
int v;
int wt;
};
struct edge e[100001];
int dist[100001];
int main()
{
int i, j, n, m, u, v, wt;
cin>>n>>m;
for(i=1;i<=m;i++)
{
cin>>u>>v>>wt;
e[i].u=u;
e[i].v=v;
e[i].wt=wt;
... | ALGO | 0.999993 | 4.236841 |
a369ab25-d5fe-41b6-b771-acd7c625d325 | KTS-o7/Leetcode_Journey | LeetcodeSolutions/Prob0042_TrappingRainWater.cpp | // Approach: Using two arrays to track height
class Solution {
public:
int trap(vector<int>& height) {
vector<int>leftMaxHeight(height.size()), rightMaxHeight(height.size());
int size = height.size(), water = 0;
leftMaxHeight[0] = height[0];
rightMaxHeight[size-1] = height[size-1];
... | ALGO | 0.999996 | 7.273644 |
65e84f80-a0a7-4f70-aa85-8668d04cbe73 | gajgeospatial/boost_1_73_0 | libs/multiprecision/test/constexpr_test_cpp_int_7.cpp | // Contains Quickbook snippets used by boost/libs/multiprecision/doc/multiprecision.qbk,
// used in section Literal Types and constexpr Support, last example on constexpr randoms.
// A implementation and demonstration of the Keep It Simple Stupid random number generator algorithm https://en.wikipedia.org/wiki/KISS_(al... | TOOL | 0.911823 | 6.230577 |
572fb6c7-0165-4ffc-a68f-920cda591c80 | ShivamDhamija/leetcodeQuestions | 0491-increasing-subsequences/0491-increasing-subsequences.cpp | class Solution {
public:
set<vector<int>>s;
int a=0;
bool check(vector<int>&v)
{
for(int i=1;i<v.size();i++)
{
if(v[i]<v[i-1])return false;
}
return true;
}
void call(vector<int>& n,vector<int>& v,int i)
{
if(v.size()>1)
s.inser... | ALGO | 0.999991 | 5.636506 |
b41f0bc8-41f9-45dc-9dad-cad460e2df1c | Ghanmohan/Questions_practice | Divide and Conquer/p1.cpp | #include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout); f
#endif
int i, j, count = 0, ans = 0;
string s;
cin >> s;
int n = s.size();
int arr... | ALGO | 0.999922 | 3.924273 |
80382de5-8173-41d5-a916-589d80598842 | heysujal/Leetcode-v2 | 1493-frog-position-after-t-seconds/1493-frog-position-after-t-seconds.cpp | class Solution {
public:
// observation
// while going down multiply with 1/edge_count <= for unvisited nodes only
double frogPosition(int n, vector<vector<int>>& edges, int t, int target) {
vector<vector<int>> adjList(n+1); //adjList
vector<bool> vis(n+1,0);
for(auto e : edges){
... | ALGO | 0.999939 | 6.47281 |
773ceddf-6392-40d6-95e9-a6263074e3e4 | viiccwen/Competitve-programming | AP325/d002.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
string s;
ll rec();
ll h() {
ll x = rec(), y = rec(), z = rec();
return 3 * x - 2 * y + z;
}
ll g() {
ll x = rec(), y = rec();
return 2 * x + y - 7;
}
ll f() {
ll x = rec();
return 2 * x - 3;
}
ll rec() {
cin >> s;
if (s == "f")
... | ALGO | 0.999656 | 3.952986 |
61a6a3c5-53f7-4cf4-ab55-a6c1af2a5630 | edge555/Online-Judge-Solves | Codeforces/1341/A. Nastya and Rice.cpp | #include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%ll... | ALGO | 0.998592 | 3.593951 |
5ca8f8fe-0b42-41dd-9cc7-f3cf0d2b96e7 | zwshen/notes-learning | skills/Acm/Others/chchwyacm/common_algo/prime_factor.cpp | #include<iostream>
#include<vector>
using namespace std;
/**
* 判斷a是不是質數
*/
bool isprime(int a) {
if (a==2) return true; // 2 is prime
if (a%2==0) return false; // but 2's times is not prime
for (int i=3;i*i<=a;i+=2)
if (a%i==0) return false;
return true;
}
/**
* 列出a所有的質因數
*/
vector<int> ... | ALGO | 0.994148 | 3.152689 |
571c544c-ae83-4972-9c69-33dc7c3fdb06 | MerzhvinskiyD/Limit_order_book | c_map.cpp | #include <chrono>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include "rapidjson/document.h"
#include "rapidjson/error/en.h"
enum class Event { undef, error, ping, update, snapshot };
class Limit_order_book {
public:
Limit_order_... | DATA | 0.905247 | 5.514115 |
5d4e338b-208a-4197-aa21-d4e8454aaab3 | Ahnaf-41M/Codeforces_AtCoder | atcoder/abc177/B.cpp | #include<bits/stdc++.h>
#define pb push_back
#define endl "\n"
#define ll long long
#define W(t) while(t--)
#define clr(a) memset(a,0,sizeof(a))
#define rep(i,a,b) for(i = a; i < b; i++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
int main()
{
IOS
... | ALGO | 0.99999 | 3.798299 |
5651586c-e7fb-4def-877f-bc0b4119b17e | ScallyBag/SugaR | src/main.cpp | #include <iostream>
#include "bitboard.h"
#include "position.h"
#include "polybook.h"
#include "search.h"
#include "thread.h"
#include "tt.h"
#include "uci.h"
#include "syzygy/tbprobe.h"
namespace PSQT {
void init();
}
int main(int argc, char* argv[]) {
std::cout << engine_info() << std::endl;
UCI::init(Opti... | TOOL | 0.883686 | 4.932847 |
cd67dc89-fc8b-44b5-b6a6-74c302729ddb | ChetanPatel1999/hw_cpp_100 | 12_pattern.cpp | #include <iostream>
using namespace std;
int main()
{
int i, j;
for (i = 1; i <= 5; i++)
{
for (j = 1; j <= i; j++)
{
cout<<"* ";
}
cout<<endl;
}
return 0;
} | ALGO | 0.999455 | 3.602286 |
32fa9bec-b502-4219-a612-9ae3a8a9c499 | Hiyabye/Baekjoon | 10xxx/10599.cpp | #include <iostream>
using namespace std;
bool solve(void) {
int a, b, c, d; cin >> a >> b >> c >> d;
if (a == 0 && b == 0 && c == 0 && d == 0) return false;
cout << c-b << " " << d-a << "\n";
return true;
}
int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
while (solve());
return 0;
} | ALGO | 0.998487 | 3.948886 |
056377f1-f616-42f3-8ad9-ecc2c0707e7c | bvquoc/ICPC-Training | ieeextreme16/travel-service.cpp | #include <iostream>
#include <deque>
#define int long long
#define INF 1e18
using namespace std;
int s, c;
int f[10005];
int r[10005];
int res[10005];
int32_t main()
{
int T;
cin >> T;
while (T--)
{
cin >> s >> c >> r[0];
deque<int> dq;
for (int i = 1; i <= s; i++)
{
... | ALGO | 0.999855 | 3.378824 |
097d981f-e087-4d95-b14b-05a984482751 | thirisha3sha/c-programming | power recursion.cpp | #include<stdio.h>
int power(int base,int a);
int main()
{
int base,a,result;
printf("enter the base:");
scanf("%d",&base);
printf("enter the power number:");
scanf("%d",&a);
result=power(base,a);
printf("\n power %d ^ %d is:%d ",base,a,result);
return 0;
}
int power(int base,int a)
{
if(a!=0)
{
return (bas... | ALGO | 0.999658 | 3.945432 |
6179d52d-4837-4e07-a6bd-cb70b3c2faae | loceaner/OI_Code | luogu/luogucf409d.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
scanf("%d",&n);
switch(n){
case 1:cout<<"1";break;
case 2:cout<<"0";break;
case 3:cout<<"0";break;
case 4:cout<<"1";break;
case 5:cout<<"0";break;
case 6:cout<<"1";break;
case 7:cout<<"0";b... | ALGO | 0.999896 | 3.10871 |
7a91f0ae-63e5-4097-87b0-b60a411e280a | rabbitCase/dsa-practice | Arrays and Math/Leetcode/Medium/minCostPath.cpp | //Leetcode Medium 64
//Recursively solve the problem (subproblem) for the new matrix obtained when we move row wise or column wise. Use memoization to speed up repetitive function calls
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int minPathSum(vector<vector<int>>& grid) {
... | ALGO | 0.999944 | 5.980304 |
0f9b66a5-30dc-4975-9c2e-5eb8519da6f8 | kurumishka/problems | 1676/G.cpp | #pragma GCC optimize("O2")
#include <bits/stdc++.h>
template<class T>
using V = std::vector<T>;
using namespace std;
#define endl "\n"
#define pb push_back
#define all(x) x.begin(),x.end()
#define ANS ((int)1e9+7)
map<int, set<int>> m;
map<int,int> cols;
int ans;
inline int dfs(int node = 1) {
int bal = cols[nod... | ALGO | 0.999948 | 4.617443 |
5aadf983-159c-42fa-bd72-a29da635b7e3 | TitoKilonzo/shift_master | OneDrive/Documents/shift_master/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.997456 | 6.772262 |
138207b4-7ab8-4493-b983-e565a44be62c | toufu-24/AtCoder | ABC/ABC344/E2.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define all(v) v.begin(), v.end()
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort(v.rbegin(), v.rend())
#define REVERSE(v) reverse(v.begin(), v.end())
#define ll int64_t
#define ld long double
#define int ll
... | ALGO | 0.999846 | 4.599656 |
3fe9e65a-673c-41f7-8857-368bb8343365 | Return0-iiitdwd/goldman-sachs-sde-sheet | 387_First_Unique_Character_in_a_String.cpp | //first unique character in a string
//approach - 1 //naive approach
//time complexiy: O(N)
//Space compleixity: O(N)
//Here loop traverses the string 2 times, this approach wont be feasible when the string length is too long.
class Solution {
public:
int firstUniqChar(string s) {
unordered_map<char,int>... | ALGO | 0.999778 | 5.848156 |
bd9252a4-13d3-46a7-bef0-765075ab819a | zim2510/Online-Judge-Solves | 2018/Dice III.cpp | #include <bits/stdc++.h>
#define Read() freopen("in.txt", "r", stdin)
#define Write() freopen("out.txt", "w", stdout)
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define TC(i, a, b) for(int i = a; i<=b; i++)
#define FOR(i, a, b) for(int i = a;... | ALGO | 0.992404 | 3.599795 |
cbabd2d5-4dc6-4a0f-91cb-84cb9b8b7ebe | BlueSkyForever/C-Plus-Plus | data_structures/binary_search_tree.cpp | /**
* \file
* \brief A simple tree implementation using structured nodes
*
* \todo update code to use C++ STL library features and OO structure
* \warning This program is a poor implementation - C style - and does not
* utilize any of the C++ STL features.
*/
#include <iostream>
struct node {
int val;
n... | ALGO | 0.999372 | 5.72389 |
38ce65ed-dda1-40a3-bb30-0d508cdc8c3a | danikhan632/vortex_llvm | libcxx/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
// requires ShuffleIterator<Iter>
// && CopyConstructible<Compare>
// void
// stable_sort(Iter first, Iter last, Compare comp);
#include <algorithm>
#include <functional>
#include <vector>
#include <ra... | TEST | 0.993001 | 6.623847 |
9ba83680-5294-4253-907b-b33754e34f2e | alexCao2021/P6 | Bitonic.cpp | vector<int> bitonicSequence(vector<int> array){
sort(array.begin(), array.end());
int n = array.size();
vector<int> ans(n);
int i=0, j=n-1;
int k=0;
while(i<=j){
ans[i] = array[k];
i++; k++;
if(i<j) {ans[j] = array[k];
j--; k++;}
}
return ans;
} | ALGO | 0.999994 | 5.276762 |
47f6ce1b-b6f4-49ef-ac63-b93c4863377d | Garzzza7/zadania | Algos/Kosaraju.cpp | #include <iostream>
#include <map>
#include <stack>
#include <vector>
// https://atcoder.jp/contests/practice2/tasks/practice2_g
// https://codeforces.com/problemset/problem/427/C
template <typename T = int> struct kosaraju {
T n;
std::vector<std::vector<T>> adj;
std::vector<std::vector<T>> rev_adj;
... | ALGO | 0.999895 | 5.130883 |
f0e66ab7-bbc8-412d-a65a-e65b4824c4c0 | sarvex/leetcode-chai | solution/1900-1999/1989.Maximum Number of People That Can Be Caught in Tag/Solution.cpp | class Solution {
public:
int catchMaximumAmountofPeople(vector<int>& team, int dist) {
int ans = 0;
int n = team.size();
for (int i = 0, j = 0; i < n; ++i) {
if (team[i]) {
while (j < n && (team[j] || i - j > dist)) {
++j;
}
... | ALGO | 0.999967 | 5.473316 |
5a9dac0f-5de2-489b-bff4-8a73d902c5c8 | hejmsdz/NonLinear | functions/xe^sqrt(x+1)-1.cpp | #include "function.h"
long double evalFloat(long double x) {
return x * exp(sqrt(x + 1)) - 1;
}
interval evalInterval(interval x) {
return x * exp(sqrt(x + 1.0l)) - 1.0l;
}
| TOOL | 0.941452 | 4.424638 |
7bddf29e-8738-4a34-aea6-259d98c4b4b1 | AniketVelhankar/BE-COMP-Lab-Assignments | DSA/Assignment 9/NPQ.cpp | #include <iostream>
#define MAX 10
using namespace std;
struct queue
{
int data[MAX];
int front,rear;
};
class Queue
{
struct queue q;
public:
Queue()
{
q.front=q.rear=-1;
}
int isempty();
int isfull();
void enqueue(int);
int delqueue();
void display()... | ALGO | 0.995993 | 3.995858 |
9dcf64a3-f9f2-4702-8842-4b3aefe61095 | KhangPham205/ControlStructeExercise | LTHAM/087/087.cpp | #include <iostream>
#include <cmath>
using namespace std;
float Tong(float, int);
int main()
{
float x;
cout << "Nhap x: ";
cin >> x;
int n;
cout << "Nhap n: ";
cin >> n;
cout << "Tong la: " << Tong(x, n) << endl;
return 0;
}
float Tong(float x, int n)
{
float s = 0;
float t = x;
int dau = 1;
int i = 0... | ALGO | 0.999654 | 3.808084 |
4b675889-d5ec-41d4-84d6-8c1cee957b4d | chistyakova-ann/MyWork | src/get_init_state.cpp | #include "../include/get_init_state.h"
int get_init_state(char32_t sym, const State_for_char sts[], int n){
int lower, upper, middle;
lower = 0; upper = n - 1;
while(lower <= upper){
middle = (lower + upper) >> 1;
char32_t c_ = sts[middle].c;
if(sym == c_){
return sts[mid... | ALGO | 0.999054 | 3.842413 |
50355bb4-d8c0-4942-86eb-dc50e0010499 | mateor/pdroid | android-2.3.4_r1/tags/1.32/frameworks/base/media/libstagefright/codecs/m4v_h263/dec/src/pp_semaphore_chroma_inter.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
xpred = x-axis coordinate of the block used for prediction (int)
ypred = y-axis coordinate of the block used for prediction (int)
pp_dec_u = pointer to the post processing semaphore for ... | ALGO | 0.998435 | 6.569502 |
997d5b43-f677-4936-a052-2531eb139c5a | kuppamhyndhavi/Codechef | Water Mixing.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int a,b,x,y;
cin>>a>>b>>x>>y;
int diff=b-a;
if(diff>0){
if(diff<=x){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}else if(di... | ALGO | 0.999136 | 3.34816 |
7719f8e4-1971-469f-b999-0f9a5136ebee | Argo2s/Spline | Spline/SimpleGLUT.cpp | #include "stdafx.h"
// standard
#include <assert.h>
#include <math.h>
// glut
#include <GL/glut.h>
//================================
// global variables
//================================
// screen size
int g_screenWidth = 0;
int g_screenHeight = 0;
static int pointindex = 0;
static GLfloat t = 0; //This variabl... | ALGO | 0.986649 | 3.068093 |
3f7c0b07-8cf1-413b-a6f7-c409f0bc36e7 | Subhraneel77/Leetcodes-Solutions | 2742-painting-the-walls/2742-painting-the-walls.cpp | class Solution {
public:
int solve(vector<int>& cost, vector<int>& time, int i, int bank,vector<vector<int>> &dp){
if(bank <= 0){
return 0;
}
if(i >= cost.size()){
return 1e9;
}
if(dp[i][bank] != -1){
return dp[i][bank];
}
... | ALGO | 0.999683 | 5.545579 |
02fc3950-1d62-42d3-88a5-27e9b2197e89 | bdcbqa314159/cpp_financial_numerical_recipes | chapter_11/black_futures_options.cpp | #include "fin_recipes"
#include <iostream>
int main()
{
// double F = 50, K = 45, r = 0.08, sigma = 0.2, time = 0.5; -> the book results for this are not correct.
double F = 12800, K = 12750, r = 0.01, sigma = 0.15, time = 0.25; // verified with another site.
std::cout << "european futures call option = ... | ALGO | 0.998747 | 5.945402 |
0afbb505-e80d-44ff-9e2b-154db9cac7ec | ishandutta2007/codeforces | shawn/normal/601/B.cpp | #include <bits/stdc++.h>
using namespace std;
int rd() {
int x = 0; char c = getchar();
while (c > '9' || c < '0') c = getchar();
while (c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
return x;
}
const int N = 1e5 + 10;
int n, q, a[N], b[N], s[N], top, L[N], R[N], l, r, len;
int main() {
n = rd(), ... | ALGO | 0.999827 | 3.772592 |
846efbc4-043b-4f87-bbfc-3ef7eaf5bcbb | houwenqi/litlecode | floyd_warshall.cpp | #include <stdio.h>
int max = 1001;
int e[10][10];
int main()
{
int point;
int line;
int i;
int j;
int p1;
int p2;
int len;
int k;
//输入顶点数和边条数
scanf("%d %d",&point,&line);
//初始化矩阵
for ( i = 1; i <= point ; i++ )
{
for( j = 1; j <= point; j++ )
{
if( i == j )
{
e[i][j] = 0;
}
else
... | ALGO | 0.999765 | 3.12364 |
697d6c31-2b7f-46c0-af22-08f2e5532ee7 | ishandutta2007/codeforces | pajaraja/normal/682/C.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int t[100001];
struct edge
{
int k,w;
};
vector<edge> g[100001];
int dfs(int s,int te,int f, bool masinazaslaninu)
{
int r=0;
if(!masinazaslaninu) r++;
for(int i=0;i<g[s].size();i++)
{
if(g[s][i].k!=f)
{
if(g[... | ALGO | 0.999955 | 3.415839 |
3de985d8-3cd6-461e-95f0-2c2043447b54 | ZakaDev22/Practices-Over-The-Past-Courses | Old Practices/Problem #54 Calculate Vocation Days/Problem #54 Calculate Vocation Days/Teacher Solution.cpp |
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <iomanip>
using namespace std;
short ReadNumbers(string message)
{
short n = 0;
cout << message;
cin >> n;
return n;
}
struct stDate
{
short year = 0;
short month = 0;
short day = 0;
};
bool IsDate1LessThanDate2(stDate dat... | ALGO | 0.998954 | 3.950637 |
67ee56a6-9261-4112-981f-9184b0e1bf3b | noochila/-DSA- | 0001-two-sum/0001-two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
int n = nums.size();
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (nums[i] + nums[j] == target) {
return {i, j};
}
}
... | ALGO | 0.99991 | 6.401557 |
c8913430-22e6-43ce-9f52-52bfffcdf4d7 | Madhavsingla1/LeetCode-Sol | 231-power-of-two/231-power-of-two.cpp | class Solution {
public:
bool isPowerOfTwo(int n)
{
// long long num=1;
// while(n>num)
// {
// num=num<<1;
// }
// return num==n;
if(n<=0)return 0;
return !(n&(n-1));
}
}; | ALGO | 0.999027 | 6.107308 |
37b75361-52ae-4d47-b2e6-88357ca3d86d | KeyaanKR/CSES | Introductory Problems/Coin_Piles.cpp | #include <bits/stdc++.h>
typedef long long int ll;
int main() {
ll n;
std::cin >> n;
for (ll i = 0; i < n; i++) {
ll a, b;
std::cin >> a >> b;
if ((a + b) % 3 == 0 && std::max(a, b) <= 2 * std::min(a, b))
std::cout << "YES" << std::endl;
else
std::cout << "NO" << std::endl;
}
}
| ALGO | 0.999633 | 4.271642 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.