uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3888b4d4-12ef-43f8-a06a-a5f96ca9794c | Salensoft/thu-cst-cracker | 大一下/面向对象程序设计基础-姚海龙老师/hw/Individual Project /2016011446_翁家翌/oop_individual_project_2017/src/generator.cpp | #include "generator.h"
int Generator::METHOD_CASE = 0;
int Generator::TOTAL_NUMBER_OF_POINTS;
int Generator::MAX_COORDINATE;
int Generator::POINTS_PRECISION = 10;
ld Generator::MIN_DISTANCE;
/**
* [Generator::Rand_in_coordinate_range description]
* @Author n+e
* @DateTime 2017-04-23
* @return [a float in [0,M... | ALGO | 0.98447 | 5.306767 |
b6b347d3-8dc6-4142-82bb-a8b869b2db29 | chenchu-zs/leetcode | 007_Reverse_Integer.cpp | class Solution {
public:
long long reverse(int x)
{
string s = to_string(x);
if (s[0] == '-')
std::reverse(s.begin() + 1, s.end());
else
std::reverse(s.begin(), s.end());
//judge if overflow
long long trans = stoll(s);
int ans = (int)stoll... | ALGO | 0.999944 | 5.330945 |
cb2a0314-1680-4e9c-892d-e310ece87db4 | alvarez37/algebra | algebra/WinNTL-10_5_0/tests/mat_lzz_pTest.cpp |
#include <NTL/mat_lzz_p.h>
NTL_CLIENT
void FillRandom(Mat<zz_p>& A)
{
long n = A.NumRows();
long m = A.NumCols();
for (long i = 0; i < n; i++)
for (long j = 0; j < m; j++)
random(A[i][j]);
}
void FillRandom1(Mat<zz_p>& A)
{
long n = A.NumRows();
long m = A.NumCols();
for (long j = 0... | ALGO | 0.990532 | 3.546973 |
33183ba4-9d27-466b-8d80-6ce885d2fef9 | roadswitcher/AOC_2024 | Day_8/day8.cpp | #include <fstream>
#include <iostream>
#include <set>
#include <string>
#include <vector>
struct coord {
int y{}; // row
int x{}; // column
char type{};
};
using map_grid = std::vector<std::vector<char>>;
using tower_pair = std::pair<coord, coord>;
map_grid loadfile(const std::string &filename) {
map_grid re... | ALGO | 0.999851 | 5.932654 |
a7ee07e9-68d9-4971-a9a2-01bc240e533f | ahmedfci93/Problem-Solving | UVA/639 - Don't Get Rooked.cpp | // Backtrack Algorithm
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string s[4];
int n;
bool is_safe(int x,int y)
{
int i;
for(i=x;i>-1;i--)
if(s[i][y]=='r') return false;
else if (s[i][y]=='X')break;
for(i=y;i>-1;i--)
if(s[x][i]=='r') return false;
else if (s[x][i]=='X')b... | ALGO | 0.999639 | 4.597405 |
05369d3d-7514-43ed-bf2e-d90c5275d89f | ishandutta2007/codeforces | lqs2015/normal/1470/D.cpp | #include <bits/stdc++.h>
using namespace std;
int test, n, m, x, y, ord[333333], cnt, flg, res[333333];
vector<int> g[333333], ans;
bool used[333333];
void dfs(int i)
{
ord[++cnt] = i;
used[i] = 1;
for (int j = 0; j < g[i].size(); j++)
{
int to = g[i][j];
if (!used[to]) dfs(to);
}
}
int main()
{
scanf("%d", &... | ALGO | 0.999951 | 4.1923 |
a4edd4c0-eba4-4dce-8d97-f993d6f197d6 | MaulikVarshney/JobPrep | Patterns/4.cpp | #include<bits/stdc++.h>
using namespace std;
void print(int a){
for(int i=1;i<=a;i++){
for(int j=1;j<=i;j++){
cout<<i;
}
cout<<"\n";
}
}
int main(){
int n;
cout<<"Enter upper limit you want = ";
cin>>n;
print(n);
return 0;
}
| ALGO | 0.999752 | 4.119641 |
a782bc36-65d5-4a8b-b744-e77401063763 | MichaelxhJiang/LeetCode | RangeAddition.cpp | class Solution {
public:
vector<int> getModifiedArray(int length, vector<vector<int>>& updates) {
vector<int> prefixSum = vector<int>(length, 0);
for (int i = 0; i < updates.size(); i++) {
prefixSum[updates[i][0]] += updates[i][2];
if (updates[i][1]+1 < length) {
... | ALGO | 0.999586 | 6.287035 |
88bf74f6-93ca-4074-93fa-89c976d88b55 | ishandutta2007/codeforces | penguin1017/normal/1292/A.cpp | #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define pb push_back
#define pii pair<int,int>
#define vi vector<pii>
#define fi first
#define se second
#define lb(x) ((x)&(-x))
using namespace std;
const int N=1e5+9;
vi g[N];
bitset<100009> a[2];
int ... | ALGO | 0.999879 | 3.604777 |
047c2645-889c-4e36-b210-3d02ad64338b | ishandutta2007/codeforces | natofp/normal/1566/A.cpp | #include <bits/stdc++.h>
#include <random>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define pii pair<int,int>
#define mp make_pair
#define pll pair<long long,long long>
#define ld long double
#define ull unsigned long long
using namespace std;
void solve(){
int n, s; cin >>... | ALGO | 0.999765 | 3.452224 |
ca0200c2-6f82-4276-95ac-cc1bc48a1850 | loteque/wasteland-warrior-engine | thirdparty/openxr/src/common/filesystem_utils.cpp | #include "filesystem_utils.hpp"
#include "platform_utils.hpp"
#include <cstring>
#include <string>
#if defined DISABLE_STD_FILESYSTEM
#define USE_EXPERIMENTAL_FS 0
#define USE_FINAL_FS 0
#else
#include "stdfs_conditions.h"
#endif
#if USE_FINAL_FS == 1
#include <filesystem>
#define FS_PREFIX std::filesystem
#elif U... | TOOL | 0.96598 | 7.568545 |
d0af5619-ff9a-4aab-8052-e0445f2e81a1 | zenvite2/DSAA_PTIT | _old C++/canhbao.cpp | /*
Có một số đứa trẻ đang ăn trưa ở bàn ăn. Chúng luân phiên nhau lấy thức ăn từ bàn. Một số đứa trẻ ko được dạy dỗ nên nhảy vào lấy mà ko cho người khác cơ hội. Nếu ở 1 thời điểm 1 đứa trẻ lấy 1 miếng thức ăn mà trong khi nó có nhiều thức ăn hơn tất cả những đứa trẻ khác cộng lại,
nó sẽ bị cô giáo cảnh báo về cách cư ... | ALGO | 0.999794 | 4.011791 |
86168ced-b6bc-42ec-b6a1-3d00bb9c1023 | youxiao/yxbase | buildtools/third_party/libc++/trunk/test/std/containers/sequences/vector.bool/find.pass.cpp | // <vector>
// vector<bool>
// std::find with vector<bool>::iterator
// https://bugs.llvm.org/show_bug.cgi?id=16816
#include <vector>
#include <algorithm>
#include <cassert>
#include <cstddef>
int main()
{
{
for (unsigned i = 1; i < 256; ++i)
{
std::vector<bool> b(i,true);
... | TEST | 0.985428 | 5.10077 |
104af991-d43f-4397-afc7-0e1238068ddd | munhwas1140/algo-study | WEEK_04/BOJ_9252/hyeongjun.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio cin.tie(0)->sync_with_stdio(0)
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
string a, b;
int dp[1001][1001];
int go(int ai, int bi) {
if(ai < 0 || bi < 0) return 0;
int &ret = dp[ai][bi];
if(ret != -1) return ret;
... | ALGO | 0.999989 | 4.287396 |
48aff620-caf8-4c08-bb6e-addf2995341f | qingwabote/zero | puttyknife/phys/bullet-end/bullet/src/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp | //#include <stdio.h>
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/CollisionShapes/btTriangleShape.h"
#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h"
#include "BulletCollision/NarrowPhaseCo... | ALGO | 0.988334 | 5.537234 |
9a49fd45-f758-44b6-af7a-85d5694e8e2e | rahimuj570/onlineCp | play boy chimp.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define bdb(x) cout<<bitset<10>(x)<<endl;
#define db(x) cout<<(x)<<endl;
#define pb push_back;
int getUpperBound(int arr[], int luchu_height, i... | ALGO | 0.999981 | 3.856851 |
2743ac3e-9982-490d-94e0-f6af57421187 | wamgbo/school | code/now/first_of_freshman/撲克牌.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
void shuffle(int wDeck[][13], const char *wFace[], const char *wSuit[]);
int main() {
const char *suit[4] = { "Hearts", "Diamonds", "Clubs", "Spades" };
const char *face[13] = { "Ace", "Deuce", "Three", "Four",
"Five", "Six... | ALGO | 0.995892 | 5.366879 |
406f3ff6-4a3c-4311-9608-7da5b5aec71c | fepaf/Competitive-Programming | Resoluções OJ/cses/2417.cpp | #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
#define INF (2e18)
#define MAX (1<<20)
#define MOD 1000000007
#define i64 long long
#define all(x) (x).begin() , (x).end()
#define sz(x) (int)(x).size()
#define ii antr<int, int>
#define fs first
#define sc second
#define eb e... | ALGO | 0.999919 | 3.839705 |
9743d149-415a-4f6a-bee6-e78ed877bd29 | kassonlab/gmxapi | src/gromacs/gmxana/gmx_h2order.cpp | #include "gmxpre.h"
#include <cmath>
#include <cstring>
#include "gromacs/commandline/pargs.h"
#include "gromacs/commandline/viewit.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
#include "gromacs/gmxana/gmx_ana.h"
#include "gromacs/gmxana/princ.h"
#include "gromacs/math/vec.h"
#include "gromac... | ALGO | 0.996932 | 4.038609 |
52bb0f35-cc62-420f-a887-464480a7d405 | geekygirl8/Hacktoberfest_2022_DSA | C++/C++/binary-gap.cpp | // Time: O(logn) = O(1) due to n is a 32-bit number
// Space: O(1)
class Solution {
public:
int binaryGap(int N) {
int result = 0;
int last = -1;
for (int i = 0; i < 32; ++i) {
if ((N >> i) & 1) {
if (last != -1) {
result = max(result, i - la... | ALGO | 0.999814 | 6.305405 |
0dc9d13b-5f39-47f6-b384-cd368deac557 | JustBeYou/infoarena | infoarena/probleme/sobo.cpp | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef signed long long ll;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef unsigned char uchar;
const int lmax = 2001;
const int nmax = 16;
const ll INF = 1e16;
void printbin(int x) {
bitset<sizeof(x) * 8> a(x);
... | ALGO | 0.999632 | 3.424584 |
3c43887b-1d6b-4ea0-baa6-6609f38659a4 | MightyJjared/DSA-Sigma | DSA/Stack/pushatbottom.cpp | #include <iostream>
#include <stack>
using namespace std;
// we are creating a function which will push element to the bottom of the stack
void pushatbottom(stack<int> &s, int val){
if(s.empty()){
s.push(val);
return;
}
int temp = s.top();
s.pop();
pushatbottom(s, val);
s.push(t... | ALGO | 0.99976 | 4.847487 |
6ed0e174-86db-4d8a-a139-d98a37a808f1 | IvDmAl/FractalRanderer | Fractals/Source/BurningShip.cpp | #pragma once
#include "Renderer/FractalInterface.h"
/*
This class contains the mathematical implementation of the burning ship fractal.
For more details about this fractal, see: https://en.wikipedia.org/wiki/Burning_Ship_fractal
*/
class BurningShip : public FractalInterface
{
public:
double Evaluate(double real, d... | ALGO | 0.98031 | 5.708375 |
30d732f3-4b49-4888-aaf7-b949f9ba5861 | WhiteFang033/C-Programs | Lab 7 (20th Nov 23)/dynamic_array.cpp | //Program to find the largest element in an given array by allocating memory dynamically
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, j, n, max=0;
printf("Enter the size of array...\n");
scanf("%d", &n);
int *ptr = (int*)calloc(n, sizeof(int));
printf("Enter the numbers in the array...\n");
fo... | ALGO | 0.99979 | 3.552021 |
ed70d7f2-7d61-4341-b30e-d4927c2297f9 | Q-Minh/position-based-dynamics | src/xpbd/green_strain_elastic_constraint.cpp | #include "xpbd/green_strain_elastic_constraint.h"
#include <Eigen/Dense>
#include <eigen/SVD>
namespace xpbd {
green_strain_elastic_constraint_t::green_strain_elastic_constraint_t(
std::initializer_list<index_type> indices,
positions_type const& p,
scalar_type young_modulus,
scalar_type poisson_ratio... | ALGO | 0.997669 | 5.914926 |
3552d7cc-842a-44bd-8f1b-7aca4a6a9c73 | Singh-Amarjot/learnYard_DSA | fundamental practice problems/arrays/max consecutive ones 3 (changing sliding window).cpp | class Solution {
public:
int longestOnes(vector<int>& nums, int k) {
int n = nums.size();
int l =0;
int ans = 0;
int zero_count = 0;
for(int r = 0;r<n;r++){
if(nums[r]==0){
zero_count++;
}
while(zero_count>k){
... | ALGO | 0.999963 | 6.176891 |
005a3cdc-6c6c-4aaf-80fe-4ebd1eaf93a5 | RyomenDev/DSA | DSA LB/RECURSION/1_.cpp |
// Recursion : function calls itself
// Call Stack flow
// if recusive relation is in end : TAil Recursion
// if it is above Processing : Head Recursion
#include <iostream>
using namespace std;
// power n^e
int pOWER(int n, int e)
{
// base case
if (e == 0)
return 1;
return n * pOWER(n, e - 1);... | ALGO | 0.997936 | 5.215756 |
ba3c645c-6242-4130-a484-e40e02fbfae0 | wonsangL/algorithm | Problem/baekjoon/1051_numSquare.cpp | #include<iostream>
#include<string>
using namespace std;
int N, M;
string grid[50];
int find_rect(int row, int col) {
int c_col = M - 1, result = 1;
while (c_col != col) {
if (grid[row][col] == grid[row][c_col]) {
if (row + (c_col - col) < N && grid[row][col] == grid[row + (c_col - col)][col]) {
if (grid... | ALGO | 0.99994 | 4.635101 |
7a3659b5-0872-4d13-937f-6e05a5b4df96 | kcalbCube/PVC-16 | include/boost_1_78_0/libs/graph/example/remove_edge_if_dir.cpp | #include <boost/config.hpp>
#include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
/*
Sample output:
original graph:
0 --> 3 2 3
1 --> 3
2 --> 0
3 --> 2
removing edges (0,3)
0 --> 2
1 --> 3
2 --> 0
3 --> 2
removing edge (0,2) and (3, 2)
0 -->
... | ALGO | 0.977754 | 6.749057 |
b059e048-5555-486f-aac7-3f179b1f405b | glucu/stroustrup-ppp | ch18/ex4.cpp | #include <iostream>
#include <stdexcept>
/*
* COMMENT:
* The results do in fact look "unreasonable." In fact,
* <b>const char ca1[] = {'C', '+', '+'};</b> is stored in the
* .rodata segment when it is a const global array. But on my machine
* is stored adjacent to the const string literal <b>exception</b> meanin... | TOOL | 0.961225 | 4.810591 |
97ead877-51ba-4fdd-80c6-faef19b0e735 | SahilRaj1/placement-prep | dsa/bit manipulation/02_Bit_Manipulation_Tricks.cpp | /* TOPIC: ^ Bit Manipulation Tricks */
// REFERENCE: https://youtu.be/XjtYsFjXtoE
#include <bits/stdc++.h>
using namespace std;
void printBinary(int num) {
for (int i = 10; i >= 0; --i) {
cout << ((num >> i) & 1);
} cout<<endl;
}
int main() {
int n;
cin >> n;
// 1. Odd Even Check
i... | ALGO | 0.998715 | 4.375699 |
02027059-dcfd-46a7-b542-5acc26b5b73c | Chandankr-kr/LeetCode | 0074-search-a-2d-matrix/0074-search-a-2d-matrix.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int m=matrix.size();
int n=matrix[0].size();
int lo=0;
int hi=m*n-1;
while(lo<=hi){
int mid=lo+(hi-lo)/2;
int i=mid/n;
int j=mid%n;
if(target=... | ALGO | 0.999969 | 6.152008 |
52b9a478-2779-4077-a686-1af1331bfa92 | MaryBrachini/Edi | Atividade2/L6/main.cpp | /* Escreva um procedimento que recebes 3 valores reais X, Y e Z e que verifique se esses valores
podem ser os comprimentos dos lados de um triângulo e, neste caso, retornar qual o tipo de
triângulo formado. Para que X, Y e Z formem um triângulo é necessário que a seguinte propriedade
seja satisfeita: o comprimento de c... | ALGO | 0.984969 | 4.360489 |
352a29ab-2ad1-42ed-bc48-4e14f36ceb26 | savigurjar/Practices-Problems-DSA | array DSA questions and Solution practice/chararray.cpp | #include<iostream>
#include<vector>
using namespace std;
//create array of char types and store 'a' to 'z
int main()
{
char arr[26];
cout<<"a to z characters are : ";
for(int i=0;i<26;i++)
{
// arr[i] = 'a'+i;
arr[i] = 'A'+i;
cout<<arr[i]<<" ";
}
// for(int i=0;i<26;i++)
// {
// cout<<arr[i]<<"... | ALGO | 0.988613 | 3.417075 |
3d950617-afb6-45d7-8faa-9abf03c7b6fc | houhongyi/MyOpencv | modules/features2d/src/kaze/nldiffusion_functions.cpp | /**
* @file nldiffusion_functions.cpp
* @brief Functions for non-linear diffusion applications:
* 2D Gaussian Derivatives
* Perona and Malik conductivity equations
* Perona and Malik evolution
* @date Dec 27, 2011
* @author Pablo F. Alcantarilla
*/
#include "../precomp.hpp"
#include "nldiffusion_functions.h"
#... | ALGO | 0.999929 | 7.13626 |
abcdef1d-9140-43d9-84f3-b2ad1fb85e5e | alexandraback/datacollection | solutions_5634947029139456_0/C++/hbrausen/q1.cpp | #include <iostream>
#include <vector>
#include <string>
#include <set>
using namespace std;
unsigned int parsebin(string s, int L)
{
int ret;
ret = 0;
for (int j = 0; j < L; ++j) {
if (s[s.size()-1-j] == '1') {
ret += 1<<j;
}
}
return ret;
}
unsigned int countones(unsigned int n)
{
int ret = 0;
while ... | ALGO | 0.999484 | 4.271968 |
0b72fd91-76f6-47f1-ac41-ba55f2fa9d86 | barak/mldemos | _AlgorithmsPlugins/ASVM/asvm_nlopt_solver.cpp |
#include "asvm_nlopt_solver.h"
double * x_curr;
double objective(unsigned n, const double *x, double *grad, void *my_func_data)
{
unsigned int nalpha = ((obj_func_data*)my_func_data)->num_alpha;
double** matkgh = ((obj_func_data*)my_func_data)->NLModulationKernel;
bool b = ((obj_func_data*)my_func_data)->bVerbo... | ALGO | 0.999551 | 3.122177 |
cef37ff6-cddf-4d3b-96d6-4a6b3b538262 | dungpv133/CPP-PTIT | comination2.cpp | #include <bits/stdc++.h>
using namespace std;
int n, a[100], k;
void result(){
for(int i = 1; i <= k; i++){
cout << a[i];
}
cout << " ";
}
void next_gen(int i){
for(int j = a[i - 1] + 1; j <= n - k + i; j++){
a[i] = j;
if(i == k)
result();
else
next_gen(i + 1);
}
}
int main(){
int test;
cin >> tes... | ALGO | 0.999894 | 3.882637 |
9afa03f0-a189-48d4-b1e9-013e97799ae4 | abhi061201/GFG-LEETCODE-CODINGNINJA-SOLUTION | Day 53/27. Remove Element leetcode.cpp | class Solution {
public:
int removeElement(vector<int>&nums, int val) {
int c=0;
int l=0;
while(l<nums.size()){
if(nums[l]==val){
l++;
continue;
}
else{
nums[c]=nums[l];
c++;
l++;
}
}
return c;
}
};
| ALGO | 0.999946 | 6.071265 |
aa0f1929-41c2-43fc-92f9-5804d45731d6 | ISCS-ZJU/AMBEA | code/MBE/AggressiveFinder.cpp | #include "AggressiveFinder.h"
AmbeaFinderNaive::AmbeaFinderNaive(BiGraph *graph, const char *name)
: BicliqueFinder(graph, name) {}
void AmbeaFinderNaive::Execute(int min_l_size, int min_r_size) {
setup(min_l_size, min_r_size);
graph_->Reorder(RInc);
for (int v = 0; v < graph_->GetRSize(); v++) {
if (g... | ALGO | 0.999929 | 5.708506 |
989435e4-415c-491f-a9c8-89617d087d5f | agath0/dataStructures | c_basics/arrayAsParameter.cpp | #include <stdlib.h>
#include <stdio.h>
#include <iostream>
using namespace std;
//Note: Array cannot be passed by value
// Array can only by passed by address in c and cpp
void fuc(int a[],int n)
//int a[] is passed by address
//int n is passed by value
//Note: instead of using a[] we can use *a
//which will be... | TOOL | 0.970879 | 3.931706 |
b4dd4874-e16b-4c65-a584-8a009f8e7da2 | kdheeraj1502/450-final | 450-DSA-CRACKER-master/Arrays/Sort an array of 0s, 1s and 2s.cpp | Link-https://practice.geeksforgeeks.org/problems/sort-an-array-of-0s-1s-and-2s/0
#include <iostream>
using namespace std;
int main() {
//code
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
int count0=0,count1=0;
for(in... | ALGO | 0.999568 | 5.401857 |
5ea9deb7-6c07-46a6-8ca7-b449a698e58e | kearcer/tjh_test | static_test/test38_Change_The_midsniff_To_Presniff_plus/src/main.cpp | /*
* @Author: Jiahui Tang
* @Date: 2023-02-26 10:34:31
* @LastEditors:
* @LastEditTime: 2023-02-26 10:34:31
* @Description:
*/
// 引入头文件
#include <iostream> // 用于输入输出流
#include <stack> // 用于栈数据结构
#include <string> // 用于字符串操作
#include <sstream> // 用于字符串流
// 定义一个函数来判断是否为操作数
bool is_operand(const std::string &... | ALGO | 0.999399 | 5.240675 |
1d0b5f4c-7fe3-4d95-b63e-338ce8275bd5 | Fazziekey/leetcode | sword to offer/14剪绳子.cpp | class Solution {
public:
int cuttingRope(int n) {
int max = 0,multi = 1;
int m = 2;
for(m = 2;m <= n;m++){
vector<int> k(m,1);
for(int i=0;i< n % m;i++){
k[i] = (n + (m - n % m))/m;
multi = multi * k[i];
}
for(in... | ALGO | 0.999993 | 5.569553 |
c122ee0c-1169-4208-b16b-aae09210f8ce | therohit777/Hacktober_algo_bucket | Trees/convertDLL.cpp | #include<iostream>
using namespace std;
// Node structure
struct Node{
int key;
Node *left, *right;
Node(int k){
key = k;
left = right = NULL;
}
};
// function to convert binary tree into a doubly linked list
Node *prv = NULL; // global pointer for setting previous node
Node* conve... | ALGO | 0.999985 | 4.733191 |
2be62edb-976a-4064-87c7-814c36b1f25a | luv28/SOLVED-DSA-PROBLEMS | 257-binary-tree-paths/257-binary-tree-paths.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.999916 | 5.898259 |
7750e1f4-3515-4d70-8f6e-d460ea0b3ffe | ishandutta2007/codeforces | wxhtzdy/normal/1186/F.cpp | /**
* author: wxhtzdy
* created: 14.07.2022 16:10:54
**/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<int> u(m), v(m);
vector<vector<int>> g(n);
for (int i = 0; i < m; i++) {
cin >> u[i] >> v[i];
--... | ALGO | 0.999983 | 4.588762 |
065e8722-2644-4189-894e-254269ee7b64 | omaraaa/CSEngine | include/Box2D/Dynamics/Contacts/b2Contact.cpp | #include <Box2D/Dynamics/Contacts/b2Contact.h>
#include <Box2D/Dynamics/Contacts/b2CircleContact.h>
#include <Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h>
#include <Box2D/Dynamics/Contacts/b2PolygonContact.h>
#include <Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h>
#include <Box2D/Dynamics/Contacts/b2EdgeAnd... | ALGO | 0.994502 | 7.744863 |
bb68e4b3-2825-4f84-a061-d1fe5ef690f8 | MaTb3a/LeetCode-Problems-2023 | 0460-lfu-cache/0460-lfu-cache.cpp | class LFUCache {
public:
int mp[100005],freq[100005],lstUpdate[100005],sz,time;
set<pair<pair<int,int>,int>>st;
LFUCache(int capacity) {
memset(mp,-1,sizeof mp);
memset(freq,0,sizeof freq);
memset(lstUpdate,0,sizeof lstUpdate);
sz = capacity;
time = 0 ;
st.cle... | ALGO | 0.999425 | 5.898921 |
beddf301-83b2-41a7-abe5-c65ac5aad31b | cwang588/algorithms | 巧合区间.cpp | #include<bits/stdc++.h>
using namespace std;
map<long long,long long>num;
long long a[200005],b[200005];
int main(){
int n;
long long k;
cin>>n>>k;
for(int i=1;i<=n;++i)cin>>a[i];
long long tot=0,ans=0;
for(int i=1;i<=n;++i){
tot+=a[i];
b[i]=((tot-i)%k+k)%k;
}
int now=0;
num[0]=1;
for(int i=1;i<=n;++i){
... | ALGO | 0.999954 | 3.485387 |
b7739ce7-58d0-4db6-b923-5742ea686acc | espkk/rostrum-regex | interface.cpp | #include <vector>
#include <string>
#include <stdexcept>
#include <memory>
#include <boost/dll.hpp>
#include <re2/re2.h>
#include <rostrum/api.hpp>
class regex_adapter {
public:
regex_adapter() = default;
explicit regex_adapter(const char* const pattern) {
compile(pattern);
}
void compile(const char* c... | TOOL | 0.884954 | 6.997078 |
ced67d06-6d15-42c7-ad34-99d05169a469 | ishandutta2007/codeforces | liymsheep/normal/585/A.cpp | #include <functional>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <cctype>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queu... | ALGO | 0.999967 | 3.201423 |
2790cac1-aea3-4f3b-b702-76a9bd415fb5 | uwaberascovia/calculator | 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.998784 | 6.761023 |
006eb834-b55b-4c5e-b0bf-178e8d0b3345 | jhanvee-khola/LeetCode | 14-longest-common-prefix/14-longest-common-prefix.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
if(strs.size()==0){
return "";
}
string ans="";
int i=0;
bool b=true;
while(b){
if(i>=strs[0].length()){
break;
}
char c=strs[0]... | ALGO | 0.99984 | 5.903854 |
b0b9233c-6d8a-41d9-9af7-c58b5617b33e | Abhisheksaraswat21/DAA_2022-AbhishekSaraswat- | DAA-Lab-main-2/Week 1/Linear Search/linear_search.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--) {
int n, key;
cin>>n;
int arr[n];
for(int i = 0; i < n; i++) {
cin>>arr[i];
}
cin>>key;
int j;
for(j = 0; j < n; j++) {
if(arr[j] == ke... | ALGO | 0.999884 | 4.196052 |
0d4310b5-4a31-4f1d-a02b-f859088bd3e8 | espennordahl/Aurora | Aurora/src/shading/materials/kelemenMaterial.cpp | #include <iostream>
#include <ImfArray.h>
#include <ImfRgba.h>
#include <ImfInputFile.h>
#include "kelemenMaterial.h"
#include "cookTorrance.h"
#include "shaders.h"
#include "lambert.h"
#include "log.h"
#define lcontext LOG_KelemenMaterial
#include "shadingEngine.h"
#include <math.h>
#include <sstream>
using namesp... | TOOL | 0.934151 | 5.793353 |
1e9164b7-ec47-4d8f-9695-5a52fa199689 | sahadat-11/Codeforces | 1692/E.cpp | //In The Name of ALLAH
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
#define ll long long
void solve() {
int n, k; cin >> n >> k; int a[n];
for(int i = 0; i < n; i++) {
cin >> a[i];
}
int l = 0, sum = 0, ans = -1;
for(int r = 0; r < n; r++) {
sum += a[r];
while(sum ... | ALGO | 0.999848 | 4.395233 |
7d01e055-430b-4bea-823c-dc4c4778d695 | Huey-ZhangHaiyu/-offer | code/acwing62丑数.cpp | //质因子中不包含2.3.5以外的数称作丑数,找出第n个丑数
/*
思路的本质为三路归并
i=2,j=3,k=5
2*1,2*2,2*3,2*4,2*5,2*6,2*8,,,//没有2*7哈
3*1,3*2,3*3,3*4,3*5,3*6,3*8,,,
4*1,4*2,4*3,4*4,4*5,4*6,4*8,,,
每次找最小的插进来,并且记得1为第一个丑数
可以看到最后*的数组就是我们生成的数组
*/
class Solution {
public:
int getUglyNumber(int n) {
vector<int> v;
v.push_back(1);//vector<int> ... | ALGO | 0.999931 | 5.067482 |
5a7a3e72-6806-42d7-a599-a8942629833d | AbhJ/some-cp-files-2 | codechefLONGCOOK.cpp | #include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
using namespace std;//coded by abhijay mitra
const int N=2e5+3;
const long M = 1000000007; // modulo
ll dow(ll y, ll m, ll d)
{
static ll t[] = {0, ... | ALGO | 0.999888 | 4.198418 |
348653f0-1cb1-4698-ab39-1c54ddde69f7 | Lqs66/llvm-16.0.4 | llvm/lib/CodeGen/MachineRegionInfo.cpp | #include "llvm/CodeGen/MachineRegionInfo.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/RegionInfoImpl.h"
#include "llvm/CodeGen/MachinePostDominators.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/D... | TOOL | 0.927861 | 7.856205 |
3ad0db4d-954f-4c83-ae70-c5cef3ee8632 | ishandutta2007/codeforces | kort0n/normal/1334/C.cpp | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
template<class T>
inline bool chmin(T &a, T b) {
... | ALGO | 0.999933 | 4.140725 |
ddde8ade-296f-4e91-8cd4-34a342b8fa88 | FelixMatrixx/23521215_23521704_23521494_23521821_23521208_23521327_BT03 | Bai123/Bai123.cpp | #include<iostream>
using namespace std;
void Nhap(int[], int&);
int ktDoiXung(int[], int);
int main()
{
int a[100];
int n;
Nhap(a, n);
int kq = ktDoiXung(a, n);
cout << kq;
return 0;
}
void Nhap(int a[], int& n)
{
cin >> n;
for (int i = 0; i <= n - 1; i++)
cin >> a[i];
}
int ktDoiXung(int a[], int n)
{
int ... | ALGO | 0.999967 | 3.984124 |
03add8ed-ba9a-4aea-bc65-6e63b3757c63 | Shreyyy07/DSA-CPP | Arrays/53-maximum-subarray/maximum-subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int n=nums.size();
int sum=0;
int maxi=INT_MIN;
for(int i=0; i<n; i++){
sum+=nums[i];
if(sum>maxi){
maxi=sum;
}
if(sum<0){
sum=0;
... | ALGO | 0.999955 | 6.266583 |
65c3368f-c11c-4376-a4c3-0a3fdb93235a | bluejw/BayesOptimalTreatment | Bayes_Optimal_Treatment_Simulation/SGD_Rcpp_Functions.cpp | //[[Rcpp::depends(RcppArmadillo)]]
# include <RcppArmadillo.h>
using namespace std;
using namespace arma;
using namespace Rcpp;
// [[Rcpp::export]]
mat rmvn_rcpp(const int n, vec& mean, mat& sigma){
// randomly generate samples from multivariate normal distribution
// args: n: number of data
// mean: r... | ALGO | 0.999834 | 5.848823 |
ce774d47-872a-45fd-82d0-dd35b2a653c2 | HdmkK/codingTest_CPP | 코테(cpp)/27_메뉴 리뉴얼.cpp | #include <string>
#include <vector>
#include <iostream>
#include <unordered_map>
#include <algorithm>
using namespace std;
unordered_map<string, int> mem;
bool compare(const pair<string, int>& a, const pair<string, int>& b) {
return a.second > b.second;
}
void combination(string& str, string& cur, int start, int... | ALGO | 0.999861 | 5.516148 |
18069f40-f077-4e7c-8531-2ab559f757da | immaksudalam/Data-Structure-Algorithm-Problem-solve | Graph Algorithm/DisJoint Set Union.cpp | #include <bits/stdc++.h>
using namespace std;
#define mx 100000
int parent[mx];
int rank[mx];
void make_set(int n){
parent[n] = n;
rank[n] = 1;
}
int findParent(int x){
if(x == parent[x])
return x;
return parent[x] = findParent(parent[x]); // path compression o(4*n)
}
void union_set(int x, int... | ALGO | 0.999986 | 4.755094 |
85b37778-eb48-451e-8025-3e67fcc1ba20 | dimonkiss/LaboratoryWork | LaboratoryWork4/LaboratoryWork4/LaboratoryWork4.cpp | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
unsigned long long factorial(double n) {
unsigned long long result = 1;
for (int i = 1; i <= n; ++i) {
result *= i;
}
return result;
}
double functionY1(double x) {
double sum1 = 0;
double sum2 = 0;
for (... | ALGO | 0.999271 | 3.480501 |
943fb388-6b89-4809-b632-54533f81ab0c | ishandutta2007/codeforces | penguinhacker/normal/83/A.cpp | #include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
using namespace std;
#define ll long long
#define ar array
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (int& i : a)
cin >> i;
ll ans=0;
int last=0;
int cur=0;
for (... | ALGO | 0.999781 | 3.878585 |
2304ae78-bdb0-431d-976b-d446c70f253f | EvgeniiKuchma/Evgenii-Kuchma | Functions/FunctionMain.cpp | // ++
#include <iostream>
//
int sum(int num1, int num2)//
//
{
int res = num1 + num2;//return num1+num2 - 2
return res;
}
void hi()//
{
std::cout << "hi world\n";
if (1)
return;
std::cout << "by world\n";
}
int sum_arr(int arr[], const int length);//
/*int sum_arr(int arr[], ... | ALGO | 0.990334 | 3.298442 |
10e00e62-b4eb-4982-9025-eff5665b4644 | abenezer444/DSA | 0027-remove-element/0027-remove-element.cpp | class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int k = 0;
for (int i = 0; i < nums.size(); i++) {
if (nums[i] != val) {
nums[k] = nums[i];
k++;
}
}
return k;
}
}; | ALGO | 0.998473 | 6.119414 |
44eca736-ffd7-413f-a5be-b2f0e0f58454 | chloegao12/Stochastic-Circuit | RSlatch_Gillespie.cpp | #include <vector>
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <algorithm> //std::copy
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <mpi.h>
using namespace std;
double fRand(double fMin, double fMax){
double f = (double)r... | ALGO | 0.999787 | 4.010507 |
c2a03467-cede-4d2a-aef1-8cb6038eabf9 | hotuanan/codeforces | Reconnaissance 2/main.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n;
cin >> n;
vector<int> v(n);
for(auto &x: v) cin >> x;
int idx = -1;
int mi = INT_MAX;
for(int i = 0; i < n - 1; i++) {
if(abs(v[i] - v[i + 1]) < mi) {
idx = i;
mi = abs(v[i] - v[i + 1]);
... | ALGO | 0.999973 | 4.144835 |
eee596e9-03ce-481d-874c-2777c769daa5 | Janarthanan200/CPC_weekly-tasks | binary_question_3.cpp | #include <iostream>
#include<bits/stdc++.h>
using namespace std;
/* In addition to normal binary search conditions, we check one extra condition here, that is,
whether the value at position m is the first occurance of our key element is our vector */
int binary(vector<int> &v,int l,int r,int key)
{
while(l<=r... | ALGO | 0.999941 | 5.076105 |
0660b840-2e98-4a40-99d0-9b232d6444fc | rishabhkmannu67/algo | greedy/Dijikstra.cpp | #include <iostream>
#include <string>
using namespace std;
int extractMinVertex(int *dist, bool *visited, int n){
int minIndex = -1;
for (int i = 0; i < n; i++)
if(!visited[i] && (minIndex == -1 || dist[minIndex] > dist[i]))
minIndex = i;
return minIndex;
}
void dijkstra(int **adj, int... | ALGO | 0.998565 | 4.285916 |
26084ef9-08ba-494e-81c3-722f1964b720 | SnowyField1906/university-of-science | Programming 2/tests/2018-2019/undefined/1.cpp | #include <iostream>
#include <string.h>
using namespace std;
void CheckInt(const char *s, int i, int &count) {
if (s[i + count] == '0' || s[i + count] == '1' || s[i + count] == '2' || s[i + count] == '3' || s[i + count] == '4' || s[i + count] == '5' || s[i + count] == '6' || s[i + count] == '7' || s[i + count] == ... | ALGO | 0.999136 | 4.545503 |
059a45b9-f2fe-4751-8fc8-ba5ed64d0c77 | nabirS/Problem_Solving_URI | 1153.cpp | #include<iostream>
using namespace std;
int main()
{
int i,fact=1,n;
cin>>n;
for(i=1; i<=n; i++)
{
fact*=i;
}
cout<<fact<<endl;
return 0;
}
| ALGO | 0.999931 | 4.704988 |
43241641-6e02-422d-934d-0da55b941b8b | Amit3200/codes_algo | Interview Preparations/Sort_an_array_of_0s_1s_2s.cpp | //author : 'Amit Singh Sansoya @amit3200'
//it was all meant to happen as i was all talk!
#include<bits/stdc++.h>
using namespace std;
#define lld long long int
lld n,arr[900030];
int main(){
lld t;
cin>>t;
while(t--){
lld k;
cin>>n;
map<lld,lld> mp;
for(lld i=1;i<=n;i++){
cin>>k;
mp[k]++;
}
lld or... | ALGO | 0.999945 | 3.589462 |
67cde7af-a969-457e-8fc2-261e406c19fe | theabhishekgoyal/6Companies30days | Adobe/Non-negative_Integers_without_Consecutive_Ones.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int findIntegers(int n) {
vector<int> dpZero(32), dpOne(32), dp(32);
dpZero[0] = dp[0] = 1;
for (int i = 1; i < 32; ++i) {
dpOne[i] = dpZero[i-1];
dpZero[i] = dpZero[i-1] + dpOne[i-1];
d... | ALGO | 0.999934 | 4.9657 |
680b3b52-4510-46f4-b641-4948d5777a33 | Shadow-Chen/benchmarks_gem5_gpu | rodinia-omp/srad/srad.cpp | #define OPEN
#define ITERATION
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <omp.h>
#ifdef GEM5_WORK
#include <stdint.h>
extern "C" {
void m5_dumpreset_stats(uint64_t ns_delay, uint64_t ns_period);
void m5_work_begin(uint64_t workid, uint64_t threadid);
void m5_work... | ALGO | 0.999786 | 4.748237 |
f8678859-649a-4a91-b1f4-053403cefef6 | JustAG7/Competitive_Programming | ICPC/2023/ICPCCentral2022/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define db double
#define X first
#define Y second
#define fast ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
#define all(x) (x).begin(),(x).end()
#define nl '\n'
const ll M=1e9+7;
const int N ... | ALGO | 0.999993 | 4.590492 |
a88e642c-2c65-40bd-bb1e-459dfbb7fb53 | AbhiArya20/data-structure-and-algorithms-practice | 02 DP/007UglyNumber.cpp | #include<bits/stdc++.h>
using namespace std;
// LeetCode - 264
class Solution {
public:
int nthUglyNumber(int n) {
vector<int> ugly(n);
vector<int> factors(3);
vector<int> pointers(3);
factors[0]=2;
factors[1]=3;
factors[2]=5;
ugly[0]=1;
int ans = 1;... | ALGO | 0.999984 | 5.526617 |
a87b56ef-1aea-4ac9-bc85-1d647ffad11e | tchomphoochan/cmutoi_codes | solutions/ipst/o61_mar_practice_uncategorized/o56_mar_c3_hellroad.cpp | // headers
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
// types
template<class T> using ordered_set = tr... | ALGO | 0.999978 | 4.730042 |
e2d8ffdd-f364-47d4-af0f-bbcd1801f233 | batherit/Algorithm | Study20200330/1935_후위표기식2.cpp | #include<iostream>
#include<iomanip>
#include<stack>
#include<string>
using namespace std;
double arr[30];
bool isoper(char ch) {
if (ch == '+') return true;
else if (ch == '-') return true;
else if (ch == '*') return true;
else if (ch == '/') return true;
return false;
}
int main(void) {
int n;
cin >> n;
s... | ALGO | 0.999879 | 3.948139 |
28543251-5bbc-4533-a0a9-1adc7f76d943 | Piyusss/Lc-2024 | 5-longest-palindromic-substring/longest-palindromic-substring.cpp | class Solution {
public:
int dp[10001][1001];
bool isPal(string &s,int i,int j){
if(i>=j)return 1;
if(dp[i][j]!=-1)return dp[i][j];
if(s[i]==s[j])return dp[i][j]= isPal(s,i+1,j-1);
return dp[i][j]= 0;
}
string longestPalindrome(string s) {
int n=s.size();
memset(dp,-1,sizeof(dp)... | ALGO | 0.999988 | 6.09277 |
5dede1d7-118d-4ca5-8dd7-25de4ffce054 | Hackeries/CP | CP-Contests/edu170/twoScreens.cpp | #include <bits/stdc++.h>
#define lli long long
#define pii pair<lli,lli>
#define fi first
#define sc second
#define pb push_back
#define EB emplace_back
#define MP make_pair
#define vi vector<lli>
#define vov vector<vector<lli>>v(n,vector<lli> (m))
#define vpii vector<pair<lli,lli>>
#define all(o) (o).begin(), (o).end(... | ALGO | 0.999987 | 5.284599 |
333c01aa-4110-480e-be4f-a19bc9b5a5f0 | jizhang-cmu/autonomy_stack_diablo_setup | src/slam/dependency/gtsam/gtsam/3rdparty/Eigen/doc/examples/Tutorial_ArrayClass_addition.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(3,3);
ArrayXXf b(3,3);
a << 1,2,3,
4,5,6,
7,8,9;
b << 1,2,3,
1,2,3,
1,2,3;
// Adding two arrays
cout << "a + b = " << endl << a + b << endl << endl;
// Subt... | ALGO | 0.961325 | 3.648974 |
f88d9b3e-b147-4f78-98bc-f636c28caf29 | AblalimovAlexey/AnotherWorks | cicles_2.6.cpp | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
while (N < 2) {
cout << "Enter the length of the triangle edge: ";
cin >> N;
}
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
if (j >= N - i)
cout << "* ";
else
cout << " ";
}
cout << endl;
}
return 0;
} | ALGO | 0.998707 | 3.731372 |
deffac06-0bd4-4ed8-babf-5e93a8adbcc2 | 369Saur/Codeforces | D_Double_Strings.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
int n ; cin >> n ;
vector<string> v(n) ;
set<string> st ;
for(int i = 0 ; i < n ; i++){
cin >> v[i] ;
st.insert(v[i]) ;
}
for(auto &i : v){
int flag = 0 ;
for(int j = 1 ; j < i.size(... | ALGO | 0.999845 | 4.458046 |
963f836f-3f9c-46f3-89b2-ee4c1b124721 | estebandonis/Chat-Sistos | src/server.cpp | #include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <deque>
#include <thread>
#include <mutex>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "protocol/message.h"
#include "protocol/chat.pb.h"
std::ve... | WEB | 0.868656 | 6.431712 |
7599aadb-6587-42f0-aa40-2c1ce60c9fc4 | akshay1027/Competative_programming | Div2A/devusingercherujocker.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,d;
cin>>n>>d;
int a[n],sum=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
sum=sum+a[i];
}
int c=((n-1)*10)+sum;
if(c>d)
{
cout<<"-1"<<endl;
}
else{
sum=d-sum;
cout<<sum/5<<... | ALGO | 0.999902 | 3.180634 |
384cc5e2-7461-4d89-a4af-264728940d04 | mohsenzouari/Ingeniorat_PFE | sumo-main/src/microsim/devices/MSDevice_SSM.cpp | /****************************************************************************/
/****************************************************************************/
/// @file MSDevice_SSM.cpp
/// @author Daniel Krajzewicz
/// @author Michael Behrisch
/// @author Jakob Erdmann
/// @author Leonhard Luecken
/// @author M... | TOOL | 0.922107 | 4.747006 |
0dba3e2b-12b5-4770-b4e0-24449489bdbb | KJJ1305/DSA-solutions | Linkedlists/reorderlist.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* rev... | ALGO | 0.999884 | 5.648571 |
a92d935e-618a-435e-bb24-d7df710d539c | Deb4dev/dsa | linkedlistdeletion.cpp | //get the basics
#include<iostream>
#include<stdlib.h>
using namespace std;
class Node{ //create the node to use
public:
int data;
Node* next;
Node(int val){//making a constructor
data = val;
next = NULL;
}
};
//insertion
void insertion(Node* &head,int val){
... | ALGO | 0.999586 | 3.683756 |
5fff90cf-279a-4462-8685-4eeaf6a24ab0 | remek3344/ProjektyC- | Generator_Liczb_Losowych_Monte_Carlo.cpp | #include <iostream>
#include <cmath>
using namespace std;
double losowaLiczba() {
return rand() / (double)RAND_MAX;
}
double estymujLiczbePi(int liczbaPunktow) {
int wewnatrzKola = 0;
int i = 0;
while (i < liczbaPunktow) {
double x = losowaLiczba();
double y = losowaLiczba();
... | ALGO | 0.999773 | 4.874486 |
97649992-3e87-4704-8d29-1c107baa3878 | ChandanGupta31/DSA | Array/best_time_to_buy_and_sell_stock_1.cpp | #include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
// Time Complexity = O(n)
// Space Complexity = O(1)
int solution(vector<int> &arr, int n){
int mn = arr[0];
int profit = 0;
for (int i = 0; i < n; i++)
{
int cost = arr[i]-mn;
profit = max(cost,... | ALGO | 0.999491 | 5.385111 |
359e75f1-0fee-4e87-a75b-162ba56ce237 | j7y17lte/los_frameworks_av | media/libstagefright/codecs/amrnb/enc/src/q_gain_p.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/q_gain_p.c
Functions: q_gain_pitch
Date: 02/04/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV codi... | ALGO | 0.998885 | 6.453278 |
a3291535-2747-4243-88ef-277b10bedff4 | aaronshyuu/maze-generator | Maze_Generator/Maze.cpp | #include <iostream>
#include "Maze.h"
#include "DisjointSets.h"
using namespace std; // 0 is north, 1 is south, 2 is east, 3 is west
Cell::Cell() {
// Set intial border and walls
NBorder = false;
NWall = true;
SBorder = false;
SWall = true;
EBorder = false;
EWal... | ALGO | 0.989645 | 5.318198 |
800577e0-97cf-44f6-9b48-b111d6ad8739 | FBorowiec/advanced_cpp | modern_cpp_examples/advanced_examples/exercise_5.cpp | #include <cassert>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
#include "modern_cpp_examples/map/utils/buckets.hpp"
namespace exercise_5 {
template <typename T>
class Team {
public:
Team(const std::initializer_list<std::string>& names) : names_(names) {
assert(names.size()... | TEST | 0.862178 | 7.043451 |
75d36a4b-c946-4bee-847c-b339a1d47432 | RithikSuthan/LeetCode | 1044-find-common-characters/1044-find-common-characters.cpp | class Solution {
public:
vector<string> commonChars(vector<string>& words) {
vector<string> frequency;
for (auto &chr:words[0])
{
int count=0;
for(int i=1;i<words.size();i++)
{
// cout<<words[i];
for(auto &ch:words[i])
... | ALGO | 0.99987 | 5.619835 |
dd1e9882-eaf6-4980-aecd-6ef146ecf050 | DuGuYifei/LeetCode_Record | 1017.负二进制转换.cpp | #include <string>
#include <algorithm>
using namespace std;
/*
* @lc app=leetcode.cn id=1017 lang=cpp
*
* [1017] 负二进制转换
*
* https://leetcode.cn/problems/convert-to-base-2/description/
*
* algorithms
* Medium (57.11%)
* Likes: 68
* Dislikes: 0
* Total Accepted: 6.2K
* Total Submissions: 10.6K
* Testca... | ALGO | 0.999548 | 5.878413 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.