uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
33b6e60a-dc94-4922-aa32-4ab953d35f8d | Anildudy/cracking_the_coding_interview_book_solutions | stack_queue/queue_via_stacks.cpp | #include<bits/stdc++.h>
using namespace std;
class myQueue {
stack<int> ph;
stack<int> pp;
public:
void push_back(int val){
ph.push(val);
}
int pop_back(){
if(!pp.empty()){
int v = pp.top();
pp.pop();
return v;
}
... | ALGO | 0.997222 | 4.195621 |
daf24417-8f37-471e-ad2d-eec9caa7aa13 | habibulbasharcse/C- | input_in_list.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
list<int> myList;
int size = 0;
while(true) {
int val;
cin >> val;
if(val == -1) {
break;
}
myList.push_back(val);
size++;
}
list<int> myList1;
int size1 = 0;
whil... | ALGO | 0.999885 | 3.5651 |
09d51187-292b-4f96-9f40-0b43afb43dc5 | Mahbub20/Codeforces-Coding-Solutions | A. Ehab and another construction problem.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int x,a,b;
while(cin >> x){
if(x<4)
{
cout << -1 << endl;
}
else{
if(x%2==0)
{
a = x;
b = a/2;
}
else{
a = x-1;
b = a/2;
}
cout <... | ALGO | 0.999789 | 3.863855 |
9889bb9a-c08b-46cd-978c-b1ea3a1be4ea | tanvirtareq/programming | codeforces/1024 eid.cpp | #include<bits/stdc++.h>
typedef long long unsigned llu;
using namespace std;
llu LCM(llu a,llu b)
{
llu g=__gcd(a, b);
return (a/g)*b;
}
int main()
{
llu n, t;
cin>>t;
for(llu i=1;i<=t;i++)
{
llu n, lcm=1;
cin>>n;
while(n--)
{
llu x;
ci... | ALGO | 0.999641 | 3.857671 |
ca7f137c-ffd4-4b54-969b-2c2c460f43be | laradicp/scheduling-with-cadences | f1/src/main.cpp | #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <chrono>
#include <ilcplex/ilocplex.h>
#include "Data.h"
bool solve2(Data &data, std::vector<int> &s)
{
IloEnv env;
IloModel model(env);
int positions = data.getDimension();
std::vector<int> jobsPer... | ALGO | 0.999644 | 4.480876 |
97b40b66-2b8b-43a3-a214-b5f8dc845217 | borgesdan/CmakeLibraryAndExecutableModel | Library/rectangle.cpp | #include "rectangle.hpp"
Rectangle Rectangle::Intersect(Rectangle const& value1, Rectangle const& value2) {
const auto num1 = value1.X + value1.Width;
const auto num2 = value2.X + value2.Width;
const auto num3 = value1.Y + value1.Height;
const auto num4 = value2.Y + value2.Height;
const auto num5 = value1.X > val... | TOOL | 0.992611 | 5.087862 |
f2574483-73f1-4350-b0f7-4aaa318743dd | Volverman/procon-archive | atcoder.jp/abc087/abc087_b/Main.cpp | #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
int A, B, C, X;
cin >> A >> B >> C >> X;
... | ALGO | 0.998869 | 3.914469 |
882ebd7e-d673-47f9-8a7a-eafba2dad4ab | vincent97198/competitve-programming-record | codeforce/1452B.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 100005;
int arr[N];
signed main()
{
int t; cin >> t;
while(t--){
int n; cin >> n;
int MAX=0,sum=0,MIN=1000000000+5;
for(int i=0;i<n;++i){
cin >> arr[i];
sum+=arr[i];
... | ALGO | 0.999765 | 4.331959 |
9146ac09-ae70-44bc-a465-05e46d2ecdb0 | RahulKumarHacker/CppCodes | Untitled115.cpp | using namespace std;
#include<iostream>
main()
{
int i;
string a;
cout<<"inter revesing string :";
cin>>a;
cout<<endl<<"revese string "<<a<<" is ";
i=a.length();
while(i>=0)
{
cout<<a[i];
i-=1;
}
}
| ALGO | 0.99909 | 3.286814 |
fb9dc8d2-9b76-4858-a744-3ebf6c3412b8 | Apress/learn-cocos2d-game-dev-w-ios-5 | CH04_code/DoodleDrop07/libs/Box2d/Dynamics/Contacts/b2PolygonContact.cpp | #include <Box2D/Dynamics/Contacts/b2PolygonContact.h>
#include <Box2D/Common/b2BlockAllocator.h>
#include <Box2D/Collision/b2TimeOfImpact.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Dynamics/b2WorldCallbacks.h>
#include <new>
b2Contact* b2PolygonContact::Create(b2Fixtur... | ALGO | 0.992128 | 7.25428 |
2c4f8019-927b-4f39-bd43-4ebf09957c7b | vaannisv/Leetcode-Solutions | 1-Easy/3024-Type_of_Triangle.cpp | /*Question no.3024
Type of Triangle
You are given a 0-indexed integer array nums of size 3 which can form the sides of a triangle.
A triangle is called equilateral if it has all sides of equal length.
A triangle is called isosceles if it has exactly two sides of equal length.
A triangle is called scalene if all its s... | ALGO | 0.999961 | 5.846126 |
e4de7e5e-09b7-436c-92c2-c4c1d82a3332 | YUMINYUMINLEE/codetree-TILs | 240323/세 실수의 반올림/rounding-of-three-actual-numbers.cpp | #include <iostream>
int main() {
double a,b,c;
std::cin>>a>>b>>c;
std::cout<<std::fixed;
std::cout.precision(3);
std::cout<<a<<"\n"<<b<<"\n"<<c;
} | ALGO | 0.951411 | 3.941401 |
ee7dd2ed-06a3-46de-a8dc-607dd3d969d8 | libmv/libmv | src/third_party/OpenExif/src/OpenExifJpeg/OpenExif_jdmarker.cpp | #define OE_JPEG_INTERNALS
#include "OpenExif_jinclude.h"
#include "OpenExifJpegLib.h"
typedef enum { /* OE_JPEG marker codes */
M_SOF0 = 0xc0,
M_SOF1 = 0xc1,
M_SOF2 = 0xc2,
M_SOF3 = 0xc3,
M_SOF5 = 0xc5,
M_SOF6 = 0xc6,
M_SOF7 = 0xc7,
M_JPG = 0xc8,
M_SOF9 = 0xc9,
M_SOF10 = 0xca,
M... | TOOL | 0.864304 | 4.48688 |
b04d8c93-f0fe-449d-a43d-9f6e85d42479 | HARRISAMIN432/codeforces | maximumTastiness.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> nums(n);
for (int &num : nums)
cin >> num;
sort(nums.begin(), nums.end());
cout << nums[nu... | ALGO | 0.999925 | 4.330997 |
09c336ce-d69a-4bfb-98e6-55f1e0df5ccb | ishandutta2007/codeforces | .tx/normal/911/A.cpp | #include <bits/stdc++.h>
#ifdef JLOCAL
#include "stress.h"
#endif
using namespace std;
#define rep(i, z, n) for (int i = (z); i < int(n); ++i)
#define repr(i, n, z) for (int i = int(n) - 1; i >= (z); --i)
#define shl(n) (1 << (n))
#define hbit(n, i) (((n) >> (i)) & 1)
#define STRESS 0
using lint = long long;
int a[2... | ALGO | 0.999966 | 4.242717 |
1197316d-a8e4-46fc-8256-c3a6b4641ddc | carolladeira/MAPD | dlib/test/ranking.cpp | #include "tester.h"
namespace
{
using namespace test;
using namespace dlib;
using namespace std;
logger dlog("test.ranking");
// ----------------------------------------------------------------------------------------
template <typename T>
void brute_force_count_ranking_inversions (
... | TEST | 0.870045 | 7.038505 |
c898b537-dd3d-44ad-a12a-a205b90b0301 | jevrii/storm_black | Solutions/CF/1352/C.cpp | #include <bits/stdc++.h>
#define pii pair<int, int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
#define DEBUG 1
#define cerr if (DEBUG) cerr
#define test cerr << "hi\n";
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l, r) un... | ALGO | 0.999919 | 4.253681 |
2b67759a-ad38-40ee-9392-6da472d45c3e | grayj/Jedi-Academy | codemp/botlib/be_aas_routealt.cpp |
/*****************************************************************************
* name: be_aas_routealt.c
*
* desc: AAS
*
* $Archive: /MissionPack/code/botlib/be_aas_routealt.c $
* $Author: Zaphod $
* $Revision: 5 $
* $Modtime: 11/22/00 8:47a $
* $Date: 11/22/00 8:55a $
*
*********************************... | ALGO | 0.99856 | 4.925857 |
64becb4f-48c9-4300-9a6c-b77c05fd2aa7 | santi1475/asistenciaML | backend/entrenamientos opencv ruidos/opencv-master/samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp | #include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
static void help(char ** argv)
{
cout << endl
<< "This program demonstrated the use of the discrete Fourier transform (D... | ALGO | 0.994759 | 6.214012 |
101a3422-6954-4b9e-8394-6a833d802793 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1328_6.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a = 1, n, m, res = 1;
cin >> n >> m;
if (n >= m) {
res += 6 - n;
if (6 % res == 0) {
cout << 1 << "/" << 6 / res << endl;
} else {
if (res % 2 == 0)
cout << res / 2 << "/" << 6 / 2 << endl;
else
cout << re... | ALGO | 0.999807 | 4.427832 |
2abf63f0-9b15-48e1-bed1-8959dee1bbf2 | bobot/CVC4.old-svn | examples/hashsmt/sha1smt.cpp | /*
* sha1smt.cpp
*
* Created on: Jul 13, 2012
* Author: dejan
*/
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
#include "word.h"
#include "sha1.hpp"
#include "expr/command.h"
#include <boost/uuid/sha1.hpp>
using namespace std;
using namespace CVC4;
int main(int argc, char* ... | TOOL | 0.995786 | 6.472747 |
2f4e06b3-e350-4f45-8c37-ee959b787390 | jerry3008/MyDataStructureJourney | matrix_operations/secondary_diagonal_min_max/main.cpp | #include <vector>
#include <algorithm> // For std::min and std::max
std::pair<int,int> minMaxDiagonal(const std::vector<std::vector<int>>& grid)
{
if (grid.empty() || grid[0].empty()) return {-1, -1};
int n = grid.size();
int min_val = grid[0][n-1];
int max_val = grid[0][n-1];
for(int i = 1; ... | ALGO | 0.999571 | 6.406587 |
3553758a-2d3d-45c6-97ed-e758799ae89f | footoredo/Gungnir | Code/8.14/h.cpp | #include <bits/stdc++.h>
typedef long double DB;
const DB eps = 1e-8;
const int N = 222;
struct Point {
int x, y, z;
__inline Point() {}
__inline Point(int x, int y, int z): x(x), y(y), z(z) {}
__inline Point operator+(const Point& rhs) const {
return Point(x + rhs.x, y + rhs.y, z + rhs.z);
}
__inline Point op... | ALGO | 0.999883 | 4.132789 |
3bbb0694-847b-4565-849f-a20d73f5a002 | alexandraback/datacollection | solutions_5744014401732608_0/C++/pedrohlf/B.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <map>
#include <queue>
#include <stdlib.h>
#include <set>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <unistd.h>
#include <stack>
#include <sstream>
#include <list>
#include <bitset>
#define ff first
#define ss se... | ALGO | 0.999769 | 3.779083 |
76620864-0fc5-4fc9-857e-228f7e5e1d32 | suditya/LEETCODE-Practice | 78-subsets/78-subsets.cpp | class Solution {
public:
vector<vector<int>> ans;
void dfs(int i,vector<int>& a,vector<int> path)
{
if(i>=a.size()) ans.push_back(path);
else
{
auto temp=path;
path.push_back(a[i]);
//taken
dfs(i+1,a,path);
dfs(i+1,a,te... | ALGO | 0.999942 | 6.032405 |
629efc1f-8b19-4950-82f7-933f3bbb4a27 | roaa-al-homsi/LeetCode | Easy/containsDuplicate.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <map>
#include <string>
using namespace std;
//bool containsDuplicate(vector<int>& nums)
//{
//
// unordered_set<int>v;
// int i = 0;
// int j = nums.size();
//
// while (i < j)
// {
// if (v.find(nums[i]) == v.end())
// {
... | ALGO | 0.999325 | 4.788463 |
71318a4b-dc3e-4080-9c5c-38eaa0ec3bc4 | ishandutta2007/codeforces | wenhao801/normal/1656/F.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
inline int read() {
int ret = 0, t = 1;
char c = getchar();
while ((c < '0' || c > '9') && c != '-') c = getchar();
if (c == '-') t = -1, c = getchar();
while (c >= '0' && c <= '9') ret = (ret * 10) ... | ALGO | 0.999932 | 3.891892 |
af7d585e-42ef-41b4-b9e4-cde6af22ce99 | Md-Merazul-Islam/XPSC-Batch-3 | Weekly Task/3rd week/day-5/valid_building_beatiful_array.cpp |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
int a[n];
vector<int> odd, even;
for (int i = 0; i < n; i++)
{
cin >> a[i];
if (a[i] % 2 == 0)
{
... | ALGO | 0.999864 | 4.906914 |
90a03ce4-a539-48fa-be8c-7cda6be81e26 | roman-ojha/cpp | Notes/STL/18_unordered_set.cpp | /*
*) std::unordered_set
-> Unique objects.
-> Not Sorted.
-> Unordered set is a associative container that contains set of unique objects.
-> Search, insertion, and removal have average constant-time complexity.
-> Internally, the element are organized into buckets.
... | TOOL | 0.855515 | 5.063676 |
9a1148b8-a6ec-4294-9f3f-5926c2aec440 | KMsojib/Competitive-Programming | Codeforces/B_Ilya_and_Queries.cpp | #include<bits/stdc++.h>
using namespace std;
int M, F[100002], L, R, i;
string S;
int main()
{
cin >> S >> M;
for (i = S.length() - 2; i >= 0; i--)
F[i] = F[i + 1] + (S[i] == S[i + 1]);
while (M--)
{
cin >> L >> R;
cout << F[L - 1] - F[R - 1] << endl;
}
} | ALGO | 0.999916 | 3.815372 |
7373aa2b-cb64-49a6-9240-b519caaea77a | muhamadfarissss/STD_M.Faris_2311104017 | 01_Pengenalan_CPP_Bagian_1/Code Tugas Pendahuluan/TP7/main.cpp | #include <iostream>
using namespace std;
int main()
{
int bilangan, asli, jumlah;
cout << "Masukan bilangan asli: ";
cin >> asli;
bilangan = 1;
jumlah = 0;
while (bilangan <= asli) {
if (bilangan % 2 == 0) {
jumlah += bilangan;
}
bilangan++;
}
cout ... | ALGO | 0.997181 | 4.715769 |
f80541be-8eb1-47f6-9f9a-14deca9e58ff | ColinPeppler/CompetitiveProgramming | Fall2019/NorthCentral18/OtherSide/OtherSide.cpp | #include <iostream>
using namespace std;
/*
Insight: We can combine wolves and cabbages since sheep can't be left along
with either wolves or cabbages.
Additional we can approach by only think about cases where we can succesfully
transport everything without anything being eaten. Therefore, we'll only
consider case... | ALGO | 0.999905 | 4.130492 |
1cc7a187-0ea8-4128-a20d-1a85088837a8 | AustinBoyuJiang/Competitive-Programming | Competitions/USACO/2024/December/Gold/pp3.cpp | /*
* Author: Austin Jiang
* Date: 1/7/2025 11:11:51 PM
* Problem:
* Source:
* Description:
*/
/* Configuration */
#define MULTICASES
//#define LOCAL
//#define READLOCAL
//#define FILESCOMP
//#define SETMEM
#define FASTIO
//#define NDEBUG
#define OPTIMIZE
#define INTTOLL
#ifdef OPTIMIZE
#pragma GCC optimize(2)
#p... | ALGO | 0.99976 | 4.627717 |
859f6dfb-4809-43d4-86e3-a382554594c5 | fanmuvamessi/24120346 | week2/ex5.cpp | #include<iostream>
using namespace std;
int twopointers(int a[], int n, int target)
{
int minn = 10000000;
int left = 0, s = 0;
for (int right = 0; right < n; right++)
{
s += a[right];
while (s >= target)
{
if (right - left + 1 < minn)
minn = right - left + 1;
s -= a[left];
left++;
}
}
if (m... | ALGO | 0.999968 | 4.409456 |
2dd42288-f845-4040-92d8-c9ce857a6f50 | ferreiraluisa/faculdade | S01/INF 110 - Computer Programming I/praticas/outras aulas/frac.cpp | #include <iostream>
using namespace std;
void somafrac(int na, int da, int nb, int db, int &nr, int &dr){
int simp,aux;
dr = da*db;
nr = na*(dr/da) + nb*(dr/db);
if(nr>=dr){
for(int i=1;i<=nr;i++){
if(nr%i==0 && dr%i==0){
simp = i;
}
}
}
e... | ALGO | 0.999364 | 4.847616 |
476d15c9-d445-4b0f-abdc-d21d3058d99d | backengineering/llvm-msvc | libc/src/math/generic/remainderf.cpp | #include "src/math/remainderf.h"
#include "src/__support/FPUtil/DivisionAndRemainderOperations.h"
#include "src/__support/common.h"
namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, remainderf, (float x, float y)) {
int quotient;
return fputil::remquo(x, y, quotient);
}
} // namespace LIBC_NAMESPACE
| ALGO | 0.988418 | 6.31993 |
addae3f9-a91a-4c10-aa18-f2f3cd46f79d | shishircsehstu/LeetCode | Valid Sudoku.cpp | // Problems: https://leetcode.com/problems/valid-sudoku/
class Solution {
public:
bool isValiedCol(int rowLow, int rowHi, int colLow, int colHi,vector<vector<char>>& board){
int isVisited[10];
for(int i=colLow; i<=colHi;i++){
memset(isVisited,0,sizeof(isVisited));
... | ALGO | 0.999322 | 6.853761 |
dfddfe24-5ec6-4305-b71e-98a5d310af23 | yangchang-n/study-cpp | acmicpc/Platinum/01799_P5_비숍.cpp | #include <iostream>
#include <array>
#include <vector>
using namespace std;
int N;
int bd[10][10];
bool vis_up[20] = {};
bool vis_dw[20] = {};
vector<array<int, 2>> ev;
vector<array<int, 2>> od;
int cnt = 0;
int ans = 0;
void bkt(vector<array<int, 2>>& vt, int n, int c)
{
if (n == vt.size())
{
cnt = max(c, cnt... | ALGO | 0.999842 | 4.085549 |
431891aa-2cb4-45ae-be54-d2e39b074bdc | honeyvikash/Leetcode_Solved_Problems | 3043-find-the-length-of-the-longest-common-prefix/3043-find-the-length-of-the-longest-common-prefix.cpp | class Solution {
public:
int longestCommonPrefix(vector<int>& arr1, vector<int>& arr2) {
set<string> st;
for (auto &x : arr1)
{
string s = to_string(x);
string prefix = "";
for (auto &ch : s)
{
prefix += ch;
st... | ALGO | 0.999891 | 5.680491 |
d3a6a665-1fd4-4ff5-b08c-a532cb6464e6 | JayGhz/competitive-programming | class/week7/z.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
vector<int> z_function(string s) {
int n = s.length();
vector<int> z(n);
for (int i = 1, l = 0, r = 0; i < n; ++i) {
if (i <... | ALGO | 0.9999 | 4.311142 |
2bd7a9cc-37ad-4665-ad90-4d632f34117e | goyalankit/data-cruncher | opt-markov/markov_pass_runner.cpp | #include <chrono>
#include <ctime>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <ratio>
#include <string>
#include <stdlib.h>
#include <time.h>
#include<sys/time.h>
#include "omp.h"
#include <vector>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classificatio... | TOOL | 0.961622 | 3.325655 |
47e67879-6121-4433-a59d-4c1d0f8cb7eb | alokg-812/Data-Structure-Algorithms | Leetcode/Contests/Weekly_399/String_Compression_III.cpp | class Solution {
public:
string compressedString(string word) {
string comp = "";
int n = word.size();
int i = 0;
while(i<n){
int cnt = 0;
char curr = word[i];
while(i<n and word[i] == curr and cnt <9){
cnt++;
i++;
... | ALGO | 0.999998 | 6.303583 |
5fe555d0-ebc8-4fa3-9e4b-ae217f496765 | nebulasio/nvm | llvm/lib/CodeGen/MachineSSAUpdater.cpp | #include "llvm/CodeGen/MachineSSAUpdater.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include... | TOOL | 0.991964 | 7.879014 |
05cb7d1d-8325-46fb-82aa-eefedca87cdf | karinafierro/cookbook | chapter-11/recipe-05/cxx-example/example.cpp | #include "mkl.h"
#include <cassert>
#include <cmath>
#include <iostream>
#include <random>
int main() {
// generate a uniform distribution of real number between -1.0 and 1.0
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_real_distribution<double> dist(-1.0, 1.0);
int m = 500;
int k = 1000;
... | ALGO | 0.996959 | 5.846803 |
d7b249df-011e-4b69-a40b-7b4607be7152 | sweetyhank/2023aaib2 | week06/week06-5-b.cpp | long long countSubarrays(int* nums, int numsSize, int k) {
int M=0;
for(int i=0; i<numsSize;i++){
if(nums[i]>M)M=nums[i];
}
long long int ans=0,tail =0,MN=0;
for(int head=0; head<numsSize;head++){
if(nums[head]==M) MN++;
while(MN>=k){
if(nums[tail]==M... | ALGO | 0.99994 | 5.062899 |
839ffeed-d3f3-4e23-b8c2-c4ab0127102d | worldplayinc/roborepo | robox-android/roboxtv/cores/VideoPlayer/DVDTSCorrection.cpp | #include "DVDTSCorrection.h"
#include "DVDClock.h"
#include "DVDCodecs/DVDCodecUtils.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include <cmath>
#define MAXERR DVD_MSEC_TO_TIME(2.5)
CPullupCorrection::CPullupCorrection()
{
ResetVFRDetection();
Flush();
}
void CPullupCorrection::ResetVFRDetection(vo... | TOOL | 0.876694 | 5.83308 |
c2ce2654-972a-4884-a2e6-8942366f243d | shakibhoseen/java | 1800B.cpp | #include<bits/stdc++.h>
using namespace std;
void solve()
{
int n;
cin>>n;
int small[26] = {0};
int big[26];
int operation;
cin>>operation;
string input;
cin>>input;
for(int i=0; i<n; i++)
{
if(97<=input[i] &&input[i]<=122)
{
//small letter
... | ALGO | 0.999836 | 4.384799 |
9320be95-3b8e-4ded-9f46-e4e27e9c1bc2 | SumitKrShakya/Dsa-Practice-Questions | 1_Recursion/8_Palandrome checker.cpp | #include <bits/stdc++.h>
using namespace std;
bool palchecker(string a, int s, int e)
{
if (s == e)
return true;
if (a[s] != a[e])
return false;
if (s < e + 1)
return palchecker(a, s + 1, e - 1);
return true;
}
int main()
{
string s;
cin >> s;
cout << palchecker(s,... | ALGO | 0.999904 | 4.540607 |
5670cccf-47b2-4ff6-9d5c-49236210a891 | f0cusPie/SP-IVT-20-2b | 12/12.1 - Linear search/linearSearch.cpp | #include <iostream>
#include <string>
#include "Windows.h"
#define INPUT_COUNT_MESSAGE "Enter count of items:"
#define INPUT_KEY_MESSAGE "Enter a key to found the items:"
using namespace std;
int _personsCount;
struct Person
{
string fullName;
int passportNumber;
string phoneNumber;
};
int ReadNaturalNu... | TOOL | 0.910008 | 4.663707 |
2dd6231d-d203-4902-9952-cb5cdcc2969c | ibizzn/audacity | lib-src/libvamp/host/vamp-simple-host.cpp | /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
* This "simple" Vamp plugin host is no longer as simple as it was; it
* now has a lot of options and includes a lot of code to handle the
* various useful listing modes it supports.
*
* However, the runPlugin function still contains... | TOOL | 0.876115 | 5.373444 |
74d4f5f7-8d26-4f8d-9f2b-e8741f4a31d2 | cyprus09/LeetcodePractice | LinkedList/MergeLL.cpp | #include "linkedlist.h"
//naive approach
class Solution {
public:
ListNode* mergeTwoLists(ListNode* list1, ListNode* list2) {
ListNode* temp1 = list1;
ListNode* temp2 = list2;
ListNode* merged = new ListNode();
ListNode* ans = merged;
while(temp1 != NULL && temp2 != NUL... | ALGO | 0.999701 | 5.661047 |
5cf29167-b50d-439d-8148-b92659aac33a | jigyu12/Algorithm_Problem_Solve_Beakjoon | Baekjoon_C++/2908/main.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string n1, n2;
cin >> n1 >> n2;
reverse(n1.begin(), n1.end());
reverse(n2.begin(), n2.end());
int num1 = stoi(n1), num2 = stoi(n2);
if (num1 > num2) {
cout << num1;
}
else {
cout << num2;
}
return 0;
} | ALGO | 0.99982 | 3.774105 |
dd564b65-47e8-499d-8b42-9b027cf86cea | aim-wip/frameworks_av | media/libstagefright/codecs/amrnb/enc/src/cor_h_x.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "cnst.h"
#include "cor_h_x.h"
#include "basic_op.h"
/*------------------------------------------------------------------... | ALGO | 0.999939 | 4.894512 |
db2548d9-0f2c-44f0-86f4-430ec473ecb7 | prabhjotschugh/The-Algorithms-Cpp | Queues/Stack_using_queues.cpp | #include <iostream>
#include <queue>
using namespace std;
class StackUsingQueues {
private:
queue<int> q1, q2;
public:
void push(int value) {
q2.push(value);
while (!q1.empty()) {
q2.push(q1.front());
q1.pop();
}
swap(q1, q2);
}
void pop() {
... | ALGO | 0.99941 | 6.252594 |
6b590a43-bc39-49d6-8fb9-360deae9f6e7 | sanghandsondev/SPCT_LG_sanghoang | Learning_28tech/Exercise/06_TwoPointers/MergingArray.cpp | #include <bits/stdc++.h>
using namespace std;
// BÀI TOÁN: Merge 2 mảng ko giảm thành 1 mảng ko giảm
// SOLVE: Sử dụng 2 pointer nhưng không phải trên 1 mảng mà xài trên 2 mảng, mỗi mảng 1 pointer
int n = 6, m = 7;
int a[6] = {1, 6, 9, 13, 18, 18};
int b[7] = {2, 3, 8, 13, 15, 21 , 25};
int main(){
// multiset<... | ALGO | 0.99997 | 4.064445 |
9626d106-ddec-4bb3-9862-b1883df1ecf8 | NataliaN24/Data-Structures-and-Algorithms-2023-2024 | 12.Minimal Spanning Tree/Algorithms/01 Prim .cpp | #include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <climits>
using namespace std;
struct Edge
{
int vertex;
int weight;
};
void PrimMST(const vector<vector<Edge>>& graph, int start)
{
int n = graph.size();
vector<int>key(n, INT_MAX);// Used to store the minimum weight to add a n... | ALGO | 0.999957 | 5.61979 |
be997e83-4b49-44bb-b3f3-11101b423d64 | NishantKSinha/LeetCode | 0392-is-subsequence/0392-is-subsequence.cpp | class Solution {
public:
bool isSubsequence(string s, string t) {
int m = s.length();
int n = t.length();
int i =0 , j = 0;
while(i < m && j < n){
if(s[i] == t[j]) {
i++;
}
j++;
}
if(i == m) return true;
retu... | ALGO | 0.999939 | 6.261236 |
e435d13f-238c-409d-9ac6-843cf0d1551c | alaawahba13/Problem-Solving | Interviews_Sheet/Boy_Girl.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
string s ;
cin >> s ;
int count=0;
for(int i=97;i <=123; i++){
for(int j=0 ;j <s.length(); j++){
if(s[j] == (char)i){
count ++ ;
break;
}
... | ALGO | 0.999683 | 3.62924 |
1e3c9197-d9f2-4d1d-8f7f-721ecc581ee9 | DevendraRahangdale/DSA-CPP | bubblesort.cpp | #include<iostream>
using namespace std;
int main(){
int n ,i,a[100],j;
cout<<"enter no of element in the array:";
cin>>n;
cout<<"enter array element:";
for(i=0;i<n;i++){
cin>>a[i];
}
for(i=0;i<n;i++){
for(j=0;j<n-i;j++){
if(a[j]>a[j+1]){
swap(a[j],a[j+1]);
... | ALGO | 0.999794 | 4.032066 |
ae75f007-bd19-4b27-bcad-595bc9cbaea7 | Garvit-1/DSA | 1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph/all-ancestors-of-a-node-in-a-directed-acyclic-graph.cpp | class Solution {
public:
vector<vector<int>> getAncestors(int n, vector<vector<int>>& edges) {
vector<vector<int>> res(n);
vector<vector<int>> graph(n);
for (const auto& edge : edges) {
graph[edge[0]].push_back(edge[1]);
}
for (int i = 0; i < n; ... | ALGO | 0.999993 | 6.547782 |
50c6cb1b-21ac-402f-9656-9962e79d0775 | paul-fornage/CS10A-2 | class materials/Gaddis-CPP_10e_SourceCode/Chapter 17/Program 17-25.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int searchValue; // Value to search for
// Create a vector of unsorted integers.
vector<int> numbers = { 10, 1, 9, 2, 8, 3, 7, 4, 6, 5 };
// Sort the vector.
sort(numbers.begin(), numbers.end());
// Disp... | ALGO | 0.999902 | 6.007292 |
e95d75e4-65df-4b43-9cfc-8a13739519c3 | rv404674/CPcodes | a2 online judge/div2 B/jul19/sumofdigits.cpp | #include<bits/stdc++.h>
using namespace std;
string tostring(long x){
stringstream ss;
ss<<x;
return ss.str();
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
int i,j,cnt;
long sum;
string s;
cin>>s;
cnt=sum=0;
while(1){
sum=0;
if(s.size()==1) {cout<<cnt;return 0;}
for(i=0;s[i];i++)
sum+=s[i]-'0';
s... | ALGO | 0.999803 | 3.661659 |
8dba0445-74bb-40f8-9c8a-95e80ac9af3e | InflixOP/LeetCode-CPP-Solutions | #2824 Count Pairs Whose Sum is Less than Target.cpp | class Solution {
public:
int countPairs(vector<int>& nums, int target) {
int c=0;
for(int i=0;i<nums.size()-1;i++){
for(int j=i+1;j<nums.size();j++){
if(nums[i]+nums[j]<target)
c++;
}
}
return c;
}
}; | ALGO | 0.999972 | 5.912678 |
fb1808c8-1c26-4d14-bf82-97e6814ed848 | subhasmitasahoo/CompetitiveProgramming | HAMMING_DISTANCE.cpp | class Solution {
public:
int hammingDistance(int x, int y) {
int res = 0;
while(x!=0 || y!=0){
if(x%2 != y%2){
res++;
}
x/=2;
y/=2;
}
return res;
}
}; | ALGO | 0.999964 | 5.607403 |
7143ec79-ac36-4ca0-8b0d-df4c8defaa9d | ishandutta2007/codeforces | heltion/normal/1095/F.cpp | #include<bits/stdc++.h>
using namespace std;
#define maxn 240000
typedef long long LL;
int n, m;
LL a[maxn];
struct edge{
int u, v;
LL w;
bool operator < (const edge &b){
return w < b.w;
}
}e[maxn << 1];
int f[maxn];
int get(int u){
return u == f[u] ? u : f[u] = get(f[u]);
}
int main(){
cin >> n >> m;
LL mini ... | ALGO | 0.999987 | 3.535541 |
f6ab67f6-260c-46c4-8e71-e6ac14f19e65 | vbonnici/grafe-sim | analysis/data/p01314/s569906670.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
int n;
while(cin>>n,n!=0){
int cnt=0;
for(int i=1; i<n; ++i){
int sum=0;
for(int j=i; sum<n; ++j){
sum = sum + j;
if(sum==n){++cnt;}
}
}
cout << cnt <<endl;
}
return 0;
}
| ALGO | 0.999411 | 3.835148 |
48857b04-30d8-4eeb-8097-e7c3b8e2e4c1 | nvpro-samples/nv_cluster_builder | src/nvcluster.cpp | #include <clusterizer.hpp>
#include <nvcluster/nvcluster.h>
#include <stddef.h>
#if !defined(NVCLUSTER_BUILDER_COMPILING)
#error NVCLUSTER_BUILDER_COMPILING must be defined when building the library
#endif
struct nvcluster_Context_t
{
uint32_t version = 0u;
nvcluster_Bool parallelize = NVCLUSTER_FALSE;
... | TOOL | 0.984487 | 7.577987 |
9f4aa797-e41e-4773-a310-8a2413323162 | SahilRout/CrackYourInternship-Challenge | 665-non-decreasing-array/665-non-decreasing-array.cpp | class Solution {
public:
bool checkPossibility(vector<int>& nums) {
int cnt = 0;
for(int i = 1; i < nums.size() && cnt<=1 ; i++){
if(nums[i-1] > nums[i]){
cnt++;
if(i-2<0 || nums[i-2]... | ALGO | 0.999991 | 5.802787 |
c863b5c7-232b-42e7-9d08-bc62b5a49d52 | AshishKumar555/Coding_Blocks | star_Pattern/16.cpp | #include<iostream>
using namespace std;
int main(){
for(int i=1;i<=5;i++){
for(int j=1;j<=9;j++){
if(j==6-i || j==4+i ||i==5){
cout<<"*";
}
else{
cout<<" ";
}
}
cout<<endl;
}
} | ALGO | 0.998511 | 3.387859 |
7f76f9b8-5a4a-472a-bc2f-5eff71e6f52d | tschaible45/Bigtreetech-SKR-MINI-E3 | firmware/V2.0/Marlin-2.0.8.2.x-SKR-mini-E3-V2.0/buildroot/share/PlatformIO/variants/MARLIN_F103Vx/variant.cpp | #include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
// Digital PinName array
const PinName digitalPin[] = {
PA_0, //D0
PA_1, //D1
PA_2, //D2
PA_3, //D3
PA_4, //D4
PA_5, //D5
PA_6, //D6
PA_7, //D7
PA_8, //D8
PA_9, //D9
PA_10, //D10
PA_11, //D11
PA_12, //D12
PA_13, //D... | CONFIG | 0.862358 | 3.751779 |
e9397643-4490-461c-a6a5-d8cef40a345f | ishandutta2007/codeforces | marckess/normal/75/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int, int> ii;
typedef vector<ii> vii;
#define fi first
#define se second
#define endl '\n'
#define MOD(n,k) ( (n % k) + k ) % k
#define isOn(S, j) (S & (1 << j) )
... | ALGO | 0.999992 | 4.478426 |
c3726f5d-cc86-4a6f-922f-47bb6124736d | huylq1808/Leetcode | Day0-9/Day5_18-07-24/lec12_IntegerToRoman/main.cpp | #include <iostream>
#include <map>
#include <vector>
using namespace std;
class Solution{
public:
string intToRoman(int num){
map<int, char> romanNumerals = {
{1000, 'M'},
{500, 'D'},
{100, 'C'},
{50, 'L'},
{10, 'X'},
{5, 'V'},
... | ALGO | 0.999616 | 6.388856 |
f1cc984c-e86e-4c99-8293-fe5ca7f539f8 | manel1874/MPC-Benchmark | SemiHonestYao/privPhyloTree/Alice/App.cpp | #include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
#include <vector>
#include <climits>
#include <cmath>
#include "../../../../libscapi/include/comm/Comm.hpp"
#include "../../../../libscapi/include/infra/ConfigFile.hpp"
#include "include/HamParties.hpp"
#include "include/matrixDist.hpp"
#... | ALGO | 0.990022 | 4.181508 |
1596e896-d61b-4f96-97f0-96f7eef5d14e | rothberg-cmu/rothberg-run | src/public/tests/batch/ysclass/YsMergeSort/test.cpp | #include <ysclass.h>
#include <stdio.h>
#include <stdlib.h>
YSRESULT TestSimple(void)
{
YSRESULT res=YSOK;
printf("%s\n",__FUNCTION__);
std::vector <int> key;
for(int i=0; i<10000; ++i)
{
key.push_back(rand());
}
if(YSOK!=YsSimpleMergeSort(key.size(),key.data()))
{
fprintf(stderr,"YsMergeSort returned ... | TEST | 0.907573 | 5.526778 |
70df4f98-73ba-478d-87ca-6a5fd377b59e | terror/solutions | codeforces/1418B.cpp | #pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long u... | ALGO | 0.999987 | 3.560679 |
291cea24-28af-4dcb-a83e-71d7aac84bd2 | ishandutta2007/codeforces | lucasr/normal/82/C.cpp | #include <vector>
#include <string>
#include <sstream>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
#define all(x) x.begin(),x.end()
#define FOR(it,x) for(__typeof(... | ALGO | 0.999996 | 3.899193 |
b24d6142-2eca-46e0-abf0-24f5d64d48d9 | hiteshv01/6Companies30Days | Amazon/Maximum_Profit.cpp | // { Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int maxProfit(int K, int N, int A[]) {
vector<vector<int>> dp(K+1,vector<int> (N+1,0)) ;
//
for(int i=1 ;i<... | ALGO | 0.999803 | 5.286619 |
4f1e2502-6732-4b52-8fa7-7286105dd30d | Bardli/EECS4088 | ETL&STL/test/STL_min.cpp | #include <vector>
#include <algorithm>
#include <iostream>
#include <chrono>
int main() {
std::vector<int> numbers;
// Fill the vector
for (int i = 99; i >= 0; --i) {
numbers.push_back(i);
}
auto start = std::chrono::high_resolution_clock::now();
auto minIt = std::min_element(numbers.... | ALGO | 0.998138 | 6.472755 |
31e3dfca-2fcc-4040-9a89-05f1190ab2dc | Mizanur1692000/Data-Structure-Problems | 15. Quick sort using linked list c++.cpp | //Quick sort using linked list
#include <cstdio>
#include <iostream>
using namespace std;
struct Node {
int data;
struct Node* link;
};
void pushData(struct Node** headRef, int newData)
{
struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
newNode->data=newData;
newNode->link=NULL;
st... | ALGO | 0.999995 | 5.129253 |
c5a256a0-f1cc-49e4-aba1-39920112b842 | Johniel/contests | atcoder/abc293/G/main.cpp | // github.com/Johniel/contests
// atcoder/abc293/G/main.cpp
#include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
// #define endl "\n"
using namespace std;
template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.s... | ALGO | 0.999958 | 4.135688 |
ae909348-9307-486e-89de-687854f2356a | zeropool/Vigoth | C#/Research/QuantLib-1.8/ql/timegrid.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <ql/timegrid.hpp>
#include <iomanip>
namespace QuantLib {
TimeGrid::TimeGrid(Time end, Size steps) {
// We seem to assume that the grid begins at 0.
// Let's enforce the assumption for the time being
... | ALGO | 0.924471 | 7.494493 |
324c9503-0dda-4fb7-abd4-1761a4d77ab5 | ishandutta2007/codeforces | alishahali1382/normal/1037/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int MAXN=1000 * 1000 + 10;
int n, s, ans, m;
char a[MAXN], tmp;
int A[MAXN];
int main(){
ios_base::sync_with_stdio(false);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
cin>>n;
for (i... | ALGO | 0.999945 | 3.566741 |
a1f04942-6e7f-4989-a41e-1f25eb1a58ab | Devansh8954/program-cpp | 2D array programs/Compress_the_String.cpp | /*
Compress the String
Write a program to do basic string compression. For a character which is consecutively repeated more than once, replace consecutive duplicate
occurrences with the count of repetitions.
Example:
If a string has 'x' repeated 5 times, replace this "xxxxx" with "x5".
The string is compressed only w... | ALGO | 0.999989 | 5.86462 |
a1c574de-d25e-4f90-95fa-279c1fe05d2a | Rohit7798C/CPPCrash | week7/4_recursion_class_III/1_recursion_new_pattern.cpp | /*Recursion New Pattern
Include-Exclude Pattern
- Firstly we will include that thing and check for the answer
- Secondly we will exclude that thing and check for the answer
- Lastly we will choose the best answer from above both options.
*** Sub-String ***
- It is a continuos part of string(e.g. sub-string).
*** Sub-... | ALGO | 0.999964 | 5.043287 |
03472ade-523e-41f5-9b5f-9f691771945f | Devchawla2608/100Days | Day153/GfgDaily.cpp | class Solution {
public:
int getMinDiff(int arr[], int n, int k) {
if(n == 1) return 0;
sort(arr , arr + n);
int diff = arr[n-1] - arr[0];
int mn , mx;
for(int i = 1 ; i<n ; i++){
if(arr[i]-k<0) continue;
mx = max(arr[i-1] + k , arr[n-1] - k);
... | ALGO | 0.999977 | 5.017657 |
4d6cb399-a375-482d-a137-5432eab04045 | chapuni/libcxx | test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp | // <vector>
// template <class... Args> iterator emplace(const_iterator pos, Args&&... args);
#include <vector>
#include <cassert>
#include "min_allocator.h"
#include "asan_testing.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
{
std::vector<int> v;
v.reserve(3);
assert(... | TEST | 0.943059 | 5.680536 |
ca3b06de-ecd6-4da8-bf06-5fdaf927e410 | Lord-Lava/Leetcode-Stuff | 0033-search-in-rotated-sorted-array/0033-search-in-rotated-sorted-array.cpp | class Solution {
int findPivot(vector<int>&nums) {
int N = nums.size();
int lo = 0;
int hi = N-1;
while(lo<=hi) {
int mid = lo+(hi-lo)/2;
if(nums[(mid-1+N)%N] < nums[mid] && nums[(mid+1)%N] < nums[mid]) {
return mid;
} else if(nums[... | ALGO | 0.999998 | 6.491778 |
6e745206-59d1-43d7-9f7d-2c70ed3c666c | 01prashu/Data-Structure-Algorithm | Tree/16BST_impli.cpp | #include<iostream>
#include <queue>
using namespace std;
class node
{
public:
int data;
node *left;
node *right;
node(int d)
{
this->data=d;
this->left=NULL;
this->right=NULL;
}
};
node *create_BST(node *root , int d)
{
if(root == NULL)
{
root=new nod... | ALGO | 0.99998 | 4.55998 |
19507a7f-5691-47a8-96fb-8b676d2def00 | ishandutta2007/codeforces | dreamoon_love_aa/normal/1455/B.cpp | #include<bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define MP make_pair
#define PB emplace_back
using namespace std;
bool valid(int now, int k, int x) {
int v = now - x;
return v != 1 && v != (2LL + k + 1) * k / 2 - 1 && v <= (2LL + k + 1) * k / 2;
}
void solve() {
int x;
scanf("%d", &x);
int n... | ALGO | 0.999928 | 4.141611 |
799c89d6-a140-4796-9c30-b34431e6450b | tanisha10101/Data-Structures-and-Algorithms | reverse_arr.cpp | #include <iostream>
using namespace std;
int arr[50];
void reverse(){
int size;
cout << "enter size of array: " <<endl;
cin>> size;
cout << "enter elements: " <<endl;
for(int i = 0; i<size; i++){
cin >> arr[i];
}
cout << "array is: " << endl;
for(int i = 0; i<size; i++... | ALGO | 0.99066 | 3.90201 |
bc393986-3698-4027-a345-6e7e401b84e4 | phantomwolf/leetcode-problems | Leetcode/0123-BestTimeToBuyAndSellStockIII/cpp/solution2.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int n = prices.size();
// From right to left
vector<int> rightProfits(n+1, 0);
int maxPrice = prices[n-1];
for (int i = n-2; i >= 0; i--) {
rightProfits[i] = max(rightProfits[i+1], maxPrice-prices[i]);
... | ALGO | 0.999926 | 6.27421 |
967479c3-471d-4e21-8f63-af92ba6ea1e2 | AyushMakone/CPP-Theory | 6_Iterative function to calculate factorial.cpp | #include <iostream>
using namespace std;
// Iterative function to calculate factorial
unsigned long long factorialIterative(int n) {
unsigned long long result = 1; // Start with 1, as factorial of 0 is 1
for (int i = 1; i <= n; ++i) { // Loop from 1 to n
result *= i; // Multiply resul... | ALGO | 0.999879 | 6.561732 |
ac341566-e268-46de-8256-16f7b387b766 | Sudhanshu-273/LeetCode | 1046-max-consecutive-ones-iii/max-consecutive-ones-iii.cpp | class Solution {
public:
int longestOnes(vector<int>& nums, int k) {
int l = 0, r = 0;
int n = nums.size();
int count = 0;
int maxlen = 0;
while(r < n) {
if(nums[r] == 0) {
while(count >= k) {
if(nums[l] == 0) {
... | ALGO | 0.99997 | 6.247605 |
2d9f6d74-2ac5-40eb-95c3-2507def611b6 | monai/node-imagesearch | deps/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Eigen::MatrixXf m(2,2);
m << 1, 2,
3, 4;
//get location of maximum
MatrixXf::Index maxRow, maxCol;
float max = m.maxCoeff(&maxRow, &maxCol);
//get location of minimum
MatrixXf::Index minRow, m... | ALGO | 0.999724 | 4.010038 |
1498f621-bc7d-4880-b4ee-e5a71e9d14ad | hairjd2/Group5USSIM | prototype.cpp | /*
* File: MLS_proto.cpp
* Project: CMPE 349 USSIM, Spring 2023
* Author: Nick Myers
* Date: 04/26/2023
* E-mail: <EMAIL>
*
* Create prototype for Sine function output
*/
// Libraries
#include <iostream>
#include <string>
#include <math.h>
#include <cmath>
#include <fstream>
using namespace std;
// Constants
#define... | ALGO | 0.912216 | 5.455737 |
d5cca481-c865-4e0f-a36e-b3003dac9e90 | rrrs07/DSA_practice | strings/LC questions/easy/remove_duplicates.cpp | // 1047. Remove All Adjacent Duplicates In String
// You are given a string s consisting of lowercase English letters. A duplicate removal consists of choosing two adjacent and equal letters and removing them.
// We repeatedly make duplicate removals on s until we no longer can.
// Return the final string after all ... | ALGO | 0.999928 | 6.457827 |
6440e34d-7264-4efd-b84e-1cc355a76cb2 | shivgupta198922/HACKEREARTH-MASTER | Codemonk/Level-9/Hashing/Little Jhool and the matchmaker.cpp | #include<bits/stdc++.h>
using namespace std;
bool jhooli[26];
int match_string(string a)
{
bool match[26];
memset(match, false, 26 * sizeof(bool));
for(int i = 0; i <= a.length() - 1; i++)
{
if(a[i] >= 97 && a[i] <= 122)
match[a[i] - 'a'] = 1;
else if(a[i] >= 65 && a[i] <= 9... | ALGO | 0.999974 | 3.850229 |
7f9a927a-3d51-4e28-9c38-2f8d16d2fcdb | starswap/CompetitiveProgramming | CodeForces/1929/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<vector<int>> AL;
const int MAX_K = 20;
int DP[(1 << MAX_K)];
map<pair<int, int>, int> edge_covers;
const int INF = 1e9+7;
bool compute_path(int u, int v, int i, int p, int k) {
if (v == i) return true;
if (i != v) {
for (int ... | ALGO | 0.999786 | 5.461024 |
c5e1832f-05fa-4780-9873-c8688b65ebe9 | 144bharat/DSA | day7 - Arrays/LargestElement.cpp | #include<iostream>
#include<vector>
using namespace std;
int largestElement(vector<int> &arr, int n) {
// Brute Force
// sort(arr.begin(),arr.end());
// return arr[n-1];
// Optimal Solution
int largest = arr[0];
for(int i=1;i<arr.size();i++)
{
if(largest<arr[i])
{
... | ALGO | 0.998732 | 4.316102 |
49383975-44bb-48c4-bdb7-f8ce133b3034 | sanketdisale871/DSA | 3394-minimum-array-end/minimum-array-end.cpp | class Solution {
public:
typedef long long int ll;
long long minEnd(int n, int x) {
string b = bitset<32>(x).to_string();
b = "000000000000000000000000000000000000"+b;
string binNMO = bitset<32>(n-1).to_string();
ll j = binNMO.size()-1;
for(ll i = b.size()-1;i>... | ALGO | 0.999913 | 4.947505 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.