uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2da8bf92-b008-4c91-a707-e6777e876720 | Pterosaur/algorithm_practice | leetcode/327. Count of Range Sum/327. Count of Range Sum/327. Count of Range Sum.cpp | // 327. Count of Range Sum.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
//327. Count of Range Sum
//Given an integer array nums, return the number of range sums that lie in [lower, upper] inclusive.
//Range sum S(i, j) is defined as the sum of the elements in nums between indices ... | ALGO | 0.999837 | 5.943635 |
91487420-8d73-415f-9bca-d5d8808e0779 | EmptyDust/Algorithm-Codes-and-writeups | codes/-0x30_competition/-0x33_codeforces/924/B.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int MAXN = 1e6 + 10;
void solve() {
int n;cin >> n;
vector<int> nums(n);
for (int i = 0;i < n;++i)cin >> nums[i];
sort(nums.begin(), nums.end());
nums.erase(unique(nums.begin(), nums.end()), nums.end());
int ans = 0;... | ALGO | 0.999805 | 5.405186 |
d19adaaf-b03b-4edf-b1f9-7eabd870bddb | The-No-Hands-company/RudeBase3D | third_party/libigl/libigl-2.5.0/tests/include/igl/quadprog.cpp | #include <test_common.h>
#include <igl/quadprog.h>
#include <igl/EPS.h>
TEST_CASE("quadprog: box3", "[igl]" )
{
{
Eigen::Matrix3d H = (Eigen::Matrix3d(3,3)<<
0.240548455386281, 0.237314308102107, 0.0436993831501944,
0.237314308102107, 0.326254049041854,-0.00021896091952631,
0.0436993... | ALGO | 0.995816 | 6.168975 |
63239f9e-d89e-4027-90bc-9173fced3321 | MaheshSharan/LeetCode_Automation | solutions/0000-0099/0047.Permutations II/Solution.cpp | class Solution {
public:
vector<vector<int>> permuteUnique(vector<int>& nums) {
sort(nums.begin(), nums.end());
int n = nums.size();
vector<vector<int>> ans;
vector<int> t(n);
vector<bool> vis(n);
function<void(int)> dfs = [&](int i) {
if (i == n) {
... | ALGO | 0.999991 | 6.543767 |
4c63e814-9657-43d6-bd89-70ea45f104ee | pall-pandiyan/cpp-programs | continueStatement.cpp | #include<iostream>
using namespace std;
int main() {
for( int i=0; i<=20; i++) {
if(i%2) {
continue;
}
std::cout<<i<<" ";
}
return 0;
}
// the output will be...
//
// 0 2 4 6 8 10 12 14 16 18 20 | ALGO | 0.996133 | 3.759793 |
60b35445-b8da-4ea8-a628-ab1eedf80cd7 | sungzzuu/2020_Momodora_RUTM | 모모도라2/Momodora_RUTM/Momodora_RUTM/CollisionMgr.cpp | #include "stdafx.h"
#include "CollisionMgr.h"
#include "Obj.h"
#include "RectMgr.h"
#include "MyRect.h"
#include "LineMgr.h"
#include "Player.h"
#include "ObjMgr.h"
CCollisionMgr::CCollisionMgr()
{
}
CCollisionMgr::~CCollisionMgr()
{
}
bool CCollisionMgr::Collision_RectEx(list<CObj*>& _Dst, list<CObj*>& _Src)
{
flo... | ALGO | 0.909698 | 4.286013 |
c11191a9-071f-4d12-8b91-9af91da4bb5b | RahulGupta403/GFG_POTD | 2024/February/Day_25/Reach_a_given_score.cpp | class Solution
{
public:
// Complete this function
#define ll long long int
ll solve(ll n,ll help[],ll index,ll dp[][3]){
if(n==0){
return 1*1LL;
}
if(n<0 or index<0){
return 0;
}
if(dp[n][index]!=-1){
return dp[n][index];
... | ALGO | 0.999877 | 4.361209 |
be7d5ebd-2703-4d66-b744-d5df1595fdec | raincross7/code-similarity | codes/train_code/problem382/problem382_485.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;
typedef pair<int_t, int_t> pi;
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).... | ALGO | 0.999934 | 4.977487 |
f86d5ed8-5c6d-46dd-b8aa-ccf6b5abbdb8 | shafinkun/LightOJ | Hex_a_bonacci.cpp | /*_______________In the name of Allah_____________*/
/*________________Solved By shafinkun_____________*/
#include <bits/stdc++.h>
using namespace std;
#define optimize() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define endl '\n'
#define ll long long
#de... | ALGO | 0.999918 | 4.216484 |
371319e5-8687-48bb-8086-590cf2bce879 | DominicS99/Competitive-Programming | Kattis/robotmaze.cpp | // Nowhere near efficient, but this was during contest practice. AC'd it with 0.3 seconds to spare :)
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int main() {
ios::sync_with_stdio(0); cin.tie(NULL);
vector<int> dir = {1, 0, -1, 0, 1}; // DLUR
int t, m, n;
string s;
cin >> t;
... | ALGO | 0.999932 | 5.060979 |
2786e7e2-b627-4e29-aca4-29c302f93d60 | AlexMarcus17/Data-Structures-Projects | Lab1.Bag/Bag.cpp | #include "Bag.h"
#include "BagIterator.h"
#include <exception>
#include <iostream>
using namespace std;
// wc - Theta(1)
// bc - Theta(1)
// ac - Theta(1)
Bag::Bag() {
//TODO - Implementation
this->cp = 1;
this->n = 0;
this->elements = new ElementFrequencyPair[cp];
}
// wc - Theta(n)
// bc - Theta(1)
// ... | TOOL | 0.857491 | 5.36843 |
84cf05db-254c-41f7-a01d-3a82ede34011 | SonicZentropy/UEMirror | Engine/Source/ThirdParty/IntelTBB/IntelTBB-4.0/src/rml/perfor/tbb_multi_omp.cpp | #include <cstddef>
#include <cstdlib>
#include <cstdio>
#include <float.h>
#include <math.h>
#include <time.h>
#include <omp.h>
#include <assert.h>
#include "thread_level.h"
#include "tbb/task.h"
#include "tbb/tick_count.h"
#include "tbb/task_scheduler_init.h"
#include "tbb/scalable_allocator.h"
#if _WIN32||_WIN64
... | TOOL | 0.932409 | 4.619615 |
c2210635-8b37-48fd-a014-dec7159c4555 | yashgupta18/Data-structures-and-algorithms | TREE/BinaryTreeAlgos/2 Trees/InvertBinaryTree.cpp | #include <iostream>
#include<unordered_map>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
struct Node{
int data;
Node *left, *right;
};
struct Node *newNode(int item)
{
struct Node *temp = (struct Node *)malloc(sizeof(struct Node));
temp->data = item;
temp->... | ALGO | 0.999989 | 5.248424 |
ac4565ba-3a0b-4e68-816d-d507b955a880 | JAKUAN-AHMED/ALGORITHM | MODULE 06-GRAPH/AdjacencyList.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
vector<pair<int,int>>adjmat[N];
int main()
{
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++)
{
int u,v,w;
cin>>u>>v>>w;
adjmat[u].push_back({v,w});
//adjmat[v].push_back({u,w});
}
for(int i=1;i<=n;i++)
{... | ALGO | 0.99958 | 4.053364 |
3db4d9cd-d593-4dd3-9f47-fbe7248508d6 | gitee2github/llvm-project | llvm/lib/Support/SuffixTree.cpp | #include "llvm/Support/SuffixTree.h"
#include "llvm/Support/Allocator.h"
#include <vector>
using namespace llvm;
SuffixTree::SuffixTree(const std::vector<unsigned> &Str) : Str(Str) {
Root = insertInternalNode(nullptr, EmptyIdx, EmptyIdx, 0);
Active.Node = Root;
// Keep track of the number of suffixes we have t... | ALGO | 0.995276 | 7.207297 |
cc70137c-9340-4c92-a04b-2d6685ee46b0 | junkun/srv_core | pca/eigen/bench/vdw_new.cpp | #include <iostream>
#include <Eigen/Core>
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &inter... | ALGO | 0.999866 | 3.523852 |
b0e105df-9bd4-40d4-b33e-7ae00c4684da | KareemEssam7/Competitive-Programming-Library | Data Structures/EvoStack.cpp | template<class T>
class EvoStack {
stack<T> f[2], b[2];
T merge(T a, T b) {
return __gcd(a, b);
}
void add(T val, stack<T> s[]) {
s[0].push(val);
s[1].push((s[1].empty() ? val : merge(s[1].top(), val)));
}
void rem(stack<T> s[]) {
s[0].pop(), s[1].pop();
}
... | ALGO | 0.999701 | 4.799057 |
2de3c061-33f7-41c7-aafe-a61de7f01b3a | npcarter2025/LeetcodeWorkspace | Flipping_An_Image/flipping_an_image.cpp | #include <vector>
using namespace std;
class Solution {
public:
vector<vector<int>> flipAndInvertImage(vector<vector<int>>& image) {
int n = image.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < (n + 1) / 2; j++) {
int temp = image[i][j];
image... | ALGO | 0.999857 | 6.294607 |
0efc41cc-2003-40ca-adb2-30e3c9a11cf5 | falconcoin/fal | src/addrman.cpp | #include "addrman.h"
#include "hash.h"
using namespace std;
int CAddrInfo::GetTriedBucket(const std::vector<unsigned char> &nKey) const
{
CDataStream ss1(SER_GETHASH, 0);
std::vector<unsigned char> vchKey = GetKey();
ss1 << nKey << vchKey;
uint64 hash1 = Hash(ss1.begin(), ss1.end()).Get64();
CDat... | ALGO | 0.970691 | 6.083518 |
bee8d5d6-bad9-4002-8d59-563db4d74576 | S-ameer1/LeetCode | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlin... | class Solution {
public:
int numSubarraysWithSum(vector<int>& nums, int goal) {
int n=nums.size();
int count=0;
unordered_map<int,int>mp;
mp[0]=1;
int pref=0;
for(int i=0;i<n;i++){
pref+=nums[i];
if(mp.find(pref-goal)!=mp.end()){
... | ALGO | 0.999971 | 6.431715 |
a81f2ed7-501f-4229-a2f7-78f049a856f9 | Official-Akash/CPLUSPLUS | CPP/linked.cpp | #include<iostream.h>
#include<stdio.h>
#include<stdlib.h>
struct node
{
int info;
struct node *next;
}*start;
class list {
public:
node* create_node(int value) {
struct node *temp, *s;
temp = new(struct node);
if (temp == NULL)
cout<<"Memory not allocated "<<endl;
else
{
temp... | ALGO | 0.996462 | 3.736404 |
a7cf03ec-12ca-4dc3-bf26-12cf55715064 | byteZorvin/Competitive-Programming | 740-delete-and-earn/740-delete-and-earn.cpp | class Solution {
public:
int deleteAndEarn(vector<int>& nums) {
int n = 10001;
vector<int> values(n, 0);
for (int num : nums)
values[num] += num;
int take = 0, skip = 0;
for (int i = 0; i < n; i++) {
int takei = skip + values[i];
int skipi... | ALGO | 0.999411 | 6.173131 |
e17729ae-805a-4c25-b1c2-96f5b67392d6 | ghozt777/cp | leetcode/c++/arrays/maximum-consecutive-ones-iii/main.cpp | // link:https://leetcode.com/problems/max-consecutive-ones-iii/
// idea: Sliding Window
class Solution {
public:
int longestOnes(vector<int>& nums, int k) {
const int n=nums.size();
int res=INT_MIN;
int l=0;
int zero=0;
for(int r=0;r<n;r++){
zero+=nums[r]==0;
... | ALGO | 0.999932 | 6.274651 |
bdb7e3dd-8da3-466d-a7e6-61118f19efe0 | HuangDDU/hzy_algorithm | huawei/2_Transcoding_Network Delivery/23_12_17初始想法/main4_yx_trajectory_merge.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Provider {
public:
int x, y;
int left_transmitter_id=-1, right_transmitter_id=-1; // 方便Provider所在行的路径合并
vector<vector<int>> target_vector; // 目标列表保存的方式
Provider(int x, int y) {
this->x = x;
this->y = y;
}
};
class ... | ALGO | 0.999784 | 4.039044 |
54116bc9-e1eb-44ec-941d-8d1ec4c4812e | forrestv/opende | OPCODE/Ice/IceAABB.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains AABB-related code.
* \file IceAABB.cpp
* \author Pierre Terdiman
* \date January, 29, 2000
*/
///... | ALGO | 0.989591 | 4.170553 |
0c000f9c-32b0-4092-905e-ebb564204db5 | Dr-XX/pandore-bug-injected | src/operatorsP0/contour/phoughlines.cpp | /**
* @author Laurent Quesnel - 2002-06-10
* @author Rgis Clouard - Nov 28, 2006
* @author Rgis Clouard - May 25, 2011
*/
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <pandore.h>
using namespace pandore;
/**
* @file phoughlines.cpp
* Algorithm for Hough Transform
*/
const double de... | ALGO | 0.99572 | 6.084091 |
6e56e314-d853-4ca0-8433-5f90df6fb0fc | eliot-exdev/boost-morphos | libs/contract/example/meyer97/stack3.cpp | //[meyer97_stack3
// File: stack3.cpp
#include "stack4.hpp"
#include <boost/contract.hpp>
#include <boost/optional.hpp>
#include <cassert>
// Dispenser LIFO with max capacity using error codes.
template<typename T>
class stack3 {
friend class boost::contract::access;
void invariant() const {
if(!error... | TOOL | 0.89831 | 6.539376 |
268a146d-eaa3-469a-aa51-a1d34f706a68 | wangx1996/CenterBEV | cbev/models/DCNv2/src/cpu/dcn_v2_im2col_cpu.cpp | #include "dcn_v2_im2col_cpu.h"
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <ATen/ATen.h>
//#include <ATen/cuda/CUDAContext.h>
#include <TH/TH.h>
//#include <THC/THCAtomics.cuh>
//#include <THC/THCDeviceUtils.cuh>
// modified from the CUDA version for CPU use by Daniel K. Suhendro
/*#define CU... | DATA | 0.908076 | 4.642383 |
8e6e4290-9605-4fef-b78c-1aa5ad904b6c | shivaapratim/DSA_Daily | 0113-path-sum-ii/0113-path-sum-ii.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.999944 | 5.904356 |
b140f794-ea5f-4f2b-b8ed-8c73e1de42e1 | raincross7/code-similarity | codes/train_code/problem464/problem464_261.cpp | #include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll ... | ALGO | 0.999996 | 4.107497 |
e6421c94-69af-4e23-ae31-96c87c1b9383 | bhuvi99/SPOJ | CodeChef/Easy/AMSGAME1.cpp | #include<iostream>
#pragma GCc optimize ("-O3")
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;
int gcd(int a,int b){
if(b>a) return gcd(b,a);
return b==0?a:gcd(b,a%b);
}
int main(){
int t,n,g;
cin>>t;
while(t--){
cin>>n;
int a[n];
rep(i,0,n) cin>>a[i];
g=a[0];
rep(i,1,n) g=gcd(g,a[i]);
co... | ALGO | 0.999952 | 3.810909 |
9098e745-14cd-465a-aec1-95d75d6df41f | fkti6307/DM | DM/Parser.cpp | #include "ParserHeader.h"
BigNatural parseToBigNatural(char* string)
{
BigNatural result;
int size;
short currentNumber;
char current;
int j = 0;
if (strlen(string) == 0)
{
result.size = 0;
return result;
}
size = strlen(string);
short* coef = new short[size];
for (int i = 0; string[i] != '\0'; i++)... | ALGO | 0.947967 | 3.789084 |
de5fa5ca-efdb-4008-ac98-fabd93f84601 | zzwblog/AlgorithmCode | PAT/A1099 Build A Binary Search Tree.cpp | ////#include <iostream>
////#include <queue>
////#include <vector>
////#include <algorithm>
////using namespace std;
////struct Node
////{
//// int val, l, r;
////}node[105];
////vector<int>nums(105), levelOrder;
////int N, k = 0;
////void inOrderTravel(int root)//得到树的中序遍历
////{
//// if (root == -1)
//// return;
//// ... | ALGO | 0.999999 | 4.488581 |
a8793f0c-3651-467f-9fb7-f3c0990102bb | Shivamkumar26/Leetcode-Solutions | 1020-longest-turbulent-subarray/longest-turbulent-subarray.cpp | class Solution {
public:
int maxTurbulenceSize(vector<int>& arr) {
int n = arr.size(), res = 0, len = 0;
for(int i = 0; i < n; i++) {
if(i > 1 &&
((arr[i-2] > arr[i-1] && arr[i-1] < arr[i]) ||
(arr[i-2] < arr[i-1] && arr[i-1] > arr[i])))
... | ALGO | 0.99986 | 5.979559 |
76d8e35f-2c74-4588-b1ab-7c699cd08540 | GNAQ/Algorithm-Contest-Archive | CPC/EuRC/NWERC2020/D.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<typename int_t>
void readx(int_t &x)
{
x=0; int_t k=1; char ch=0;
while (ch<'0' || ch>'9') { ch=getchar(); if (ch=='-') k=-1; }
while (ch>='0' && ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
x*=k;
}
bool Isint(ll x)
{
return (long long)sqr... | ALGO | 0.999599 | 3.227415 |
ac29949c-9ab0-46bf-a446-c6e7d80f3047 | ssjf409/PS | 알고리즘스터디/1174줄어드는숫자.cpp | #include <iostream>
#include <vector>
#include <cstring>
using namespace std;
int cache[11][11];
vector<int> v;
void getNum(int num, int x) {
if(x == 1) return;
if(num == 0) return;
int ret = num;
int nx;
bool flag = true;
for(int i = 0; i <= 9; i++) {
if(num - cache[x][i] <= 0) {
... | ALGO | 0.999503 | 5.130586 |
3be94c6c-a080-4291-b378-2cd98ee4ff63 | jjeunv/Data-Structure | W14_GraphTraversal/2021_P/2021_W14_P4.cpp | #include <iostream>
#include <vector>
using namespace std;
#define endl "\n"
bool visit[101];
vector<int> graph[101];
int cnt;
void DFS(int num) {
visit[num] = true;
for (auto i : graph[num]) {
if (!visit[i]) {
cnt++;
DFS(i);
}
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int T; cin >> ... | ALGO | 0.999943 | 4.590183 |
21112580-06d9-4eff-9037-04390295a40a | dendisuhubdy/ntl | src/QuadTest.cpp |
#include <NTL/quad_float.h>
NTL_CLIENT
int main()
{
quad_float a, b, c, d;
quad_float::SetOutputPrecision(25);
long pok;
double one = 1.0;
quad_float_PrecisionOK(pok, one);
if (pok)
cout << "Precision OK\n";
else
cout << "Precision not OK\n";
cin >> a;
cout << a << "\n";
... | TOOL | 0.910308 | 3.961687 |
d54d2325-ec59-4e36-ae9a-c6f3676e871c | SpatikaP/DSA-solutions | Missing number in array - GFG/missing-number-in-array.cpp | //{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution{
public:
int missingNumber(vector<int>& array, int n) {
// Your code goes here
int sum=0;
int sum1=0;
for(int i... | ALGO | 0.999836 | 5.559233 |
40362f57-c59c-4890-b862-750abf2d7258 | SudhanshuDTU/DSA_Arrays | sheetQ3.cpp | #include<iostream>
using namespace std;
class Solution{
public:
int findMissing(int arr[], int n) {
int common_diff = (arr[n - 1] - arr[0]) / n;
int missing_element;
for (int i = 1; i < n; i++) {
if (arr[i] - arr[i - 1] != common_diff) {
missing_element = arr[i - 1] + common_di... | ALGO | 0.999794 | 3.887469 |
6a1095ae-d527-491a-8b84-6d64430dfa5e | yliu-cs/ACM | PTA/团体程序设计天梯赛-练习集-L1-019.cpp | #include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int num_1, num_2;
cin >> num_1 >> num_2;
int n;
cin >> n;
int res_1 = 0, res_2 = 0;
bool flag_1 = 0, flag_2 = 0;
bool flag = 0;
while (n--) {
in... | ALGO | 0.999801 | 4.590074 |
60061c89-ca38-4f2d-8f19-a7e9144081e6 | godely/Problems | UVa/10319.cpp | #include <bits/stdc++.h>
using namespace std;
#define fr(a,b,c) for(int a = b; a < c; a++)
#define rp(a,b) fr(a,0,b)
#define Y(x) (2*x)
#define N(x) (2*x + 1)
#define NEG(x) (x^1)
#define MAXM 2000
#define add(a,b) to[z] = b, ant[z] = adj[a], adj[a] = z++
int to[MAXM], ant[MAXM], adj[MAXM], z;
int mark[MAXM], vis[MAXM... | ALGO | 0.999903 | 4.15572 |
777ac9a7-0426-4f3e-94b4-b97929947fa6 | aqua4/leetcode-solutions | Kth Largest Element in an Array/Solution.99674988.cpp | class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
nth_element(nums.begin(), nums.begin() + k - 1, nums.end(), greater<int>());
return nums[k - 1];
}
}; | ALGO | 0.999907 | 5.514548 |
79972ca8-88ec-43c0-a575-af1b4524408f | LiquidPlayer/LiquidCore | deps/boost_1_66_0/libs/numeric/ublas/doc/samples/vector_binary_scalar.cpp | #include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v (3);
for (unsigned i = 0; i < v.size (); ++ i)
v (i) = i;
std::cout << 2.0 * v << std::endl;
std::cout << v * 2.0 << std::endl;
}
| ALGO | 0.911726 | 3.24158 |
61a5f42b-1483-498e-8bf9-a1850a7506a2 | WillGasser/schoolwork | COMP2710/project2/project2_Gasser_wbg0023.cpp | // Will Gasser, wbg0023, project2_Gasser_wbg0023, g++ -o main.exe project2_Gasser_wbg0023.cpp, ./main.exe
// Date: 09/20/2023
// Course: COMP 2710 (Software Construction)
#include <stdio.h>
#include <iostream>
#include <iomanip>
# include <stdlib.h>
# include <assert.h>
# include <ctime>
using namespace std;
// ALL ... | ALGO | 0.917319 | 4.838291 |
9409871c-960b-4305-ad11-53567b27343b | NeighborUncleWang/Companies | Virtu/OA/LongestArithmeticSequence/main.cpp | #include <iostream>
#include <vector>
#include <math.h>
using namespace std;
int LongestArithmeticSequence(vector<int> nums) {
sort(nums.begin(), nums.end());
int n = nums.size(), res = 0;
vector<vector<int>> dp(n, vector<int>(n, 2));
for (int j = n - 2; j >= 0; --j) {
int i = j - 1, k = j + 1... | ALGO | 0.999448 | 3.99158 |
95673276-cce9-46d9-93cb-278de59f83c3 | touyou/CompetitiveProgramming | topcoder/LaserShooting.cpp | #include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include ... | ALGO | 0.999018 | 4.230792 |
c2b308a5-d6f6-45a3-b50d-766e562dda44 | estudioPro/codigosProgramacionEstructurada | Ejercicio4.3_13/11/19/main.cpp | #include <iostream>
using namespace std;
int main() {
int numero;
int suma = 0;
for (int i = 0; i < 10; ++i) {
cout<<"Ingresa el valor "<<i+1<<" : ";
cin>>numero;
suma = suma + numero;
}
cout<<"Tu resultado es: "<<suma;
return 0;
} | ALGO | 0.903929 | 3.224885 |
222a2b64-423c-449b-9214-9d4a814e468b | SUSHANTSINGH01/CP-AND-DSA | DSA/bit_manipulation/reverse_bits_interview.cpp | unsigned int Solution::reverse(unsigned int A) {
// Do not write main() function.
// Do not read input, instead use the arguments to the function.
// Do not print the output, instead return values as specified
// Still have a doubt. Checkout www.interviewbit.com/pages/sample_codes/ for more details
... | ALGO | 0.999868 | 5.23625 |
4266126a-70f4-4a93-872f-340873cf5753 | regindex/finite-automata-partition-refinement | lib/part_ref.cpp | /*
Code implementing partition refinement algorithm.
*/
#include "part_ref.h"
/**
* @brief Sort a (Pseudo-)Wheeler automaton using the partition refinement algorithm
*
* @param P input partition
* @param NFA a (Pseudo-)Wheeler automato to sort
*/
void PART_REF_WHEELER(partition& P, graph& NFA) {
// iterate... | ALGO | 0.999979 | 4.831114 |
add5208a-5e17-448f-847a-72fa2d87dd1a | Octobug/notes | algorithms_and_data_structures/leetcode/dynamic_programming/m_00416_partition_equal_subset_sum/main.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution
{
public:
bool canPartition(vector<int> &nums)
{
int sum = 0;
for (auto num : nums)
sum += num;
if (sum % 2 == 1)
return false;
int half = sum / 2;
vector<int> dp(half +... | ALGO | 0.999623 | 5.681667 |
689928f2-f607-40d7-9487-055c7dc1c043 | linux4life798/llvm-project-ci-test | libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp | // <algorithm>
// template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
// constexpr bool // constexpr after C++17
// is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
// ForwardIterator2 first2, BinaryPredicate pred);
#include <algorithm>
#include <funct... | TEST | 0.977907 | 7.44474 |
82102592-9b28-43d1-a5ac-112988930ebe | M7-TROJAN/Problem-Solving | Date Problems/Problem #19 difference Between 2 Dates/differenceBetween2Dates_v2.cpp |
#include <iostream>
using namespace std;
struct stDate
{
short day = 0;
short month = 0;
short year = 0;
};
stDate readDate()
{
stDate date;
// Get the input from the user
std::cout << "Please enter a Day: ";
std::cin >> date.day;
std::cout << "Please enter a Month: ";
std::cin >>... | ALGO | 0.999349 | 4.74101 |
9408d63a-6e8d-406e-9a85-bf6d4b1ce79b | nguyentuss/Competitive-Programming | CP/OnlineJudge/SeriesContest/WinterContest2021/Nguyen.Ngoc.Tu_010805/WC5.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX_N (int) (2e5 + 7)
#define int long long
int v[MAX_N];
int sum[MAX_N];
signed main() {
ios_base::sync_with_stdio(0); cin.tie(NULL);
cout.tie(NULL);
freopen("WC5.inp","r",stdin);
freopen("WC5.out","w",stdout);
int t; cin >> t;
while (t--) {
int n; cin ... | ALGO | 0.999892 | 4.122451 |
24e60511-0a3b-411c-8d27-f36ec8845a34 | tung23102000/contests-CTDLGT | contest 9 CTDL>/Bai1_Chuyen_DS_Canh_Sang_DS_Ke.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,m,a,b;
cin>>n>>m;//n la so dinh , m la so canh
vector<int> ke[1005];
for(int i=0;i<m;i++){//canh
cin>>a>>b;
ke[a].push_back(b);
ke[b].push_back(a);
}
for(int i=1;i<=n;i++){//dinh
cout<<i<<":"<<" ";
... | ALGO | 0.999428 | 3.960027 |
c462c67f-f6b9-47ae-ad58-b42a1934ff17 | Prakul-Agrawal/AoC-2024 | Day-17.cpp | //
// Created by Prakul Agrawal on 12/26/24.
//
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e18
typedef long long ll;
//#define int long long;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typ... | ALGO | 0.999803 | 4.58725 |
2ea8a439-3e98-423d-b677-38ffddd55a93 | ishandutta2007/codeforces | he_ren/normal/609/C.cpp | #include<cstdio>
const int MAXN = 1e5 + 5;
inline int max(int a,int b){ return a>b? a: b;}
int a[MAXN];
int main(void)
{
int n;
scanf("%d",&n);
int sum=0;
for(int i=1; i<=n; ++i)
scanf("%d",&a[i]), sum+=a[i];
int sum2 = sum%n? sum/n+1: sum/n;
sum/=n;
int ans=0, ans2=0;
for(int i=1; i<=n; ++i)
{
if(a... | ALGO | 0.999925 | 3.140522 |
10ea1b07-89a0-4dbf-a025-b422ef46b9ce | steineggerlab/foldmason | lib/foldseek/lib/mmseqs/src/clustering/AlignmentSymmetry.cpp | //
// Implemented by Martin Steinegger, Lars vdd
//
#include "AlignmentSymmetry.h"
#include <climits>
#include <new>
#include <algorithm>
#include "Parameters.h"
#include "Util.h"
#include "Debug.h"
#include "FastSort.h"
#include <cmath>
#ifdef OPENMP
#include <omp.h>
#endif
#define LEN(x, y) (x[y+1] - x[y])
void Al... | ALGO | 0.989222 | 5.068161 |
aca1f123-cca1-4e23-9647-f91806170a42 | dhruv3375/CP | CPP Basics/Z_Three_Numbers.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int a , b;
cin >> a >> b;
int cnt = 0;
for(int i = 0; i <= a; i++)
{
for(int j = 0; j <=a; j++)
{
long long z = b - (i + j);
if(z >= 0 && z <=a){
cnt++;
}
}
}... | ALGO | 0.999718 | 3.338455 |
a8709558-24fa-4c87-bb3f-50a9a9408fe5 | Kestrel-omega/Baekjoon | src/12015.cpp | /*
NlogN LIS Algorithm
1. create an vector of size N
2. push the first element of the array into the vector that too small to create a LIS
3. for the rest of the elements of the array, if the element is greater than the last element of the vector, push it into the vector
4. else, find the first element of the vector t... | ALGO | 0.999971 | 5.402955 |
d6071623-198e-45d2-8270-46cc9eebc024 | zkEloHub/LC-SourceCode | lc75_1.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
int len = nums.size();
if(len == 0) return ;
int l = 0, r = len - 1, i;
for(i = l; i <= r; i++) {
if(nums[i] == 1) continue;
if(nums[i] == 0) {
swap(nums[i], nums[l]);
} ... | ALGO | 0.999704 | 5.780397 |
09a3f61c-e408-4ceb-a504-e76d5f0b9392 | TRLVMMR/algorithm | 蓝桥杯/特殊回文数2.cpp | /*
һʼfj¼jķdz⣬j = 50ʱfj505
*/
#include<stdio.h>
//5λ (ʱkΪ1ż0)
void five(int n, int k)
{
if(n > 45)
return;
//iΪм
//jΪߵ
for(int j = 10; j < 100; j++)
{
int temp = j, sum = 0;
for(int i = k; i <= 9; i+=2)
{
int m = (n - i) / 2;
while(temp != 0)
{
sum = sum + temp % 10;
te... | ALGO | 0.99984 | 4.104512 |
93917cec-fabe-406c-8c14-75995022292a | Ivenyang/Cocos2dx | JSBinding/testJS/libs/cocos2dx/support/CCPointExtension.cpp | #include "CCPointExtension.h"
#include "ccMacros.h" // FLT_EPSILON
#include <stdio.h>
NS_CC_BEGIN
#define kCCPointEpsilon FLT_EPSILON
float
ccpLength(const CCPoint& v)
{
return sqrtf(ccpLengthSQ(v));
}
float
ccpDistance(const CCPoint& v1, const CCPoint& v2)
{
return ccpLength(ccpSub(v1, v2));
}
CCPoint
ccp... | TOOL | 0.928043 | 6.506376 |
6fe6ef97-c571-4164-8cd8-20a94c73d743 | bythewaydai/PlayKill | MyCppGame/cocos2d/cocos/math/MathUtil.cpp | #include "MathUtil.h"
#include "base/ccMacros.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include <cpu-features.h>
#endif
//#define USE_NEON32 : neon 32 code will be used
//#define USE_NEON64 : neon 64 code will be used
//#define INCLUDE_NEON32 : neon 32 code included
//#define INCLUDE_NEON64... | TOOL | 0.981619 | 6.318425 |
bab55015-31d3-4360-b1d9-b45f97a84539 | ixray-team/ixray-1.5-stcs | sdk/sources/MagicSoftware/FreeMagic/Source/Containment2D/MgcCont2DMinBox.cpp | #include "MgcCont2DMinBox.h"
using namespace Mgc;
//----------------------------------------------------------------------------
Box2 Mgc::MinBox (int iQuantity, const Vector2* akPoint)
{
// The input points are V[0] through V[N-1] and are assumed to be the
// vertices of a convex polygon that are counterclock... | ALGO | 0.999854 | 7.619165 |
1984866f-3262-4135-a867-f3f9d56bf8ef | simbody/simbody | SimTKmath/Optimizers/src/IpOpt/IpUserScaling.cpp | #include "IpUserScaling.hpp"
namespace SimTKIpopt
{
void UserScaling::DetermineScalingParametersImpl(
const SmartPtr<const VectorSpace> x_space,
const SmartPtr<const VectorSpace> c_space,
const SmartPtr<const VectorSpace> d_space,
const SmartPtr<const MatrixSpace> jac_c_space,
const SmartPtr<con... | TOOL | 0.940822 | 6.275608 |
4a887257-6b77-49d1-a529-1142cb9fb9ad | saulelabra/FaceDetection_OpenCV | main.cpp | #include "FaceDetector_opt.h"
#include <windows.h>
#include <vector>
#include <iostream>
using namespace std;
using namespace cv;
int main()
{
//Variable declaration
int option;//for menu
parameters_FacDet settings;//for detector initialization
vector <string> pathsToClassif;//
//Image file
string fileNa... | ALGO | 0.910382 | 4.015195 |
a6af1bb4-be11-4d9c-9a36-f627d69eafd8 | ckdlscjs/AlgorithmRepo | 프로그래머스/1/76501. 음양 더하기/음양 더하기.cpp | //https://school.programmers.co.kr/learn/courses/30/lessons/76501
#include <bits/stdc++.h>
using namespace std;
int solution(vector<int> absolutes, vector<bool> signs)
{
int answer = 0;
for(int i = 0; i < absolutes.size(); i++)
answer += absolutes[i] * (signs[i] ? 1 : -1);
return answer;
} | ALGO | 0.999962 | 5.10269 |
8197076a-4644-4440-8bce-d674829084f5 | MatheoJ/RaytracingRenderer | 3rdparty/json/tests/thirdparty/Fuzzer/test/AbsNegAndConstant64Test.cpp | // abs(x) < 0 and y == Const puzzle, 64-bit variant.
#include <cstring>
#include <cstdint>
#include <cstdlib>
#include <cstddef>
#include <cstdio>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (Size < 16) return 0;
int64_t x;
uint64_t y;
memcpy(&x, Data, sizeof(x));
memcpy(&y, ... | ALGO | 0.990184 | 5.085598 |
3cd06b11-1829-46b4-8cd7-8477fcf7d605 | JstMonika/VC | Virtual Contest/World_Final_2001_Vancouver/pB.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename T> using vec = vector<T>;
template<typename T> using Prior = priority_queue<T>;
template<typename T> using prior = priority_queue<T, vector<T>, greater<T>>... | ALGO | 0.993917 | 3.214704 |
99817e80-fc87-4a5b-82e0-61b2457d7b90 | affanqureshi2/Projects | Computer Programming Projects/Final/recurtion.cpp | #include <iostream>
using namespace std;
int mystery(int n);
//Precondition n > = 1.
int main()
{
cout << mystery(3);
return 0;
}
int mystery(int n)
{
if (n <= 1)
return 1;
else
return ( mystery(n - 1) + n );
}
| ALGO | 0.999841 | 4.431593 |
956e0cf2-b877-4dfb-80ed-29c8ddc4dbe3 | NephrenCake/Algorithm | AcWing/蓝桥杯C++AB组/第六讲 双指针、BFS与图论/1096. 地牢大师.cpp | #include <cstring>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
// https://www.acwing.com/problem/content/1098/
const int N = 105;
char g[N][N][N];
int dist[N][N][N];
int l, r, c;
int dz[] = {1, -1, 0, 0, 0, 0};
int dx[] = {0, 0, 0, 1, 0, -1};
int dy[] = {0, 0, 1,... | ALGO | 0.999773 | 3.853984 |
51469fd5-493a-447d-bfc4-fd25714ba612 | AmanDhimanD/CPP | C++ STL/03_Deque.cpp | #include <iostream>
#include<deque>
using namespace std;
int main()
{
//insertion Deleteion can done both sides beg or last
deque<int> d;
d.push_back(1);
d.push_front(2);
for(int i:d)
{
cout << i << " ";
}
cout << endl;
// d.pop_front();
// cout << endl;
// for(int ... | TOOL | 0.879476 | 4.746338 |
763c5025-3e4e-42db-b4e8-801600df8dc3 | jammidee/laframeflu | 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.998764 | 6.762122 |
fed86c3c-e06f-4dec-8957-980251ce0100 | Kenshin2438/CP-Code-Collection | Contest/2022 CCPC Henan Provincial Collegiate Programming Contest/G.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(a) begin(a), end(a)
#define sz(x) (int)((x).size())
#ifdef LOCAL
#include "debug.hpp"
#else
#define debug(...) 42
#endif
template <uint32_t mod> struct m32 {
static_assert(mod < (1U << 31), "Modulus error!");
using u32 = uint32_t;
... | ALGO | 0.999791 | 5.192976 |
9dcee7cf-353e-43bc-87b9-0eef61dc72d8 | Gautam-Jangir8/LeetCode-Questions | 0450-delete-node-in-a-bst/0450-delete-node-in-a-bst.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.999997 | 6.826929 |
eafd96f9-3379-4f08-8e6f-c1b3e1909f7c | career-sp/Cpp_language_dsa | hashing/Practice_questions/Q1.cpp | /*
Can you make the stirngs equal?
Given an array of strings. You can move any number of characters from one strng to any other string any number of times. You just have to make all of them equal.
Print "yes" if you can make every string in the array equal by using any number of operations otherwise print "No".
e.g.... | ALGO | 0.999958 | 6.097767 |
652874cf-66d1-49db-9fa9-7cb52db4102b | giovany-silva/Programacao-Competitiva | Códigos/URI2961.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int x, valores[4]={0,0,0,0}, maior=0;
string um, dois, tres, quatro, um2, dois2, tres2, quatro2;
cin >> x;
getchar();
for(int i=0; i<x; i++){
getline(cin, um);
getline(cin, um);
getline(cin, dois);
getline(cin, tres);
getline(cin,... | ALGO | 0.99961 | 3.499445 |
21d47c2a-14d9-44e2-b7bd-eca375218122 | old-yan/leetcode-solutions | leetcode_solutions/leetcode_1550/1510/1510.cpp | #include "utils.h"
class Solution {
public:
bool winnerSquareGame(int n) {
bool dp[n+1];
dp[0]=false;
FOR(i,1,n+1){
dp[i]=false;
for(int j=1;j*j<=i;j++){
if(!dp[i-j*j]){
dp[i]=true;
break;
}
... | ALGO | 0.999708 | 5.155683 |
e5736190-248a-47da-95c8-61537492b0ca | SianDonchev/Package_Installation_task | Package_Installation/Graph.cpp | #include "Graph.h"
void Graph::addVertex(const std::string& vertexName)
{
Vertex vertex(vertexName);
graph.insert({ vertexName,vertex });
allVertices.insert(vertexName);
}
void Graph::addDirectedEdge(const std::string& from, const std::string& to)
{
graph[from].addAdjacentVertex(to);
}
void Graph::dfs()
{
for(... | ALGO | 0.988048 | 5.428318 |
eb4dcecd-8592-40b5-9721-c825bdd442c6 | JeromeGJH/LeetCode | 1855_1.cpp | class Solution {
public:
int maxDistance(vector<int>& nums1, vector<int>& nums2) {
int left, right, mid=0;
int i, res = 0;
for(i = 0; i < nums1.size(); ++i){
left = nums1[i] <= nums2[mid]? mid: i;
right = nums2.size() - 1;
while(left < right){
... | ALGO | 0.999935 | 5.766019 |
1e3d3a7d-6b16-434b-922d-bf4a62ba4815 | PunnyOz2/Intro_Data_Structure | ds01_pair_sum.cpp | #include <iostream>
#include <vector>
#include <set>
using namespace std;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
int a,b,tmp;
cin >> a >> b;
vector<bool> s(2000019,false);
vector<int> v(a);
for(int i = 0; i<a; i++){
cin >> tmp;
for(int j = 0; j<i; j++){
... | ALGO | 0.999919 | 3.862218 |
5da6c0c1-81c1-4f56-90cf-b8b388537a2a | lionkingchuja/leet_code | 1642-water-bottles/1642-water-bottles.cpp | class Solution {
public:
int numWaterBottles(int numBottles, int numExchange) {
int ans=numBottles;
int temp=numBottles / numExchange;
int rem=numBottles % numExchange;
ans +=temp;
int total=temp+rem;
while(total >=numExchange){
rem=total % numExchange;
... | ALGO | 0.999816 | 5.345779 |
f8c23ff9-b5a8-4b3c-a69d-034c3a65f45d | bhupalisarma/Problems | 0128-longest-consecutive-sequence/0128-longest-consecutive-sequence.cpp | // class Solution {
// public:
// int longestConsecutive(vector<int>& nums) {
// sort(nums.begin(),nums.end());
// int n = nums.size();
// int count = 1;
// if(n==0) return 0;
// for(int i=0;i<n;i++){
// if(nums[i]==nums[i+1]-1) count++;
// }
// ... | ALGO | 0.999943 | 5.703418 |
ceac6188-fcd6-48dd-b452-ee3abf7be891 | farzamdorostkar/amon | llvm-project-17.0.6.src/libc/src/math/aarch64/truncf.cpp | #include "src/math/truncf.h"
#include "src/__support/common.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(float, truncf, (float x)) {
float y;
__asm__ __volatile__("frintz %s0, %s1\n\t" : "=w"(y) : "w"(x));
return y;
}
} // namespace __llvm_libc
| ALGO | 0.977682 | 5.757904 |
fb426879-7bf9-4b46-a841-26531a0f8667 | kkisic/Procon | CPP/Codeforces/1155/a.cpp | #include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>
#define int long long int
#define rep(i, n) for(int i = 0; i < (n);... | ALGO | 0.999874 | 3.411044 |
8e294da0-102a-4088-babf-252f939fcc55 | benjsherman/ParallelProg4 | Sudoku GA/Sudokoid.cpp |
#include <iostream>
#include <vector>
#include <random>
#include <time.h>
#include <fstream>
#include <exception>
#include <cstdlib>
#include <climits>
#include "SimpleSolver.h"
using namespace std;
/******************************************************************************
copy
copies a given 2-d array of intos... | ALGO | 0.994518 | 5.023287 |
4768c85c-6d7e-4e99-a088-f9bd81846846 | divy9881/CC | GFG/Sorting/selection_sort.cpp | #include<iostream>
using namespace std;
void Swap(int &a,int &b){
int t = a;
a = b;
b = t;
}
void selection_sort(int arr[],int n){
for(int i=0;i<n-1;i++)
for(int j=i+1;j<n;j++)
if(arr[i]>arr[j])
Swap(arr[i],arr[j]);
}
int main(){
int n;
cin>>n;
int *arr... | ALGO | 0.999942 | 4.222542 |
00c8c267-748b-4fa9-b09a-187c705b60dd | Habtewold-D/flutter-lab-assignment-3 | 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.998757 | 6.771107 |
2fafa024-d901-44b2-b920-b37224209619 | NguyenHuuVanh/Algorithm-and-data-structure | BT_LON_LAP_TRINH/cau31.cpp | #include <iostream>
#define MAX 100
using namespace std;
void nhapmang(int arr[], int n)
{
for (int i = 0; i < n; i++)
{
cout << "Nhap arr[" << i << "]=";
cin >> arr[i];
}
}
void inmang(int arr[], int n)
{
for (int i = 0; i < n; i++)
{
cout << arr[i] << "\t";
}
}
void ... | ALGO | 0.999782 | 3.47572 |
442346ce-177b-4ebb-909c-3fdf9835c1b1 | hareta0109/atcoder | submissions/abc/abc157/e.cpp | #include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<... | ALGO | 0.999181 | 4.282216 |
cbd69840-2742-476c-aa19-bee4b13457d8 | chuang0221/leetcode | Graph/695. Max Area of Island/main.cpp | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
class Solution {
public:
int maxAreaOfIsland(vector<vector<int>>& grid) {
int m = grid.size(), n = grid[0].size();
vector<vector<bool>> visited(m, vector<bool>(n, false));
int dx[4] = {-1, 0, 1, 0};
int dy[... | ALGO | 0.999955 | 6.24672 |
cacea66e-6ab9-4ccd-a049-f0e24569d1dc | eeemrann/DSA-II | 2_Problem.cpp | //Palindrome
#include<bits/stdc++.h>
using namespace std;
bool isPalindrome(string s) {
queue<char> q;
list<char> l;
for (auto c : s) {
l.push_back(c);
}
for (auto c : s) {
q.push(c);
}
l.pop_back();
q.pop();
while (!q.empty()) {
if (q.front() != l.back()) {... | ALGO | 0.999565 | 5.924406 |
3554829a-d331-4cf0-ab57-8e6d6a94fc49 | Ekam3000/CppAndDataStructure2 | 12_Graphs/1_CB_Graph_algorithms/12_challenges_graphs/10_sakshi_and_art.cpp | /*
Problem Name : Sakshi and Art
Topic : Graphs
Difficulty : Medium
EXPLANATION
Consider this as a graph(lines as edges and points as nodes). We need to add edges, such that there is a Euler Path. Let be connected components of graph. Count the number of vertices(count of the open ends) with odd degree. If there is no... | ALGO | 0.99988 | 4.978657 |
a470836f-d9aa-4f9c-bbae-ba2c2ed9396b | ravi-kr-singh/Image-Processing | Gaussian Smoothing/gaussian_smoothing.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;
#define pi 3.14159265358979323846
int normalisation_factor;
void mask_generator(vector<vector<double>>& m... | ALGO | 0.991286 | 4.631443 |
c65f1523-b8d5-49e9-b0b0-667363fc77a5 | Overstars/Practice | OJ/HDOJ题目/图论/HDOJ4280Island Transport(最大流,链式前向星+当前弧优化,还是TLE).cpp | #pragma comment(linker,"/STACK:102400000,102400000")
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<iomanip>//控制输出,<<setiosflags(ios::fixed)<<setprecision(9)
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
//当前弧优化是用... | ALGO | 0.999936 | 4.190065 |
acc55f1d-f989-467f-b1c5-94b8d73cd04d | Sumelt/Daily-Coding | 剑指Office/面试题18_删除链表的节点.cpp | /*----------------------------------------------------------------
* @Author: Su
* @Description:
* @Creath Date:
----------------------------------------------------------------*/
#include <iostream>
using namespace std;
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val... | ALGO | 0.999521 | 4.99397 |
74c91d4d-cc67-4eed-b5ab-25fcbfb336b1 | jsj9620/HUFS.github-issue-test | Algorithm/Algorithm/arrangement of queens.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
//체스 퀸 배치 문제
//퀸이 움직일 수 있는 자리에는 배치하면 안됨
using namespace std;
int n = 5, A[10][10];
void print() {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
printf("%3d", A[i][j]);
}
printf("\n");
}
printf("\n");
}
void q(int w, int h) {
int i;
fo... | ALGO | 0.999919 | 3.621804 |
c953eb32-39e7-4af0-98e6-548e2c9db2a0 | anandspaces/algorithms | jsd.cpp | #include <iostream>
using namespace std;
const int MAX_JOBS = 100;
struct Job {
char id;
int deadline;
int profit;
};
class JobSequencing {
private:
Job jobs[MAX_JOBS];
int numJobs;
public:
JobSequencing(int n) : numJobs(n) {}
void addJob(char id, int deadline, int profit) {
job... | ALGO | 0.999996 | 6.496175 |
ab7436ba-6f73-4ba5-b932-d908e37189c7 | maryamBarmaky/AcmSolution | 535 a co/تبدیل عددبه حروف.cpp | //535 A code forces
#include <iostream>
#include <string>
using namespace std;
int main()
{
int s;
string word[20] = { "zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen" };
string word2[8] = { "twen... | ALGO | 0.998408 | 5.140421 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.