uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7bbb366e-b11f-44aa-a6ed-f0c80fb487d5 | Laxmikant3/Dsa_cpp | 07. Sorting/Bubblesort.cpp | #include <bits/stdc++.h>
using namespace std;
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
// A function to implement bubble sort
void bubbleSort(int arr[], int n)
{
int i, j;
for (i = 0; i < n-1; i++)
// Last i elements are already in place
for (j = 0... | ALGO | 0.999568 | 5.158766 |
1b1791ce-99bf-46e7-b27d-11b281b48819 | ClaudiooBarbieri/challenges-pacs | challenge-3/src/JacobiSolver.cpp | #include "JacobiSolver.hpp"
namespace challenge3{
JacobiSolver::JacobiSolver(const Mesh2D & mesh_, const std::string & function, unsigned int nMax_, double tol_, const std::string & bCond) : mesh{mesh_},nMax{nMax_},tol{tol_} {
/// set number of points and spacing
nx = mesh.getNx();
... | ALGO | 0.999922 | 6.024433 |
954e6ef8-790a-471d-a24d-94d4e88ffa65 | LeeYH94/ps_acmicpc | 1065.cpp | #include <iostream>
using namespace std;
int main(){
int n;
int cnt = 0;
cin >> n;
int a, b;
for(int i = 1; i <= n; i++){
if(i < 100){
cnt++;
continue;
}else if(i == 1000){
continue;
}else{
a = i / 100 - (i / 10) % 10;
b = (i / 10) % 10 - i % 10;
if(a == b) cn... | ALGO | 0.999403 | 4.175498 |
e9d34f6f-a08e-4575-8793-64fdbf8e8b2e | UCM-237/paparazzi_ucm | sw/airborne/modules/ins/ins_mekf_wind.cpp | /**
* @file modules/ins/ins_mekf_wind.cpp
*
* Multiplicative Extended Kalman Filter in rotation matrix formulation.
*
* Estimate attitude, ground speed, position, gyro bias, accelerometer bias and wind speed.
*
* Using Eigen library
*/
#include "modules/ins/ins_mekf_wind.h"
#include "generated/airframe.h"
#if... | ALGO | 0.944719 | 7.123877 |
4fa2865f-9a99-40d7-a9e1-6c49a82fdff6 | adamjatim/cpp_dasar | kelas_cpp/07_array/04_cari_array.cpp | // program ini dapat mencari nilai dalam suatu array
#include <iostream>
using namespace std;
int main()
{
int angka[] = {10, 20, 30 ,40, 50, 60, 70, 80, 90};
int x;
// sizeof(int) on a 32-bit machine, will return value 4 byte
// sizeof(int*) on a 64-bit machine, will return value 8 byte
int ukuran... | ALGO | 0.999282 | 4.056267 |
5c14f84f-4f61-4bfd-a107-7e33a5d7b0b4 | hello-world0421/Algorithm-Code-Repository | codeforces_code/CR983/补题/A.cpp | #include <bits/stdc++.h>
void solve() {
int n; std::cin >> n;
int a = 0;
for (int i = 0, num; i < 2 * n; i++) {
std::cin >> num;
a += num;
}
std::cout << (a & 1) << ' ' << std::min(a, 2 * n - a) << '\n';
}
int main() {
std::cin.tie(nullptr)->sync_with_stdio(false);
int tt;... | ALGO | 0.999074 | 4.416835 |
e12151cc-e2c7-40d5-a3bc-e524534f378a | Anupsimha/DSA-Daily-Grind | Leetcode/Arrays/605_CanPlaceFlowers.cpp | // My Approach - Approach I
// bool canPlaceFlowers(vector<int>& flowerbed, int n) {
// int m = flowerbed.size();
//
// for(int i = 0 ; i < m ; i++){
// if(flowerbed[i] == 0){
//
// bool leftEmpty = (i == 0 || flowerbed[i - 1] == 0);
// bool rightEmpty = (i == m - 1 || flowerbed... | ALGO | 0.999994 | 6.3459 |
a12cdfcd-fd8e-46df-9baa-176f24e59d61 | ShivamRajSingh/Codeforces | CPP/Factorial_yen_coin.cpp | #include<iostream>
#include<vector>
using namespace std;
int main()
{
long long int p;
cin >> p;
vector<long long int> v(11,1);
for(int i =1; i<11; i++)
v[i] = (i+1)*v[i-1];
long long int count =0;
while(p > 0){
long long int t = -1;
for(int i =0; i < 11;i++){
... | ALGO | 0.999867 | 3.560495 |
4cf8c3a7-a1a9-48fe-8f8b-ecd21c7d6bf6 | kkpan11/apple-llvm-project | bolt/lib/Passes/HFSort.cpp | #include "bolt/Passes/HFSort.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <unordered_set>
#define DEBUG_TYPE "hfsort"
namespace opts {
extern llvm::cl::opt<unsigned> Verbosity;
}
namespace llvm {
namespace bol... | ALGO | 0.99846 | 6.844934 |
0899c353-69ec-42e7-a42d-e88d0367885d | wenchy/Algorithm | Sort/InsertionSort/shellSort.cpp | #include <iostream>
#define N 10
using namespace std;
void printArray(int a[], int n)
{
for(int i = 0; i < n; i++)
{
cout << a[i] << " ";
}
cout << endl;
}
void shellSort(int a[], int n)
{
int i, j, increment;
int temp;
for(increment = n/2; increment > 0; increment /= 2)
{
... | ALGO | 0.999955 | 4.936599 |
aa082124-c95a-4e9b-9856-bab79ad5a8ae | iagoofelipe/Geometricos | retangulo/Retangulo.cpp | #include <iostream>
#include <string>
#include <math.h>
#include "Retangulo.h"
COORDENADA getCoordenada(double x, double y) {
COORDENADA c;
c.x = x;
c.y = y;
return c;
}
void Retangulo::showMsg(std::string msg) {
std::cout << BLUE << "[PROCESS] " << NORMAL << spacerString(msg, STRING_SIZE);
}
vo... | TOOL | 0.952533 | 4.805972 |
b6020426-acc0-4af4-848a-f86bc7fd8e3c | SleeplessJake/Data-Structures | Binary Tree/BinaryTree.cpp | #include "BinaryTree.h"
#include "iostream"
enum comparrsion {
GREATER_THAN_ROOT = 1,
LESS_THAN_OR_EQUAL_ROOT = 0
};
// Accessors // Getters //
template <typename T>
Node<T> *BinaryTree<T>::getRoot() const { return this->root; }
// Mutators // Setters //
template <typename T>
void BinaryTree<T>::setRoot(Node... | ALGO | 0.999135 | 5.320188 |
4eec91c0-e0ce-47c3-9f14-55a86d765aa1 | akashrautela/p3 | Class Work (13-6-19)/LL_insertion_at_back.cpp | #include<iostream>
using namespace std;
class node
{
public:
int data;
node *next;
};
void insert_at_back(node **head,int data)
{
node *tmp =new node();
tmp->data = data;
tmp->next=NULL;
if(*head == NULL)
{
*head=tmp;
return;
}
node *lastnode=*head;
while(lastnod... | ALGO | 0.998389 | 4.229905 |
f738efb8-6bb4-4a54-8043-9a7e0461b7ca | Ujjwalsharma7/DSA_Algorithms | Arrays/minmax.cpp | #include<bits/stdc++.h>
using namespace std;
struct pairr
{
int minn;
int maxx;
};
struct pairr maxmin(int a[],int n)
{
struct pairr p;
if(n==1)
{
a[0]=p.maxx=p.minn;
return p;
}
if(a[0]>a[1])
{
p.maxx=a[0];
p.minn=a[1];
}
else if(a[0]<a[1])
{... | ALGO | 0.999861 | 3.516351 |
f7868ec6-b163-402c-af21-2e9841c8e041 | maruf-ahammed-75/problem-solve-for-cp | Code Forces/Max_Plus_Size__Codeforces_Round_975.cpp | // Max_Plus_Size__Codeforces_Round_975.cpp
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void IAmHere(){
int n ;
cin>>n;
vector<int>a(n);
int mx = INT_MIN;
for(auto &i :a){
cin>>i;
mx = max(i,mx);
}
int in = -1;
bool flag =0;
for(int i=0 ; i<n ; ... | ALGO | 0.999694 | 4.78521 |
a256be32-041e-4b8d-8271-0efe1928c040 | yashsiwach/DSA-Notes | DSA_Sheet_Love Babbar/Arrays/6. Union and Intersection of two arrays/Solution_simple_Intersection.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
void findIntersection(vector<int>&nums1,vector<int>&nums2){
// Step - 1 => Sorting step
sort(nums1.begin(),nums1.end());
sort(nums2.begin(),nums2.end());
vector<int>ans;
set<int>unique;
// Step - 2 => Play... | ALGO | 0.999977 | 4.90122 |
adda417e-80e8-4ac6-a7d8-500fa6a6bef7 | mmatrosov/FKN2020 | preliminary/B/33905303.cpp | #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include ... | ALGO | 0.999813 | 4.1949 |
6d53be3d-c5f7-4590-8be5-f4038c5d4d6d | holographica/Daisy_Gran | DaisySP/DaisySP-LGPL/Source/Utility/port.cpp | #include <math.h>
#include <stdlib.h>
#define ROOT2 (1.4142135623730950488)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "port.h"
using namespace daisysp;
void Port::Init(float sample_rate, float htime)
{
yt1_ = 0;
prvhtim_ = -100.0;
htime_ = htime;
sample_rate_ = sample_r... | ALGO | 0.998181 | 4.187156 |
14b2c95c-cfbe-444e-9899-fbed0cfe5c1f | its-Hitesh/Codeforeces-questions | B_EhAb_AnD_gCd.cpp | #include <bits/stdc++.h>
#include <bits/extc++.h>//
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long ;
#define pb push_back
#define ld long double
#define sz size()
#define foo(i,a,b) f... | ALGO | 0.99953 | 5.266879 |
9d98bdb8-9e5d-4837-a727-2a3e9d46b927 | benjiro52/course.C.plus.plus | old_tasks_2/lucky_kaitki.cpp | #include <iostream>
using namespace std;
int main()
{
for (int number = 100000; number <= 999999; number ++) {
int a = number / 100000 % 10;
int b = number / 10000 % 10;
int c = number / 1000 % 10;
int d = number / 100 % 10;
int e = number / 10 % 10;
int f = number ... | ALGO | 0.999281 | 3.820832 |
dd681250-63fe-4122-82b3-61d7d54be605 | ChuanqiXu9/clangd-for-modules | clang/test/SemaTemplate/ackermann.cpp | // RUN: %clang_cc1 -fsyntax-only -verify %s
// expected-no-diagnostics
// template<unsigned M, unsigned N>
// struct Ackermann {
// enum {
// value = M ? (N ? Ackermann<M-1, Ackermann<M, N-1> >::value
// : Ackermann<M-1, 1>::value)
// : N + 1
// };
// };
template<unsigned M, u... | ALGO | 0.867499 | 5.812396 |
1746c0b8-085d-420d-90b0-24a746e49c30 | grybd/Algorithms | 数组/移动零.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
void moveZeroes(vector<int>& nums) {
int i=0,j=1;
while(j<(int)nums.size()){
if(nums[i]==0&&nums[j]!=0){
swap(nums[i],nums[j]);
i++;
j++;
}else if(nums[i]==... | ALGO | 0.999983 | 6.001035 |
925fbd6d-ffe1-40b7-99fc-42896b64e280 | fabianmakhdoomi/C-Programs | compare_string.cpp | #include <iostream>
using namespace std;
int main() {
char str1[100], str2[100];
cout << "Enter the first string: ";
cin >> str1;
cout << "Enter the second string: ";
cin >> str2;
int i = 0;
bool areEqual = true;
while (str1[i] != '\0' && str2[i] != '\0') {
if (str1[i] != str... | ALGO | 0.998092 | 3.931229 |
4178b971-12cf-47d6-85bf-ab868bed0c02 | onkar-sawarna/Competitive-Programming | CodeChef_Problems/PCJ18B.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("Input.txt", "r", stdin);
freopen("Output.txt", "w", stdout);
#endif
int T;
cin>>T;
while(T--)
{
long N; //N8N chessboard
cin>>N;
int i,count=0;
for(i=1;i<=N;i=i+2)
{
c... | ALGO | 0.997928 | 4.576117 |
0d996a2f-1302-4198-8e54-04b748d4113d | SahinBabazada/news | 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 |
92ebbd3d-35cc-4b7c-a858-9ab77382d891 | raincross7/code-similarity | codes/train_code/problem287/problem287_161.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
signed main(){
int n;
cin>>n;
vector<ll> a(n);
for(auto& ai:a)cin>>ai;
map<ll,ll> odd,eve;
for(int i=0;i<n;++i){
if(i&1)odd[a[i]]++;
else eve[a[i]]++;
}
using pll = pair<ll,ll>;
vector<pll> a_odd,a_eve;
for(auto x:odd)a_od... | ALGO | 0.999981 | 4.02414 |
c865462a-4d3d-42f7-9a5f-7ebb262bbff4 | Warawreh/CP-Library | Contests/Google_hashcode/Google Hashcode/random.cpp | #include <bits/stdc++.h>
using namespace std;
struct library{
// t number of days to check;
// n number of books in the library;
// m number of books to be read in a day;
int id, N,T, M;
vector<int> books;
void read(){
cin >> N >> T >> M;
for(int i=0; i<N; i++){
int a;
cin>>a;
books.push_back(a);
... | ALGO | 0.999949 | 3.697137 |
7513643d-9d45-4c01-a578-6d1635c15aa9 | Kristoff-starling/OJ-Programmes | Codeforces/[Codeforces-219D]Choosing Capital for Treeland.cpp | #include <cassert>
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cstdlib>
#include <utility>
#include <cctype>
#include <algorithm>
#include <bitset>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#define LL long... | ALGO | 0.999975 | 4.078468 |
d168b3eb-7248-477e-b3fe-85d102f983ab | niralisureja/C-CODE | 1497-design-a-stack-with-increment-operation/design-a-stack-with-increment-operation.cpp | class CustomStack {
public:
CustomStack(int maxSize) : maxSize(maxSize) {}
void push(int x) {
if (stack.size() == maxSize)
return;
stack.push(x);
pendingIncrements.push_back(0);
}
int pop() {
if (stack.empty())
return -1;
const int i = stack.size() - 1;
if (i > 0)
pe... | ALGO | 0.999188 | 5.739202 |
7199eae5-f1f7-449e-a720-3e4c541c4f18 | sarvex/leetcode-nelua | solution/0500-0599/0556.Next Greater Element III/Solution.cpp | class Solution {
public:
int nextGreaterElement(int n) {
string s = to_string(n);
n = s.size();
int i = n - 2, j = n - 1;
for (; i >= 0 && s[i] >= s[i + 1]; --i)
;
if (i < 0) return -1;
for (; s[i] >= s[j]; --j)
;
swap(s[i], s[j]);
... | ALGO | 0.99996 | 5.497602 |
406c754d-a254-4a40-8596-1bebca8035f4 | LJ-Zer/Trashbin_Project | Trained-Model/Trained_1/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/topk_v2.cpp | #include <stdint.h>
#include "edge-impulse-sdk/tensorflow/lite/kernels/kernel_util.h"
#include "edge-impulse-sdk/tensorflow/lite/micro/kernels/kernel_util.h"
namespace tflite {
namespace topk_v2 {
constexpr int kInputTensor = 0;
constexpr int kInputTopK = 1;
constexpr int kOutputValues = 0;
constexpr int kOutputIndex... | ALGO | 0.997285 | 7.762837 |
397ec098-03ea-402c-9dff-2e8e09bf4c97 | alexandraback/datacollection | solutions_5765824346324992_0/C++/srMatanza/barber.cpp | #include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int lcm(vector<int> v)
{
sort(v.begin(), v.end(), std::greater<int>());
int l=v[0];
for(int i=1; i<v.size(); i++)
{
int a = max(v[i], l);
int b = min(v[i], l);
i... | ALGO | 0.99986 | 3.697624 |
c6a7cf32-ba75-4b3d-bb89-ef9e5d7ee6a9 | Abhisek-Ray99/Ds-Algo-code | Binary-search-tree/BinaryTree-is-valid-BST-or-not.cpp | // The Binary Tree is BST or not
#include<iostream>
using namespace std;
template<typename T>
class BTNode{
public:
T data;
BTNode *left;
BTNode *right;
BTNode(T data){
this->data = data;
left = NULL;
right = NULL;
}
};
void PrintTree(BT... | ALGO | 0.999877 | 5.35135 |
32966f94-e193-449d-b73a-f69128136d09 | epiitom/DSA | basics/prime.cpp | #include<iostream>
using namespace std;
int main() {
int n ;
bool is_prime = true;
cout << "Enter the number :";
cin >> n;
if(n==0 || n==1){
is_prime = false;
}
for (int i = 2; i <= n/2 ; i++){
if( n % i == 0){
is_prime = false;
break;
}
}... | ALGO | 0.999831 | 3.225926 |
4bf8525d-f97b-49c7-acd5-b7629128cd2b | Ahmed-Bensalem/TP5CPP | EX3TP5/point.cpp | #include "Point.h"
using namespace std;
Point::Point(float x, float y) : x(x), y(y) {}
Point::Point(const Point& autre) : x(autre.x), y(autre.y) {}
void Point::affiche() const {
cout << "(" << x << ", " << y << ")" << endl;
}
bool Point::comparer(const Point& p1, const Point& p2) {
return (p1.x == p2.x && p1... | TOOL | 0.870085 | 5.433702 |
a322d3da-7ef2-4a75-abfc-240ecbdb5ec8 | hjiang13/LLMs-in-IR | POJ-104/1/964.cpp | #include <iostream>
using namespace std;
int countt;
void f(int p,int q)
{
for(int m=p; m<=sqrt(q); m++)
{
if(q%m==0)
{
countt++;
f(m,q/m); }
}
}
int main()
{
int n,num,i;
cin>>n;
for(i=0; i<n; i++)
{
cin>>num;
countt=0;
for(int k=2; k<=sqrt(num); k++)
{
if(num%k==0)
{
countt++;
f(k,num/k);
}
}
cout<<countt+1<<endl; ;
... | ALGO | 0.999958 | 3.839506 |
af9a7f3b-a6b0-4f8a-bfe8-45b50f9acbba | Skullduggery-sys/designPatterns | generative/factory_method/c++/new_Object.cpp | # include <iostream>
# include <memory>
using namespace std;
# pragma region Product
class Product
{
public:
virtual ~Product() = default;
virtual void run() = 0;
};
class ConProd1 : public Product
{
public:
ConProd1() { cout << "Calling the ConProd1 constructor;" << endl; }
~ConProd1() override { cout... | TOOL | 0.916473 | 7.338853 |
599d05e0-17c0-4889-8cd1-c7c2ce4fda85 | kandarpkakkad/30-Day-Challenge-CPP | Day12 - Bits/day12_q2.cpp | #include<bits/stdc++.h>
using namespace std;
/*
https://leetcode.com/problems/counting-bits
Input:
15
Output:
0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4
0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4
*/
int main() {
#ifndef ONLINE_JUDGE
freopen("../input.txt", "r", stdin);
freopen("../output.txt", "w", stdout);
#endif
long long N;... | ALGO | 0.999961 | 4.587996 |
087737a4-46da-44ff-bd56-a42eca40b3b2 | raincross7/code-similarity | codes/train_code/problem408/problem408_477.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; ... | ALGO | 0.999979 | 3.361989 |
111ffde3-f5cf-4faa-9fcd-b573c42eafd7 | pum10-2023/fixed-wing-drone | libraries/AP_Math/quaternion.cpp | #pragma GCC optimize("O2")
#include "quaternion.h"
#include "AP_Math.h"
#include <AP_InternalError/AP_InternalError.h>
#include <AP_CustomRotations/AP_CustomRotations.h>
#include <AP_Vehicle/AP_Vehicle_Type.h>
#define HALF_SQRT_2_PlUS_SQRT_2 0.92387953251128673848313610506011 // sqrt(2 + sqrt(2)) / 2
#define HALF_SQR... | ALGO | 0.985247 | 7.430884 |
1db51261-4432-48dc-87a2-52c56af89d7f | Timer-han/MSU_MM_EVM_5th_SEMESTR | threads_No3/main.cpp | #include <iostream>
#include <pthread.h>
#include <cfloat>
enum class io_status
{
undef,
error_open,
error_read,
success
};
class Args
{
public:
int p = 0; // количество потоков
int k = 0; // номер потока
pthread_t tid = 1;
const char * name = nullptr;
double res = 0; // количество элементов, больших среднег... | DATA | 0.991247 | 3.896195 |
125072a6-fa39-4081-aa47-a9e406c2a3e9 | Codesmith28/cse205-ds | cp/codeforces/2025-01-24/ASerejaAndCoatRack.cpp | #include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define dbg(x...)
#endif
using namespace std;
/* (╯°□°)╯︵ ┻━┻ */
#define int long long
#define pii pair<int, int>
#define endl "\n"
const int inf = 1e18;
const int ninf = -1 * inf;
int mod = 1e9 + 7;
void solve( ) {
int n, d;
cin >> n ... | ALGO | 0.999788 | 3.929249 |
c41d14b4-709f-409a-8d14-8abc1d595f37 | tahmid-saj/Cpp_DSA_Notes | Stacks and Queues/Ch4.6_PriorityQueuesInSTL/Ch4.6_PriorityQueuesInSTL/Ch4.6_PriorityQueuesInSTL.cpp | #include <iostream>
#include <queue>
#include <functional>
using namespace std;
int main() {
priority_queue<int> pq1; // plus vector<int> and less<int>
priority_queue<int, vector<int>, greater<int> > pq2;
pq1.push(3); pq1.push(1); pq1.push(2);
pq2.push(3); pq2.push(1); pq2.push(2);
int a[] = { 4,6... | ALGO | 0.984986 | 4.062106 |
71c99d56-c50a-44f2-b574-d17fa6b3ed7b | ishandutta2007/codeforces | papa3/normal/1322/B.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
const bool debug = true;
#else
const bool debug = false;
#define cerr if (true) {} else cout
#endif
//#define int long long
//#define double long double
//const int INF = 1000000000000000000LL;
const int mod = 1000000007;
struct Drzewo {
int dl;
ve... | ALGO | 0.999997 | 3.979563 |
dcbf6fc7-4d42-49c7-aa52-b1f7313a5537 | 15757170756/All-Code-I-Have-Done | DataStructure/图/最小生成树prim算法一般实现(使用邻接矩阵).cpp | /*
Greedy Algorithms | Set 5 (Prim’s Minimum Spanning Tree(MST))
3
We have discussed Kruskal’s algorithm for Minimum Spanning Tree.
Like Kruskal’s algorithm, Prim’s algorithm is also a Greedy algorithm.
It starts with an empty spanning tree.
The idea is to maintain two sets of vertices.
The first set contains the verti... | ALGO | 0.999986 | 5.106997 |
baa984ce-9152-40f8-a06e-7d407b40e281 | chaudhary-tushar/GFG-LeetCode | GFG/LinkedList/inspos.cpp | #include<iostream>
#include"../ds.h"
using namespace std;
void inspos(LinkedList<int> &ll,int x,int k){
if(ll.head==NULL || ll.size()<k){
return;
}
Node<int>* temp=new Node(x);
int i=0;
Node<int>* curr=ll.head;
while(curr->next!=NULL && i<k-1){
curr=curr->next;
i++;
... | ALGO | 0.999639 | 3.399252 |
47cd65be-2eda-4142-8f6f-364bc52b1512 | pokeparadox/PenjinTwo | include/PenjinFixedFunc.cpp | #include "PenjinFixedFunc.h"
using namespace fixedpoint;
fixed_point<16> fixedpoint::fixsqrt16(fixed_point<16> a)
{
fixed_point<16> b;
b.intValue = fixsqrt16(a.intValue);
return b;
}
| ALGO | 0.996573 | 3.506017 |
e82b0d6a-d1f8-47cf-8561-b01f160aef70 | leoleoasd/oi | lg/1181.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAXN 100100
int data[MAXN]={0};
int n = 0;
int maxn = 0;
int main(){
cin>>n>>maxn;
for(int i = 0; i < n; ++i){
cin>>data[i];
}
int output = 0;
int sum = 0;
for(int i = 0; i < n; ++i){
if(sum + data[i] <= maxn){
sum... | ALGO | 0.999931 | 3.96982 |
a78b4278-dd1c-47f2-9071-d7b091fca86f | Sadiaborsha19/CCE-2310-Competitive-Programming-Sessional | sheet 4/E.cpp | 1.// Problem name: count.
2.// Course title: Competitive Programming Sessional
3.// Course code: CCE-2310
4.// Course teacher name: Mirza Raquib
5.// Date: 23/6/25
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int sum = 0;
for(int i=0; i<s.size();i++)
{
sum+= s[i]-'0... | ALGO | 0.99968 | 4.120061 |
b009e3c7-ab31-44de-907e-363043d908b7 | r-burg/rbfilter | Calcs.cpp | /** \file
'Calcs.cpp' is one of the files intended to hold the functions for
calculation purposes.
It is not involved with GUIs and so it is expected that it will not (or
barely) need editting for porting to a different OS.
*/
// ***************************
// #include <vcl\vcl.h>
// #pragma hdrstop
#include <cmath... | ALGO | 0.998761 | 3.888726 |
753a4e6a-342c-4611-9e79-b340ef36b77f | tmd2018/ollvm-tll | lib/Analysis/MemorySSAUpdater.cpp | #define DEBUG_TYPE "memoryssa"
using namespace llvm;
// This is the marker algorithm from "Simple and Efficient Construction of
// Static Single Assignment Form"
// The simple, non-marker algorithm places phi nodes at any join
// Here, we place markers, and only place phi nodes if they end up necessary.
// They are on... | ALGO | 0.998357 | 7.409169 |
78768e30-60a0-4031-9e44-b5d6bf301502 | Pritam723/ProblemSolving | 1063-best-sightseeing-pair/1063-best-sightseeing-pair.cpp | class Solution {
public:
int maxScoreSightseeingPair(vector<int>& values) {
// See, we have i < j. So, at any point think about
// fixing/choosing the j. Intially we start from j = 1,
// so, this way we only have one choice i.e., i = 0.
// For j = 2, we have 2 choices i.e., i = 0 or... | ALGO | 0.999987 | 6.261908 |
99f6f36c-dbad-4c7c-b0dc-d06af06bcee8 | gnuinos/iceweasel-uxp | layout/tables/FixedTableLayoutStrategy.cpp | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
// vim:cindent:ts=2:et:sw=2:
/*
* Algorithms that determine column and table inline sizes used for
* CSS2's 'table-layout: fixed'.
*/
#include "FixedTableLayoutStrategy.h"
#include "nsTableFrame.h"
#include "nsTableColFrame.h"
#include... | TOOL | 0.955799 | 7.633717 |
5e627a56-ac19-436d-91f8-53136c09160b | sayan112/Leetcode_Sayan | 0206-reverse-linked-list/0206-reverse-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseList... | ALGO | 0.999891 | 5.810848 |
7b55065f-b266-45fa-b9a6-deeb6f62a9e9 | liuli4016/pfSkel | HighCurv/driver.cpp | //
// driver program for the HighDiverg module
//
#include "common.h"
#include "highDiverg.h"
#include <fstream>
#include <iostream>
int main(int argc, char *argv[])
{
FILE *fout;
int L,M,N; // Sizes in x,y,z dimensions
char *cL, *cM, *cN;
int i;
ForceVector *fv;
VoxelPositionDouble *HDPts;
in... | ALGO | 0.947154 | 5.25714 |
afe7a9b1-ef0e-4c9d-a5d8-aa40961e984c | hazerMf/Code-Ptit | BT/ki12324/dsa05027.cpp | #include <bits/stdc++.h>
using namespace std;
int ks(int wt,int w[],int val[],int n){
if (n == 0 || wt == 0)
return 0;
if (w[n - 1] > wt)
return ks(wt, w, val, n - 1);
else
return max(
val[n - 1]
+ ks(wt - w[n - 1], w, val, n - 1),
ks(w... | ALGO | 0.999958 | 4.056705 |
dfa7bc4b-0b7c-445c-ba8b-81b40ef2dbc9 | ishandutta2007/codeforces | klimoza/normal/1428/B.cpp |
/*#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC target("avx2")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <math.h>
#incl... | ALGO | 0.999944 | 3.683217 |
9b4c340f-3e01-4504-940c-168583bc8377 | ishandutta2007/codeforces | thenymphsofdelphi/normal/999/B.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
string a;
cin >> n;
cin >> a;
for (int i = 1; i <= n; i++){
if (n % i == 0){
reverse(a.begin(), a.begin() + i);
}
}
cout << a;
} | ALGO | 0.999995 | 4.042749 |
40f44909-d9ef-41af-91a6-a21b0caf635e | DaaGvda/xray-oxygen | code/engine.vc2008/xrPhysics/PHContactBodyEffector.cpp | #include "stdafx.h"
#include "PHContactBodyEffector.h"
#include "ExtendedGeom.h"
#include "tri-colliderknoopc/dTriList.h"
#include "PhysicsCommon.h"
#include "../xrEngine/gamemtllib.h"
#include "mathutilsode.h"
void CPHContactBodyEffector::Init(dBodyID body,const dContact& contact,SGameMtl* material)
{
CPHBaseBodyEffe... | ALGO | 0.993903 | 5.48348 |
c9bdbdce-97ae-4b37-84e2-7b75e31bec1c | Yallaswamy/LEETCODE_PROBLEMS | 623-add-one-row-to-tree/add-one-row-to-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999995 | 6.236501 |
2bb03b78-5605-4ea8-9aa2-f92c1ed71537 | Spandan350/PlacementCodingQuestions | Array/Maximum Index.cpp | int maxIndexDiff(int arr[], int N)
{
// Your code here
int i=0,j=N-1;
int max=0;
while(i<=j)
{
if(i==j)
{
i++;
j=N-1;
}
if(arr[i]<=arr[j])
{
if(max<(j-i))
{
max=j-i;
}
i++;
j=N-1;
}
else
{
j--;
}
}
return max;
} | ALGO | 0.9998 | 5.345989 |
ff08c757-1afd-488d-b65c-1af90097c920 | RG-Le/DSA | LL_EO_SEG.cpp | #include<iostream>
using namespace std;
class Node {
public:
int data;
Node *next;
Node(int data){
this->data = data;
next = NULL;
}
};
Node* takeInput(){
int data;
cin>>data;
Node *head = NULL; /// LL is empty
Node *tail = NULL; /// LL is empty
while(data != -1... | ALGO | 0.999876 | 4.291811 |
281a82bc-00d2-4daf-97ff-54cdb2c651a1 | matter-labs/compiler-llvm | clang-tools-extra/clangd/ConfigYAML.cpp | namespace clang {
namespace clangd {
namespace config {
namespace {
using llvm::yaml::BlockScalarNode;
using llvm::yaml::MappingNode;
using llvm::yaml::Node;
using llvm::yaml::ScalarNode;
using llvm::yaml::SequenceNode;
llvm::Optional<llvm::StringRef>
bestGuess(llvm::StringRef Search,
llvm::ArrayRef<llvm::St... | TOOL | 0.954322 | 6.438928 |
504d093b-dd76-48fc-8d3b-6e443e64578a | tfg1434/cp | WWPIT/0_3.cpp | #pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,avx")
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int t;
cin >> t;
while(t--){
int n, k;
cin >> n >> k;
int low = 1;
int high = 1e9;... | ALGO | 0.999931 | 4.409332 |
38f4aa27-b87d-487a-9945-4559a6dce303 | onlytiancai/codesnip | c++/026.cpp | #include <iostream>
#include <list>
int main()
{
std::list< std::pair<int, std::string> > mylist;
std::pair<int, std::string> kv(1, "11111");
mylist.push_back(kv);
mylist.emplace_back(kv);
std::cout << std::endl;
mylist.push_back(std::make_pair(2, "sort"));
mylist.push_back({ 40, "sort" });
std::cout... | TOOL | 0.945731 | 3.879463 |
526f5c12-75af-4b70-9594-75715c39b1b8 | ishandutta2007/codeforces | kostia244/normal/253/B.cpp | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first.first
#define yy first.second
#define __V vector
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define oit ost... | ALGO | 0.999965 | 3.704068 |
7762a69b-6e68-4677-ab02-f5352b97a152 | remyvnkhiemtruong/codeforces-submissions | codeforces/1081/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define endl '\n'
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(indx, a, b) for (int indx = a; indx < b; indx++)
#def... | ALGO | 0.99993 | 3.859092 |
9cb1770a-4d6c-4216-967a-770d7f9d3cfa | Ismail-Upal/CP-Campaign | Codeforces/A_Easy_Problem.cpp | #include<bits/stdc++.h>
using namespace std;
#define opt() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using ll = long long;
#define endl "\n"
#define sz(x) (ll)(x).size()
#define tc int t;cin>>t;while(t--)
//-------------------------------------------
int32_t main()
{
opt();
tc{
int n; ... | ALGO | 0.999863 | 4.841623 |
62c090c4-8635-408e-af57-71c6c902ce49 | ssh352/CTPTest-2 | CTP/lib/boost_1_62_0/libs/local_function/example/impl_tparam_tricks.cpp | //[impl_tparam_tricks
#include <boost/detail/lightweight_test.hpp>
#include <vector>
#include <algorithm>
// Casting functor trick.
struct casting_func {
explicit casting_func(void* obj, void (*call)(void*, const int&))
: obj_(obj), call_(call) {}
// Unfortunately, function pointer call is not inli... | TOOL | 0.912434 | 6.769924 |
c5533173-967d-4fdc-853c-11e511a5803d | JhonTitor6/junqi | singlegame.cpp | #include "singlegame.h"
#include <QTimer>
#include <QTime>
void Singlegame::click(int clickid, int row, int col)
{
if(!this->_P1Turn)
return;
Board::click(clickid, row, col);
if(!this->_P1Turn)
{
// 启动0.1秒定时器,在0.1秒后电脑再思考
sleep(100);
Step* step = NULL;
step = getBestMove();
if(step)
{
moveStone(step... | TOOL | 0.954544 | 3.922679 |
0d1a0805-e3c9-4832-b876-e9984f26ff10 | sarvex/leetcode-lol-code | solution/1700-1799/1793.Maximum Score of a Good Subarray/Solution.cpp | class Solution {
public:
int maximumScore(vector<int>& nums, int k) {
int n = nums.size();
vector<int> left(n, -1);
vector<int> right(n, n);
stack<int> stk;
for (int i = 0; i < n; ++i) {
int v = nums[i];
while (!stk.empty() && nums[stk.top()] >= v) {
... | ALGO | 0.999983 | 5.715046 |
881efaa1-1ca6-471e-ab46-98055283077f | haitaibrowser/haitaibrowser | third_party/WebKit/Source/modules/webaudio/RealtimeAnalyser.cpp | #include "modules/webaudio/RealtimeAnalyser.h"
#include "platform/audio/AudioBus.h"
#include "platform/audio/AudioUtilities.h"
#include "platform/audio/VectorMath.h"
#include "wtf/MathExtras.h"
#include <algorithm>
#include <complex>
#include <limits.h>
namespace blink {
const double RealtimeAnalyser::DefaultSmoothin... | TOOL | 0.893654 | 7.106882 |
da7fe909-f071-419c-a778-ad5833a1ff23 | NORTH89/note_app | 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 |
119f9a9e-2c72-409c-99a3-b493406cabfa | Presto412/Algorithmic-Toolbox-Solutions | week2_algorithmic_warmup/3_greatest_common_divisor/gcd.cpp | #include <iostream>
int gcd_naive(int a, int b)
{
int current_gcd = 1;
for (int d = 2; d <= a && d <= b; d++)
{
if (a % d == 0 && b % d == 0)
{
if (d > current_gcd)
{
current_gcd = d;
}
}
}
return current_gcd;
}
long long gcd_fast(long long a, long long b)
{
long long... | ALGO | 0.999801 | 5.469553 |
205e6757-406b-4713-ab4b-6612aa76b0fe | risabhsinha8/CompetitiveCoding | Competitions/aprilcook2.cpp | //Question
#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define fo(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
// #define int long long
#define pb push_back
#define mp make_pair
#define pii ... | ALGO | 0.999101 | 4.015263 |
21eb8309-bcc8-4174-92ca-8906cc0e8793 | LRL52/ACM-ICPC | 2023-ICPC-寒假&春季训练/4.27/D_Unique_PalindromesD_独特的回文.cpp | /***
* @Author: LRL52
* @Date: 2023-04-28 00:32:28
* @LastEditTime: 2023-04-28 00:37:45
*/
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+5;
char s[N];
char ss[]="abc";
void solve(){
int n,k;
cin >> n >> k;
vector<int> x(k+1),c(k+1);
for (int i=1;i<=k;i++) cin >> x[i];
for (int ... | ALGO | 0.999985 | 4.088576 |
3884cb0c-766b-459e-8617-f52c68980efc | prabhxjottsingh/leetcode-practise-problems | Sieve of Eratosthenes/0762 - Prime Number of Set Bits in Binary Representation.cpp | //Tags: Medium
//Problem Link: https://leetcode.com/problems/prime-number-of-set-bits-in-binary-representation/
//Time Complexity:
//Space Complexity:
class Solution
{
private:
bool isPrime(int x)
{
if (x < 2)
return false;
for (int i = 2; i * i <= x; i++)
{
if (... | ALGO | 0.999843 | 5.76561 |
e4db3803-4f72-4641-a951-f6a4a2611fa8 | 0xUvaish/LeetHub | 336-palindrome-pairs/336-palindrome-pairs.cpp | class Solution {
bool checkPal(string &str , int st , int ed){
int i = st , j = ed;
while(i < j){
if(str[i] != str[j]){
return 0;
}
i++,j--;
}
return 1;
}
public:
vector<vector<int>> palindromePairs(vector<string>& word... | ALGO | 0.999929 | 6.10074 |
9656b339-bd4d-44eb-b485-56c7164f806c | brupadhyay/Striver-SDE-Sheet-Challenge | Day13/queueUsingStack.cpp | #include <stack>
#include <iostream>
using namespace std;
/**
* Solution 1 - using two stacks
* TC - O(N) { push operation }
* SC - O(2N)
*/
class Queue1 {
// Define the data members(if any) here.
stack<int> input, output;
public:
void enQueue(int val) {
while(!input.empty()){
... | ALGO | 0.99911 | 5.608156 |
00635e02-f537-4327-9e93-8c9b44347208 | dhruvpunetha/DAA_LAB_ASSIGNMENTS | week6/Question2.cpp | #include<bits/stdc++.h>
using namespace std;
//dhruv punetha ml 23 2014639
void mark(int **G, int n, int k)
{
for (int i = 0; i < n; ++i)
G[i][k] = 2;
}
bool ispath(int **ar,int n,int s,int d)
{
vector<int> st;
st.push_back(s);
mark(ar,n,s);
int color[n]={1};
while(!st.empty())
{... | ALGO | 0.999987 | 4.092747 |
6bc5388a-879f-4c89-9ea6-b96fc53c5824 | KL-Lru/Competitive-Programming | AtCoder/abc133/c.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 2019;
int main(){
ll l,r;
cin >> l >> r;
ll mn = 3000;
for(int i = l;i < min(l + MOD, r); i++){
for(int j = i+1;j <= min(i+MOD+1, r); j++){
mn = min(mn, ((i%MOD) * (j%MOD)) %MOD);
}
}
cou... | ALGO | 0.999961 | 4.229064 |
370783da-f55e-4d80-92da-030b69fc4b11 | yourSrijit/Geeksforgeeks-practice-solved | IsitFibonacci.cpp | // Geek just learned about Fibonacci numbers.
// The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, ...
// where the next number is found by adding up the two numbers before it.
// He defines a new series called Geeky numbers. Here the next number is the sum of the K preceding numbers.
// You a... | ALGO | 0.99999 | 4.992435 |
c5cfc40b-8ed7-467e-8486-2ac4fcbb0607 | kangsw1025/TIL | SolveProblem/20/20.04/20_04_11/200411_1520_내리막길.cpp | #include <iostream>
using namespace std;
int arr[501][501];
int check[501][501];
bool ch[501][501];
int a, b;
int dfs(int x, int y)
{
int vec_x[4] = { 1,0,-1,0 };
int vec_y[4] = { 0,1,0,-1 };
if (x == a && y == b) return 1;
if (ch[x][y]) return check[x][y];
ch[x][y] = true;
for (int i = 0; i < 4; i++) {
int... | ALGO | 0.999352 | 3.636088 |
c1a64c96-da10-4e51-ace9-7d025a50b607 | anubhav-jangra/ds | queue/basic_array_imple.cpp | #include<iostream>
#include<stdint.h>
using namespace std;
#define MAX 10
class Queue
{
//private by default
int m_arr[MAX];
int m_size; //points to first unfilled member of the array
bool is_full()
{
if(m_size == MAX)
return true;
return false;
}
vo... | ALGO | 0.987118 | 4.247478 |
dae3cc2c-304c-4930-a0ea-3e3b267e611e | Gooner1886/DSA-101 | greedy/minArrowsToBurstBalloons.cpp | // Leetcode - 452 - Minimum arrows to burst balloons
static bool desc(vector<int> &a, vector<int> &b)
{
return a[1] < b[1]; // Sorting the points array on the basis of ending point of each balloon
}
int findMinArrowShots(vector<vector<int>> &points)
{
sort(points.begin(), points.end(), desc); // Calling the so... | ALGO | 0.999822 | 6.248707 |
418a4674-8703-4254-9465-3c30305217e6 | parasjain929/Karma | Coding Questions/Strings/Class Questions Practice/LongestSubstringDistinct.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int i=0,j,len=0,k,max=0;
char s[20];
cin>>s;
string lon;
int count[26];
while(s[i]!='\0')
{
len++;
i++;
}
i=0;j=0;
int c;
char sub[20];
for(i=0;i<=len;i++)
{
c=0;
for(k=0;k<26;k+... | ALGO | 0.999996 | 3.34762 |
8389cc70-ae38-4c7f-9d16-746023e3a134 | samreachyan/BKCodes | Thuat Toan Ung Dung/Slide Example/Chapter 4/MaxSubArrayProblem.cpp | // #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int a[1000];
int mem[1000];
bool comp[1000];
// memset(comp, 0, sizeof(comp));
void trace(int i) {
if (i != 1 && mem[i] == a[i] + mem[i-1])
trace(i-1);
cout << a[i] << endl;
}
int max_sum(int i) {
if(i==1) return a[i];
if (comp[i]) return me... | ALGO | 0.999853 | 3.864354 |
da9fad16-df14-411e-919e-de2b62ec776d | Bixter356/PARQUEO-SD-2025 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
93d20ad2-f4d6-42c8-b4ac-302cefe10d48 | Trenh/DoomLike | externals/bgfx/3rdparty/spirv-tools/source/opt/dataflow.cpp | #include "source/opt/dataflow.h"
#include <algorithm>
#include <cstdint>
namespace spvtools {
namespace opt {
bool DataFlowAnalysis::Enqueue(Instruction* inst) {
bool& is_enqueued = on_worklist_[inst];
if (is_enqueued) return false;
is_enqueued = true;
worklist_.push(inst);
return true;
}
DataFlowAnalysis... | ALGO | 0.960573 | 7.534658 |
c3d418ec-c790-4c46-8aac-bf763a51dca0 | raghavaggarwal99/Competitive | Codeforces/777B.cpp | #include <bits/stdc++.h>
#include<unordered_map>
#include <utility>
#include<string>
using namespace std;
#define LL long long
int a[1009],b[1009];
char s1[1009],s2[1009];
int main()
{
int n;
cin>>n;
cin>>s1>>s2;
for(int i=0 ; i<n; i++)
a[i]=s1[i]-'0',b[i]=s2[i]-'0';
... | ALGO | 0.999938 | 3.610053 |
d314074e-471d-4bb0-a576-ea5d60cfccbf | AKarunakaran/CodeForces | CF424/C.cpp | #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <functional>
#include <uno... | ALGO | 0.998739 | 3.326096 |
5a657c20-db0e-4a06-8c28-6115a6cdd78d | aakim57787612/computer_programming_I | 一元多次方程式大數計算系統_8/1091659-hw8-4.cpp | // vector< Term > division provided that the quotient and remainder have integer coefficients
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
#include <iomanip>
using std::setw;
#include <fstream>
using std::istream;
using std::ifstream;
using std::ios;
#include <vector>
using std::vector;
st... | ALGO | 0.930218 | 3.75783 |
4769c3bf-34bb-4095-a36b-d9c1f5a44450 | shubho5das/Leetcode-Submissions | 0338-counting-bits/0338-counting-bits.cpp | class Solution {
public:
vector<int> countBits(int n) {
// Solve in O(n) time in the evening
int i;
vector<int> solution(n+1);
for(i=0 ; i<=n ; i++){
solution[i] = __builtin_popcount(i);
}
return solution;
}
}; | ALGO | 0.999985 | 6.357601 |
25ad05a6-493a-4122-bebd-54ba8683e605 | samarthcode1/LeetCode1 | 226-invert-binary-tree/invert-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999983 | 5.838148 |
d0325352-75f9-4d2c-9194-f902207907f0 | Aleena-Mishra-10/Data-Structure | Stack/Valid Substring .cpp | class Solution {
public:
int findMaxLen(string S) {
stack<int>s;
int result=0;
for(int i=0;i<S.length();i++){
if(S[i]=='('){
s.push(i);
}
else{
s.pop();
if(!s.empty()){
result=max(result... | ALGO | 0.998588 | 4.79424 |
cc8110cc-3f81-4405-9837-974942378db5 | paragns/CPP-codes | minimum sideways jump leetcode dhani.cpp | class Solution {
public:
vector<vector<int>> dp;
int M(int lane, int i, vector<int> &A){
if(i==A.size()-1) return 0;
if(dp[i][lane]!=-1) return dp[i][lane];
//if(A[i]-1==lane) return INT_MAX/2;
if((A[i+1]-1)==lane){
int x=INT_MAX;
if(A[i]-1!=(lane+1)%3) x ... | ALGO | 0.999942 | 5.501537 |
70791529-bd23-4b97-8f46-5b9404d46e90 | umaidansari12/CP_Backup | 2_linked_list/linked_list_in_binary_tree.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) {}
* };
*/
/**
* Definition for a binary tree node.
* struc... | ALGO | 0.999928 | 4.927894 |
81cc3571-ab7f-4a7a-ac62-7206652b7c8c | Shehab-Sarker/cse-1202lab | lab5exp3.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> longestIncreasingSubsequence(const vector<int>& nums) {
int n = nums.size();
vector<int> dp(n, 1); // dp[i] stores the length of the LIS ending at nums[i]
vector<int> prev(n, -1); // prev[i] stores the index of the previous element in the LIS
fo... | ALGO | 0.999966 | 5.773552 |
a50f113d-1793-4876-bd37-980f9eabd8b0 | PoHengChen/DataStructure | DataStructure/Source.cpp | #include "sort.h"
#define size 6
void bubblesort2(int data[]) {
bool flag = 0;
for (int i = size - 1; i > 0; i--) { // n elements need (n-1) times data scans
for (int j = 0; j < i; j++) {
if (data[j] > data[j + 1]) {
int tmp = data[j];
data[j] = data[j + 1];
data[j + 1] = tmp;
flag = 1;
}
}... | ALGO | 0.998834 | 3.114335 |
7609baa1-f5ff-4755-8ff4-cf1a442a2ccc | hotrucdiep21/Leetcodes | reverseString.cpp | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
void reverseString(vector<char> &s)
{
int l = 0;
int r = s.size() - 1;
while (l < r)
{
char temp = s[l];
s[l] = s[r];
s[r] = temp;
l++;
r--;
}
for (char result : s)
{
... | ALGO | 0.99794 | 5.879787 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.