uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
a2deb824-af55-4318-b0d0-47e80c4a5373 | zhb94430/PlannerProject | Libraries/boost_1_70_0/libs/geometry/test/algorithms/distance/distance_ca_ar_ar.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
#include <iostream>
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_cartesian_ar... | TEST | 0.937431 | 7.600434 |
3f5d8dc6-75a1-4b61-a34d-06618441a748 | sean50311/Programming-Design | W3/Practice2-3.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n=0,B=0;
cin>>n>>B;
int weight=0,price=0,w[n]={0},v[n]={0},x[n]={0};
for(int i=0;i<n;i++)
{
cin>>w[i];
}
for(int i=0;i<n;i++)
{
cin>>v[i];
}
for(int i=0;i<n;i++)
{
cin>>x[i];
}
for(int i=0;i<n;i++)
{
if(x[i]==1)
{
weight+=w[i];
... | ALGO | 0.999842 | 3.791976 |
adafc060-6cb2-4915-8398-ffbc69e98cc2 | girish-rajiv-patil/Airplane-In-Cloud | cocos2d/cocos/platform/winrt/CCFileUtilsWinRT.cpp | #include "platform/winrt/CCFileUtilsWinRT.h"
#include <regex>
#include "platform/winrt/CCWinRTUtils.h"
#include "platform/CCCommon.h"
#include "tinydir/tinydir.h"
using namespace std;
NS_CC_BEGIN
static std::string s_pszResourcePath;
// D:\aaa\bbb\ccc\ddd\abc.txt --> D:/aaa/bbb/ccc/ddd/abc.txt
static inline std::str... | TOOL | 0.913548 | 6.378664 |
4e212889-6491-4e37-a924-a199b110ddec | otavioon/COLA-2022-Tools | datasets/src/optz/codenet/2/p02598_s010044285.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map
#define mtv(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __... | ALGO | 0.999948 | 4.277199 |
f484a4b0-b3a9-4706-8615-db0986c18fe3 | nohhyeonjin/BOJ | 입출력/2441.cpp | #include <iostream>
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
for(int j=0;j<i;j++) printf(" ");
for(int j=0;j<n-i;j++) printf("*");
printf("\n");
}
} | ALGO | 0.999944 | 3.705307 |
4eea90f5-c676-465e-aaf0-5ffef80a7ca5 | hiteshmewada/LeetHub | Largest BST - GFG/largest-bst.cpp | // { Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val) {
Node* temp = new Node;
temp->data = va... | ALGO | 0.99972 | 6.864339 |
ea3558f3-13fa-4482-a07c-66b9026adb10 | Gorilla-Lab-SCUT/gmvs | gmvs/src/data_structure.cpp | mvs::Camera mvs::load_camera(vector<float> K,
vector<float> R,
vector<float> t,
int32_t height,
int32_t width,
float depth_min,
float depth_max) {... | TOOL | 0.856047 | 6.045598 |
6c058503-2aa6-4cf7-be18-04aaa5361b83 | qchien04/DSA-PTIT | soxauconchung.cpp | #include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
int t;
// Uncomment the next line if multiple test cases are needed
// cin >> t;
t = 1;
while (t--) {
int n, m;
cin >> n >> m;
vector<int> a(n), b(m);
for (int i = 0; i < n; ... | ALGO | 0.999998 | 5.252928 |
54a9df19-91fd-4723-904d-a382571415a9 | alps-jbnu/24ALPStudy | 2024-1/Intermediate/highcastle/DP/BOJ_14501.cpp | #include<bits/stdc++.h>
using namespace std;
int DP[16];
int T[1001];
int P[1001];
void dp(int n)
{
int maxnum = 0;
for(int i = 0; i <= n; i++)
{
DP[i] = max(maxnum, DP[i]);
if(T[i] + i <= n)
{
DP[T[i] + i] = max(DP[T[i] + i], P[i] + DP[i]);
}
maxnum = max(maxnum, DP[i]);
}
cout << maxnum;
}
int m... | ALGO | 0.999982 | 3.553762 |
36c02bf0-08e2-4aed-aa25-55300cecff3d | lammps/lammps | src/VORONOI/compute_voronoi_atom.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Daniel Schwen
------------------------------------------------------------------------- */
#include "compute_voronoi_atom.h"
#include "atom.h"
#include "group.h"
#include "update.h"
#include "domain.... | ALGO | 0.999285 | 6.35677 |
d6ae87ff-4ef8-4d48-a0aa-b1b43087a98e | sujon-ahmed-WD/Asiment3-ok | Same_or_Not_II.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node*next;
Node*prev;
Node(int val)
{
this->val=val;
this->next=NULL;
this->prev=NULL;
}
};
class Mystack
{
public:
Node*head=NULL;
Node*tail=NULL;
int st_sz=0;
void spu... | ALGO | 0.99999 | 3.6565 |
5e5b19b2-ad94-4c07-ac70-4515cac18718 | nutan-sangani/CP-Practice | CP31/C_1_Game_on_Tree_Easy.cpp | #include <iostream>
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define forLoop for(int i=0;i<n;i++)
#define pii pair<int,int>
#define pb push_back
#... | ALGO | 0.999801 | 4.12868 |
5185f697-9d60-4be8-af1f-1822b9a01a5b | PrasadG193/Spoj | ispoj_SHOP.cpp | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **
* Author : Prasad J Ghangal *
* Title : Spoj-Shopping *
* Category : Shortest Path *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <que... | ALGO | 0.9997 | 3.304199 |
b57f3837-5676-4ce3-8239-905cbfc62c86 | jotredi/Path_Planning | src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Eigen::MatrixXf m(2,4);
Eigen::VectorXf v(2);
m << 1, 23, 6, 9,
3, 11, 7, 2;
v << 2,
3;
MatrixXf::Index index;
// find nearest neighbour
(m.colwise() - v).colwise().squaredNorm()... | ALGO | 0.999885 | 4.138078 |
5a578fb6-2bcb-4f7b-af5b-b42a0a3b96c6 | BBB965/BAEKJOON_ALGORITHM | 프로그래머스/lv2/92342. 양궁대회/양궁대회.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> answer;
int lyan[11] = {0,};
int appeach[11] = {0,};
int gap = 0;
void find_ans(int idx, int N)
{
if (N == 0)
{
int sumL = 0;
int sumA = 0;
for (int i = 0; i < 11; i++)
{
if (lyan[i] > appeach[i]) ... | ALGO | 0.999914 | 4.594774 |
c8db077c-5ebb-4ce9-af7d-d551e32346f2 | li-zihang/neon_learning | 3rdparty/android-ndk-r17c/sources/third_party/shaderc/third_party/spirv-tools/source/opt/propagator.cpp | #include "propagator.h"
namespace spvtools {
namespace opt {
void SSAPropagator::AddControlEdge(const Edge& edge) {
ir::BasicBlock* dest_bb = edge.dest;
// Refuse to add the exit block to the work list.
if (dest_bb == ctx_->cfg()->pseudo_exit_block()) {
return;
}
// Try to mark the edge executable. I... | ALGO | 0.986809 | 7.683536 |
2c734e67-d3ab-4a7b-9d57-e513ea2e07cb | newtorob/CS161 | Week3/minmax.cpp | /*********************************************************************
** Author: Robert Newton
** Date:07/01/2016
** Description:minmax.cpp -- program asks the user for a set of integers, the program then find the highest number and assigns it to max, then we find the lowest and assign it to min.
*********************... | ALGO | 0.99765 | 4.455285 |
5d0cce1b-373d-48be-9e52-f2f01428c760 | rishabhgupta03/CPP | Soft Drinking.cpp | #include<bits\stdc++.h>
using namespace std;
int main()
{
int n,k,l,c,d,p,nl,np;
cin>>n>>k>>l>>c>>d>>p>>nl>>np;
int a = (k*l)/nl;
int b = c*d;
int s = p/np;
cout<<(min(min(a,b),s))/n;
return 0;
}
| ALGO | 0.999561 | 3.352996 |
906413dc-2691-4f3d-bb20-5351e6c1bbfe | reguelpangrib29/PetrukUTP | Responsi UTP/function.cpp | #include <iostream>
#include <cmath>
using namespace std;
double luasLingkaran(double r){
double pi = M_PI;
return pi*r*r;
}
int main (){
double r;
cin >> r;
cout << "Luas lingkaran : " << luasLingkaran(r);
return 0;
} | ALGO | 0.992027 | 4.430292 |
ee2fc72a-c1bb-4533-a9e9-6c0482ae1471 | EliasSecurity/bookFlutter | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
a3709432-77fc-4006-ac5a-41bf3cc210d4 | Vory7/Siaod | SiaodTree2/SiaodTree2/SiaodTree2.cpp | #include <iostream>
#include <time.h>
#include <iomanip>
int numb = 1;
struct BranchTree {
int Data;
int NumVertex;
BranchTree* LeftBranch;
BranchTree* RightBranch;
};
BranchTree* AddVertex2(int* const arr, BranchTree*& aBranchTree, int L, int R)
{
if (L > R) {
return NULL;
}
else... | ALGO | 0.999543 | 4.454414 |
16c719f1-9153-492f-8999-48428fef5f8d | architkl/The-Box | codeforces/1288A.cpp | /*
Author: architkl
Language: C++ 14
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <iomanip>
#include <climits>
#include <string>
#include <cstring>
#include <cma... | ALGO | 0.999576 | 4.944602 |
2bc59eaf-37a3-4d25-9664-9c126313be35 | chain-smok/calculate | selectionsort.cpp | #include <iostream>
using namespace std;
void selection_Sort(int arr[] , int size){
int temp , length = size;
for(int i = 0; i < size ; i++){
for(int j = i + 1; j < size ; j++){
if(arr[i] > arr[j]){
temp = arr[j];
arr[j] = arr[i];
arr[i] = temp... | ALGO | 0.999908 | 3.905715 |
3929ffa4-d35d-47be-83ae-dbf438a18bad | raincross7/code-similarity | codes/train_code/problem311/problem311_494.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
int N;
cin >> N;
vector<int> t(N);
vector<string> s(N);
REP(i, N){
cin>> s[i] >> t[i];
}
string X;
cin >> X;
int cnt=0;
RE... | ALGO | 0.999715 | 3.684863 |
164bf1ab-c9fb-49a0-af91-5c390b30474f | tiqwab/atcoder | abc184/d/main.cpp | #include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <limits.h>
using namespace std;
typedef long long ll;
template<class T>
inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
... | ALGO | 0.999403 | 4.184422 |
d0744cdf-8328-4827-879f-94a270209ee7 | sarvex/leetcode-coffeescript | solution/1500-1599/1594.Maximum Non Negative Product in a Matrix/Solution.cpp | using ll = long long;
const int mod = 1e9 + 7;
class Solution {
public:
int maxProductPath(vector<vector<int>>& grid) {
int m = grid.size();
int n = grid[0].size();
vector<vector<vector<ll>>> dp(m, vector<vector<ll>>(n, vector<ll>(2, grid[0][0])));
for (int i = 1; i < m; ++i) {
... | ALGO | 0.999987 | 5.124146 |
7426637c-e675-4ec8-830c-722a3755d6a1 | 0-jij-0/CompetitiveProgramming | Pre-Written Code/Data Structures/Explicit Treap.cpp | //Treap implementation of multiset
#include <bits/stdc++.h>
using namespace std;
struct node {
int val, priority, size; //size accounts for duplicates here
int freq;
node *l = NULL, *r = NULL;
node() {}
node(int v) :val(v), priority(rand()), l(NULL), r(NULL), size(1), freq(1) {}
void updateSize() {
size = f... | ALGO | 0.999956 | 5.033021 |
b6ecd313-73f6-4b19-b752-29d32b8ab151 | kaixih/layer_norm | eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
std::cout << "Column's maximum: " << std::endl
<< mat.colwise().maxCoeff() << std::endl;
}
| ALGO | 0.999701 | 3.779679 |
5ae3f804-69a5-4058-9ac6-471f2f1c9607 | AllianceRom/android_frameworks_av | media/libstagefright/codecs/amrwb/src/dec_gain2_amr_wb.cpp | /*
------------------------------------------------------------------------------
Filename: dec_gain2_amr_wb.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------------------------------------------------------... | ALGO | 0.999274 | 4.735946 |
5c48cbd1-2cc3-4d8e-bb1e-ebd99dfd6b42 | h2ssh/Vulcan | src/mpepc/social/topo_agent.cpp | /**
* \file topo_agent.cpp
* \author Collin Johnson
*
* Definition find_topo_agents function.
*/
#include <mpepc/social/topo_agent.h>
#include <hssh/local_topological/area.h>
#include <hssh/local_topological/local_topo_map.h>
#include <tracker/dynamic_object_collection.h>
#include <tracker/dynamic_object_visitor... | ALGO | 0.982264 | 7.493537 |
2791e8ca-bd6d-4fc3-a0e6-ea1a73bd68a9 | akssingh0102/Workspace | DSA and Competitive Programming/Coding Platforms/Code Forces/Rounds/Round 723/A.cpp | #include<iostream>
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define ll long long int
#define llmin -1e18
#define ff first
#define ss second
#define pb push_back
#define vi ... | ALGO | 0.998818 | 3.25899 |
8f606e36-4d17-4172-88ac-b2cb7fc8d012 | jieqiboh/questions | leetcode/2054.TwoBestNonOverlappingEvents/main.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <bitset>
#include <utility>
#include <numeric>
#define ll long long
using namespace... | ALGO | 0.999914 | 5.965205 |
9685a919-cb7f-4272-b760-24d58292660b | younglee0207/Gaggum | ros2/src/navigation2/nav2_amcl/src/sensors/laser/beam_model.cpp | #include <math.h>
#include <assert.h>
#include "nav2_amcl/sensors/laser/laser.hpp"
namespace nav2_amcl
{
BeamModel::BeamModel(
double z_hit, double z_short, double z_max, double z_rand, double sigma_hit,
double lambda_short, double chi_outlier, size_t max_beams, map_t * map)
: Laser(max_beams, map)
{
z_hit_ = ... | TOOL | 0.946838 | 6.898676 |
04f32872-5deb-4af3-9842-d29077ea2ad8 | OrionOS-prjkt/android_bootable_recovery | otautil/verifier.cpp | #include "otautil/verifier.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <functional>
#include <memory>
#include <vector>
#include <android-base/logging.h>
#include <openssl/bio.h>
#include <openssl/bn.h>
#include <openssl/ecdsa.h>
#include <openssl/ev... | TOOL | 0.885142 | 7.504594 |
b0e91ad4-2ebf-47f6-9ca1-1b4367692810 | DermicX/ExamenFinalC- | Ejerecicio4.cpp | #include <iostream>
using namespace std;
int main() {
float numero1, numero2;
cout << "Introduce el primer numero: ";
cin >> numero1;
cout << "Introduce el segundo numero: ";
cin >> numero2;
if (numero1 > numero2) {
cout << "El primer numero (" << numero1 << ") es mayor que el segund... | TOOL | 0.96425 | 3.571388 |
99e5a3aa-6fcd-4e4e-ac68-6689e15074d0 | DmitryStarodumov/TourOptimizer | main.cpp | #include <iostream>
#include <vector>
#include <algorithm> // Для std::find и std::rotate
#include "Point.hpp"
#include "FinalTourOptimizer.hpp"
#include "utils.hpp"
const int NUM_POINTS = 100; //общее количество точек
const double RADIUS = 10.0; //радиус окружности по условию не определен, поэтому используем 10 по де... | ALGO | 0.999673 | 5.637054 |
75b1d830-0460-464a-b57e-fab5be14b426 | SnehaKumari3/codeforces_practice_problems | B_Robots.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typede... | ALGO | 0.999849 | 4.29068 |
6b8a4f88-9a24-4c85-aa8b-22bbcf8365ea | SCUTykLin/PracticeAlgorithm | Leecode/1319.cpp | //
// Created by GreenArrow on 2020/7/27.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
vector<bool> visited;
vector<vector<int>> graph;
int makeConnected(int n, vector<vector<int>> &connections) {
if (connections.size() < n - 1) {
... | ALGO | 0.999906 | 5.714856 |
7ac71fcf-97d3-4556-86e8-e1cb1d081213 | ts0ra/rebirth_internal | src/utils.cpp | #define _USE_MATH_DEFINES
#include "utils.h"
#include "enums.h"
#include "data.h"
#include <cmath>
#include <algorithm>
#include <iostream>
namespace utils
{
bool worldToScreen(const Vector3& pos, Vector2& screen, const int& width, const int& height)
{
Vector4 clipCoords{};
data::game::mvpmat... | TOOL | 0.974911 | 6.09599 |
732b3b0e-4552-45b6-9f80-b16b63533c1d | 2019331043-Zakaria/Codes | CB/E_Binary_Inversions.cpp | /*
* @Author: Zakaria
* @Date: 2022-11-21 20:44:41
* @Last Modified time: 2022-11-21 20:57:52
*/
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define pi acos(-1.0)
#define LCM(a,b) a*b/__gcd(a,b)
#define GCD(a,b) __gcd(a,b)
#define ... | ALGO | 0.999955 | 4.845449 |
e941e6f1-fad9-4994-998c-80108c98565b | Nayabkhan123/Accenture_Coding_Questions | 509_FibonacciNumber.cpp | //Iterative Method
class Solution {
public:
int fib(int n) {
if(n==0||n==1){
return n;
}
int a=0;
int b=1;
int c=0;
for(int i=1;i<n;i++){
c=a+b;
a=b;
b=c;
}
return c;
}
};
//Recursive Method
class Sol... | ALGO | 0.999979 | 6.263916 |
c91c53cd-cb62-4fac-8fc4-640ef8e30227 | powellsr/small_cxx_projects | grocery_totaler.cpp | #include <iostream>
#include <vector>
int main() {
std::vector<double> delivery_order;
delivery_order.push_back(8.99);
delivery_order.push_back(3.75);
delivery_order.push_back(0.99);
delivery_order.push_back(5.99);
// Calculate the total using a for loop:
double total = 0.0;
// Since inde... | ALGO | 0.998945 | 5.354367 |
d3830f51-9b31-4b7f-a5ca-01aaf20c3072 | RaymondCvoz/ProgrammingContest | codeforces935B.cpp | #include <iostream>
#include <algorithm>
#include <string>
std::string s;
int main()
{
int n,x = 0,y = 0,px = 0,py = 0;
std::cin >> n >> s;
int ans = 0;
for(int i = 0;i < s.length();i++)
{
if(s[i] == 'U')
{
if(px > py && y + 1 > x)
{
ans ++; ... | ALGO | 0.999669 | 3.477379 |
8a2939f6-f33a-4282-808b-3f04e29abf42 | Ui-jae-Gwon/my_portfolio | Baek_10818.cpp | #include <iostream>
using namespace std;
int main(void)
{
int array_num;
cin >> array_num;
int *array = new int[array_num];
for(int i=0; i<array_num; i++)
{
int insert_array;
cin >> insert_array;
array[i]=insert_array;
}
int min, max;
for(int i=0; i<ar... | ALGO | 0.999879 | 3.958711 |
758a2c44-c8ee-4df1-9a60-fab5c5cd8e01 | Aanish2/C-DSA | 09 Recursion/fibonacci.cpp | #include<iostream>
using namespace std;
int fib(int n){
if(n==0 or n==1){
return n;
}
int f1 = fib(n-1);
int f2 = fib(n-2);
return f1 + f2;
}
int main(){
int n;
cin>>n;
cout<<fib(n) <<endl;
} | ALGO | 0.99999 | 4.782676 |
3ae43e6e-8063-4cc4-9382-2856bdf7e965 | Shivanshbajpai31/DSA-C---Advanced | L-33_Recursions_and_BinarySearch/3_linear_search.cpp | #include<bits/stdc++.h>
using namespace std;
void print (int arr[], int n){
cout << "Size of array is : " << n << endl;
for (int i=0 ; i<n ;i++){
cout << arr[i] << " " ;
} cout << endl;
}
bool linearSearch(int arr[], int size, int k){
print (arr,size);
// base case
if (size==0)
... | ALGO | 0.999805 | 4.370414 |
584cd8f8-3889-4e74-9869-adc29f1128bf | Neeraj-2625/GFG-potd | 22-Dec-2024/solution.cpp | // User function template for C++
class Solution {
private:
bool isPoss(vector<vector<int>> mat,int row,int k,int m){
int s = 0;
int e = m-1;
while(s<=e){
int mid = s + (e-s)/2;
if(mat[row][mid] == k)
return true;
... | ALGO | 0.999948 | 5.360049 |
fd9216a7-bcd0-452a-b681-14cc0216667b | raincross7/code-similarity | codes/train_code/problem225/problem225_459.cpp | #include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>
using namespace std;
typedef u... | ALGO | 0.999937 | 3.691617 |
d9a851cf-04f1-4bd6-8bc6-af36bd4d4ba9 | MrCopperrrr/Data_Structures_and_Algorithms_243_Lab | Lab 2/main.cpp | #include "List.cpp"
#include <iostream>
using namespace std;
int main() {
List<int> myList;
// 3.3
myList.insert(0, 12);
myList.insert(1, 5);
myList.insert(2, 79);
myList.insert(3, 82);
myList.insert(4, 21);
myList.insert(5, 43);
myList.insert(6, 31);
myList.insert(7, 35);
myList.insert(8, 57);
// 3.4
... | TOOL | 0.852055 | 3.792605 |
0c3260aa-c2c0-4133-adb2-beda1f3c1a84 | aahmad8727/quiz | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
3a63b9ed-c1f0-4e95-813b-6d06c0bfd423 | bol-edu/2022-spring-nthu | Lab_A_UG871/DCT_HLS_Optimization/src/dct.cpp | #include "dct.h"
void dct_1d(dct_data_t src[DCT_SIZE], dct_data_t dst[DCT_SIZE])
{
unsigned int k, n;
int tmp;
const dct_data_t dct_coeff_table[DCT_SIZE][DCT_SIZE] = {
#include "dct_coeff_table.txt"
};
DCT_Outer_Loop:
for (k = 0; k < DCT_SIZE; k++) {
DCT_Inner_Loop:
for(n = 0, tmp = 0; n < DCT_SI... | ALGO | 0.999203 | 5.794418 |
4cc880ed-9be5-47b8-904a-f67ce0f64f3d | luwei0917/GlpG_Nature_Communication | src/USER-EFF/compute_ke_atom_eff.cpp | /* ----------------------------------------------------------------------
Contributing author: Andres Jaramillo-Botero
------------------------------------------------------------------------- */
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "compute_ke_atom_eff.h"
#include "atom.h"
#include "u... | ALGO | 0.998869 | 4.949382 |
7ee04559-7ca5-4e1a-8661-2644ed25cbbe | guilhermehencus/Linguagem_C | Exercicios_C_Complemento/Ex_2.cpp | #include <stdio.h>
#include<locale.h>
/* Exercicio 2 par em um intervalo */
int main()
{
setlocale(LC_ALL,"Portuguese");
int val;
int val2;
printf ("Escreva o primeiro valor do intervalo: \n");
scanf("%d",&val);
printf ("Escreva o segundo valor do intervalo:\n");
scanf("%d",&val2);
if(val<=val2){
while (val<=val2)
{ ... | ALGO | 0.999116 | 3.016939 |
55461df8-5818-48ec-956f-0bab85845e9e | HG-IMMORTALS/GFG-POTD | Difficulty: Easy/N meetings in one room/n-meetings-in-one-room.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to find the maximum number of meetings that can
// be performed in a meeting room.
int maxMeetings(int n, int start[], int end[]) {
// Your code here
vector<pair... | ALGO | 0.999922 | 6.023821 |
fe0d965a-cb34-4e99-ba7e-66f0c573a695 | golaced/RL_Boy | 下位机代码/Linux/control_task2/eigen/bench/quat_slerp.cpp | #include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Q>
EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t)
{
return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized());
}
template<typename Q>
EIGEN_DONT_INL... | ALGO | 0.965482 | 6.251058 |
537e8b96-2edf-40d8-b739-64e12af80564 | Christinahak/graphs | graphs/graph.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
class undirected_Graph {
public:
undirected_Graph(int size) : adj(size,std::vector<int>(0)), size(size) {}
undirected_Graph() : adj(0,std::vector<int>(0)), size(0) {}
void addEdge(int u, int v);
void addVertex(int u = 0);
void bfs(int v);... | ALGO | 0.999695 | 5.301722 |
cdd44876-2b4b-4847-a640-c0c94eb1ed45 | rahultejus/DSA_Problem_Solving | SORTING/Segregate_two_array_elements_with_linear_aux_space.cpp | #include<bits/stdc++.h>
using namespace std;
void segregate_array_elm(int arr[],int n)
{
int i=-1,j=n;
while(true)
{
do{
i++;
}while(arr[i]%2==0);
do{
j--;
}while(arr[j]%2==1);
if(i>=j)
return;
swap(arr[i],arr[j]);
}
}
voi... | ALGO | 0.999902 | 4.33668 |
b824dbe9-6acb-4498-9222-26327c1b1cd0 | MoominKim/BaekJoon | 트리의지름.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <cstring>
#define ll long long
using namespace std;
vector<pair<int,ll> > tree[100100];//연결된점,거리
int chk[100100];
int Max;
int Maxidx;
void DFS(int start,int val)
{
chk[start] = 1;
if(val > Max)
{
Max = val;
Maxidx = start;
}
for(int i = 0... | ALGO | 0.9997 | 3.57772 |
e375d278-3b18-4715-892c-1395f4f70d60 | Pismice/HonGainzClient | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
f2d1d4ad-b54b-4cde-880f-d8b026095419 | sxyugao/Codes | Luogu/P1498/P1498.cpp | #include <cstdio>
#include <iostream>
using namespace std;
bool f[1 << 10] = {1};
int main(){
int n;
scanf("%d", &n);
for(int i = 0; i < (1 << n); i++) {
for(int j = 1; j < (1 << n) - i; j++) putchar(' ');
for(int j = i; ~j; j--) f[j] ^= f[j - 1];
if(i & 1) {
for(int j = 0; j <= i; j += 2)
if(f[j]) prin... | ALGO | 0.99954 | 3.194712 |
2a437c26-4234-4488-a277-8c0b5d23bd51 | ishandutta2007/codeforces | normie28/normal/187/D.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define fef(i,a,b) for(ll i=a;i<=b;i++)
#define rer(i,a,b) for(ll i=b;i>=a;i--)
#define wew while(true)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize... | ALGO | 0.999859 | 3.179718 |
2ab54216-ec3a-4cb7-b3a3-fdd46c1022c1 | Bahubuli/DSA | 968-binary-tree-cameras/968-binary-tree-cameras.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.999896 | 6.745162 |
9eb614b7-d84c-485c-804b-ab4769ef371c | KaiEureka/AIdiy | 数学/code/poly/comp-rev/comp_1.cpp | #include <cassert>
#include <cstdio>
#include <tuple>
#include <utility>
#include <vector>
using uint = unsigned;
using ull = unsigned long long;
constexpr uint MOD = 998244353;
constexpr uint PowMod(uint a, ull e) {
for (uint res = 1;; a = (ull)a * a % MOD) {
if (e & 1) res = (ull)res * a % MOD;
if ((e /= ... | ALGO | 0.999987 | 4.648585 |
87fab171-085c-49ac-a06d-113ece2eab25 | ACM1966/CSC3100 | A4/P2.cpp | #include<bits/stdc++.h>
#define INF 10001
using namespace std;
int main() {
int N, w;
cin >> N >> w;
int A[N][N];
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
cin >> A[i][j];
if (A[i][j] > w ||A[i][j]==0) {
A[i][j] = w;
}
... | ALGO | 0.999987 | 3.762545 |
24b9e7f9-daf1-4010-964a-7366cbc5776e | itsAMd22/Competitive_Programming | Phase 1/Part 2/Class 1/Theory/4.BinSearch_MinMax.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5+6;
ll a[N+N], n, k, total = 0, mx = 0;
bool check(ll sum){
ll ct = 0, tmp = 0;
mx = 0;
for(int i=0;i<n;i++){
tmp += a[i];
if(tmp > sum) mx = max(mx, tmp - a[i]), ct++, tmp = a[i];
else if(tmp ... | ALGO | 0.999969 | 3.967291 |
16d90393-82fc-4a5d-977b-fc2e3061017a | Kennyarlexy/Competitive-Programming-Junior-Training-Sheet | C1/WanderingQueen/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
void fast_io() {
ios_base::sync_with_stdio(0);
cin.tie(0);
}
int n, m;
char grid[1005][1005];
int dist[1005][1005]; //basically minimum dist, vis array won't be used as you want to visit a grid more than once if it's valid
int dr[] = {1, 1, 0... | ALGO | 0.999887 | 5.457209 |
bbb90181-ee62-46b0-9f88-b3d092d7bd27 | AhJo53589/leetcode-cn | problems/min-cost-to-connect-all-points/SOLUTION.cpp |
//////////////////////////////////////////////////////////////////////////
class Solution {
public:
int minCostConnectPoints(vector<vector<int>>& points) {
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
vector<bool> vi(points.size(), false);
int n = ... | ALGO | 0.999956 | 5.86604 |
4fcad284-c577-433c-accf-c2299c0d4d46 | RealityVirtually2019/ComposAR | CNNServer/Fusion/3rdparty/libigl/include/igl/per_vertex_point_to_plane_quadrics.cpp | IGL_INLINE void igl::per_vertex_point_to_plane_quadrics(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const Eigen::MatrixXi & EMAP,
const Eigen::MatrixXi & EF,
const Eigen::MatrixXi & EI,
std::vector<
std::tuple<Eigen::MatrixXd,Eigen::RowVectorXd,double> > & quadrics)
{
using namespace std;
... | ALGO | 0.99656 | 6.061336 |
37edbc05-6790-49f9-998f-15ec469e02cb | 0-JackFrost-0/CS101-2025-Solutions | lab6-quiz/courseAllocation.cpp | // Author: 0-JackFrost-0
// Date: 24/2/25
#include<simplecpp>
int main(){
char degree, courseType;
bool isValid;
int year;
cin >> degree >> year >> courseType;
if(degree == 'b'){
// isValid computation for btech
isValid = (year == 1 && courseType == 'i') ||
(year ... | ALGO | 0.974839 | 4.73205 |
069a053b-0d5d-4402-bce0-ccb9f65e9561 | GKD-RM-Lab/OpenRM2024-gkd | src/kalman/trackqueueV4.cpp | #include "kalman/interface/trackqueueV4.h"
#include <iostream>
#include <memory>
#include <algorithm>
#include <cmath>
#include "utils/print.h"
#include "uniterm/uniterm.h"
using namespace rm;
using namespace std;
// [ x, y, z, v, vz, angle, w, a ] [ x, y, z ]
// [ 0, 1, 2, 3, 4, 5, 6, 7 ] [ 0, 1, 2 ]
static... | ALGO | 0.983322 | 5.534713 |
0cc58e58-a802-455b-bfb9-997e5a2aeb7e | gabsnim/AEDS_I | 17/ed17.cpp | /*
Aluno: Gabriel Xavier Borges
Matricula: 805347
atividade finalizada
*/
// dependencias
#include <iostream> // std::cin, std::cout, std:endl
#include <limits> // std::numeric_limits
#include <string> // para cadeias de caracteres
#include "list.hpp"
// ----------------------------------------------- definico... | TOOL | 0.971464 | 4.277733 |
f286fa5a-ed4a-45a6-b593-7b975579268a | ahao214/Algorithm | Ahao.LeetCodeCPP/306. 累加数.cpp | #include<vector>
#include <string>
using namespace std;
/*
306. ۼ
ۼ һַֿγۼС
һЧ ۼ 3 ʼ⣬еÿֱ֮ǰ֮͡
һֻ '0'-'9' ַдһ㷨жϸǷ ۼ ǣ true false
˵ۼ 0 ֮⣬ 0 ͷԲ 1, 2, 03 1, 02, 3
*/
class Solution {
public:
string add(string x, string y)
{
vector<int> A, B, C;
for (int i = x.size() - 1; i >= 0; i--) A.push_back(x[i] -... | ALGO | 0.99967 | 5.9378 |
a6fc0799-9af9-4f14-8036-de084e38eb69 | Gandoler/Evm_labs | lab1/5.cpp | #include <iostream>
#include <iomanip>
#include <cstdint>
const int N = 5;
int main() {
uint16_t Ms[N] = {0xFADE, 0xFADE, 0xFADE, 0xFADE, 0xFADE};
// Вывод адресов элементов массива
printf("Address of the beginning of the array M: %p\n", (void*)Ms);
printf("Address of the first element of the array M... | TOOL | 0.982029 | 5.153277 |
5ab4ac9f-84ef-4997-8f84-0ee6a75b5397 | jincheng-ai/ros-melodic-python3-opencv4 | xacro/orocos_kinematics_dynamics/orocos_kdl/src/chainiksolvervel_pinv_givens.cpp | // Version: 1.0
// Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// URL: http://www.orocos.org/kdl
#include "chainiksolvervel_pinv_givens.hpp"
#include "utilities/svd_eigen_Macie.hpp"
namespace KDL
{
ChainIkSolverVel_pinv... | ALGO | 0.997849 | 6.108738 |
1cd47e55-39cf-4256-a790-8b74bc651a5f | hrushikesh430/Striver-CP-sheet | maths/3cp.cpp | #include<bits/stdc++.h>
using namespace std;
void solve()
{
int a;
cin >> a;
if(a%2==0)
cout << "Mahmoud" << endl;
else
cout << "Ehab" << endl;
}
int main()
{
// int t;
// cin >> t;
// while(t--)
solve();
} | ALGO | 0.999838 | 3.693537 |
8f6c8700-8055-4b4f-b0a7-813ab57b34ea | PreInvisibleGuy/Bruh | SUM2K.Cpp | #include<bits/stdc++.h>
using namespace std;
long long n,k,a[100001],s=0;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
freopen("Sum2K.Inp ","r",stdin);
freopen("Sum2K.Out ","w ",stdout);
cin>>n>>k;
for(int i=1;i<=n;i++)
cin>>a[i];
sort(a+1,a+1+n);
int l=1,r=n,m=(l+r)/2;... | ALGO | 0.999955 | 3.697089 |
18e7514d-d079-45e0-95b9-72aa97c9015d | UITshirodoragon/DSA-UIT | Big number/test.cpp | #include <iostream>
#include <cmath>
using namespace std;
struct PHANSO
{
int tu, mau;
};
// bổ trợ
int gcd(int a, int b)
{
a = abs(a);
b = abs(b);
while (a*b != 0) {
if(a > b)
a %= b;
else
b %= a;
}
return a + b;
}
int lcm(int a, int b)
{
a = abs... | ALGO | 0.998674 | 4.466876 |
047fcca9-7b53-47b5-a090-238b3dbcb6a6 | SamIam9640/codetree-TILs | 240310/격자 반대로 채우기/grid-anti-fill.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int arr[100];
int new_arr[100];
int cnt = 0;
for (int i = 0; i < 100; i++) {
cin >> arr[i];
if (arr[i] == 0) {
cnt = i;
break;
}
if (arr[i] % 2 == 0) {
new_arr[i] = arr[i] / ... | ALGO | 0.999996 | 4.671065 |
dd3e60f7-27da-4a73-956b-0f064d82f533 | minhnguyen28204/CS162 | W09/22125058_Ex01/Function.cpp | #include <fstream>
void EnterArray(std::ofstream &ofs, int n, int* arr){
if (ofs.is_open()){
ofs.write(reinterpret_cast<char*>(&n), sizeof(n));
for(int i=0; i<n; i++){
ofs.write(reinterpret_cast<char*>(&arr[i]),sizeof(arr[i]));
}
}
}
int GetMedian(int n, int* arr){
for(... | ALGO | 0.993381 | 4.505637 |
80b4fbaa-7cf2-479a-a28c-33b1fb6e078a | gnarayan1337/CompetitiveProgramming | usaco/contests/2014-15/feb 2015/bronze/censoring.cpp | // author : gautam narayan
// approach: we slowly build the string and remove substrings accordingly
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
freopen("censor.in", "r", stdin);
freopen("censor.out", "w", stdout);
string s, t, ss{};cin>>s>>t;
for ... | ALGO | 0.999954 | 4.225634 |
6aea1142-8cb1-40d7-9555-333c9b503e94 | MahmoudZaytoni/learning | data-structures/DSU/codeforces_1753C.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <cstring>
#define sz(v) ((int)((v).size()))
#define all(v) ((v).begin()),((v).end())
using namespace std;
typedef long long ll;
class UnionFind {
vector<int> root;
publ... | ALGO | 0.999988 | 4.355934 |
44ba2087-db1d-4788-9693-423f0ae4884b | kapil-goyal/Data-Structure-Lab | 3/160101039_OA3_1.cpp | #include <bits/stdc++.h>
using namespace std;
//struct for linked lists
struct node
{
int data;
node * next;
};
//This function creates and allocates memory to a node.
node *createnode(int d)
{
node *temp = new node;
temp->data = d;
temp->next = NULL;
}
//This function will print the linked list. (Just for che... | ALGO | 0.99979 | 4.108743 |
6fd19f53-30d0-4dbd-baac-054e2327628d | ishandutta2007/codeforces | leopro/normal/1667/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve();
int32_t main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int t = 1;
// cin >> t;
do { solve(); } while (--t);
return 0;
}
void solve() {
int n;
cin >> n;
vector<ll> a(n);
for (ll &x: ... | ALGO | 0.999978 | 3.835967 |
65be073a-10f6-48cd-b671-a537d52705b0 | heavenMOJANG/ICPC | .history/Codeforces/CF2039/C_20241123232033.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
void solve() {
int x, m; cin >> x >> m;
set<int> fac;
for (int i = 1; i <= sqrt(x); ++ i) {
if (x % i) contin... | ALGO | 0.999947 | 5.721208 |
2a5834e0-afa5-4ff0-8a0b-37b5806040dc | AchyutPandey/LeetCode | 0701-insert-into-a-binary-search-tree/0701-insert-into-a-binary-search-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999994 | 6.274209 |
43892935-ab83-4e76-adc1-779e03c51f53 | sicongyu/Unreal-Lightmass-SH-based-GI | Engine/Source/ThirdParty/IntelTBB/IntelTBB-4.4u3/src/perf/fibonacci_impl_tbb.cpp | #include <cstdio>
#include <cstdlib>
#include "tbb/task_scheduler_init.h"
#include "tbb/task.h"
#include "tbb/tick_count.h"
extern long CutOff;
long SerialFib( const long n ) {
if( n<2 )
return n;
else
return SerialFib(n-1)+SerialFib(n-2);
}
struct FibContinuation: public tbb::task {
lon... | ALGO | 0.999605 | 4.705167 |
7cf2d9a0-d7d6-4834-8855-40ce7acf99cc | CyberBoyAyush/gfg | Difficulty: Easy/Swap and Maximize/swap-and-maximize.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// long long int maxSum(int arr[], int n);
// } Driver Code Ends
class Solution {
public:
long long maxSum(vector<int>& arr) {
sort(arr.begin(),arr.end());
int n=arr.size();
vector<int>narr(n);
int i=0;
... | ALGO | 0.998978 | 6.160127 |
87339722-7d44-4b1e-a44c-22ab23122dde | Ahyoung-Kim/BOJ | 11052.cpp | #include<iostream>
#include<queue>
#include<algorithm>
#include<cstdlib>
using namespace std;
int dp[1001] = { 0, };
int p[10001];
int main(void) {
int n;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> p[i];
dp[1] = p[1];
for (int i = 2; i <= n; i++) {
int maxnum = p[i];
for (int j = i - 1; j >= i / 2... | ALGO | 0.999847 | 3.556428 |
32799cc6-5d00-4751-ae05-27993ff2b80f | vedeninvv/Algorithms | lab 5/a1.cpp | #include <iostream>
using namespace std;
struct Node {
int* value;
Node *next_node;
};
int hash_func(int value) {
return abs(value % 500000);
}
void add(int value, Node **current_node) {
bool flag = false;
Node* cur_node = *current_node;
Node* last_node = cur_node;
while (cur_node != nul... | ALGO | 0.999567 | 4.552221 |
8833020b-369b-4ea9-902f-0ee387dcef21 | LearnWithDalle/Data-Structures-and-Algorithms-in-C- | Day_06/patten07.cpp | #include <iostream>
using namespace std;
int main()
{
/*
*
* *
* * *
* * * *
*/
int n;
cout << "Enter the value of N: ";
cin >> n;
int i = 1;
int start = 1;
while (i <= n)
{
int space = n - i;
while (space)
{
... | ALGO | 0.999881 | 4.3041 |
72bd887e-ecb3-4d1e-87d2-50a045cce3d5 | A-Ariyanuchitkul/I2P2-MiniProject3-Gomoku | AlphaBeta3.cpp | #include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <array>
#include <set>
#include <limits>
#include <unordered_map>
#include <queue>
enum SPOT_STATE {
EMPTY = 0,
BLACK = 1,
WHITE = 2
};
const int SIZE = 15;
const int INF = std::numeric_limits<int>::max()/16; //To prevent ... | ALGO | 0.999658 | 4.377605 |
9f13e86d-013f-424b-aea8-d760c33278e5 | Piyushhh786/DSA_with_CPP | IfElse/greatestOfThree.cpp | #include<iostream>
using namespace std;
int main(){
int a,b,c;
cout<<"enter 1st number";
cin>>a;
cout<<"enter 2nd number";
cin>>b;
cout<<"enter 3rd number";
cin>>c;
if(a>b){
if(a>c){
cout<<"1st number is greatest : "<<a;
}
else{
cout<<"3rd ... | ALGO | 0.999823 | 3.497852 |
5535b6d5-4186-4e04-9f90-50e5f24a4186 | bmltera/moon-lander | src/Octree.cpp | #include "Octree.h"
//draw a box from a "Box" class
//
void Octree::drawBox(const Box &box) {
Vector3 min = box.parameters[0];
Vector3 max = box.parameters[1];
Vector3 size = max - min;
Vector3 center = size / 2 + min;
ofVec3f p = ofVec3f(center.x(), center.y(), center.z());
float w = size.x();
float h = size... | ALGO | 0.966462 | 6.140177 |
c946b892-ecd6-4d38-9f14-5868c961b95f | Chitti-07/DSA-C-Plus-Plus | Codes/37.Min_Cost_To_Move_Chips.cpp | // We have n chips, where the position of the ith chip is position[i].
// We need to move all the chips to the same position. In one step,
// we can change the position of the ith chip from position[i] to:
// position[i] + 2 or position[i] - 2 with cost = 0.
// position[i] + 1 or position[i] - 1 with cost = 1.
// Retu... | ALGO | 0.999915 | 6.402472 |
59a1b6d9-995f-4f5a-a1fb-d50f7bc1c0e1 | marcusjwhelan/cppcourses | advanced/passingFunToFunc/usingFunctionPointers.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool match(string test) {
return test.size() == 3;
}
// own count if
// 2nd arg is a function pointer
int countStrings(vector<string> &texts, bool (*cb)(string test)) {
int tally = 0;
for (int i = 0; i < texts.size(); i++) {
... | ALGO | 0.985881 | 5.619027 |
a78791df-44c7-4ccb-a233-31487ff025ef | shuleyu/CPP-Library-Examples | Enumerate.cpp | #include<iostream>
#include<vector>
#include<Enumerate.hpp>
using namespace std;
int main(){
// vector<size_t> p{2,4,2,5,0};
vector<double> a{1.1,2.1},b{1.2,2.2,3.2,4.2};
vector<vector<double>> p{a,b};
// Use function.
auto res=Enumerate(p);
for (auto &item:res) {
for (auto &item2:... | ALGO | 0.970248 | 4.181502 |
5e8a984a-8cf2-4986-9f2e-96d1a3226c9a | yaominzh/bookreading | DXSjcjc/chap02p10a.cpp | #include <math.h>
#include <stdio.h>
int main() {
int i, a, b, c;
for (i = 100; i <= 999; i++) {
a = i % 10;
b = i / 10 % 10;
c = i / 100;
if (pow(a, 3) + pow(b, 3) + pow(c, 3) == i)
printf("%d\n", i);
}
return 0;
}
/*
g++ chap01p02.cpp -o chap01p02 && "/Use... | ALGO | 0.999187 | 4.885959 |
dd0330b7-8886-4dfd-bfb1-9a891c89a7a6 | adad15/CAE-CPlusPlus | eigen/doc/snippets/Triangular_solve.cpp | Matrix3d m = Matrix3d::Zero();
m.triangularView<Eigen::Upper>().setOnes();
cout << "Here is the matrix m:\n" << m << endl;
Matrix3d n = Matrix3d::Ones();
n.triangularView<Eigen::Lower>() *= 2;
cout << "Here is the matrix n:\n" << n << endl;
cout << "And now here is m.inverse()*n, taking advantage of the fact that"
... | ALGO | 0.9992 | 3.70449 |
bc6c3633-56f6-4740-8246-78bbb1e71dd7 | sarthakkurothe/data_structures | arrays/countpairsinarray.cpp | /*Count Pairs in an Array
https://www.geeksforgeeks.org/problems/count-pairs-in-an-array4145/1
Given an array arr of n integers, count all pairs (arr[i], arr[j]) in it such that i*arr[i] > j*arr[j] and 0 ≤ i < j < n.
Note: 0-based Indexing is followed.
Example 1:
Input :
n = 4
arr[] = {8, 4, 2, 1}
Output :
2
Expl... | ALGO | 0.999821 | 4.630208 |
fb4dd2b7-18e6-493e-911f-565b04a836a5 | hhadzem/BosnjackaKNP | Educational Round - 116 (div 2)/Banknotes.cpp | #include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
void solve(){
int n; long long int k;
scanf("%d %lld", &n, &k);
vector<long long int> apoeni;
for(int i = 0; i < n; i++){
int temp; scanf("%d", &temp);
apoeni.push_back(pow(10,... | ALGO | 0.999496 | 3.307542 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.