uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2ac3fd89-8ed2-4f27-8347-706e139de37d | NIKITA320495/cpp-codes | DSA/linkedlist1.cpp | #include<iostream>
using namespace std;
struct node
{ int info;
node *next;
};
node *start=nullptr;
void create_list(int info)
{
node *newnode= new node;
newnode->info=info;
newnode->next=nullptr;
start=newnode;
}
void display()
{
cout<<start->next;
if (start==nullptr)
{cout<<"Empty";}... | ALGO | 0.998909 | 3.598706 |
90b735d7-879a-469e-a501-dd43d2f6d83f | Mennah-Elsheikh/PS_Leetcode | 283-move-zeroes/move-zeroes.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums) {
int last_zero_index = 0 ;
int n = nums.size();
for (int i = 0 ; i < n ; i++)
{
if( nums[i] != 0 )
{
nums[last_zero_index] = nums[i];
last_zero_index++ ;
... | ALGO | 0.999886 | 6.605893 |
868b0378-9342-48c0-b466-c824399b5e52 | PKua007/rampack | src/core/DomainDecomposition.cpp | //
// Created by Piotr Kubala on 13/03/2021.
//
#include <numeric>
#include <sstream>
#include "DomainDecomposition.h"
#include "utils/Exceptions.h"
std::string TooNarrowDomainException::makeWhat(std::size_t coord, double wholeDomainWidth, double ghostLayerWidth,
double... | ALGO | 0.999493 | 6.73722 |
2d8d0db2-b55b-46ef-a06b-aa840d0ca3b2 | kevinryantao/LearnCPlusPlus | guessinggame.cpp | #include <stdlib.h>
#include <iostream>
using namespace std;
int main()
{
srand(time(NULL));
int number=rand() % 100;
int guess=-1;
int trycount=0;
while(guess != number && trycount<8)
{
cout<<"Please enter a guess: ";
cin>>guess;
if(guess<number)
cout<<"Too low"<<endl;
if(guess>number)
cout<<"T... | TOOL | 0.856907 | 3.288715 |
bc1d2cfd-b244-4c3c-9e52-c33803d0ac01 | rlom721/binary-tree | src/BinaryTreeNode.cpp | // Implementation file for BinaryTreeNode class
// File name: BinaryTreeNode.cpp
#include "BinaryTreeNode.h" // header file for BinaryTreeNode class
#include <iostream>
using namespace std;
namespace lomboy_a4 {
// Default constructor uses default constructor of DataType to set default value
// for data fi... | ALGO | 0.978532 | 5.252836 |
9e6eb467-1c30-4ec8-b20e-4e553549fcc5 | JahedaShaikh/myFile | DSA/practice/prime.cpp | #include<iostream>
using namespace std;
int main(){
int n, temp, flag=0;
cout<<"enter the number: ";
cin>>n;
temp=n/2;
for(int i=2; i<=n; i++){
if(n%2==0){
cout<<"number is not prime ";
flag=1;
break;
}
}
if(flag==0){
cout<<"number... | ALGO | 0.999657 | 3.106592 |
c7b328c6-4f6e-46c6-9a0e-5e32ff479c75 | Harshit-018/LeetCode | 2389-longest-subsequence-with-limited-sum/2389-longest-subsequence-with-limited-sum.cpp | class Solution {
public:
vector<int> answerQueries(vector<int>& nums, vector<int>& queries) {
int n = nums.size();
int m = queries.size();
sort(nums.begin(),nums.end());
vector<int> psum(n);
vector<int> ans(m);
psum[0]=nums[0];
for(int i=1;i<n;i++){
... | ALGO | 0.999985 | 6.040618 |
995a7e49-cc5f-4394-a286-cd53c5f1ebb6 | devakarkesavan/leetcode_Problems | 1620-check-if-array-pairs-are-divisible-by-k/1620-check-if-array-pairs-are-divisible-by-k.cpp | class Solution {
public:
static bool canArrange(vector<int>& arr, int k) {
const int h=k/2;
vector<int> freq(h+1, 0);
for(int x: arr){
x%=k;
if (x<0) x+=k;
(x>h)?freq[k-x]--:freq[x]++;
}
if (k%2==0 && freq[h]%2!=0) return 0;
int k2... | ALGO | 0.999947 | 5.407489 |
41293d0e-7b12-49b5-af9d-123429145cf1 | abhisheksingh24/random_codes_i_ever_wrote | Aibohphobia.cpp | #include<iostream>
#include<string>
using namespace std;
short int res[6100][6100];
void init(int n){
for(int i = 0; i < n; i++){
for(int j = 0; j < i; j++){
res[i][j] = 0;
}
res[i][i] = 1;
}
}
int max3(int a, int b, int c){
return max(a,max(b,c));
}
void fillRes(str... | ALGO | 0.999834 | 4.000125 |
652ce839-d301-4e5a-96e0-f8beadcfd2e4 | SMiles02/CompetitiveProgramming | Codeforces/CF 1500 - 1599/CF1552/CF1552D.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n,x,y;
cin>>n;
bool ok=0;
int a[n];
for (int i=0;i<n;++i)
{
cin>>a[i];
ok|=(a[i]==0);
}
for (int i=0;i<(1<<n);++i)
{
x=0;
for (int j=0;j<n;++j)
if (i&(1<<j))
... | ALGO | 0.999565 | 4.300813 |
af1840ed-30c8-4578-a6af-f81dd8ae8423 | svn2github/vcglib | apps/sample/trimesh_kdtree/trimesh_kdtree.cpp | /*! \file trimesh_kdtree.cpp
\ingroup code_sample
\brief An example about using the kdtree and meshes
KdTree are one of the Spatial indexing data structure available.
They are tailored for storing point-based structures and performing k-neighbours queries.
In this simple example we simply compute the average distance... | ALGO | 0.99294 | 6.500706 |
7cfdff47-647f-44da-b9cf-b3dd4d4583be | moves-rwth/dft-bdmp | 2022-LambdaMu/StormFigaro/src/storm/abstraction/prism/PrismMenuGameAbstractor.cpp | #include "storm/abstraction/prism/PrismMenuGameAbstractor.h"
#include "storm/abstraction/BottomStateResult.h"
#include "storm/abstraction/GameBddResult.h"
#include "storm/abstraction/ExpressionTranslator.h"
#include "storm/storage/BitVector.h"
#include "storm/storage/prism/Program.h"
#include "storm/storage/dd/DdMa... | ALGO | 0.935491 | 4.034054 |
5aa49c7e-3d9b-4f33-921d-ad060eb8b710 | garvitkataria/Compitative-Programming | Graphs/ConnectedComp2.cpp | #include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
void dfs(int start, vector<int>* edges, int n, unordered_set<int>& visited, unordered_set<int>* component)
{
visited.insert(start);
component->insert(start);
for (int i = 0; i < edges[start].size(); ++i)
{
int v = edges[start][i... | ALGO | 0.999971 | 4.980427 |
0116b1ff-fda9-4006-b9e1-500571ffac38 | zhzh2001/Learning-public | c++实用代码/二分图/二分图test/二分图_邻接表_greedy.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
struct Edge{
#define Mx 400005
int link[Mx],next[Mx],son[Mx],l;
void clear(){l=0;memset(son,0,sizeof(son));}
void addedge(int x,int y){
link[++l]=y;next[l]=son[x];son[x]=l;
}
};
Edge g;
#define N 100005
int visit[N],link[N],greedy[N],n,ans,... | ALGO | 0.999618 | 3.427635 |
7edb0f2d-5cd8-463c-803d-2ec9311a69d0 | epsilonorion/usv_lsa_sim_copy | uwsim_resources/uwsim_bullet/Extras/CDTestFramework/Opcode/OPC_Picking.cpp | /*
* OPCODE - Optimized Collision Detection
* http://www.codercorner.com/Opcode.htm
*
* Copyright (c) 2001-2008 Pierre Terdiman, <EMAIL>
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
P... | ALGO | 0.984524 | 6.507806 |
ae4fd49f-0889-41ff-a87c-5eb4f1797eb5 | DroidTh3ory-xx/platform_frameworks_av | media/libstagefright/codecs/amrnb/common/src/q_plsf.cpp | /*
********************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
* R99 Version 3.2.0
* REL-4 Version 4.0.0
*
*********************************************************... | ALGO | 0.927666 | 5.540532 |
e957db00-bc32-43b7-b013-725d6e69128e | Johniel/contests | atcoder/arc104/B/main.cpp | // atcoder/arc104/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/
#include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
using namespace std;
template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ... | ALGO | 0.999022 | 5.811386 |
ae6a7b41-12ab-41ae-8e24-1d49527d717d | lge88/OpenSees | SRC/analysis/algorithm/eigenAlgo/FrequencyAlgo.cpp | // $Revision: 1.3 $
// $Date: 2009-07-29 21:57:42 $
// $Source: /usr/local/cvs/OpenSees/SRC/analysis/algorithm/eigenAlgo/FrequencyAlgo.cpp,v $
// File: ~/analysis/algorithm/eigenAlgo/FrequencyAlgo.C
//
// Written: Jun Peng
// Created: Mon Feb. 8, 1999
// Revision: A
//
// Description: This file contains the class defi... | ALGO | 0.993956 | 5.624841 |
f4aca22e-b312-49f2-bd47-eeca1298dffc | fnewsome/Algorithms | Problems/RemoveGivenNode.cpp | #include <iostream>
#include <map>
using namespace std;
typedef struct Node{
int data;
Node *next;
}Node;
Node *head = NULL;
int numElements = 0;
// Name: PrintList
//
// Description: Prints the items in the list
//
// Arguments: Root - starting element in the list
//
void PrintList(Node *Root){
Node ... | ALGO | 0.998351 | 5.045941 |
80d2eaec-27fd-47ab-abc7-f59f5f340cf9 | eRgo35/polsl-huffman | lab-01/main.cpp | #include <iostream>
using namespace std;
int main() {
cout << "Hello, world!" << endl << "Please provide how long the loop should work:";
unsigned long int a = 0;
unsigned long int b = 1;
unsigned long long int c, t;
cin >> t;
cout << a << endl << b << endl;
for (int i = 0; i < t; i++) {
c = a +... | ALGO | 0.999331 | 3.497958 |
9c916981-ac36-441d-86d6-69ae7547e87e | GarageGames/Torque3D | Engine/source/terrain/terrCollision.cpp | #include "platform/platform.h"
#include "terrain/terrCollision.h"
#include "terrain/terrData.h"
#include "collision/abstractPolyList.h"
#include "collision/collision.h"
const F32 TerrainThickness = 0.5f;
static const U32 MaxExtent = 256;
#define MAX_FLOAT 1e20f
//-----------------------------------------------------... | ALGO | 0.990762 | 4.901754 |
a8169f39-442d-4a2c-9b26-8eb4d9f7c729 | ZuoYuShen/Leetcode-record | Leetcode-code/647.回文子串_中心扩展.cpp | /*
* @lc app=leetcode.cn id=647 lang=cpp
*
* [647] 回文子串
*/
// @lc code=start
class Solution {
public:
int countSubstrings(string s) {
int n = s.size(), res = 0;
for(int i=0; i<2*n-1; i++){
int L = i/2, R = i/2 + i%2;
while(L >= 0 && R < n && s[L]==s[R]){
... | ALGO | 0.999989 | 6.930444 |
d289a818-0187-47a8-bbed-25d5c89f28fc | jkirkpatrick260/node | deps/icu-small/source/tools/toolutil/package.cpp | #include "unicode/utypes.h"
#include "unicode/putil.h"
#include "unicode/udata.h"
#include "cstring.h"
#include "uarrsort.h"
#include "ucmndata.h"
#include "udataswp.h"
#include "swapimpl.h"
#include "toolutil.h"
#include "package.h"
#include "cmemory.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
stat... | TOOL | 0.870482 | 5.164838 |
cddab968-7fca-4cc8-8eae-fd3e5bec0433 | CppOpen/LearningOpenCV3 | examples/chapter10/example_10-03/example_10-03.cpp | // Example 10-3. Threshold versus adaptive threshold
#include "stdafx.h"
#include "..\..\_opencv.h"
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
if (argc != 7) {
cout << "\nExample 10-3. Threshold versus adaptive threshold\n"
"Usage:\n" << argv[0] << " fixed_thr... | ALGO | 0.958616 | 6.591274 |
15fcdd35-f253-42db-8e55-14e0b78af611 | donbasta/leetcode-submissions | Hard/1489.cpp | struct DSU {
vector<int> par, sz;
DSU (int n) {
par.resize(n);
iota(par.begin(), par.end(), 0);
sz.assign(n, 1);
}
void clear() {
iota(par.begin(), par.end(), 0);
for (auto& e : sz) e = 1;
}
int fpar(int n) {
if (n == par[n]) return n;
retu... | ALGO | 0.999986 | 5.205509 |
04d71233-f55b-4035-b399-cf8a868232da | CPS794/attack-defense | attack-defense.cpp | /*input
1
12 12 1 1 0.85 0.85 4.1 0.6 0.7
1 1 1 1 1 1 1 1 1 1 1 1
*/
#include <bits/stdc++.h>
using namespace std;
const int MAXN=13;
const int MAXM=10;
const int MAXK=3;
const int MOD=1000000007;
const int INF=2139062143;
const double EPS=1e-12;
const int destroyed[13][13] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,1,2,3,... | ALGO | 0.998909 | 3.352013 |
b7a26ed0-d795-491c-b6cb-ea7b6d8db3c0 | MijaTola/Codeforce | 1255A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
int a,b;
cin >> a >> b;
int dif = abs(a - b);
int ans = 0;
ans += dif / 5;
dif %= 5;
ans += dif / 2;
ans += dif % 2;
cout << ans << "\n";... | ALGO | 0.999769 | 4.668388 |
b5501e62-39e6-4521-94e3-203b75e68084 | Pooh1223/Online-Judge | Tioj/Tioj1662.cpp | #include <bits/stdc++.h>
using namespace std;
string s;
int main(){
while(getline(cin,s,'\n')){
char c = ' ';
for(int i = 0;i < s.size();++i){
if(isalpha(s[i])){
c = s[i];
if(s[i] <= 'z' && s[i] >= 'a') putchar(toupper(s[i]));
else putchar(tolower(s[i]));
} else {
putchar(' ');
}
}
cou... | ALGO | 0.99745 | 4.170027 |
485a0fdf-0050-44ed-894a-4534a7a6b712 | doujiangyfl/CPP_Primer_Study | Chapter5/exercise5_24.cpp | #include <iostream>
#include <stdexcept>
int main(void)
{
int i, j;
std::cin >> i >> j;
if (j == 0)
throw std::runtime_error("divisor is 0");
std::cout << i / j << std::endl;
return 0;
} | ALGO | 0.974294 | 4.516567 |
6d460736-0ff9-4ed2-9dee-6479a8d0b752 | olanti-p/BNMT | src/path_info.cpp | #include "path_info.h"
#include <clocale>
#include <cstdlib>
#include "enums.h"
#include "filesystem.h"
#include "language.h"
#include "options.h"
#if defined(_WIN32)
#include <windows.h>
#endif
/**
* Return a locale specific path, or if there is no path for the current
* locale, return the default path.
* @para... | TOOL | 0.878565 | 7.051363 |
5ea247c4-859d-4eb4-88ed-af119cfb6722 | mrcchef/CP | Contest/Google/kick_start/A_2021/K_Goodness_String.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(0) ; cout.tie(0);
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<=n;i++)
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define mii map<ll,ll>
#define p... | ALGO | 0.999884 | 4.292697 |
108b9764-358c-4513-a6b2-77c799abbca3 | inho9606/Leetcode | Range_Addition_II.cpp | // https://leetcode.com/problems/range-addition-ii/submissions/
// Problem: Given ops, find the minimum rectangle.
// I. Initialize the rectangle with given width and hight m, n.
// II. Find the minimum width and hight among the given rectangle ops with for loop.
// time: O(n) space: O(1) n is the size of ops.
// Runti... | ALGO | 0.999204 | 6.452576 |
b90398d9-5161-4fab-83b4-b7bc10a02dad | AlperTheKing/Computations | find_numbers.cpp | #include <iostream>
#include <vector>
#include <thread>
#include <mutex>
std::mutex print_mutex;
// Function to calculate the sum of digits of a number
int sum_of_digits(int num) {
int sum = 0;
while (num > 0) {
sum += num % 10;
num /= 10;
}
return sum;
}
// Function to check if a num... | ALGO | 0.999458 | 6.69693 |
e7c4583e-734d-40c9-b8b8-e997b5dec5be | nishant-nimbare/cp | codeforces/302B.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin>>n>>m;
// cout<<"n "<<n<<" m "<<m<<'\n';
int arr[n+1];
arr[0]=0;
int c,t;
for(size_t i=1; i<=n; i++){
cin>>c>>t;
... | ALGO | 0.999913 | 3.996959 |
bc49cb4e-ecff-4693-a22a-0a1cef8c3425 | PalRishikesh/c-plus-basic | LoveBabbar/array/problems/sort_0_1.cpp | #include<iostream>
using namespace std;
void printArray(int arr[], int n){
for (int i = 0; i < n; i++)
{
cout << arr[i]<< " ";
}
cout <<endl;
}
void sortOne(int arr[], int n){
int left = 0, right = n-1;
while(left < right){
while (arr[left] == 0)
{
... | ALGO | 0.999907 | 4.73475 |
772fd9a0-a245-456d-ad8f-515be50002a0 | LyTruongsinh/DSA | Data_Structures/Tree/General_Tree/Populating_Next_Right_Pointer_In_Each_Node2.cpp | #include <algorithm>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Node
{
public:
int val;
Node *left;
Node *right;
Node *next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), ... | ALGO | 0.999971 | 4.956362 |
e4fbce8b-dc65-4ef2-b3d9-7bd573d852bc | dhruvkuchhal03/DynamicProgramming-Practice-AdityaVerma | 22_Longest_Common_Substring.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
int longestCommonSubstr(string S1, string S2, int n, int m)
{
// your code here
vector<vector<int>> t(n + 1, vector<int>(m + 1, -1));
for (int i = 0; i <= n; i++)
... | ALGO | 0.999965 | 6.188099 |
0156cebb-b1ea-44de-a6b0-ee2924b31f33 | Arman-2107046/Dynamic_Programming | ninja_training2.cpp | #include <bits/stdc++.h>
using namespace std; // memoization solution
int f(int day, int last, vector<vector<int>> &points,vector<vector<int>>&dp)
{
if (day == 0)
{
int maxi = 0;
for (int i = 0; i < 3; i++)
{
if (i != last)
{
maxi = max(maxi, poin... | ALGO | 0.999907 | 5.473702 |
1f69cfcb-3534-485c-84b8-b23a982b6bd6 | IcEy-999/MyUESource | Engine/Plugins/Experimental/ControlRig/Source/ControlRig/Private/Units/Highlevel/Hierarchy/RigUnit_SpringIK.cpp | #include "Units/Highlevel/Hierarchy/RigUnit_SpringIK.h"
#include "Units/RigUnitContext.h"
FRigUnit_SpringIK_Execute()
{
DECLARE_SCOPE_HIERARCHICAL_COUNTER_RIGUNIT()
FRigBoneHierarchy* Hierarchy = ExecuteContext.GetBones();
if (Hierarchy == nullptr)
{
return;
}
TArray<FCachedRigElement>& CachedBones = WorkD... | ALGO | 0.929534 | 5.769396 |
b2c4e4bb-cd8d-42cf-b90b-6c1ed31ff64f | ishandutta2007/codeforces | andreikkaa/normal/641/C.cpp | /*
* C++11 code template for contests.
* @author: Andrey Kalendarov
* @e-mail: <EMAIL>
*/
/*______ DEFINES _______*/
#define _SCL_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
//#define ANDREIKKAA_ALLOCATOR
//#define ANDREIKKAA_UNSAFE_VECTOR
#ifdef ANDREIKKAA_UNSAFE_VECTOR
#define vec vector
#endif // ANDREIKKA... | ALGO | 0.999932 | 3.97927 |
a243efc3-95a7-42be-a5e4-2cacbddec71f | profetaRecursivo/proyecto2025 | matematicas/aplicarKpermutaciones.cpp | #include <iostream>
#include <vector>
using namespace std;
#define vi vector<int>
vi applyperm(vi& secuencia, vi& permutacion) {
vi ans(secuencia.size());
for (int i = 0; i < secuencia.size(); i++) {
ans[i] = secuencia[permutacion[i]];
}
return ans;
}
vi permutar(vi secuencia, vi permutacion,... | ALGO | 0.999975 | 4.102149 |
9dad28ee-b2f0-4ca7-8723-ca1af788e33b | jiry17/AutoLifter | run/runnable/Relish/segment-tree/min-neg.cpp | #include <cassert>
#include <cstdio>
#include <sys/time.h>
double difftime(timeval start, timeval end) {
long long second_diff = end.tv_sec - start.tv_sec;
if (second_diff < 0) second_diff += 24 * 3600;
long long u_diff = end.tv_usec - start.tv_usec;
return second_diff + u_diff * 1e-6;
}
int min(int a, ... | ALGO | 0.999627 | 3.65241 |
60f1b558-79a6-4a41-a0e4-482f74d55947 | sikha22/PDA_Problems | PDA/Bheem Wants Ladoos.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node* left;
Node* right;
};
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
return temp;
}
Node* buildTree(string str)
{
//... | ALGO | 0.999882 | 5.611012 |
3345a756-39d5-4e58-8e9c-2812c8ee32f0 | DANIS-4512/dsa | practice/practice07/10/insertionsort.cpp | #include <iostream>
using namespace std;
void insertionSort(int arr[],int n){
for(int i=1;i<n;i++){
int temp=arr[i];
for(int j=i-1;j>=0;j++){
if (arr[j+1]<arr[j])
{
arr[j+1]=temp;
}
else{
break;
}
... | ALGO | 0.999919 | 4.687307 |
cd5c42b8-d2fc-41fb-a1cb-8ecac16c420a | waura/frayer | 3rdparty/OpenCV-2.3.0/modules/contrib/src/polyfit.cpp | // This original code was written by
// Onkar Raut
// Graduate Student,
// University of North Carolina at Charlotte
#include "precomp.hpp"
void cv::polyfit(const Mat& src_x, const Mat& src_y, Mat& dst, int order)
{
CV_Assert((src_x.rows>0)&&(src_y.rows>0)&&(src_x.cols==1)&&(src_y.cols==1)
&&(dst.c... | ALGO | 0.998021 | 4.057002 |
3604cd1a-1cdb-4d8b-9649-42770874d7e2 | Omar-Sharif/Competitive-Programming | UVA ONLINE JUDGE/11559 Event Planning.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,b,h,w;
while(cin>>n>>b>>h>>w)
{
long long sum=LONG_MAX,m,flag=0,flag1,i,j,k;
for(j=1;j<=h;j++){
long long p;
cin>>p;
flag1=0;
long long ara[w],i;
for(i=0;i<w;i... | ALGO | 0.999874 | 3.3852 |
5a31474e-3e78-4108-966e-a4dbc88d6512 | ishandutta2007/codeforces | mateusz/normal/675/C.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n;
long long tab[N];
map<long long, int> M;
int main() {
cin >> n;
long long sum = 0;
int mostFrequent = 0;
int times = -1;
for (int i = 1; i <= n; i++) {
cin >> tab[i];
sum += tab[i];
if (!M.count(s... | ALGO | 0.999971 | 3.685055 |
7fcc6b19-31d8-4359-a1a2-13a06100055c | KazuhoSAKAOKA/leetcode | leetcode_Q1636/leetcode_Q1636.cpp | // leetcode_Q1636.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include "./../utility/leetcode_testcase_helper.h"
using namespace std;
class Solution {
public:
vector<int> frequencySort(vector<int>& nums) {
... | ALGO | 0.999991 | 6.136087 |
76654667-f516-4c4b-8924-a5c48f869405 | itoral/vkdf | framework/vkdf-box.cpp | #include "vkdf-box.hpp"
#include "vkdf-util.hpp"
glm::vec3
vkdf_box_get_vertex(const VkdfBox *box, uint32_t index)
{
switch (index) {
case 0:
return box->center + glm::vec3(box->w, box->h, box->d);
case 1:
return box->center + glm::vec3(-box->w, box->h, box->d);
case 2:
return box->center... | ALGO | 0.95323 | 7.280357 |
567c4dd9-9117-4439-ae53-7dee29e5ddd2 | kactasar/adventofcode | 2021/day1/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
int main(){
std::fstream input_file("input");
std::vector<int> input_vector;
if(!input_file){
std::cout << "Error: input file not found.\n";
return 1;
}
while(!input_file.eof()){
int tmp;
input_file >> tmp;
input_vector.push_back(tmp);
}
i... | ALGO | 0.99902 | 3.985267 |
c66b829d-c683-413e-b36a-403831fb211b | unclezhou486/ACM-Solutions | Mix/2024/ABC344/D_String_Bags.cpp | #include <bits/stdc++.h>
using namespace std;
const int N=110;
int dp[N][N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
memset(dp,0x3f,sizeof dp);
dp[0][0]=0;
string t;
cin>>t;
t='0'+t;
int lent=t.size();
int n;
cin>>n;
int m;
for(int ii=1;ii<=n;ii++... | ALGO | 0.999869 | 4.028378 |
3c47fb67-151b-4d9d-95b2-9e07de154f48 | ugozapad/solunar_engine | externals/glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if (static_cast<unsigned>(n) > 63) { std::printf("r... | ALGO | 0.9993 | 4.846448 |
f3a6152d-8a9b-4a15-bcac-d927f3e4389a | sekrittt/vuz | code/cpp/arrays-7/SRS-04.12.2023.cpp | #include <iostream>
using namespace std;
void shellSort(int *a, int n)
{
int h = 1;
while (h < n / 3)
{
h = 3 * h + 1;
}
while (h >= 1)
{
for (int i = h; i < n; i++)
{
for (int j = i; j >= h && *(a + j) < *(a + j - h); j -= h)
{
i... | ALGO | 0.999757 | 3.963795 |
576052e4-5d2c-4915-820e-7750f370944c | seongho-joo/PS_study | BOJ/2194.cpp | #include <iostream>
#include <queue>
using namespace std;
typedef pair<int, int> pii;
int N, M, K, A, B;
bool map[500][500], visited[500][500];
pii s, e;
int dy[] = {-1, 1, 0, 0};
int dx[] = {0, 0, -1, 1};
bool collisionCheck(int y, int x) {
// 범위에서 벗어남
if(y < 0 || x < 0 || y + A - 1 >= N || x + B - 1 >= M) ... | ALGO | 0.999931 | 4.807408 |
5c20a1a8-0b21-41a1-919f-36c25a7743a3 | PrinceJain1608/DSA | Graph/graph_creation.cpp | #include<iostream>
#include<unordered_map>
#include<list>
using namespace std;
class graph
{
public:
unordered_map<int,list<int>> adj;
void addEdge(int u,int v,bool direction){
adj[u].push_back(v);
if(direction==0){
adj[v].push_back(u);
}
}
void printAdjList(){
for(auto i: adj){
co... | ALGO | 0.999834 | 5.020587 |
72d876b6-a79a-45c0-8843-735c6b9ca0e5 | thalesonunes/uemg-trabalhos | Algorítmo e Estrutura de Dados II/Exercícios de Aula/2019-09-02/numeroPerfeito.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
bool numPerfeito(int X)
{
int soma=0;
for(int i=1; i<X; i++)
{
if(X % i == 0)
soma = soma + i;
}
if (X == soma)
{
return true;
}
return false;
}
int main()
{
setlocale(LC_ALL, "portuguese"... | ALGO | 0.998988 | 4.457221 |
6a572b2a-979a-4de1-8cb7-b4131ea21b3a | 1804054Miraz/Codeforces-solutions | A. Sum of Odd Integers.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k,test;
scanf("%d",&test);
while(test--){
scanf("%d%d",&n,&k);
if(n%2==0){
if(k%2==0 && k<=sqrt(n)){
printf("YES\n");
}
else
{
printf("NO\n");
}
}
else
{
if(k%2==1 && k<=sqrt(n)){
printf("YES\n");
}
else ... | ALGO | 0.999698 | 4.155381 |
332ac865-c297-499e-9596-3a8b7081a700 | Ayush-865/BinarySearch | Bounds/higherBound.cpp | /*
Time Complexity in case of sorted array: O(n)
Time Complexity in case of unsorted array: O(n)+O(nlogn)
Space Complexity: O(1)
C++ equivalent function
int idx=upper_bound(arr.begin(), arr.end(), target)-arr.begin()
*/
#include <bits/stdc++.h>
using namespace std;
int higherBound(int low, int high, vector<int> &arr,... | ALGO | 0.999924 | 6.163995 |
bd9db87e-d9c2-4749-a3a9-58d46809cb4c | niteshim0/DSA | 12_Binary_Tree/06_Imporant_Ques/33_Flatten_Binary_Tree_to_Linked_LIst.cpp | // Approach I
class Solution {
public:
TreeNode* prev = NULL;
void flatten(TreeNode* root) {
if(root == NULL) return;
flatten(root->right);
flatten(root->left);
root->right = prev;
root->left = NULL;
prev = root;
}
};
// Time Complexity : O(N)
// Space Comple... | ALGO | 0.999992 | 6.291171 |
de101e62-a99a-4d8b-b0bf-b70341d3d4ae | Mikhailichenko/AnastasiyaMi | tree.cpp | #include <iostream>
#include <queue>
using namespace std;
typedef struct Node{
int data;
Node* left=NULL;
Node* right=NULL;
}Node;
class BinTree{
Node* root;
public:
Node* get_root(){
return root;
}
BinTree(int a){
Node* temp=new Node;
temp->data=a;
root... | ALGO | 0.999958 | 3.662971 |
6cad3e96-6bac-42e6-aace-a49233328be0 | Stromblak/Programacion-Competitiva | Taller 2/l1/488/488.cpp | #include <bits/stdc++.h>
using namespace std;
//Pablo Zapata
//Solucion Propia
void onda(int a){
for(int i=1; i<=a; i++){
for(int j=0; j<i; j++) cout << i;
cout << endl;
}
for(int i=a-1; i>0; i--){
for(int j=0; j<i; j++) cout << i;
cout << endl;
}
}
int main(){
int n;
cin >> n;
while(n--){
int a, ... | ALGO | 0.999698 | 4.131379 |
5a64d0c5-fcc3-4737-8e1b-1a9856e71466 | Yuki-Wada/competitive_programming | cpp/src/at_coder/abc282_e.cpp | // include
//------------------------------------------
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <s... | ALGO | 0.999969 | 4.849118 |
c91210a4-e2bc-4a1c-95c1-e10c63a44cde | phitronio/Batch-4-Introduction-to-cpp-for-DSA | Module 7/custom_sort.cpp | #include <bits/stdc++.h>
using namespace std;
class Freq
{
public:
char value;
int count;
};
bool cmp(Freq a, Freq b)
{
if (a.count == b.count)
{
return a.value < b.value;
}
else
{
return a.count > b.count;
}
}
int main()
{
string s;
cin >> s;
Freq f[26];
... | ALGO | 0.999975 | 4.315738 |
ed75e6ec-4a0c-4e61-96eb-1bcabcdd4d86 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/BlackJack_20210108193204.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999967 | 3.637586 |
ea3fcc54-5e9c-45ab-af6d-7bc4dfcc0144 | checkoutb/LeetCodeCCpp | daily_challenge/2022/LT_2022-06-17_968._Binary_Tree_Cameras.cpp |
#include "../../header/myheader.h"
class LT
{
public:
// D D
//If we set a camera at the leaf, the camera can cover the leafand its parent.
// If we set a camera at its parent, the camera can cover the leaf, its parentand its sibling.
//
// We can see that the second plan is always better ... | ALGO | 0.999764 | 6.049819 |
30f77ead-1fbc-426a-b41e-a7f0ef30f5aa | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Mixtral/top0-100/maximum-value-sum-by-placing-three-rooks-ii-Solution.maximumValueSum/177821_DoS.cpp | QString IRCView::openTags(TextHtmlData* data, int from)
{
QString ret, tag;
int i = from;
for ( ; i < data->openHtmlTags.count(); ++i)
{
tag = data->openHtmlTags.at(i);
if (data->reverse)
{
ret += fontColorOpenTag(Preferences::self()->color(Preferen... | TOOL | 0.864986 | 4.15005 |
e2257ff6-d77e-462e-8462-aea706527288 | syahn/Problem-solving | acmicpc.net/find_fraction.cpp | // # Reflection
// Not that hard.
// # Problem
// 시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
// 2 초 128 MB 2689 1460 1288 55.517%
//
// 문제
// 무한히 큰 배열에 다음과 같이 분수들을 적혀있다.
//
// 1/1 1/2 1/3 1/4 1/5 …
// 2/1 2/2 2/3 2/4 … …
// 3/1 3/2 3/3 … … …
// 4/1 4/2 … … … …
// 5/1 … … … … …
// … … … … … …
// 이와 같이 나열된 분수들을 1/1 -> 1/2 -> 2/1... | ALGO | 0.999869 | 5.196249 |
0b08eb68-6829-412a-a917-5749c9c5f609 | javagovindsharma/leetscode | solution/3100-3199/3145.Find Products of Elements of Big Array/Solution.cpp | using ll = long long;
const int m = 50;
ll cnt[m + 1];
ll s[m + 1];
ll p = 1;
auto init = [] {
cnt[0] = 0;
s[0] = 0;
for (int i = 1; i <= m; ++i) {
cnt[i] = cnt[i - 1] * 2 + p;
s[i] = s[i - 1] * 2 + p * (i - 1);
p *= 2;
}
return 0;
}();
pair<ll, ll> numIdxAndSum(ll x) {
... | ALGO | 0.999957 | 4.511467 |
f2846472-4b75-4741-a318-ab7781c42851 | ProjectGhostOS/frameworks_av | media/module/codecs/amrnb/dec/src/dec_lag6.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/dec_lag6.c
Functions: Dec_lag6
Date: 01/31/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description:
(1) Updated to accept new parameter... | ALGO | 0.999415 | 6.897988 |
f380dbff-e2fa-4227-906a-f4b54b835578 | deepinsight230/LeetCode | 71-simplify-path/71-simplify-path.cpp | class Solution {
public:
string simplifyPath(string path) {
stack<string> st;
string res;
for(int i = 0; i<path.size(); ++i){
if(path[i] == '/') continue;
string temp;
while(i < path.size() && path[i] != '/'){
temp += path[i];
... | ALGO | 0.999898 | 5.877517 |
be105d0d-af09-4cd7-b0c8-bd6dbec80138 | ParkGeongi/Howsfit | Fastapi/openpose/src/openpose/utilities/fileSystem.cpp | #include <openpose/utilities/fileSystem.hpp>
#include <algorithm> // std::replace
#include <cctype> // std::isdigit
#include <cstdio> // std::fopen
#include <cstring> // std::strncmp
#ifdef _WIN32
#include <direct.h> // _mkdir
#include <windows.h> // DWORD, GetFileAttributesA
#elif defined __unix__ || defined _... | TOOL | 0.910999 | 5.506975 |
52132d7e-af83-4ce0-b827-371acd69c07f | EslamKhder/problem-solving-with-c- | sheets/Sheet #8 (General easy)/M. The New Year Meeting Friends.cpp | #include<bits/stdc++.h>
using namespace std;
int main() //
{
int num1,num2,num3; // 7 1 4 7 - 1 = 6
cin>>num1>>num2>>num3;
cout<<max(max(num1,num2),num3) - min(min(num1,num2),num3);
}
| ALGO | 0.999989 | 3.828679 |
decfe867-17c2-40c5-afd0-2ae6ee7d8899 | SirKeka/Tic-Tac-Toe | Source.cpp | //
// "-"
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
//
const char X = 'X';
const char O = 'O';
const char EMPTY = ' ';
const char TIE = 'T';
const char NO_ONE = 'N';
void instructions()
{
std::cout << " - : -.\n";
std::cout << "-- \n\n";
std::cout << " , 0 ... | ALGO | 0.992796 | 4.690242 |
a4c93282-6a37-4320-a0bb-a7d59b53c56a | n01e0/pRETzel_logic | libcxx/test/std/algorithms/alg.modifying.operations/alg.generate/generate.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, Callable Generator>
// requires OutputIterator<Iter, Generator::result_type>
// && CopyConstructible<Generator>
// constexpr void // constexpr after c++17
// generate(Iter first, Iter last, Generator gen);
#include <algorithm>
#include <cassert>
#in... | TEST | 0.855605 | 6.39654 |
566e1f56-3ec7-4388-b2e4-c1e1a7840be2 | Priyo002/DSA | Decode-DSA-C++/Classes/Week23(Graph)/Class7/DSU.cpp | #include<bits/stdc++.h>
using namespace std;
void init() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("inputf.in", "r", stdin);
freopen("outputf.in", "w", stdout);
#endif
}
int find(vector<int>&parent, int x) {
//This method returns which group/cluster x belongs to
if (pare... | ALGO | 0.999961 | 5.393538 |
a306b253-414d-4fa7-88b2-4001e07fa50f | MicroYY/InfiniTAM | ITMLib/Trackers/CPU/libviso2/reconstruction.cpp | #include "reconstruction.h"
#include <fstream>
using namespace std;
Reconstruction::Reconstruction () {
K = Matrix::eye(3);
// First transformation matrix
Tr_total.push_back(Matrix::eye(4));
// First inverse transformation matrix
Tr_inv_total.push_back(Matrix::eye(4));
}
Reconstruction::~Reconstruction (... | ALGO | 0.998371 | 4.13434 |
bcb26a9f-2d01-4922-b537-d9a0132c6067 | Nooruleman54/Lab-Task-6-to-10 | Qno 6.cpp | //find max of three numbers.
#include<iostream>
using namespace std;
int main() {
int a,b,c;
cout<<"Enter the value of a"<<endl;
cin>>a;
cout<<"Enter the value of b"<<endl;
cin>>b;
cout<<"Enter the value of c"<<endl;
cin>>c;
if(a>b) {
if(a>c)
cout<<"a is the greatest number"<<endl;
else
cout<<"c is the gre... | ALGO | 0.999583 | 3.53811 |
caf0ec37-d83b-4631-b6f5-8fd884a5deb0 | tomatoisblue/atcoder | APG4b/ex11.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int N, A;
cin >> N;
cin >> A;
for(int i=0; i<N; i++){
string op;
int B;
cin >> op >> B;
if(op=="+"){
A += B;
}else if(op=="-"){
A -= B;
}else if(op=="*"){
A *= B;
}else{
if(B==0){
cout << "error... | ALGO | 0.999739 | 3.726636 |
aaad898e-33d1-4cb4-be3c-d1d1febaedc7 | Rahat10101/Problem-Solving-CodeForces | 1389A - LCM Problem.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int l,r;
cin>>l>>r;
if(2 * l > r)
{
cout<<"-1 -1 \n";
}
else
{
cout<<l<<" "<<l*2<<endl;
}
}
}
| ALGO | 0.999349 | 4.206439 |
615ad42e-ade6-4872-964d-f4c9a6fbb706 | tiagoanoliveira/Programacao | Modelo/Teste_2/print_grades.cpp | #include <iostream>
#include <iomanip>
#include <map>
#include <list>
#include <string>
#include <vector>
#include <algorithm>
void print_grades(const std::map<std::string, std::list<int>>& grades) {
// Vetor auxiliar para guardar pares {nome, média}
std::vector<std::pair<std::string, double> > student_average... | ALGO | 0.988357 | 5.750278 |
3b88760a-fc47-41df-bbb6-e36c6fde1199 | lzcwr/ACM-ICPC-Code | Data-Structure/hdu 4010 Query on The Trees LCT.cpp | #include <bits/stdc++.h>
#ifdef __WINDOWS_
#include <windows.h>
#endif
using namespace std;
#define showtime printf("time = %.15f\n", clock() / (double)CLOCKS_PER_SEC);
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define root 1, n, 1
const int maxn = 100010;
const int maxm = 100005;
const int mo... | ALGO | 0.999887 | 4.017302 |
d42faa32-6a49-4e9f-97fb-a97b7f60e9c5 | manchalaharikesh/CODES-POTDs | LeetCode/229. Majority Element II.cpp | // DATE: 05-OCT-2023
// Question URL: https://leetcode.com/problems/majority-element-ii/
// Question: 229. Majority Element II
// Description: Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times.
// Approach: 1. Use hashmap to store count.
// 2. Use sorting then use two p... | ALGO | 0.999993 | 6.026447 |
52f7e22f-20ac-4959-a007-97905536cfaf | mchzh/LeetCodeForQuote | DP/312. Burst Balloons/312. Burst Balloons.cpp | class Solution {
public:
int maxCoins(vector<int>& nums) {
int n = nums.size();
nums.insert(nums.begin(), 1);
nums.push_back(1);
auto dp = vector<vector<int>>(n+2, vector<int>(n+2, 0));
// first loop to check len
for (int len = 1; len <= n; len++) {
... | ALGO | 0.999987 | 5.446536 |
1a69888e-1587-48ac-8553-3349f2c8ce88 | Brandon-Erazo/Programacion-1-UTN-FRGP | GUIA 3/EJERCICIO 29 - TP3 (CICLOS EXACTOS).cpp | ///Ejercicio: 29
///Autor: Brandon Erazo
///Fecha: 02/08/2024
///Comentario:
///LIBRERIAS
# include <iostream>
/// iostream es un componente de la biblioteca estndar (STL)
///del lenguaje de programacin C++ que es utilizado para operaciones de entrada/salida.
# include <cstdlib>
///Destruye objetos con almacenamiento ... | ALGO | 0.999446 | 3.519585 |
faec0d6f-bd6e-45c6-96e3-90191d6a8f2e | bharathv005/Cpp | b.find_peak_element.cpp | #include <bits/stdc++.h>
using namespace std;
int findPeakElement(int arr[], int n) {
if (n == 1)
return 0;
if (arr[0] > arr[1])
return 0;
if (arr[n-1] > arr[n-2])
return n-1;
int low = 1;
int high = n-2;
while (low <= high) {
int mid = (low + high) / 2;
... | ALGO | 0.999889 | 5.1476 |
79cdc05e-46a1-451a-9667-8e81e0469a3f | davidditao/CppLearning | DDthreadTest.cpp | #include <iostream>
#include <thread> // 线程库
void func01(int a) {
std::cout << "Hello sub thread!\n";
// 休眠 50 ms, chrono 是 C++11 中的时间库
std::this_thread::sleep_for(std::chrono::microseconds(50));
}
/*---------------------------- 一、创建线程 --------------------------------*/
void test01() {
int a = 0;
... | TOOL | 0.9633 | 4.330366 |
702a96c8-6d5e-4ffd-a03b-218f9817a327 | ishandutta2007/codeforces | savinov/normal/736/B.cpp | #include <bits/stdc++.h>
#define clr(x) memset((x), 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; --i)
#define for1(i, n) for(int i ... | ALGO | 0.999971 | 3.863567 |
1c1311bb-ed81-4720-b4cc-085f6e9e3209 | dae-hany/c-Practice | 타입 캐스팅_ const_cast.cpp | #include <iostream>
using namespace std;
int main() {
char str[] = "Hello World!";
const char* ptr = str; // ptr Ű const
// ptr[0] = 'A';// ! const ptr Ű
//
char* c = const_cast<char*>(ptr); // ptr const Ӽ
c[0] = 'A'; //
cout << c << endl; // Aello World!
} | TOOL | 0.974839 | 3.522123 |
b8850546-a750-4ff2-aae7-bc4e1f8cc85f | ishandutta2007/codeforces | rxdoi/normal/245/C.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
const int Maxn=100+19;
int Ans,n,A[Maxn],B[Maxn];
int main()
{
scanf("%d",&n);
for (int i=1;i<=n;i++) scanf("%d",&A[i]);
for (int i=1;2*i+1<=n;i++) B[i]=B[2*i+1]=B[2*i]=1;
for (int i=1;i<=n;i++)
if (!B[i]&&A[i]) {puts("-1");return 0;}
for (int i=n;i>=1;... | ALGO | 0.999987 | 3.431603 |
e152c396-6ea6-41e9-886f-d1a69de6746b | Roooooobin/Leetcode-Problems | Check If N and Its Double Exist/main.cpp | #include <bits/stdc++.h>
using namespace std;
// leetcode-1346 by Robin
bool checkIfExist(vector<int>& arr) {
set<int> s;
for (int x: arr) {
if (s.count(2 * x) || (x % 2 == 0 && s.count(x / 2))) return true;
s.insert(x);
}
return false;
}
int main() {
std::cout << "Hello, World!" <... | ALGO | 0.990072 | 5.600585 |
7afeb34c-0262-4d45-b85a-ab6255786f60 | ishandutta2007/codeforces | dxqwq/normal/1615/B.cpp | // Problem: B. And It's Non-Zero
// Contest: Codeforces Global Round 18
// URL: https://codeforces.com/contest/1615/problem/B
// Memory Limit: 256 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
//And in that light,I find deliverance.
#include<bits/stdc++.h>
// #pragma GCC optimize("Ofast"... | ALGO | 0.999959 | 4.544703 |
6b705d31-62d3-42a8-9d64-9aa56090ec05 | SPHewitt/fsi-workshop | src/FluidSolidInteraction/numerics/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(2);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,
1;
//add v to each column of m
mat.colwise() += v;
std::cout << "Broadcasting result: " << std::endl;... | ALGO | 0.994423 | 4.136906 |
bf932942-9a4f-4ed2-9be6-0f13a75e6126 | ishandutta2007/codeforces | crtsir/normal/1263/B.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,cnt=0;
string a;
vector<string>v;
cin>>n;
map<string,bool>find;
for(int i=0;i<n;i++)cin>>a,v.push_back(a),find[a]=1;
map<string,int>mp;
mp[v[0]]=1;
vector<string>ans;
for(int i=1;i<n;i++)
if(mp[v[i]]){
... | ALGO | 0.999958 | 3.691299 |
f2fd7664-df77-445e-9728-1916b2b67972 | AtulSingh027/Legacy-DSA | DSA_COCHING/array.c++/InterSaction2Array.cpp | #include <iostream>
using namespace std;
int Intersaction2array(int arr1[], int len1, int arr2[], int len2)
{
int flag = 0;
for (int i = 0; i < len1; i++)
{
if (arr1[i] != -1)
{
for (int j = 0; j < len2; j++)
{
if (... | ALGO | 0.999498 | 4.559993 |
f17cb8da-ffd2-42f5-8a8c-063add3f969c | GraiemBell/DeepCamera | src/face_detection/assets/detection/face_detector/3rdparty/ncnn/src/layer/arm/prelu_arm.cpp | #include "prelu_arm.h"
#if __ARM_NEON
#include <arm_neon.h>
#endif // __ARM_NEON
namespace ncnn {
DEFINE_LAYER_CREATOR(PReLU_arm)
int PReLU_arm::forward_inplace(Mat& bottom_top_blob) const
{
int dims = bottom_top_blob.dims;
if (dims != 3)
return PReLU::forward_inplace(bottom_top_blob);
int w = ... | ALGO | 0.878506 | 6.879412 |
8dd3895a-0582-4752-a447-58dd704809e5 | weiweimonster/CS184 | p4-clothsim-sp22-heathcliff-4/ext/nanogui/ext/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.933546 | 3.642258 |
8924c955-892e-4947-8df5-f01cc335738d | nicecapj/crossplatfromMmorpgServer | ThirdParty/boost_1_61_0/libs/coroutine/example/asymmetric/same_fringe.cpp | #include <cstddef>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <string>
#include <utility>
#include <boost/bind.hpp>
#include <boost/range.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/coroutine/all.hpp>
struct node
{
typedef boost::shared_ptr< node > ptr_t;
// Each tree nod... | ALGO | 0.965407 | 6.88511 |
cf3fe40f-a09e-452a-a619-a94ab6b0fd57 | Sabuj-Kumar/MyCodes | Contest/Vjugde/trainner UAP Individual Long Contest 03/B - SuperSale.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
int person;
int wight[ 1010 ],price[ 1010 ];
int dp[ 1010 ][ 31 ];
int amount(int i,int w){
if(i == n) return 0;
if(dp[ i ][ w ] != -1) return dp[ i ][ w ];
if(w < wight[ i ]) return dp[ i ][ w ] = amount(i+1,w);
else return dp[ i ][ w ] = max(... | ALGO | 0.999942 | 3.784442 |
88f232c2-870d-4052-a7db-db555988522c | Kcode15/Leet | 2704-maximum-difference-by-remapping-a-digit/2704-maximum-difference-by-remapping-a-digit.cpp | class Solution {
public:
int minMaxDifference(int num) {
string str = to_string(num);
string ma = "";
string mi = "";
int n = str.size();
char ele = ' ';
// Step 1: Find first non-9 digit for max replacement
for(int i=0;i<n;i++){
if(str[i] != '9'){... | ALGO | 0.999944 | 6.201138 |
eb568e98-9627-4339-9933-e1426b424510 | shankerabhigyan/dsa-code | Codeforces/937/c.cpp | // https://codeforces.com/contest/1950/problem/C
#include<bits/stdc++.h>
using namespace std;
string get12HourFormat(string &time){
int h = stoi(time.substr(0, 2));
string m = time.substr(3, 2);
if(h<13 && h>0){
if(h<12){
return time + " AM";
}
else{
return t... | ALGO | 0.993399 | 5.685134 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.