uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9418cb78-b089-4444-88f9-d1eda0e36d7f | Gatubi/ApacheLAN | src/ApacheConfig.cpp | #define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include "ApacheConfig.h"
#include <fstream>
#include <sstream>
#include <iostream>
// Funcin auxiliar para parsear lneas "clave=valor"
std::string GetValue(const std::string& line)
{
size_t pos = line.find('=');
if (p... | TOOL | 0.874833 | 4.797027 |
404023e0-a7c2-4c1c-92a9-b287331d17d1 | rprakashdass/Leetcode-Problems | DSA/Easy/2697. Lexicographically Smallest Palindrome.cpp | class Solution {
public:
string makeSmallestPalindrome(string s) {
int n = s.size();
int left = 0, right = n-1;
while(left < right){
if(s[left] != s[right])
s[left] = s[right] = min(s[right], s[left]);
left++;
right--;
}
ret... | ALGO | 0.999988 | 6.440141 |
3426fdc3-05f4-455a-b08a-dff70ccacf6b | usernamegenerator/leetcode | LeetCodeCNExplore/leetcodeCNeasy/others/191hammingWeight.cpp | // https://leetcode-cn.com/explore/interview/card/top-interview-questions-easy/26/others/64/
/*
位1的个数
编写一个函数,输入是一个无符号整数,返回其二进制表达式中数字位数为 ‘1’ 的个数(也被称为汉明重量)。
示例 1:
输入:00000000000000000000000000001011
输出:3
解释:输入的二进制串 00000000000000000000000000001011 中,共有三位为 '1'。
示例 2:
输入:00000000000000000000000010000000
输出:1
解释:输入的二进制... | ALGO | 0.998155 | 6.429856 |
b777a47c-91bc-4dad-9198-f5804cff2881 | cgkantidis/aoc_2023 | src/d02p2.cpp | #include <algorithm>
#include <fmt/core.h>
#include <fstream>
#include <string>
#include <vector>
struct GameSet
{
std::size_t m_red;
std::size_t m_green;
std::size_t m_blue;
[[nodiscard]] std::size_t
get_power() const {
return m_red * m_green * m_blue;
}
};
struct Game
{
std::size_t m_id;
std::v... | ALGO | 0.97148 | 6.398829 |
1c089e4c-f5a7-4d0c-a307-c04062e256c1 | ColorfulsKite/THCS2 | C03014_BSC-USC.cpp | #include<stdio.h>
#include<math.h>
#include<string.h>
long long ucln(long long a, long long b){
while( a != b){
if(a > b) a -= b;
else b -= a;
}
return a;
}
long long bcnn(long long a, long long b){
return (a*b)/ucln(a,b);
}
void bai_lam(){
long long a,b;
scanf("%lld%lld",&a, &b);
printf("%lld %lld\n", b... | ALGO | 0.999731 | 4.540189 |
a7bdfc61-1cf4-4ca5-ae9e-225a14ea6980 | lewis-revill/agc-llvm-project | llvm/lib/TableGen/StringMatcher.cpp | #include "llvm/TableGen/StringMatcher.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace llvm;
/// FindFirstNonCommonLetter - Find the first character in the keys of the
/// string pairs that... | TOOL | 0.961693 | 7.349344 |
9ba0ba52-f324-4ffb-b29a-42d11bf83a01 | madhavgupta2775/Competitive_solutions | codeforces/1790/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define forn(i,a,n) for(long long i = a; i < n; i++)
#define endl "\n"
#define int long long
const int MOD2 = 1e9+7;
const int MOD = 998244353;
void solve() {
int n, s, r; cin >> n >> s >> r;
int temp = r;
forn(i, 0, n-1){
cout << min(s-temp, r-n+i+... | ALGO | 0.999293 | 3.280638 |
f8195445-05ad-4459-8e1d-447b5a9d4929 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/CodeLlama/top0-100/maximize-the-minimum-powered-city-Solution.maxPower/177740_DoS_Exec_Code_Overflow_Mem._Corr..cpp | static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC) /* {{{ */
{
/*
This is how the time string is formatted:
snprintf(p, sizeof(p), "%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100,
ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
*/
time_t ret;
struct tm thetime;
char * strbuf;
... | ALGO | 0.986423 | 5.784013 |
b45b7362-b4cd-47fd-90a7-36d9d3a77e2f | Joachim-Lebrun/Fork-Litecoin-quick | src/crypto/hmac_sha512.cpp | #include <crypto/hmac_sha512.h>
#include <string.h>
CHMAC_SHA512::CHMAC_SHA512(const unsigned char* key, size_t keylen)
{
unsigned char rkey[128];
if (keylen <= 128) {
memcpy(rkey, key, keylen);
memset(rkey + keylen, 0, 128 - keylen);
} else {
CSHA512().Write(key, keylen).Finalize(... | ALGO | 0.93776 | 5.726457 |
64279c5b-a13a-4d29-ada9-7e607be36941 | zhongwang123/Code-Backups | FoxAndTouristFamilies.cpp | //****************************************************************************************************************//
//Source: SRM 561
//Description:
//给定一个国家的地图,地图呈树形,在树上的一些结点上住着居民,在节日来临时,居民会随机,独立地选择一个除居住地以外其他的节点作为旅游目的地,
//然后沿着最短路径前往目的地,在这个过程中,树的某些边会被所有居民经过,求这种“关键边”的期望数
//Note:
//Category:树形DP
//*********************... | ALGO | 0.998959 | 4.130442 |
e1ce812c-5402-4357-b693-b1cd3eb5109e | WangDaLei/llvm | llvm/lib/Analysis/InlineCost.cpp | #include "llvm/Analysis/InlineCost.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/CFG.h... | ALGO | 0.893004 | 7.59966 |
95bcf0cb-574d-4c0e-93d5-a6bf5bd23eef | aurora1409/CPP_Pro | midc++/Untitled14.cpp | #include<iostream>
#include<math.h>
#include<string>
using namespace std;
bool checkp(int n)
{
if(n<2) return 0;
else
{
for(int i=2;i<=sqrt(n);i++)
{
if(n%i==0)
{
return 0;
break;
}
}
}
return 1;
}
int main()
{
string s;
getline(cin,s);
for(int i=0;i<=s.size();i++)
{
if(checkp(i+1)==1)... | ALGO | 0.999893 | 3.333043 |
9e13b911-4525-4c43-98ab-a24ce145b6e2 | SuperHellCat/https-github.com-EpicGames-UnrealEngine | Engine/Source/ThirdParty/PhysX/PhysX_3.4/Source/LowLevelDynamics/src/DyConstraintSetupBlock.cpp | #include "foundation/PxMemory.h"
#include "DyConstraintPrep.h"
#include "PxsRigidBody.h"
#include "DySolverConstraint1D.h"
#include "DySolverConstraint1D4.h"
#include "PsSort.h"
#include "PxcConstraintBlockStream.h"
#include "DyArticulationContactPrep.h"
#include "PsFoundation.h"
namespace physx
{
namespace Dy
{
void... | ALGO | 0.943933 | 4.488029 |
26353c4e-622b-4174-a124-35c16a0e9a37 | priyanshuid/practice-codes | 6th semester practice/ternary_search.cpp | #include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
int pos=-1;
int ternary_search(int ar[],int st,int en,int val)
{
int t1=(int)(st+en)/3;
int t2=(int)2*(st+en)/3;
if(st>en)
return -1;
else
{
if(ar[t1]==val)
return t1;
else if(ar[t2]=... | ALGO | 0.999987 | 4.15906 |
9adb9648-8fe1-4a2a-95a1-145ab28d8086 | MaorMan1/Tetris-SFML | src/LeaderBoardUtils.cpp | #include "LeaderboardUtils.hpp"
#include <fstream>
#include <sstream>
#include <filesystem>
#include <algorithm>
void loadScoresFromFile(const std::string& filePath, std::vector<ScoreEntry>& scores) {
scores.clear();
std::ifstream file(filePath);
if (!file.is_open()) {
std::cerr << "Failed to open... | TOOL | 0.897747 | 6.06189 |
12267998-1438-4a07-bf09-29327a4cf217 | ttamx/Competitive-Programming | codeforces/1934D2.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using db = long double;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<db>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
u... | ALGO | 0.999246 | 4.293611 |
ada16a0e-e086-4536-88e6-325504507c6a | nguyencongvan10022002/CPP | mat khau.cpp | #include<bits/stdc++.h>
using namespace std;
int comp(string a, string b){
int n = a.length();
int m = b.length();
return n < m;
}
string str[100001];
main(){
int n;
cin >> n;
for(int i = 0; i < n; i++) cin >> str[i];
sort(str, str + n, comp);
int count = 0;
for(int i = 0; i < n - 1; i++){
for(int j = i + 1... | ALGO | 0.999965 | 3.882874 |
1c4400e6-afe6-4ed1-aa22-2df575f7393a | muhammadbadrul1234/Computer-Science-and-Engineering | Programing/AtCoder/abc155_b/32136848_WA_0ms_0kB.cpp | #include<iostream>
using namespace std;
int main(){
int a,b;
int sum=0;
int sum1=0;
cin>>a;
for(int i=0;i<6;i++){
cin>>b;
if(b%2==0){
sum++;
if(b%3==0){
sum1++;
}
else if(b%5==0){
sum1++;
... | ALGO | 0.99997 | 4.07997 |
f1af9025-0162-4bde-9a69-cad177dab8d3 | ashutosh1598/Codeforces | Edu36/1.cpp | #include"iomanip"
#include"iostream"
#include"limits"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"queue"
#include"stack"
#include"set"
#include"map"
#include"string"
#include"cstring"
#include"assert.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(),v.e... | ALGO | 0.999611 | 3.279205 |
108a642e-b3d6-466d-8a1f-485193bc7f59 | open-airlab/VTNMPC-Autonomous-Wind-Turbine-Inspection | WTI_catkin/NMPC_code_generator/ros_acado_bridge/ACADOtoolkit/examples/basic_data_structures/function/symbolic_differentiation1.cpp | /**
* \file examples/function/symbolic_differentiation1.cpp
* \author Boris Houska, Hans Joachim Ferreau
* \date 2008
*/
#include <acado/utils/acado_utils.hpp>
#include <acado/user_interaction/user_interaction.hpp>
#include <acado/symbolic_expression/symbolic_expression.hpp>
#include <acado/function/funct... | TEST | 0.882593 | 6.675132 |
21e08000-8d82-4fcc-86d5-f10f829e3dbf | cabelo/opencertiface | biometrics/3rdparty/eigen-eigen-c58038c56923/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.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 << "Row's maximum: " << std::endl
<< mat.rowwise().maxCoeff() << std::endl;
}
| ALGO | 0.999543 | 3.881484 |
d449f39e-ad8f-4790-be60-5643dc7a5b47 | chitrasaindane/CPP | heap/delete_element_heap.cpp | #include <iostream>
using namespace std;
// Function to insert an element into the heap
void insert(int a[], int n) {
int temp, i = n;
temp = a[n];
while (i > 1 && temp > a[i / 2]) {
a[i] = a[i / 2];
i = i / 2;
}
a[i] = temp;
}
// Function to create a heap from an array
void creat... | ALGO | 0.999966 | 5.565801 |
1618c1e1-bdb2-438c-bd77-d54d6df29fdd | ishandutta2007/codeforces | yyljkydr/normal/1553/H.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e6+1e3+7,INF=1e9;
int cnt;
struct T{
int l,r;
int ls,rs;
int ld,rd;
int dis;
int sz;
}t[N*2+1];
void update(int x)
{
t[x].ld=min({t[t[x].ls].ld,t[t[x].rs].ld+t[t[x].ls].sz,INF});
t[x].rd=min({t[t[x].rs].rd,t[t[x].ls].rd+t[t[x].rs]... | ALGO | 0.99997 | 4.214863 |
60f96730-2bcf-4e43-8b3a-9683e384b9fe | veis-lzf/Lora_PingPong | DemoRX/Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/arm_nnexamples_gru.cpp | /**
* @ingroup groupExamples
*/
/**
* @defgroup GRUExample Gated Recurrent Unit Example
*
* \par Description:
* \par
* Demonstrates a gated recurrent unit (GRU) example with the use of fully-connected,
* Tanh/Sigmoid activation functions.
*
* \par Model definition:
* \par
* GRU is a type of recurrent neura... | ALGO | 0.921446 | 7.471897 |
fdc01c3e-f788-4787-9f31-d33562626f5a | tomiscoin/phfirecoin | src/CryptoNoteCore/Difficulty.cpp | #include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <vector>
#include "Common/int-util.h"
#include "crypto/hash.h"
#include "CryptoNoteConfig.h"
#include "Difficulty.h"
namespace CryptoNote {
using std::uint64_t;
using std::vector;
#if defined(__SIZEOF_INT128__)
static inli... | ALGO | 0.990476 | 6.731177 |
6464549f-c0a1-4d6a-bc51-03943435b285 | shivajaysaxena/LeetCode | 2028-the-earliest-and-latest-rounds-where-players-compete/the-earliest-and-latest-rounds-where-players-compete.cpp | class Solution {
bool dp[7][28][28] = {};
int mini = INT_MAX;
int maxi = INT_MIN;
void recursive(int round, int l, int r, int n) {
if (dp[round][l][r])
return;
dp[round][l][r] = 1;
if (l > r)
return recursive(round, r, l, n);
if (l == r) {
... | ALGO | 0.999925 | 5.93715 |
e99b4c10-0111-4202-afaa-173edd960746 | bbaah123/CPlusPlus | files/0134398408_ sc/Chapter10/pr10-08.cpp | // This program uses the address of each element in the array.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const int NUM_COINS = 5;
double coins[NUM_COINS] = {0.05, 0.1, 0.25, 0.5, 1.0};
double *doublePtr; // Pointer to a double
// Use the pointer to display the value... | ALGO | 0.986637 | 5.232846 |
6a45ac8e-6f4d-47af-8adc-1e2f9cbc93d5 | hugols16/Data_Structures | Dynamic_Stack.cpp | #include "DynamicStack.hpp"
#include <stddef.h>
#include <iostream>
typedef DynamicStack::StackItem StackItem; // for simplicity
const StackItem DynamicStack::EMPTY_STACK = -999;
DynamicStack::DynamicStack()
{
capacity_ = 16;
init_capacity_ = 16;
... | TOOL | 0.891531 | 4.138535 |
942a5efa-67e6-44c5-8f5c-5698de79601e | ridelsam/data-struc-c-cpp | strings/validating_string.cpp | #include <iostream>
bool valid(char name[])
{
for (int i = 0; name[i] != '\0'; i++)
{
if (!(name[i] >= 65 && name[i] <= 90) && !(name[i] >= 97 && name[i] <= 122) && !(name[i] >= 48 && name[i] <= 57))
return false;
}
return true;
}
int main()
{
char name[] = "An3ura8?{}356HHHg";
... | ALGO | 0.9933 | 4.8382 |
5ded6a79-883c-4cf7-9a56-a36fe7a04b50 | ishandutta2007/codeforces | mohammedehab2002/normal/182/D.cpp | #include <iostream>
#include <string.h>
using namespace std;
string s1,s2;
bool check(string s,int i)
{
for (int x=0;x<s.size();x++)
{
if (s[x]!=s[x%i])
return false;
}
return true;
}
bool check2(int i)
{
string a1=s1.substr(0,i);
string a2=s2.substr(0,i);
return (a1==a2);
}
int main()
{
int ans=0;
cin >> ... | ALGO | 0.999875 | 3.862498 |
ca45c14d-2cca-4dc6-a30a-b461be875d17 | Tittanc/Reponame | CompetitiveProgramming/Geometry/GeometryTemplate.cpp | #include<bits/stdc++.h>
using namespace std;
class Cpoint
{
public:
long long x,y,z;
Cpoint(long long tmp_x=0, long long tmp_y=0, long long tmp_z=0)
{
x=tmp_x;
y=tmp_y;
z=tmp_z;
}
Cpoint operator+(Cpoint b)
{
return Cpoint(this->x+b.x, this->y+b.y, this-... | ALGO | 0.99999 | 4.373252 |
343f3f93-cd36-423a-a6ca-4caf57e76078 | holmesfems/PasswordBook | src/saveConfig.cpp | #include "saveConfig.h"
#include <boost/filesystem.hpp>
#include <fstream>
#include <iostream>
#include <vector>
#include "stringTool.h"
namespace SaveConfig
{
ConfigItem::ConfigItem()
{
key = "";
value = "";
}
ConfigItem::ConfigItem(const std::string &key, const std::string &value)
... | TOOL | 0.909267 | 5.35115 |
840ccf7b-b54d-42d7-b9a3-f0301623d6c0 | git-aditya-star/6Companies30days | Goldman Sachs/13.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:
string decodeString(string &s, int &i){
string result="";
while(i < s.length() && s[i] != ']'){
... | ALGO | 0.997831 | 6.127937 |
c8566dff-f064-41c4-80c5-04b776594ce4 | tpatil2/Interview_prep | stacks-queues/stack-using-Array.cpp | #include <iostream>
#define MAX_SIZE 100
int top=-1;
int arr[MAX_SIZE];
using namespace std;
void push(int x){
if(top > MAX_SIZE-1){
std::cout << "Error: Stack overflow" << std::endl;
}
top++;
arr[top]=x;
}
void pop(){
if(top==-1){
std::cout << "Error: Already Empty Stack" << std::endl;
}else{
... | ALGO | 0.956767 | 4.406978 |
9e07e2f4-f910-4709-b51b-d75db405fbef | BernardIgiri/archive-OpenGLTechDemonstrator | StringUtilities.cpp | #include "StringUtilities.h"
#include <io.h>
/************************************************************************
Reads a command string and returns the data in desired format.
************************************************************************/
void StrUtil_ReadCommandString(const char *string,void *data... | TOOL | 0.992717 | 4.450439 |
d0be8e25-8c0c-4a3a-8ad7-77df00aa763a | cliatyw/UE4 | Engine/Source/ThirdParty/PhysX3/PhysX_3.4/Source/GeomUtils/src/contact/GuLegacyContactCapsuleHeightField.cpp | #include "GuDistancePointSegment.h"
#include "GuDistanceSegmentSegment.h"
#include "GuGeometryUnion.h"
#include "GuHeightFieldData.h"
#include "GuHeightFieldUtil.h"
#include "GuContactMethodImpl.h"
#include "GuContactBuffer.h"
#include "GuContactMethodImpl.h"
#include "GuInternal.h"
#define DO_EDGE_EDGE 1
#define DEBU... | ALGO | 0.995651 | 7.302341 |
4266424c-aeec-4cd9-b01c-61c3dc710cbb | Fedbxy/competitive-programming | OTOG/496.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false); cin.tie(0);
int n;cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
float temp = j;
if(temp/2 == floor(temp/2)){
cout<<"-";
}else{
cout<<"*... | ALGO | 0.999978 | 3.80613 |
e8ca35c0-b0ce-4488-b659-16314e64ff9b | IAmShaaann/DSA-Codes | AmazonAlgoPrep/Sliding Window/Maximum_from_Subarray_K/main.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> brute_force(vector<int> arr, int window)
{
vector<int> ans;
for (int i = 0; i <= arr.size() - window; i++)
{
int mx = INT_MIN;
for (int j = i; j < i + window; j++)
{
mx = max(mx, arr[j]);
}
... | ALGO | 0.999974 | 4.757133 |
83f79492-79bb-46d4-a3d5-21d89295416b | khan-yin/leetcode | src/第16章/连续数列/贪心.cpp | #include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
int maxSubArray(vector<int>& nums) {
int n = nums.size();
int res = INT_MIN;
int sum = 0;
for(int i=0;i<n;i++)
{
if(sum<0)
{
sum=0;
}
... | ALGO | 0.99987 | 5.897202 |
bf50e836-fa3c-45be-aade-0312ca3426c1 | obalcells/problemas | graphs/specialgraphs/walkingrid.cpp | #include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
s... | ALGO | 0.999824 | 4.023448 |
2cccd560-52e2-414d-99a8-10c972a05ef7 | toboy32/cpp_training | 4_변수5.cpp | // 4_변수5.cpp
#include <iostream>
using namespace std;
#if 0
// typedef
// : 변수를 만들듯이 타입의 별칭을 만들 수 있습니다.
typedef int ARR3[3];
typedef int (*PARR3)[3];
int main()
{
// int x[3] = { 10, 20, 30 };
// x: int[3]
ARR3 x = { 10, 20, 30 };
PARR3 p = &x;
}
#endif
// using
// 1) namespace
// - using 선언
// ... | CONFIG | 0.860664 | 3.626962 |
b1145eb6-e935-4136-bc8b-3d4eecfcd047 | aazannoorkhuwaja/C-plus-plus-CBL-Project | IF-Else/qns7.cpp | //7. Write a program that checks if a triangle is valid based on its sides.
#include <iostream>
using namespace std;
int main(){
cout <<"Input the three sides of triangle : "<<endl;
int s1,s2,s3;
cin>>s1>>s2>>s3;
if (s1 > 0 && s2 > 0 && s3 > 0 && s1 + s2 > s3 && s2 + s3 > s1 && s3 + s1 > s2)
{
... | ALGO | 0.99483 | 3.458755 |
162daf9c-353d-4339-855f-5685ac88262b | Masud-Abdullah/Online-Judges | LightOJ/Parity.cpp | #include <bits/stdc++.h>
#define nl "\n"
#define nn (cout << "NO\n")
#define yy (cout << "YES\n")
#define ss " "
#define ll long long
#define ull unsigned long long
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a / gcd(a, b)) * b)
#define pii pair<int, int>
#define pll pair<long long, long long>
#define sz(v) (int)... | ALGO | 0.999819 | 4.916019 |
73dbe987-14ae-4f7d-9008-9554b4500038 | EnricoFabiano85/cpp | MyUnorderedMMap.cpp | /*
Rough implementation of hash table with functionalities similar
to unordered_multimap. Will also be tested on
https://leetcode.com/problems/design-hashmap/description/
Notes: std::unordered_map is equivalent to a
std::forward_list<Map_Node> + std::vector<std::forward_list<Map_Node>::iterator>
(although ... | ALGO | 0.960457 | 6.272703 |
ca8a714a-e520-48cc-871c-504be89b1b9c | jccarvalhosa/maratona | hackerrank/contests/vihaan/khokho.cpp | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int T;
cin>>T;
while(T--) {
int n, k, i, ans=0;
cin>>n>>k;
vector<vector<int> > v(k);
for(i=0;i<n;i++) {
int x;
cin>>x;
v[i%k].push_back(x);
}
for(i=0;i<k;i++) {
for(int j=0;j<v[i].size();j++) {
... | ALGO | 0.999834 | 3.655726 |
9955de16-d2d5-4ea3-9db3-ae24b6f63f57 | jrajni/problemsPractice | addTwoNumbersTarget.cpp | #include<iostream>
using namespace std;
int main(void)
{
int n,target,count=-1;
cout<<"size of array="<<endl;
cin>>n;
int a[n];
cout<<"enter elements of array="<<endl;
for(int i=0;i<n;i++)cin>>a[i];
cout<<"enter target"<<endl;
cin>>target;
for(int i=0;i<n;i++)
{
for(int j... | ALGO | 0.999695 | 4.836489 |
5877ba64-ca02-469b-9e3c-0da8b72603b0 | GoWest279/Gem5-RISCV-FullSystem | src/systemc/tests/systemc/misc/user_guide/chpt11.6/mean.cpp | /*****************************************************************************
mean.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | ALGO | 0.999418 | 4.632813 |
58b599d6-f16b-4da7-a188-03e0a4c92a81 | stormbreaker/CSC300 | Assignment1/Assignment1BK.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
#include <iostream>
#include <cctype>
using namespace std;
const int notrelprim = -999; // Honestly not sure this is necessary
int gcd(int a, int b); // basic gcd
void extended(int a, int b, int &j, int d); // extended Euclid
int main()
{
int a,b,c,d,j,k,r,s,t,x... | ALGO | 0.999959 | 3.600978 |
2ceaa46c-b5ab-4637-91aa-af2b58242d1d | Agasthya-Samyak-Jnan/LeetCode-Problems | Medium/Frequency Tracker.cpp | #include<bits/stdc++.h>
using namespace std;
// Link to the Problem : https://leetcode.com/problems/frequency-tracker/
// Difficulty : Medium
/* HASH MAPS - BIDIRECTIONAL MAPPING - NUMBERS TO THIER FREQUENCY COUNTS AND FREQUENCY COUNTS TO COUNT OF NUMBERS HAVING IT. */
class FrequencyTracker {
public:
//... | ALGO | 0.998636 | 5.918699 |
fdf1514b-f113-4d57-bb9c-f91755684924 | jainhardik120/CodeX | CPP/NQueensSolver.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
vector<vector<int>> findSolutions(vector<int> &path, int start, int n)
{
vector<vector<int>> sol;
if (start == n)
{
sol.push_back(path);
return sol;
}
vector<bool> possiblePositions(n,... | ALGO | 0.999919 | 5.501049 |
bdbde45f-8dab-4297-8a99-9d266d915bd0 | xrayFan/xray_history | Editor/ParticleEditor/Editor/frustum.cpp | //---------------------------------------------------------------------------
#include "stdafx.h"
#pragma hdrstop
#include "Frustum.h"
#include "UI_Main.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////... | ALGO | 0.964541 | 5.481926 |
b18a9c52-aad6-4630-8139-1f85041e5dcb | CGCL-codes/G4S | cantera/test_problems/cathermo/HMW_graph_VvT/HMW_graph_VvT.cpp | /**
* @file HMW_graph_VvT
*/
#include "cantera/thermo.h"
#include "TemperatureTable.h"
#include "cantera/thermo/HMWSoln.h"
#include <cstdio>
using namespace std;
using namespace Cantera;
int main(int argc, char** argv)
{
int retn = 0;
size_t i;
try {
std::string iFile = (argc > 1) ? argv[1] ... | ALGO | 0.917606 | 5.781168 |
b25069a5-4fb5-4398-8298-fef11bface73 | hotuanan/codeforces | 440A - Forgotten Episode/main.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
long long n;
cin >> n;
long long s = 0;
for (int i = 0; i < n - 1; i++) {
int tmp;
cin >> tmp;
s += tmp;
}
cout << n * (n + 1) / 2 - s << endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0)... | ALGO | 0.999887 | 3.635017 |
3d092098-87e0-4bf9-898c-d8a94ad3b5eb | vaibhav0415/leetcode | 0532-k-diff-pairs-in-an-array/0532-k-diff-pairs-in-an-array.cpp | class Solution {
public:
int findPairs(vector<int>& nums, int k) {
int i=0;
int j=1;
int c=0;
sort(nums.begin(),nums.end());
while(i<nums.size() && j<nums.size()){
if(nums[j]-nums[i]==k){
i++;
j++;
c++;
... | ALGO | 0.999914 | 5.797373 |
fe8da064-64d7-412b-8464-80b7ec6341c5 | gaurpiyush001/Complete_Interview_Revision_Repo | DP_late_start/Distinct_Ways_Pattern/MinSwapsToMakeSeqInc.cpp | //https://leetcode.com/problems/minimum-swaps-to-make-sequences-increasing/
class Solution {
public:
int solve(vector<int>& nums1, vector<int>& nums2, int index, bool swapped){
if( index == nums1.size() ){
return 0;
}
int ans = INT_MAX;
i... | ALGO | 0.999997 | 5.840762 |
b505f79b-10b2-4722-bcbd-a454e3214d84 | albertmas/PhysicsBox2DPractice1 | Physics2_class4_-_handout/Physics2_class4 - handout/Box2D/Box2D/Dynamics/Joints/b2MotorJoint.cpp | #include <Box2D/Dynamics/Joints/b2MotorJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Point-to-point constraint
// Cdot = v2 - v1
// = v2 + cross(w2, r2) - v1 - cross(w1, r1)
// J = [-I -r1_skew I r2_skew ]
// Identity used:
// w k % (rx i + ry j) = w * (-ry i + rx j)
// An... | ALGO | 0.927024 | 7.699895 |
f7d71708-4636-465a-a013-4f07df1cb89e | RaniaArbash/OOP345-NRB-W25 | Week 10 - Lecture/c-threadReturnResultLambda.cpp | #include <thread>
#include <iostream>
using namespace std;
int main() {
int tx, ty, tz;
std::thread tX = std::thread([&]() {for (tx = 0; tx < 100; cout << '^', tx++); });
std::thread tY = std::thread([&]() {for (ty = 0; ty < 200; cout << '_', ty++); });
std::thread tZ = std::thread([&]() {for (tz = 0; tz < ... | TOOL | 0.905573 | 3.753989 |
0f70f9ba-d2ba-4271-af28-9df91df6ddc2 | steephengeorge/hackerRank-cpp | src/TimeComplexityPrimality.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
bool isPrime(int n)
{
if( n <=1 )
return false;
if( n ==2 || n== 3)
return true;
int root = sqrt(n);
for(int i = 2; i <= root; ++i)
{
if(n%i==0... | ALGO | 0.999389 | 4.42981 |
30ef852e-efa9-4bca-927a-ce642aae2002 | skrewbar/PS | Baekjoon/gold/1958.cpp | #include <bits/stdc++.h>
using namespace std;
int DP[101][101][101];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string a, b, c;
cin >> a >> b >> c;
for (int i = 1 ; i <= a.size() ; i++) {
for (int j = 1 ; j <= b.size() ; j++) {
for (int k = 1 ; k <= c.size() ;... | ALGO | 0.999982 | 4.863571 |
1bf57364-8148-4982-a835-05ebf3dd2ac0 | aaronpwinter/Ray-Tracing-Data-Structures | ext/nanogui/ext/eigen/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp | ArrayXXf table(10, 4);
table.col(0) = ArrayXf::LinSpaced(10, 0, 90);
table.col(1) = M_PI / 180 * table.col(0);
table.col(2) = table.col(1).sin();
table.col(3) = table.col(1).cos();
std::cout << " Degrees Radians Sine Cosine\n";
std::cout << table << std::endl;
| ALGO | 0.926107 | 3.543272 |
f78cf28a-5bfe-46b7-b3bb-a4cd52e7cbd2 | kiennt63/cuda-chinese-guy | week-1/main.cpp | #include "vecadd.h"
#include <stdio.h>
#include <vector>
int main() {
int count = 100000;
std::vector<float> h_A(count, 1);
std::vector<float> h_B(count, 2);
std::vector<float> h_C(count);
vecAdd(h_A.data(), h_B.data(), h_C.data(), count);
for (size_t i = 0; i < 100; ++i) {
printf("%.0f ", h_C[i]);
... | ALGO | 0.968547 | 4.396296 |
88f5701f-392c-4428-8a75-13fac5725056 | ishandutta2007/codeforces | hos.lyric/normal/1184/B1.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=a;i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#defi... | ALGO | 0.999928 | 3.147684 |
e33e6e69-7836-48b3-9506-5e5f6123afa2 | alex-roh/Acmicpc_Problem_Solving | 탐욕적 기법을 활용한 풀이/1202 - 보석 도둑/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define bnd(a,b,c,d) (a >= 0 && b >= 0 && a < c && b < d)
#define prt(arr,N,M) cl; rep(i, 0, N){ rep(j, 0, M){ cos(arr[i][j]); } cl; } cl;
#define rep(i,a,b) for(int i = a; i < b; i++)
#define rrep(i,b,a) for(int i = b - 1; i >= a; i--)
#define mp(a,b) make_pair(a, b)
#... | ALGO | 0.999815 | 3.341985 |
93cf7a99-8448-45c7-8920-bf7575c12e87 | bluesea0/Leetcode | 191. 位1的个数/191. 位1的个数.cpp | #include <iostream>
#include<vector>
#include<queue>
using namespace std;
//10-16 ָoffer15
class Solution {
public:
//ѭжʱ临ӶΪO(logn)
int hammingWeight(uint32_t n) {
int ans=0;
while(n){
if(n%2==1)
ans++;//ԻΪans+=(n&1)//ʾĩλǷ1.
n/=2;//n&=(n-1)
}
... | ALGO | 0.999771 | 5.545606 |
e367fa4d-4e98-44e2-ab3f-74b807ba77ff | Codeer-man/C-DSA | c++/funcitons/sum.cpp | #include <iostream>
using namespace std;
int sumOfNum(int n)
{
int i;
int sum = 1;
for (i = 1; i <= n; i++)
{
sum = sum*i;
}
return sum;
}
int main()
{
cout << sumOfNum(5) << endl;
return 0;
} | ALGO | 0.999917 | 5.338084 |
dc3b6957-6503-49eb-afcf-3a5f1c67f480 | aniruddh-joshi/LeetCode | 1009.cpp | class Solution {
public:
int bitwiseComplement(int n) {
int m=n;
int mask=0;
//edge case
if(n==0) return 1;
while(m!=0){
mask=(mask<<1)|1;
m=m>>1;
}
int ans=(~n)&mask;
return ans;
}
};
| ALGO | 0.999956 | 6.112307 |
a68bea46-1b20-400c-9cba-489cb9fb49c7 | shanmuga-pandi/LeetCode-Shanmuga | Solutions/Hard/212_Word_Search_II.cpp | /*
Given a 2D board and a list of words from the dictionary, find all words in the board.
Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once in a word.
Example:
Input: ... | ALGO | 0.99989 | 7.061285 |
b57e715b-5f52-4e11-a02d-f3a483a4e5a5 | star-platinum127/uva | AP325 P-3-10.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define miku mywaifu
#define misaka mywaifu
#define pb push_back
#define S second
#define F first
#define mem(i,j) memset(i,j,sizeof(i))
#define pii pair<int,int>
#define pll pair<long,long>
#define MOD 1000000007
const int MAXN = 100005;
const int INF... | ALGO | 0.999943 | 4.043149 |
e3d498ee-67b0-4581-b91e-5aef885b313f | jyork03/PID-controller | src/PID.cpp | #include "PID.h"
using namespace std;
PID::PID() {}
PID::~PID() {}
void PID::Init(std::vector<double> p) {
Kp = p[0];
Ki = p[1];
Kd = p[2];
p_error = 0.0;
i_error = 0.0;
d_error = 0.0;
}
void PID::ResetErrors() {
p_error = 0.0;
i_error = 0.0;
d_error = 0.0;
}
void PID::UpdateError(double cte) {... | ALGO | 0.98471 | 4.745046 |
3cda28b8-5674-4ee4-b816-1236ac140b6a | adityataday/fundManagement | Final/Final/Client.cpp | #include "Client.h"
#include <iostream>
#include <string>
using namespace std;
Client::Client() {
userID = 0;
password = " ";
balance = 0;
}
Client::Client(int u, string p, double b)
{
userID = u;
password = p;
balance = b;
}
void Client::setUserID(int id)
{
userID = id;
}
void Client::setPassword(string pa... | TOOL | 0.850892 | 3.558933 |
6db2598c-b80e-4da1-9726-dd960547e1a7 | samuko-things/simple_pid_control | simple_pid_control.cpp | #include "simple_pid_control.h"
SimplePID::SimplePID(float Kp, float Ki, float Kd, float out_min, float out_max)
{
reset();
kp = Kp;
ki = Ki;
kd = Kd;
outMax = out_max;
outMin = out_min;
errorPrev = error;
lastTime = micros();
}
void SimplePID::setParameters(float Kp, float Ki, float Kd, float out_m... | ALGO | 0.882776 | 5.763251 |
1dd932a3-98b3-4b50-8d21-766f956bcd59 | yuchen0515/Codewar_HPE | 2022/p2.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
int main() {
std::vector<int32_t> arr(4, 0);
int32_t total = 0;
for (int32_t i = 0 ; i < 4 ; i++) {
std::cin >> arr[i];
total += arr[i];
}
int32_t ans = 0;
if (total < 2 * arr[0]) {
ans = 0;
} else if (... | ALGO | 0.999918 | 4.997629 |
1e339c55-59a8-4fff-b541-888d52db27c4 | kikimo/third-party | boost_1_83_0/tools/inspect/inspect.cpp | // inspect program -------------------------------------------------------------------//
// This program recurses through sub-directories looking for various problems.
// It contains some Boost specific features, like ignoring "bin",
// and the code that identifies library names assumes the Boost directory
// st... | TOOL | 0.880042 | 5.735641 |
788b4c80-4555-439f-b689-e206a8d9f40f | sinian666/codes_41_10 | cpp_副本10/chapter_stack_and_queue/linkedlist_deque.cpp | /**
* File: linkedlist_deque.cpp
* Created Time: 2023-03-02
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 双向链表节点 */
struct DoublyListNode {
int val; // 节点值
DoublyListNode *next; // 后继节点指针
DoublyListNode *prev; // 前驱节点指针
DoublyListNode(int val) : val(val), prev(nullp... | ALGO | 0.999206 | 5.936366 |
f76855b7-1f2a-4df6-b649-938b7543610a | spinos/aphid | shared/ttg/AdaptiveBccGrid3.cpp | #include "AdaptiveBccGrid3.h"
namespace aphid {
namespace ttg {
AdaptiveBccGrid3::AdaptiveBccGrid3()
{}
AdaptiveBccGrid3::~AdaptiveBccGrid3()
{}
BccCell3 * AdaptiveBccGrid3::addCell(const sdb::Coord4 & cellCoord)
{
#if 0
std::cout<<"\n AdaptiveBccGrid3::addCell";
#endif
BccCell3 * c = AdaptiveGrid10T::addCell(ce... | ALGO | 0.998234 | 5.105502 |
80c97f0a-9369-456b-9f02-1eabd540cbc5 | chuck8868/QuantLibQt | test-suite/mclongstaffschwartzengine.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include "mclongstaffschwartzengine.hpp"
#include "utilities.hpp"
#include <ql/instruments/vanillaoption.hpp>
#include <ql/termstructures/yield/flatforward.hpp>
#include <ql/termstructures/volatility/equityfx/blackconstantvol.hpp>
#include... | ALGO | 0.969411 | 7.721702 |
754e3c33-7d63-418b-9e64-b87b30d4a0bd | otavioon/COLA-2022-Tools | datasets/src/algo/codenet/1/s362776240.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod=1000000007;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
double c[2][2];
for ( int i = 0; i < 3; i++ ){
for (int j =0; j < 3; j++){
cin >> c[i][j];
}
}
if( (c[1][1]/c[1][2] == c[2][1... | ALGO | 0.999602 | 3.723891 |
819ea343-325d-4485-ab85-aaf87c8914f6 | CoinBitCore/temp | src/rest.cpp | #include <chain.h>
#include <chainparams.h>
#include <core_io.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <validation.h>
#include <httpserver.h>
#include <rpc/blockchain.h>
#include <rpc/server.h>
#include <streams.h>
#include <sync.h>
#include <txmempool.h>
#include <utilstrencodings.... | WEB | 0.936567 | 5.505206 |
8f84970e-4354-418e-a498-4132e01f25e1 | 2TAJ/przyklady | podzielnoscLiczby3If.cpp | #include <iostream>
using namespace std;
int main()
{
int liczba;
cout << "Podaj swoj liczbe" << endl;
cin >> liczba;
if (liczba % 3 == 0)
{
cout << "Liczba dzieli sie przez 3 " << endl;
}
if (liczba % 2 == 0)
{
cout << "Liczba dzieli sie przez 2" << endl;
}
if (l... | ALGO | 0.988144 | 3.144691 |
61815a73-576b-45aa-b23a-570fc91006f6 | sarvex/leetcode-basic | solution/2300-2399/2347.Best Poker Hand/Solution.cpp | class Solution {
public:
string bestHand(vector<int>& ranks, vector<char>& suits) {
bool flush = true;
for (int i = 1; i < 5 && flush; ++i) {
flush = suits[i] == suits[i - 1];
}
if (flush) {
return "Flush";
}
int cnt[14]{};
bool pair = ... | ALGO | 0.999837 | 6.191286 |
0cd4730b-c503-432c-85ca-d3dad754c0a6 | powder2005/etohari | vnoi/segtree_itladder.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
using pld = pair < ld, ld >;
using point = pair < ld, ld > ;
using line = pair < point, point >;
template < class T > bool minimum(T& a, const T& b) { return b < a ?... | ALGO | 0.999073 | 4.456585 |
a6824385-1b2c-4888-8ba2-0c7c0b5bfde3 | AlbanGauthier/IGR205projet | extern/eigen3/blas/double.cpp | #define SCALAR double
#define SCALAR_SUFFIX d
#define SCALAR_SUFFIX_UP "D"
#define ISCOMPLEX 0
#include "level1_impl.h"
#include "level1_real_impl.h"
#include "level2_impl.h"
#include "level2_real_impl.h"
#include "level3_impl.h"
double BLASFUNC(dsdot)(int* n, float* x, int* incx, float* y, int* incy)
{
... | ALGO | 0.998417 | 4.855024 |
e1acb41d-5192-4db2-b1b8-745750f7bee0 | BoseDada/College | C++/RemovalofLeftRecursion.cpp | #include <iostream>
#include <fstream>
using namespace std;
void removingleftrecursion(char arr[],int size, char ss){
cout << endl;
char alpha[10];
char beta[10];
for (int i = 0; i < size; i++) {
if (arr[i] == '>') {
if (arr[i + 1] == ss) {
int j = i;
... | ALGO | 0.999408 | 3.10619 |
a1c58c19-1797-4fe9-a186-63f2f165cf9f | yashswag22/Striver-A-to-Z-DSA-sheet | Recursion [PatternWise]/Get a Strong Hold/4. Sort a stack using recursion.cpp | void sortedInsert(int temp, stack<int> &s){
// Base case: If stack is empty or temp is greater than or equal to the top element, insert temp
if (s.empty() || temp >= s.top()) {
s.push(temp);
return;
}
// If temp is smaller than the top element, pop the top and recurse
int t = s.top()... | ALGO | 0.999969 | 5.535662 |
bce9d515-90c2-4ca7-8f8b-c327f53b399f | MaTianmao/src | src/boost/libs/bimap/example/mi_to_b_path/tagged_bidirectional_map.cpp | // Boost.Bimap Example
//-----------------------------------------------------------------------------
// This example shows how to construct a bidirectional map with
// multi_index_container.
// By a bidirectional map we mean a container of elements of
// std::pair<const FromType,const ToType> such that no two element... | ALGO | 0.974361 | 6.418914 |
479f5c78-a4f2-4bef-b73a-aa54b30ea440 | SynTax19/LeetCode-Solutions | Subarray with 0 sum - GFG/subarray-with-0-sum.cpp | // { Driver Code Starts
// A C++ program to find if there is a zero sum
// subarray
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
//Complete this function
//Function to check whether there is a subarray present with 0-sum or not.
bool subArrayExists(int ar... | ALGO | 0.999747 | 6.243397 |
100b8935-dfa6-40a8-bdb7-00f98ce44548 | salemi8686/CP | Java/Solution.cpp | class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
int res = 1, n = nums.size();
vector<int> dp(n,1);
for(int i=0;i<nums.size();++i){
for(int j=0;j<i;++j){
if(nums[i]>nums[j]){
dp[i] = max(dp[i],dp[j]+1);
}
... | ALGO | 0.999971 | 5.950613 |
cce849db-4478-41a4-b9e8-e0b04db82379 | Bekzhan-Kasymbekov/30github | CodeWars/WhoLikesThis?.cpp |
#include <iostream>
#include <vector>
#include <string>
std::string likes(const std::vector<std::string> &names) {
std::string output;
if (names.empty()) return "no one likes this";
if (names.size() == 1) {
output = names[0] + " likes this";
} else if (names.size() == 2) {
output = n... | ALGO | 0.978866 | 6.336668 |
7ba06055-1880-4922-b716-da87fde96c92 | CodeDks/DATA_STRUCTURE_CODE | 1. Basic_dsa_linear_dsa/dsa26.cpp | // Pivot element in the array..
/*
#include <iostream>
using namespace std;
int Pivot(int arr[], int n)
{
int s = 0;
int e = n - 1;
int mid = s + (e - s) / 2;
while (s < e)
{
if (arr[mid] >= arr[0])
{
s = mid + 1;
}
else
{
e = mid;
... | ALGO | 0.99988 | 6.027759 |
6d4081fb-cd40-40ea-8b94-72807f51bc2d | fafa1899/BuildCppDependency | Source/boost-1.86.0/libs/compute/perf/perf_unique_copy.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/unique_copy.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
i... | ALGO | 0.979676 | 5.406857 |
824ac755-c9a6-418f-b5f5-9f160cf1d38a | thomasverardo/kd-tree_parallel | mpi_hybrid/kd_tree_mpi_hybrid.cpp | #include <iostream>
#include <algorithm>
#include "kd_tree.hpp"
#include <math.h>
#include <string>
#include <sstream>
#include <chrono>
#define N_DIM 2
//++++++++++++++++++ class kpoint ++++++++++++++
template<typename T>
kpoint<T>::kpoint(){
// points = {};
ndim = N_DIM;
}
template<typename T... | ALGO | 0.999483 | 3.383833 |
2520f0c2-5f76-4a4a-a5a3-2211a830e48f | nickchen111/Leetcode | Dynamic_Programming/790. Domino and Tromino Tiling.cpp | /*
790. Domino and Tromino Tiling
*/
// 矩陣快速冪: TC:O(lgn) SC:O(1)
class Solution {
using LL = long long;
LL MOD = 1e9 + 7;
public:
int numTilings(int n) {
return f2(n-1);
}
int f2(int n) {
if(n == 0) return 1;
if(n == 1) return 2;
if(n == 2) return 5;
vector<... | ALGO | 0.999986 | 6.42062 |
3edf28ac-a467-4f1c-9ef1-fe4663fccd59 | CHH3213/chhRobotics_CPP | PathPlanning/Rapidly-exploring_Random_Tree_Star/RRT_Star.cpp | //
// Created by chh3213 on 2022/11/27.
//
#include "RRT_Star.h"
RRT_Star::RRT_Star(const vector<vector<double>> &obstacleList, const vector<double> &randArea,
const vector<double> &playArea, double robotRadius, double expandDis, double goalSampleRate,
int maxIter, double connect... | ALGO | 0.99993 | 4.008628 |
17e6fe7a-3a42-4cde-bc14-4d3d7a501d15 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_4756_0.cpp | #include <bits/stdc++.h>
using namespace std;
const int max_n = 111, inf = 1000111222;
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
struct state {
int num, x, y;
state(int num, int x, int y) : num(num), x(x), y(y) {}
void write() const { cout << num << " " << x + 1 << " " << y + 1 << "\n"; }
};... | ALGO | 0.999851 | 3.311925 |
feaf5881-01d8-4a8f-b4b5-5092061c0414 | kahuz/baekjoon | DFS_BFS/12851_숨바꼭질2.cpp | #include <iostream> // io
#include <queue> // queue
using namespace std;
//입력된 수빈이의 위치와 동생의 위치를 저장할 변수 선언 및 초기화
int N = 0, K = 0;
//중복 방문을 방지하기 위한 배열 선언 및 초기화
//check range 0 ~ 100000 이므로 배열 크기를 100001으로 선언
bool check[100001] = { 0 };
//탐색 깊이의 제한을 두기 위한 변수 선언 및 초기화
int search_limit = 100001;
//가장 빠르게 찾은 방법의 개수 ( 동... | ALGO | 0.999854 | 4.22839 |
1024a810-e01e-4f77-879a-13526cbee742 | sonalibante/ORE | QuantLib/ql/models/marketmodels/products/onestep/onestepoptionlets.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <ql/models/marketmodels/products/onestep/onestepoptionlets.hpp>
#include <ql/models/marketmodels/curvestate.hpp>
#include <ql/models/marketmodels/utilities.hpp>
#include <ql/payoff.hpp>
#include <ql/auto_ptr.hpp>
namespace QuantL... | ALGO | 0.944415 | 7.548162 |
54abd231-9595-4389-be6d-41e3d25223aa | ArcticFoox/autocommit_window | fizzbuzz.cpp | //28702 math
#include<iostream>
#include<cctype>
#include<string>
using namespace std;
int ans;
int main(){
string a, b, c;
cin >> a >> b >> c;
if(isdigit(a[0])) ans = stoi(a) + 3;
else if(isdigit(b[0])) ans = stoi(b) + 2;
else ans = stoi(c) + 1;
if(ans % 3 == 0 && ans % 5 == 0){
co... | ALGO | 0.999896 | 4.26205 |
13f255f1-d140-4bb2-a495-301998055c2c | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_8026_4.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
pair<long long, long long> a[100010];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; ++i) cin >> a[i].first >> a[i].second;
sort(a + 1, a + n + 1);
long long ans = -1e9;
for (int i = 1; i <= n; ++... | ALGO | 0.999826 | 4.077154 |
cc1e7ce0-bffe-4df0-92b2-f90186616133 | CodeCatX/Ingenier-a-de-Software | Ingenieria_de_Software/Segundo_semestre/Estructura_de_datos/Repaso/Lista/Lista.cpp | #include <iostream>
using namespace std;
struct Nodo {
int dato;
Nodo *sig;
};
Nodo *crearNodo(int x) {
Nodo *ap = new Nodo;
ap -> dato = x;
ap -> sig = nullptr;
return ap;
}
void imprimirRecursivo(Nodo *head) {
if (head != nullptr) {
cout << head -> dato << " ";
imprimirR... | ALGO | 0.999676 | 4.655606 |
e34bf238-e2ba-42be-bf30-64b8f7e3c12d | velazqua/competitive-programming | online-judges/UVa/11824/11824.cpp | /* Alex Velazquez
* Start: Fri Feb 24 20:29:17 EST 2012
* End : Wed Feb 29 19:52:12 EST 2012
*/
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#i... | ALGO | 0.999563 | 3.760751 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.