uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
4c87ecae-6880-497d-b1e7-4977a782b577 | facebook/hhvm | third-party/tbb/src/examples/parallel_do/parallel_preorder/main.cpp | /* Example program that shows how to use parallel_do to do parallel preorder
traversal of a directed acyclic graph. */
#include <cstdlib>
#include "tbb/task_scheduler_init.h"
#include "tbb/tick_count.h"
#include "../../common/utility/utility.h"
#include <iostream>
#include <vector>
#include "Graph.h"
// some forwa... | ALGO | 0.998293 | 6.105292 |
cbe14606-092c-4545-aa79-6b53fc38d67c | judithmarg/AlgoritmosAvanzadosContests | BITree.cpp | #include<bits/stdc++.h>
using namespace std;
// extraido de GeeksForGeeks
int getSum(int BITree[], int index){
int sum = 0;
index = index +1;
while(index>0){
sum += BITree[index];
index -= index & (-index);
}
return sum;
}
void updateBIT(int BITree[], int n, int index, int val){
... | ALGO | 0.999819 | 4.834796 |
ce5eee19-0bdd-4056-bffa-cf7fb64267a6 | abdrahmanrashed/coventry | session2/Towers.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<int> v;
for(int i = 0; i < n; ++i){
int x;
cin >> x;
auto it = upper_bound(v.begin(), v.end(), x);
if(it == v.end()) ... | ALGO | 0.999898 | 4.765085 |
a0e251b9-90a1-43a5-a3bb-23ffcf6af8d4 | vanphutin/DataStructureAndAlgorithms | src/1.ArraysAndLinkedLists/Array/TrungBinhCong.cpp | #include<iostream>
#include <iomanip>
using namespace std;
float TBC(int n,int a[]){
float sum = 0;
int dem = 0;
for(int j = 0; j<n; j++){
if(a[j] % 2 == 0){
sum += a[j];
dem ++;
}
}
return (float) sum / (float)dem;
}
main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin >> a[i];
}
cou... | ALGO | 0.998635 | 3.739076 |
5c7db3e2-f75f-4921-8e8a-75838eacbae7 | imulan/procon | atcoder/abc164/d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U... | ALGO | 0.99984 | 4.072406 |
7475c06d-a94d-4e00-80c6-773e8e581c8c | InfiniteVoidLoop/ITUS | Lab 1/Exercise_4.cpp | #include<iostream>
using namespace std;
struct Node{
int data;
Node* next;
};
struct List{
Node* head;
};
Node* createNode(int data){
Node* newNode = new Node;
newNode->data = data;
newNode->next = NULL;
return newNode;
}
void printList(List L){
for (Node* ptr = L.head; ptr != N... | ALGO | 0.999034 | 4.262719 |
394ef503-3275-49b1-bf2a-c341f364034d | kaigian/LeetCodeCpp | LeetCodeCpp/LeetCodeCpp/leetcode-27.cpp | #include<vector>
using namespace std;
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int numsSize = nums.size();
if (numsSize == 0)
return 0;
int tail = numsSize - 1;
for (int i = 0; i <= tail; i++) {
if (nums[i] == val) {
nums[i] = nums[tail];
i--; tail--;
}
}
r... | ALGO | 0.99978 | 6.079103 |
b29c6bf4-e6a1-4a45-8a7a-e26f37787c42 | PranitaKute/codeforces-solutions | April Fools Day Contest 2024 B - Is it stated?/solution.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
string s;
cin>>s;
if (s.find("it") != string::npos) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
return 0;
}
| ALGO | 0.999721 | 5.121909 |
bc48cfba-2c34-44eb-ab1b-ce3aeede2bc1 | Amit006/CompitiveCode | Scaler/Reccursion/Q2.SimpleRecursioninc.cpp | #include<bits/stdc++.h>
using namespace std;
int bar(int x, int y) {
if (x == 0) return y;
return bar(x, bar(x , y-1));
}
int foo(int x, int y) {
if (y == 0) return 1;
return bar(x, foo(x, y - 1));
}
int main() {
int x = 2, y = 3;
cout << foo(x, y) << endl; // Output: 8
return 0;
} | ALGO | 0.999914 | 5.449826 |
ec60b5cb-238e-4b5a-98db-4faec1660f57 | KonstantinShemyakin/CorwansGameOfLife | src/CellAutomat.cpp | #include <GoL.h>
static cell_field field = nullptr;
static cell_field buffer_field = nullptr;
static field_config size;
void AllocFields() {
field = (cell_field)SDL_calloc(size.height, sizeof(cell_row));
buffer_field = (cell_field)SDL_calloc(size.height, sizeof(cell_row));
for (int i = 0; i < size.height; i++) {
... | TOOL | 0.877181 | 4.475608 |
f50b6baf-6328-4433-bb0f-54bac44371d4 | shivgupta198922/HACKEREARTH-MASTER | Algorithms/Dynamic Programming/2 Dimensional/Game of Strings.cpp | #include<bits/stdc++.h>
using namespace std;
class GameOFString
{
public:
bool checkV(char x)
{
if(x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u')
return true;
return false;
}
int minLength(string &x, string &y)
{
int n = x.length(), m = y... | ALGO | 0.999915 | 4.377793 |
6031a861-0ff3-450c-bfdf-77f04bd5dcb8 | Rajkumar84478/GraphAlgorithmsOnMetroNetworks | BFS.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> BFS_for_cost(vector<vector<pair<int, pair<int, int>>>> &adj, int s, int V, vector<int> &par)
{
queue<pair<int, int>> q;
q.push({s, 0});
vector<int> dis(V, INT_MAX);
dis[s] = 0;
vector<int> vis(V, false);
while (!q.empty())
{
i... | ALGO | 0.999946 | 4.275989 |
09a70ae1-abb8-4f26-9354-af557c73e43d | bala-chandar12/DSA-C- | hard/[1228] Find Greatest Common Divisor of N Numbers [H].cpp | /*
#### Find Greatest Common Divisor of N Numbers ####
Create a function that takes an array of numbers and returns the greatest common factor of those numbers.
[Examples]
___
gcd([84, 70, 42, 56]) ➞ 14
gcd([19, 38, 76, 133]) ➞ 19
gcd([120, 300, 95, 425, 625]) ➞ 5
_____
[Notes]
The GCD is the largest factor th... | ALGO | 0.996006 | 5.202693 |
d141317f-f5b9-4943-a90e-2fcb374d7d5a | eerrjhj/CP-Solutions | CodeChef/C++14/BINSTRING/58906603.cpp | #include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define debug(x) cout << x << endl;
#define ll long long
#define mod 1000000007
#define pb push_back
#define fs first
#define sec second
//fast factors
//count distinct array
// fast prime
// XOR(num & string)
int odd(int n)
{
if(n%2!=0) return 1;
... | ALGO | 0.999975 | 4.300664 |
fe5a8cf0-2cca-4dc8-a69c-75efa74645f3 | chriskiefer/libcccrt | eigen-3.4.0/doc/examples/QuickStart_example2_dynamic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXd m = MatrixXd::Random(3,3);
m = (m + MatrixXd::Constant(3,3,1.2)) * 50;
cout << "m =" << endl << m << endl;
VectorXd v(3);
v << 1, 2, 3;
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.999151 | 3.513405 |
2dc568a3-125f-48a6-a3e3-788bade8a7b3 | NadeenRR/tic_tac_game | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
1d652a9e-9144-4a63-919a-7453ee53c9df | mjmj1/codetree-TILs | 250114/최대공약수 구하기/find-the-greatest-common-divisor.cpp | #include <iostream>
using namespace std;
int n, m;
int get_gcd(int n, int m)
{
for(int i = min(n, m); i > 0; i--)
{
if(n % i == 0 && m % i == 0)
{
return i;
}
}
}
int main() {
cin >> n >> m;
printf("%d", get_gcd(n, m));
return 0;
} | ALGO | 0.999841 | 5.464458 |
9c26c0c0-7b40-4dae-ae04-6845090590c2 | ishandutta2007/codeforces | golikovnik/normal/1544/D.cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using ui64 = uint64_t;
template <class A, class B>
bool smin(A &x, B &&y) {
if (y < x) {
x = y;
return true;
}
return false;
}
template <class A, class B>
bool smax(A &x, B &&y) {
if (x < y) {
x = y;
return true;
}
return... | ALGO | 0.999965 | 4.874881 |
53d3ce88-5999-4a2b-93cb-950adbf257c4 | fciapsa/Competitive-Programming | AceptaElReto/609ReunionDeTorres.cpp | #include <iostream>
#include <vector>
#include <climits>
using namespace std;
int main() {
std::ios::sync_with_stdio(false);
int n, t, a, b, solRow = -1, bestRowVal, solCol = -1, bestColVal, aux;
cin >> n >> t;
while (cin) {
vector<int> oncol(n + 1);
vector<int> onrow(n + 1);
for (int i = 0; i < t; ++i) {... | ALGO | 0.999956 | 4.350511 |
fd0d877e-fbf3-40cb-8a2a-c2e204a9ebf4 | ChaomengOrion/CompetitiveSave | AtCoder/AtCoder Beginner Contest 381/D_1122_Substring.cpp | #include <bits/stdc++.h>
using i64 = long long;
#define LOG(...) std::cerr << "Line[" << __LINE__ << "]: " << __VA_ARGS__ << std::endl;
#define LOGV(_vec, _size) std::cerr << #_vec << " = " << '['; for (int _i = 0; _i < (_size); _i++) { std::cerr << (_vec)[_i]; if (_i != (_size) - 1) std::cerr << ", "; } std::cerr <<... | ALGO | 0.999949 | 4.735712 |
2333233a-4d6e-459a-9ccf-e22af10141b6 | VenkataAnilKumar/LeetCode | Solutions/QueueReconstructionByHeight.cpp | // Source : https://leetcode.com/problems/queue-reconstruction-by-height/
// Author : Venkata Anil Kumar
/***************************************************************************************
*
* Suppose you have a random list of people standing in a queue. Each person is
* described by a pair of integers (h, k... | ALGO | 0.999982 | 5.459786 |
7c4bda1b-4a9a-46fc-9ef1-b13e87a2d629 | indrajohn7/Problem-Solving | TECHGIG/AMAZON17/lexi.cpp | #include<bits/stdc++.h>
using namespace std;
char* longestIncreasingSubsequence(char* input1)
{
int *lis, i, j, max = 0;
int n=strlen(input1);
lis = (int*) malloc ( sizeof( int ) * n );
/* Initialize LIS values for all indexes */
for (i = 0; i < n; i++ )
lis[i] = 1;
vector<char> vec;
char ... | ALGO | 0.99999 | 4.196145 |
bac2630e-5d75-46ef-9a00-ba05bfdf57fc | hafzhang/JLCtoKicad | 3d-viewer/3d_rendering/post_shader_ssao.cpp | /**
* @file post_shader_ssao.cpp
* @brief Implement a post shader screen space ambient occlusion in software.
*/
#include "post_shader_ssao.h"
#include "../3d_fastmath.h"
POST_SHADER_SSAO::POST_SHADER_SSAO( const CAMERA& aCamera ) :
POST_SHADER( aCamera ),
m_shadedBuffer( nullptr ),
m_isUsi... | ALGO | 0.945852 | 6.616891 |
f247db2c-efec-4615-998d-ef3e272b2047 | wide777/AtCoder | ABC/ABC198/A.cpp | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int MOD = 1000000007;
static const int INF = (1 << 30);
int main() {
int n;
cin >> n;
cout << n - 1 << endl;
} | ALGO | 0.999144 | 3.160238 |
0b6f9b18-54cd-45aa-a1b1-1dc462bdcb9a | seraph27/competitve-programming | atcoder/abc323/e.cpp | // Problem: E - Playlist
// Contest: ユニークビジョンプログラミングコンテスト2023 秋 (AtCoder Beginner Contest 323)
// URL: https://atcoder.jp/contests/abc323/tasks/abc323_e
// Time Limit: 2000
// Start: Sun Nov 3 01:10:33 2024
// mintemplate
#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#define ll long long
#define ar array
#defin... | ALGO | 0.999836 | 5.216189 |
eb9df690-1078-4942-a572-f288352236cb | ZoruaSama/Solutions-4-Luogu-Problems | P1806/main.cpp | #include <iostream>
using namespace std;
long long f[501][501]; //跑了i圈 最后一次跑了j圈的方案数
int n;
int main() {
cin>>n;
cin>>n;
for(int i=1;i<=n;++i){
f[i][i]=1;
}
for(int i=1;i<=n;++i){
for(int j=1;j<i;++j){
for(int k=1;k<j && j+k<=i;++k){
f[i][j]+=f[i-j][k];
... | ALGO | 0.999744 | 3.660909 |
8481a245-0a15-4578-8817-9f744f49cf2a | shatakshishukla17/6companies30days-ShatakshiShukla | KSizedSubarrayMaximum.cpp | class Solution {
public:
// Function to find maximum of each subarray of size k.
vector<int> maxOfSubarrays(vector<int>& arr, int k) {
// your code here
int n = arr.size();
int i = 0, j = 1, maxi = 0;
vector<int> ans;
while(i < k) {
if(arr[i] > maxi... | ALGO | 0.999892 | 5.526027 |
b702b734-38e2-4479-9df9-0ec7c092b96a | abubakaristiak/CSE-Fundamentals | Basic Data Structures/Week 03- (Doubly Linked List)/Module -12/_01_Remove_Duplicate_Again.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
list<int> amerList;
int val;
while (true)
{
cin >> val;
if (val == -1) break;
amerList.push_back(val);
}
amerList.sort();
amerList.unique();
for(int val: amerList){
cout << val << " ";
... | ALGO | 0.998731 | 3.908812 |
a773e182-4cd3-4230-b1c2-c6df87900b5d | taehyeonk/Physics-simulation | lab15_Quaternion_test_init_3/FrameWork/MMatrix.cpp | /// GraphicsTown2006 - CS559 Sample Code
// written by Michael Gleicher - originally written Fall, 2000
// updated Fall, 2005
// a matrix "class" taken from my old code. ancient and embarassing,
// but useful - beware, this stuff is circa 1990!
// all references specific to Snap-Together math have been removed tho
// ... | ALGO | 0.983941 | 3.900659 |
1a894a44-5e13-431d-8333-84840686ef9e | probabilisticExecutionSymbol/symbolic-execution | jpf/z3/src/tactic/arith/bound_manager.cpp | #include "tactic/arith/bound_manager.h"
#include "ast/ast_smt2_pp.h"
#include "tactic/goal.h"
bound_manager::bound_manager(ast_manager & m):
m_util(m) {
}
bound_manager::~bound_manager() {
reset();
}
bound_manager* bound_manager::translate(ast_manager& dst_m) {
bound_manager* result = alloc(bound_manager... | ALGO | 0.957036 | 7.327234 |
706f3bc3-96f1-49fe-b945-8a73ead30657 | thinkhy/LeetCode | recorder_list.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <limits>
#include <utility>
#include <cstdio>
#include <cstring>
using namespace std;
#define DE(a)... | ALGO | 0.99999 | 5.501283 |
69eb648e-b7a0-43d9-b34d-3ffa8905182d | Harshit090/My_Flutter-Journey | flutter_change_text_on_button_click/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.998419 | 6.785645 |
43482673-f0f2-4b51-bfab-fb378aa62316 | karlkrissian/amilab | src/Algorithms/ImageDerivatives.cpp | #include "ImageDerivatives.h"
#include "GeneralGaussianFilter.h"
#include <boost/format.hpp>
//------------------------------------------------------------------------------
InrImage* Func_Laplacian( InrImage* im )
// ----------------------
{
InrImage* image_res;
std::string resname;
register i... | ALGO | 0.99873 | 5.491046 |
f1fdfc16-e349-4b41-a390-5832746a4b84 | AlejandrVilla/hash-algorithms | hmac.cpp | #include "hmac_sha256.hpp"
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream>
#include <iostream>
int main(int argc, char* argv[])
{
std::string dir = argv[1];
std::ifstream file(dir);
std::string text, clave;
std::getline(file, text)... | TOOL | 0.880151 | 4.526217 |
9ddb7571-4356-4779-8e99-9da84567a84e | gvrohan11/Airport-Algorithms | tests/test-bet_cent.cpp | #include <catch2/catch_test_macros.hpp>
#include "readdat.h"
#include <iostream>
#include "Algorithms/bet_cent.h"
using namespace std;
// IF THERE ARE NO ARROW SIGNS (-> or <-) ASSUME NODES ARE CONNECTED IN BOTH DIRECTIONS
TEST_CASE("Betweenness Centrality Dijkstra Simple") {
/*
|1| <--> |3| <--> |2... | TEST | 0.941921 | 6.203127 |
e7d2a95c-8baa-4a04-a892-f22181a5521a | 2006jjj/lafore-solution-of-exercises | Chapter 8/01.cpp | /*08_01ex.cpp
Добавьте в класс Distance из программы ENGLPLUS этой главы перегруженную операцию -, которая вычисляет разность двух интервалов. Она должна позволять выполнение выражений типа dist3=dist1-dist2;.
Предполагаем, что эта операция никогда не будет использоваться для вычитания большего интервала из меньшего (т... | ALGO | 0.856136 | 5.460973 |
210c9061-6665-400c-bc67-048bd07fd325 | sahadat-11/CSES | Restaurant_Customers.cpp | //In The Name of ALLAH
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7, mod = 1e9 + 7;
#define int long long
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
vector<pair<int, int>> p;
for(int i = 0; i < n; i++) {
int st, en; cin >> st >> en;
p.push_back({s... | ALGO | 0.999897 | 4.311924 |
2539ffef-335f-4dc1-89f9-2d6917981269 | aasis21/crux | milestone4(final_project)/programs/mutual_recurse.cpp | int odd(int n);
int even(int n);
int main()
{
// set an integer number here
int number = 23940;
// if the number is odd (1 = TRUE)
if(odd(number)==1){
print_int(1);
}
else{
print_int(0);
}
return 0;
}
// returns 0 if the given number becomes 0, so the given number is odd
// returns even(number - 1)... | ALGO | 0.999821 | 4.758138 |
e8e05a47-22e6-4be0-a252-868b61c8db1c | WangWei9705/Cplusplus | 每日一题/day20_1.cpp | /**********************************************************
* Author : WangWei
* Email : <EMAIL>
* Last modified : 2019-06-11 15:35:16
* Filename : day20_1.cpp
* Description : 字符串逆序
* *******************************************************/
#include <string>
#include <iostream>
using namespa... | ALGO | 0.999897 | 4.871696 |
27cb9cf2-a407-4d5b-8120-ac452d68c472 | Md-sakib-al-hasan/algorithm_phitor | Module 6/ds.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
vector<int> adj[N];
int main()
{
// int N=1e5+5;
// vector<pair<int,int> > adj[N];
int n,m;cin>>n>>m;
for(int i=0;i<m;i++){
int u,v,w;cin>>u>>v;
adj[u].push_back(v);
// adj[v].push_back({u,w});
}
return... | ALGO | 0.999885 | 4.472096 |
8d24d284-e311-48f4-8cb4-4704b303f6aa | pstivers3/clearn | x.categories/deitel/MFC/Ch01/Fig01_18/tester.cpp | #include <iostream.h>
void myFunction( int c );
int main()
{
int x = 0;
cout << "Please enter a number: ";
cin >> x;
myFunction( x );
return 0;
}
void myFunction( int c )
{
if ( c > 0 )
cout << "positive";
else
cout << "negative";
cout << endl;
}
| TOOL | 0.975625 | 3.664484 |
32b44880-7aa8-49c4-9355-075827e2aafb | Akubisa12/Bahan-belajar-CPP | 62. IF/main.cpp | #include <iostream>
using namespace std;
int main()
{
int a = 12;
int b = 10;
if (a > b) {
cout << "Nilai variabel a lebih besar dari variabel b" << endl;
}
return 0;
} | ALGO | 0.966576 | 3.154447 |
28d86027-3da2-457d-ada4-efc1dd8c8476 | huynhtanhoa2012/Codeforces | CodeForces Problem A/584A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n, t;
cin >> n >> t;
if(n==1 and t==10) cout << -1 << endl;
else{
if(t==10) t=1;
cout << t;
... | ALGO | 0.999647 | 4.667453 |
aa47054a-3976-4e07-ab22-c388caf248dc | harshbakori/classic_py_repo | opencv/opencv-master/samples/cpp/tutorial_code/ImgProc/periodic_noise_removing_filter/periodic_noise_removing_filter.cpp | /**
* @brief You will learn how to remove periodic noise in the Fourier domain
* @author Karpushin Vladislav, <EMAIL>, https://github.com/VladKarpushin
*/
#include <iostream>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
using namespace cv;
using namespace std;
void fftshift(const Mat& inputImg, Mat... | ALGO | 0.998203 | 4.560166 |
4634caa5-6ab7-47d6-a6c7-b90fb32fbc83 | nubot-nudt/SGLC | semgraph/3dParty/oneTBB/examples/getting_started/sub_string_finder/sub_string_finder_extended.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm> // std::max
#include "oneapi/tbb/parallel_for.h"
#include "oneapi/tbb/blocked_range.h"
#include "oneapi/tbb/tick_count.h"
static const std::size_t N = 22;
void SerialSubStringFinder(const std::string &str,
std::ve... | ALGO | 0.999849 | 6.910629 |
d0cc1272-fae9-4309-93ce-c32145a0f230 | sainidaksh45/ChronOS | priority.cpp | #include "process.h"
#include "utils.h"
#include <vector>
void priority(std::vector<Process> processes) {
int time = 0, completed = 0, n = processes.size();
std::vector<std::pair<int, int>> timeline;
std::vector<bool> visited(n, false);
while (completed < n) {
int idx = -1, min_pr = 1e9;
... | ALGO | 0.999861 | 4.7748 |
58ef8e5c-8934-428a-922a-e1bf7b19dff7 | CyberFruitSeeker/CPP_Practice | 023_ContinueBreak/023_ContinueBreak.cpp | // 023_ContinueBreak.cpp : 이 파일에는 'main' 함수가 포함됩니다. 거기서 프로그램 실행이 시작되고 종료됩니다.
//
#include <iostream>
int main()
{
// for문이나 while문안에서 break라는 구문을 사용할수 있다.
// 즉시 반복문을 종료하라.
// 중단점을 걸어보는 능력은 정말 주기 힘든 능력이다.
int Count = 0;
while (true)
{
++Count;
if (10 < Count)
{
break;
}
}
// 스킬이 있는데.
// 80데미지를 5번... | TOOL | 0.947335 | 4.007914 |
c5411e34-4c58-40ee-94ea-cde9dc794e20 | HaydenRoeder1/CS240-Data-Structures-and-Algorithms- | lab-8-spr19-HaydenRoeder1/Hash.cpp | #include "Hash.h"
#include <iostream>
using namespace std;
Hash::Hash(unsigned int size){
max_size = size;
nodes = new Node[size];
}
Hash::~Hash(){
delete[] nodes;
}
unsigned int Hash::hasher(string key){
int sum = 0;
for(int i = 0; i < key.length(); i++){
sum += key[i];
}
int index = sum % size();
... | ALGO | 0.996938 | 5.069292 |
286e0f19-7776-44b0-adc8-cb9e76626002 | minseo0102/Algorithm | SWEA/D3/1209. [S/W 문제해결 기본] 2일차 - Sum/[S/W 문제해결 기본] 2일차 - Sum.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
for (int i = 0; i < 10; i++) {
int t;
cin >> t;//test case number
vector<int> col(100,0);
int rcross = 0;
int lcross = 0;
int m = 0;
for (int... | ALGO | 0.999513 | 3.917427 |
6ce62347-b413-49c5-b802-160bed4d975b | Bhanuchennupati/csa0480 | q33.cpp | #include <stdio.h>
#include <limits.h>
#define MAX_FRAMES 3
#define MAX_PAGES 10
void initializeMemory(int memory[], int size);
void displayMemory(int memory[], int size);
int pageFault(int memory[], int size, int pages[], int pageIndex, int futureReferences[]);
int main() {
int memory[MAX_FRAMES];
int pages[MA... | ALGO | 0.999357 | 4.908378 |
74902408-c57b-4787-8962-4f729db6ac11 | yudou2018/LearningNotes | LeetCodeHot100/16接雨水.cpp | /*
* Ŀ n ǸʾÿΪ 1 ӵĸ߶ͼ
* 㰴еӣ֮ܽӶˮ
* [0,1,0,2,1,0,1,3,2,1,2,1] 6λˮ ͼ"H"ʾשͷ "="ʾˮ
* H
* H = = = H H = H
* __H = H H = H H H H H H
*/
/*
* 1α
* һα ҵǰλi߷
* ڶα ҵǰλiҿ߷
*
* α ߷еСֵ ȥǰiĸ߶
* ǵǰֱܷŵˮ
* ʱ临ӶO(3N)
* ռ临ӶO(2N) ߷
*/
class Solution1 {
public:
int trap(vector<int>& height) {
int n = height.size(... | ALGO | 0.999983 | 5.723023 |
0ce239a5-a400-45f0-b5df-e4070670a8e9 | esl000/CustomUE4VolumeRaymarching | Engine/Source/ThirdParty/ICU/icu4c-64_1/source/common/stringtriebuilder.cpp | #include "utypeinfo.h" // for 'typeid' to work
#include "unicode/utypes.h"
#include "unicode/stringtriebuilder.h"
#include "uassert.h"
#include "uhash.h"
U_CDECL_BEGIN
static int32_t U_CALLCONV
hashStringTrieNode(const UHashTok key) {
return icu::StringTrieBuilder::hashNode(key.pointer);
}
static UBool U_CALLCO... | ALGO | 0.980952 | 7.441104 |
3d4f7cc1-84be-4290-a05f-56f2c45f9958 | siddharth94/competitive | Codechef/julylunch15/pyppyct.cpp | #include <bits/stdc++.h>
using namespace std;
#define R(i,a,b) for(int i=a;i<b;i++)
#define RE(i,a,b) for(int i=a;i<=b;i++)
#define RR(i,a,b) for(int i=a;i>b;i--)
#define RRE(i,a,b) for(int i=a;i>=b;i--)
#define F(i,n) for(int i=0;i<n;i++)
#define FE(i,n) for(int i=0;i<=n;i++)
#define FR(i,n) for(int i=n;i>0;i--)
#def... | ALGO | 0.999796 | 3.262767 |
1d2397aa-0230-48e5-b8fd-976fbf8d3c8d | shreya024/Codehelp | Array/Positive_and_Negative.cpp | //Move all negative numbers to beginning and positive to end with constant extra space
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
int j = 0;
for (int i = 0; i < n; i++)
{
if (arr[i] <... | ALGO | 0.99997 | 4.519175 |
fb321945-21ca-4639-b992-cdb621e13fa5 | urstrulynishkarsh/DSA-2024 | SearchingAndSorting/19-WAPInsertionSort.cpp | #include<iostream>
#include<vector>
using namespace std;
void SelectionSort(vector<int> &arr)
{
for(int i=1;i<arr.size();i++)
{
// fetch the value
int value=arr[i];
int j=i-1;
for(;j>=0;j--)
{
// comparision
if(arr[... | ALGO | 0.99975 | 4.537577 |
d8886983-925b-4b5a-8fd5-a08dd99a5459 | Areeba1718/godot | thirdparty/msdfgen/core/Scanline.cpp |
#include "Scanline.h"
#include <cstdlib>
#include "arithmetics.hpp"
namespace msdfgen {
static int compareIntersections(const void *a, const void *b) {
return sign(reinterpret_cast<const Scanline::Intersection *>(a)->x-reinterpret_cast<const Scanline::Intersection *>(b)->x);
}
bool interpretFillRule(int inters... | ALGO | 0.909299 | 5.735757 |
3a7c1b78-704b-4c2f-8d0a-2f8fcb42a63a | am0654/LinkedLists | TraverseSinglyLinkedLists.cpp | #include <iostream>
using namespace std;
//node structure
struct Node {
int data;
Node* next;
};
class LinkedList {
public:
Node* head;
public:
//constructor to create an empty LinkedList
LinkedList(){
head = NULL;
}
//display the content of the list
void PrintList() {
... | ALGO | 0.92032 | 5.042422 |
7a28770f-17f6-413f-beaf-26d987d8d5c9 | AyushChauhan7983/DAA_Lab_Assignments | week10/ques1.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
multiset<pair<int,int>> s;
vector<int> v1(n);
vector<int> v2(n);
vector<int> ans;
for(int i = 0; i < n; i++) {
cin>>v1[i];
}
for(int i = 0; i < n; i++) {
cin>>v2[i];
}
for(int i = 0; i <... | ALGO | 0.999996 | 3.687091 |
1338c46e-0475-4b4e-97a4-586c2824305e | SuZeAI/DSA_CPP | phantubentrainhohon.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n;
cin >> n;
int a[n], ans[n];
for(int i = 0; i < n; i++){
cin >> a[i];
}
stack<int> st;
for(int i = n - 1; ~i; i--){
while(!st.empty() a... | ALGO | 0.999992 | 4.835236 |
dfe1d8c1-fd8b-46ea-91f3-89612ae90f22 | dheeraj557/PROBLEM-SOLVING | 637-average-of-levels-in-binary-tree/637-average-of-levels-in-binary-tree.cpp | class Solution {
public:
vector<double> averageOfLevels(TreeNode* root) {
vector<double> ans;
queue<TreeNode*> q;
q.push(root);
while(!q.empty())
{
long temp=0;
int size= q.size();
for(int i=0;i<size;i++)
{
TreeN... | ALGO | 0.99996 | 6.411975 |
469a4271-4c33-480d-90b0-0538a4890932 | jamesiarmes/exploring-cpp | chapter-14/exercise1401.cpp | #include <cstdio>
#include <fstream>
#include <iostream>
int main()
{
std::ifstream in{"list1402.in"};
std::ofstream out{"list1402.out"};
if (not in)
std::perror("list1402.in");
else if (not out)
std::perror("list1402.out");
else
{
int x{};
while (in >> x)
out << x << '\n';
in.cl... | TOOL | 0.89983 | 4.223208 |
2a8bd6f1-4489-4ba4-a821-d23c6b374795 | tASDFG22345/maoberlehner4 | USACO training problems/Section 1.3/namenum.cpp | /*
TASK:namenum
ID:ethanhp1
LANG:C++14
*/
#include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
string get_id(string name){
char decoder[24] = {'2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','7','7','8','8','8','9','9','9... | ALGO | 0.980374 | 4.292579 |
0b8b9af4-37e4-4ad6-8d38-a2e80adeba15 | Nidhideveloper/SDEchallenge-By-Nidhi | duplicatesinarray.cpp | #include <bits/stdc++.h>
int findDuplicate(vector<int> &arr, int n){
// Write your code here.
int slow=arr[0], fast=arr[0];
do{
slow=arr[slow];
fast=arr[arr[fast]];
}while(slow!=fast);
fast=arr[0];
while(slow!=fast){
slow=arr[slow];
fast=arr[fast];
}
return ... | ALGO | 0.99995 | 5.272337 |
07cb1ba0-7307-483b-8313-f7bb72877904 | 18629469616/18629469616 | 第3章:树与二叉树/5、演示代码(二)/4、Leetcode-111.cpp |
/*************************************************************************
> File Name: 111.cpp
> Author: hug
> Mail: <EMAIL>
> Created Time: 四 4/25 20:23:14 2019
************************************************************************/
/**
* Definition for a binary tree node.
* struct TreeNode {
... | ALGO | 0.99994 | 6.546924 |
08800266-7818-47df-be76-7a17f15f1364 | Lincito-31/Preseleccion | CSES/Problem Set/Dynamic Programming/Dice Combinations.cpp | #include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int n,dp[1000001];
int main(){
dp[1]=1;dp[2]=2;dp[3]=4;dp[4]=8;dp[5]=16;dp[6]=32;
scanf("%d",&n);
for(int i=7;i<=n;i++){
for(int j=1;j<=6;j++){
dp[i]+=dp[i-j];
dp[i]%=MOD;
}
}
printf("%d",dp[... | ALGO | 0.999987 | 4.401438 |
66feebd1-983a-43aa-99de-0748646dde4e | SunOS-Project/android_frameworks_av | media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp | //#define LOG_NDEBUG 0
#define PROP_VALUE_MAX 92
#define LOG_TAG "MediaCodecsXmlParser"
#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
#include <android/api-level.h>
#include <android-base/logging.h>
#include <android-base/macros.h>
#include <android-base/properties.h>
#include <utils/Log.h>
#include... | TOOL | 0.97506 | 4.100667 |
95162a41-d5a9-4f0f-ac8c-c9c948f3f541 | icoty/LeetCode | Algorithms/893.Groups_of_Special-Equivalent_Strings.cpp | #include "AllInclude.h"
class Solution {
public:
int numSpecialEquivGroups(vector<string>& A) {
set<string> fingerprint;
for(auto ele: A)
{
string odd = "";
string even = "";
for(int i = 0; i < ele.size(); ++i)
... | ALGO | 0.999957 | 5.855016 |
40817d38-11d4-4a8c-90bf-9213d7689266 | p-abhay/LeetCode | 994-rotting-oranges/994-rotting-oranges.cpp | class Node {
public:
int x;
int y;
int time;
Node(int x,int y,int time) {
this->x = x;
this->y = y;
this->time = time;
}
};
class Solution {
public:
int orangesRotting(vector<vector<int>>& grid) {
int rows = grid.size();
... | ALGO | 0.999959 | 6.134597 |
8014e1d2-de79-47e8-b824-0024f1c72253 | zeroonedays/DS-Algo-Cpp | Time-Complexity/big_O_logn.cpp | #include <iostream>
using namespace std;
void nlognruntime(int n){
int count=0;
// i*=2 >>
for (int i=1; i<n; i*=2){
cout << i << " ";
count++;
}
cout << "\nLoop run " << count <<" times." << endl;
}
int main() {
int n=1000;
nlognruntime(n);
}
//O(logn)
| ALGO | 0.997717 | 4.686607 |
5634838d-3f6e-448e-9ca7-cfc79cc5294c | Arshjeet-Singh/DSASheet2022 | Practice/Permutations.cpp | class Solution {
public:
void solve(vector<int> nums,vector<vector<int>> &ans,int ind)
{
if(ind>=nums.size())
{
ans.push_back(nums);
return;
}
for(int j=ind;j<nums.size();j++)
{
swap(nums[ind],nums[j]);
solve(nums,ans,ind+1)... | ALGO | 0.999997 | 6.181562 |
625017cd-bc0a-4beb-ac88-13ae983af57e | raphaelmenges/eyeGUI | externals/GLM/test/core/core_type_mat4x4.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 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.861577 | 6.887771 |
65bf3874-6b06-44a3-ad14-eb8d73155088 | shiquan-wang/LeetCode | dynamic_programming/c++/70_climbing_stairs.cpp | #include<iostream>
#include<vector>
using namespace std;
class Solution{
public:
int climbStairs(int n){
if(n == 1 || n == 2) return n;
vector<int> dp(n);
dp[0] = 1; dp[1] = 2;
for(int i = 2; i < n; ++i){
dp[i] = dp[i-1] + dp[i-2];
}
return dp[n-1];
}... | ALGO | 0.999986 | 4.274648 |
c4adf29c-7ddf-4b5f-9730-6db395abcc38 | TRGoCPftF/llvm-source | tools/llvm-dwarfdump/Statistics.cpp | #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/Object/ObjectFile.h"
#define DEBUG_TYPE "dwarfdump"
using namespace llvm;... | TOOL | 0.928274 | 6.627964 |
0e79f512-a7d8-461f-9a9b-7d71afc1c66d | Anjaligupta90/cpp-programing | Recursion/class2/findmax.cpp | #include<iostream>
using namespace std;
// int max(int a,int b)
// {
// if(a>b)
// {
// return a;
// }
// else{
// return b;
// }
// }
void findmax(int arr[],int size,int index,int &maxi)
{
if(index==size)
{
return;
}
maxi= max(maxi,arr[index]); ... | ALGO | 0.999581 | 3.904743 |
5dbaa77c-8fc8-4b10-a030-20eec481c316 | lehkhazirna/Competitive-programming | Introductory Problems/weird_algorithm.cpp | #include <iostream>
using namespace std;
int main()
{
long long n; // Hetah hian int i hman chuan a range a pel anga, answer diklo a awm ang
cin>>n;
cout<<n<<" ";
while(n!=1){
if(n%2==0){ // n hi even anih chuan 2 in divide tur tih lai
n=n/2;
}
else{ // n... | ALGO | 0.999974 | 4.583906 |
fe756388-b3f5-4c24-b00b-11549828ce28 | krishna-gavas/Competitive-Coding | codes/Sorting/InsertionSort.cpp | #include <iostream>
#include <algorithm>
using namespace std;
void InsertionSort(int A[], int n){
for(int i=1;i<n;i++){
int key = A[i];
int j = i-1;
while(j>=0 && A[j]>key){
A[j+1] = A[j];
j = j-1;
}
A[j+1] = key;
}
}
int main() {
int N;
... | ALGO | 0.999973 | 4.807722 |
eb78f6dd-c2b1-48d4-8622-f06ec44ab942 | maybelizard/OOP-Homework | Lab 2 extra/globalFunctions.cpp | #pragma once
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <ctime>
#include "movie.h"
#include "movieSeries.h"
#include "globalFunctions.h"
int compareName(Movie m1, Movie m2) {
char m1Name[256], m2Name[256];
strcpy(m1Name, m1.getName());
strcpy(m2Name, m2.getName());
int comparation = strcmp(m1Name... | TOOL | 0.924646 | 4.191926 |
9101affe-4c97-412e-8fcc-2e2ce3e5a260 | PratikSLakade/Applications-programs-in-C-C-and-Java | program428.cpp | #include<iostream>
using namespace std;
void Swap(int &A, int &B)
{
int Temp;
Temp = A;
A = B;
B = Temp;
}
int main()
{
int Value1 = 10, Value2 = 20;
cout<<"Value of Value1 variable is : "<<Value1<<"\n";
cout<<"Value of Value2 variable is : "<<Value2<<"\n";
Swap(Value1, Valu... | ALGO | 0.999836 | 5.539383 |
fa39b854-1d52-4acc-921d-8f31aa13fdbb | TasiChicken/LeetCode | cpps/1000/100/20/15.cpp | #include <iostream>
#include <vector>
#include <map>
using namespace std;
class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
vector<vector<int>> ans;
map<int, int> mp;
for(auto num : nums)
mp[num] += 1;
auto _1 = mp.begin();
for(; _1 !... | ALGO | 0.999678 | 5.588521 |
b029cab1-58fa-4314-ab0a-5e423ee7a43a | fenghuayumo/UE5Main | Engine/Source/ThirdParty/hlslcc/hlslcc/src/hlslcc_lib/opt_redundant_jumps.cpp | /**
* \file opt_redundant_jumps.cpp
* Remove certain types of redundant jumps
*/
#include "ShaderCompilerCommon.h"
#include "ir.h"
class redundant_jumps_visitor : public ir_hierarchical_visitor
{
public:
redundant_jumps_visitor()
{
this->progress = false;
}
virtual ir_visitor_status visit_leave(ir_if *);
virt... | ALGO | 0.965945 | 7.168443 |
7503b5c6-217f-411f-8505-8a1796359fbe | VijaiSankar2006/cpp-primer-5th-edition-solutions | Part_2_The_Cplusplus_Library/Chapter_12_DynamicMemory/Ex_12_4.cpp | /************************************************************************************************************************************************************
* @file Ex_12_4.cpp
* @brief Exercise 12.4: In our check function we didn’t check whether i was greater than zero. Why is it okay to omit that
* check?
* @dat... | TOOL | 0.945118 | 3.035224 |
55836ef4-b5ab-4977-a674-9399068fb223 | Drizzle210/DTQG_2021-2022 | CODE/CODEFORCES/A.(contest #724)/A.cpp | #include <iostream>
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define endl '\n'
#define MASK(i) (1LL << (i))
#define BIT(x, i) (((x) >> (i)) & 1)
#define SET_ON(x, i) ((x) | MASK(i))
#define SET_OFF(x, i) ((x) & ~MASK(i))
#define reset(arr) memset((arr) , 0 , sizeof(arr))
#de... | ALGO | 0.999768 | 3.813638 |
ac7fb1a4-eb18-4535-b366-a3a07f697623 | raincross7/code-similarity | codes/train_code/problem440/problem440_467.cpp | #include<iostream>
using namespace std;
int main(){
int N;
cin>>N;
while (N!=0)
{
int ans=0;
bool l=false,r=false,up=false;
for (int i = 0; i < N; i++)
{
string S;
cin>>S;
if(S=="ru")r=true;
else if(S=="lu")l=true;
... | ALGO | 0.9998 | 3.425023 |
cb40aeb8-0f36-40cf-8c78-afc4dcd811b0 | familyld/Coding_Interviews | C++/33_SortArrayForMinNumber/SortArrayForMinNumber.cpp | #include <cstring>
#include <algorithm>
#include <cstdio>
using namespace std;
int compare(const void* strNumber1, const void* strNumber2);
// intʮƱʾֻ10λ
const int g_MaxNumberLength = 10;
char* g_StrCombine1 = new char[g_MaxNumberLength * 2 + 1];
char* g_StrCombine2 = new char[g_MaxNumberLength * 2 + 1];
void Print... | ALGO | 0.999665 | 4.48775 |
a151fc0c-c1a6-4fbd-9c87-afa0bd7ae940 | ishandutta2007/codeforces | 12tqian/normal/1491/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define f1r(i, a, b) for (int i = a; i < b; ++i)
#define f0r(i, a) f1r(i, 0, a)
#define each(t, a) for (auto& t : a)
#define mp make_pair
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(x) begin(x), ... | ALGO | 0.999957 | 4.476157 |
74a5d47c-ae8a-4f5e-80ae-ade43c00ff35 | AnuE27/happy-tails | 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.998799 | 6.776823 |
da583dec-fdd7-406d-919e-7068012caa60 | The1one1/code | C_Schedule_Management.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e9 + 7;
bool check(int n, int mid, map<int, int> &m) {
int cnt = 0;
for (int i = 1; i <= n; i++) {
int value = m[i];
// cout << "i=" << i << " " << m[i] << " mid = " << mid << endl;
if (mid > value)
cnt += (mid - value) / 2;
... | ALGO | 0.999988 | 4.584123 |
3fda8dad-f391-4bf5-8549-697736d1bfab | Developerganesh01/Tries | xorquery.cpp | #include<bits/stdc++.h>
using namespace std;
//+x -x ? y k x^y>=k
struct node{
int ct;
node *child[2];
node()
{
ct=0;
child[0]=child[1]=NULL;
}
};
struct trie{
node *root;
multiset<int>ms;
trie()
{
root=new node;
}
void add(int num)
{
ms.insert(num);
node *curr=root;
for(... | ALGO | 0.999516 | 4.30308 |
01638172-abb0-4ba2-b474-7170aad98c88 | urstrulynishkarsh/LEETCODE-Questions | 1051-HeightChecker.cpp | #include<iostream>
#include<vector>
using namespace std;
void countSort(vector<int> &expected)
{
vector<int> count(101,0);
for(int val:expected)
{
count[val]++;
}
int j=0;
for(int i=0;i<101;i++)
{
if(count[i]!=0)
{
... | ALGO | 0.999914 | 4.638357 |
2a00082a-2283-44a4-a02c-7526bc0e3079 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/DSA/LinearDataStructures/ChefAndStreetFood_20200728132021.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999672 | 3.575077 |
3f212c84-08fc-4109-8e3c-5b9f6b6ec01e | DakshNsut/Data_Structures_and_Algorithms | Array/max_product_subarray.cpp | #include <iostream>
#include <algorithm>
using namespace std;
// To find maximum product of elements of a subarray
void max_product_subarray(int arr[], int n){
int ans = arr[0]; // initialised to arr[0] so that if there is single element and that is negative, so that is the answer
int ma = ans;
int mi = a... | ALGO | 0.999971 | 5.370121 |
5059c044-dd10-44d9-9a97-adede3ee8559 | Owmicron/CPStuff | Codeforces/AandB.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=n... | ALGO | 0.999733 | 4.380054 |
a3e7e02a-ebbe-4be3-9c93-a609620a644c | zhalok/LeetCode-Submissions | 0835-image-overlap/0835-image-overlap.cpp | class Solution {
public:
int largestOverlap(vector<vector<int>>& img1, vector<vector<int>>& img2) {
vector<pair<int, int>>v1;
vector<pair<int, int>>v2;
for(int i=0; i<img1.size(); i++){
for(int j=0; j<img2.size(); j++){
if(img1[i][j]==1){
... | ALGO | 0.99983 | 5.954112 |
fbbc0f8d-cdaf-4097-8d8f-486b744aff19 | Kopriwchin/FMI-Work | Introduction in Programming - First Sem/10-26-22/Task6.cpp | #include <iostream>
using namespace std;
int main(int x)
{
int num1, num2, num3, num4, num5;
cin >> num1 >> num2 >> num3 >> num4 >> num5;
for (int x = -100; x <= 100; x++)
{
int palindrome = num1 * (x * x * x * x)
+ num2 * (x * x * x)
+ num3 * (x * x)
+ num4 * x
+ num5;
if (palindrome >= -100 &... | ALGO | 0.99925 | 3.639223 |
4483fd7d-f991-4699-bd83-7b705edda447 | leiverandres/implementations | useful_strings.cpp | #include <bits/stdc++.h>
using namespace std;
string delete_spaces(string &str) {
str.erase(remove(str.begin(), str.end(), ' '), str.end());
return str;
}
string to_str(int a) {
std::stringstream ss;
ss << a;
return ss.str();
}
int to_int(string s) {
istringstream buffer(s);
int value;
buffer >> valu... | ALGO | 0.996341 | 3.796285 |
5b377e58-5414-44cb-b5e4-6ba56bb70d54 | snandasena/cpp-advanced-topics | ds/leetcode/graph/src/clone_graph.cpp | //
// Created by sajith on 2/23/22.
//
#include "base.h"
class Solution
{
public:
Node *cloneGraph(Node *node)
{
if (!node) return node;
unordered_map<Node *, Node *> graph;
graph[node] = new Node(node->val);
queue<Node *> que;
que.push(node);
Node *head;
... | ALGO | 0.99956 | 6.317498 |
c08733dd-1eaf-4c11-99cd-65e256b86080 | Suresh-vivek/AlgoZenith_DSA | LinkedList/23_DeleteMiddle.cpp | /*
2095. Delete the Middle Node of a Linked List
Solved
Medium
Topics
Companies
Hint
You are given the head of a linked list. Delete the middle node, and return the head of the modified linked list.
The middle node of a linked list of size n is the ⌊n / 2⌋th node from the start using 0-based indexing, where ⌊x⌋ denote... | ALGO | 0.999876 | 6.259621 |
b99360d5-0844-4795-9aa4-ebdccc98cc94 | TTalvenH/CPP_Modules | module09/ex02/src/main.cpp | #include "./PmergeMe/PmergeMe.hpp"
#include <iostream>
#include <sstream>
int main(int argc, char** argv)
{
if (argc > 2)
{
try{
for (int i = 1; i < argc; i++)
{
int value;
std::istringstream stream(argv[i]);
if (!(stream >> value) || value <= 0 || !stream.eof())
throw std::runtime_error("Error");... | ALGO | 0.994709 | 4.459392 |
9c34b16d-bb04-4ea9-95a2-dc4f3cf8c951 | bibudhlahiri/learning | SpeedTest.cpp | #include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <backward/hash_map.h>
#include <backward/list.h>
using namespace std;
/*Will insert a few thousand random <key, count> pairs to a hashtable. Will iterate a few times over over these pairs, and in each iteration,
will ... | TEST | 0.992614 | 5.51452 |
c53946af-abbe-48f8-9c2c-81cf1963187b | Gabp0/desafios-da-programacao | src/week9/calculando.cpp | #include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
#define cord pair<ll, ll>
#define edge pair<ll, ll>
#define PN cout << "\n"
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using s = short;
using us = unsigned short;
long long pinf = 9223372036854775807;
lon... | ALGO | 0.99955 | 3.785625 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.