uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f0f6b796-7b45-49eb-b576-f5f084e2ab8d | jlochman/JForex | IndicatorsDerived/Normalize.cpp | /*
* Normalize.cpp
*
* Created on: Sep 1, 2015
* Author: jlochman
*/
#include <iostream>
#include "TMath.h"
#include "../Indicators/MovingAverage.h"
#include "../Indicators/MovingMin.h"
#include "../Indicators/MovingMax.h"
#include "Normalize.h"
Normalize::Normalize(string branchName, const vector<doubl... | TOOL | 0.903592 | 5.225243 |
e7338458-aab5-4047-8d4b-fedda9260269 | GunioRobot/scribe-dependencies | boost_1_41_0/libs/graph/example/make_biconnected_planar.cpp | #include <boost/graph/biconnected_components.hpp>
#include <boost/graph/make_biconnected_planar.hpp>
#include <boost/graph/boyer_myrvold_planar_test.hpp>
using namespace boost;
int main(int argc, char** argv)
{
typedef adjacency_list
< vecS,
vecS,
undirectedS,
property<vertex_index_t, int>,... | ALGO | 0.990627 | 7.085266 |
dffd5729-fa66-4b84-9ff1-b31a0dc07517 | rofi93/Codeforces | C. Game.cpp | /* -------------------------------- */
/* Name: MD. Khairul Basar */
/* Institute: HSTU */
/* Dept: CSE */
/* Email: <EMAIL> */
/* -------------------------------- */
#include <bits/stdc++.h>
/* all header files */
#define fs first
#define sc seco... | ALGO | 0.999562 | 3.371887 |
36927f04-95dc-4d97-84c5-fdb251c69a5c | ibrahim3761/Competitive-programming | A_Expression.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int value = max({a + b + c, (a + b) * c, a * (b + c), a * b * c});
cout << value << endl;
return 0;
}
| ALGO | 0.999889 | 4.071676 |
a1e494d4-a4b1-4c6b-a76c-d8e5d7c07c48 | vukadinovic936/CpProblems | coinExchangeDP.cpp | #include <bits/stdc++.h>
#define vi vector<int>
#define pi pair<int,int>
#define vii vector<pair<int,int>>
using namespace std;
int coins[2];
int memo[1000];
int n;
int rec(int money) {
if(money==0) return 0;
if(money<0) return 10000000;
int res=10000;
if(memo[money]==-1) {
for(int i=0; i<n; i++... | ALGO | 0.998244 | 3.959562 |
e6229a91-7101-430b-b9de-9c1e6d8826fb | sbakic/algorithms | codeforces/758b-blown-garland/main.cpp | #include <bits/stdc++.h>
using namespace std;
bool found(char c[], char C) {
for (int i = 0; i < 4; i++) {
if (c[i] == C) return true;
}
return false;
}
int main() {
char c[] = "!!!!";
string s, t = "RBYG";
cin >> s;
int n = s.size(), r = 0, b = 0, y = 0, g = 0;
for (int i = 0; i < n; i++) {
... | ALGO | 0.990743 | 3.874233 |
e93d0f4f-1c1b-462c-9608-d0207870b03f | C5Hwang/Online-Judge-Solutions | Luogu/Luogu1251.cpp | #include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
const int MAX_N = 2e3 + 10 , MAX_V = 4e3 + 10 , MAX_E = 3e4 + 10 , INF = 0x3f3f3f3f ;
std::queue<int> q ;
struct Link {
int num , cost , cap ;
Link *next , *reg ;
}list[MAX_E] ;
bool vis[MAX_V] ;
Link *head[MAX_V] , *id[MAX_V] ;
in... | ALGO | 0.999811 | 3.735624 |
415287b3-3062-452a-9d5c-f377629e8556 | heavenMOJANG/ICPC | .history/Codeforces/CF2020/C_20241023192526.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
int calc(int x, int y) {
return x & y;
}
void solve() {
int b, c, d; cin >> b >> c >> d;
int a{};
for (int i = 0; i... | ALGO | 0.998918 | 4.793745 |
cfefa3ef-0ea3-4e10-ac5d-a482d041c51e | iyangzy/LeetCode | offer2/从尾到头打印链表.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr){};
};
vector<int> printListFromTailToHead(ListNode *head)
{
vector<int> res;
while (head)
{
res.push_back(head->val);
... | ALGO | 0.999635 | 4.460912 |
2a4d4b35-1946-4a85-bb61-042a67db00a3 | joYousefShaban/Problem-Solving | HackerRank/Java/LeetCode/max-consecutive-ones/Wrong Answer/1-28-2021, 1_03_15 PM/Solution.cpp | // https://leetcode.com/problems/max-consecutive-ones
class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int strike=-1;
int temp=0;
for(int i=0;i<nums.size();i++)
{
if(nums[i]==0)
{
if(temp>strike && strike!=-1)
... | ALGO | 0.999896 | 6.273149 |
13dc33d8-f1d1-454e-8972-4487454089c0 | 1lonely6legend/path_plan | a_star/astar.cpp | //
// Created by ogier on 24-4-4.
//
#include "astar.h"
Astar::Node::Node(double x, double y, float cost, double parent_index)
: x(x), y(y), cost(cost), parent_index(parent_index) {}
Astar::Astar(const double resolution, const double robotRadius)
: resolution_(resolution), robot_radius_(robotRadius) {
heur... | ALGO | 0.999905 | 3.495465 |
28cf5dcd-8462-4246-b847-21a369aeeb7f | samvel63/oop-autumn | lab7/TBinaryTree.cpp | #include "TBinaryTree.h"
template <class T>
TBinaryTree<T>::TBinaryTree()
{
head = nullptr;
}
template <class T>
std::shared_ptr<TBinaryTreeItem<T>> TBinaryTree<T>::find(std::shared_ptr<T> &obj)
{
std::shared_ptr<TBinaryTreeItem<T>> item = head;
while (item != nullptr) {
if (item->item->Side() == ... | ALGO | 0.996969 | 5.042284 |
5c323e9f-61cc-43c1-b30a-fc2463f38ed1 | burhan-cse/leetcode | K-diffPairsinanArray532.cpp | class Solution {
public:
int findPairs(vector<int>& nums, int k) {
int cnt = 0;
unordered_map<int, int>mp;
if(k==0){
for(int x : nums){
if(mp[x]==1) cnt++;
mp[x]++;
}
}
else{
for(int x : nums){
... | ALGO | 0.999759 | 6.022685 |
7a37797e-af89-46ba-9dff-939a52a23952 | Revendell/LeetCode | src/258add-digits.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
class Solution {
public:
int addDigits(int num) {
//˼룺
int res;
while (num / 10 != 0)
{
res = 0;
while (num / 10 != 0)
{
res += num % 10;
num = num / 10;
}
res += num % 10;
num = res;
}
return num;
}
};
... | ALGO | 0.999902 | 5.678918 |
eb34fe91-bcde-486a-af55-58f1dc4d8fcb | adarshyoga/TaskProf_RegionDiffSched | benchmarks/pbbs/diff_analysis/karatsuba/karatsuba.cpp | #include <cstdlib>
#include <cassert>
#include <cstdio>
#include "t_debug_task.h"
#include "tbb/tick_count.h"
#include "tbb/task_scheduler_init.h"
// Assumed to hold 32 bits
typedef unsigned int T;
#include "temp_space.h"
#include <tbb/parallel_invoke.h>
namespace TBBExample {
#include "simple_mul_serial.h"
#includ... | TEST | 0.9795 | 5.849417 |
3e8c5bcf-edac-4d1c-a77d-26aec6c6576f | Trabiant/Informatics-reports | NonlinearEquation/NewtonMethod.cpp | #include <iostream>
#include <cmath>
#include <locale>
using namespace std;
double f(double x)
{
return 0.1 * pow(x, 2) - x * log(x);
}
double f1(double x)
{
return (1 / 5) * x - log(x) - 1;
}
double f2(double x)
{
return 1 / 5 - 1 / x;
}
int main()
{
setlocale(LC_ALL, "Russian");
double a, b, x0, x... | ALGO | 0.999976 | 3.486688 |
c291c405-b457-4d2e-81c8-2c14b4bc8231 | JeanGyuHu/Algorithm | 최댓값과 최솟값/source.cpp | #include <bits/stdc++.h>
using namespace std;
string solution(string s) {
vector<int> v;
string answer = "", tmp;
bool flag=true;
for(int i=0; i<s.size(); i++){
if(s[i]==' '){
v.push_back(stoi(tmp));
tmp.clear();
flag = true;
continue;
}... | ALGO | 0.999559 | 4.500192 |
f3839075-e226-44b7-aa9e-37a461c028be | violinmeng/algorithm-solution-leet | cpp-solutions/src/slns0kto1k/s0028_str_str.cpp | #include <iostream>
#include <string>
using namespace std;
int strStr(string haystack, string needle)
{
int m = haystack.length(), n = needle.length();
if (n == 0) return 0;
for (int i = 0; i < m - n + 1; i++) {
for (int j = 0; j < n; j++) {
if (haystack[i + j] != needle[j]) break;
if (j == n -... | ALGO | 0.999882 | 5.118846 |
f21d5814-f41b-4997-9c93-d3e632e637f2 | sandialabs/woodland | woodland/acorn/fs3d_sigma_znml.cpp | #include "woodland/acorn/fs3d.hpp"
#include "woodland/acorn/util.hpp"
#include "woodland/acorn/matvec.hpp"
#include "woodland/acorn/dbg.hpp"
namespace woodland {
namespace acorn {
namespace fs3d {
typedef Matvec<3,Real> mv3;
/* Solution for the case
z = x - y = (x1,0,0)
nml = v = (v1,0,v3)
*/
template <typenam... | ALGO | 0.999394 | 6.741364 |
c90729b3-f1fe-46c4-a775-f9dfd4f8735c | valen214/competitive | codeforces/1187/d.cpp |
#include <bits/stdc++.h>
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
#define forab(i, a, b) for(ull i=a, max=b; i < max; ++i)
#define fori(i, n) for(ull i=0, max=n; i < max; ++i)
#define forr(i, n) for(ull i = n; i >= 0; --i)
#define bit(n, i) ((n >> i) & 1)
#define bin(n, l) ( bits... | ALGO | 0.999866 | 3.902534 |
d1368921-0329-4531-9e49-50fe0eb3dc9b | andrewcleung/leetcode | 2185.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
int prefixCount(vector<string>& words, string pref) {
int ret = 0;
for (auto &w : words)
{
ret = w.find(pref) == 0 ? ret + 1 : ret;
}
return ret;
}
};
int ... | ALGO | 0.999531 | 5.670308 |
a616f6ed-fc41-4342-ad0f-134f3ff14cdd | th35tup1d/online_judge_problems_solutions | codeforces/00012.266A.Stones_on_the_Table.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
int n;
int i, j;
cin >> n;
string str;
cin >> str;
/*for(i=0; i< n; i++)
{
cin >> str[i];
}
*/
int c=0;
for(i=0, j=1; i<n-1, j<n; i++, j++)
{
if(str[i]==str[j])
c++;
}
cout << c << endl;
return 0... | ALGO | 0.999905 | 3.657009 |
17906b8b-d1d0-44ab-9bb5-585fa0eda300 | TMBOC/Robust-GNSS-Estimation-using-FG-GMM-TD | 3rdparty/RobustGNSS/gtsam/gtsam/geometry/CalibratedCamera.cpp | /**
* @file CalibratedCamera.cpp
* @brief Calibrated camera for which only pose is unknown
* @date Aug 17, 2009
* @author Frank Dellaert
*/
#include <gtsam/geometry/Pose2.h>
#include <gtsam/geometry/CalibratedCamera.h>
using namespace std;
namespace gtsam {
/* **************************************************... | TOOL | 0.991909 | 6.61899 |
4d148127-a231-4510-9892-dcb14023cc17 | GuoliangPeng/CarND-Path-Planning-Project-pgl | src/Eigen-3.3/lapack/cholesky.cpp | #include "lapack_common.h"
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info))
{
*info = 0;
if(UPLO(*uplo)==INVALID) *info = -1;
else if(*n<0) ... | ALGO | 0.998036 | 6.004565 |
236cc9bd-0af0-4dfe-bbb2-7d8d36d037e1 | tedmoskovitz/PracticeCpp | Pointers_10/pointers.cpp | /*
Pointers hold the addresses of variables.
*/
#include <iostream>
int main()
{
// Pointers hold the addresses of variables.
int age = 28;
// if you don't know which address you're going to point to, use nullptr
// the int in front says that the pointer is going to point to an int
int *p_age = nullptr;
... | TOOL | 0.904706 | 3.636715 |
e9c88750-9301-45be-b6c2-664b46a58b1d | MaheshworDhakal/Python_learning | fib.cpp | #include<stdio.h>
#include<math.h>
int fib(int n);
int main ()
{
int n;
printf("enter the number of term \n");
scanf("%d",&n);
fib(n);
printf("the series is %d^3\t+",fib(n));
return 0;
}
fib(int n)
{
while(n!=1){
{
if(n==1)
{return 2;
}
else
{
return (2 +fib(n-1));
}
n--;
}
}
}
| ALGO | 0.999776 | 3.193577 |
9b0f860f-b6ba-4038-87a1-c797e81fa444 | hpuxiaoqiang/coding | DataStrcture/数据结构书中算法的实现/BasicOperate/SQStack.cpp | /*
˳ջĻ
*/
#include <iostream>
using namespace std;
#define OK 1
#define ERROR 0
#define MaxSize 100
typedef int ElemType;
typedef struct {
ElemType *top;
ElemType *base;
int StackSize;
}SQStack;
//ʼ
int Init(SQStack &S){
S.base = new ElemType[MaxSize];
if(!S.base) return ERROR;
S.top = S.base;
S.StackSize = M... | ALGO | 0.947205 | 3.421242 |
192b3c08-3536-4c63-864b-4b251e17c3f1 | Makwy1424/SDE-Sheet-Challenge | Merge_two_linked_list.cpp | #include <bits/stdc++.h>
using namespace std;
/************************************************************
Following is the linked list node structure.
template <typename T>
class Node {
public:
T data;
Node* next;
Node(T data) {
next = NULL;
this-... | ALGO | 0.999834 | 4.36097 |
4811bc35-173f-4a47-b257-95dbfed2f282 | Theemiss/holberton-flutter_intro | breaking_bad/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.99862 | 6.783336 |
05f746c8-ca4b-4c35-acaf-fc9ea8193b57 | hjiang13/LLMs-in-IR | processed_data/Decompiled_Humaneval_x_cpp_164_Result_O3/GPT4o_human_x_164_decompiled/test/CPP_97.cpp | #include <cstdlib>
extern "C" int multiply(int a, int b) {
a = abs(a);
b = abs(b);
return (b % 10) * (a % 10);
}
#undef NDEBUG
#include<assert.h>
int main(){
assert (multiply(148, 412) == 16 );
assert (multiply(19, 28) == 72 );
assert (multiply(2020, 1851) == 0);
as... | TEST | 0.996611 | 4.344945 |
27f77444-bc76-463f-b613-ef32ba2ec38c | rafaelportomoura/ufla-gcc123-arquitetura-de-computadores-2 | AVX/Cifra de César/main.cpp | #include <immintrin.h>
#include <iostream>
using namespace std;
const int NUMERO_DE_CARACTERES = 8;
__m256 get_m256_da_palavra( string p ) {
__m256i _m256i_palavra = _mm256_set_epi32( p[7], p[6], p[5], p[4], p[3], p[2], p[1], p[0] );
return _mm256_cvtepi32_ps( _m256i_palavra );
}
string get_palavra_do_m256( __m2... | ALGO | 0.989255 | 5.137016 |
c6e124d7-cb8f-4bc6-ba5d-1488fb5cd022 | KaisHasan/Codeforces | CodeForces_Vanya_and_Exams.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> pi;
typedef pair<double , int > dpi;
typedef pair<long long , long long> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef unsigned long long ull;
#define MP make_pair
#define mem(a , v) mems... | ALGO | 0.999169 | 3.48638 |
80eeb31b-ab49-41f3-9a58-5849b47dc880 | enesisaoglu/SnakeGameInCppWithRaylib | SnakeGame.cpp | #include "raylib.h"
#include <iostream>
#include <deque>
using namespace std;
//Define colors and its adjustment to use in game loop
Color green = { 173,204,96,255 };
Color darkGreen = { 43,51,24,255 };
//Declaring and initializing global variables
int cellSize = 30;
int cellCount = 25;
int offset = 75;
double last... | ALGO | 0.996416 | 6.629691 |
7ef456fe-4fb5-4e84-94ba-26a2252c9bb9 | ishandutta2007/codeforces | awakeanay/normal/1705/A.cpp | #include <iostream>
#include <algorithm>
#define int long long
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int t;
std::cin >> t;
while(t--) {
int n, x;
std::cin >> n >> x;
int h[2*n];
for(int i = 0; i < 2*n; i++)
std::cin >> h[i];
std::sort(h, h+2*n);
... | ALGO | 0.999733 | 4.349446 |
492df3bb-3d03-4d20-9c0f-d69ba55d3753 | khomyakov42/Algorithms-training | Multiplication puzzle.cpp | #include<cstdio>
#include<vector>
using namespace std;
#define inf 1000000000
int main(){
FILE *in = fopen("input.txt", "r");
FILE *out = fopen("output.txt", "w");
int n;
int p[100];
int res[100][100];
fscanf(in, "%d", &n);
for(int i = 0; i < n; i++)
fscanf(in, "%d", &p[i]);
for(int i ... | ALGO | 0.999768 | 3.135022 |
dcbc8bbd-34e5-4d38-a2c3-80dd871f1f38 | ishandutta2007/codeforces | aid/normal/220/E.cpp | #include <iostream>
#include <map>
using namespace std;
const int MAXN = 100 * 1000 + 5;
int a[MAXN], st[2][4 * MAXN];
map<int, int> mp;
void add(int t, int v, int tl, int tr, int pos, int val) {
if(tl == tr - 1) {
st[t][v] += val;
return;
}
int tm = (tl + tr) / 2;
if(pos < tm)
... | ALGO | 0.999973 | 4.226936 |
413f9a83-6f33-4c94-a3b6-f452264154b4 | MehakRauf/Cpp-Questions | practice/merge.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
struct List
{
int data;
struct List *next;
};
struct List *start = NULL;
struct List *insert(int value)
{
struct List *temp = (struct List *)malloc(sizeof(struct List));
temp->data = value;
temp->next = NULL;
if (start == NULL)
{... | ALGO | 0.999834 | 4.004308 |
38f03bcc-8ac5-480a-85a4-ea403a55f329 | Zym2022/elu_ws | yolomech/src/template_alignment.cpp | #include "template_alignment.h" // [0.0, 0.9, -2.0, 0.0, 0.8, 0.0]
struct ICPResult
{
float fitness_score;
Eigen::Matrix4f final_transformation;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
void
icp_align(Eigen::Matrix4f icp_init, ICPResult &result, FeatureCloud best_template, FeatureCloud target_cloud)
{
pcl::Iterati... | ALGO | 0.930801 | 4.986129 |
0f2888e3-281f-4fe5-a495-b55175692877 | AllenLiuX/My-LeetCode | leetcode-cpp/100-199/#151 翻转字符串里的单词.cpp | Tags: 字符串, 双指针, 中等
给定一个字符串,逐个翻转字符串中的每个单词。
示例 1:
输入: "the sky is blue"
输出: "blue is sky the"
示例 2:
输入: " hello world! "
输出: "world! hello"
解释: 输入字符串可以在前面或者后面包含多余的空格,但是反转后的字符不能包括。
示例 3:
输入: "a good example"
输出: "example good a"
解释: 如果两个单词间有多余的空格,将反转后单词间的空格减少到只含一个。
说明:
无空格字符构成一个单词。
输入字符串可以在前面或者后面包含多余的空格,但是反转后的字符... | ALGO | 0.999828 | 5.999329 |
96991dd8-8835-4507-b8c2-696c2c31a61e | lymike/CISC220.Lab3PartB | Lab 3 Part 2.1/Filter.cpp | /*
* Filter.cpp
*
* Created on: Oct 4, 2017
* Author: Michael Ly
*/
#include <iostream>
#include <stdlib.h>
#include "Filter.hpp"
using namespace std;
Filter::Filter() {
arr = NULL;
size = 0;
farray = NULL;
hi = 0;
lo = 0;
}
void Filter::createArray1() {
size = (rand() % 25) + 25;
int *tarr = new ... | ALGO | 0.97609 | 3.935944 |
14af7eb5-8923-464f-8798-ca2c3f9161b6 | emurillojr/Cplusplus | Other/numberSquaredCubed.cpp | /* Ernesto Murillo - Number squared cubed program
Variables used:
num = number
*/
#include <iostream>
using namespace std;
int main ()
{
double num;
cout <<"Please enter number and press ENTER: ";
cin >>num;
cout << endl;
cout <<"The square of "<<num<<" is "<<num*num<<endl;
cout << endl;
cout <<"The cube of ... | TOOL | 0.89183 | 3.576798 |
64299b03-91a8-4e20-9bdc-09b0e17dc1e3 | Kyan820815/leetcode | lc02xx/lc0281.cpp | //--- Q: 0281. Zigzag Iterator
/**
* Your ZigzagIterator object will be instantiated and called as such:
* ZigzagIterator i(v1, v2);
* while (i.hasNext()) cout << i.next();
*/
//--- method 1: index recording
class ZigzagIterator {
public:
ZigzagIterator(vector<int>& v1, vector<int>& v2) {
arr.push_bac... | ALGO | 0.999957 | 5.786191 |
116c5a37-3bff-4192-a5b1-cde33c662025 | Suraj110905/DSA-with-C-plus-plus | patternproblem5.cpp | //5 4 3 2 1
//5 4 3 2 1
//5 4 3 2 1
//5 4 3 2 1
//5 4 3 2 1
#include <iostream>
using namespace std;
int main(){
for(int row=1;row<=5;row++)
{
for(int col=5;col>=1;col--)
{
cout<<col<<" ";
}
cout<<endl;
}
} | ALGO | 0.999355 | 3.395977 |
0d5bc2d5-af32-4b4d-b011-a369576f00f5 | ishandutta2007/codeforces | dzhulgakov/normal/109/A.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <iostream>
#include <iterator>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <sstream>
using namespace std;
#define RE... | ALGO | 0.99971 | 3.074277 |
9a8ee7e9-5240-4f6c-ada7-80b7754387f0 | HHHHao-s/algorithm | 41.R缺失的第一个正数.cpp | #include "s.h"
/*
* @lc app=leetcode.cn id=41 lang=cpp
*
* [41] 缺失的第一个正数
*/
// @lc code=start
class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
// 将小于0的改成n+1
int n = nums.size();
for (int& num: nums) {
if (num <= 0) {
num = n + 1;
... | ALGO | 0.999814 | 4.857217 |
981a140d-e7c3-4d69-a18e-1c102978a7c7 | blueaaa7/CPPCode | 算法/80中序和后序遍历构造二叉树.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
// 定义二叉树节点结构
struct TreeNode {
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
};
class Solution {
public:
TreeNode* buildTree(vector<int>& inorder, vector<int>... | ALGO | 0.999958 | 6.567833 |
ecfb7005-648a-4c2d-8869-8de77ad0412b | DeveshKD/SPPU-Practicals | 2nd Year/DSA/10_heaps.cpp | #include<bits/stdc++.h>
using namespace std;
struct MinHeap
{
int* arr;
int capacity;
int size;
MinHeap(int capacity)
{
this->capacity = capacity;
size = 0;
arr = new int(capacity);
}
int left(int i)
{
return (2*i+1);
}
int right(int i)
{
... | ALGO | 0.999958 | 4.35815 |
6391f4e3-f548-47fa-992f-9f3348b60d18 | raveesh1512/DSA | String.cpp | #include <stdio.h> // Include for printf
#include <stdlib.h> // Include for malloc and free
using namespace std;
const char* equalStrings(const char* s1,const char* s2){
int i,j;
for( i=0,j=0;s1[i]!='\0'&&s2[j]!='\0';i++,j++){
if(s1[i]!=s2[j]){
break;
}
}
if(s1[i]==s2[j])
... | ALGO | 0.999783 | 3.864784 |
eb79bad2-3852-42d4-9365-4c13f8d0a202 | byuzbasi/rbridge | src/utilities.cpp | #include <math.h>
#include <time.h>
#include <string.h>
double sign(double x) {
if (x > 0) return 1.0;
else if (x < 0) return -1.0;
else return 0.0;
}
double crossprod(double *x, double *v, int n, int j) {
int jn = j*n, i; double sum=0.0;
for (i=0;i<n;i++) sum += x[jn+i]*v[i];
return(sum);
}
double maxpr... | ALGO | 0.999981 | 4.181593 |
e69dd5ef-120d-4440-ae5c-07a77b63a230 | Knackie/AdventOfCode2024 | day11.cpp | #include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
// Fonction pour exécuter les transformations de clignement
std::vector<int> blink(std::vector<int> stones, int num_blinks) {
for (int i = 0; i < num_blinks; ++i) {
std::vector<int> new_stones;
for (int st... | ALGO | 0.998391 | 6.652284 |
d038ba9c-fcab-47eb-9fbb-2ed154d81ce5 | harsh-panchal-804/LeetCode-Solutions | Sequential Digits.cpp | class Solution {
public:
vector<int> sequentialDigits(int low, int high) {
string c = "123456789";
vector<int>ans;
for(int i =0;i<c.size();i++){
for(int j =i+1;j<c.size();j++){
int curr = stoi(c.substr(i,j-i+1));
if(curr<=high && curr>=low)ans.pus... | ALGO | 0.99997 | 5.796688 |
c5ef9f3d-ded1-4f55-81fc-ffd2b5169ea3 | rafi67/Problem | Deque_STL.cpp | #include <iostream>
#include <deque>
using namespace std;
void printKMax(int arr[], int n, int k){
// Create a Double Ended Queue, Qi that will store indexes of array elements
// The queue will store indexes of useful elements in every window and it will
// maintain decreasing order of values from front to... | ALGO | 0.999934 | 4.347818 |
56115aaa-ba32-4f10-a82d-3124a825cb2b | skylayer/OiCodeRepo | 2018/09/25/[LOJ10147]石子合并.cpp | #include<bits/stdc++.h>
using namespace std;
long long dx[401][401],dn[401][401],frt[401],a[401];
int n;
int main() {
memset(dn,0x3f,sizeof dn);
scanf("%d",&n);
for(int i=1; i<=n; i++) {
scanf("%lld",&frt[i]);
dn[i][i]=0;
// dn[i+n][i+n]=dx[i+n][i+n]=dn[i][i]=dx[i][i];
frt[i+n]=fr... | ALGO | 0.999958 | 3.049095 |
03080107-e713-4418-b50f-d99db2f991e7 | bdumitriu/playground | university-work/utcn/algoritmi fundamentali/lab3/red-black tree/rbtest.cpp | /*
* A small application for testing the functionality of the
* Red/Black Tree class.
*
* Author: Bogdan DUMITRIU
* Date: 26.11.2001
*/
#include <stdio.h>
#include <conio.h>
#include "rbtree.h"
/*
* Prints a list of commands on the screen.
*/
void print_commands()
{
clrscr();
printf("\ni - insert a node i... | ALGO | 0.952682 | 5.511229 |
676e06b5-0ea1-4beb-b546-29daad89555a | 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.999849 | 5.955377 |
c526815f-519b-4541-bd4e-0d475ec1a57b | Soldie/Carberp-BOTNET | source - absource/pro/all source/hvnc_dll/HVNC Lib/webcam/baseclasses/arithutil.cpp | #include <streams.h>
//
// Declare function from largeint.h we need so that PPC can build
//
//
// Enlarged integer divide - 64-bits / 32-bits > 32-bits
//
#ifndef _X86_
#define LLtoU64(x) (*(unsigned __int64*)(void*)(&(x)))
__inline
ULONG
WINAPI
EnlargedUnsignedDivide (
IN ULARGE_INTEGER Dividend,
IN ULO... | TOOL | 0.931668 | 4.102474 |
1ede12db-cdbf-4083-9cfa-3266f9a574cc | thesamarthrai/75-Hard-LeetCode-Challange | Day11_72.cpp | //My approach
class Solution {
public:
int minDistance(string word1, string word2) {
int count = 0;
int size,ans;
if(word1.size()>word2.size()){
for(int i=0;i<word2.size();i++){
if(word1[i]==word2[i]){
continue;
}else if(word1... | ALGO | 0.999984 | 5.842515 |
ea0b8e57-fd99-40d3-bc4a-1faf583907b9 | mdshadesh/CodeChef-Problem-Solution | MEX_ARRAY.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int t; cin>>t;
while(t--)
{
int n; cin>>n; int flag=n , f=0 ,x;
map<int,int> m; //frequency map
vector<int> ans; //to store answer vector
f... | ALGO | 0.999965 | 3.911644 |
dd1b830b-0574-4bf0-bcaf-a07610f7905b | 20212619/cpp | Week_11/11└х-VectorWithOp+ErrOK/11└х-VectorWithOp+ErrOK.cpp | #include <iostream>
using namespace std;
class Vector {
double* arr;
int dim;
public:
Vector(int d = 0) : dim(d), arr(NULL) { arr = new double[dim]; }
~Vector() { delete[] arr; }
double& operator[] (int id) { return arr[id]; }
friend ostream& operator << (ostream& os, Vector& v) {
os << "<";
for (int i = 0... | ALGO | 0.929765 | 3.612588 |
cb6d6141-0774-4ca0-99a6-d68a87334c88 | kratimitra/Competitive_Programming | Trees/Transform to Sum Tree.cpp | class Solution {
public:
int sum_helper(Node* node)
{
if(node == NULL)
return 0;
int old_value = node->data;
node->data = sum_helper(node->left) + sum_helper(node->right);
return old_value + node->data;
}
// Convert a given tree to a ... | ALGO | 0.999973 | 6.129952 |
f9a66254-5e5a-4671-94b7-548fcfb22ec7 | giorgiopizz/lab | codici_esame/Esercizi_Lez02/esempio02.cpp | /*
c++ -o esempio02 esempio02.cpp
*/
#include <iostream>
#define START 4
// Vari modi di scrivere la funione raddoppia
double raddoppia(double input)
{
return input * 2;
}
double raddoppia2(double input)
{
input = input * 2;
return input;
}
double raddoppiaPointer(double *input)
{
*input = *input * 2;
... | TOOL | 0.983922 | 5.848951 |
e618b91e-f88a-4773-a831-f78ac07f5810 | maligir/temp | third_party/tesseract/src/textord/bbgrid.cpp | #include "bbgrid.h"
#include "helpers.h"
#include "ocrblock.h"
namespace tesseract {
///////////////////////////////////////////////////////////////////////
// BBGrid IMPLEMENTATION.
///////////////////////////////////////////////////////////////////////
GridBase::GridBase(int gridsize, const ICOORD &bleft, const ICO... | ALGO | 0.986981 | 7.321719 |
e9b08534-83e2-421c-9e23-6f5b849a72fc | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Gemma/top0-100/maximum-value-sum-by-placing-three-rooks-ii-Solution.maximumValueSum/177917_Exec_Code.cpp | char **XGetFontPath(
register Display *dpy,
int *npaths) /* RETURN */
{
xGetFontPathReply rep;
unsigned long nbytes = 0;
char **flist = NULL;
char *ch = NULL;
char *chend;
int count = 0;
register unsigned i;
register int length;
_X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq (GetFontPat... | ALGO | 0.994625 | 3.762064 |
b19b0785-21ec-4d0b-8977-bda20262747b | NaderYehia/Competitive-Programming | Vjudge/UVA/11388/29658053_AC_0ms_0kB.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e3+10,M=1e3+7,OO=0x3f3f3f3f;
int main(){
//freopen("haa.txt","r",stdin);
//freopen("myfile.txt","w",stdout);
int t;
scanf("%d",&t);
while(t--){
int a,b;
scanf("%d%d",&a,&b);
if(b%a){
... | ALGO | 0.999202 | 4.067055 |
172daa01-826a-48ef-bcbb-ce80a4936121 | ZEUSRPA/CompetitiveProgramming | Training/Uva/12468.cpp | #include <bits/stdc++.h>
#define ENDL '\n'
#define deb(u) cout << #u " : " << (u) << ENDL;
#define deba(alias, u) cout << alias << ": " << (u) << ENDL;
#define debp(u, v) cout << u << " : " << v << ENDL;
#define pb push_back
#define F first
#define S second
#define lli long long
#define ld long double
#define pii pair<... | ALGO | 0.999212 | 3.50412 |
75d39876-8d4c-4fac-9514-a41d271acaf7 | abdul1mannan/LeetCode | 0547-number-of-provinces/0547-number-of-provinces.cpp | class Solution {
public:
void dfs(int i, vector<int>& vis, vector<vector<int>>& adj) {
vis[i] = 1;
for (auto edge : adj[i]) {
if (!vis[edge]) {
dfs(edge, vis, adj);
}
}
}
int findCircleNum(vector<vector<int>>& isConnected) {
int n = is... | ALGO | 0.999978 | 6.153112 |
34f8d6ba-80bb-4a2c-a500-e4677294363e | saurabh-sk/Udacity-SDC-ND | 07 Highway Driving/CarND-Path-Planning-Project-master/src/Eigen-3.3/unsupported/doc/examples/MatrixPower.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
Matrix3d A;
A << cos(1), -sin(1), 0,
sin(1), cos(1), 0,
0 , 0 , 1;
std::cout << "The matrix A is:\n" << A << "\n\n"
"The matrix power A^(pi/4) is:\n"... | ALGO | 0.999796 | 3.790203 |
ab938508-6bce-493b-93c3-59d71ed6ff19 | sterngerlach/my-lidar-graph-slam-v2 | src/my_lidar_graph_slam/grid_map_new/grid_binary_bayes.cpp |
/* grid_binary_bayes.cpp */
#include <algorithm>
#include "my_lidar_graph_slam/grid_map_new/grid_binary_bayes.hpp"
#include "my_lidar_graph_slam/grid_map_new/grid_values.hpp"
namespace MyLidarGraphSlam {
namespace GridMapNew {
/* Initialize the lookup table for converting from internal values to
* corresponding p... | ALGO | 0.999522 | 4.141405 |
e12c5364-582d-446d-9e62-235590982688 | ishandutta2007/codeforces | maksim1744/normal/1310/E.cpp | /*
author: Maksim1744
created: 23.02.2020 20:57:14
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sum(a) ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a) (*mi... | ALGO | 0.999953 | 4.429087 |
8d78b284-c199-4223-80ad-3e9436627808 | mohamedfouad2000/TheBill | 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 |
edc7a8bf-12b5-4155-80b1-442a7c288884 | LogicShao/CP-Workspace | src/atc/abc372/ping/B_3_A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int M, tot = 0;
cin >> M;
vector<int> ans(20, 0);
for (int i = 0; M; M /= 3, ++i)
{
tot += M % 3;
ans[i]+=M % 3;
}
cout << tot << '\n';
for (int i = 0; i < 11; ++i)
for (int j = 0; j < ans[i]; ++j)
... | ALGO | 0.99961 | 3.540513 |
bf73c089-2f0c-4b86-b1b8-18e9922e7f4c | timprepscius/GeometricTools | WildMagic5/LibPhysics/Intersection/Wm5ExtremalQuery3PRJ.cpp | #include "Wm5PhysicsPCH.h"
#include "Wm5ExtremalQuery3PRJ.h"
namespace Wm5
{
//----------------------------------------------------------------------------
template <typename Real>
ExtremalQuery3PRJ<Real>::ExtremalQuery3PRJ (
const ConvexPolyhedron3<Real>* polytope)
:
ExtremalQuery3<Real>(polytope)
{
m... | ALGO | 0.991514 | 7.328369 |
193cceec-2e0e-47d6-b1c3-f06553e55288 | Andipstha/CPP_LAB | trash/template/Template.cpp | //wap to sort n number in ascending using function template
#include<iostream>
using namespace std;
template <typename T>
T sort(T num)
{
T a[30];
T i=0,j=0,temp=0;
for(i=0;i<num;i++)
{
cin>>a[i];
}
for(i=0;i<=num;i++)
{
for(j=i+1;j<=num;j++)
{
if(a[i]>a[j])
{
... | ALGO | 0.999339 | 4.332572 |
ee1a2fa9-a041-46fd-8fcb-8df896c98c3a | atlejq/HydraSTAQ_Cpp | HydraCpp/Stacker.cpp | #include "pch.h"
#include "Stacker.h"
std::vector<std::string> readStrings(std::string path)
{
std::vector<std::string> stringArray;
std::string line;
std::ifstream stringArrayStream(path);
if (stringArrayStream.is_open())
{
while (std::getline(stringArrayStream, line)) {
string... | TOOL | 0.990603 | 3.69421 |
39bc16df-dbfa-470b-8494-8cbf9c34a50d | ishandutta2007/codeforces | smax/normal/1183/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define f0r(a, b) for (long long a = 0; a < b; a++)
#define f1r(a, b, c) for (long long a = b; a < c; a++)
#define f0rd(a, b) for (long long a = b; a >= 0; a--)
#define f1rd(a, b, c) for (long long a = b; a >= c; a--)
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define... | ALGO | 0.999919 | 3.856248 |
851998c8-4d58-4bdb-9ad0-26d078827c9b | fsjhhh/acm_title | cpp/模板/线性dp_最长上升子序列2.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#define IOS ios::sync_with_stdio(0); \
cin.tie(0); \
cou... | ALGO | 0.999785 | 4.157481 |
4d9ad778-b02d-4ec0-9c85-58fec9419e93 | debojyoti-majumder/CompCoding | yearEnd2018/ses2/leetcode/prob2.cpp | // Problem URL: https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/description/
#include "stdafx.h"
#include <iostream>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
private:
ListNode* _head;
void delete... | ALGO | 0.999961 | 5.489655 |
2332ebf3-febb-458a-8892-c2e9eebf4105 | gauravkumarjha442/Leetcode | leetcode/940. Distinct Subsequences II/s2.cpp | // OJ: https://leetcode.com/problems/distinct-subsequences-ii/
// Author: github.com/lzl124631x
// Time: O(N)
// Space: O(1)
class Solution {
public:
int distinctSubseqII(string S) {
int N = S.size(), mod = pow(10, 9) + 7;
int picks[26] = {0};
int pick = 0, noPick = 1;
for (int i = 0... | ALGO | 0.999996 | 6.406798 |
620ced0e-7f12-41e3-a255-50ed2c0cffa7 | bhavyagoyal/Quoridor | client.cpp | #include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <arpa/inet.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
struct pos{
int x... | ALGO | 0.999259 | 3.572937 |
711345d2-2a5e-4363-84da-579438fe2068 | SebasDosman/programming_practices | C++/EjerciciosVarios/Ejercicio5.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string nom;
char genero;
int i, edad, max, contmasc = 0, contfem = 0, contaptos = 0, nac;
cout << "Digite su nombre \n";
cin >> nom;
cout << "\n";
cout << nom << " digite la cantidad de personas a evaluar \n";
cin >> max;
cout... | TOOL | 0.901103 | 3.602809 |
fd012591-f4dc-4187-99ac-5995b1db6907 | bpmnnit/codes | fence1.cpp | #include<iostream>
#include<cstdio>
using namespace std;
int main() {
double n, a;
scanf("%lf", &n);
while(n != 0) {
a = (n * n) / (3.141592 * 2);
printf("%.02lf\n", a);
scanf("%lf", &n);
}
}
| ALGO | 0.998908 | 3.071925 |
27f78e3f-bb90-45c3-ab40-709f3ab1e1f6 | pantq1711/DSA_CodePTIT | DSA07019.cpp | #include<bits/stdc++.h>
using namespace std;
void right(int a[], int n, int d[]){
stack <int> st;
for(int i=0; i<n; ++i){
while(!st.empty() && a[i] < a[st.top()]){
d[st.top()] = i;
st.pop();
}
st.push(i);
}
while(!st.empty()){
d[st.top()] = n;
st.pop();
}
}
void left(int a[], int n, int d[]){
stac... | ALGO | 0.999832 | 4.712542 |
ec06ccfb-60f8-48ce-b81e-14a2677bb4c7 | datouxyz/TPMPlusPlus | Tpm++/eigen-3.4.0/doc/examples/make_circulant2.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
// [circulant_func]
template<class ArgType>
class circulant_functor {
const ArgType &m_vec;
public:
circulant_functor(const ArgType& arg) : m_vec(arg) {}
const typename ArgType::Scalar& operator() (Index row, Index col) const {
Index index = ... | ALGO | 0.9994 | 5.574491 |
14580cf7-5291-46c8-9cc1-d1637a286830 | BlueMutagens/CS_10A_BinaryConvert | Lab 3/circle.cpp | //
// main.cpp
// Lab 3
//
// Created by Sean Belingheri on 9/8/22.
//
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
const double pi = 3.14159265;
float rad;
cout<<"Enter radius: ";
cin>>rad;
cout<<"Circumference: "<<float(2*pi*rad)<<endl;
cout<<"Area: "<<float(pi*... | ALGO | 0.972585 | 4.499882 |
0806cd28-fb4c-4d88-830d-efd561537718 | keshav11/implementations | linked-lists/middle_list.cpp | #include <cstdio>
#include <iostream>
using namespace std;
struct node
{
int val;
node * next;
};
struct node* push(struct node* start, int val)
{
struct node* nw = new struct node;
nw->val = val;
nw->next = start;
return nw;
}
void print_linked_list(struct node* start)
{
while(start!=NULL)
{
cout << s... | ALGO | 0.999869 | 4.628366 |
4c765b02-a648-4c44-b2bd-80abaaf1f74f | daleihao/GCAM_co2_downscaling | cvs/objects/target_finder/source/secanter.cpp | /*!
* \file secanter.cpp
* \ingroup Objects
* \brief Secanter class source file.
* \author Pralit Patel
*/
#include "util/base/include/definitions.h"
#include <cassert>
#include <string>
#include <cmath>
#include "util/logger/include/ilogger.h"
#include "target_finder/include/secanter.h"
#include "target_finder/... | ALGO | 0.998402 | 6.442822 |
dff68955-0427-487d-819e-11b91b03cfb2 | dungnt23012003/TTUD | gold_mining.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, l1, l2;
cin >> n >> l1 >>l2;
int a[n+1];
for(int i=1;i<=n;i++){
cin >> a[i];
}
deque<int> max_dp;
int dp[n+1];
dp[0]=0;
for(int i=1;i<=n;i++){
if... | ALGO | 0.999893 | 3.238251 |
a7710270-2306-4318-ae41-63f089676ec7 | Jazmann/openCV-Cxx11 | modules/features2d/src/detectors.cpp | #include "precomp.hpp"
namespace cv
{
/*
* FeatureDetector
*/
FeatureDetector::~FeatureDetector()
{}
void FeatureDetector::detect( InputArray image, std::vector<KeyPoint>& keypoints, InputArray mask ) const
{
keypoints.clear();
if( image.empty() )
return;
CV_Assert( mask.empty() || (mask.ty... | ALGO | 0.915109 | 6.796993 |
db45692f-1111-4bae-957c-16f2da8d40ed | Jia-Sian/OJ | uva/10783.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int T,t,a,b;
scanf("%d",&T);
for(t=1;t<=T;t++){
scanf("%d %d",&a,&b);
if(a%2==0)a++;
if(b%2==0)b--;
if(a>b){
printf("Case %d: 0\n",t);
conti... | ALGO | 0.999778 | 4.229719 |
aa74b205-733f-451b-9695-2f82e18095da | vfolunin/archives-solutions | LeetCode/2318.cpp | class Solution {
public:
int distinctSequences(int n) {
if (n == 1)
return 6;
const long long MOD = 1e9 + 7;
vector<vector<vector<long long>>> ways(n + 1, vector<vector<long long>>(7, vector<long long>(7)));
for (int a = 1; a <= 6; a++)
... | ALGO | 0.999973 | 6.061308 |
2d41229b-c790-4c55-821c-9c99737a21f0 | tauseefk/ray-tracer | main.cpp | #include "camera.h"
#include "hitable_list.h"
#include "material.h"
#include "sphere.h"
#include <iostream>
#include <sstream>
#include <thread>
#include <vector>
// XXX:TODO format is off
vec3 color(const ray& r, hitable* world, int depth) {
hit_record rec;
if (world->hit(r, 0.001, MAXFLOAT, rec)) {
ray scat... | ALGO | 0.960688 | 5.26044 |
54710070-9de5-4841-9ec1-aae47ba8e9d9 | aziz-tamim/Phitron_course | C++ for DSA/Week 02 String Class Objects/Module 08 Final_Exam/Sort_It_Again.cpp | #include<bits/stdc++.h>
using namespace std;
class Student
{
public:
string name;
int cls;
char section;
int id;
int math_marks;
int eng_marks;
};
bool cmp(Student m, Student e)
{
if(m.eng_marks > e.eng_marks)
{
return true;
}
else if(m.eng_marks < e.eng_marks)
{
... | ALGO | 0.999251 | 3.93847 |
3af16daf-83fc-4b4f-a69b-6d466e4223b0 | Akaash2409/leetcode | 0002-add-two-numbers/0002-add-two-numbers.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* addTwoNumbe... | ALGO | 0.99991 | 6.370091 |
2578a64a-e493-4b5d-b4f7-ba1b2d50f95a | Jeffrin2005/prefix_sum | Find the Pivot Integer.cpp | class Solution {
public:
int largestAltitude(vector<int>& gain) {
int n = gain.size();
vector<int>pref(n+1,0);
pref[0] = gain[0];
for(int i = 1; i < n; i++){
pref[i] = pref[i-1] + gain[i];
}
return *max_element(pref.begin(), pref.end());
}
};
| ALGO | 0.99961 | 5.902737 |
a292bc6d-7905-4ff9-9956-39b576cabad2 | shockley6668/Algorithm-Design-and-Analysis | 算法分析设计/着色问题/main.cpp | //
// main.cpp
// 着色问题
//
// Created by Shockley on 6/4/24.
//
#include <iostream>
#include <vector>
using namespace std;
class Graph{
public:
Graph(int nodes ,int colors,int edges):n(nodes),m(colors),e(edges),total_ways(0){
adj.resize(n);
color.resize(n,0);
}
void addEdge(int u,int v)
... | ALGO | 0.999747 | 5.203391 |
3356698f-678e-4d67-99f9-49b1abe25a0d | majinaru/Competitive-programming | atcoder/abc353/a.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> vt(n);
bool cond = true;
for (int i = 0; i < n; i++) {
cin >> vt[i];
if (vt[i] > vt[0] && cond) {
cout << i + 1 << endl;
cond = false;
}
}
if (c... | ALGO | 0.999969 | 4.869279 |
4a7bdd1e-2544-49b9-b7f1-24e1d0eff8e4 | vikashkrdeveloper/CodeForce-Solved-Problem | Do_Not_Be_Distracted!_1520_A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int nNumber;
cin >> nNumber;
for (int i = 1; i <= nNumber; i++)
{
int numberOfDays;
cin >> numberOfDays;
string solvedTasks;
cin >> solvedTasks;
bool isSolved[26] = {false};
bool isPossible = true... | ALGO | 0.999909 | 5.063016 |
2992bd0b-f726-47c9-a59a-7d91b2274d87 | mdtariqueh007/My_Leetcode | 2588-maximum-number-of-points-from-grid-queries/maximum-number-of-points-from-grid-queries.cpp | class Solution {
public:
vector<int> maxPoints(vector<vector<int>>& grid, vector<int>& queries) {
vector<pair<int,int>> sortedQueries;
for(int i = 0;i<queries.size();i++){
sortedQueries.push_back({queries[i], i});
}
sort(sortedQueries.begin(), sortedQueries.end());
... | ALGO | 0.999976 | 6.062059 |
2bb9451d-7c0f-42ab-9c6d-50412572c259 | kirillpisarev/weather-assignment | 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 |
bd62d6ad-4235-4198-8011-31c0efc2f1b7 | Ritax2003/DSA | test 2/Leaders-in-array.cpp | /*
Leaders in array
Send Feedback
Given an integer array A of size n. Find and print all the leaders present in the input array. An array element A[i] is called Leader, if all the elements following it (i.e. present at its right) are less than or equal to A[i].
Print all the leader elements separated by space and in th... | ALGO | 0.999976 | 3.82671 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.