uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
adc76040-0247-494b-a54e-f97b54b63cfd | KaloqnTodorov/TSP | tsp2/graphClass.cpp | #include <iostream>
#include "graphClass.h"
#include <fstream>
using namespace std;
void graphClass::copy(const graphClass& other)
{
this->size = other.size;
for (size_t i = 0; i < V; i++)
{
for (size_t j = 0; j < V; j++)
{
this->graph[i][j] = other.graph[i][j];
}
}... | ALGO | 0.98736 | 3.195495 |
60be3758-7e39-4646-aeba-c45d9a4b0252 | Marcus-techtile/pallet_detection | src/multi_pallet_detection/include/eigen/doc/examples/make_circulant2.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
// [circulant_func]
template<class ArgType>
class circulant_functor {
const ArgType &m_vec;
public:
circulant_functor(const ArgType& arg) : m_vec(arg) {}
const typename ArgType::Scalar& operator() (Index row, Index col) const {
Index index = ... | ALGO | 0.999519 | 5.560641 |
cf58f254-eb3e-478c-a3fb-f2e40e24bece | MichalMroz21/Competitive-Programming | Leetcode/1329.cpp | class Solution {
public:
vector<vector<int>> diagonalSort(vector<vector<int>>& mat) {
int n = mat.size(), m = mat[0].size();
for(int j = 0; j < m; j++){
priority_queue<int> pq{};
for(int i = 0; i < n && i + j < m; i++){
pq.push(-mat[i][i + j]);
... | ALGO | 0.999983 | 6.053704 |
453ccd8b-f06d-4d23-b606-65f9294c8502 | Ayushrawat63/DSA | D1/Stack/2stackUsingArray.cpp | #include <iostream>
#include <stack>
using namespace std;
// link: https://www.naukri.com/code360/problems/two-stacks_983634?leftPanelTabValue=PROBLEM
class Stack
{
int back;
int front;
int *arr;
int size;
public:
Stack(int n)
{
size = n;
arr = new int[size];
front = -1... | ALGO | 0.986511 | 3.700292 |
43085ca6-53ca-41af-81db-0a74485b3718 | arntsonl/fbagx | source/burn/sega/fd1089.cpp | #include "sys16.h"
#define BIT(x,n) (((x)>>(n))&1)
#define BITSWAP8(a, b, c, d, e, f, g, h, i) BITSWAP08(a, b, c, d, e, f, g, h, i)
struct parameters
{
int xor1;
int s7,s6,s5,s4,s3,s2,s1,s0;
};
static UINT8 basetable_fd1089[0x100] =
{
0x00,0x1c,0x76,0x6a,0x5e,0x42,0x24,0x38,0x4b,0x67,0xad,0x81,0xe9,0xc5,0x03,0x2f... | ALGO | 0.998112 | 5.741314 |
875daded-28e6-432d-bffe-6c29e094a150 | jcastaneda30/ExerciseAlgorithms | Codeforce/2023/RPC9/Street.cpp | #include<iostream>
#include<vector>
#include<string>
#include <unordered_map>
using namespace std;
int main(){
int n,q;
cin>>n>>q;
vector<string> calles(n);
unordered_map<string, int> posiciones;
for(int i=0;i<n;i++) {
cin>>calles[i];
posiciones[calles[i]]=i;
}
for(int ... | ALGO | 0.999866 | 4.562213 |
25a88d86-9cb5-48d4-ab8d-d17f4df46e3f | markenen/communication181-sixth-group | 201811050957/2.1线性表问题(猴子选大王).cpp | //链表法
#include<iostream>
#include<ostream>
#include <iostream>
using namespace std;
struct Monkey
{
int num; //猴子的编号
struct Monkey* next; //下一只猴子
};
int main()
{
int m, n, i, j, king;
Monkey* head, * p1, * p2;
cin >> m >> n;
if (n == 1)
{
king = m;
}
else
{
//建立... | ALGO | 0.999992 | 3.298288 |
82f06958-c46a-4f81-8685-cde2434710ae | Stenardt-9002/CODECHEF-Datastructure-and-algo | List-question/Linked List/3-detec_cyclein_ll(141).cpp | // https://practice.geeksforgeeks.org/problems/detect-loop-in-linked-list/1
#include <bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds ;
typedef long long ll1d;
struct Node
{
int data;
struct Node *next;
Node(int x)... | ALGO | 0.999866 | 5.140656 |
c51b5661-82c0-493c-9186-5d16fc38a3eb | prathmesh0125/180-Days-Of-DSA | 1_gfg question/39_reverse string.cpp | #include<iostream>
using namespace std;
string reverse(string str){
int start=0;
int end=str.size()-1;
while(start<=end){
swap(str[start++],str[end--]);
}
return str;
}
int main(){
string str="geeks";
cout<<reverse(str);
} | ALGO | 0.999312 | 4.516758 |
8b4ac8ba-a187-480c-9c2f-1df05969ad89 | stalker5217/problem-solving | BAEKJOON/2563.cpp | #define DEBUG 0
#define LOG(string) cout << string
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
void drawRectangle(int[100][100], int, int);
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int map[100][100];
int cnt;... | ALGO | 0.992163 | 4.188966 |
a545c3d7-d949-4002-9705-778a73d6b731 | nileshwankhede03/basic-cpp-programs | .history/pattern16_20250219124837.cpp | #include "./stdc++.h"
using namespace std;
void print15(int n)
{
for(int i = 0; i < n;i++)
{
for(char ch = 'A'; ch <= 'A' + i; ch++)
{
}
cout << endl;
}
}
int main()
{
// 2 : test cases
// 3 : for 3 *
// 5 : for 5 *
int testCases;
cin... | ALGO | 0.997034 | 4.546629 |
da508ba0-f65f-40b8-9340-3d62b320994d | maisonmains/myBox2DBranch | src/collision/b2_broad_phase.cpp | #include "box2d/b2_broad_phase.h"
#include <string.h>
b2BroadPhase::b2BroadPhase()
{
m_proxyCount = 0;
m_pairCapacity = 16;
m_pairCount = 0;
m_pairBuffer = (b2Pair*)b2Alloc(m_pairCapacity * sizeof(b2Pair));
m_moveCapacity = 16;
m_moveCount = 0;
m_moveBuffer = (int32*)b2Alloc(m_moveCapacity * sizeof(int32));
}... | ALGO | 0.925312 | 6.956042 |
2916476a-a5eb-4bff-8ac5-4c8450c4c4c2 | BurkhardtMicah/DataStructures | Trie_DS.cpp | #include <iostream>
#include <cstddef>
#include <fstream>
//Size of alphabet
const int SIZE_ALPHA = 127;
class Trie
{
private:
Trie* childNodes[SIZE_ALPHA]; //array of pointers to child nodes
bool wordEnd;
void reccomendationSearch(std::string);
void search(std::string);
public:
//Constructor
Trie... | ALGO | 0.997493 | 4.964099 |
72f88916-3081-4719-b462-5167ecfb3fdd | ishandutta2007/codeforces | aryanc403/normal/616/D.cpp | /*
Warn - Don't change next line else you will get WA verdict. Online Judge is configured to give WA if next line is not present.
Author - Aryan Choudhary (@aryanc403)
const short DEBUG { 0 };
#define debug(x) if (DEBUG) cout << #x << " = " << x << '\n'
*/
#pragma warning(disable:4996)
#pragma comment(linker... | ALGO | 0.999976 | 4.397904 |
4d613b9f-ba71-43b3-acf7-14eb956d1fee | krackn88/krackn | venv/lib/python3.12/site-packages/sklearn/svm/src/liblinear/tron.cpp | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "tron.h"
#ifndef min
template <class T> static inline T min(T x,T y) { return (x<y)?x:y; }
#endif
#ifndef max
template <class T> static inline T max(T x,T y) { return (x>y)?x:y; }
#endif
static void default_print(const char *buf)
{... | ALGO | 0.99963 | 5.847107 |
db5324d2-dad0-4bce-b06a-c72ef8d0fdb2 | Chandiharh-university/opps-and-dsa-Tamanna25582 | Kruskal algorithm.cpp | /******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
******************************************... | ALGO | 0.999961 | 5.883779 |
2f005a35-b3e2-4a53-944b-a650585a695a | Surya-13/CS2810 | A4/Answer.cpp | //*************************************
// NAME: B.V.S.SUDHEENDRA **
// ROLL NO: CS18B006 **
// DATE FINISHED: 04-02-2020 **
// SUBMISSION DEADLINE: 05-02-2020 **
//*************************************
#include<bits/stdc++.h>
#define ll long long int ... | ALGO | 0.998004 | 4.199912 |
77c83c8b-b337-4bed-a09c-56acdb8f91e6 | itzuditsharma/Leetcode | 1170-shortest-common-supersequence/1170-shortest-common-supersequence.cpp | class Solution {
public:
int LCS(int i, int j, string &str1, string &str2, vector<vector<int>> &dp){
if(i == 0 || j == 0) return 0;
if(dp[i][j] != -1) return dp[i][j];
if(str1[i-1] == str2[j-1]){
return dp[i][j] = 1 + LCS(i-1, j-1, str1, str2, dp);
}
return dp[... | ALGO | 0.999993 | 6.090296 |
310cdbef-c4ac-48d8-8485-1f202a3653bd | abdullaabdullazade/rio-semifinal-submissions-2025 | Rəşad_İsayev_Ehtibar oğlu_10.0_1_100BAL_RIO2025_Semifinal_S1.cpp | #include <bits/stdc++.h>
#define ll long long
#define int ll
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define vi vector<int>
#define pb push_back
#define nl '\n';
using namespace std;
// priority_queue<int, vector<int>, greater<int>> pq;
// A 65 Z 90 / a 97 z 122 /
bool is_prime(int n){
for (i... | ALGO | 0.999224 | 4.526936 |
4ae23e69-7dbf-467d-beff-6981d5766946 | benedictdavon/NYCU-Data-Structure-and-Object-Oriented-Programming | Midterm Exam 2/Midterm_answer/Q1_BST/BST.cpp | #include "BST.h"
#include<iostream>
#include<queue>
using namespace std;
void BST::insert(Node* insertNode) {
//TODO: insert a node to BST
Node* tempNode = new Node(insertNode->getValue());
Node* current;
Node* parent;
// Check if root is null, if yes assign to root
if (root == NULL) {
root = tempNode;
r... | ALGO | 0.999675 | 4.209023 |
2b0ac7fb-dd24-40b5-9cdc-eb11f313f470 | myreporthjh/ZumZumZum | thirdparty/opencv_480/sources/modules/video/src/tracking/tracker_nano.cpp | // This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
// Author, HongLinChu, <EMAIL>
// Adapt to OpenCV, ZihaoMu: <EMAIL>
// Link to original inference code: https://github.com/HonglinChu/NanoTrack
// Link to original training repo: https://github.com/... | ALGO | 0.984676 | 6.433546 |
91011219-8425-4af1-baea-b278f20735d6 | heavenMOJANG/ICPC | .history/Codeforces/CF2005/E1_20240925145615.CPP | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
void solve() {
int l, n, m; cin >> l >> n >> m;
vector<int> a(l + 1);
vector b(n + 1, vector<int>(m + 1));
for (int ... | ALGO | 0.999743 | 4.656158 |
f5e2c5c8-a1f3-4ff5-854b-b65b1b30dedc | TensorMD/lammps-tensormd | src/OPENMP/reaxff_bonds_omp.cpp | // clang-format off
#include "reaxff_omp.h"
#include "pair_reaxff_omp.h"
#include "reaxff_api.h"
#include <cmath>
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
namespace ReaxFF {
void BondsOMP(reax_system *system, simulation_data *data,
s... | ALGO | 0.997045 | 6.908043 |
a9d17de9-4027-4073-b001-bd23b817a72c | x1314aq/dsa | hihoCoder/1518.cpp | /**
* hihoCoder 1518 最大集合
*/
#include <bits/stdc++.h>
using namespace std;
int n;
int arr[100005];
int visit[100005];
int res[100005];
int num[100005];
void calc(int k) {
memset(visit, 0, sizeof(visit));
memset(num, 0, sizeof(num));
int ans = 0;
int pre = arr[k];
num[ans] = pre;
while (!v... | ALGO | 0.999975 | 3.965876 |
1eb199b2-96f1-483f-a822-f40a2ffb6aa0 | ishandutta2007/codeforces | mr.robot_28/normal/1416/B.cpp | #include<bits/stdc++.h>
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while(t--){
int n;
cin >> n;
vector <int> a(n);
int sum = 0;
for(int i = 0; i < n; i++)
{
cin >> a[i];
sum += a[i];
}
if(sum % n != 0)
{
cout <... | ALGO | 0.998137 | 3.427751 |
25b19f41-8671-4984-997c-0f40199bfb84 | VishnukantMULE/Practice_CPP | OOPs/Polymorphism.cpp | // PolyMorphism- many forms
/*
Polymorphism is the concept in which an object can be treated
in different ways
its means that object of a class can be used as object of
other derived class
Types of Polymorphism:
Polymorphism in OOP can be categorized into
compile-time (or static) polymorphism and
runtime (or dyn... | TOOL | 0.994481 | 5.692876 |
e5b91731-b466-4b70-8306-25d2bb3ca717 | rene-d/hackerrank | security/functions/security-inverse-of-a-function.cpp | // Security > Functions > Security Function Inverses
// Find the inverse of a given function f.
//
// https://www.hackerrank.com/challenges/security-inverse-of-a-function/problem
//
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
i... | ALGO | 0.999909 | 4.12138 |
cc5d9c99-1e2f-4b5b-a517-c0e3ef906176 | iamkuntal2002/most_liked_questions | dfs/minEffort.cpp | #include<bits/stdc++.h>
using namespace std;
// https://leetcode.com/problems/path-with-minimum-effort/ | ALGO | 0.999862 | 4.848351 |
9776b735-16de-4c56-b39e-ffdb75e97a03 | randeepsinghsikarwar/cpp_practice | HRStringStream.cpp | #include <iostream>
#include <vector>
#include <sstream>
using namespace std;
vector<int> parseInt(string str)
{
vector<int> result;
stringstream ss(str);
int a = 0;
char
while(ch == ','){
ss>>a>>c;
result.push_back(a);
i++;
}
return result;
}
int main()
{
str... | TOOL | 0.990677 | 3.896057 |
2f52afc2-07b2-4761-a975-45c075aef908 | Abindran/Cpp-Bootacmp | standardTemplateLibrary/setAndMultiset/setAndMultiSet.cpp | // The difference between the seta nd the multiset is that
// set - doesn't allows duplicate
// multiset - allows duplicate
#include<iostream>
#include<set>
using namespace std;
class User{
public:
string name;
int score;
bool operator >(const User& u)const{return score<u.score;}
bool operator <(const ... | ALGO | 0.946363 | 4.008592 |
bc4973bc-0884-4f41-b6c5-507b517feb66 | 155chb/QtGameProject | VSProject/Player.cpp | #include "Player.h"
#include "InfoSet.h"
#include "DeepAgent.h"
#include "Cards.h"
#include <queue>
#include <tuple>
#include <map>
class InfoSet;
Player::Player(InfoSet* infoset) {
this->infoset = infoset;
}
Player::~Player() {}
void Player::initHandCards(HandCards handCards, HandCards threeLandlordCards) {
... | ALGO | 0.979728 | 4.553329 |
d74b1d55-6f47-4ce6-8597-35e4ce9efc8f | OrderLab/violet-s2e-klee | lib/Expr/BitfieldSimplifier.cpp | #include "klee/BitfieldSimplifier.h"
#include <klee/Common.h>
#include "llvm/Support/CommandLine.h"
using namespace klee;
using namespace llvm;
namespace {
inline uint64_t zeroMask(uint64_t w) {
if (w < 64)
return (((uint64_t)(int64_t) -1) << w);
else
return 0;
}
cl::opt<bool> DebugSimplifie... | ALGO | 0.964898 | 7.757245 |
d06233b5-86c4-448b-812e-1b1aa6c7c99d | yiqichenshallwetalk/GROMACS-FEP-GPU | api/nblib/simulationstate.cpp | /*! \internal \file
* \brief
* Implements nblib SimulationState
*
* \author Berk Hess <<EMAIL>>
* \author Victor Holanda <<EMAIL>>
* \author Joe Jordan <<EMAIL>>
* \author Prashanth Kanduri <<EMAIL>>
* \author Sebastian Keller <<EMAIL>>
* \author Artem Zhmurov <<EMAIL>>
*/
#include "nblib/simulationstate.h"
... | TOOL | 0.930445 | 7.847733 |
4a64aeac-2666-4f25-9086-e306cdd804d7 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10642_1.cpp | #include <bits/stdc++.h>
using namespace std;
inline char gc() {
static char buf[100000], *p1 = buf, *p2 = buf;
return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
? EOF
: *p1++;
}
inline long long read() {
long long x = 0;
char ch = getchar();
bool positive... | ALGO | 0.999976 | 4.080753 |
bd770c30-1dca-428c-9159-2f4245c45b4c | Sarthakbhamare/DAA-Lab | 3mergesort.cpp | #include<iostream>
using namespace std;
int main(){
int n1, n2, n3;
int a1[] = {3,5,6,7};
int a2[] = {23,45,22,10};
int a3[8];
int k;
int merge(int a1[], int a2[], int a3[], int nl,int n2);
merge(a1,a2,a3,3,5);
cout<<"Resulatant array is:\n";
for(k=0; k<8; k++) {
cout<<a3 [k]<<endl;
}
}
int merge(int a1[... | ALGO | 0.999615 | 3.225175 |
9868c8db-594b-45f1-9aae-54f3dd937045 | corb20/Games202Homework | hw2/prt/ext/eigen/blas/single.cpp | #define SCALAR float
#define SCALAR_SUFFIX s
#define SCALAR_SUFFIX_UP "S"
#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"
float BLASFUNC(sdsdot)(int* n, float* alpha, float* x, int* incx, float* y, in... | TOOL | 0.945966 | 3.381595 |
cd286207-3372-4da4-a132-27ba14572c27 | mariaaktermukti/vjudge | G_how_mant.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int S,T;
cin>> S >> T;
int count=0;
for(int i=0;i<=S;++i)
{
for(int j=0;j<=S-i;++j)
{
for(int k=0;k<=S-i-j;++k)
{
if(i*j*k<=T)
{
count++;
... | ALGO | 0.999969 | 4.269703 |
67423ef4-890c-4a11-8f34-be9c3eec73f6 | JanhviAgrawal/DSA-with-CPP | ch-7-Patterns with loop/WithoutSpace Patterns/Task/pattern14.cpp | #include <iostream>
using namespace std;
main()
{
for (int i = 5; i >= 1; i--)
{
for (int j = i; j >= 1; j--)
{
cout <<"* ";
}
cout << endl;
}
} | ALGO | 0.99949 | 3.47109 |
fdd95b55-c801-44bc-8fcf-9f12319ba21f | sushilkumar20/Leetcode-Daily-question | 0049-group-anagrams/0049-group-anagrams.cpp | class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
map<string,vector<string>> mp;
for(int i=0;i<strs.size();i++)
{
string x = strs[i];
sort(x.begin(),x.end());
mp[x].push_back(strs[i]);
... | ALGO | 0.999994 | 6.440591 |
bfb4a3c1-af44-4f76-ba73-8e39ea8f5312 | Rishabhsp98/DSA-AlgoQuestions-Leetcode-GFG | Day15/minOperationsToReduceToZero.cpp | class Solution {
public:
int minOperations(vector<int>& arr, int x) {
int currsum = 0,start= 0,n = arr.size(),maxlength = 0,sum = accumulate(arr.begin(),arr.end(),0);
int targetsum = sum-x;
if(sum < x)
return -1;
if(sum == x)
return n;
for(int i=0;i<n;... | ALGO | 0.999957 | 5.516047 |
e6e313ef-be07-4889-9ff9-e3b8ccce47da | tykim96/BJ | 백준/1152.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
getline(cin, s);
if (s == " ") { cout << 0; return 0; }
int sp = 0, ep = s.size() - 1;
if (s[sp] == ' ') sp++;
if (s[ep] != ' ') ep++;
int cnt = 1;
for (int i = sp; i < ep; i++) {
if (s[i] == ' ')cnt++;
}
cout << cnt;
return 0;
} | ALGO | 0.999824 | 3.573242 |
43c3d070-ed16-4604-91f5-9a35d74ffabd | atharvarakshak/leetcode | 3743-reschedule-meetings-for-maximum-free-time-i/3743-reschedule-meetings-for-maximum-free-time-i.cpp | class Solution {
public:
int maxFreeTime(int eventTime, int k, vector<int>& startTime, vector<int>& endTime) {
vector<pair<int,int>> event;
int n = startTime.size();
for (int i = 0; i < n; i++) {
event.push_back({startTime[i], endTime[i]});
}
vector<int> free;
... | ALGO | 0.999942 | 5.675143 |
385b494e-720b-4dc5-bf14-7583d7b613e2 | kou256/CodeList | src/aoj/ITP1/3/c.cpp | // 3/c.cpp
#include <bits/stdc++.h>
int main() {
int x, y;
while(scanf("%d %d", &x, &y)) {
if (x == 0 && y == 0) {
break;
}
if (x < y) {
printf("%d %d\n", x, y);
}
else {
printf("%d %d\n", y, x);
}
}
return 0;
} | ALGO | 0.998642 | 3.758045 |
7ff19d0e-a50e-479a-90e7-7ded9bc8d586 | Shreyansh277/Cp_solutions | Atcoder_dp_contest_solution/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(x,y,z) for(int x=y;x<=z;x++)
#define repr(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define ppb pop_back
#define f first
#define s second
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define int long long int
typedef vector<int> vi;
#define mod... | ALGO | 0.999984 | 4.965782 |
632f1ab5-aa88-4165-9132-9088e893548f | SuEric/Animacion | Animacion/Viewports.cpp | #include <cmath>
#include <iostream>
#ifdef __APPLE__
# include <GLUT/glut.h>
#else
# include <GL/glut.h>
#endif
#define PI 3.14159265
using namespace std;
static GLsizei width, height;
void drawScene(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glViewport(0, 0, width/2.0, height);
glColor3f(1.0,... | TOOL | 0.973268 | 5.717879 |
7b975e05-5953-43a8-b969-1300cbf4ced4 | masa-umich/Rocket-Avionics | apogee-detection/noise_generator.cpp | #include <iostream>
#include <vector>
#include <random>
#include <ctime>
#include <chrono>
#include <thread>
#include <fstream>
#include <string>
#include <cmath>
#include <math.h> //for NAN
#include "noise_generator.hpp"
using namespace std;
// this takes the raw height reading from MASTRAN and computes the actual... | DATA | 0.952267 | 4.241826 |
c8a711bf-fb3c-458f-810b-94e3e8e3d58d | lwang1108/giza-pp | GIZA++-v2/atables.cpp | #include "atables.h"
#include "globals.h"
#include "util/assert.h"
#include "parameter.h"
GLOBAL_PARAMETER(bool, CompactADTable, "compactadtable", "1: only 3-dimensional alignment table for IBM-2 and IBM-3", kParLevModels, 1);
GLOBAL_PARAMETER(float, amodel_smooth_factor, "model23SmoothFactor", "smoothing parameter fo... | TOOL | 0.864201 | 5.41878 |
3e4af910-355a-40c1-91b1-62046bbd5785 | raj-mistry-01/Algorithms | Graph Theory/2ddj.cpp | class Solution {
public:
int minimumEffortPath(vector<vector<int>>& heights) {
// vector<pair<pair<int,int> , int>> graph;
map<pair<int, int>, vector<pair<pair<int, int>, int>>> graph;
for(int i = 0 ; i < heights.size() ; i++) {
for(int j = 0 ; j < heights[0].size() ; j++) {
... | ALGO | 0.999987 | 5.64101 |
17a19c03-4264-4212-825e-0a040d2e6a34 | RunAtTekky/DSAandCP | contests/CF/987Div2/B_Penchick_and_Satay_Sticks.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n; cin >> n;
vector<int> a(n);
for (auto &e : a) cin >> e;
for (int i=0; i<n; i++) {
int diff = abs(a[i] - i - 1);
if (diff > 1) { cout << "NO\n"; return; }
}
cout << "YES\n";
}
int main() {
int t=1; cin >>... | ALGO | 0.99994 | 4.579684 |
d36064dc-d5f7-404a-b1c6-82e8fcf71c68 | Is-Daouda/is-Engine-Example-Pack | is-Engine-TransitionEffect/app/src/main/cpp/isEngine/ext_lib/Box2D/Dynamics/Joints/b2WeldJoint.cpp | #include "b2WeldJoint.h"
#include "../b2Body.h"
#include "../b2TimeStep.h"
// Point-to-point constraint
// C = p2 - p1
// 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)
// Angle constraint
// C = angle2 - a... | ALGO | 0.984899 | 6.810672 |
04cce1e3-2236-486a-af7c-720f5caf0fd8 | MiCrByrd/HierTensDecomp | DirichletProcessSamplers.cpp | #include "DirichletProcessSamplers.h"
#include "FixedEffect.h"
#include "RandomEffect.h"
#include "TypeDefs.h"
#include "Generate.h"
#include <iostream>
#include <vector>
#include <random>
#include <cmath>
#include <chrono>
FixedEffect DPSampler(sVec& xData, sVec& init_localAllo, int beta,
std::vector<double>& beta0... | ALGO | 0.99891 | 4.858056 |
f382d801-9cf9-4fe9-b108-b07557a4ec93 | exopeng/Competitive-Programming | ccc/roadhelp/roadhelp.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T> using Tree = tree<T, null_type, less<T>,
rb_tree_tag, tree_order_statistics_node_update>;
#define mp make_pair
#define pb push_back
#define lb lowe... | ALGO | 0.999937 | 3.941985 |
820f56cb-8774-4ec6-a5e1-43c30fc295bd | i-am-faith/CODING-NINJAS-CPP | MILESTONE 1/Pattern 2/Mirror_Num_P.cpp | Code : Mirror Number Pattern
Print the following pattern for the given N number of rows.
Pattern for N = 4
1
12
123
1234
Input format :
Integer N (Total no. of rows)
Output format :
Pattern in N lines
Constraints
0 <= N <= 50
Sample Input 1:
3
Sample Output 1:
1
12
123
Sample Input 2:
4
Sample ... | ALGO | 0.999886 | 4.899539 |
db73796d-8338-47ef-bb21-ea5fc576a78a | kapurm17/DS_and_Algos | Basic/Recursion/Misc/count_abc/countabc.cpp | #include<iostream>
int countAbc(std::string str){
if(str.length() < 3) return 0;
if(str.substr(0, 3) == "abc") return 1 + countAbc(str.substr(3, str.length() - 3));
return countAbc(str.substr(1, str.length() - 1));
}
int main(){
std::string str;
std::cin>>str;
std::cout<<countAbc(str)<<'\n';
return 0;
}
| ALGO | 0.999567 | 4.091813 |
c7e36465-b5e1-474b-9ee2-aaa4bdc533ae | Pvt821/dsa | lab7/queueArr.cpp | #include<cstdio>
#define size 5
class queue{
int arr[size];
int front;
int rear;
public:
queue(){
front =-1;
rear = -1;
}
int enqueue(int);
int dequeue();
int peek();
};
int main(){
queue obj;
int choice,value;
do{
printf("\n=====MENU CARD=====\n");
printf("Enter 1: To In... | ALGO | 0.951476 | 3.750335 |
5f9a3f57-3fe7-4d09-a08f-19b078267f2e | Stanuns/grid_mapping | src/pose.cpp | //
// Created by wei.sun on 19-7-2.
//
#include <math.h>
#include "grid_mapping/pose.hpp"
namespace grid_mapping{
double computeDistance(const Pose& x1,const Pose& x2){
double dist ;
dist = sqrt(pow(x2.x-x1.x,2)+pow(x2.y-x1.y,2));
return dist;
}
double computeDistanceSquare(const... | ALGO | 0.987886 | 4.303525 |
1cb2faf5-eee8-4ff5-a179-31b565b38756 | Simba256/Competitive-Programming | Codeforces/1729/1729D2.cpp | using namespace std;
#include<bits/stdc++.h>
#define nl cout<<"\n"
#define ve vector
#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvll vector<vector<ll>>
#define ll long l... | ALGO | 0.999916 | 3.861287 |
eadf9f20-b4db-480a-a482-e437c1f61269 | ren517/lanqiao | dp/包子凑数.cpp | #include <iostream>
using namespace std;
const int M = 1000;
const int m = 1e5;
int arr[M];
int dp[m];
int main()
{
// 请在此输入您的代码
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> arr[i];
dp[arr[i]] = 1;
}
for (int i = 1; i <= m; i++)
{
for (int j = 1; j <= n... | ALGO | 0.999891 | 3.371899 |
600e2ec2-9ea9-43ac-827f-0b3b4791980d | AneekG8/DSA | DATA STRUCTURES/STACKS/STACKS IN C++/DeleteMiddle.cpp | //delete middle element of a stack with recursion
//middle element wont get pushed while returning back
#include<iostream>
#include<stack>
using namespace std;
void showstack(stack <int> s)
{
while (!s.empty())
{
cout << '\t' << s.top();
s.pop();
}
cout << '\n';
}
void deleteMiddle(st... | ALGO | 0.998688 | 5.108049 |
65ae1788-d8dd-47d7-a5b7-593ba1213534 | alamin147/competitive-programming | leetcode/guess-number-higher-or-lower.cpp | /**
* Forward declaration of guess API.
* @param num your guess
* @return -1 if num is higher than the picked number
* 1 if num is lower than the picked number
* otherwise return 0
* int guess(int num);
*/
class Solution {
public:
long long guessNumber(long long n) {
l... | ALGO | 0.999997 | 5.532434 |
355bd5c2-a09b-4c1c-a1e9-0014a9497eb9 | govinddwivedi-git/Codeforces-Solutions | B_DIV_MOD.cpp | #include <bits/stdc++.h>
using namespace std;
// Macros and constants
#define pb push_back
#define endl ("\n")
#define pi (3.141592653589)
#define int long long
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define aint(c) c.begin(), c.end()
#define mini(a, b, c) min... | ALGO | 0.999824 | 4.085984 |
e339271a-426a-4900-9a6a-2058ea08592d | crimsonme/UE4.25 | UnrealEngine-release/Engine/Plugins/Experimental/AlembicImporter/Source/ThirdParty/Alembic/openexr/IlmBase/ImathTest/testRoots.cpp | #include <testRoots.h>
#include "ImathRoots.h"
#include "ImathFun.h"
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
using namespace std;
void
sort (int nx, double &x0, double &x1, double &x2)
{
if (nx == 2)
{
if (x0 > x1)
swap (x0, x1);
}
if (nx == 3)
{
if ... | TEST | 0.993885 | 4.804662 |
e6a35399-14ae-4482-afd1-0ea3182820b3 | mihirbajpai10/C-- | pattern3.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=n; i>=1; i--){
for (int j = 1; j <=i; j++)
{
cout<<"*";
}
cout<<endl;
}
return 0;
}
| ALGO | 0.999986 | 3.80342 |
3d6508fb-2535-47a2-90ce-04ae3723bdfb | TengFeiyang01/Algorithm | ACODE/cf/cf_850/c.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <functional>
#include <vector>
#include <cstring>
#include <map>
#include <unordered_map>
#include <stack>
#include <numeric>
#include <cmath>
#define sz(x) int((x).size())
#define bg(x) begin(x)
#define all(x) bg(x), e... | ALGO | 0.999696 | 4.738044 |
9d01aa88-4d9d-450a-93ef-0752fae01cd1 | Katsudon10/Competitive-programming | Atcoder/ARC/ARC003/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
const int inf = INT_MAX;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
vector<int>dxs={1,0,-1,0};
vector<int>dys={0,1,0,-1};
//fixed << setprecision(10)
int ma... | ALGO | 0.999557 | 3.980452 |
758213be-ae2b-4be1-9a16-5356e8ba5a99 | slitvinov/lammps-sph-multiphase | src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "math.h"
#include "pair_lj_cut_dipole_cut_omp.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#incl... | ALGO | 0.999714 | 6.608471 |
435854ae-6b98-43ac-8195-9a1781cfcf9b | josephmousa/LearnCppCodeCademy | project3/quadratic.cpp | //program to calculate roos of a quadratic by passing in values for constants
#include <iostream>
#include <cmath>
int main() {
double a,b,c;
std::cout << "Enter a: ";
std::cin >> a;
std::cout << "Enter b: ";
std::cin >> b;
std::cout << "Enter c: ";
std::cin >> c;
double root1, root2;
root1 = ((-b) + st... | ALGO | 0.998044 | 3.613125 |
5cd8b317-5c8e-4e23-be68-e8cfe6f2099e | TinkerEdgeR-Android/external_eigen | doc/examples/Tutorial_BlockOperations_vector.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::ArrayXf v(6);
v << 1, 2, 3, 4, 5, 6;
cout << "v.head(3) =" << endl << v.head(3) << endl << endl;
cout << "v.tail<3>() = " << endl << v.tail<3>() << endl << endl;
v.segment(1,4) *= 2;
cout << "after 'v.segment(1,4) *= 2', v... | ALGO | 0.998056 | 3.072667 |
6427d140-f016-4052-a526-1bbeeff208f7 | stevenmsl/cpp_src_800 | util.cpp | #include <string>
#include <sstream>
#include "node.h"
#include "util.h"
using namespace std;
using namespace sol800;
string Util::toString(vector<string> input)
{
string result = "[";
for (auto e : input)
{
result += e;
result += ",";
}
/* remove the last comma */
if (result.b... | ALGO | 0.976325 | 5.26491 |
5d489a5c-64bc-434a-8474-cfbeda125554 | jumpinjackie/mapguide | MgDev/Oem/geos/src/noding/SingleInteriorIntersectionFinder.cpp | #include <geos/noding/SingleInteriorIntersectionFinder.h>
#include <geos/noding/SegmentString.h>
#include <geos/algorithm/LineIntersector.h>
#include <geos/geom/Coordinate.h>
using namespace geos::geom;
namespace geos {
namespace noding { // geos.noding
/*public (override) */
void
SingleInteriorIntersectionFinder::p... | ALGO | 0.999666 | 5.7855 |
9b0cd44b-abf3-4ad4-8bb4-d0d00f79c568 | AlissonAnjos21/algoritmos-e-programacao | semestre20231/laboratorio11/AtividadeRecursao02.cpp | #include <iostream>
using namespace std;
int multiplicacao(int n1, int n2){
if(n2 == 1){
return n1;
}
if(n1 == 0 || n2 == 0){
return 0;
}
return n1 + multiplicacao(n1, n2-1);
}
int main() {
int n1, n2;
cout << "Informe um inteiro positivo para realizar a multiplicacao: " << endl;
cin >> n1;
cout << "In... | ALGO | 0.999432 | 4.178636 |
99588126-5553-4a33-a953-f2687aedcd0b | coldEr66/online-judge | atcoder/ARC106/pC.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
fp... | ALGO | 0.99999 | 3.553173 |
3a168d07-1342-49fa-88ab-12125b8487fd | GitNerdSavvy/GeeksForGeeks | Difficulty: Medium/Smallest Positive Missing/smallest-positive-missing.cpp | class Solution {
public:
int missingNumber(vector<int> &arr) {
// code here
int n=arr.size();
for(int i=0; i<n; i++){
while(arr[i] > 0 && arr[i] <= n && arr[arr[i]-1] != arr[i]){
swap(arr[i], arr[arr[i]-1]);
}
}
int key = 1;
... | ALGO | 0.999947 | 5.098481 |
c913497f-8758-47ff-9011-e6bf64a1b2cb | dilevin/CSC417-a6-rigid-body-contact | extern/libigl/include/igl/flipped_triangles.cpp | #include "list_to_matrix.h"
#include <vector>
template <typename DerivedV, typename DerivedF, typename DerivedX>
IGL_INLINE void igl::flipped_triangles(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedX> & X)
{
assert(V.cols() == 2 && "V shou... | ALGO | 0.998871 | 6.577977 |
a821c99d-2c64-4c9b-aa97-832b340867d0 | SayanBanerjee09082002/ComPhy_Programmes | Roots_of_Function/False_Proposition_Method/False_Proposition_Method.cpp | #include <iostream>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#define f(x) log(x) - cos(x) // FUNTION
using namespace std;
float FPM(float a, float b, float tol, int maxitr)
{
cout << setprecision(10) << fixed;
float fa, fb, ft, t;
int itr = 1;
do
{
fa = f(a);
fb =... | ALGO | 0.99993 | 4.352983 |
0c10dd7f-b3c5-47fe-8c69-f59f9922b6e7 | ShelpAm/competitive_programming | codeforces/problem/1915/D/main.cpp | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string_view>
#include <uno... | ALGO | 0.999843 | 5.308358 |
c1aa4b8a-d6c8-4c9b-aff0-948d35a69f53 | nishantbhardwaj2004/DSA-in-Cpp | Functions/Function2/dpp1SquareofNnumbers.cpp | #include<iostream>
using namespace std;
int Square(int n){
return n*n;
}
int main(){
int n;
cout<<"Enter number :";
cin>>n;
for(int i=1;i<=n;i++){
cout<<Square(i)<<endl;
}
} | ALGO | 0.992336 | 3.723456 |
96dd4c29-87c2-4de5-9234-c88d89587dc0 | apandia/Leetcode | Array/LC0287_FindDuplicateNumber.cpp | //Floyd's Cycle Detection Algorithm
//TC: O(n)
//SC: O(1)
class Solution {
public:
int findDuplicate(vector<int>& nums) {
int fast = nums[0];
int slow = nums[0];
do{
slow = nums[slow];
fast = nums[nums[fast]];
}while(slow != fast);
... | ALGO | 0.999969 | 6.039622 |
41bb45aa-8cfe-4d4f-9f2e-0bc28e9b4305 | ishandutta2007/codeforces | sd0061/normal/513/G2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 35;
int n , K , a[N];
double f[2][N][N];
void work() {
int i , j , k , x , y;
cin >> n >> K;
for (i = 0 ; i < n ; ++ i)
cin >> a[i];
int cur = 0 , nxt = 1;
for (i = 0 ; i < n ; ++ i)
for (j = i + 1 ; ... | ALGO | 0.999828 | 3.797728 |
2848268c-3176-488f-9d1b-8dfbf8d38da4 | Rishikesh-kumar-7258/practice_cpp | algorithms/chapter1/InsertionSort.cpp | #include <iostream>
using namespace std;
void insertion(int arr[], int);
void insertion_d(int arr[], int n);
void linear_search(int arr[], int n, int v);
void n_bit_sum(int a[], int b[], int c[], int n);
void selection(int arr[], int n);
void insertion_recursive(int arr[], int, int);
int main() {
int arr[] = {1, 5, ... | ALGO | 0.999902 | 3.89833 |
1110697d-9ede-421c-946c-0a4914c096ed | alexandraback/datacollection | solutions_5686275109552128_0/C++/JeffreyHui/GCJ15_Q_B.cpp | #include <cstdio>
int T, D, P[1000], total, high, cut;
int main (){
freopen("B-small-attempt1.in", "r", stdin);
freopen("B-small-attempt1.out", "w", stdout);
scanf("%d", &T);
for (int i = 1; i <= T; i++){
high = 0;
scanf("%d", &D);
for (int j = 0; j < D; j++){
scanf("%d", &P[j]);
if (high < P[j])
hi... | ALGO | 0.999745 | 3.374522 |
1db50366-3b71-400f-827e-afa2ba83ba20 | Amorrrrrrrrr/algorithm | algorithm/二刷/字符串/001.反转字符串.cpp | class Solution {
public:
void reverseString(vector<char>& s) {
int right = s.size() - 1;
int left = 0;
while (left < right) {
int tmp = s[left];
s[left] = s[right];
s[right] = tmp;
left++;right--;
}
}
}; | ALGO | 0.999749 | 6.097936 |
12aa595e-3aef-4988-94fe-9b7a818a7375 | UdaySharmaGitHub/DSA-CPP | Leet Code Problems/Easy/136_Single_Number.cpp | /*
136. Single Number
Given a non-empty array of integers nums, every element appears twice except for
one. Find that single one.
You must implement a solution with a linear runtime complexity and use only
constant extra space.
Example 1:
Input: nums = [2,2,1]
Output: 1
Example 2:
Input: nums = [4,1,2,1,2]
Output: 4
... | ALGO | 0.999876 | 6.08444 |
7e2d3f90-1e40-472e-ae8b-d482f0ced50a | sarvex/leetcode-fish | solution/1200-1299/1209.Remove All Adjacent Duplicates in String II/Solution.cpp | class Solution {
public:
string removeDuplicates(string s, int k) {
vector<pair<char, int>> stk;
for (char& c : s) {
if (stk.size() && stk.back().first == c) {
stk.back().second = (stk.back().second + 1) % k;
if (stk.back().second == 0) {
... | ALGO | 0.999997 | 6.534365 |
9ca21a35-dddc-4bcb-96bb-09e2d709c0f7 | ishandutta2007/codeforces | thienu/normal/1419/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define u_map unordered_map
#define u_set unordered_set
#define u_multiset unordered_multiset
using ll = long long;
using vvi = vector<vector<int>>;
using vi = vector<int>;
using vvll = vector<vector<long long>>;
using vll = vector<long long>;
using vd = vector<double>;
... | ALGO | 0.999842 | 4.676878 |
2cf71f48-d067-4cba-b91b-30896c8bd375 | Rijul1204/Algorithm_ACM | Source_Code/Floyd-Warshall/11463 Commandos.cpp | #include<stdio.h>
#define inf 1000000
int mat[500][500];
void set(int n);
void floyd(int n);
int main(){
int i,j,k,l,s,e,t=1,res,test,n,m;
//freopen("in.txt","r",stdin);
scanf("%d",&test);
while(test--){
scanf("%d %d",&n,&m);
set(n);
for(i=1;i<=m;i++){
scanf("%d %d",&k,&l);
mat[k][l]=ma... | ALGO | 0.999847 | 4.022022 |
902037df-2b74-4d23-b199-39237f60e94d | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12324_31.cpp | #include <bits/stdc++.h>
int main() {
int a = 0, i, n;
char X, tab[150];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s", &tab);
if (strcmp(tab, "X++") == 0 || strcmp(tab, "++X") == 0)
a = a + 1;
else if (strcmp(tab, "X--") == 0 || strcmp(tab, "--X") == 0)
a = a - 1;
}
printf("... | ALGO | 0.999413 | 3.839991 |
7a999439-9096-467c-a5fa-9a59d1d88ac7 | pingchungchang/CP | ABC330F.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const ll mxn = 2e5+10;
const ll inf = 1e15;
ll n,k;
ll x[mxn],y[mxn];
inline ll calc(ll r){
ll re = 0;
for(int i = 0;i+i<n;i++){
re... | ALGO | 0.999992 | 4.650794 |
c6258c14-e4a0-4bff-bba4-79729fd33828 | Hasheditz/Leetcode-CSES-GFG-Codeforces-Coding-Solutions | CSES Solutions/Sorting and Searching/Movie_Festival.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ff first
#define ss second
#define set_bits __builtin_popcountll
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define nl endl
#define ll long long int
void solve()
{
int n;
... | ALGO | 0.99985 | 4.417263 |
1852871a-7b26-4bb1-9f97-ed412a029f86 | naquee-rizwan/SPOJ | ACODE DP.cpp | #include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
string t;
while (cin>>t)
{
if (t=="0")
break;
ll ar[t.length()];
ll k=t.length();
for (ll i=1;i<k;i++)
ar[i]=0;
ar[0]=1;
for (ll i=1;i<k;i++)
{
if (t[i]-'0')
ar[i]=ar[i-1];
ll num=(t[i-1]-'0')*10+(t[i]-'0');... | ALGO | 0.999887 | 3.609066 |
44d564ac-c27f-4343-9128-8369abd6857e | mkltaneja/Leetcode | 818. Race Car.cpp |
// Time Complexity = O(target * log(target) * log(target))
// Space Complexity = O(target * log(target))
class Solution {
public:
int racecar(int target)
{
if(target == 0) return 0;
queue<pair<int,int>> posSpeedQue;
set<pair<int,int>> visitedConf;
int sequenceLength = 0;
... | ALGO | 0.999899 | 5.361156 |
d55cc17b-9065-4fad-ad72-6896035f2b85 | Saleh7127/CPP-solution-by-Fellow_junior | UVA Judge/uva793.cpp | /***
created: 2021-11-20-21.25.30
***/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define test int tt; cin>>tt; for(int cs=1;cs<=tt;cs++)
#define get_lost_idiot return 0
#define nl '\n'
vector<ll>parent(200005),rankk(200005);
void make_set(ll n)
{
for(ll i=0; i<=n+5; i++)
{
p... | ALGO | 0.999548 | 3.875853 |
099a8788-4545-4e7f-acea-41abe7597d3f | UITSE2024/LuuDoThuatToan_Cpp_Function | AnhVan/103/103.cpp | #include <iostream>
using namespace std;
float Tinh();
int main()
{
cout << "S(n) = " << Tinh();
return 0;
}
float Tinh()
{
float s = 0, e = 1;
int i = 1;
float ep = 10e-6;
while (e >= ep)
{
e = (float)1 / i;
s = s + e;
i = i + 2;
}
return s;
} | ALGO | 0.997314 | 3.715947 |
1c270410-7c3c-48f3-a17f-3937c6325783 | Rohitrky2021/JavaSourceCode | =INTERVIEW-----BITS/InterviewBit-Topicwise-Solutions-master/Heaps and Maps/Merge K sorted arrays!.cpp | vector<int> Solution::solve(vector<vector<int> > &A) {
int k=A.size(),n=A[0].size();
vector<int> ans;
for(int i=0;i<k;i++)
{
for(int j=0;j<n;j++)
{
ans.push_back(A[i][j]);
}
}
sort(ans.begin(),ans.end());
return ans;
} | ALGO | 0.999961 | 4.642297 |
c69baec6-14cf-4429-97ad-fa49ffa95055 | PacktPublishing/Cpp-for-game-developers | Module 3/C++GameDevelopmentCookbook_Code/Chapter9/Source/Box2D/Contributions/Utilities/ConvexDecomposition/b2Triangle.cpp | #include "b2Triangle.h"
//Constructor automatically fixes orientation to ccw
b2Triangle::b2Triangle(float32 x1, float32 y1, float32 x2, float32 y2, float32 x3, float32 y3){
x = new float32[3];
y = new float32[3];
float32 dx1 = x2-x1;
float32 dx2 = x3-x1;
float32 dy1 = y2-y1;
float32 dy2 = y3-y1;
float32 cross =... | ALGO | 0.914821 | 4.681123 |
cadfda1f-46f3-4e91-8017-6f17d75c2db4 | ishandutta2007/codeforces | amethyst0/normal/949/E.cpp | #pragma comment(linker, "/STACK:1000000000")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdlib>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <ctime>
#define mp make_pair
#define... | ALGO | 0.999993 | 3.895887 |
97707639-ca20-4767-b73e-a4ef721c6b0e | atul21mangla/DSA-code | String/String Class/customSort.cpp | #include <bits/stdc++.h>
using namespace std;
// assume 'a' is present at a lower position than 'b'
// return true when swap is not needed else return false
bool myLengthComparator(string a , string b){
if(a.length() < b.length()){
return true;
}
return false;
}
bool myGreaterComparator(int a , in... | ALGO | 0.999768 | 4.539917 |
4932fb1f-c88e-43cd-bd9a-773bfa0496b2 | kartikvishwakarma/Geeksforgeeks | practice/others/trapp_rain_water.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
cin>>n;
int a[n];
int left[n]={0}, right[n]={0};
//left[] = {0}, right[] = {0};
for(int i=0;i<n;i++)
cin>>a[i];
left[0]=a[0];
right[n-1]=a[n-1];
for(int i=1;i<n;i++)
left[i]=max(left[i-1], a[i]);
for(int i=n-2;i>=0;i--... | ALGO | 0.999948 | 3.878134 |
cd2130db-8d8f-43ab-a9f2-98b29a055b9e | ChoiWheatley/choi-workspace | ALGORITHMS/apss/8_dynamic_programming/8_wildcard_memo.cpp | #include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;
enum DP{
UNDEFINED=-1, FAILURE=0, SUCCESS=1
};
#define MAXN 100
#define MAXC (MAXN+1)
static int cache[MAXC][MAXC]={-1};
vector<string> solve(const string& src, const vector<string>& pa... | ALGO | 0.999957 | 4.058656 |
f9c62653-9f19-4f83-8a0b-93d9a781ffbf | hugoresende27/c-_Exercicios | exercicios youtube/FUNCOES_grausC_grausF.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <locale>
#include <iomanip>
using namespace std;
float celsius (float );
int main ()
{
setlocale (LC_ALL,"Portuguese");
float t=0;
cout<<"PROGRAMA TEMPERATURA Formula--C = 5/9 * (F-32)\n";
for (int i=0; i<133; i++)
{
t=celsius(i);
cout<<i... | TOOL | 0.909849 | 3.885617 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.