uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f7346a78-ed2e-4fe5-88ea-d60dc87407be | AneeshAhuja31/DSA_Concepts | Linked_List/LLRecursiveTraversal.cpp | #include<iostream>
using namespace std;
struct Node{
int data;
Node*next;
}*head=NULL;
void Create(int A[],int n){
Node*t,*last;
head = new Node;
head->data = A[0];
head->next=NULL;
last = head;
for(int i=1;i<n;i++){
t = new Node;
t->data=A[i];
t->next=... | ALGO | 0.999839 | 5.013684 |
b10fc021-69e6-437b-9798-055571ce7133 | CSHS-CWRA/RavenHydroFramework | src/OrographicCorrections.cpp | #include "Model.h"
double UBCPreciptiationByElev(const double temp,
const double gauge_elev,
const double band_elev,
const UBC_lapse PP);
void CModel::CorrectTemp(const optStruct &Options,
force_st... | ALGO | 0.992716 | 6.423515 |
5d3b2226-aac4-4ed8-9497-6857c8d72b2f | Priyanshu-bit/Leetcode-solutions | 1822-sign-of-the-product-of-an-array/1822-sign-of-the-product-of-an-array.cpp | class Solution {
public:
int arraySign(vector<int>& nums) {
int i , count_neg = 0;
for(i=0 ; i<nums.size() ; i++)
{
if(nums[i] == 0)
return 0;
else if(nums[i] < 0)
count_neg++;
}
if(count_neg %2 == 0)
return ... | ALGO | 0.999991 | 5.380296 |
8024b50f-a0e7-489c-8335-daa765f1feea | bappasahabapi/Level-1-ProblemSet-div-3- | 02-Basic Data Structure-C++/week-7-[Queue]/m-24-(Queue)/02-Queue-templete.cpp | #include<iostream>
#include<deque>
using namespace std;
int main(){
deque<int> dq;
dq.push_back(1);
dq.push_back(2);
dq.push_front(11);
dq.push_front(22);
for( auto i:dq){
cout << i<<"-> ";
}
cout << endl;
dq.pop_back();
for( auto i:dq){
cout << i<<"-> ";
... | ALGO | 0.987463 | 4.427463 |
89a6b5ea-d8a6-4742-8bd2-600fd289243e | OpenVu/atv-6.4 | lib/gdi/region.cpp | #include <lib/gdi/erect.h>
#include <lib/gdi/epoint.h>
#include <lib/gdi/region.h>
#include <lib/base/eerror.h>
#undef max
#define max(a,b) ((a) > (b) ? (a) : (b))
#undef min
#define min(a,b) ((a) < (b) ? (a) : (b))
/*
Region code.
A region is basically a list of rectangles. In this implementation,
rectangles ... | TOOL | 0.913063 | 7.370716 |
4f784d80-1351-4465-b0da-7abb391315cb | 9Tempest/llvm-hacked | libcxx/test/std/containers/sequences/vector.bool/find.pass.cpp | // <vector>
// vector<bool>
// std::find with vector<bool>::iterator
// https://llvm.org/PR16816
#include <vector>
#include <algorithm>
#include <cassert>
#include <cstddef>
#include "test_macros.h"
TEST_CONSTEXPR_CXX20 bool tests()
{
{
for (unsigned i = 1; i < 256; ++i)
{
std::vect... | TEST | 0.986734 | 5.746491 |
4dc8657d-89f8-4ecb-b918-e11b003576da | GHeeJeon/2019-2-cpp-class | 20190924_source.cpp | #include <iostream>
#include <string>
using namespace std;
class Person {
string name, tel;
public:
Person();
string getName() { return name; }
string getTel() { return tel; }
void set(string name, string tel);
};
class PersonManager {
Person* p;
int size;
public:
PersonManager(int n) {
string name, tel;
... | TOOL | 0.941808 | 4.519671 |
3f87f382-5a5c-4e22-ac40-bcf0baf8cc31 | raincross7/code-similarity | codes/train_code/problem033/problem033_315.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
while(1){
int n;
int mi=1000001;
cin >> n;
if(n==0)break;
vector<int>a(n,0);
for(int i=0;i<n;i++){
cin >> a[i];
}
sort(a.begin(),a.end());
for(int i=1;i<n;i++){
mi=min(mi,a[i]-a[i-1... | ALGO | 0.999788 | 3.491322 |
0fe4e7fd-bca6-47a2-a335-cd72e999f7fd | pradyumn07/LeetCode | 3321-type-of-triangle/3321-type-of-triangle.cpp | class Solution {
public:
string triangleType(vector<int>& nums) {
unordered_set<int> st;
for(int i=0;i<nums.size();i++){
st.insert(nums[i]);
}
if(nums[0]+nums[1]<=nums[2] || nums[0]+nums[2]<=nums[1] || nums[1]+nums[2]<=nums[0]) return "none";
if(st.size()==3) ret... | ALGO | 0.99996 | 5.644262 |
ab583eff-c432-45af-8e83-2124dd89b466 | CS0522/Algorithm-Notes-Practice | 11_Palindromic.cpp | /**
* P436 最长回文子串
* 动态规划
*/
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
// 输入 string
string targetStr;
// dp array
// 里面只能是 1 或者 0
int **dp;
void init()
{
cout << "Input the string: " << endl;
getline(cin, targetStr);
// initialize dp array
d... | ALGO | 0.999782 | 5.016645 |
733dabf4-eb5d-4c38-a87a-f4c2c67fee81 | woohyunjng/Coding-Practice | PS/Baekjoon/18000/18448.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAX = 200001;
const int INF = 0x3f3f3f3f3f3f3f3f;
typedef array<int, 2> pr;
int N, W[MAX], V[MAX], mtree[MAX * 4], tree[MAX * 4];
vector<int> arr;
int merge(int X, int Y) { return W[Y] < W[X] ? Y : X; }
void minit(int n, int s, int e) {... | ALGO | 0.999977 | 4.164063 |
c4435f8b-6f28-4039-97fa-efc1b0088e21 | ishandutta2007/codeforces | shik/normal/707/C.cpp | // {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define... | ALGO | 0.999806 | 3.828549 |
03fa7104-deba-4374-a0de-43e52fd5ec82 | tommasobo/Uno-SC25 | sim/datacenter/main_ndp.cpp | // -*- c-basic-offset: 4; indent-tabs-mode: nil -*-
#include "config.h"
#include <sstream>
#include "clock.h"
#include "compositequeue.h"
#include "connection_matrix.h"
#include "fat_tree_interdc_topology.h"
#include "eventlist.h"
#include "firstfit.h"
#include "logfile.h"
#include "loggers.h"
#include "ndp.h"
#inclu... | TOOL | 0.900394 | 4.325884 |
ab0855a5-a1b9-4e68-9841-98acc5dcebb8 | raincross7/code-similarity | codes/train_code/problem237/problem237_167.cpp | #define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _o... | ALGO | 0.99996 | 4.062972 |
bbd91790-3ba5-42cf-a3bb-e8558f8c565c | lokitkhemka/jetFramework | src/jet/Geometry/Surface/surface2_set.cpp | #include <jet.h>
#include "surface2_set.h"
#include <algorithm>
#include <limits>
#include <vector>
namespace jet
{
SurfaceSet2::SurfaceSet2()
{}
SurfaceSet2::SurfaceSet2(const std::vector<Surface2Ptr>& others,
const Transform2& transform, bool IsNormalFlipped)
: Surface2(... | TOOL | 0.954504 | 5.439626 |
ffda3add-d41f-44bd-a2cd-eceda3c3d129 | s-spillias/EMs-with-LLMs | POPULATIONS/POPULATION_0013/BROKEN/INDIVIDUAL_QG4KWL3Z/model.cpp | #include <TMB.hpp>
// 1. Model equations are described at the end of this file.
template<class Type>
Type objective_function<Type>::operator() ()
{
// --- DATA INPUTS ---
DATA_VECTOR(Year); // Observation year (integer)
DATA_VECTOR(cots_dat); // Observed adult COTS density (indiv/m2)
DATA_VECTOR(fast_dat); //... | ALGO | 0.999564 | 6.448645 |
118e8b4d-0608-4fda-b465-faa088f7e1fa | aditya13902/Leetcode | 743-network-delay-time/743-network-delay-time.cpp | class Solution {
public:
int networkDelayTime(vector<vector<int>>& times, int n, int k) {
vector<vector<pair<int,int>>>adj(n+1);
for(auto vec:times){
adj[vec[0]].push_back({vec[1],vec[2]});
}
vector<int>dis(n+1,1e8);
dis[k]=0;
set<pair<int,int>>st;
... | ALGO | 0.999989 | 5.968622 |
cf2fb83b-2810-4eb5-af4b-91414f122260 | ishandutta2007/codeforces | duality/normal/NA/116.cpp | #define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printA... | ALGO | 0.999845 | 3.274175 |
606cc146-c194-4aa1-a28d-718478b9f8fb | CCTC-CCS-DATASTRUCT-I-2023-2024/BSIT-I-D | Activities/Activity VII/FAJARDO_ACTIVITY_VII.cpp | #include <iostream>
using namespace std;
int main(){
int num;
cout << "Enter your number" << endl;
cin >> num;
long sum =1;
for(int i=1;i<=num;i++){
sum += i;
}
cout << "The sum of all whole numbers from 1 to 10 " << num << " is " << sum << endl;
}
| ALGO | 0.992775 | 3.497953 |
81fd0313-bf34-4f80-94d9-f4cc5672458d | fopmania/CPP | test1/test1/subset.cpp | #include "stdafx.h"
#include "subset.h"
#include <vector>
#include <algorithm>
#include <vector>
using namespace std;
vector<vector<int>> subsets(vector<int> &nums) {
// write your code here
vector<vector<int> > S;
vector<int>temp;
S.push_back(temp);
int len = nums.size();
if (!len) {
return S;
}
//std::so... | ALGO | 0.999766 | 5.344978 |
0c1c6841-d05e-4e7a-9e62-27cb394dc622 | GangDangOO/Dx113D-Minecraft | D3D/Game2/OpenSimplexNoise.cpp | #include "stdafx.h"
#include <cmath>
namespace OpenSimplexNoise
{
using namespace std;
Noise::Noise()
: m_stretch2d(-0.211324865405187) //(1/Math.sqrt(2+1)-1)/2;
, m_squish2d(0.366025403784439) //(Math.sqrt(2+1)-1)/2;
, m_stretch3d(-1.0 / 6) //(1/Math.sqrt(3+1)-1)/3;
, m_squish3d(1.0 /... | ALGO | 0.998335 | 7.154571 |
83819d7b-66dc-4cf9-be0b-285db989af73 | Shishank93774/LeetCode-Solutions | 0003-longest-substring-without-repeating-characters/0003-longest-substring-without-repeating-characters.cpp | class Solution {
public:
int lengthOfLongestSubstring(string str) {
unordered_map<char, int> mp;
int ans = 0, cur = 0, lst = -1, n = str.length();
for(int i = 0; i<n; i++){
ans = max(ans, i - lst - 1);
if(mp.find(str[i]) != mp.end() and mp[str[i]] >= lst) lst = mp[str... | ALGO | 0.999955 | 6.205861 |
73e42359-f513-420d-a54a-1794ba497bed | GuidebeeGameEngine/GuidebeeGameEngine | game/src/main/jni/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp | #include <Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h>
#include <Box2D/Common/b2BlockAllocator.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Collision/Shapes/b2ChainShape.h>
#include <Box2D/Collision/Shapes/b2EdgeShape.h>
using namespace std;
b2Contact* b2ChainAndCircleContact::Create(b2Fixture* fixt... | ALGO | 0.959711 | 6.407322 |
61a8c54e-f837-4632-9e0a-fabbdd7f7ac7 | saif-gitreps/Algorithms | Implementations/Continas_duplicate.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
sort(nums.begin(),nums.end());
for(int i=1;i<nums.size();i++){
if(nums[i-1]==nums[i]){
return true;
}
}
return false;
}
};
class Solution {
public:
// apparently O(n) ... | ALGO | 0.999991 | 5.727366 |
fddafba6-0d13-425c-a66b-3954e2cbf2eb | OzairKhanBro/Bit-attay | CString.cpp | #include"stdafx.h"
#include"CString.h"
#include<iostream>
using namespace std;
CString CString::concat(const CString& s2) const
{
int l = getLenght();
int l1 = s2.getLenght();
CString ch;
int i = 0;
for (int i = 0; i < l; i++)
{
if (i >= ch.size - 1)
{
ch.at(i) = '\0';
ch.resize(size * 2);
}
ch.... | TOOL | 0.937938 | 3.550263 |
2d99e124-2962-4003-9900-795c86e9f170 | migueljarquin686/FUVI | Bateria de ejercicio C++/multiplos_alg_17.cpp | // Autor Miguel Flores
//17. Algoritmo que visualice la cuenta de los nmeros que son mltiplos de 2 o
//de 3 que hay entre 1 y 100.
#include<iostream>
using namespace std;
int main() {
int a;
int b;
int m;
m = 1;
a = 0;
b = 0;
cout << "Este algoritmo te muestra los numeros multiplos de 2 y de 3 que hay del 1 al ... | ALGO | 0.991666 | 3.461041 |
1c9705d6-c013-4681-ad31-33ba93040095 | sndrzt/mesa-21.2.6 | src/intel/compiler/brw_fs_saturate_propagation.cpp | #include "brw_fs.h"
#include "brw_fs_live_variables.h"
#include "brw_cfg.h"
using namespace brw;
/** @file brw_fs_saturate_propagation.cpp
*
* Implements a pass that propagates the SAT modifier from a MOV.SAT into the
* instruction that produced the source of the MOV.SAT, thereby allowing the
* MOV's src and dst ... | ALGO | 0.966956 | 6.105121 |
ec04ad81-4989-4bd5-b108-f411daf40365 | sgc109/algorithm_practice | BOJ/2751.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <utility>
#include <stack>
#include <string.h>
#include <stdlib.h>
#define REP(i,a,b) for(int i = a; i < b;++i)
#define FOR(i,n) REP(i,0,n)
#define mp make_pair
#define pb push_back
using namespace std;
typedef lo... | ALGO | 0.999839 | 3.467795 |
0d97225b-eaf5-4d57-82d4-e9281ba52cb3 | oohminseok/coding-test | 프로그래머스/unrated/181839. 주사위 게임 1/주사위 게임 1.cpp | #include <string>
#include <vector>
#include <math.h>
using namespace std;
int solution(int a, int b)
{
int answer = 0;
if(a%2==1&&b%2==1)
{
return (a*a)+(b*b);
}
else if(a%2==1||b%2==1)
{
return 2*(a+b);
}
else if(a%2!=1&&b%2!=1)
{
return std::abs(a-b);
... | ALGO | 0.999936 | 4.869422 |
4cd20b2d-8c05-4442-8bff-f6bbbf6b2df6 | hkhetawat/SCOREP_Applications | lammps/src/MISC/fix_thermal_conductivity.cpp | /* ----------------------------------------------------------------------
Contributing author: Craig Tenney (UND) added support
for swapping atoms of different masses
------------------------------------------------------------------------- */
#include "fix_thermal_conductivity.h"
#include <... | ALGO | 0.991011 | 5.303722 |
1001b766-3e46-4025-8409-754a4fac676b | abhijitmanna912001/DSA-Problem-Solving | Recursion/AddStrings.cpp | #include <iostream>
#include <algorithm>
using namespace std;
void addRE(string &num1, int p1, string &num2, int p2, int carry, string &ans)
{
if (p1 < 0 && p2 < 0)
{
if (carry != 0)
ans.push_back(carry + '0');
return;
}
int n1 = (p1 >= 0 ? num1[p1] : '0') - '0';
int n2... | ALGO | 0.999912 | 5.062111 |
37435d50-49bc-41a9-950a-2bea7af5b316 | patel-anshu111/c-program_practice | c++ program/fkjvbi.cpp |
cpp
Copy
Edit
#include <iostream>
using namespace std;
// Function to add two integers
int add(int a, int b) {
return a + b;
}
// Function to add two floats
float add(float a, float b) {
return a + b;
}
// Function to add three integers
int add(int a, int b, int c) {
return a + b + c;
}
int main(){
... | TOOL | 0.891021 | 5.531563 |
64fbbde7-d945-4d28-ad9d-0b52f5a9cca0 | SwintonStreet/GiftAppTest | 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 |
dae01d60-ab1e-4736-98d7-7b030b4c272a | Churk-Ben/AllStudyRepo | Study_of_C&C++/VSCodeFiles_of_cpp_2/Day08/0809.cpp | #include <string>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
// 大数加法
string add(const string &a, const string &b)
{
string res;
int carry = 0;
int i = a.size() - 1, j = b.size() - 1;
while (i >= 0 || j >= 0 || carry > 0)
{
int digit_a = i >= 0 ? a[i] - ... | ALGO | 0.999982 | 4.701906 |
58abbd2f-bba4-4e1a-b53a-4ffd688aea51 | MostakChy055/DSA_Odyssey | DP/Resources/SubSetSum_Problem.cpp | #include<bits/stdc++.h>
using namespace std;
int main(void){
int num[] = {3, 34, 4, 12, 5, 2}, aim = 10, n = sizeof(num)/sizeof(int);
vector<bool>dp(aim + 1, false);
// To make aim from the given array
// for(int i = 0; i<sizeof(num)/sizeof(int); i += 1){
// for(int j = num[i]; j<=aim; j += 1)... | ALGO | 0.999848 | 3.368025 |
aecb83a0-531a-4ce2-a47e-9e463025743c | InvalidNamee/OJ-AC-Repository-for-UPC | AC_code/2024新生寒假集训系列/3991_递推&递归/9_J_蜜蜂路线.cpp | #include <iostream>
#include <cmath>
#include <vector>
using namespace std;
class Hipre {
vector<int> a;
public:
void mv(int t) {
vector<int> b(t, 0);
b.insert(b.end(), a.begin(), a.end());
a = b;
}
Hipre() {
a = vector<int>(1, 0);
}
Hipre(int n) {
if ... | ALGO | 0.999868 | 4.439137 |
fd5be0fc-aed9-418e-9485-3ed84eb40fb5 | itsabhijeetid/gfg-practice | Medium/Majority Element/majority-element.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:
// Function to find majority element in the array
// a: input array
// size: size of input array
int majorityElement(int a[]... | ALGO | 0.999915 | 5.591088 |
2f98300c-0347-48b6-86ad-cef770272ec0 | LakshayAggarwal25/C-Plus-Plus-DSA | CPP_DSA/Lectures/7.STL-Algorithms/Basic_STL_Functions.cpp | #include <iostream>
#include<algorithm>
using namespace std;
// Defining a Comparator Function
bool compare(int a, int b){
return b<a;
}
int main() {
int arr[] = {1,10,11,9,100};
int n = sizeof(arr)/sizeof(int);
// Search in an unsorted array --> find(array_name,array_name + number_of_elements,key)
... | ALGO | 0.99959 | 4.508606 |
f2620507-86ed-4583-86db-82d7175a3721 | reisxd/TizenTubeCobalt | third_party/icu/source/i18n/double-conversion-strtod.cpp | // ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include <climits>
#include <cstdarg>
// ICU PATCH: Customize header file paths for ICU.
#include "double-conversion-bignum.h"
#include "double-conversion-cached-powers.h"
#include "double-conversion-ieee.h"
#incl... | TOOL | 0.935088 | 5.156433 |
e65a445a-b54e-446b-b9df-37b4d797e9ee | fou1100ouacus/DataStructures | operation on array and linkedlist/move last ele to front of list.cpp | #include <bits/stdc++.h>
using namespace std;
struct node {
int data;
node *next;};
void PrintList(node *head) ;
void fun1(node* head) ;
void InSertionLast(node *&head,int x) ;
void MovetoFront(node *&head) ;
int main()
{
int data;
node *head1;
head1=NULL;
InSertionLast(head1,5) ;
InSertionLast(head1,6) ;
InSertio... | ALGO | 0.999187 | 4.138244 |
525380c2-de01-4079-bd0e-da5d8a43325d | subnr01/subs-practice | leet_code/trees/medium/BSIterator.cpp | /*
Implement an iterator over a binary search tree (BST).
Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
Note: next() and hasNext() should run in average O(1) time and
uses O(h) memory, where h is the height of the tree.
*/
class BSTIt... | ALGO | 0.999976 | 6.278019 |
1dc7bbdf-77dd-4f3f-8024-6920979de8dd | wenli7363/Distributed-parallel-computing | MPI/optimizer3.cpp | // 优化三+小循环埃式筛
#include "mpi.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
typedef long long LL;
#define MIN(a, b) ((a)<(b) ? (a) : (b))
#define BLOCK_LOW(id, p, n) ((long long)(id)*(n)/(p))
#define BLOCK_HIGH(id, p, n) (BLOCK_LOW((id)+1,p,n)-1)
#define BLOCK_SIZE(id, p, n) (BLOCK_HIGH(id,p,n)-BLOCK_LOW(... | ALGO | 0.99999 | 4.041158 |
fe99296e-90b2-4df0-9953-71087b988ad5 | satyamtiwari736182/CP | pepcoding/Level 1/10_Generic_Tree/sample.cpp | #include "../header.h"
struct Node
{
vector<Node *> children;
int data;
};
void display(Node *node)
{
string str = to_string(node->data) + " -> ";
for (auto child : node->children)
str += to_string(child->data) + " ";
cout << str << endl;
for (auto child : node->children)
di... | ALGO | 0.999814 | 4.345086 |
38e5cf64-0c71-4a8b-b27b-8961c9d268d2 | chrishewlings/Projects | C++/cpp/array_sorting.cpp | // sorting with selection sort
#include <iostream>
#include <algorithm>
int anUnsortedArray[] = {0, 90, 30, 25, 60, 42, 80, 30, 90};
int arrayLength = sizeof(anUnsortedArray) / sizeof(anUnsortedArray[0]);
int main()
{
using namespace std;
for (int startIndex = 0; startIndex < arrayLength; startIndex++)
{
int s... | ALGO | 0.999833 | 4.315843 |
e3fd6626-1142-4c02-b56d-6dba3a6dd346 | LEECHHE/acmicpc | solved/2616.cpp | #include<iostream>
#include<cstring>
using namespace std;
int seq[50001];
int dp[50001][3];
int psum[50001] = { 0 };
int n,k;
int solve(int idx, int t){
if( t >= 3 ) return 0;
if( idx > n ) return 0;
int& ret = dp[idx][t];
if( ret != -1 ) return ret;
return ret = max(solve(idx+k,t+1)+psum[idx+k-1]-psum[idx-1],sol... | ALGO | 0.999918 | 3.296175 |
ebe32f55-7a94-4490-9d82-0233f64e5f13 | geekquad/AlgoBook | cpp/Graphs/dijsktra.cpp | //Dijsktra algorithm to find shortest paths from source to all vertices in the given graph.
#include <bits/stdc++.h>
#define w 5
using namespace std;
int minkey(int store[],int spt_set[])
{
int keymin=INT_MAX;
int index;
for(int i=0;i<w;i++)
{
if(spt_set[i]==0 && store[i]<keymin)
{
... | ALGO | 0.99995 | 4.23616 |
ad841995-7598-4f39-bfa5-57ee50d5236b | joaoabrantesuchoa/Competitive-Programming-CPP | Problems/Problems Sets/CSES/Introductory Problems/Two_Knights.cpp | #include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
cin >> n;
for (long long i = 1; i <= n; i++) {
long long ans1 = i * i * (i * i - 1) / 2;
long long ans2 = 4 * (i - 1) * (i - 2);
cout << ans1 - ans2 << "\n";
}
return 0;
} | ALGO | 0.999522 | 3.626069 |
105eb54e-72e7-45e9-a1fc-9b95e81d40b2 | AnuragPatel1/Codeforces-Problem | B_Checkout_Assistant.cpp | #include <bits/stdc++.h>
using namespace std;
#define PI (3.141592653589)
#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i,j) for(int i = 0; i<j; i++)
#define rrep(i,j) for(int i = j; i>=0; i--)
#define all(x) x.begin(), x.end()
#define print(x) cout << x << endl
#define YES co... | ALGO | 0.999954 | 4.001284 |
bc9a0ead-4b10-4ad8-8f87-43e5d2d9d2bd | seonghwan7694/BOJ_solved | c++/2513번.cpp | #include <bits/stdc++.h>
#define lld long long int
using namespace std;
lld N, K, S; // N : apartment, K : max people in bus, S : location of school
vector<pair<lld, lld>> L, R;
lld func(vector<pair<lld, lld>> &D){
lld cost = 0;
sort(D.begin(), D.end(), [](const pair<lld, lld> &p1, const pair<lld, lld> &p2){
... | ALGO | 0.999467 | 3.157645 |
594b6e68-a7ab-4933-bbd8-efaea1086490 | yuandaxing/leetcode | cpluplus/merge_two_sorted_list.cpp | /*
* author: yuandx
* create: 2015-11-18
* email: <EMAIL>
*/
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <climits>
#include <string>
#include <utility>
#include <functional>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <unordered_map>
#include <unordered_set>... | ALGO | 0.999867 | 5.218242 |
868ebc48-cea0-4c24-aa92-adbd2b5fa8ed | shivamscodes/programs | c++/basic/gratest.cpp | #include <iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"enter a";
cin>>a;
cout<<"enter b";
cin>>b;
cout<<"enter c";
cin>>c;
if((a>b)&&(a>c))
{
cout<<"greatest is a"<<a;
}
else if((b>a)&&(b>c))
{
cout<<"greatest is b"<<b;
}
else{
... | ALGO | 0.998766 | 3.542518 |
d00a85fc-8dcc-4cf3-9a0f-a775376182d2 | kyle-nguyennn/cp | UVa/10038_JollyJumpers/main.cpp | #include <bits/stdc++.h>
using namespace std;
void doo(int n){
int a,b;
vector<bool> v(n,false);
cin >> a;
for (int i =1; i< n; i++) {
cin >> b;
int temp = (int)abs(a-b);
if (temp >0 && temp <n) v[temp] = true;
a = b;
}
sort(v.begin()+1, v.end());
//cout << ... | ALGO | 0.999841 | 3.830585 |
41c8b9bb-1409-4211-8e38-cee313b2346f | BaoTrung37/PTIT_Sources | CTDL-thayson/contest11/bai10-cay-nhi-phan-tong.cpp | /**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ii pair<int, int>
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()
#define set_vect(a,n); vector<int>a(n); for(auto &z : a)cin>>z;
const int N = 1e5 + 5;
struct Node{
int data;
Node *left,*right;
Node(int... | ALGO | 0.999924 | 4.874305 |
d5de906a-5dc5-4a9c-9a23-fcf92e23cfb3 | yuzhiliu8/churchillcoding-solutions | CodeForces/984-Div3/e.cpp | #include <bits/stdc++.h>
using namespace std;
// COL = region number
// ROW = country number
int search(int* values, int rows, int cols, int region, string op, int limit){
for (int i = 0; i < rows; i++){
cout << *((values + i * cols) + region) << ' ';
cout << endl;
}
cout << endl;
int... | ALGO | 0.999652 | 3.988387 |
351a1315-bb33-47fd-a05c-d2f521fecd97 | leon-schi/fortune-hyperbolic | experiments/CGAL-5.2/demo/CGAL_ipelets/hilbert_sort.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/hilbert_sort.h>
#include <CGAL/CGAL_Ipelet_base.h>
// --------------------------------------------------------------------
namespace CGAL_hilbert_sort{
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
con... | ALGO | 0.999905 | 6.329237 |
a4ace326-1587-4976-95ba-3a3888fb39fd | MachineryZ/Leetcode | 2249. Count Lattice Points Inside a Circle.cpp | class Solution {
public:
int countLatticePoints(vector<vector<int>>& circles)
{
int lower_x = 105;
int upper_x = -105;
int lower_y = 105;
int upper_y = -105;
for(int i = 0; i < circles.size(); i++)
{
lower_x = min(lower_x, circles[i][0] - circles[i][2... | ALGO | 0.999646 | 5.375445 |
7aad2e8e-66e1-48b1-bbf1-76cd7e27810d | wangwangla/algorithm | doc/other/look-1/094. 二叉树中的最大路径和.cpp | class Solution
{
public:
int maxPathSum(TreeNode *root)
{
int ret = INT_MIN;
onePath(root,ret);
return ret;
}
int onePath(TreeNode* root,int&ret)
{
if(root==nullptr)
return 0;
int l = onePath(root->left,ret);
int r... | ALGO | 0.999972 | 5.742893 |
760f63d9-8d41-4df9-98f5-3084de25ebc6 | PradeepSingh15/Codeforces | 151-A-Soft Drinking/softdrinking.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int n, k, l, c, d, p, nl, np;
cin>>n>>k>>l>>c>>d>>p>>nl>>np;
long long int t = (k*l)/nl;
long long int s = c*d;
long long int r = p/np;
long long int x = min(t, min(s, r))/n ;
cout<<x<<endl;
return 0;
} | ALGO | 0.999716 | 3.417599 |
98496d81-1800-4deb-8dcf-da56f793dd95 | c4glaku/io-chess | src/pieces/ChessPiece.cpp | #include "ChessPiece.h"
#include <cmath>
#include <vector>
ChessPiece::ChessPiece(std::string clr, int x, int y, PieceType t, bool moved)
: colour(clr), row(x), col(y), type(t), hasMoved(moved) {}
PieceType ChessPiece::getPieceType() const { return type; }
std::string ChessPiece::getColour() const { return colou... | ALGO | 0.898703 | 5.776135 |
77d89950-1037-4e1f-bb73-d0bd7abe5572 | ritwik-jha/cpp-prac | add_using_func.cpp | #include<iostream>
using namespace std;
int add(int n1, int n2){
int sum_ = n1 + n2;
return sum_;
}
int main(){
int n1, n2;
cin >> n1 >> n2;
cout << add(n1,n2) << endl;
} | ALGO | 0.998246 | 4.231198 |
3e5e4d05-f26d-4bc9-bd7f-ea4db680d01b | saitejasree2004/CSA0426-Operating-system | day 4/LRU.cpp | #include <stdio.h>
#include <stdlib.h>
#define NUM_FRAMES 3 // Number of page frames (memory slots)
#define NUM_PAGES 10 // Total number of pages in the reference string
// Function to simulate LRU paging
void lru_paging(int pages[], int num_pages, int num_frames) {
int frames[num_frames];
int last_used[num_f... | ALGO | 0.999784 | 6.115321 |
ba6946ab-7191-4339-b962-901bee99fc8d | alibaba/esod | evaluation/tiny_benchmark/maskrcnn_benchmark/csrc/cpu/nms_cpu.cpp | template <typename scalar_t>
at::Tensor nms_cpu_kernel(const at::Tensor& dets,
const at::Tensor& scores,
const float threshold) {
AT_ASSERTM(!dets.type().is_cuda(), "dets must be a CPU tensor");
AT_ASSERTM(!scores.type().is_cuda(), "scores must be a CPU tensor");
... | ALGO | 0.976456 | 7.292679 |
c82dbee1-479d-4d62-b93a-e9f759ac3d77 | ParaToolsInc/benchmarks | threading/tacc_1/psum.cpp | #include <algorithm>
#include <future>
#include <iostream>
#include <omp.h>
#include <thread>
#include <tbb/blocked_range.h>
#include <tbb/mutex.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_for_each.h>
#include <tbb/task_scheduler_init.h>
#include <tbb/tick_count.h>
#define NFRAMES 500
#define BUFSIZE 1920... | ALGO | 0.857722 | 4.15351 |
2601a264-765b-4990-97c0-af2a0535d014 | gnu-mirror-unofficial/chess | src/adapter/move_do.cpp | // move_do.cpp
// includes
#include <cstdlib>
#include "board.h"
#include "colour.h"
#include "hash.h"
#include "move.h"
#include "move_do.h"
#include "move_legal.h"
#include "piece.h"
#include "random.h"
#include "util.h"
namespace adapter {
// prototypes
static void square_clear (board_t * board, int square, in... | ALGO | 0.934663 | 6.921452 |
465e8218-3bc4-43a0-91f7-567eaf0efeff | titsuki/AOJ | Volume_00/0054_Sum_of_Nth_decimal_places.cpp |
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#i... | ALGO | 0.999402 | 3.371701 |
ac7e88fe-75ab-4842-95cc-6759cd049f8e | Sachin2486/System-Design | system-design/expense_tracker_design/splitWise.cpp | #include<bits/stdc++.h>
using namespace std;
class User {
string id, name, email;
public:
User(string id, string name, string email) : id(id) , name(name), email(email) {}
string getId() const {
return id;
}
string getName() const {
return name;
}
};
class S... | TOOL | 0.868969 | 4.464599 |
9cfdf6a2-09ac-43c3-a83e-54b561daec1e | jonyroy/online-judge-problem-solutions | www.codeforces.com/30A.cpp | #include<set>
#include<list>
#include<map>
#include<stack>
#include<bitset>
#include<ctime>
#include<string>
#include<deque>
#include<queue>
#include<cstdio>
#include<cmath>
#include<utility>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<cs... | ALGO | 0.999717 | 3.273706 |
8645a201-8a01-45d9-91df-f16644be6f03 | KimDoYoung1997/TBCpp | cpp-examples/hong_lab/chapter_8/lec_8.8/Calc.cpp | #include <iostream>
#include "Calc.h"
using namespace std;
// class Calc
// {
// private:
// int m_value;
// public:
// Calc(int init_value)
// :m_value(init_value)
// {cout << "init value : "<<init_value<< endl;}
// Calc& Calc::add(int value)
// {
// m_value+=value;
// return *... | TOOL | 0.868008 | 4.257634 |
e97492d6-f8f9-42f0-9183-03d263c8723a | zhuminjie/OpenSeesPy | SRC/domain/pattern/SimulatedRandomProcessSeries.cpp | // $Revision: 1.3 $
// $Date: 2010-02-04 18:32:41 $
// $Source: /usr/local/cvs/OpenSees/SRC/domain/pattern/SimulatedRandomProcessSeries.cpp,v $
//
// Written by Terje Haukaas (<EMAIL>), February 2002
// Revised:
//
#include <SimulatedRandomProcessSeries.h>
#include <Vector.h>
#include <Channel.h>
#include <Spectrum.... | TOOL | 0.874874 | 4.196401 |
d0f4328f-175d-482c-a28b-76d9da45b27c | JasurbekErgashev/CS201 | assignments/assignment1/task3.cpp | #include <iostream>
using namespace std;
struct Node {
int data;
Node* next;
Node(int data) {
this->data = data;
next = NULL;
}
};
void selectionSortList(Node* head){
Node* curr = head;
while (curr) {
Node* min = curr;
Node* r = curr->next;
while (r) {
... | ALGO | 0.999962 | 5.237682 |
0b13dada-a337-4e62-bcad-b739fcf138d2 | elmerjani/competitive-programming | B_Binary_Colouring.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> ass(int x){
vector<int> ans;
while(x>0){
ans.push_back(x%2);
x/=2;
}
while(ans.size()<32)ans.push_back(0);
return ans;
}
int main(){
int t;cin>>t;
while(t--){
int x;cin>>x;
vector<int> ans=ass(x);
... | ALGO | 0.999825 | 4.167577 |
3a44de6e-d880-4c33-bd3d-7fcf95ac30ff | DhruvDave12/DSA-Practice | Graph/kruskal.cpp | #include <bits/stdc++.h>
using namespace std;
class Graph {
public:
map<int,vector<pair<int,int>>> adj;
void addEdgeUndirected(int u, int v, int w){
adj[u].push_back({v,w});
adj[v].push_back({u,w});
}
void addEdgeDirected(int u, int v, int w){
adj[u].push_back({v,w});
... | ALGO | 0.999974 | 4.525499 |
d5e23abb-4840-4240-b72b-a6ad4d3b9db6 | heisenberg01010/Competitive-Programming-Solved-Problems | Codeforces/Bear and Big Brother.cpp | #include <iostream>
using namespace std;
int main()
{
int l, b, count = 0;
cin >> l >> b;
while(l <= b)
{
b = b * 2;
l = l * 3;
count++;
}
cout << count;
return 0;
} | ALGO | 0.999823 | 4.060131 |
72862f8c-2329-44cc-962f-792ad5cefd1c | exponentialcherub/VisualSSS | libigl-master/include/igl/pso.cpp | #include "pso.h"
#include <cassert>
#include <Eigen/StdVector>
#include <vector>
#include <iostream>
template <
typename Scalar,
typename DerivedX,
typename DerivedLB,
typename DerivedUB>
IGL_INLINE Scalar igl::pso(
const std::function< Scalar (DerivedX &) > f,
const Eigen::MatrixBase<DerivedLB> & LB,
... | ALGO | 0.999928 | 6.353269 |
21ede917-0cc7-4055-8f08-aa4e52299f0d | Slava/competitiveProgramming | timus/timus_1190.cpp | #include <cstdio>
#include <cstdlib>
char noonecares[20000];
int n, a[5100], t, l = 1, s;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%s%d", noonecares, &t);
if (!t)
a[i] = -1;
else scanf("%d", a + i);
}
for (int i = n - 1; i >= 0; i--) {
if (a[i] != -1)
l = a[i];
s += l;
}
... | ALGO | 0.999358 | 3.280135 |
c1d1924e-cd89-4450-baf2-24349f5b6393 | Shubh08am/Codeforces_Problems_Solutions | Sorting Parts.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define int long long
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pd pair<ld, ld>
#define vi vector<int>
typedef long double lld;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<pii> v... | ALGO | 0.999891 | 4.100764 |
82a15cbb-fed0-4b15-8041-d748ba8a1521 | junrae6454/Algorithm | CodeGround/새로운방/새로운방/main.cpp | #include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int min(int a, int b)
{
if (a > b)
return b;
else
return a;
}
int max(int a, int b)
{
if (a > b)
return a;
else
return b;
}
int main(int argc, char** argv) {
/* Ʒ freopen Լ sample_input.txt read only ,
ǥ Է(Ű) sample_inpu... | ALGO | 0.999745 | 4.188701 |
9721f49a-c74a-4501-b24a-a03ecad7a55e | EricWang007/POJ-PTA | POJ/基本算法/模拟法/2993.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <vector>
using namespace std;
const int MAX = 1e2 + 10;
const double eps = 1e-6;
#define INF 0x7fffffff
#define ll long long
#define FOR(i, a, b) for (int i = a; i <= ... | ALGO | 0.997109 | 3.327178 |
726a54c2-5b32-4107-94b7-3064b167d4ac | akgcoin/akg-core | src/rpc/mining.cpp | #include <base58.h>
#include <amount.h>
#include <chain.h>
#include <chainparams.h>
#include <consensus/consensus.h>
#include <consensus/params.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <init.h>
#include <validation.h>
#include <miner.h>
#include <net.h>
#include <policy/fees.h>
#include <pow.h... | WEB | 0.992516 | 4.121417 |
4d3c0050-3239-47c8-b3f8-9a3877dd65b4 | CGAL/cgal | Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_surface_inside.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
#include <CGAL/make_mesh_3.h>
#include <C... | ALGO | 0.977089 | 7.190813 |
35d24b3e-564b-4b59-bfc1-fb91dd352c04 | kukjinman/SWstudy | Algorithm_cpp/Programmers/순위검색/answer.cpp | #include <algorithm>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
vector<string> data_parse(string data)
{
vector<string> ret;
string tmp = "";
for (auto c : data) {
if (c == ' ') {
if (tmp != "and")
ret.push_back(tmp);
... | ALGO | 0.997669 | 5.112732 |
6a0efed7-da05-42dc-9e51-142c84354899 | stamcenter/llvm-zeno | llvm/examples/Kaleidoscope/Chapter2/toy.cpp | #include <cctype>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
//===----------------------------------------------------------------------===//
// Lexer
//===----------------------------------------------------------------------===//
// T... | TOOL | 0.924074 | 7.666117 |
62f44c58-e7b8-463d-8a2b-5a7286898c1a | tamasferencz12/Suli | 2020.11.18.cpp | #include <iostream>
#include <cstring>
using namespace std;
int main()
{
char s[100];
int db = 0, i = 0;
cout << "s=";
cin.getline(s, 100);
while (i < strlen(s))
{
if (strchr("0123456789", s[i]) != 0)
{
db++;
while (s[i] != ' ' && s[i] != '\0')
... | ALGO | 0.996815 | 3.018956 |
34c66540-198a-4557-862a-aed45daface2 | adityakch/Data-Structures-and-Algorithms | CPP/Two Pointers & Sliding window/subarray.cpp | #include <bits/stdc++.h>
using namespace std;
// brute force - O(n^3)
vector<vector<int>> subArray(vector<int> &arr)
{
int n = arr.size();
vector<vector<int>> res;
for (int i = 0; i < n; i++)
{
for (int j = i; j < n; j++)
{
vector<int> subarrays;
for (int k = ... | ALGO | 0.999663 | 5.821635 |
6b377812-6060-43cd-a088-9574a95ea180 | SrishtiSomya/TLE-CP-Sheets | fashionableArray.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
void solve(){
int n;
cin >> n;
int a[n];
for(int i = 0; i < n; i++){
cin >> a[i];
}
sort(a, a+n);
if(a[0] % 2 == a[n - 1] % 2){
cout << 0 << "\n";
return;
}else{
//cout << Emax << " " << Emin << " " << Omax ... | ALGO | 0.999541 | 4.161787 |
901c6824-3a0b-4c46-9db7-47991e320576 | ahmedibrahim404/CompetitiveProgramming | Senior Training/Sheet1/P/main.cpp | #include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int MAX=300000+3;
vvi ns;
int par[MAX];
int get(int v){
if(v==par[v]) return v;
return par[v]=get(par[v]);
}
int n, k, d;
int main(){
scanf("%d%d%d",&n,&k,&d);
ns = vvi(n);
queue<int> q;
vi dis(n... | ALGO | 0.99998 | 4.066685 |
60d1504c-1dcf-44b7-b9bc-52d1cca15320 | ArseniyRauba/OAIP-1sem | lab5/dop3(3)/dop3(3).cpp | #include <iostream>
int main()
{
using namespace std;
setlocale(LC_CTYPE, "rus");
double a, b, p, q, r, s;
cout << "Введите размеры участка: ";
cin >> a;
cin >> b;
cout << "Введите размеры первого дома: ";
cin >> p;
cin >> q;
cout << "Введите размеры второго дома: ";
cin >> r;
cin >> s;
if (p + r <= a && ... | ALGO | 0.999254 | 4.052664 |
7df285c3-afb9-409e-ac6f-8b880e913757 | Vibha-Hathwar/oops | oops/h8.cpp | //migratory birds
#include<iostream>
using namespace std;
int N,A[10];
int main()
{
cin >> N;
for (int i=1,x; i <= N; i++) cin >> x, A[x]++;
int ans = 1;
for (int i=2; i <= 5; i++)
if (A[i] > A[ans]) ans = i;
cout << ans<<"\n";
}
| ALGO | 0.999937 | 3.197908 |
8f3ed85b-eb17-4039-9ccc-4281f70ecec3 | pnayak1501/cpp | 16recursion/recursive_sum.cpp | // Recursive sum
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int sum(int n){
if(n==0){
return 0;
}
int prevSum = sum(n-1);
return n + prevSum;
}
int main() {
int n;
cin>>n;
cout<<sum(n);
return 0;
}
| ALGO | 0.999957 | 4.870659 |
fe453b93-358b-4bca-82a3-e9f06aa28a1e | breadchris/CPlusPractice | cs_1124/homework_1/medieval_times.cpp | /*
* medieval_times.cpp
* Christopher Thompson
* Homework 1
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <sstream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
struct Warrior {
string name;
int strength;
};
int readFile();
int main() {
return... | TOOL | 0.866817 | 3.679831 |
aae6cdcc-3934-4d32-b810-b92d7a0f688d | sarvex/leetcode-jai | lcci/16.21.Sum Swap/Solution.cpp | class Solution {
public:
vector<int> findSwapValues(vector<int>& array1, vector<int>& array2) {
int s1 = 0, s2 = 0;
unordered_set<int> s;
for (int a : array1) s1 += a;
for (int b : array2) {
s2 += b;
s.insert(b);
}
int diff = s1 - s2;
i... | ALGO | 0.999988 | 5.360476 |
85b440ab-14a3-4567-b949-f9a7b596bbc5 | Yash3292/cpp | binomialCoefficient.cpp | #include<iostream>
using namespace std;
int factorial(int num){
int fact = 1;
for(int i=1; i<=num; i++){
fact *= i;
}
return fact;
}
double binoCoef(int n, int r){
double bico = factorial(n) / (factorial(r) * factorial(n - r));
return bico;
}
int main(){
int n, r;
cout <<... | ALGO | 0.999711 | 5.544822 |
b5cb68e9-0737-4340-864c-90fd3b427d52 | aseemrb/competitive | c++/longest_nondecr_seq.cpp | #include <iostream>
#include <cstdlib>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <c... | ALGO | 0.99843 | 3.578692 |
31495d2e-3732-43e5-8acb-81a134f8c732 | vanshu778/programming | sprint_1/36_N-th_triangular.cpp | //Write a program to find the N-th triangular number.
#include <iostream>
using namespace std;
int triangularNumber(int N) {
return (N * (N + 1)) / 2;
}
int main() {
int N;
cout << "Enter N: ";
cin >> N;
cout << triangularNumber(N) << endl;
return 0;
}
| ALGO | 0.999713 | 7.015415 |
a28a7008-fde6-4206-a559-48d36ab65cf4 | harikrishnamwork/coding-question | Algorithms/Recursion/Crossword Puzzle/solution.cpp | #include<bits/stdc++.h>
using namespace std;
// checks all positions in the grid where it's possible to place the strings
bool placeString(vector<string>& grid, const string& l) {
int len = l.length();
bool placed = false;
// check the horizontal positions
// checking each row
for (int i = 0... | ALGO | 0.99997 | 4.819948 |
4740025c-def0-46c6-90a9-f47fce3febd8 | minhvpham/codeblock | codeforces/1615b.cpp | #include<bits/stdc++.h>
using namespace std;
#define task "c9"
#define SZ(c) (c).size()
#define getbit(x,i) (((x) >> (i)) & 1)
#define turnoff(x,i) (x)&(~(1<<(i)))
#define __builtin_popcount __builtin_popcountll
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define fi fir... | ALGO | 0.999847 | 4.440241 |
7f3b42d6-1706-4f4e-85ac-74f883184e7b | kkarimi62/myLammps | lib/gpu/lal_buck_coul.cpp | /***************************************************************************
buck_coul.cpp
-------------------
Trung Dac Nguyen (ORNL)
Class for acceleration of the buck/coul/cut pair style.
____________________________________... | ALGO | 0.889488 | 6.26065 |
9936b655-68e4-4c36-8817-1818624d6601 | reliak/moonpdf | ext/sumatra/src/PdfSync.cpp | #include "BaseUtil.h"
#include "PdfSync.h"
#include "FileUtil.h"
#include "PdfEngine.h"
#include "synctex_parser.h"
// size of the mark highlighting the location calculated by forward-search
#define MARK_SIZE 10
// maximum error in the source file line number when doing forward-search
#define EPSILON_L... | TOOL | 0.932784 | 4.744723 |
b359c8e9-8b2d-43c0-ab52-8cff748839d6 | ishandutta2007/codeforces | emptyhope/normal/1672/F1.cpp | #include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
//#define int long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1... | ALGO | 0.999989 | 4.321828 |
db48e94f-5f09-4156-b7ca-b2a9235125d3 | div-hacks/Be-Creative-Hacktoberfest | cpp/queue.cpp | #include <iostream>
using namespace std;
int queue[100], n = 100, front = -1, rear = -1;
void Insert() {
int val;
if (rear == n - 1)
cout<<"Queue Overflow"<<endl;
else {
if (front == -1)
front = 0;
cout<<"Enter element to be inserted : "<<endl;
cin>>val;
rear++;
queue[rea... | ALGO | 0.980745 | 3.764059 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.