uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
1ce74fec-d0ca-4e6a-9f41-3d1569678a2b | Komrad1991/ASD_L7-hash | MyHash/main.cpp | #include <unordered_set>
#include "MyHash.h"
#include <string>
#include <iostream>
#include <random>
#include <chrono>
#include <time.h>
#include <algorithm>
#include <fstream>
using namespace std::chrono;
int main()
{
{
int progon = 10;
std::cout << "TIME MESURE: " << std::endl;
std::random_device rd;
std::... | TOOL | 0.887424 | 4.324629 |
9dee253c-f0fe-4301-91a9-e722de1d0394 | gustavocadev/estructuras-iterativas-While | 3-sumar_numeros.cpp | #include <iostream>
using namespace std;
int main() {
/*
3.- Disear el programa que permita calcular la suma de los numeros enteros comprendidos entre dos cantidades ingresadas por teclado
*/
int a, b;
cout << "ingrese un numero" << endl;
cin >> a;
cout << "ingrese otro numero mayor que el anterior" << endl;
cin... | ALGO | 0.919814 | 3.194825 |
6697702f-d51b-4689-839b-ba9c5d085c43 | code-fans/books-source | 动态规划/03_完全背包问题/3.1完全背包问题/src/标程/FullKnapsack.cpp | //ȫ
#include <bits/stdc++.h>
using namespace std;
int m,n,c[300],w[300],f[2000];
int main()
{
//freopen("FullKnapsack.in","r",stdin);
//freopen("FullKnapsack.out","w",stdout);
scanf("%d%d",&m,&n);
for(int i=1; i<=n; i++)
scanf("%d%d",&w[i],&c[i]);
for(int v=1; v<=m; v++)
for(int j=1; j<=n; j++) ... | ALGO | 0.999983 | 3.705523 |
13b6c133-0e41-43e1-a261-a286f64d103f | CodeByAshuu/CipherSchools | Day56/Q1AVLEangeSearch.cpp | #include <iostream>
#include <vector>
using namespace std;
// + structure for AVL tree
struct Node {
int key;
Node* left;
Node* right;
int height;
};
int getHeight(Node* node) {
return node ? node->height : 0;
}
Node* createNode(int key) {
Node* node = new Node();
node->key = key;
nod... | ALGO | 0.999982 | 5.731553 |
ad4bf474-22f9-4399-b440-655ecf5e7b54 | simrant27/Flutter | self/first/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.997885 | 6.785645 |
9d2ec65d-b2b7-4ab9-9235-58b368cd52ce | Hamsuke/TableroAjedrez | Piezas/Caballo.cpp | //
// Created by victo on 05/11/2024.
//
#include "Pieza.h"
#include "Caballo.h"
void ArribaI(struct pieza p[8][8], int x, int y) {
if (x + 1 < 8 && y + 2 < 8 && p[x+1][y+2].color != p[x][y].color) {
p[x+1][y+2].simbolo = "X";
}
}
void ArribaD(struct pieza p[8][8], int x, int y) {
if (x - 1 >= 0 ... | ALGO | 0.989664 | 3.428946 |
599dc601-f3c0-44e7-b0b6-338a2a4a99ca | ishandutta2007/codeforces | pllk/normal/1082/E.cpp | #include <iostream>
using namespace std;
#define INF 999999999
int n, c;
int s[505050];
int z[505050];
int a[505050];
int r[505050];
int main() {
cin >> n >> c;
int u = 1;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= 500000; i++) z[i] = -1;
for (int i = n; i >= 1; i--) {
r[i] = r[i+1]+(a[i]... | ALGO | 0.999953 | 3.60974 |
003a9911-bbc4-4ad7-a7f5-9ff739927c97 | taegun1011/problem-solving-cpp | repos/gold/21942.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
int day[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
int difference(string A, string B) {
int Amin = atoi(A.substr(14, 2).c_... | ALGO | 0.998108 | 4.51626 |
beb64e3b-45af-48a8-bb12-0516ce67167f | fvmassoli/CarND-Model-Predicitve-Control | polyfit/src/Eigen-3.3/doc/examples/TutorialLinAlgExComputeSolveError.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(100,100);
MatrixXd b = MatrixXd::Random(100,50);
MatrixXd x = A.fullPivLu().solve(b);
double relative_error = (A*x - b).norm() / b.norm(); // norm() is L2 norm
cout << "The ... | ALGO | 0.999591 | 3.625966 |
209e39e8-32b2-477e-9421-7d6df9e3a943 | Oumaimamam/mutli-stream-hedging | src/mathematicalApp/Options/exotics/ConditionalBasket.cpp | #include <cmath>
#include "ConditionalBasket.hpp"
double ConditionalBasket::payoff(const PnlMat* path,double r) const {
int m = 0;
while (m < dates_->size) {
// Calcul de la moyenne des actifs
double basket = 0.0;
for(int d = 0; d < size_; d++) {
basket += MGET(path, m, d);
... | ALGO | 0.999426 | 4.482955 |
b4e0d141-ffb3-4058-bf9d-14ecd4c37e70 | MAA1117/DSA | codeforces/800/032424_cf1560b.cpp | // https://codeforces.com/problemset/problem/1560/B
#include <bits/stdc++.h>
using namespace std;
#define SET_IO() ios_base::sync_with_stdio(false), cin.tie(nullptr);
using ll = long long;
void solve() {
int a, b, c;
cin >> a >> b >> c;
int circ = 2 * abs(a - b);
if (a > circ || b > circ || c > circ) {
co... | ALGO | 0.999795 | 4.685905 |
35cabf3b-e769-48c4-b3ed-24bd7dbc9115 | osirisQdt2810/algorithms | src/leetcode/cheatsheet/solution/2500-2599/2567.Minimum Score by Changing Two Elements/Solution.cpp | class Solution {
public:
int minimizeSum(vector<int>& nums) {
sort(nums.begin(), nums.end());
int n = nums.size();
return min({nums[n - 1] - nums[2], nums[n - 2] - nums[1], nums[n - 3] - nums[0]});
}
}; | ALGO | 0.999976 | 5.698688 |
30189536-8e59-42a0-afcf-bff37bc78057 | M-Farjad/FlutterapP | dice_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.998929 | 6.785645 |
1af35038-fa1a-48aa-947a-fbd12c2a1c2d | youlive789/AlgorithmStudy | BackJoon/datastructure/2517.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int count;
cin >> count;
vector<unsigned long> runners;
while (count--) {
unsigned long tmp;
cin >> tmp;
runners.push_back(tmp);
}
vector<int> scores;
for (int i = 0; i < runners.size(); ... | ALGO | 0.999856 | 4.186612 |
0ffc4d5d-04d6-438a-8c81-528b97535a14 | ishandutta2007/codeforces | ngfam/normal/1497/C2.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int ntest; cin >> ntest;
while(ntest--) {
int n, k; cin >> n >> k;
n -= (k - 3);
for(int i = 0; i < k - 3; ++i) cout << 1 << " ";
k = 3;
if (k == 3) {
... | ALGO | 0.999799 | 4.083077 |
693057e1-4c11-4029-ba93-3753f5425bd6 | ninhtrinhhuyen/Vehicle-Management-Information | Data.cpp | #include "Data.h"
// compare string by alphabet a -> z
bool data::compareAlphabet(const std::string& s1, const std::string& s2)
{
std::size_t sizeStr{s1.size() < s2.size() ? s1.size() : s2.size()};
for(std::size_t index{0}; index < sizeStr; ++index)
{
if(s1[index] < s2[index])
return tr... | TOOL | 0.866404 | 3.911248 |
b59c91b5-450c-4cc7-b317-c9a84d81a2ac | gauravpundir14/Leetcode-Soluctions | Search a node in BST - GFG/search-a-node-in-bst.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node *right;
Node *left;
Node(int x) {
data = x;
right = NULL;
left = NULL;
}
};
bool search(Node *root, int x);
Node *insert(Node *tree, int val) {
Node *temp = NULL;
if... | ALGO | 0.999711 | 5.657893 |
153b7a7c-1b49-46cc-8247-70a4f1616338 | FOSCODER/FreeCAD-for-rendering | src/Gui/DlgParameterFind.cpp | #include "PreCompiled.h"
#ifndef _PreComp_
# include <QMessageBox>
# include <QPushButton>
#endif
#include "DlgParameterFind.h"
#include "ui_DlgParameterFind.h"
#include "DlgParameterImp.h"
using namespace Gui::Dialog;
/* TRANSLATOR Gui::Dialog::DlgParameterFind */
DlgParameterFind::DlgParameterFind(DlgParameterImp... | TOOL | 0.970775 | 6.642013 |
5275dc53-32d9-46f1-8625-334b81c9e55f | dzulfikarsn/note | opencv/opencv_contrib-4.x/modules/cudabgsegm/src/mog.cpp | #include "precomp.hpp"
using namespace cv;
using namespace cv::cuda;
#if !defined HAVE_CUDA || defined(CUDA_DISABLER)
Ptr<cuda::BackgroundSubtractorMOG> cv::cuda::createBackgroundSubtractorMOG(int, int, double, double) { throw_no_cuda(); return Ptr<cuda::BackgroundSubtractorMOG>(); }
#else
namespace cv { namespac... | ALGO | 0.855894 | 6.937222 |
4747fc20-563b-4fc4-a8e9-1e788b023e3c | Projjwalanka/CUCS3 | CPP/FunctionTemplate.cpp | #include<iostream>
using namespace std;
template<class T>
void bubble(T arr[20],int n)
{
T temp;
for( int i=0; i<n; i++)
{
for( int j=0; j<n-1-i; j++)
{
if (arr[j]>arr[j+1])
{
temp=arr[j];
arr[j]=arr[j+1];
... | ALGO | 0.999408 | 4.156698 |
ae76320f-67ab-497b-842e-133fa52a078c | WanDejun/vscode_cpp | 0x_3F`s tea/B - Sum AND Subarrays.cpp | //https://atcoder.jp/contests/dwacon5th-prelims/tasks/dwacon5th_prelims_b
#include <bits/stdc++.h>
#define PII pair<int, int>
#define MII multimap<int, int>
#define MSI multimap<string, int>
#define SI multiset<int>
#define VI vector<int>
#define FI first
#define SE second
#define i64 long long
using namespace std;
... | ALGO | 0.999986 | 4.115957 |
3417f4a8-f7c2-40a9-93f1-3e5225824bad | miaodi/linearAlgebra | benchmarks/uncategorized_bench.cpp | #include <algorithm>
#include <benchmark/benchmark.h>
#include <iterator>
#include <memory>
#include <numeric>
#include <omp.h>
#include <random>
#include <stdlib.h>
#include <vector>
template <bool DO_PREFETCH>
int binarySearch(int *array, int number_of_elements, int key) {
int low = 0, high = number_of_elements - ... | ALGO | 0.998781 | 7.191517 |
e4783574-f51c-4c1d-97f9-e89284f6b71a | choi-dan-di/Study_OpenGL | OpenGL/EDM/EDM/object.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
#include <glm/glm.hpp>
using namespace glm;
#include "object.h"
// ̹ ε ܺ ̺귯
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
bool loadOBJ(const char* path, vector<vec3>& out_vertices, vector<vec2>& out_uvs, vector<vec3>& out_normals... | TOOL | 0.914218 | 4.156867 |
36ed91bd-949f-4beb-9bfa-262b370773e2 | rajat2004/programming | a2oj/ladder12/38.cpp | #pragma GCC optimize ("-O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> ... | ALGO | 0.999765 | 4.685616 |
8cfc2369-c5c7-4b80-b1c2-6f83b6d4baf1 | GabrielSMuniz/Codigos_exercicios_faculdade | 2022-2/Lista_ex4_malloc2/ex5.cpp | #include <iostream>
/*
Nome: .... Gabriel Muniz
Turma: ... C_21
Enunciado: Faça um programa como o de média de
nota, mas com funções
*/
void ler(float *a)
{
for (int i = 0; i < 10; i++)
{
printf("Digite a %dª nota: ", i + 1);
scanf("%f", (a + i));
}
}
void calcMedia(float *val, float *med... | ALGO | 0.911236 | 5.180676 |
ac116fde-509d-48ed-843b-f03a000cd8c7 | BandhiyaHardik/Leetcode_Solutions | daily_problems/916_Word_Subsets.cpp | class Solution {
public:
bool isSubset(vector<int>& freq2, vector<int>& temp) {
for(int i = 0; i < 26; i++) {
if(temp[i] < freq2[i]) {
return false;
}
}
return true;
}
vector<string> wordSubsets(vector<string>& words1, vector<string>& words2) ... | ALGO | 0.999891 | 6.002467 |
f082e057-8cca-4cf3-be93-6e1651635a6c | oceanstar777/2021-2_hufs_computer_programming_and_practice | Project1/15_함수.cpp | //c Լ ȯ 1
//ʿ伺
//1.ݺ
//2.ȭ -> ش ⸸ ãƺ ȴ
// Ʈ , α © ִ.
//
//
#include<iostream>
using namespace std;
int add(int x, int y);
int main(void)
{
int x, y;
cin >> x >> y;
printf("%d", add(x, y));
return 0;
}
int add(int x, int y)
{
int result;
result = x + y;
return result;
}
| ALGO | 0.997737 | 3.261541 |
957241d0-84c5-48fe-b360-53d21c3daf1e | wangtongxue-369/xcpc_Code_file | file/vjudge/2025spring_practice/1_erfen/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define PII pair<ll, ll>
const ll mod = 1e9 + 7;
const ll MAXN = 500005;
const ll base1 = 131;
const ll base2 = 127;
ll _ = 1, n, q, m, ans = 0, a[MAXN], l[MAXN], r[MAXN], t[MAXN];
ll tr[MAXN];
int l... | ALGO | 0.999831 | 4.11461 |
f731a24f-4cd6-4271-a13c-abc49966533b | yokoleia/AmadeusCPP | Chapter_3/3_25.cpp | #include <iostream>
using namespace std;
int main() {
int year;
bool leapYear = false;
cin >> year;
if (year % 4 == 0) {
leapYear = true;
if (year % 100 == 0) {
if (year % 400 != 0) {
leapYear = false;
}
}
}
cout << year << " - "... | ALGO | 0.999712 | 5.244958 |
6ae2a1f2-978a-41fe-9c07-ddb2ea101f0f | hh730/LeetCode-submission | 0145-binary-tree-postorder-traversal/0145-binary-tree-postorder-traversal.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.999861 | 6.076892 |
d909a4ce-a419-4208-9e6b-0e2f2cd14b79 | atharv-patil/strivers-sde-sheet | 088 Sort a Stack.cpp | #include <bits/stdc++.h>
void insert(stack<int> &stack,int num){
if(stack.empty()){
stack.push(num);
return;
}
if(stack.top()>num){
int lol = stack.top();
stack.pop();
insert(stack,num);
stack.push(lol);
}else{
stack.push(num);
}
}
void sortStack(stack<int>... | ALGO | 0.999966 | 5.100506 |
314a58e8-42db-4e0a-b983-2b4a254a8230 | monoscale/Project-Euler | 10-19/problem12.cpp | #include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include "../Utils/chrono.cpp"
int get_number_of_divisors(int n){
int amount_of_divisors = 1;
for(int i = n/2; i > 0; i--){
if(n%i == 0){
amount_of_divisors++;
}
}
return amount_of_divisors;
}
int main(void){
int to_add = 2;
int curr... | ALGO | 0.999705 | 5.754372 |
437fab71-fb84-4aff-9302-9a2c4ae50452 | Wonchul-Shin/AlgoritmStudy | Graph/[백준] 1012 - 유기농 배추 (실버2)/최아현/1012번 - 유기농 배추.cpp | #include<cstdio>
#include<iostream>
#include<string.h>
using namespace std;
int M, N;
int cabge[50][50] = { 0, };
int check[50][50] = { 0, };
int dx[4] = { 1,-1,0,0 };
int dy[4] = { 0,0,-1,1 };
void dfs(int y, int x) {
check[y][x] = 1;
for (int i = 0; i < 4; i++)
{
int n_y = y + dy[i];
int n_x = x + dx[... | ALGO | 0.999768 | 3.556282 |
59b1cd86-114a-4a19-a691-d138308e6e21 | aditya28sarin/Data-structures-and-Algorithms | DSA/Data Structures/Linear DS/Hashing/contains_duplicate_2.cpp | class Solution {
public:
bool containsNearbyDuplicate(vector<int>& nums, int k) {
unordered_set<int> st;
unordered_map<int,int> mp;
for(int i=0;i<nums.size();i++){
if(st.find(nums[i])==st.end()){
st.insert(nums[i]);
mp.insert({nums[i],i});
... | ALGO | 0.99997 | 6.153445 |
8e080e37-4009-4691-9179-c0b839a30dc9 | BadhonAhmad/Codeforces-Solve | B_Magic_Stick.cpp | /*****from dust i have come, dust i will be*****/
#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
#define pb(a) push_back(a)
#define e "\n"
#define int long long int
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
const int N = 1e5 + 10;
/*****SALAH is the firs... | ALGO | 0.999471 | 4.286571 |
1a476a39-b883-4349-a0db-5a7bbd0b237a | wasim-ahmed/ICW-TRACI | ICW_TraciClient/utils/common/StringUtils.cpp | /****************************************************************************/
/****************************************************************************/
/// @file StringUtils.cpp
/// @author Daniel Krajzewicz
/// @author Laura Bieker
/// @author Michael Behrisch
/// @date unknown
/// @version $Id$
///
// ... | TOOL | 0.94444 | 6.516762 |
e8aadb77-002d-487f-9b59-94a07961f44a | ishandutta2007/codeforces | moririn2528/normal/1556/B.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
#include<set>
#include<complex>
#include<numeric>
#include<functional>
#include<unordered_map>
#in... | ALGO | 0.999969 | 3.573048 |
fc340ae9-8681-41ec-bd9e-aef9c78cfc2f | adiiisanjayaa/ar | 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 |
111fd24c-9a36-493d-a0f1-652e083db298 | under-the-keyboard/ACM-Code-Library | 数论/扩展中国剩余定理.cpp | long long M[maxn], C[maxn];//模数, 余数
long long mul(long long a, long long b, long long p) {
if(b < 0) b = -b;
long long ans = 0;
while(b) {
if(b & 1) ans = (ans + a) % p;
a = (a + a) % p;
b >>= 1;
}
return ans;
}
long long gcd(long long a, long long b) {
return !b ? a : gc... | ALGO | 0.999931 | 3.356155 |
87c6856f-32d5-45a5-836d-acde47a4e95d | sneha390/DSA_Track | POPQuestion/tutorialChallenge.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
/*
* Complete the 'introTutorial' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER V
* 2.... | ALGO | 0.999833 | 5.197424 |
bffb623f-4f59-42d4-b462-904940550cbf | ishandutta2007/codeforces | se1ka2/normal/1499/D.cpp | #include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
struct PrimeDecomposition
{
int n;
vector<bool> p;
vector<int> prime;
vector<int> d;
PrimeDecomposition(int n) : n(n){
p.resize(n + 1);
d.resize(n + 1);
d[1] = 1;
for(int i = 2; i <... | ALGO | 0.999872 | 4.145424 |
921bbca0-fb21-420e-aa08-fcf842684a90 | Jinnrry/POJAutocommit | POJ/poj/2771.cpp | #include<stdio.h>
#include<string.h>
#define MAX 500
bool Check[MAX];
bool Hide[MAX][MAX]={false};
int Match[MAX],n,boys,height[500];
char music[500][100],sport[500][100];
bool DFS(int p);
bool compare(int boy,int girl);
int main()
{
int t,i,j,k,a,b,h,Save;
char str[20];
scanf("%d",&t);
for (j=0;j<t;j++)
{
scanf... | ALGO | 0.999701 | 3.197784 |
600d7f8b-2eae-40d1-96bc-7a367f0c2fad | Sahil-Badkul/leetcode | 706-design-hashmap/706-design-hashmap.cpp | class MyHashMap {
public:
int mp[1000001];
MyHashMap() {
fill(mp,mp+1000001,-1);
}
void put(int key, int value) {
mp[key] = value;
}
int get(int key) {
return mp[key];
}
void remove(int key) {
mp[key] = -1;
}
};
/**
* Your MyHashMap ob... | ALGO | 0.998718 | 6.177547 |
0cf1add2-fe09-4517-aaac-07ece4168d29 | tasninanika/Codeforces_Problems-1000 | Dreamoon and Stairs/dreamoonAndStairs.cpp | #include<iostream>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
int moves = (n + 1) / 2;
for(int i = moves; i <= n; i++){
if(i % m == 0){
cout << i << endl;
return 0;
}
}
cout << -1 << endl;
return 0;
}
| ALGO | 0.999983 | 3.705699 |
9b2f005a-4dfb-4ccf-97d7-953afb4e99f5 | Bill-Fu/leetcode | cpp/507_PerfectNumber_Cpp_1.cpp | class Solution {
public:
bool checkPerfectNumber(int num) {
int s = 1;
if(num == 1) {
return false;
}
for(int i = 2; i <= sqrt(num); ++i) {
if(num % i == 0) {
s += i;
s += num / i;
}
}
... | ALGO | 0.999813 | 5.976306 |
8dfc89ca-70f7-401e-978d-90fb44544def | raincross7/code-similarity | codes/train_code/problem236/problem236_360.cpp | #include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for... | ALGO | 0.999948 | 3.731745 |
78cd5e42-870c-4b12-b601-649760c93e27 | BioDataAnalysis/blaze | blazemark/src/blitz/Complex6.cpp | //=================================================================================================
//=================================================================================================
//*************************************************************************************************
// Includes
//****... | ALGO | 0.99476 | 3.598421 |
63799d51-8b9d-45fe-a13a-0659b918593b | vijaymanikantareddy/LeetCode_GFG_solved | 0289-game-of-life/0289-game-of-life.cpp | class Solution {
public:
void dfs(vector<vector<int>>& board, int row, int col, vector<vector<int>>& v){
int oneCount = 0;
int zeroCount = 0;
int n = board.size();
int m = board[0].size();
for(int i = -1 ; i <= 1 ; i++){
for(int j = -1 ; j <= 1 ; j++){
... | ALGO | 0.999958 | 6.709815 |
0f4e7be8-f2a0-413f-b4c1-7427d1932f46 | multiib/beegfs-thesis | beegfs-ssocks/common/source/common/system/System.cpp | #include <common/app/log/LogContext.h>
#include <common/toolkit/StorageTk.h>
#include <common/toolkit/StringTk.h>
#include "System.h"
#include <mutex>
#include <sys/utsname.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
Mutex Syste... | TOOL | 0.886438 | 6.168722 |
f6fa5eff-1808-495f-a54d-4ea03ca2420a | ghdwlsrl3229/BOJ | 3000/3980.cpp | #include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
#define ll long long
#define fr first
#define sc second
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
const int MAX_V = 440;
const int INF = 1000000000;
struct Edge {
int v, c, f, d;
Edge *... | ALGO | 0.999393 | 3.666559 |
b45e5f12-9f5c-428f-8cb9-b993f6e969d0 | Jin-0-2/2023_winter_C | 240131_스택_큐/240131_스택_큐/10_이중연결리스트클래스화.cpp | // 10_߿ḮƮ Ŭȭ.cpp
#include <iostream>
#include <conio.h>
using namespace std;
// ּ ;
class Node
{
public:
int* data; // ----------------- int -> int*
Node* next; // ּ
Node* prev; // ּ
public:
Node(int* _data) : data(_data), next(NULL), prev(NULL)
{
}
~Node()
{
}
};
class MyList
{
private:
Nod... | TOOL | 0.990085 | 3.798616 |
143bd488-4d0c-4afd-83d9-50e450150057 | IcEy-999/MyUESource | Engine/Source/ThirdParty/glslang/glslang/src/glslang_lib/SPIRV/InReadableOrder.cpp | // The SPIR-V spec requires code blocks to appear in an order satisfying the
// dominator-tree direction (ie, dominator before the dominated). This is,
// actually, easy to achieve: any pre-order CFG traversal algorithm will do it.
// Because such algorithms visit a block only after traversing some path to it
// from ... | ALGO | 0.999187 | 7.713007 |
0c0cdbd1-74b5-4d26-84fb-dc3b2bcaaafe | karrrtavy/studs | programming/ex task/5.cpp | /*
Заполнить вектор случайный
числами отсортировать его по возрастанию и убыванию с помощью multiset
*/
#include <iostream>
#include <vector>
#include <set> // для multiset
#include <ctime> // для time()
#include <cstdlib> // для rand() и srand()
#include <algorithm> // для copy()
int main() {
// Ини... | ALGO | 0.999169 | 5.319202 |
c424dd53-9a85-4de4-b192-f351cd1922bf | bartoszpogoda/data-struct-and-algorithms-II | data-structures-and-algorithms-II/MinimumHeap.cpp | #include "MinimumHeap.h"
#include "PathNode.h"
#include "Edge.h"
#include <string>
#include <iostream>
template<class Type>
void MinimumHeap<Type>::fixUp(int nodeId) {
while (parent(nodeId) >= 0) {
// if parent has bigger weight
if (elements[parent(nodeId)].getKey() > elements[nodeId].getKey()) {
// swap with... | ALGO | 0.995889 | 5.28392 |
41ca5074-c16c-4126-b77b-653832dd2da6 | shruti-102/Daily-Leetcode-Challenge | 74-search-a-2d-matrix/74-search-a-2d-matrix.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int n=matrix.size();
int m=matrix[0].size();
int targetrow=n-1;
bool found=false;
int l=0,h=n-1;
while(l<=h)
{
int mid=l+(h-l)/2;
cout<<... | ALGO | 0.99997 | 5.84788 |
9491c351-16f5-4162-a75f-713f85aff83e | ahmedbadawihosny/Programming-And-Problem-Solving | Problem Solving/CodeForces/ICPC Assiut University Training Sheet/Newcomers/C++/L-Sheet #9-General medium/A-Drawing Task.cpp | #include <iostream>
#include <string>
#define Code_acceleration ios::sync_with_stdio(false); cin.tie(nullptr);
#define ll long long
using namespace std;
int main(){
Code_acceleration
string s;
cin >> s;
int n = s.length();
for (int i = 0; i < n/2; i++) {
if (s[i] == '?' && s[n-i-1] == '?') {
... | ALGO | 0.999925 | 3.636241 |
dc587e32-bc12-4331-9fb6-10aa27ea9de4 | mayuresh-tech/Competitive_Practise | codechef/Chef_and_Fruits_FRUITS.cpp | #include <bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
int main() {
int testCases;
scanf("%d", &testCases);
while(testCases--) {
int apples, oranges, coins;
scanf("%d %d %d", &apples, &oranges, &coins);
while(true) {
if(coins > 0 && app... | ALGO | 0.999971 | 4.485228 |
3043cc6b-be63-4659-bd02-78741a49b34e | kunal170/CP | codeforces/1313/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define rep(n) for(int i=0;i<n;i++)
#define repit(x) for(auto it : x)
#define ll long long
#define vi vector<int>
#define vc vector<char>
#define vs ... | ALGO | 0.999954 | 4.586592 |
e735013c-39b7-42f3-8cc3-663804f8a749 | ishandutta2007/codeforces | arterm/normal/685/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int M = 100100;
const int K = 303;
int n, k;
int x[M], y[M];
int a[M * K], b[M * K];
ll ans[M];
int m = 0;
int pre[M];
int *all;
void read() {
cin >> n >> k;
all = a;
for (int i = 0; i < n; ++i) {
cin >> x[i... | ALGO | 0.999979 | 3.262386 |
63e6bb2e-36a3-4db9-aca5-b84f213cb152 | ishandutta2007/codeforces | heart_blue/normal/1423/K.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bi... | ALGO | 0.999623 | 3.874699 |
5d57bd68-6d06-4566-9cb3-e77b4bafb465 | CHNCoin/CHNCoin | src/script.cpp | using namespace std;
using namespace boost;
#include "script.h"
#include "keystore.h"
#include "bignum.h"
#include "key.h"
#include "main.h"
#include "sync.h"
#include "util.h"
bool CheckSig(vector<unsigned char> vchSig, vector<unsigned char> vchPubKey, CScript scriptCode, const CTransaction& txTo, unsigned int nIn, ... | TOOL | 0.91463 | 6.503615 |
1124366b-ed24-474f-bb6b-9d43eff46d8a | darkmatter18/leetcode | 0647-palindromic-substrings/0647-palindromic-substrings.cpp | class Solution {
public:
int countSubstrings(string s) {
int c = 0;
for(int i = 0; i < s.size(); i++){
for(int j = i; j < s.size(); j++){
if(is_palindrome(s, i, j)){
c++;
}
}
}
return c;
}
... | ALGO | 0.999932 | 6.362881 |
03481ad9-fd3c-4525-a515-e965c281c963 | greatzero728/zero.icpc | Contest/codeforces/Codeforces-Round-969--Div.-2-/(B).cpp | #include <bits/stdc++.h>
using namespace std;
int a[101010];
int main() {
int t; scanf("%d", &t);
while(t--) {
int n, m; scanf("%d %d", &n, &m);
for(int i = n; i--; ) scanf("%d", a + i);
int mx = *max_element(a, a + n);
while(m--) {
char c; int l, r; scanf(" %c %d %d", &c, &l, &r);
if(l <= mx && ... | ALGO | 0.999949 | 3.696135 |
22e9ce64-dff3-484a-a7ab-8955cad784c7 | RudraGahlot/Data-Structures | ARRAY/(a)- WAP-to-reverse-an-array-or-string.cpp | // write-a-program-to-reverse-an-array-or-string
Time Complexity : O(n)
#include <iostream>
using namespace std;
void reverseArray(int arr[] , int start , int end)
{
while(start<end){
int temp = arr[start];
arr[start] = arr[end];
arr[end] = temp;
start++;
end--;
}
}
v... | ALGO | 0.999583 | 5.552863 |
5c0f4570-63c0-41e4-b794-c856ed3bcd9e | wei-yuan/OpenCV_Playground | calcHist/main.cpp | #include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
/**
* @function main
*/
int main(int argc, char **argv)
{
//Mat src, dst;
Mat src, dst;
/// Load image
// getUMat() faster than copyTo()
... | TOOL | 0.898053 | 5.606786 |
53a1dd9f-176b-4a8f-886d-1eb0370f63bd | k99812/Cpp | 인프런 강의/6-0 2792/6-0 2792/2792.cpp | #include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n, m, a[300004], ret = 1e18;
bool check(int mid)
{
int num = 0;
for (int i = 0; i < m; i++)
{
num += a[i] / mid;
if (a[i] % mid) num++;
}
return n >= num;
}
int main()
{
cin >> n >> m;
ll low = 1, hi = 0, mid;
for (i... | ALGO | 0.999976 | 4.064653 |
25dfa47f-228c-4618-bc4e-d252bb223017 | Abhishekjadhavv/Assignment---44 | search.cpp | // Create a function to search the element in the set.
#include<iostream>
#include<set>
#include<iterator>
using namespace std;
int main(){
// Initialize set
set<int> s;
s.insert(1);
s.insert(4);
s.insert(2);
s.insert(5);
s.insert(3);
// finding position of 6
auto pos = s.find(8)... | ALGO | 0.995561 | 4.850524 |
5c67fa1a-d42a-4a14-bbf4-287f75622a56 | wyjoutstanding/Algorithm | AlgorithmNote/AlgorithmNote-Code/第9章 数据结构专题2/A1086.cpp | /*
* @Author: wuyangjun
* @Date: 2019-08-11 16:47:03
* @LastEditTime: 2019-08-11 17:19:26
* @Github: https://github.com/wyjoutstanding
*/
#include <bits/stdc++.h>
using namespace std;
struct TNode {
int data;
TNode *lchild, *rchild;
};
vector<int> op, post; //操作序列、后序遍历结果
int N, cnt = 0; //结点总数、当前操作下标
// 遍历... | ALGO | 0.999936 | 4.681681 |
06b76a23-720a-4432-9a4f-897defd19ba6 | chunny326/cs6420-assignment8-chunny326 | src/alg_matrices.cpp | #include <iostream>
#include "alg_matrices.h"
// Multiplies matrix A by matrix B and returns the result based on the Square-Matrix-Multiply algorithm.
// Both A and B matrices are of square n×n size and n is a power of 2.
double* iterative_mult(int n, double *A, double *B)
{
double* C = new double[n * n];
for... | ALGO | 0.999071 | 5.319083 |
3472af0e-15e5-4120-b6de-82d7903f5792 | muhammadGunaid/event_manager | 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 |
ca0b1274-e50f-4e81-89eb-f4353879a109 | veli9595/Velina_Ivanova | 7maZad06-11.cpp | #include<iostream>
using namespace std;
int main()
{
int x,max,min,max1=1,min1=1;
cout<<"Vuvedete broq na ychastnicite: "<<endl;
cin>>x;
int a[x];
for(int i=0;i<x;i++)
{
cout<<"Vuvedete tochkite na "<<i+1<<"-iq uchastnik"<<endl;
cin>>a[i];
}
max=a[0];
min=a[0];
fo... | ALGO | 0.999775 | 3.417595 |
9e8ccde8-a5a3-4ea3-8794-9e6e4ce2d62d | OliverHenrichs/Tetris | Tetris/Tetris.cpp | #include "pch.h"
using namespace std;
// Figures
wstring tetromino[7];
static int tetrominoWidth = 4;
// Field
static int nFieldWidth = 12;
static int nFieldHeight = 18;
unsigned char *pField = nullptr;
// Score Board
static int nScoreWidth = 19;
static int nScoreHeight = 3;
unsigned char *pScoreBoard = nullptr;
/... | TOOL | 0.922729 | 3.902032 |
5896ee2b-86fe-4466-bc9c-8c49d040c154 | Takeoff0518/cpp-learning-code | template-rem-2/P3865-ST.cpp | #include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#define N (100005)
#define M (1005)
#define ll long long
#define INF (0x3f3f3f3f)
#define mod (998244353)
#define PII pair<int,int>
#define ls(xxx) (xxx)<<1
#define rs(xxx) (xxx)<<1|1
using namespace std;
int n,m,f[N][18],a[N],lg[N];
int main(){
... | ALGO | 0.999947 | 4.359067 |
dbee677e-92cb-47be-8626-201e49a4f73c | sky-bro/AC | leetcode.com/0836 Rectangle Overlap/better.cpp | #include <iostream>
#include <vector>
using namespace std;
// for 1D:
// left1 < right2 && left2 < right1
// for 2D:
// overlap on both x and y
class Solution {
public:
bool isRectangleOverlap(vector<int>& rec1, vector<int>& rec2) {
// overlap on x && overlap on y
return rec1[0] < rec2[2] && rec2[0] < re... | ALGO | 0.997188 | 5.60292 |
d0de34c9-46c0-4903-b180-756dbac141b4 | knightcodeman/strivers-SDE-sheet-challenge | 16_majority_element2.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> majorityElementII(vector<int> &arr)
{
int n=arr.size();
int check_occur=n/3;
vector<int>ans;
unordered_map<int,int>umap;
for(int i=0;i<n;i++)umap[arr[i]]++;
for(auto it:umap)if(it.second>check_occur)ans.push_back(it.first);
return ans;
}
| ALGO | 0.999904 | 5.09698 |
59705e84-916f-4302-a30a-c87e3253d4fc | cavinhartono/problemsolving-java | src/FizzBuzz/main.cpp | #include <iostream>
using namespace std;
void fizzBuzz(int n) {
for (int i = 1; i <= n; i++) {
if (i % 3 == 0 && i % 5 == 0) {
cout << "FizzBuzz" << endl;
} else if (i % 3 == 0) {
cout << "Fizz" << endl;
} else if (i % 5 == 0) {
cout << "Buzz" << endl;
} else {
cout << i << e... | ALGO | 0.992658 | 6.877235 |
506c6d7c-6fc9-4280-8a9b-2261baa695e1 | gzgreg/ACM | 2017-09-02/K.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int,int> vals;
int N, M;
int ans = 0;
int accum[10001];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N >> M;
for(int i = 0; i < N; i++... | ALGO | 0.999954 | 3.516555 |
4273f2a2-7a4a-4980-be6e-ba4183e9d0a8 | kmjp/procon | atcoder/arc051-100/arc81-100/arc097/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999907 | 4.197162 |
3bc8a23d-8bc4-4783-8f97-86d5c451dc7e | ishandutta2007/codeforces | gediminas/normal/585/D.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
template<typename T>
struct seti : public tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> {
seti(): tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update... | ALGO | 0.999985 | 3.664124 |
656e32c4-e045-4cc4-8e21-820aae8d37ea | MattShi/csmastercourses | CoursePrjs/CSC505/hw/2/hw2_1/qsort.cpp | // hw2_1.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include <iostream>
#include <string>
#include <memory.h>
#include <stdlib.h>
std::string STR_EXIT = "e";
int N_THOUSANDS = 1024*10;
int g_qsortbase = 2;
int g_currentsize = 0;
int *g_sort = new int[N_THOUSANDS];
int g_current_... | ALGO | 0.999416 | 4.535879 |
fb407b57-a1e6-40ea-a3ba-df0b7999af58 | NithinNk99/Flight_booking | 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 |
f2dd4a08-5685-47de-a35a-e5fb078e4465 | Miralius/RedBelt | EBook/slow.cpp | #include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
class ReadingManager {
using UserId = unsigned;
using PageNumber = unsigned short;
static constexpr UserId max_user_count = 100000;
static constexpr PageNumber max_page_count = 1000;
public:
ReadingManager()
... | ALGO | 0.924505 | 5.418391 |
0253cd6d-1e55-42be-b3f5-7fcf072efeb6 | maple3142/Practice | uva10131.cpp | #include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
struct Elephant {
Elephant(int a, int b, int c) : weight(a), iq(b), idx(c) {}
int weight, iq, idx;
};
int main(void) {
ios::sync_with_stdio(false);
vector<Elephant> v;
int a, b, cnt = 0;
while (cin >> a >> b) {
cnt... | ALGO | 0.999987 | 3.769933 |
ba981da6-3504-48d1-9710-e056d2e2823d | mehuloo3/gfg | Difficulty: Medium/Missing And Repeating/missing-and-repeating.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> findTwoElement(vector<int>& arr) {
// code here
unordered_map<int,int>map;
vector<int>ans;
for(auto i:arr)
{
map[i]++;
}
... | ALGO | 0.999506 | 5.446724 |
a00a6a4a-8af3-4f82-8cf7-8c449545205e | msi1202/projects | efield.cpp | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
//Global variable declaration and intializations
const double& Q=1.e-9;
const double& k_e=9*pow(10,9);
const double& r_min=0;
const double& r_max=100;
double Efield(double r, const double &a=50)
{
if (r<a)
return k_e*Q*(r/... | ALGO | 0.987622 | 3.689029 |
eafff036-c49b-4afe-8837-10e02c772b83 | esquintero/GrupoSimulaciones | Taller1/Problema4/Cuna_Newton.cpp | #include <iostream>
#include <cmath>
using namespace std;
void InicieAnimacion(void);
void InicieCuadro(void);
void TermineCuadro(void);
// Constantes globales en CGS
const int N = 3; // # pndulos
const double g = 980;
const double K = 10.0e10;
// Constantes PEFRL
const double Zeta=0.1786178958448091e00;
const doub... | ALGO | 0.999349 | 4.088818 |
ecc155cb-656c-4614-8fdc-bdbc9ac46ace | sidharth-085/Coding-Ninjas-DSA-Problems | HashMap/LongestConsecutiveSequence.cpp | #include <vector>
#include <unordered_map>
using namespace std;
std::vector<int> longestConsecutiveIncreasingSequence(int *arr, int n) {
std::unordered_map<int, bool> numMap;
std::vector<int> result;
// Insert all elements into the map
for (int i = 0; i < n; i++) {
numMap[arr[i]] = true;
}... | ALGO | 0.999992 | 6.37423 |
8dd6352c-5e71-4dd3-9d96-012053bf6193 | ishandutta2007/codeforces | koosha_mv/normal/1277/E.cpp | #include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define f_(i,a,b)for(ll i=a;i>=b;i--)
#define ll long long
#define pb push_back
using namespace std;
ll t,l,q,n,m,a,b,mark[200009],ans1,ans2,x,y;
vector<int> g[200009];
int dfs(int x,int y){
if(x==y){l=0;return 0;}
... | ALGO | 0.999168 | 3.740729 |
bd109bc3-dd0d-403b-95dc-93d5b0b442fe | dgcnz/competitive-programming | codeforces/1350B-orac-and-models.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using vi = vector<int>;
const int NMAX = 1e5 + 11;
int n, s[NMAX];
// dp(i) = max{dp(j) | j <- [1,2..i], i mod j == 0, s[j] < s[i] } + 1
int solve(void)
{
vi dp(n + 1, 1);
for (int i = 1; i <= n; ++i)
{
for (int j =... | ALGO | 0.999609 | 3.703408 |
93f9ba49-57aa-48e7-860a-7aa05656f98d | K33weR/lab_1_01 | Res2/Lab_0_02.cpp | #include <iostream>
int main()
{
unsigned char x = 7, invMask = 255; // 00000111
unsigned short i, bitChange, invertBits;
std::cout << "Enter the index of a bit of a num 0-7 (right to left): ";
std::cin >> i;
unsigned char mask = ~(1 << i);
bitChange = x & mask; // Change i bit to 0
invertB... | ALGO | 0.94705 | 5.152892 |
a50be933-6dea-458e-a568-b46703921b50 | YiDeveloper/Yi | src/eccryptoverify.cpp | #include "eccryptoverify.h"
namespace {
int CompareBigEndian(const unsigned char *c1, size_t c1len, const unsigned char *c2, size_t c2len) {
while (c1len > c2len) {
if (*c1)
return 1;
c1++;
c1len--;
}
while (c2len > c1len) {
if (*c2)
return -1;
... | ALGO | 0.918142 | 6.280211 |
4db91c85-d9c8-4003-8ad1-2c6dd14da863 | zhangbright1986/DisRep | client/HelperFunctions.cpp | #include "HelperFunctions.h"
#include "Log.h"
#include <math.h>
#include <cassert>
#include <iostream>
#include <time.h>
#include <string.h>
#include <set>
#ifndef WIN32
#include <sys/time.h>
#include <sys/resource.h>
#endif
// Random number generator
double helper_functions::random(long newSeed)
{
stat... | TOOL | 0.886198 | 5.955753 |
77f71d18-722e-415a-b35b-83be86097c9c | Ratna04priya/Disposal-Codes | 3rd Semester/max-sum-array.cpp | #include<stdio.h>
#include<stdlib.h>
int max2(int a,int b)
{ return (a>b)? a : b;}
int max(int a, int b, int c)
{
return max2(max2(a,b),c);
}
int maxsubarrcrs(int arr[50],int l, int h)
{
int m=(l+h)/2;
int i,sum=0;
int lsum,rsum,tsum;
lsum=(-10000);
rsum=(-10000);
for(i=m;i>=1;--i)
{
sum=sum+arr[i];
if(s... | ALGO | 0.999961 | 3.819093 |
ae3cc92c-a414-48e8-ae34-a8c63347fb59 | ishandutta2007/codeforces | quang/normal/356/C.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int sum;
int a[5];
int check(int u, int v) {
int b[5];
for (int i = 0; i < 5; i++) {
b[i] = a[i];
}
int foo = sum;
for (int i = 4; i >= 0; i--) {
if (u <= b[i]) {
foo -= u * i;
b[i] -= u;
u = 0;
break;
} else {
u... | ALGO | 0.999985 | 3.65199 |
2e3f69d4-ba93-45b6-931d-8215817dd355 | homer6/c_reading | boost-trunk/libs/phoenix/example/if.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <boost/phoenix/statement.hpp>
#include <boost/phoenix/operator.hpp>
#include <boost/phoenix/core.hpp>
int
main()
{
using boost::phoenix::if_;
using boost::phoenix::arg_names::arg1;
int init[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
std::... | TOOL | 0.976583 | 4.440653 |
6e55f68b-89ea-404f-a5c9-7c37f08fe355 | peterhyun1234/Algorithm_team_BOJ | YJ/20200904/Heap/디스크 컨트롤러.cpp | #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
struct cmp {
bool operator()(pair<int, int> a, pair<int, int> b) {
if (a.second > b.second)
return true;
else if (a.second == b.second) {
if (a.first > b.first... | ALGO | 0.999968 | 4.853171 |
db151a09-695d-4aec-9b0b-75db9b1690c3 | PradyumnGup/web | DSA/Binary Trees/Merge two BST 's.cpp | /*
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
*/
class Solution {
public:
Node* middle(Node* node){
Node* slow=node;
Node* fast=node->right->right;
while(fast && fast->right){
slow=... | ALGO | 0.999999 | 5.775836 |
c909339e-3758-4ea5-b8d0-d674aa76f543 | rupeshrrts/DSA_BY_NINJAS | milestone_3/code/3_Recursion/5_Hint_first_index.cpp | // First Index of Number
// Send Feedback
// Given an array of length N and an integer x, you need to find and return the first index of integer x present in the array. Return -1 if it is not present in the array.
// First index means, the index of first occurrence of x in the input array.
// Do this recursively. Index... | ALGO | 0.999947 | 6.05306 |
574ec05d-6eb1-409c-a3bb-36fff958b3ba | Anmolawasthi117/Dsa_using_C- | assignments/lec_3/q5.cpp | #include<iostream>
#include<vector>
#include<bits/stdc++.h>
using namespace std;
int main(){
int s,m,n;
cout<<"Enter the sides of triangle ";
cin>>s,m,n;
if(s==m && m==n){
cout<<"Equilateral triangle";
}
else if(s==m || m==n || n==s){
cout<<"Isosceles triangle";
}
else{
... | ALGO | 0.999442 | 4.247995 |
d598ef03-c2c7-418b-af02-d90739e712b7 | jatin69/coding-practice | leetcode/algorithms/backtracking/permutations/Q47-permutations-ii.cpp | /*
* Author : Jatin Rohilla
* Date : 06-2019
*
* Editor : Dev c++ 5.11
* Compiler : g++ 5.1.0
* flags : -std=c++14
*
*/
#include<bits/stdc++.h>
using namespace std;
/********************************** 24ms *****************************/
class Solution {
public:
void backtrack(vector<int>& nums, in... | ALGO | 0.999994 | 5.766946 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.