uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a6be362b-e693-4293-936d-3f3378f3d508 | SOFTK2765/PS | BOJ/5355.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
double a;
char b[500];
memset(b, 0, sizeof(b));
scanf("%lf", &a);
gets(b);
for(int i=1;b[i]!='\0';i+=2)
{
if(b[i]=='@') a *= 3;
... | ALGO | 0.982618 | 3.248672 |
c8564c34-cdbe-4d59-ba5f-87f8740881f0 | tnqkr98/Algorithm-Study | BeakjoonOnlineJudge/baek13580(Andando no tempo).cpp | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a==b || a==c || b==c
|| a+b==c || a+c==b || b+c==a)
cout << "s";
else cout << "n";
return 0;
} | ALGO | 0.99953 | 3.956326 |
754aa929-002b-41ad-8e06-26e004511d10 | manu05X/Leetcode | 0542-01-matrix/0542-01-matrix.cpp | class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& matrix) {
int rows = matrix.size(); // Number of rows in the matrix
int cols = matrix[0].size(); // Number of columns in the matrix
vector<vector<int>> dist(rows, vector<int>(cols, -1)); // Initialize the distanc... | ALGO | 0.999994 | 7.280297 |
6c71bfa3-8c74-4e81-aa82-56488000ed4b | J0shuaLeong/CG2111A | opencv/modules/video/src/camshift.cpp | #include "precomp.hpp"
int cv::meanShift( InputArray _probImage, Rect& window, TermCriteria criteria )
{
CV_INSTRUMENT_REGION();
Size size;
int cn;
Mat mat;
UMat umat;
bool isUMat = _probImage.isUMat();
if (isUMat)
umat = _probImage.getUMat(), cn = umat.channels(), size = umat.siz... | ALGO | 0.999812 | 6.413995 |
ce1182b3-6eee-4558-bcae-708920c4931d | dhnesh12/codechef-solutions | 04-CodeChef-Hard/106--Renting Spare Oven Time.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define IN freopen("testing.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout... | ALGO | 0.999934 | 3.696584 |
93a2e1af-906d-416c-81e9-547db15bdf4a | sajjadhussains/data-structure | searching/exam5.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
int ans;
if(a!=b && b!=c && a!=c)
{
ans=3;
}
else if(a == b && b == c)
{
ans = 1;
}
else{
ans = 2;
}
cout<<ans<<endl;
return 0;
}
| ALGO | 0.999984 | 4.339993 |
2549eaac-24a2-4444-b7c7-1a203b96260a | SWEG-2016EC-Batch/Quantum-leap | ETS1403_Yafet_Michael/Salary_calculator.cpp | #include <iostream>
using namespace std;
int main() {
float base_salary,gross_salary,working_hour,bonus_rate,tax_rate,extra_hour=0;
cout<<"Enter your base salary: ";
cin>>base_salary;
cout<<"Enter your working hours in hour: ";
cin>>working_hour;
cout<<"Enter your bonus rate in %: ";
cin>>bo... | ALGO | 0.968742 | 3.185574 |
8f296e3b-1b18-46d7-bff2-09e90775a899 | puentemonte/Segundo-IngInfor-UCM | ED/P1_ProximoTren/main.cpp | // Estibaliz Zubimendi
// A79
#include <iostream>
#include <iomanip>
#include <fstream>
#include "header.h"
Hora siguienteHora(std::vector<Hora> const& v, Hora const&h) {
auto low = std::lower_bound(v.begin(), v.end(), h);
if (low == v.end()) throw std::invalid_argument("NO");
return *low;
}
// Resuelve ... | ALGO | 0.974193 | 5.245016 |
65f5dde4-6cc8-4af1-8f1a-4b8adb249bf8 | Siddharth3271/Leetcode-Problems | 1338. Reduce Array Size to The Half.cpp | class Solution {
public:
int minSetSize(vector<int>& arr) {
//T.C.=O(n log n)
//S.C.=O(n)
map<int,int>mp;
//by default map orders according to keys in ascending order
//reverse the ordering->frequency first then key and by descending order
for(auto it:arr){
... | ALGO | 0.999975 | 5.742287 |
49282850-65d1-4b86-92a4-cc3514c57757 | luqmanarifin/cp | 0-unclassified/lnumbers.cpp | #include <bits/stdc++.h>
using namespace std;
int len(int num, int base) {
int ret = 0;
while(num) {
ret++;
num /= base;
}
return (ret? ret : 1);
}
int main() {
int t;
scanf("%d", &t);
while(t--) {
int n, k;
scanf("%d %d", &n, &k);
int l = 2, r = n + 1;
while(l < r) {
int ... | ALGO | 0.99976 | 4.188703 |
a1d2615a-2249-423c-bc70-a228a9f0ea36 | kche1106/CodingTestLecture | CodingTestLecture/77.cpp | //
// 77.cpp
// CodingTestLecture
//
// Created by 김채은 on 2023/04/03.
//
#include <iostream>
using namespace std;
//공통원소가 있으면 하나의 집합으로
//disjoint-set : 서로소 집합
int unf[1001];
int find(int v) {
//v라는 학생의 집합 번호 리턴
if(v == unf[v]) return v;
else return unf[v] = find(unf[v]); //결국 루트노드가 집합 번호가 됨(메모이제이션)
}... | ALGO | 0.999996 | 5.437975 |
35208286-eba2-442a-9643-311a43640690 | thinhvip1/28Tech | bai_tap_c/arr2D/dem_snt_tren_duong_cheo_chinh_va_phu1.cpp | #include <bits/stdc++.h>
using namespace std;
int nt[10001];
bool isPrime(int n){
if(n < 2) return false;
if(n==2 || n==3) return true;
if(n%2==0 || n%3==0) return false;
for(int i = 5; i*i <= n; i+=6)
if(n%i==0||n%(i+2)==0) return false;
return true;
}
void sangnt(int n){
for(int i = 0;... | ALGO | 0.999983 | 4.111802 |
5521597e-f4ae-4941-bf67-423c3a1309b6 | weixiangchen1/LeetCode | 129. 求根节点到叶节点数字之和.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.999936 | 6.767001 |
1527d1aa-eaf9-4e2f-a599-114342f67511 | cinder/Cinder | blocks/Box2D/src/Box2D/Dynamics/Joints/b2DistanceJoint.cpp | #include <Box2D/Dynamics/Joints/b2DistanceJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// 1-D constrained system
// m (v2 - v1) = lambda
// v2 + (beta/h) * x1 + gamma * lambda = 0, gamma has units of inverse mass.
// x2 = x1 + h * v2
// 1-D mass-damper-spring system
// m (v2 - v1... | ALGO | 0.998201 | 7.19491 |
5930f284-c9bb-4672-88f6-84ce96a571cc | ArielQuinn/AIProject | Competition/solvers/enumerative/esolver-synth-lib/src/z3-4.3.1/src/util/cooperate.cpp | #include"z3_omp.h"
#include"cooperate.h"
#include"trace.h"
#include"debug.h"
struct cooperation_lock {
omp_nest_lock_t m_lock;
char const * m_task;
volatile int m_owner_thread;
cooperation_lock() {
omp_set_nested(1);
omp_init_nest_lock(&m_lock);
m_task = 0;
m_ow... | TOOL | 0.896172 | 4.410498 |
58294fbe-5337-44e9-9e3f-7fa5a366b0dc | kristofe/GameEngine | SupportLibraries/bullet-2.76/Extras/CDTestFramework/BipartiteBoxPruning.cpp | /*
CDTestFramework http://codercorner.com
Copyright (c) 2007-2008 Pierre Terdiman, <EMAIL>
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software... | ALGO | 0.942901 | 6.009002 |
65bad26b-b2ee-4172-bd89-f4fa9d4d9a2f | tokumaru-y/CompetitiveCPP | typical90/resolved/75_sample.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
vector<int> dx{ 1, 0, -1, 0 };
vector<int> dy{ 0, 1, 0, -1 };
ll MOD = 1000000007;
ll N;
ll prime_sum = 0;
ll ans = 0;
vector<pair<ll, ll>>prime_list(ll n){
vector<pair<ll, ll>> res;
for(ll ... | ALGO | 0.999984 | 4.943715 |
ecc878ed-24e7-4ed2-871d-8ef50299c308 | SoumyadipOjha/LeetCode_Problems | 485-max-consecutive-ones/max-consecutive-ones.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int ans=0;
int n=nums.size();
int cnt=0;
for(int i=0;i<n;i++){
if(nums[i]==1)cnt++;
else{
cnt=0;
}
ans=max(ans,cnt);
}
... | ALGO | 0.999978 | 6.09633 |
7f928511-4c9b-4899-b8b4-d466ce5ef7f2 | jonas7654/mlp.cpp | Matrix_Based/src/mlp.cpp | #include "../include/mlp.h"
mlp::mlp(const size_t number_of_layers, const size_t layer_sizes[], const size_t batch_size, const bool use_one_hot) {
num_layers = number_of_layers - 1; // Exclude input layer
this->context_size = layer_sizes[0]; // store the context_size for better code readabillity
this->out... | ALGO | 0.9336 | 3.759689 |
51b36971-8471-49a7-8d77-71ac64255c65 | joeedh/sculptcore | extern/eigen_dist/bench/perf_monitoring/trmv_lot.cpp | #include "gemv_common.h"
EIGEN_DONT_INLINE
void trmv(const Mat &A, Vec &B, const Vec &C)
{
B.noalias() += A.transpose().triangularView<Lower>() * C;
}
int main(int argc, char **argv)
{
return main_gemv(argc, argv, trmv);
}
| ALGO | 0.987179 | 5.021466 |
14dbae71-7b2a-47b7-8209-4cd939405832 | Harsh5chal/Programming | InterviewBit/mergeinterval.c++.cpp | #include<bits/c++io.h>
#include<algorithm>
#include<stack>
#include<iostream>
//with overlapping
using namespace std;
struct Interval
{
int start,end;
};
bool compareInterval(Interval i1,Interval i2)
{
return (i1.start<i2.start);
}
void mergeInterval(Interval arr[],int n)
{
if(n<=0)
return;
... | ALGO | 0.99965 | 5.191189 |
1068065c-ed8e-4eb2-94f4-29fd6a4c5ca5 | ChiRuiChen/Deepcalo_Linchi_singlestream | myproject_prj/solution1/syn/systemc/zeropad2d_cl_me_ap_fixed_ap_fixed_config57_s.cpp | #include "zeropad2d_cl_me_ap_fixed_ap_fixed_config57_s.h"
#include "AESL_pkg.h"
using namespace std;
namespace ap_rtl {
const sc_logic zeropad2d_cl_me_ap_fixed_ap_fixed_config57_s::ap_const_logic_1 = sc_dt::Log_1;
const sc_logic zeropad2d_cl_me_ap_fixed_ap_fixed_config57_s::ap_const_logic_0 = sc_dt::Log_0;
const sc_... | TOOL | 0.92495 | 4.556113 |
5c04f682-812d-47a9-afd0-3ed3bf337f9d | govindvarma1/LeetCode-Problems | 0153-find-minimum-in-rotated-sorted-array/0153-find-minimum-in-rotated-sorted-array.cpp | class Solution {
public:
int findMin(vector<int>& nums) {
int n = nums.size();
int low = 0, high = n-1;
while(low<=high) {
int mid = (low+high)/2;
if(nums[mid]<nums[low] && nums[mid]<nums[high]) {
high = mid;
} else if(nums[low]<=nums[mid] ... | ALGO | 0.999989 | 5.829333 |
04b14138-1a0e-48a1-9b53-d496d5065bd8 | 01LuGuang/Algorithm | Practice/DP/树形DP.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 6010;
int H[N];
vector<int> tree[N];
int dp[N][2]; //dp[u][0] 不来 dp[u][1] 来
bool has_parent[N]; //寻找祖宗结点
void dfs(int u) {
dp[u][1] = H[u]; //来的话加上自己的快乐值
for(int v : tree[u]) {
dfs(v);
... | ALGO | 0.999988 | 4.029719 |
b6917f32-8fb1-40db-9f84-071a04ce4a78 | sangeeta0201/fpsanitizer | llvm/lib/MC/MCCodeView.cpp | #include "llvm/MC/MCCodeView.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/M... | TOOL | 0.866213 | 7.540946 |
30f5860e-43bd-43c8-a302-d6a409315add | draguve/Ender3ProMarlin | Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp | #include "../../../inc/MarlinConfigPre.h"
#if BOTH(DWIN_LCD_PROUI, HAS_LEVELING)
#include "../../marlinui.h"
#include "../../../core/types.h"
#include "../../../feature/bedlevel/bedlevel.h"
#include "../../../module/probe.h"
#include "../../../gcode/gcode.h"
#include "../../../module/planner.h"
#include "../../../gco... | TOOL | 0.89131 | 6.704621 |
0c7bdaa3-00e7-4a75-b7a5-d8b9ab67402a | gonzavesc/convection_final | boundary.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath> //std::pow abs
#include <new>
#include <algorithm> //std::max
#include "read.hpp"
#include "initialize.hpp"
#include "export.hpp"
#include "method.hpp"
#include "boundary.hpp"
inlet::inlet(const double& a)
{
alpha = ... | ALGO | 0.994306 | 3.621894 |
34cf1424-0a93-4b46-98d3-fffbb01f5575 | Srey-3112/LeetcodeDSA | 0424-longest-repeating-character-replacement/0424-longest-repeating-character-replacement.cpp | class Solution {
public:
int characterReplacement(string s, int k) {
// int maxLen=0;
// for(int i=0;i<s.size();i++){
// int hash[26]={0};
// int maxF=0;
// for(int j=i;j<s.size();j++){
// hash[s[j]-'A']++;
// maxF=max(maxF, hash[s... | ALGO | 0.999967 | 6.304075 |
4fd844ab-bea2-4a06-92d6-93c4ee56e782 | Zimse12345/Code | AtCoder_Contest/ABC382/F.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <math.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define bendl(x) x.begin(), x.end()
#define siz(x) ((int)(x).size())
//#define int long long
usin... | ALGO | 0.999975 | 4.217474 |
ca90e990-6d16-4522-92f3-1847ee7b019d | udoydev/Cp_Problems | assust university sheet/486a.cpp | #include <cmath>
#include <iostream>
using namespace std;
int main()
{
long long n, a;
cin >> n;
if(n % 2 == 0) a = n / 2;
else a = ((n + 1) / 2) * (-1);
cout << a << endl;
return 0;
}
//easy one you did not cacth it idiot | ALGO | 0.999938 | 3.754602 |
15c676f9-ed27-4271-b6df-d85fe99b0e2e | snl-dakota/dakota-packages | muq2/modules/Modeling/src/MultiLogisticLikelihood.cpp | #include "MUQ/Modeling/MultiLogisticLikelihood.h"
using namespace muq::Modeling;
MultiLogisticLikelihood::MultiLogisticLikelihood(unsigned int numClassesIn,
Eigen::VectorXi const& dataIn) : ModPiece(numClassesIn*dataIn.size()*Eigen::VectorXi::Ones(1),
... | DATA | 0.869899 | 6.382165 |
aae595a9-90c9-4ccb-98ff-4567bab14dfa | mfooo/mangos | dep/tbb/src/old/spin_rw_mutex_v2.cpp | #include "spin_rw_mutex_v2.h"
#include "tbb/tbb_machine.h"
#include "../tbb/itt_notify.h"
namespace tbb {
using namespace internal;
static inline bool CAS(volatile uintptr &addr, uintptr newv, uintptr oldv) {
return __TBB_CompareAndSwapW((volatile void *)&addr, (intptr)newv, (intptr)oldv) == (intptr)oldv;
}
//!... | TOOL | 0.976158 | 7.085324 |
6c3e428d-fdcf-42ee-8dd8-84ea13e02579 | LeonardXu1/MIE443 | src/mie443_contest2/src/pathPlanning.cpp | #include "../include/pathPlanning.h"
int const NUMBER_OF_POINT=5;
int const NUMBER_OF_BOXES=5;
float dx;
float dy;
float pathPlanning::CalDistance(float dx, float dy){
float distance=std::sqrt(std::pow(dx,2)+std::pow(dy,2));
return distance;
}
std::vector<int>pathPlanning::pathPlan(std::vector<float> startPos, ... | ALGO | 0.999947 | 3.818517 |
fa0008b7-21c7-4011-be4a-6011bd553986 | Mohid169/MPC_cart_pend | eigen-3.4.0/bench/perf_monitoring/trmv_lot.cpp | #include "gemv_common.h"
EIGEN_DONT_INLINE
void trmv(const Mat &A, Vec &B, const Vec &C)
{
B.noalias() += A.transpose().triangularView<Lower>() * C;
}
int main(int argc, char **argv)
{
return main_gemv(argc, argv, trmv);
}
| ALGO | 0.973701 | 5.021466 |
acf619c5-437a-4be1-88c2-0aec54b8296b | pvanek/sqliteman | Sqliteman/sqliteman/qscintilla2/src/LexAU3.cpp | #include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
stati... | TOOL | 0.873238 | 3.886212 |
e201261d-c366-4d6e-8696-718ce136de46 | leoni05/Teamnote | 1-Math/4-chinese-remainder-theorem.cpp | // 3으로 나누었을 때 2가 남고, 5로 나누었을 때 3이 남고, 7로 나누었을 때 2가 남는 수는 무엇인가?
// 위와 같은 질문에 대한 해답을 구하는 법
// gcd(ni,nj)=1, i!=j 이면 다음 연립 합동식은
// x = a1(mod n1)
// x = a2(mod n2)
// x = a3(mod n3)
// ...
// x = ak(mod nk)
// 은 법 n1n2n3...nk에 대하여 유일한 해를 갖는다.
// N = n1*n1*n2*...*nk
// Ni = N/ni 일때, Ni와 ni가 서로소이므로 베주항등식에 따라 MiNi + mini =... | ALGO | 0.999898 | 4.263237 |
c2126842-94ff-4e90-a754-53fd32973c66 | ishandutta2007/codeforces | jjleo/normal/1476/A.cpp | #include <bits/stdc++.h>
#define maxn 100086
using namespace std;
int t, n, k;
int main(){
scanf("%d", &t);
while(t--){
scanf("%d%d", &n, &k);
if(n <= k) printf("%d\n", (k + n - 1) / n);
else printf("%d\n", n % k == 0 ? 1 : 2);
}
} | ALGO | 0.999322 | 3.734741 |
fbb42528-0c03-4199-858a-585cfe0557f4 | SanketDeshmukh007/Data-Structures-and-Algorithms | Array/Missing_Element_With_Duplicates.cpp | #include <iostream>
using namespace std;
int MissingElement(int a[], int n)
{
for (int i = 0; i < n; i++)
{
int index = abs(a[i]);
if (a[index - 1] > 0)
a[index - 1] = -a[index - 1];
}
for (int i = 0; i < n; i++)
{
if (a[i] > 0)
return i + 1;
}
... | ALGO | 0.999908 | 4.793208 |
d705ad5d-0d18-4e4b-9d79-6812ae03e50e | akshaykhandelwal0710/cpp_templates | treap.cpp | struct Data {
char val;
Data() {
val = 'a';
}
};
struct treap{
Data val;
treap *left, *right;
int weight, size;
treap(Data &vl) {
size = 1;
weight = rand();
left = right = nullptr;
val = vl;
}
void update() {
size = get_size(left) +... | ALGO | 0.998575 | 3.750682 |
04a091e2-d0a9-4002-b1cf-80f83cf8d743 | Badger-RL/BadgerRLSystemCodeRelease2023 | Src/Modules/Sensing/FootSupportProvider/FootSupportProvider.cpp | /*
* @file FootSupportProvider.cpp
*
* This file implements a module that provides an abstract distribution of
* how much each foot supports the weight of the robot.
*
* The code is based on parts of the class BodyModel from the code of the
* team UNSW Australia.
*
* @author Thomas Röfer
* @author Philip Reic... | ALGO | 0.976778 | 6.784017 |
04130fe3-04eb-4111-a8c2-ab230a56b682 | rks-031/DSA-codehelp-LB | b4 arrays/even_odd.cpp | #include <bits/stdc++.h>
using namespace std;
bool isEven(int num)
{
return (num % 2 == 0) ? true : false;
}
int main()
{
int num;
cin >> num;
bool val = isEven(num);
if (val == true)
{
cout << "even";
}
else
{
cou... | ALGO | 0.999805 | 4.22609 |
e2f1f5ec-5c18-4ad4-a5f1-1cc228834df2 | atanughosh01/Leetcode-grinder | 0104-maximum-depth-of-binary-tree/0104-maximum-depth-of-binary-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.999921 | 6.168714 |
801d8a03-93cf-469f-b605-04a27afb0d4f | Hari-Hara-2005/GFG | Difficulty: Easy/Convert to Roman No/convert-to-roman-no.cpp | class Solution {
public:
string convertToRoman(int n) {
// code here
static vector<int>val={1000,900,500,400,100,90,50,40,10,9,5,4,1};
static vector<string>num={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
string res="";
for(int i=0;i<val.size();i++)
... | ALGO | 0.999828 | 6.466612 |
2cc342de-d914-42a7-b9c5-186601986090 | fitrahidayaat/leetcode-150-top-interview-solutions | 083-average-of-levels-in-binary-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.999927 | 7.046199 |
dda14bc9-9ae8-4e67-a691-f8570fb1f6c3 | danx30/civilwar | MMOCoreORB/src/server/zone/objects/resource/simplexnoise/SimplexNoise.cpp | /** \file
\brief Implements the SimplexNoise class for producing Perlin simplex noise.
\author Stefan Gustavson (<EMAIL>)
*/
/*
* This implementation is "Simplex Noise" as presented by
* Ken Perlin at a relatively obscure and not often cited course
* session "Real-Time Shading" at Siggraph 2001 (before real
* ... | ALGO | 0.999497 | 4.599758 |
ed8ef37f-82ef-4d63-9392-13461ec637a6 | shawn-0519/Contatcs | Contatcs/Contacts.cpp | #include <iostream>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
using namespace std;
struct Contact {
string name;
string phone;
string addr;
string gender;
int age;
};
vector<Contact> contacts; // ڴ洢ϵ
int language = 0; // 0 ʾģ1 ʾӢ
// ˵ʾϢĶ֧
const string menu[2][8]... | TOOL | 0.925977 | 4.586792 |
9bc3ab9f-81cf-48d7-9282-9d8e494ea32e | sulmone/boost_1_53_0 | libs/bimap/example/simple_bimap.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is misleading and unsettling, there are no
// po... | TOOL | 0.8533 | 6.067896 |
d57ee408-5837-409e-9493-bce7cb0df9c2 | mdmahafuzur47/Problem-Solving | Github/Problem-Solving/Array/08-08-23/ReverseTheArray.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while (t--){
int size,m;
scanf("%d %d", &size,&m);
int arr[size];
for(int i=0; i<size; i++){
scanf("%d", &arr[i]);
}
int i=m+1, j=size-1,temp=0;
while(i<j){
temp = arr[i];
arr[i] ... | ALGO | 0.999832 | 3.283322 |
b5f13804-40f9-4df3-a519-66f90c06ee26 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_4552_11.cpp | #include <bits/stdc++.h>
using namespace std;
long long int n, a[101], sum;
bool chk() {
double x = ((double)sum * 10.00) / n;
return (x >= 45.00);
}
int main() {
scanf("%lld", &n);
for (long long int i = 0; i < n; i++) {
scanf("%lld", &a[i]);
sum += a[i];
}
sort(a, a + n);
long long int i = 0;
... | ALGO | 0.999895 | 3.962261 |
2dc177e1-3220-467f-b6f8-206ce24caf37 | LinXin04/LeetCode | Triangle.cpp | class Solution {
public:
int minimumTotal(vector<vector<int>>& triangle) {
if(triangle.size()==0) return 0;
if(triangle.size()==1) return triangle[0][0];
for(int i=triangle.size()-2;i>=0;i--)
{
for(int j=0;j<=i;j++)
triangle[i][j]+=min(triangle[i+1][j],tri... | ALGO | 0.999972 | 6.220694 |
0518fb2b-fa2b-4666-82b9-22a20774c4dd | kagasan/atcoder | abc/abc104/4.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
ll tri[101010];
ll hoge(ll a, ll b, ll c, ll d){
a = (a * b) % MOD;
c = (c * d) % MOD;
return (a * c) % MOD;
}
ll calc(ll A, ll L, ll C, ll R){
ll tmp = 0;
tmp = (tmp + hoge(A, C, tri[L], tri[R])) % MO... | ALGO | 0.999939 | 3.97177 |
10eae545-31b6-46b7-83a9-33fcaff1d20e | serine-18/recursion- | 7.cpp | #include<stdio.h>
bool odd (int);
int main(){
int number;
scanf("%d",&number);
if (odd(number))
printf ("true");
else
printf ("false");
}
bool odd(int n){
if(n>0){
if (n<10)
return (n%2!=0);
else
return ((n%10)%2!=0&&odd(n/10));
}
} | ALGO | 0.9999 | 3.491925 |
2cc890c4-3972-4eb9-967e-e6d6b4fd085f | Keyu-He/Enhancing-Debugging-Skills-of-LLMs-with-Prompt-Engineering | solutions_correct/algorithms/S/Sum Game/Sum Game.cpp | class Solution {
public:
bool sumGame(string num) {
const int N = num.length();
int lDigitSum = 0;
int lQCount = 0;
int rDigitSum = 0;
int rQCount = 0;
for(int i = 0; i < N; ++i){
if(isdigit(num[i])){
if(i < N / 2){
... | ALGO | 0.99995 | 5.952336 |
b09ae552-9128-46d6-98d8-be297185011e | theyashsolanki/DSA | Adhoc/easy/reverseLetters.cpp | #include "iostream"
using namespace std;
class Solution {
public:
string reverseOnlyLetters(string s) {
int i = 0;
int j = s.size() - 1;
// 65 -> 90 && 97 -> 122
while (i < j) {
int x = s[i];
int y = s[j];
if (!(x >= 65 && x <= 90) && !(x >= 97 && x <= 122))
i++;
else i... | ALGO | 0.987669 | 5.722708 |
9cca8ec0-1ec6-4bdd-a7db-9df9ffd31e1e | ishandutta2007/codeforces | intothenight/normal/1398/B.cpp | #include "bits/stdc++.h"
using namespace std;
int main(){
cin.tie(0)->sync_with_stdio(0);
auto __solve_tc = [&](int __tc_num){
string s;
cin >> s;
int n = int(s.size());
vector<int> a;
for(auto i = 0; i < n; ){
while(i < n && s[i] == '0'){
++ i;
}
if(i == n) break;
int j = i;
while(j < n... | ALGO | 0.999972 | 4.827152 |
e9e64d0e-bc13-4cde-97c2-74833a72b8be | greymaner/tx2_uav_fengdian | modules/nanogui/ext/eigen/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp | MatrixXd A = MatrixXd::Random(6,6);
cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
EigenSolver<MatrixXd> es(A);
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
complex<double> l... | ALGO | 0.999505 | 3.093769 |
13fd8730-2160-4542-8528-ab0c84735dec | toby-j/pathvision | pathvision/models/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cpu.cpp | namespace detectron2 {
template <typename scalar_t>
at::Tensor nms_rotated_cpu_kernel(
const at::Tensor& dets,
const at::Tensor& scores,
const double iou_threshold) {
// nms_rotated_cpu_kernel is modified from torchvision's nms_cpu_kernel,
// however, the code in this function is much shorter because
... | ALGO | 0.994028 | 7.662067 |
f18be83c-89d5-40f0-8829-12f98bdbe467 | moondemon68/cp | Codeforces/PastContests/1301/B.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define LL long long
using namespace std;
int main () {
//clock_t start = clock();
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
... | ALGO | 0.999902 | 3.73245 |
a96a6fbb-a011-4a9b-a673-03e84c2d3c7b | phamkhanh-TB/c | fraction plus using overloading.cpp | #include <bits/stdc++.h>
using namespace std;
struct phanso{
int a;
int b;
friend istream& operator >>(istream &is,phanso &p){
is>>p.a>>p.b;
return is;
}
friend ostream& operator <<(ostream &os,phanso p ){
os<<p.a<<"/"<<p.b;
return os;
}
friend phanso operator... | ALGO | 0.999611 | 3.952748 |
4a0792e6-5d57-4c42-ae32-14349be1c6bd | HPC-Courses/AMSC-Labs | Labs/2022-23/lab06/ex04/solution.cpp | #include <iostream>
#include <array>
#include <random>
#include <string>
#include <iomanip>
#include <numeric>
#include <algorithm>
#include <omp.h>
constexpr size_t dim = 2;
using Point = std::array<double, dim>;
using KDTree = std::vector<std::pair<size_t, size_t>>;
size_t build_kdtree_recursive(const std::vect... | ALGO | 0.999961 | 5.948328 |
7c8d9f1b-17ac-418b-836b-2fee0cf7c63c | snodeco/snode-coin | src/coins.cpp | #include "coins.h"
#include "random.h"
#include <assert.h>
/**
* calculate number of bytes for the bitmask, and its number of non-zero bytes
* each bit in the bitmask represents the availability of one output, but the
* availabilities of the first two outputs are encoded separately
*/
void CCoins::CalcMaskSize(u... | ALGO | 0.960287 | 7.059897 |
62bbb559-878c-4597-9da3-87cc410e5ae0 | khanhbuiduc/ICPC | algo_course/Thang6/Buoi3/3. findingRPS/sol.cpp | #include <iostream>
#include <string>
#include <math.h>
int cntR[400005], cntS[400005], cntP[400005];
std::string s;
int n, numTest;
int main () {
std::cin >> numTest;
for (int testCase = 1; testCase <= numTest; testCase++) {
std::cin >> s;
n = (int) s.size();
for (int i = 0; i <= n; i++) {
c... | ALGO | 0.999745 | 4.232788 |
35b24a62-61bb-42c2-85b3-56d87677c8db | justin0u0/LeetCode | problems/3011-find-if-array-can-be-sorted/solution.cpp | /**
* Author: justin0u0<<EMAIL>>
* Problem: https://leetcode.com/problems/find-if-array-can-be-sorted/
* Runtime: 0ms (100.00%)
*/
class Solution {
public:
bool canSortArray(vector<int>& nums) {
nums.emplace_back(0xFFF);
int mx = 0;
int next = 0;
int bits = 0;
for (int num : nums) {
co... | ALGO | 0.99945 | 5.800776 |
b10f86fb-3cad-40bc-9737-b15da4e16970 | dzbanek7/dzban | aiter_zadania/aiter/alg_iteracyjny.cpp | /*
* alg_iteracyjny.cpp
*
*/
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
int n;
float iloczyn = 1;
float a;
cout << "Podaj liczbę całkowitą: ";
cin >> n;
for (int i=1; i <= n; i++) {
cout << "Podaj liczbę: ";
cin >> a;
iloczyn *= a;
... | ALGO | 0.989619 | 3.441004 |
80742be8-bcd6-4728-9c3d-e7c1dc132012 | anhngoxitin01/ProjectGLv2 | TrainingFramework/src/GameManager/CollisionManager.cpp | #include"CollisionManager.h"
CollisionManager::CollisionManager()
{
}
CollisionManager::~CollisionManager()
{
}
/*
* return -1 if not check successful
* return other value if successful
*/
int CollisionManager::isCollBetweenPlayerAndItemMap(MRectangle pl, int speed, int direction, int& distancePlaAndBarrier , int& s... | TOOL | 0.990954 | 3.477689 |
3541b8c6-8c0d-4c34-bc09-5e38596f69f5 | areian13/kgu-clab-2024-2-algorithm-basic-study | 1주차/과제/wodls1593/7.소수구하기_1(2020KB,148ms).cpp | #include <iostream>
using namespace std;
bool Squrt(int n){
if(n==1) return false;
if(n==2) return true;
for(int i = 2;i*i<=n;i++){
if(n%i ==0)
return false;
}
return true;
}
int main(){
int M,N;
cin >> M >> N;
for(int i = M;i<=N; i++){
if(Squrt(i))
... | ALGO | 0.99992 | 3.387143 |
22ce9a80-4830-44b2-8e37-e8754aa855ce | nebulaed/My_LeetCode_Road | Code/12.整数转罗马数字.cpp | #include<iostream>
#include<string>
using namespace std;
class Solution {
public:
string intToRoman(int num) {
string ret = "";
int digits[4] = { 0,0,0,0 };
const string roman = "IVXLCDM";
digits[3] = num / 1000;
digits[2] = (num % 1000) / 100;
digits[1] = (num % 10... | ALGO | 0.999363 | 6.06606 |
6d73f1cf-b424-4715-9d17-abbaa02447a1 | lakshita157/6-Companies-30-Days | 1189-maximum-number-of-balloons/1189-maximum-number-of-balloons.cpp | class Solution {
public:
int maxNumberOfBalloons(string text) {
unordered_map<char,int>mp;
for(auto x:text){
mp[x]++;
}
// int ans=0;
int bcount=0;
int acount=0;
int lcount=0;
int ocount=0;
int ncount=0;
for(auto x:mp){
... | ALGO | 0.999765 | 5.628814 |
20e479f2-fa77-49f4-b10d-34a84c383a37 | ruturajjena/android_device_lenovo_kuntao | gps/utils/loc_misc_utils.cpp | #define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_misc_utils"
#include <stdio.h>
#include <string.h>
#include <platform_lib_log_util.h>
#include <loc_misc_utils.h>
#include <ctype.h>
int loc_util_split_string(char *raw_string, char **split_strings_ptr,
int max_num_substrings, char delimiter)
{
... | TOOL | 0.952942 | 5.316868 |
901da6b1-ee63-4559-9a9a-9951dc5bd370 | peterjc123/magma | src/zgetrf_nopiv_batched.cpp | /*
-- MAGMA (version 2.5.4) --
Univ. of Tennessee, Knoxville
Univ. of California, Berkeley
Univ. of Colorado, Denver
@date October 2020
@author Azzam Haidar
@author Adrien Remy
@precisions normal z -> s d c
*/
#include <cuda_runtime.h>
#include "magma_internal.h"
#include "batched_kernel_par... | ALGO | 0.999232 | 6.295114 |
cf3bbbfc-73f7-4b4a-a583-9d4db5a22266 | magnuaub/gem5 | src/systemc/tests/systemc/misc/synth/combo/switch3/switch3.cpp | /*****************************************************************************
switch3.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/****************************************************************************... | TOOL | 0.944538 | 4.566834 |
0ab32a1e-f34e-4f64-9ce2-59ff3125d320 | otavioon/COLA-2022-Tools | datasets/src/algo/codenet/4/s092954260.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;
#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << ... | ALGO | 0.997279 | 3.190885 |
d3cd6811-05b2-453f-b2cb-042575c6fd28 | VenkataDurgareddy/owlcoder-progs | level-3/count unique characters.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
getline(cin,s);
transform(s.begin(),s.end(),s.begin(),::tolower);
int c=0;
vector<char>v;
for(int i=0;i<s.length();i++)
{
if(s[i]!=' ')
{
v.push_back(s[i]);
}
}
for(auto it:v)
... | ALGO | 0.999705 | 3.892788 |
21e8626d-0dd6-459f-a4ed-38b7f3c58c67 | ishandutta2007/codeforces | everule/normal/1389/D.cpp | #include <iostream>
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long int;
template<typename T>
ostream& operator+(ostream& out, const vector<T> &vec){
for(const auto &x : vec){
out<<x<<" ";
}
out<<"\n";
return out;
}
template<typename T... | ALGO | 0.999885 | 3.602648 |
badc1686-353d-4244-bc51-4dca358baa33 | hfinkel/llvm-project-csp | libcxx/test/std/utilities/function.objects/func.search/func.search.default/default.pred.pass.cpp | // <functional>
// UNSUPPORTED: c++98, c++03, c++11, c++14
// default searcher
// template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
// class default_searcher {
// public:
// default_searcher(_ForwardIterator __f, _ForwardIterator __l,
// _BinaryPredicate __p = _Bina... | TEST | 0.909121 | 6.626993 |
af21d85d-185f-4514-ba9f-45df1acec758 | CGCL-codes/G4S | cantera/ext/eigen/unsupported/bench/bench_svd.cpp | // Bench to compare the efficiency of SVD algorithms
#include <iostream>
#include <bench/BenchTimer.h>
#include <unsupported/Eigen/SVD>
using namespace Eigen;
using namespace std;
// number of computations of each algorithm before the print of the time
#ifndef REPEAT
#define REPEAT 10
#endif
// number of tests of t... | TEST | 0.993316 | 6.26191 |
e9878509-ce21-4be1-b1f7-2634a7ffc399 | YellowWang/UVa | uva10130/uva10130.cpp | // uva10130 dp
// 0-1⣬ùʵ֣עͲΪͨʵ֡
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <memory.h>
#include <queue>
#include <deque>
#include <vector>
#include <math.h>
#include <set>
using namespace std;
#define len 1001
#define total_len 31
struct Node
{
int price;
int weigh... | ALGO | 0.999907 | 3.645919 |
7907eb20-ab7e-4efe-bb18-55ded3872edd | ianhook/OCRManga | tesstwo/src/main/jni/com_googlecode_tesseract_android/src/cube/word_size_model.cpp | #include <math.h>
#include <string>
#include <vector>
#include "word_size_model.h"
#include "cube_utils.h"
namespace tesseract {
WordSizeModel::WordSizeModel(CharSet * char_set, bool contextual) {
char_set_ = char_set;
contextual_ = contextual;
}
WordSizeModel::~WordSizeModel() {
for (int fnt = 0; fnt < font_p... | ALGO | 0.889683 | 6.56839 |
e4dc76e6-b9d0-4fda-9f98-dffd24ba987e | Van1yu3/SWKM | src/kmeans_hartigan.cpp |
// [[Rcpp::depends(RcppArmadillo)]]
#include <RcppArmadillo.h>
#include <Rcpp.h>
using namespace Rcpp;
using namespace arma;
// [[Rcpp::plugins(cpp11)]]
// Calculate euclidean distance (square)
mat CalEucDist(mat X,mat C){
mat Dis(X.n_rows,C.n_rows); //n by p
mat temp(size(X));
for(unsigned int i=0;i<C.n_rows;+... | ALGO | 0.999979 | 6.605254 |
e40b6f05-4603-4870-902b-f0d81ad2bde0 | Raiyan-sharif/artificial-inteligence | AStarSearch.cpp | #include<bits/stdc++.h>
using namespace std;
const int a= 999;
const int Lim = 99999999;
int N, E, mat[a][a], distence[a], parent[a];
int start,finish,path[a];
//={7,6,2,1,0};
int main(){
for( int i = 0; i < a; i++ )
{
parent[i] = -1;
distence[i] = Lim;
for( int j = 0; j < a; j++ )
... | ALGO | 0.999995 | 3.898312 |
4476c00e-f8c2-4882-93d0-ec545dd6dbdb | karan-saroya/UVACode | Primes & Misc/11408_CountDePrime.cpp | #include<stdio.h>
#include<stdlib.h>
bool sieve[5000001];
int is_deprime[5000001];
int copy[5000001];
int main()
{
for(int i=0;i<5000001;i++)
{
sieve[i]=true;
is_deprime[i]=0;
copy[i]=i;
}
for(int i=2;i<5000001;i++)
{
if(sieve[i])
{
for(int j=2*i;j<5000001;j+=i)
{
sieve[j]=false;
i... | ALGO | 0.999726 | 3.247553 |
61a45221-5ec1-4f57-9b48-27443c7ccd5e | ryank157/asm | ch5 - AVX SFP/L2/code.cpp | //------------------------------------------------
// Ch05_02.cpp
//------------------------------------------------
#include <iomanip>
#include <iostream>
// No need for Windows-specific headers like <tchar.h> or <windows.h>
using namespace std;
// Corrected function signature with pointers for _sa and... | TOOL | 0.964576 | 6.412412 |
e5e7fe49-eb57-4d37-a986-82c51b92f1ba | Moloshow/gpuprogrammingTP | MatMul CPU C++/eigen-3.3.7/doc/examples/Tutorial_BlockOperations_corner.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::Matrix4f m;
m << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10,11,12,
13,14,15,16;
cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl;
cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << ... | ALGO | 0.998928 | 4.092313 |
cc35e48c-d8bb-4030-a7e3-b4b3ffa8e325 | luthanhy/LearnCode | Practice_Leetcode/can_place_flower.cpp | #include "iostream"
#include "vector"
using namespace std;
class Solution {
public:
bool canPlaceFlowers(vector<int>& flowerbed, int n) {
int size = flowerbed.size();
int count = 0 ;
for(int i = 0 ;i < flowerbed.size() ; i++){
if(flowerbed[i] == 0){
if(flowerbed[... | ALGO | 0.999963 | 6.017769 |
b17b761d-aa3a-44b0-a32a-0862a2451236 | Edith-mounting/Competitive_programming_problems_solution | B_Math.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define mt make_... | ALGO | 0.999919 | 3.402899 |
b5d05838-efd0-4bdc-aaed-969e7be95a48 | shiblasharif/Tasker | 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.998689 | 6.787361 |
c7e62173-c450-463d-b973-93004bcdfbed | BushuBushu/TIL-for-Joylish | Baekjoon/1000/1697_숨바꼭질/answer.cpp | #include <stdio.h>
#include <queue>
#define MAX_N 200001
using namespace std;
bool visited[MAX_N];
int X[3] = {1, -1, 2};
queue<Node> q;
struct Node
{
int x, time;
};
int bfs(int x, int tx)
{
Node currNode = {x, 0};
q.push(currNode);
visited[x] = true;
while (!q.empty())
{
currNode = q.front();
q... | ALGO | 0.999919 | 3.583704 |
075174a3-8eb6-46b6-86b7-68afefffeb31 | MomoDeve/MSL | src/virtualMachine.cpp | #include "virtualMachine.h"
#include <Windows.h>
#include <cstdlib>
#include <iomanip>
#undef ERROR
#undef CONST
#undef THIS
#undef TRUE
#undef FALSE
#undef IN
#undef OUT
#undef min
#undef max
#undef LoadLibrary
#undef FreeLibrary
#undef GetMessage
namespace MSL
{
namespace VM
{
OPCODE VirtualMachine::ReadOPCode(... | TOOL | 0.942724 | 5.690796 |
202ee89f-84b9-4c0b-a8ca-7ab2d391c78c | LoukasLoukanos/Ciencia-da-Computacao | Complementar - Estruturas de dados (Didático)/Algoritmos04/Alg04.cpp | /*
♦ Algoritmo 04: Algoritmo de Classificação/Ordenação para Estruturas de Dados Lineares Estáticas (não Dinâmicas): Bubble Sort (Ordanação por Bolhas).
*/
#include <iostream>
using namespace std;
void bubbleSort(int array[], int n) {
bool troca;
for (int i = 0; i < n - 1; i++) {
troca = false;
... | ALGO | 0.999868 | 5.896107 |
591ea16f-3edc-4a86-b385-061fd74eeca8 | Pavan-B-N/DSA-with-C_plus_plus | Graph/WordLadder1.cpp | // https://leetcode.com/problems/word-ladder/
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_set>
using namespace std;
// brute force , TLE
// 🔸 Because we must try many permutations of wordList (different orderings of transformations),
// 🔸 And because the remaining word set changes with... | ALGO | 0.999993 | 6.579568 |
8110e63b-0fb4-44f9-a01d-481bd5921a8b | cristinabac/OOP | Waze/Repository.cpp | #include "Repository.h"
#include <fstream>
#include <math.h>
Repository::Repository()
{
}
void Repository::readFromFileReports()
{
std::ifstream f(this->rFile);
std::string d, rep;
int lat, lon, valid;
while (f >> d >> rep >> lat >> lon >> valid)
{
Report r{ d, rep, lat, lon, valid };
this->reports.push_back... | TOOL | 0.870844 | 5.598846 |
f1edd2ce-722b-41eb-820a-cb4e7e7c6845 | SSAFY-BLUE/BOJ | week5/승록/4716.cpp | // 어떤 방에 풍선을 갖다주는 과정에서, 거리가 더 짧은 쪽에 갖다주게 되면 abs(A방 거리 - B방 거리) 만큼의 총 거리의 이득을 본다.
// 볼 수 있는 이득의 크기를 기준으로 정렬한 뒤에 가능한 배치를 시도한다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(0) -> sync_with_stdio(0);
int N, A, B;
while (1) {
cin >> N >> A >> B;
if (N ... | ALGO | 0.999732 | 5.159339 |
30c30e55-c61e-4694-863b-abbf44ee52f3 | icf/Code | C++ code/GpBCS_S.C.CPMC/SC_afqmcConstraintPathBP_4/include/eigen/bench/sparse_setter.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.984027 | 4.152793 |
316ba8b2-9b82-4feb-bae2-72889ebe265f | valemirm/Hillel-Homework | homework-5/homework-5-1+2.cpp | #include <iostream>
using namespace std;
unsigned long int Perimeter (unsigned short int length, unsigned short int width);
// Завдання 1: прототип функції Perimeter
unsigned long int Perimeter (unsigned short int length, unsigned short int width)
{
return 2*(length + width);
}
// Завдання 2: визначення функції... | ALGO | 0.939954 | 3.587916 |
0ce9c193-7d67-44dc-9725-4b66a58f79e4 | AlgoInHyeHwa/AlgoStudy | 0416/주식가격/주식가격_김태진.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<int> prices) {
vector<int> answer;
for(int i = 0; i < prices.size(); i++){
int price = 0;
for(int j = i + 1; j < prices.size(); j++){
price++;
if(prices[j] < prices[i])
... | ALGO | 0.999513 | 5.068377 |
2be55521-7c20-48e0-9a38-004fd9d92c23 | khushisinha20/Data-Structures-and-Algorithms | Linked List/design_browser_history.cpp | //leetcode.com/problems/design-browser-history/
#include <bits/stdc++.h>
using namespace std;
class BrowserHistory {
public:
list<string> history;
list<string> :: iterator it;
BrowserHistory(string homepage) {
history.push_back(homepage);
it = history.begin();
}
void visi... | ALGO | 0.999142 | 5.907331 |
aef8aaf8-1ee4-4cf8-b8ea-1e30080b5a6c | Eng-Gamal-megahed/Problem_Solving | substring_challenge.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
bool char1 = false, char2 = false, char3 = false;
long long n;
cin >> n;
vector<char> gamal(n);
vector<char> sobhey(3);
for (int i = 0; i < n; i++)
{
cin >> gamal[i];
}
for (int i = 0; i < 3; i++)
{
... | ALGO | 0.999953 | 3.610993 |
4b9a4e9a-6aba-41c1-acf9-a1184f1d8c33 | LostSunset/nextfoam-cfd-202407 | ThirdParty-2407/sources/paraview/ParaView-v5.11.2/VTK/ThirdParty/libproj/vtklibproj/src/projections/oea.cpp | #define PJ_LIB__
#include <errno.h>
#include "proj.h"
#include "proj_internal.h"
#include <math.h>
PROJ_HEAD(oea, "Oblated Equal Area") "\n\tMisc Sph\n\tn= m= theta=";
namespace { // anonymous namespace
struct pj_opaque {
double theta;
double m, n;
double two_r_m, two_r_n, rm, rn, hm, hn;
double c... | ALGO | 0.999204 | 5.70391 |
d66f6ed9-c030-44fd-8815-4171eaf03666 | ishandutta2007/codeforces | leaf1415/normal/521/A.cpp | #include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
... | ALGO | 0.999982 | 4.556018 |
60d86991-d8c7-48c6-921e-811981f2bba6 | ayushspn123/DSA_sheet_Lovebabber | sort_0_1_2.cpp | #include<iostream>
using namespace std;
void sort012(int arr[], int n)
{
int high=n;
int low=0,mid=0;
while(mid<=high)
{
switch(arr[mid])
{
case 0: swap(arr[mid++],arr[low++]);
break;
case 1:
mid++;
... | ALGO | 0.999928 | 4.363813 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.