uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d125fc9b-6ae3-4bb5-b2ec-791c3ef35dfd | alexandraback/datacollection | solutions_2751486_1/C++/cjtoribio/main.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <deque>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
bool iscons(... | ALGO | 0.999518 | 4.165914 |
63072701-9bac-466e-aefa-b343d05eb6bc | ishandutta2007/codeforces | skylinebaby/normal/1252/A.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> a;
int main()
{
long long n;
scanf("%lld", &n);
if(n == 1)
{
printf("1\n");
return 0;
}
long long s = 0;
long long v = 1;
for(long long i = 2; i*i <= n; i++)
{
if(n%i==0)
{
v = i;
while(n%i == 0) n/= i;
break;
}
}
if(v == 1)
{
... | ALGO | 0.999992 | 3.667535 |
3661b618-9a2e-4148-8e38-fb5fe713e6b7 | Kumawatlalit912/CSES-SOLUTION | CSES-Solutions/Range Queries/List Removals.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;
const int maxN = 2e5;
int N, p, x[maxN+1];
tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update> T;
int main(){
scanf("%d", &N);
fo... | ALGO | 0.999966 | 3.594769 |
41d8ab14-3d86-4dc0-9407-34791203ad09 | Anonymous-V/Principles-and-Practice-Using-CPP-2nd-edition | chapter_10/task_07/main.cpp | /*
* Простой калькулятор
*
* История версий:
*
* 27.09.2020 - переписан Виталием под римские числа
* Переписан с книги Виталием в июле 2020 г.
*
* Эта программа реализует основные выражения калькулятора.
*
* Ввод осуществляется из потока cin; вывод - в поток cout.
*
*
* Грамматика для ввода:
*
* Вычислен... | ALGO | 0.992787 | 4.44635 |
224bdcc5-96c9-4edc-b144-f69a404bcbaf | SujalBaidhya/cplus | cpp/digits sum.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main()
{
int x,temp=0,count=0,i=0,temp2=0,num=0,sum=0,temp3=0,rem=0,power=0;
int *p;
cout<<"Enter a number:";
cin>>x;
temp=x;
while(temp>0)
{
temp=temp/10;
count++;
}
temp2=count-1;
temp3=count;
p=new int[temp2];
for(i=0;i<count;i++)
{
powe... | ALGO | 0.999527 | 3.721884 |
0ea568ec-0036-4089-9f24-1102a817371e | anjalirawattttt/geeksforgeeks | Difficulty: Medium/Longest Bitonic subsequence/longest-bitonic-subsequence.cpp |
class Solution {
public:
int LongestBitonicSequence(int n, vector<int> &nums) {
vector<int> inc(n,1);
vector<int> dec(n,1);
for(int i=1;i<n;i++){
for(int j=0;j<i;j++){
if(nums[j]<nums[i] && 1+inc[j]>inc[i]){
inc[i]=1+inc[j];
... | ALGO | 0.999925 | 5.853116 |
6aa1d960-2d93-4963-b665-d4b32957407c | NhimDaiKa/c- | CPP0103 Tinh tong phan thuc.cpp | #include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <iomanip>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
int main(){
double n;
cin >> n;
double sum = 1;
for(double i=2; i<=n; i++){
sum += 1/i;
}
cout << fixed << setprecisio... | ALGO | 0.999804 | 4.092362 |
1d3179d6-8b0b-4ebc-9032-6d5a658a7a6c | alhussain-shaikh/Operating-System-LAB | CPU SCHEDULING/SJF(NON PREEMPTIVE).cpp | // C++ implementation of the SJF(Non-preemptive) algorithm
#include <cstdlib>
#include <iostream>
#include <queue>
using namespace std;
class process {
public:
pid_t p_no = 0;
time_t start_AT = 0, AT = 0,
BT_left = 0, BT = 0, temp_BT = 0,
CT = 0, TAT = 0, WT = 0, RT = 0;
int priority = 0;
// Function for compl... | ALGO | 0.999998 | 5.003831 |
bf4c2213-0336-4af9-9140-329bae3354fc | preetu391/cses-solutions | Sorting and Searching/DistinctNumber(Pankaj).cpp | #include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(N... | ALGO | 0.999393 | 4.788023 |
683f3756-92aa-40d8-a80d-098c59f85f7f | menna1261/IEEE-CS-25 | Rookies/Task5/B - Weird Algorithm.cpp | #include <iostream>
using namespace std;
void seq(long long n) {
cout << n << " ";
if (n == 1) {
return;
}
if (n % 2 == 0) {
seq(n / 2);
}
else {
seq(3 * n + 1);
}
}
int main() {
long long n;
cin >> n;
seq(n);
return 0;
}
| ALGO | 0.99999 | 5.242027 |
003045e3-b51d-4646-a748-039873f483d0 | TONYBRYANT1/C_plus_plus | C++ code/3.Third step/4.STL-Function object/3.Built-in function objects/2.Arithmetic function/Arithmetic function.cpp | // 算术仿函数
// 功能描述:
// 实现四则运算
// 其中 negate 是一元运算,其他都是二元运算
// 仿函数原型:
// template<class T> T plus<T> //加法仿函数
// template<class T> T minus<T> //减法仿函数
// template<class T> T multiplies<T> //乘法仿函数
// template<class T> T divides<T> //除法仿函数
// templ... | ALGO | 0.878621 | 4.54496 |
55171ca4-44f6-4cca-8ec5-156400c68a7b | ketpals/LC_coding | fndallldup.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> dup(vector<int> &nums){
vector<int> ans;
int n = nums.size();
for(int i =0; i<n; i++){
int idx = abs(nums[i]) - 1;
if(nums[idx] < 0){
ans.push_back(idx);
}else{
nums[idx] = -nums[idx];
}
}
return ans;
}
int main(){
... | ALGO | 0.999813 | 4.658696 |
c1c53227-2246-4b3b-a02f-3ef1d1aa202d | r-hub2/antimonarchistic-confounded-whapuku-RTMB | src/interpol.cpp | // [[Rcpp::depends(TMB)]]
#include "RTMB.h"
// [[Rcpp::export]]
Rcpp::XPtr<tmbutils::interpol2D<double> >
ip2D(Rcpp::NumericMatrix data,
Rcpp::NumericVector x_range,
Rcpp::NumericVector y_range,
Rcpp::List con) {
typedef tmbutils::interpol2D<double> ip2D_t;
tmbutils::interpol2D_config<double> cfg;
... | ALGO | 0.984447 | 6.899258 |
f923f2c3-b23d-425f-ab40-f70e40ea2136 | VectorworksDeveloper/SDKExamples | VectorworksSDK/SDK2023/SDKLib/Source/VWSDK/VWFC/Math/VWTransformMatrix.cpp | #include "StdHeaders.h"
#include "VectorworksSDK.h"
using namespace VWFC::Math;
VWTransformMatrix::VWTransformMatrix()
{
this->SetIdentity();
}
VWTransformMatrix::VWTransformMatrix(const VWPoint3D& uVec, const VWPoint3D& vVec, const VWPoint3D& wVec, bool bTransponse /*=false*/)
{
this->SetMatrix( uVec, vVec, wVec,... | TOOL | 0.860619 | 5.518223 |
9e9a27f7-d736-42aa-887d-eb5527451996 | RowerOjMateusza/grafikaUAM | dependencies/physx-4.1/source/geomutils/src/GuBounds.cpp | #include "geometry/PxBoxGeometry.h"
#include "geometry/PxSphereGeometry.h"
#include "geometry/PxCapsuleGeometry.h"
#include "geometry/PxPlaneGeometry.h"
#include "geometry/PxConvexMeshGeometry.h"
#include "geometry/PxTriangleMeshGeometry.h"
#include "geometry/PxHeightFieldGeometry.h"
#include "GuBounds.h"
#include "GuI... | TOOL | 0.957623 | 7.826248 |
f9848e93-76dd-4184-82d8-b523ba0123c2 | morris821028/UVa | volume005/503 - Parallelepiped walk.cpp | #include <bits/stdc++.h>
using namespace std;
int unfold(int L, int W, int H, int x1, int y1,
int x2, int y2, int z2, int rx, int ry) {
if (z2 == 0)
return (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
int ret = 0x3f3f3f3f;
if (rx >= 0 && rx < 2)
ret = min(ret, unfold(H, W, L, x1+H, y1, H-z2, y2, x2, rx+1, ry));
if (rx... | ALGO | 0.999601 | 3.186882 |
790d26a5-5239-4415-a976-68e2f9e3d27a | Coder-Vippro/Code | Archived/Colinh/2016-2017/TCSNT/TCSNT.cpp | #include <bits/stdc++.h>
#define N int (1e7)
using namespace std;
int p[N+2];
int n;
void sangngto (int n)
{
fill(p,p+n+1,1);
p[0]=p[1]=0;
for(int i=2;i*i<=n;i++)
{
if(p[i]==1)
for(int j=i*i;j<=n;j+=i) p[j]=0;
}
}
int tcs(int n)
{
int tong=0;
while (n>0)
{
tong=t... | ALGO | 0.99991 | 4.518735 |
3a33bc52-530d-4074-b092-d27526632f36 | hjd-whu/coordinate_transformation | eigen-eigen-b3f3d4950030/bench/eig33.cpp | #include <iostream>
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Matrix, typename Roots>
inline void computeRoots(const Matrix& m, Roots& roots)
{
typedef typename Matrix::Scalar Scalar;
con... | ALGO | 0.999779 | 5.613888 |
b0d5e1b5-7357-4d27-ab76-82cd2dfc720a | neelchoudhury/cp | Codeforces/131D.cpp | #include <bits/stdc++.h>
#define ll long long int
#define ld double
#define MOD 10000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define sc(n) scanf("%I64d", &n)
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
#define ios ios_base::sync_with_... | ALGO | 0.999928 | 3.934304 |
6d6078eb-34c6-4ed9-8968-0dba3a357a61 | tumpji/WTlib | thirdparty/CImg-2.0.0_pre021617/examples/wavelet_atrous.cpp | #include "CImg.h"
using namespace cimg_library;
#ifndef cimg_imagepath
#define cimg_imagepath "img/"
#endif
// Define convolution mask.
CImg<float> mask(const unsigned char dirIdx, const unsigned char scale) {
const int
d1 = 1 << (scale-1),
d2 = 1 << scale,
c = d2,
vecLen = (1 << (scale + 1)) + 1;
... | ALGO | 0.998172 | 5.066303 |
0cd60005-5dbe-4fd7-a2dd-2c2b3f0b31aa | sabid179/UIU-BCPC-251-Contest-Solutions | UIU BCPC-251 1st Individual/C_Summation_from_1_to_N.cpp | #include <bits/stdc++.h>
using namespace std;
signed main()
{
long long N;
cin >> N;
long long ans = N * (N + 1) / 2;
cout << ans << endl;
return 0;
} | ALGO | 0.998204 | 4.889133 |
4adb6b73-4ca4-4bbb-8ca5-235ff9e28ae5 | spranjal3301/Coding | Competitive Programming/Data Structure & Algorithmes/Algorithm/Sorting/InsertionSort.cpp | #include<bits/stdc++.h>
using namespace std;
void InsertionSort(int arr[], int n) {
for (int i = 1; i < n; i++) {
int key = arr[i]; // Select the current element to be inserted into the sorted part
int j = i - 1; // Set the index of the last element in the sorted part
// Compare th... | ALGO | 1 | 6.13066 |
c1faf272-8ce0-405b-ae40-1a57bb64dced | ccg-v/ft_irc | src/utils.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.cpp :+: :+: :+: ... | TOOL | 0.945733 | 5.214321 |
72f69a2e-ea4e-44f6-bd3b-f4143782edc5 | mwashief/step | UVa/10140.cpp | #include <bits/stdc++.h>
#define MAX 1000000
#define SUPER 2147483647
using namespace std;
vector<unsigned int> primes;
bool visited[MAX];
void generate()
{
primes.push_back(2);
for (unsigned int i = 3; i < MAX; i += 2)
{
if (!visited[i])
{
primes.push_back(i);
for (... | ALGO | 0.999966 | 4.63224 |
70a04802-a5a1-4347-b13e-b0037838e6e2 | ashishu8888/SDE-Journey---Leetcode | 0725-split-linked-list-in-parts/0725-split-linked-list-in-parts.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
vector<ListNode*> spl... | ALGO | 0.999934 | 5.531707 |
988ff753-817d-4b1a-9fd6-8522caefe7b1 | ishandutta2007/codeforces | ashishgup/normal/737/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
const int N=2e5+5;
int n, a, b, k;
char arr[N];
int pref[N];
int get(int l, int r)
{
return pref[r] - pref[l-1];
}
int32_t main()
{
cin>>n>>a>>b>>k;
for(int i=1;i<... | ALGO | 0.999934 | 3.279486 |
9f20a573-73ea-49d4-b9d6-d304d1142835 | ttrochez/cpp | Ejercicios/Ejercicio49- Numeros-Fibonacci/main.cpp | #include <iostream>
using namespace std;
int fib(int n)
{
if (n <=1)
{
return n;
}
return fib(n - 1) + fib(n - 2);
}
int main(int argc, char const *argv[])
{
cout << fib(12);
cout << endl;
return 0;
}
| ALGO | 0.998573 | 5.15668 |
13bafa57-2100-4dab-a39a-70ce5405fd53 | ishandutta2007/codeforces | khsoo01/normal/913/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, par[1005], ind[1005], lf[1005];
int main()
{
cin >> n;
for(int i=2;i<=n;i++) {
scanf("%d",&par[i]);
ind[par[i]]++;
}
for(int i=1;i<=n;i++) {
if(ind[i] == 0) lf[par[i]]++;
}
for(int i=1;i<=n;i++) {
if(ind[i] == 0 || lf[i] >= 3) co... | ALGO | 0.999999 | 3.863861 |
6a77fd3d-adc6-41e0-aed7-ae28a042efd9 | souravdas142/CodingOJPrac | 0160-intersection-of-two-linked-lists/0160-intersection-of-two-linked-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
ListNode *d1 = headA;
ListNode *d2 = headB;
... | ALGO | 0.999845 | 5.206598 |
1a7ef4a3-a043-4455-a497-b92f0fb9688f | ngodangtan/Data_Structure_And_Algorithm | Code_Qua_Trinh/Buoi07_31_03/DemoTree.cpp | //
// Created by Ngo Dang Tan on 21/2/25.
// MSSV: <EMAIL>
//
#include <iostream>
using namespace std;
// Bước 1: Định nghĩa cấu trúc Node
struct Node {
int data;
Node* pLeft;
Node* pRight;
};
// Bước 2: Cấp phát động Node để lưu giá trị cần lưu
Node* initNode(int value) {
Node* p = new Node;
p->data = val... | ALGO | 0.999951 | 4.850781 |
21877bb7-5c0f-41cf-aa91-ae6c040c8575 | KaziRifatAlMuin/CodeDrive | Dynamic Programming/dp optimization + NT - Multiplicity.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 7, mod = 1e9 + 7;
vector <int> divs[N+10];
void pre(){
for(int i = 1; i < N; i++){
for(int j = i; j < N; j += i){
divs[j].push_back(i);
}
}
for(int i = 1; i < N; i++) reverse(divs[i].rbegin()... | ALGO | 0.999963 | 5.573198 |
22a2a5d2-97bd-4f60-9f2f-8303e005e7ce | Nikhil-57/my--new-repository | NodeAtDisK.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
private:
void markParents(TreeNode* root, unordered_map<TreeNod... | ALGO | 0.999998 | 6.727825 |
a00a7446-9ebd-4ee0-a501-fce379b49034 | squidruge/exercise-code | sj11/sj11/sj11/人民币大写string/5-b11-2.cpp | /*1951393 Զ */
#include <iostream>
#include <string>
//ɰҪͷļ
using namespace std;
const char chistr[] = "Ҽ½ƾ"; /* д "" ~ "" ĵطֻȡֵ */
string result; /* result⣬κʽȫֱ */
/* --Ҫĺ --*/
/***************************************************************************
ƣ
ܣ
ֵ
˵
********************************... | ALGO | 0.996057 | 3.67083 |
d7e4d4b5-28e3-4181-8e9b-62994b89fefb | rdzhao/SurfaceVectorFieldDecomposition | eigen/doc/examples/class_CwiseUnaryOp_ptrfun.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define function to be applied coefficient-wise
double ramp(double x)
{
if (x > 0)
return x;
else
return 0;
}
int main(int, char**)
{
Matrix4d m1 = Matrix4d::Random();
cout << m1 << endl << "becomes: " << endl << ... | ALGO | 0.983081 | 4.111647 |
ce185649-f7a5-4c6e-8658-de3ad17dbe40 | AshHasib/Pointer-Puzzles | singlyLinkedList.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* next;
};
Node *head=NULL;
Node *tail=NULL;
class LinkedList
{
public:
void Insert(int value)
{
Node* ptr=(Node*)malloc(sizeof(Node));
ptr->data=value;
if(head==NULL)
{
hea... | ALGO | 0.999927 | 4.145937 |
b021b76a-cf9d-4163-951b-0d99c5f99a0b | freedomDR/coding | nowcoder/66offer/19.cpp | class Solution {
public:
vector<int> printMatrix(vector<vector<int> > matrix) {
vector<int> ans;
if(!matrix[0].size() || !matrix.size()) return ans;
int lay = 0;
while(true){
int li = 0+lay, lj = 0+lay, ri = matrix.size()-1-lay, rj = matrix[0].size()-1-lay;
if... | ALGO | 0.999971 | 5.480621 |
ad072690-6ece-464e-a8f1-987f8f9af9ec | Masum-SM/CodeForces | Difficulty-800/546A_Soldier_and_Bananas.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int k , n , w;
cin>>k>>n>>w;
int total = 0;
for(int i = 1 ; i <= w ; i++){
total +=(i * k);
}
int borrow = total-n;
if(borrow>=0){
cout<<borrow<<endl;
}
else{
cout<<0<<endl;
}
return 0;
} | ALGO | 0.999929 | 3.434343 |
6955a63d-b92c-4da6-bf91-f9d4f12e89c7 | ComputerScientist-01/SDE-Sheet | 389-find-the-difference/389-find-the-difference.cpp | class Solution {
public:
char findTheDifference(string s, string t) {
int difference=0;
for(auto &i : t){
difference+=i;
}
for(auto &i : s){
difference-=i;
}
return char(difference);
}
}; | ALGO | 0.999876 | 6.573295 |
bb76ef68-d72a-44ff-b318-9566aaaede11 | SuprDewd/Forritunarkeppnin-2 | 2011/Alfa4/1.cpp | #include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <... | ALGO | 0.994703 | 3.354766 |
f0ce0392-d2d9-4e73-8d13-bcae05463809 | HONGYANGGAN/leetcode | solution/0900-0999/0969.Pancake Sorting/Solution.cpp | class Solution {
public:
vector<int> pancakeSort(vector<int>& arr) {
int n = arr.size();
vector<int> ans;
for (int i = n - 1; i > 0; --i) {
int j = i;
for (; j > 0 && arr[j] != i + 1; --j)
;
if (j == i) continue;
if (j > 0) {
... | ALGO | 0.99999 | 5.850093 |
b6210045-83b5-4018-9c2a-7fc295edc5ec | John-PS3/RPCPS3 | 3rdparty/llvm/llvm/bolt/lib/Passes/Instrumentation.cpp | #include "bolt/Passes/Instrumentation.h"
#include "bolt/Core/ParallelUtilities.h"
#include "bolt/RuntimeLibs/InstrumentationRuntimeLibrary.h"
#include "bolt/Utils/CommandLineOpts.h"
#include "bolt/Utils/Utils.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/RWMutex.h"
#include <queue>
#include <stack>
#i... | TOOL | 0.917363 | 5.793505 |
dbc4b654-15d0-468d-aa41-7dec4a65e2b6 | manikanta2901/ubuntu | .history/SRM/DAA/Algorithms/Backtracking/NqueenProblem_20210520202234.cpp | /* C/C++ program to solve N Queen Problem using
backtracking */
#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > result;
bool isSafe(vector<vector<int> > board,int row, int col){
int i, j;
int N = board.size();
for (i = 0; i < col; i++){
if (board[row][i]){
return false;
}
}
f... | ALGO | 0.999928 | 5.991612 |
29dedc38-718e-45be-a787-cda7496ed7d5 | mae6/scVILP | scripts/PerfectPhy/tools/missingdata.cpp | #include<vector>
#include<iostream>
#include<sstream>
#include<cstdlib>
#include<ctime>
using namespace std;
#define ADDMISSING 1
enum ArgError { ERROR = -1, QUIT = 0, NONE = 1 };
ArgError handleArguments(int argc, char** argv, bool &fillmissing, double& prob) {
const char* helpmessage =
"Usage: ./missingdata.ou... | TOOL | 0.957976 | 4.035151 |
5a3aff0a-99d1-4c74-9ae8-ad8cc30a2f00 | boshi-an/2020-Home-Work | Fibonotci(CF575A)/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MX = 50005;
template<typename T> void read(T &x)
{
char c = getchar(); x = 0;
while(!isdigit(c)) c = getchar();
while(isdigit(c)) x = x*10+c-'0', c = getchar();
}
ll P, N, M, K;
struct MAT
{
ll x[2][2];
MAT () {memset(x, 0, sizeof... | ALGO | 0.999985 | 3.45797 |
0a028f1c-92e5-4335-80ec-427d859d611a | Sabeeh138/DSA2024 | LABS/Lab3/Q1.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int value) : data(value), next(nullptr) {}
};
class LinkedList {
private:
Node* head;
public:
LinkedList() : head(nullptr) {}
// Insert node at front
void insertAtFront(int value) {
Node* n... | ALGO | 0.999643 | 5.82691 |
cab600c7-11b4-4dde-9bf6-c6077b54d83b | junstone1995/BaekJoon | c++/2630(색종이 만들기)/2630.cpp | #include <iostream>
using namespace std;
int n;
int map[128][128];
int wcnt(0),bcnt(0);
void solve(int y,int x,int size)
{
int check = map[y][x];
for(int i = y; i < y + size; i++)
for(int j = x; j < x + size; j++)
{
if (check != map[i][j])
{
solve(y,x, size/2);
solve(y,x + size / 2, size /2);
... | ALGO | 0.999756 | 4.078312 |
b1a63869-3d9a-4743-bce4-955cf47e35ea | Yashwanth137/GFG-Potd | 2024/09 - September/07. Nth Natural Number/Solution.cpp | class Solution
{
public:
long long findNth(long long n)
{
long long result = 0, base = 1;
while (n > 0)
{
result += (n % 9) * base;
n /= 9;
base *= 10;
}
return result;
}
};
| ALGO | 0.999902 | 5.55871 |
32c06e43-3a0d-422a-aa90-db9c230d5868 | a1846342933/px4framework | src/lib/terrain_estimation/terrain_estimator.cpp | /**
* @file terrain_estimator.cpp
* A terrain estimation kalman filter.
*/
#include "terrain_estimator.h"
#include <lib/ecl/geo/geo.h>
#include <px4_platform_common/defines.h>
#define DISTANCE_TIMEOUT 100000 // time in usec after which laser is considered dead
TerrainEstimator::TerrainEstimator() :
_distance_la... | ALGO | 0.997794 | 7.054045 |
cf5fd533-8db8-47bd-b5e2-943bef8a299e | JayedHoshen/allProblemSolving | DUETCS_Vjudge/CP Training By DUET CS (2K24) Long Contest - 02/A_How Much_Does_Daytona_Cost.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int tc, n, k, i, a;
cin >> tc;
while(tc--) {
bool flag = false;
cin >> n >> k;
for(i = 0; i < n; i++) {
cin >> a;
if(k == a) flag = true;
}
if(flag == true) cout << "YES\n";
... | ALGO | 0.999461 | 3.790795 |
b4293eeb-7252-4250-98b7-16d8473073a6 | Heeks/libarea-old | kbool/src/booleng.cpp | #ifdef __GNUG__
#pragma implementation
#endif
#include <math.h>
#include <time.h>
#include "kbool/include/booleng.h"
#include "kbool/include/link.h"
#include "kbool/include/line.h"
#include "kbool/include/node.h"
#include "kbool/include/graph.h"
#include "kbool/include/graphlst.h"
B_INT bmin(B_INT const value1, B_IN... | TOOL | 0.948373 | 5.455842 |
04a7c97e-b343-45b8-8f81-ba35a58676df | dukhaan/shamo-frontend | 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.9988 | 6.76073 |
a3d21e5b-ba0f-4201-bccb-c2ef2d037227 | Benicia2005/192224021 | largest element using function.cpp | #include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int maximum();
maximum();
}
int maximum()
{
int n,i,max,a[]={1,2,3,5,4};
max=a[0];
n=sizeof(a)/sizeof(a[0]);
for(i=1;i<n;i++)
{
if(max>a[i])
continue;
else
max=a[i];
}
printf("maximum of given number is : %d");
}
| ALGO | 0.999874 | 3.056044 |
22cf5b06-7d5d-4097-9ca7-ec19aee7e98d | BhomaRamprajapat/Data-Structures | DP/RodCutting.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution{
public:
int cutRod(int price[], int n)
{
int dp[n+1][n+1];
for(int i=0;i<n+1;i++)
{
for(int j=0;j<n+1;j++)
... | ALGO | 0.999844 | 5.807294 |
93c4461f-05d0-4ac3-b811-259f7a8652d1 | anmoljhamb/leetcode | 18thJune2024/875_koko_eating_bananan.cpp | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
class Solution {
public:
long findCost(vector<int> &arr, int k) {
long cost = 0;
for (auto &x : arr) {
cost += ceil((double)x / k);
}
return cost;
}
int minEatingSpeed(vector<int> &arr, int h) {
int low... | ALGO | 0.999892 | 4.682645 |
ccf57b16-7c71-4585-bdd1-c4918610c03b | spinos/aphid | shared/BaseMesh.cpp | #include <iostream>
#include <math/BarycentricCoordinate.h>
#include "BaseMesh.h"
#include <map>
namespace aphid {
BaseMesh::BaseMesh()
{
_vertices = 0;
_indices = 0;
m_normals = 0;
m_polygonCounts = 0;
m_polygonIndices = 0;
m_numPolygons = 0;
m_u = 0;
m_v = 0;
m_uvIds = 0;
m_numUVs = m_numUVIds = 0;
}
Bas... | TOOL | 0.907233 | 7.27315 |
463eba99-7b30-40c5-b28b-b6a63903457b | schizzz8/lucrezio_explorer | src/apps/frontier_detector_app.cpp | #include <iostream>
#include <yaml-cpp/yaml.h>
#include <frontier_detector/frontier_detector.h>
using namespace std;
using namespace srrg_core;
void readMapFromYaml(char *filename);
std::string image_filename;
float resolution;
Eigen::Vector2f origin;
void drawFrontierPoints(RGBImage &image, const Vector2iVector &po... | DATA | 0.981766 | 6.012247 |
9f8d39f7-9ce2-4677-a755-71114275300d | georgehodgkins/Zhuque_artifact | clobber-pmdk/llvm/lib/Transforms/Utils/SSAUpdaterBulk.cpp | #include "llvm/Transforms/Utils/SSAUpdaterBulk.h"
#include "llvm/Analysis/IteratedDominanceFrontier.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Use.h"
#include "llvm/IR/Value.h"
using namespace llvm;
#define DEBU... | ALGO | 0.999634 | 8.043795 |
e464cc48-a445-4eac-92f7-6668efc6dca4 | ChouE/LeetCode-Cpp | DP/120.三角形最小路径和.cpp | /*
* @lc app=leetcode.cn id=120 lang=cpp
*
* [120] 三角形最小路径和
*/
// @lc code=start
class Solution {
public:
int minimumTotal(vector<vector<int>>& triangle) {
int n = triangle.size();
vector<vector<int>> dp(n, vector<int>(n, 0));
dp[0][0] = triangle[0][0];
... | ALGO | 0.999974 | 6.668963 |
0999f3d0-9776-4d1d-92c0-cb7581906ef1 | weathon/USACO | 2019/t.cpp.cpp | #include<iostream>
#include<fstream>
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
// freopen("input.in","r",stdin);
// freopen("output.out","w",stdout);
int a[5]={3,5,2,3,6};
sort(a,a+5);
for(int i:a) cout<<i<<endl;
return 0;
}
| ALGO | 0.999777 | 3.25937 |
7d162767-997f-42ea-8823-000f746221a8 | gstrick2/sboost | 3rdparty/milvus/core/src/metrics/SystemInfo.cpp | #include "metrics/SystemInfo.h"
#include "thirdparty/nlohmann/json.hpp"
#include "utils/Exception.h"
#include "utils/Log.h"
#include <dirent.h>
#include <fiu-local.h>
#include <sys/sysinfo.h>
#include <sys/times.h>
#include <unistd.h>
#include <map>
#ifdef MILVUS_GPU_VERSION
#include <nvml.h>
#endif
namespace milv... | TOOL | 0.87041 | 6.286983 |
b079fae2-51a0-48a4-83e3-83b7b03f0a3c | tmyksj/atcoder | AtCoder Beginner Contest 116/C - Grand Garden/main.cpp | #include <iostream>
#include <vector>
using namespace std;
int solve(vector<int>& h, int l, int r) {
int min = 100;
for (int i = l; i < r; i++) {
if (min > h[i]) {
min = h[i];
}
}
for (int i = l; i < r; i++) {
h[i] -= min;
}
int cnt = min;
for (int i =... | ALGO | 0.999969 | 4.711716 |
c414dfe7-75d0-4ff2-82c2-83a06e0a5ff4 | ishandutta2007/codeforces | sutaner/normal/1261/B2.cpp | #include <bits/stdc++.h>
#define rep(i, l, r) for (register int i = l; i <= r; i++)
#define per(i, r, l) for (register int i = r; i >= l; i--)
#define srep(i, l, r) for (register int i = l; i < r; i++)
#define sper(i, r, l) for (register int i = r; i > l; i--)
#define ll long long int
#define pii pair<int, int>
#defin... | ALGO | 0.999991 | 3.434152 |
e52cb8af-5666-4730-8f2f-93af46676536 | CFOP2357/competitive_programing | codeforces/Codeforces Global Round 9/B.cpp | #include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
typedef long long ull;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<ull,null_type,less<ull>,rb_tre... | ALGO | 0.999603 | 4.112631 |
1a356fe5-156f-4353-b94d-e29fb2b0a66f | xavier-tricoche/Pomato | xavier/cr3bp/computeMapOC.cpp | /** Computing Poincare Map Data for Orbit Convolution
* - Compute a regular grid of Poincare map data in CR3BP
* and store output such that it's ready for
* image processing (NRRD format - 'int' array)
*
* Author: Wayne Schlei, Xavier Tricoche (Purdue University)
*/
#include <iostream>
#include <vector>
#... | ALGO | 0.99976 | 5.65765 |
01a68730-2eff-479c-aeba-9517c7990c7b | tomoakiii/atcoder2 | Archive/abc410/c.cpp | #include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true... | ALGO | 0.999882 | 4.417336 |
e4ad0173-84d5-4628-a10b-17ddf92529f9 | RomekRJM/Playground | C++/LearningPathBeginningCpp/19_calc.cpp | #include <iostream>
#include <string>
#include <cmath>
int main19(int argc, char *argv[])
{
if(argc != 4)
{
std::cerr << "Program accepts 4 arguments" << std::endl;
return 1;
}
double lhs = std::stod(argv[1]);
std::string op = argv[2];
double rhs = std::stod(argv[3]);
... | TOOL | 0.916218 | 4.500697 |
852a047d-568f-4765-aa7b-579cb14922e4 | MomenMustafa/online-judges-SOL | CF357-D2-C(set).cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int getNext(int v, int next[])
{
if(next[v]==v) return v;
return next[v] = getNext(next[v], next);
}
int main()
{
int n, m;
scanf("%d %d", &n, &m);
set<int> st;
int answer[n]={};
for(int i=0;i<n;i++)
st.insert(i);... | ALGO | 0.999988 | 3.995421 |
74c6c092-d653-4b9c-85ba-27d37128bc0b | v1k7oriy/lama-3 | lama55/Source.cpp | #include <iostream>
#include <math.h>
#include <string.h>
using namespace std;
template <typename T>
T Max(T x, T y)
{
cout << " . " << endl;
return x > y ? x : y;
}
const char* Max(const char* a, const char* b) {
cout << " . " << endl;
return strlen(a) > strlen(b) ? a : b;
}
int main() {
setlocale(LC_ALL, "... | ALGO | 0.995665 | 3.11346 |
5e0ab9ea-96ce-40f2-832e-002b54cca70e | darshanK72/C-CPP | C++/2. Statements/c1Prime_Check.cpp | #include <iostream>
using namespace std;
int main()
{
int i,N;
i = 2;
cout<<"Enter the Number"<<endl;
cin>>N;
while(i<N)
{
if(N%i == 0)
{
cout<<N<<" is not a Prime Number"<<endl;
break;
}
else
i++;
}
if(i==N)
cout<<... | ALGO | 0.999765 | 3.324583 |
4f583008-a6ea-4e2c-ba9e-b21b9e817d92 | EveSunMaple/Code | luogu/P1880.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
int N;
int sum[105];
int num[105];
int max_ans = -1;
int min_ans = 1e9;
int max_sum[205][205][205];
int min_sum[205][205][205];
int main()
{
memset(min_sum, 0x3f, sizeof(min_sum));
scanf("%d", &N);
for(int t ... | ALGO | 0.999944 | 3.710478 |
8ddba93e-3389-4199-a5b4-4e5eff7c9c9b | SE-OOP/Assignment_01 | 201816040121/Ex06_50.cpp | #include <iostream>
using std::cout;
using std::cin;
using namespace std;
int tripleByValue(int);
void tripleByReference(int &);
//程序从下一行开始执行
int main()
{
int count;//定义一个整型变量count
cout << "Please enter the value of count: ";
cin >> count;//从键盘读入数据
cout << "count = " << count << " before tripleByValu... | TOOL | 0.998102 | 5.260391 |
b8e65c00-d063-48fc-8764-fb0644eb58ce | cdlicn/Leetcode_2023_C | main/数据结构教程/线性表/单链表及其应用/lc_分隔链表.cpp | //
// Created by LiYuanzhe on 2023/8/26.
//
#include "iostream"
#include "algorithm"
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
clas... | ALGO | 0.999987 | 5.418109 |
8a546d31-22a4-4293-b7b2-62f001beb05f | Bit-Dong/C-plus-plus_based | 模板/函数模板/案例 - 数组排序.cpp | #include<iostream>
#include<string>
using namespace std;
//ʵͨ ĺ
// ӴС
//㷨 ѡ
// char顢int
//ģ
template<typename T> //typename滻 class
void mySwap(T &a,T &b)
{
T temp=a;
a=b;
b=temp;
}
//㷨
template<class T>
void mySort(T arr[],int len)
{
for(int i=0;i<len;i++)
{
int max=i;
for(int j=i+1;j<len;j+... | ALGO | 0.985612 | 4.19963 |
99926b1d-341b-4838-8a96-b8f99cabef7b | ahmedibrahim404/CompetitiveProgramming | Codeforces/1542B/main.cpp | #include <iostream>
using namespace std;
typedef long long ll;
int main(){
int t;ll n;
scanf("%d",&t);
while(t--){
ll a, b;
scanf("%lld%lld%lld",&n,&a,&b);
ll cur=1LL;bool can=0;
if(a == 1){
if((n-1)%b == 0) printf("Yes\n");
else printf("No\n");
... | ALGO | 0.999771 | 3.392674 |
2c756cfb-ca15-4f1a-ac38-33f83622293d | SIMARSINGHRAYAT/POTD_HUB | Maximize the minimum difference between k elements_gfg.cpp | class Solution {
public:
int maxMinDiff(vector<int>& arr, int k) {
sort(arr.begin(), arr.end());
int n = arr.size();
int low = 0, high = arr[n-1] - arr[0], ans = 0;
auto isPossible = [&](int minDiff) {
int count = 1, last = arr[0];
for (int i = 1; i... | ALGO | 0.999987 | 5.41971 |
584327cc-9f28-4258-9dad-637734f5fdd9 | abhineetmishra64/Algorithm | c++/manipulator.cpp | #include <bits/stdc++.h>
using namespace std;
string getDecodedString(string s) {
int i=0,c=0;
string tmp="";
while(s[i]=='#') ++i;
s.erase(0,i);
cout << "modfied string: " << s << '\n';
if(s[0]=='#') c=1;
else c=s[0]-'A';
for(i=1;i<s.size();++i) {
if(s[i]=='#') {
+... | ALGO | 0.999972 | 4.637276 |
4443377e-5e82-4447-8712-87485077122a | mihobik/lab4_v2 | lab1_3.cpp | #include <iostream>
#include <vector>
#include <locale>
#include <random>
using namespace std;
int main() {
setlocale(LC_ALL, "RU");
int j, k, k0, k1, m, n;
cout << "Введите параметры j и k (j, k >= 1) через пробел: ";
cin >> j >> k;
cout << "Введите значение m (m >= 2): ";
cin >> m;
cou... | ALGO | 0.999887 | 3.945354 |
d4952fab-3d4a-472d-98cc-ef151f1fac8e | kei1107/algorithm | problems/JOI/Railroad_Trip.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60
/*
<url:https://www.ioi-jp.org/joi/2014/2015-ho/2015-ho.pdf>
問題文============================================================
JOI 国には N 個の都市があり,それぞれ 1, 2, . . ... | ALGO | 0.999839 | 4.035498 |
e5a6b19e-dbd1-4301-abd5-1966a8e393b6 | tom-uchida/Competitive_Programming | AtCoder_Beginners_Selection/8B-Kagami_Mochi.cpp | // https://atcoder.jp/contests/abs/tasks/abc085_b
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main(void) {
int N;
cin >> N;
vector<int> d(N);
rep(i, N) {
cin >> d[i];
}
sort(d.rbegin(), d.rend()); /... | ALGO | 0.999878 | 4.233638 |
eeca64af-5ad5-4f4b-bcc5-eb927268015a | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/BlackJack_20210108174618.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999976 | 3.477547 |
e562a842-2909-4ceb-87f2-a78e785059de | ishandutta2007/codeforces | cldp/normal/932/E.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 5010;
const int INF = 1000000007;
const double PI = acos(-1.0);
long long f[MAXN][MAXN];
int qpow(int a, int b) {
if (b == 0) return 1;
if (b == 1) return a;
int temp = qpo... | ALGO | 0.99992 | 4.39022 |
fce5b15a-5eb6-4f4c-86a3-05c7b7a04944 | MatthewDZane/UnrealQRCodeScanner | Source/ThirdParty/OpenCVLibrary/Hololens/sources/3rdparty/carotene/src/absdiff.cpp | #include <algorithm>
#include "common.hpp"
#include "vtransform.hpp"
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
template <typename T>
struct AbsDiff
{
typedef T type;
void operator() (const typename internal::VecTraits<T>::vec128 & v_src0,
const typename internal::VecTra... | ALGO | 0.994748 | 7.173657 |
d525a04b-2b65-4b32-a8c6-d7f1d21fa6ce | AlexInTown/HackWorks | CODEFORCES/Round291Div2/E2.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <memory.h>
#include <unordered_map>
#include <vector>
#define FORMAT I64d
using namespace std;
typedef long long LL;
const int MOD = 1e9+7;
const int DIM = 101;
const int MAX_IDX = 100;
vector<int> counts(MAX_IDX... | ALGO | 0.99997 | 4.245605 |
4822e3bb-8597-4e20-8fac-9d34d1f03840 | sinian666/codes_41_16 | cpp_副本12/chapter_sorting/radix_sort.cpp |
/**
* File: radix_sort.cpp
* Created Time: 2023-03-26
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 获取元素 num 的第 k 位,其中 exp = 10^(k-1) */
int digit(int num, int exp) {
// 传入 exp 而非 k 可以避免在此重复执行昂贵的次方计算
return (num / exp) % 10;
}
/* 计数排序(根据 nums 第 k 位排序) */
void countingSortDigit(vector<... | ALGO | 0.999907 | 5.788882 |
2fa79ad2-88be-419c-9fbf-e495124aa085 | firewood/topcoder | srm_5xx/srm_592/LittleElephantAndPermutationDiv2.cpp | // BEGIN CUT HERE
/*
SRM 592 Div2 Medium (500)
問題
-1からNまでのN個の数列AとBがある
-それぞれの要素を並べ替えて、max(Ai,Bi)の和を求める
-和がK以上になるのは何通りか求める
*/
// END CUT HERE
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
using namespace std;
typedef long long LL;
class LittleEleph... | ALGO | 0.999946 | 4.407104 |
5615be32-3fa2-44d3-b8e6-c9f23a318a74 | ishandutta2007/codeforces | liti/normal/1384/B2.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n, k, L;
cin >> n >> k >> L;
int l = 0, r = 2*k;
string ans = "Yes";
for (int i = 0; i < n; i++) {
int d;
cin >> d;
if (d > L) {
ans = "No";
continue;
}
int xl = ma... | ALGO | 0.99998 | 3.681714 |
8d874ff3-f48c-4837-8e84-be5de954f007 | wassimalharaki/Codeforces | 2000/Subsequences(easyversion).cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define nl '\n'
#define v vector
const int N = 20;
void solve() {
int n, x; cin >> n >> x;
string s; cin >> s;
int ans = 0;
set<string> have;
have.insert(s);
queue<string> q;
q.push(s);
while (not q.empty() and (int)... | ALGO | 0.999901 | 5.45135 |
671503d2-690f-4205-9b93-2a9c38271b05 | 20niship/melchior | tests/spline_test.cpp | #include <iostream>
#include <movutl/core/spline.hpp>
using namespace mu::core;
int main(){
std::vector<double> X = {5, 60, 100, 90};
std::vector<double> Y = {60, 30, 80, 100};
mu::core::Spline gen;
gen.init(X, Y, 10, true, false);
gen.generate();
auto rx = gen.getOutput();
return 0;
}
| ALGO | 0.910711 | 4.647638 |
8bca0854-610c-437d-9b61-d7ddf85591c5 | vruddhijain/leetcode | 0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int n = prices.size();
int profit = 0;
int cost = prices[0];
for(int i =1; i< n; i++){
if(prices[i] < cost){
cost = prices[i];
}
if(pri... | ALGO | 0.999739 | 6.150033 |
42e289df-6d51-4ea7-995b-502a1bf11c70 | MugishaBienvenu/Mentor-me | rotate_array.cpp | #include <iostream>
using namespace std;
int main(){
int arr[]={1,2,3,4,5};
int len=sizeof(arr)/sizeof(arr[0]);
// for(auto i : arr){
for( int i = 0; i <= len; i++ ){
if( arr[i] = i-1 ){
arr[0] = 5;
cout << arr[i];
}
}
// int newarr[]=arr.pop(5);
// cout<<newarr.push(newarr);;
} | ALGO | 0.999506 | 3.072085 |
2d40d0a1-86f1-4e40-9217-d867357bd6e8 | nazmulhasannasim333/cpp_practice_problems | A_Lucky.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
string s;
cin >> s;
if((s[0] + s[1] + s[2]) == (s[3] + s[4] + s[5])){
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
return 0;
} | ALGO | 0.999822 | 4.133702 |
f3f38822-eb92-4d19-ad55-53cd1e045278 | utkarshsp206/DSA | Dynamic/Fibonacci_dp.cpp | #include<bits/stdc++.h>
using namespace std;
//* Using Memoization
int fibonacci(int n, vector<int> &dp){
if(n<=1){
return n;
}
if(dp[n]!=-1) return dp[n];
return dp[n]=fibonacci(n-1, dp)+fibonacci(n-2, dp);
}
//! TC: O(N) SC: O(N)+O(N)
//* Using Tabulation
int fiboTab(int n, vector<int> &dp)... | ALGO | 0.999997 | 6.109426 |
d1a468b1-da40-4324-ab6e-49f0d11bf50e | alexsotocx/competitive-programming | UVA/Decode the Mad man.cpp | #include<stdio.h>
#include<string>
#include<iostream>
#include<sstream>
#include<algorithm>
#include <ctype.h>
#define forn(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int pos(char b, char x[])
{
forn(i,0,26)
if(b==x[i])
return i;
return -1;
}
int main()
{
//freopen("in.in","r",stdi... | ALGO | 0.998514 | 3.123617 |
995ff778-25eb-4f7a-a8b7-90e671c8b4dd | gautamsharma22/leetcode-manual | Shortest path in Undirected Graph.cpp | vector<int> shortestPath( vector<pair<int,int>> edges , int n , int m, int s , int t){
vector<vector<int>> adj(n+1);
for(int i=0;i<edges.size();i++){
int u=edges[i].first;
int v=edges[i].second;
adj[u].push_back(v);
adj[v].push_back(u);
}
vector<int> parent(n+1);
vector<bool> visited(n+1);
queue<int... | ALGO | 0.999988 | 5.4931 |
54418b39-e60d-4c47-9c54-bc3bd75bf9b9 | by-student-2017/lammps-14May16 | src/USER-SMD/compute_smd_rho.cpp | #include <string.h>
#include "compute_smd_rho.h"
#include "atom.h"
#include "update.h"
#include "modify.h"
#include "comm.h"
#include "force.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
ComputeSMDRho::ComputeSMDRho(L... | ALGO | 0.997672 | 6.439167 |
842e33f4-951d-491f-98e9-e60dc7e9e3e0 | AnasRaxa/LeetCode-Questions | Stack and Queue/Implement Stack using Arrays.cpp | #include<bits/stdc++.h>
using namespace std;
class Stack {
int size;
int * arr;
int top;
public:
Stack(int sz):size(sz){
top = -1;
arr = new int[size];
}
void push(int x) {
top++;
arr[top] = x;
}
int pop() {
int x = arr[top];
top--;
return x;
}
int Top() {
... | ALGO | 0.979085 | 4.003624 |
21c69c73-839d-4768-a489-873a5dc77f1b | GogleSiteBank/yuzuemu | src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_set.cpp | #include "shader_recompiler/frontend/maxwell/translate/impl/common_funcs.h"
#include "shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_helper.h"
namespace Shader::Maxwell {
namespace {
void HSET2(TranslatorVisitor& v, u64 insn, const IR::U32& src_b, bool bf, bool ftz, bool neg_b,
bool a... | ALGO | 0.966229 | 7.687424 |
437e470d-c4f4-4271-a6bf-1a0508e48bb4 | Jooye0n/Algorithm | SWEA/s2115.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m, c;
int arr[10][10];
bool chk[10][10] = { false, };
int result;
void findMax(int x, int k, int cnt, int rst, int total, int* tempResult, vector<int> v) {
//v에서 모든 수의 조합 중 최대 구하기 but, <=c
if (x == cnt) {
*tempResult = max(rst, *tempResult);
}
... | ALGO | 0.999969 | 4.505056 |
84312f35-94f4-447e-9251-16490452240f | Richi78/CF-Algorithms | talleres/strings/UVA_455_Periodic_Strings.cpp | #include <bits/stdc++.h>
using namespace std;
#define debug1(x) cout << #x << " = " << x << "\n";
#define debug2(x,y) cout << #x << " = " << x << " " << #y << " = " << y << "\n";
#define vdebug(a) cout << #a << " = "; for(auto x: a) cout << x << " "; cout << "\n";
#define int long long
#define FIO ios_base::sync_with... | ALGO | 0.999882 | 4.533505 |
468cd99b-c8b6-4f49-9b56-13241e5bec07 | DDenis93/LessonsC | 2-6/3.cpp | #include <iostream>
#include <vector>
#include <algorithm> //STL
using namespace std;
int main(){
int rows, cols;
cout << "Enter rows and cols amount: ";
cin >> rows >> cols;
vector<vector<int>> vector2D(rows);
// Input 2d vector
for(int i = 0; i < rows; i++){
for(int j = 0; j < cols; j++){
int val;
c... | ALGO | 0.967322 | 4.482388 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.