uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
18ccaec7-b198-4c5c-9ca8-fb9dfe32f633 | ishandutta2007/codeforces | al.cash/normal/538/C.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <complex>
#include <numeric>
#include <bitset>
#include <vector>
#include <string>
#include <queue>
#include <list>
#include <map>
#include <set>
using namespace std;
#define all... | ALGO | 0.999896 | 3.82044 |
d2b17b40-e847-4bcd-acac-bdbaff0eef57 | Gyanthakur/GFG_POTD | july_2023/potd_26_07_2023.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left, *right;
};
void inorder(Node *root,int &cnt){
if(root==NULL) return;
cnt++;
inorder(root->left, cnt);
inorder(root->right, cnt);
}
int kthAncestor(Node *root, int k, int node)
{
// Code here
Node *temp =... | ALGO | 0.999997 | 4.370744 |
f0142d1d-c46e-46aa-b200-7fcd610963ec | amsraman/Competitive_Programming | Yosupo/Tree/JumponTree.cpp | #include <bits/stdc++.h>
using namespace std;
template <int log = 20>
struct BinaryLifter {
int n, root;
vector<int> dep;
vector<vector<int>> graph;
vector<array<int, log + 1>> par;
BinaryLifter(const vector<vector<int>> & graph, int root = 0): n((int) graph.size()), root(root), graph(graph) {
... | ALGO | 0.999963 | 4.853798 |
2524a123-be0d-4f75-ad4e-ac48a25c7322 | IAmShaaann/DSA-Codes | AmazonAlgoPrep/Binary Search/search_in_bitonic_array/main.cpp | #include <iostream>
#include <vector>
using namespace std;
// Bitonic Array - an array having a peak.
int binary_search(vector<int> arr, int low, int high, int target, bool isArraySorted)
{
int mid = 0;
while (low <= high)
{
mid = low + (high - low) / 2;
if (arr[mid] == target)
... | ALGO | 0.999978 | 5.822687 |
6baf2afe-20c1-4993-a7fa-d84272160e78 | BaoThien0910/BTTH3_24521669 | 24521669_BTTH3/bai05_BTTH3/DonThuc.cpp | #include "DonThuc.h"
#include <iostream>
#include <cmath>
using namespace std;
DonThuc::DonThuc (){}
DonThuc::DonThuc(float a , float b = 0)
{
fHeSo = a;
fBac = b;
}
DonThuc::~DonThuc(){}
void DonThuc::Nhap()
{
cout<<"Nhap he so : ";
cin>>fHeSo;
cout<<"Nhap so bac : ";
cin>>fBac;
}
void DonThuc ... | TOOL | 0.939931 | 3.117527 |
c828f71d-fdf6-4b68-ae47-2b75d98fc5f4 | raincross7/code-similarity | codes/train_code/problem134/problem134_161.cpp | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
int dp[1001][1001] = { 0 };
int main()
{
int sy,sx, q, k;
char x[2001], y[2001];
k = 0;
scanf("%d", &q);
for (int z = 0; z < q; z++)
{
if (z != 0)
{
for (int i = 1; i <= sy; i++)
{
for (int j = 1; j <= sx... | ALGO | 0.999948 | 3.6476 |
0d4157b9-506d-46d8-b801-6b43791fc0df | youssefmichel/VSDS_orient | src/utility_fri.cpp |
#include "utility_fri.h"
namespace FRI_wrapper{
int startCartImpedanceCtrl(FastResearchInterface *fri, float *commCartPose){
unsigned int controlScheme = FastResearchInterface::CART_IMPEDANCE_CONTROL;
int resultValue;
if(fri->GetCurrentControlScheme() != controlScheme || !fri->IsMachineOK()){
// ... | ALGO | 0.986458 | 4.711853 |
fe43af23-f8d4-4ef9-845b-98ef33549f58 | ivangalbans/leetcode | src/0209.cpp | // https://leetcode.com/problems/minimum-size-subarray-sum/description/
// O(n * log(n))
class Solution
{
public:
int sum(vector<int> &preSum, int l, int r)
{
return l == 0 ? preSum[r] : preSum[r] - preSum[l - 1];
}
int minSubArrayLen(int target, vector<int> &nums)
{
int n = nums.... | ALGO | 0.999988 | 6.433402 |
a943563c-474b-487d-aa39-90a8e15700e5 | sheyua/LAMMPS-QTB | src/KOKKOS/pair_coul_cut_kokkos.cpp | #include "math.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "pair_coul_cut_kokkos.h"
#include "kokkos.h"
#include "atom_kokkos.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "update.h"
#include "integrate.h"
#include "r... | ALGO | 0.976852 | 6.529731 |
05fad07f-ea55-457a-b2ff-80b683b0f367 | nathaliaop/tep | Matemática/Fundamentos/Funções/solve_it.cpp | // https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1282
/*
The middle of adventure, such a perfect place to start
⣿⣿⣿⣿⣿⣿⣿⢿⠟⢿⣿⣿⣿⣿⠿⠛⠛⠿⢿⣿⣿⣿⣿⠛⣿⢿⣿⣿⣿⣿
⣿⣿⣿⡿⢿⣿⣿⣄⠄⣼⣿⡿⠋⠄⠄⠄⠄⠄⠄⠄⠛⣿⣿⠄⢀⣤⣿⣿⣿⣿
⣿⣿⣷⣤⣸⣿⠛⡛⢛⣿⠋⠄⠄⢀⠄⠄⠄⠄⠄⠄⠄⠘⣿⣿⡿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⡿⠁⠄⠁⠈⠄⠄⠄⠄⣿⡀⠄⠄⠄⠄⠄⠄⠄⠓⠸⠏⠄⢹⣿⣿⣿
⣿⣿⣿⡿⠄⠄⠄⠄⠄⠄⠄⢠⠿⠿⢻⣦⣤⣠⠄⠄⠄⠄⠄⠄⠄⠄⠈⠻⣿⣿
⣿⣿⡿⠁⠄⠄... | ALGO | 0.999898 | 4.085313 |
cc5a69ce-4229-461f-903f-c0d2f951b4ff | jibreel-natsheh/cryptography_aes_course_project | cryptopp-master/esign.cpp | // esign.cpp - originally written and placed in the public domain by Wei Dai
#include "pch.h"
#include "config.h"
// TODO: fix the C4589 warnings
#if CRYPTOPP_MSC_VERSION
# pragma warning(disable: 4589)
#endif
#include "esign.h"
#include "modarith.h"
#include "integer.h"
#include "nbtheory.h"
#include "algparam.h"
#... | TOOL | 0.973727 | 7.584857 |
763d2c46-2f86-45ef-9607-2d44ed81936a | chongin12/Problem_Solving | acmicpc.net/old/1633.cpp | #include <bits/stdc++.h>
using namespace std;
int dp[1001][3][16][16];
//dp[i][j][k][w] : i번째 친구에서 j(0:X, 1:흑, 2:백)를 택했을 때
// 누적 k개, 백 w개
int max3(int a, int b, int c){
return max(max(a,b),c);
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
int n=0;
while(1){
int a,b; cin>>a>>b;
if(ci... | ALGO | 0.999434 | 3.675357 |
2127604c-0446-4c40-a697-9f165e57247b | Mantouidev/k_system_core | libutils/JenkinsHash.cpp | /* Implementation of Jenkins one-at-a-time hash function. These choices are
* optimized for code size and portability, rather than raw speed. But speed
* should still be quite good.
**/
#include <utils/JenkinsHash.h>
namespace android {
hash_t JenkinsHashWhiten(uint32_t hash) {
hash += (hash << 3);
hash ^... | ALGO | 0.991958 | 7.014037 |
f1661226-eb4c-4ff1-9e20-de0245056b59 | maxnelso/algorithms_competitions | codeforces/problem_set/776B.cpp | #include <bitset>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cm... | ALGO | 0.99972 | 3.543273 |
e34e01ef-cf36-4b6d-9012-e4839f4927b4 | fefo2469/PF1-1 | projectplanteta/Library/PackageCache/com.unity.ide.visualstudio@2.0.16/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.960474 | 6.937841 |
a60ddb52-d636-4181-ab76-a3c795deded0 | svn2github/anki-3d-engine | src/renderer/Tiler.cpp | #include "anki/renderer/Tiler.h"
#include "anki/renderer/Renderer.h"
#include "anki/resource/ProgramResource.h"
#include "anki/scene/Camera.h"
#include <sstream>
// Default should be 0
#define ANKI_TILER_ENABLE_GPU 0
namespace anki {
//==============================================================================
//... | ALGO | 0.910123 | 6.189327 |
44ec665f-ce2f-4822-9b8d-1666a44919d5 | harshshah96/Leetcode | 442-find-all-duplicates-in-an-array/find-all-duplicates-in-an-array.cpp | static int io_opt = []() {
ios::sync_with_stdio(false);
return 0;
}();
class Solution {
public:
vector<int> findDuplicates(vector<int>& nums) {
int n=nums.size();
vector<int> a;
int i=0;
while(i<n){
int correctIdx=nums[i]-1;
if(nums[i]==i+1 || nums[i]==nu... | ALGO | 0.999988 | 5.103001 |
73931eec-804f-4da7-b208-e647f8cccfc9 | Ehsanul-Karim-Pappu/backup_code_repo | uHunt/UVA-Solutions-master/497 Strategic Defense Initiative.cpp | #include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
// End is the index in numbers of last number for longest subsequence
int lengthOfIncreasing, endOfLatest;
// L is the current list. Is not actually a valid increasing subsequence, but using L_id and P, can reconstruct f... | ALGO | 0.999889 | 4.413331 |
ebd51d74-3e2f-408a-bc29-5ec14b607354 | b191832Anand/DAA | minimum_subset_diff.cpp | #include <bits/stdc++.h>
using namespace std;
bool ss(vector<int>&v,int target,int index){
if(target==0)return true;
if(index==0)return (v[0]==target);
bool nontake=ss(v,target,index-1);
bool take=false;
if(target>=v[index])take=ss(v,target-v[index],index-1);
return take | nontake;
}
int main(){
int n;
cin>>n;
... | ALGO | 0.99996 | 4.054852 |
a863f736-e07d-45f6-8553-de2b41ebb3c5 | Sartazz7/CSES-Problem-Set | StringAlgorithms/WordCombinations.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
struct Node {
int idx,l,r;
vector<Node*> next;
Node(int idx1, int l1, int r1){
idx=idx1;
l=l1;
r=r1;
}
};
class Trie{
Node *root;
vector<string> v;
Node *leaf;
ll mod=1000000007;
int match(... | ALGO | 0.999977 | 4.225835 |
7a7b5ddc-01a2-41cb-aa73-3d7b15b3ad4c | kallaballa/Poppy | third/opencv-4.6.0/modules/calib3d/src/homography_decomp.cpp | #include "precomp.hpp"
#include <memory>
namespace cv
{
namespace HomographyDecomposition
{
//struct to hold solutions of homography decomposition
typedef struct _CameraMotion {
cv::Matx33d R; //!< rotation matrix
cv::Vec3d n; //!< normal of the plane the camera is looking at
cv::Vec3d t; //!< translatio... | ALGO | 0.999884 | 6.202213 |
6cb3feba-55a9-4617-b867-1af770d337ea | keijak/comp-pub | cf/contest/0682/E/main.cpp | #include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128_t;
#define REP(i, n) for (int i = 0, REP_N_ = int(n); i < REP_N_; ++i)
#define ALL(x) std::begin(x), std::end(x)
template <class T>
inline bool chmax(T &a, T b) {
return a < b and ((a = std::move(b)), true);
}
templ... | ALGO | 0.99997 | 3.89969 |
f026e4d0-37d9-491b-9c67-09af4890614c | rohan8789/Languages | C++/chapter05/14_DecimalToBinary.cpp | #include<iostream>
//#include<math.h>
using namespace std;
long long convert(int);
int main(int argc, char const *argv[])
{
int n;
cout<<"Enter a number: ";
cin>>n;
cout<<"Converted binary number is: "<<convert(n);
return 0;
}
long long convert(int x)
{
int rem, temp = 1;
long binary = 0;... | ALGO | 0.99974 | 5.130934 |
50c66874-d08b-473e-bd62-872e205d534c | Jystro/avventura-testuale | src/Functions.cpp | // Authors: Lorenzo Colombo - Lorenzo De Filippo - Giovanni Nerviani
#include <algorithm>
#include <ctype.h>
#include <fstream>
#include <iostream>
#include <string>
#include "Functions.hpp"
#include "GameState.hpp"
#include "Languages.hpp"
/**
* @brief Struct representing the size of the terminal
*
* @see Funct... | TOOL | 0.850646 | 5.802207 |
5ecb6f1a-000c-45cc-92eb-067d64c41695 | ishandutta2007/codeforces | spy20051623/normal/1667/A.cpp | #include <bits/stdc++.h>
using namespace std;
int a[5005];
long long b[5005];
int main() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
long long ans = 1e18;
for (... | ALGO | 0.999981 | 3.459695 |
6552ccc7-2a60-4455-973c-1bece461ed29 | shehap0/icpc-codeforces-problemswithsolve-cpp | c++ #6 (math)/M_Divisible.cpp | #include <iostream>
using namespace std;
int main(){
int x,y; cin>>x>>y;
if(x%y==0){
cout<<"YES";
}else{cout<<"NO";}
return 0;
} | ALGO | 0.999958 | 4.082111 |
8683bf9d-900e-4ddc-a9b1-7671a634c68d | caofengl/record | OJ/LeetCode/45_jump_game_2.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int jump_2(vector<int> &nums) {
size_t times = 0, reached = 0, max_dist = 0;
for (size_t i = 0; i < nums.size(); ++i) {
if (reached < i) {
++times;
reached = max_dist;
}
... | ALGO | 0.999927 | 4.963883 |
f4cef6a9-6d58-4b67-a92a-99c313f4a910 | Chongjx/Official_SP2_Framework | SP2_Framework/Source/LoadOBJ.cpp | #include <iostream>
#include <fstream>
#include <map>
#include "LoadOBJ.h"
bool LoadOBJ(
const char *file_path,
std::vector<Position> & out_vertices,
std::vector<TexCoord> & out_uvs,
std::vector<Vector3> & out_normals
)
{
//Fill up code from OBJ lecture notes
//Opening file
std::ifstream fileStream(f... | TOOL | 0.954141 | 5.252472 |
53cbfb29-22ce-47c7-8271-df3d41699349 | managarm/mlibc | options/posix/generic/strings.cpp |
#include <strings.h>
#include <string.h>
#include <ctype.h>
#include <bits/ensure.h>
#include <mlibc/strings.hpp>
char *index (const char *s, int c) {
return strchr(s, c);
}
char *rindex(const char *s, int c) {
return strrchr(s, c);
}
namespace {
template<typename T>
int ffs_generic(T i) {
//Non-portably as... | TOOL | 0.958205 | 5.772494 |
5cb18e49-7f15-432c-9d50-f6805c49a9c9 | suditya/LEETCODE-Practice | xor-queries-of-a-subarray/xor-queries-of-a-subarray.cpp | class Solution {
public:
vector<int> xorQueries(vector<int>& a, vector<vector<int>>& q)
{
int n=a.size();
int pf[n];
pf[0]=a[0];
for(int i=1;i<n;i++)
{
pf[i]=a[i] xor pf[i-1];
}
for(int i=0;i<n;i++)
cout<<pf[i]<<" ";
vector... | ALGO | 0.999988 | 4.855333 |
f7cb13db-e029-4bc4-8fa2-eacc51e05044 | kenwu890831/LeetCode | LeetCode_ 3174. Clear Digits.cpp | class Solution {
public:
string clearDigits(string s) {
string result = "" ;
for ( int i = 0 ; i < s.size() ; i++ ) {
if ( s[i] <= '9' && s[i] >= '0' && !result.empty())
result.pop_back() ;
else {
result.push_back( s[i] ) ;
}
}
r... | ALGO | 0.99765 | 5.710683 |
ed0f455b-7ca9-487b-9036-635fa3e08034 | BaseerAhmedTahir/FarmTrackr | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
977258e2-2d13-4df7-84d2-503939da89e0 | Shahbaz898414/GFG-Leetcode | Bit Manipulation/Pow(x, n).cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
double myPow(double x, long long n) {
if(n==0 || x==1)
return 1;
if(x==0)
return 0;
if(n<0)
return myPow(1/x,abs(n));
return (n%2==0 ? myPow(x*x,n/2) : x*myPow(x*x,n/2));
}
... | ALGO | 0.999729 | 3.619972 |
3202d4bf-4020-49d9-94d9-c10f96ac7003 | juanmed/multicopter_controllers | fast_controller/fast_controller.cpp | #include "fast_controller.h"
FastController::FastController(double mass, double max_thrust, double min_thrust,
const Eigen::Matrix3d & inertia_tensor, const Eigen::Vector3d & Kp,
const Eigen::Vector3d & Kd, const Eigen::Vector3d & Ki, double Kr,
double Ko, double gravity, double cd1, int rotor_count )
{
mass_ = ... | ALGO | 0.999658 | 6.093174 |
9936f723-fa5d-4a2e-8fa9-d9edc120f81d | K-Zuki/Portafolio-Final-AMP0-Ciclo01-2021 | Portafolio U1/18 absoluto.cpp | //Krista Rodriguez - RM100420
#include <iostream>
using namespace std;
int absoluto(int var){
if (var < 0)
var = -var;
return var;
}
double absoluto(double var){
if (var < 0)
var = -var;
return var;
}
int main (){
int num1 = -496;
double numd = -1354.268;
cout << "El valor absoluto de: " << num1 << " e... | TOOL | 0.991976 | 3.97285 |
74910412-812b-4f5f-ab2f-fa520e5377d6 | yi-changha/pratice | CWorkSpace/cppBasic/review-defaultValue.cpp | #include <iostream>
using namespace std;
int inventory[64] = { 0 };
int score = 0;
/*
void getItem(int itemId) {
inventory[itemId]++;
}
void getItem(int itemId, int cnt) {
inventory[itemId] += cnt;
}
*/
// default Ȱ
void getItem(int itemId, int cnt = 1, int sc =0) {
inventory[itemId] += cnt;
score += sc;
}
in... | TOOL | 0.946139 | 3.441658 |
aa4ce41a-2645-4590-9d7b-988459aaec96 | RockMake/ESTRUCTURA-DE-DATOS-I-PR-4A | Corte_1/Semana-4/Notas_y_ejer/ejer2.cpp | // dada una lista simple apuntada por cabecera (Cab) la cual contiene por cada nodo la edad de un estudiante de la universidad, escriba un si (pasa parametro)- no (no devuelve nada)
// que permita imprimir un mensaje para determinar si, se encontro al menos un estudiante menor de edad en la lista o nodo
#include <iostr... | ALGO | 0.995249 | 4.67986 |
2001e046-e3ee-4b53-920b-ebcdf10b0a12 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5085_24.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a,b,c;
cin >> a>>b>>c;
cout <<a+b+c-max(a,b,c)<<endl;
return 0;
} | ALGO | 0.999708 | 3.928715 |
34c9816a-86ac-4a59-8b9d-dcb5d9f091f3 | Pramish-Aryal/Undestined | code/utils.cpp | #include "utils.h"
using namespace types;
r32 Math::Q_rsqrt(r32 number )
{
i32 i;
r32 x2, y;
const r32 threehalfs = 1.5f;
x2 = number * 0.5f;
y = number;
i = *(i32*) &y;
i = 0x5f3759df - ( i >> 1 );
y = *(r32*)&i;
y = y * (threehalfs - (x2 * y * y)); // 1st iteration
// y ... | TOOL | 0.959541 | 4.465823 |
f67dc614-80bf-4e29-b649-24ac2b2b4434 | 4canzz/FAST-NUCES-PF-labs | LAB-3/Problem-3.cpp | //(c) 24L - 6116
#include <iostream>
#include <cstring>
using namespace std;
char * ReverseSentence(char input[]) {
char * rev = new char[strlen(input)-1];
for (int i = 0; i < strlen(input)-1 / 2; i++ ) {
rev[i] = input[strlen(input)-1-i];
}
return rev;
}
int main()
{
char input[100];
... | ALGO | 0.987098 | 4.661973 |
41014d57-80b4-4f2e-a865-4ff3353b8835 | theriyasharm/5th-sem-training-dsa | 32.cpp | #include<iostream>
#include<array>
using namespace std;
int main(){
//int a[]={};
array<int,5> a={3,4,7,2,7};
int count=0;
int found=7;
for (int i=0;i<5;i++)
{
cout<<"Array is: "<<a[i]<<endl;
if (a[i]==found)
count++;
}
cout<<"7 is printed "<<count<<" tim... | ALGO | 0.99529 | 3.585907 |
81a2159f-6b19-4e6b-8244-ae563b6374fb | jastinbeaber/OpenScan3D | libs/openMVG/dependencies/osi_clp/Clp/examples/testGub.cpp | /* $Id: testGub.cpp 1937 2013-04-09 10:32:15Z forrest $ */
#include "ClpSimplex.hpp"
#include "ClpDynamicExampleMatrix.hpp"
#include "ClpPrimalColumnSteepest.hpp"
#include "CoinSort.hpp"
#include "CoinHelperFunctions.hpp"
#include "CoinTime.hpp"
#include "CoinMpsIO.hpp"
int main(int argc, const char *argv[])
{
Cl... | ALGO | 0.96748 | 5.245689 |
4aedc5d4-82f7-4ee8-871e-b22b0544ba16 | ishandutta2007/codeforces | yousef_salama/normal/487/B.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int n, d, l, a[MAXN];
int tree[4 * MAXN];
int findmin(int i, int L, int R, int p, int q){
if(q < L || R < p)return 1 << 20;
if(p <= L && R <= q)return tree[i];
int mid = (L + R) / 2;
return min(findmin(2 * i, L, mid, p, q), findmin(2 * i + 1... | ALGO | 0.999977 | 3.909663 |
5a946d00-edd8-4b03-b7a4-077bbcda6f12 | CPS-Academy/cpc-contest-solutions | Module-02/Vjudge/01.Vector/16.Sereja And Dima.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector < int > a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int i = 0, j = n - 1;
int player1 = 0, player2 = 0, t = 1;
while (i <= j) {
if (t % 2 == 1) {
if (a[i] > a[j]) {
... | ALGO | 0.999992 | 4.013512 |
fe5ae2fe-bc5d-43be-82a8-d23954c5bc58 | hal-uw/gpu_variability_sc22_artifact | sec5c_lammps/src/compute_temp_profile.cpp | #include <mpi.h>
#include <stdlib.h>
#include <string.h>
#include "compute_temp_profile.h"
#include "atom.h"
#include "update.h"
#include "force.h"
#include "group.h"
#include "fix.h"
#include "domain.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
enum{TENSOR,BIN};
/* --------------------------... | ALGO | 0.983697 | 6.002099 |
937a1924-4ad8-44cc-8b78-837da26b69e3 | ketan-suthar/DataStructure | C++/Array/Two numbers with sum closest to zero/Method01.cpp | class Solution
{
public:
int closestToZero(int arr[], int n)
{
sort(arr, arr+n);
int curr_sum, closest_sum = INT_MAX, l_index=0, r_index=n-1,
min_l_index=l_index, min_r_index=r_index;
while(l_index < r_index)
{
curr_sum ... | ALGO | 0.999995 | 5.702006 |
429846c4-062d-406b-9a07-be8c01720101 | niranjan-ithape/C-and-DSA | recursion09.cpp | #include<iostream>
using namespace std;
int fib(int n) {
// Base case
if(n == 1) {
return 0; // First term
}
if(n == 2) {
return 1; // Second term
}
// Recursive call
return fib(n - 1) + fib(n - 2);
}
int main() {
int n;
cout << "Enter the term number: ";
cin ... | ALGO | 0.999908 | 5.900681 |
92ea6595-9134-460d-a30c-0d3283f06a09 | sckdtv89/cplus | Code/PRIME_1.cpp | #include<iostream>
#include<cmath>
using namespace std;
void Prime(long long n){
int i = 2;
while(i <= sqrt(n)){
while(n % i == 0){
cout << i << " ";
n = n/i;
}
i++;
}
if(n != 1){
cout << n;
}
cout << endl;
}
int main(){
int t;
cin >> t;
while(t > 0){
long long n;
cin >> n;
Prime(n);
t-... | ALGO | 0.999662 | 4.735315 |
b3a09619-b8be-4be9-8498-b7f23ca03846 | WilliamMarioAlan/Algorithms | LC/543.diameterOfBinaryTree.cpp | 1.不一定要经过root 比如
5
/
4
/ \
1 3
/ \
7 9
最长直径为 [7->1->4->3->6] 为 4
2.直径为边的数量 比如
5
/ \
4 3
/ \ \
7 3 8 ... | ALGO | 0.999983 | 5.27588 |
5b4ae130-3ed6-4516-8877-7f4cb3a15db2 | Dhruvvachheta1304/music_demo | 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.998762 | 6.786404 |
5e985859-bc60-4c0a-81d8-5d39855a531b | sarvex/leetcode-go | solution/0100-0199/0129.Sum Root to Leaf Numbers/Solution.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.99998 | 6.819532 |
6490fb39-9433-4cf5-8924-320c11d5f1a5 | xTayEx/xtayex-CompetitivePrograming | HDU/HDU3551.cpp | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define mst(a, b) memset((a), (b), sizeof(a))
#define idebug(x) printf("%s = %d\n"... | ALGO | 0.999828 | 4.493964 |
30d14448-83e3-40e5-b2b8-5f15e6e77055 | JeffWR/Cplusplus_AlgorithmStudy | Recursion_Algorithm/P1028_Number calculation.cpp | #include <iostream>
#include <cmath>
using namespace std;
int n;
int a[1005];
int main(){
cin>>n;
for(int i = 1 ; i <= n ; i ++){
for(int j = 1 ; j <= i/2 ; j ++){
a[i]+=a[j];
}
a[i]++;
}
cout << a[n];
return 0;
}
| ALGO | 0.999948 | 3.164096 |
82cf6e26-1759-4a9f-a819-76273f408ee9 | giapdong/cplusplus-macos | chapter4-recuisive/lietkehoanvi.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int x[100];
bool visited[100];
bool check(int v, int k) {
return !visited[v];
}
void solution() {
for(int v = 1; v <= n; v++) cout << x[v];
cout << endl;
}
void Try(int k) {
for(int v = 1; v <= n; v++) {
if(check(v, k)) {
x[v] ... | ALGO | 0.999897 | 3.612712 |
19302b33-dce6-460c-bc5d-4915a0760511 | lukastojiljkovic/Algorithms-and-Data-Structures | Petlja zadaci/Slozenost izracunavanja/Zbirovi prefiksa i razlike susednih elemenata niza/maksimalni_zbir_segmenta.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <unordered_map>
#include <vector>
using namespace std;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
int n;
cin >> n;
int zbir... | ALGO | 0.99978 | 3.983291 |
36b029a4-11c6-41d8-b9a3-54732d55cb94 | ishandutta2007/codeforces | purplecrayon/normal/1150/A.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;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define sz(v) (int)v.size()
#define ar array
// #define f fi... | ALGO | 0.999949 | 4.226961 |
01883f6d-fe4a-447e-99bd-db2a753ef70b | WWWalenok/WGoDot | thirdparty/icu4c/common/localeprioritylist.cpp | // localeprioritylist.cpp
// created: 2019jul11 Markus W. Scherer
#include "unicode/utypes.h"
#include "unicode/localpointer.h"
#include "unicode/locid.h"
#include "unicode/stringpiece.h"
#include "unicode/uobject.h"
#include "charstr.h"
#include "cmemory.h"
#include "localeprioritylist.h"
#include "uarrsort.h"
#inclu... | TOOL | 0.996696 | 7.002951 |
a5ebe0a7-d558-42d2-ae52-c7228cd1da9e | Gagneja1512/Cpp-problems | Contests/Codechef/Starters 49/monks.cpp | #include "bits/stdc++.h"
using namespace std;
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define mod 1e9 + 7
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++)
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++)
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--)
typedef lon... | ALGO | 0.999963 | 4.201812 |
19f99a41-7469-47d0-aa9b-ac4c3ccba80e | ishandutta2007/codeforces | alexandr_ts/normal/486/B.cpp | #include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr(i, n) for (ll i = 0; i < n; i++)
#define frab(i, a, b) for (ll i = a; i < b; i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pr;
const int N = 4e5;
const ll INF = 2e9 + 1;
const int ST = 110;
... | ALGO | 0.999857 | 3.352295 |
e1d40f0a-b83d-4a7a-81f8-b153fc795fde | GustavoMacedoSilva/my-codes-gust | P(1,2)/bee 8.cpp | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
//var
float x1, y1, x2, y2;
//entrada
cin >> x1 >> y1;
cin >> x2 >> y2;
//saida
cout << fixed << setprecision(4) << sqrt(pow(x1-x2, 2) + pow(y2-y1, 2)) << endl;
return 0;
} | ALGO | 0.99856 | 3.999574 |
9986f903-1d66-4301-b118-712066fe8ed4 | Sanchitraina1999/notPrivate | ADSL/Program_3/TBT.cpp | // * @Description: Create inorder threaded binary tree and perform inorder, preorder traversal.
#include <iostream>
using namespace std;
class node
{
int data;
bool leftThread, rightThread;
node *left, *right;
public:
node()
{
data = 0;
leftThread = rightThread = false; //false i... | ALGO | 0.999935 | 5.554962 |
905271fb-8ffa-4d6c-862d-37f1df742ce0 | kew7/Cpp-in-One-Hour-a-Day-by-Siddhartha-RaoCpp-in-One-Hour-a-Day-by-Siddhartha-Rao | 7.9 Functions_PassingReference.cpp | #include <iostream>
using namespace std;
const double Pi = 3.1416;
// output parameter result by reference
void Area(double radius, double& result)
{
result = Pi * radius * radius;
}
int main()
{
cout << "Enter radius: ";
double radius = 0;
cin >> radius;
double areaFetched = 0;
Area(radius, are... | ALGO | 0.987973 | 5.0932 |
bf24ff7c-168d-47a2-8448-f01bee43e6ef | m-sumaim/Leetcode | 1231-replace-elements-with-greatest-element-on-right-side/1231-replace-elements-with-greatest-element-on-right-side.cpp | class Solution {
public:
vector<int> replaceElements(vector<int>& arr) {
int n = arr.size();
int mx = arr[n-1];
arr[n-1] = -1;
for(int i=n-2; i>=0; i--){
int nmax = arr[i];
arr[i] = mx;
if(nmax > mx)
mx = nmax;
}
... | ALGO | 0.999976 | 5.543017 |
57b304ab-9d42-45d2-bca3-ce956009a721 | grovesben/GD1P02Summ | QuickSort/main.cpp | #include "QuickSortManager.h"
#include <conio.h>
#include <stdlib.h>
int main()
{
CQuickSortManager QuickSortManager;
QuickSortManager.Run();
std::cout << "\nPress any key to exit.\n"; // soft exit
char cTemp;
cTemp = _getch();
return cTemp;
} | ALGO | 0.956736 | 3.315934 |
feb2dec8-4990-49aa-87c1-9b5642b71059 | ngoquang203/Code_plusplus | Buoi_2_14.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
long long sum = 0;
for(int i = 1;i<=n;++i){
sum+= i*i*i;
}
cout<<sum;
} | ALGO | 0.999513 | 4.023168 |
8e8ae091-dfd8-4674-a2bd-5fcb84de419f | oo1463/Problemsolving | BOJ/21-02/10709.cpp | // https://www.acmicpc.net/problem/10709
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#define el '\n'
#define FAIO ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
using namespace std;
int main() {
FAIO;
int h, w;
int map[101][101];
... | ALGO | 0.999945 | 3.789804 |
634529e0-021e-41cf-9fa4-571e0efa1ed6 | ishandutta2007/codeforces | andreikkaa/normal/1603/B.cpp | /*
* C++11 code template for contests.
* @author: Andrei Kalendarov
* @e-mail: <EMAIL>
*/
//#define ANDREIKKAA_ALLOCATOR
const int _ML = 228;
const char _inpf[] =
#if defined(ANDREIKKAA)
"input.txt"
#else
""
#endif
;
const char _outf[] =
#if defined(ANDREIKKAA)
""
#else
""
#endif
;
#if defined(ANDREI... | ALGO | 0.999956 | 4.511643 |
2a6f2029-a97e-4e6d-bfb1-b3b955263151 | Rashadul-hub/Employee_Management_System | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
14d99831-fbde-4bc4-b383-b6bb82c14610 | karayuumac/procon-archive | atcoder.jp/abc341/abc341_b/Main.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef int dint;
#define int ll
dint main() {
int n;
cin >> n;
vector<int> a(n);
vector<pair<int, int>> st;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n - 1; i... | ALGO | 0.999951 | 3.612143 |
3372c4ae-6d77-4ab8-bceb-2db18879593f | SieuDoge/luyencode.net | DK06.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
// Code Here //
double a, b;
cin >> a >> b;
if (a == 0)
{
if (b == 0)
{
cout << "WOW";
}
else
{
cout << "NO";
}
}
else
{
double x = -b / a;
... | ALGO | 0.999189 | 4.246722 |
2f04e526-cd8d-40d4-b1eb-c81a3310ad96 | manjeetdeveloper/Leetcode-DSA-150-Days-Challenge | DSA 150 Days Challenges In 150 Days Problem Solving/14. Longest Common Prefix.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
if(strs.empty()) return "";
sort(strs.begin(), strs.end());
string a = strs[0], b = strs.back();
int i = 0;
while(i < min(a.size(), b.size()) && a[i] == b[i]) i++;
return a.substr(0, i);
}... | ALGO | 0.99986 | 5.808713 |
f3dea802-63ed-40d2-9d19-5923d75ff4d3 | achrafoo2018/codeforces | rangeMinDynamic.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
#define yes cout << "YES" << endl;
#define no ... | ALGO | 0.999948 | 4.361427 |
cbc2dc89-5b40-4a2f-aaa9-f406b97f8641 | harshit-jain52/CP_DSA | CSES/1640.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main()
{
int n, x;
cin >> n >> x;
map<int, vector<int>> m;
for (int i = 0; i < n; i++)
{
int tmp;
cin >> tmp;
m[tmp].push_back(i+1);
}
bool possible = false;
for (auto it : m)
{
if ... | ALGO | 0.999956 | 4.2523 |
6f06e2b0-0ad3-4f22-864a-792246dd74df | sur4jsharma/CP | Tree/extreamNode.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
};
Node *createNode(int data)
{
Node *newNode = new Node();
newNode->data = data;
newNode->left=NULL;
newNode->right=NULL;
return newNode;
}
vector<string> getData(string str)
{
vector<st... | ALGO | 0.999948 | 4.111928 |
323a8975-081d-4831-b4d3-02b4b1b392b6 | Bristisul123/Problems | week13/Day-2/h.cpp | #include <bits/stdc++.h>
#define int long long
#define all(x) x.begin(), x.end()
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"
#define nl "\n"
#define lower(x) transform(x.begin(), x.end(), x.begin(), ::tolower)
#define upper(x) transform(x.begin(), x.end(), x.begin(), ::toupper)
typedef unsigned long long ... | ALGO | 0.999997 | 4.266152 |
9b210c06-ebc6-454a-a723-51b0099646af | seongwon980/cpp.algorithms | Algorithms/1085.cpp | #include <iostream>
using namespace std;
int getMin(int a, int b, int c, int d) {
// Return the minimum integer
int temp1;
int temp2;
temp1 = (a > b) ? b : a;
temp2 = (c > d) ? d : c;
return (temp1 > temp2) ? temp2 : temp1;
}
int main(void) {
int x, y, w, h;
int result;
cin >> x ... | ALGO | 0.998506 | 3.430959 |
5585e537-ccb5-4ee1-9797-a2b56758d116 | Sigmaaaa08/Sla | ex1.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
float nt, as, ex, media;
cout << "Digite a nota do trabalho de laboratorio: ";
cin >> nt;
cout << "Digite a nota da avaliao semestral : ";
cin >> as;
cout << "Digite a nota do exame final: ";
cin >> ex;
media=(nt+as+ex)/2+3+5;
if (m... | ALGO | 0.92411 | 3.673606 |
8f045747-56d7-4917-9fec-6054283626cf | ahmedfarouk22222/WeatherAPP | 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.998809 | 6.763549 |
7c22213a-99a6-425a-988c-a9d1b253fb30 | Tamimkhan7/CP-Course | Phase 2/class four/Adjacent Matrix/Adjacent matrix implementation.cpp | #include <bits/stdc++.h>
using namespace std;
#define MTK \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define mem(a, b) memset(a, b, sizeof(a))
#define show(x) cout << #x << ' ' << x << endl
#define all(x) (x).begin(), (x).end()
#define ll int long lo... | ALGO | 0.999919 | 3.931696 |
6e086efa-da0e-4a64-aa42-bbe559b7fc11 | shintanur/minggu3_pretes2 | 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.998687 | 6.797341 |
8a138f3a-c327-4238-8f9d-168328ede269 | repos-cl/NumCSE | Assignments/PolishedCodes/IterativeMethods/QRIteration/template/main.cpp | #include <Eigen/Dense>
#include <algorithm>
#include <iostream>
#include <vector>
#include "qriteration.hpp"
int main() {
{
std::cout << "Givens rotation for [3,4]" << std::endl;
Eigen::Vector2d a(3.0, 4.0);
Eigen::Vector2d g = givens(a);
Eigen::Matrix2d G(2, 2);
G << g[0], -g[1], g[1], g[0];
... | ALGO | 0.994193 | 5.9129 |
302a461f-2a4a-4d06-addf-6b70790e90c9 | IntNull93/51_55 | C++_Primer/6_chapter/check_vec.cpp | /*
* =============================================================================
*
* Filename: check_vec.cpp
*
* Description: check one vector is another's former part or not
*
* Created on: 20151110
*
* Created by: root
*
* ============================================================... | ALGO | 0.9923 | 4.710399 |
764839bc-02c8-447c-97a1-8255d2b6926c | AG1713/CPP---Resource-edition | 11_STL/01_Containers/01_Sequence_Containers/02_Deque.cpp | # include<iostream>
# include<deque>
using namespace std;
// In this type, we can add and delete from both ends (front and rear)
int main(){
deque<int> d;
d.push_back(3);
d.push_back(4);
d.push_front(1);
for (int i: d){ // Idk how this works
cout<<i<<" ";
}
cout<<endl;
d.pop_... | TOOL | 0.85189 | 4.489507 |
9ee8e306-d227-4a44-8a58-b60ad9516751 | pratham174/dsa | reversestring.cpp | #include <iostream>
using namespace std;
#include <stack>
int main()
{
stack<string> st;
string str = "reverse this string";
str += " ";
string tempstr = "";
for (int i = 0; i < str.length(); i++)
{
if (str[i] == ' ')
{
st.push(tempstr);
tempstr = "";
... | ALGO | 0.999534 | 4.13158 |
55e73c0d-fc2e-4cf3-8205-22e1da5885aa | anmolsinghgit/LeetCode-Online-Judge | Algorithms/nth-digit.cpp | // 400. Nth Digit
// https://leetcode.com/problems/nth-digit/
#include <iostream>
#include <cmath>
using namespace std;
class Solution {
public:
int findNthDigit(size_t n) {
if (n < 10) return n;
size_t i = 1;
for (i = 1; n >= 9 * i * size_t(pow(10, i - 1)); ++i) n -= 9 * i * size_t(pow(10, i - 1));
size_t x =... | ALGO | 0.999613 | 6.350807 |
a51c6c55-cc8e-44a0-80b7-d18c5956bab1 | emilymryan/LAMMPS-SPH-Source-Code | src/pair_sph_lj.cpp | #include "pair_sph_lj.h"
#include <cmath>
#include "atom.h"
#include "force.h"
#include "neigh_list.h"
#include "memory.h"
#include "error.h"
#include "domain.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairSPHLJ::PairSPHLJ(LAMMPS *lmp) : Pair(lmp)
{
r... | ALGO | 0.998546 | 5.371852 |
7f95bb75-81f0-4848-b799-c7acd81d0302 | amrezalou/Cpp_Practices | chapter-1/main1.cpp | #include <iostream>
using namespace std;
int main () {
// getting two numbers as an inputs
int number1, number2;
cout << "enter the first number >>> ";
cin >> number1;
cout << "enter the second number >>> ";
cin >> number2;
// computing phase:
cout << number1 << " + " << number2 <<... | ALGO | 0.945814 | 3.392853 |
ff3eb4e9-10f2-4d41-bb07-c9d4fbeef653 | autocore-ai/AutowareAuto | src/planning/lane_planner/src/lane_planner.cpp | #include "lane_planner/lane_planner.hpp"
#include <lanelet2_traffic_rules/TrafficRules.h>
#include <lanelet2_traffic_rules/TrafficRulesFactory.h>
#include <lanelet2_core/geometry/Lanelet.h>
#include <lanelet2_core/geometry/LineString.h>
#include <had_map_utils/had_map_utils.hpp>
#include <geometry/common_2d.hpp>
#inclu... | TOOL | 0.998221 | 5.578121 |
ab2b34a0-2fa8-49ee-ae54-31ad68cf2570 | ayushgoel-01/DSA | 768-partition-labels/partition-labels.cpp | class Solution {
public:
vector<int> partitionLabels(string s) {
int n = s.size();
unordered_map<char,int> mp;
for(int i=0; i<n; i++){
mp[s[i]] = i;
}
vector<int> ans;
int last = 0, pi = 0;
for(int i=0; i<n; i++){
last = max(last,mp[s... | ALGO | 0.999445 | 6.360629 |
df5deee3-1589-44df-a1de-26f9da7e1b7b | aniketisin/SPOJ | ANARC09A.cpp | #include<bits/stdc++.h>
using namespace std;
/*-----Fast I/O-----*/
inline void inp( int &n ){n=0;int ch=getchar();int sign=1;while( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getchar();}while( ch >= '0' && ch <= '9' )n = (n<<3)+(n<<1) + ch-'0', ch=getchar();n=n*sign;}
/*-----End of Fast I/O-----*/
typedef vector<... | ALGO | 0.988487 | 3.478139 |
f0f11126-9dd6-4629-b7c1-188222596b9f | SURYAPRAKASHKALYANAM/LEETCODE-GFG-SOLVED-SOLUTIONS | 0153-find-minimum-in-rotated-sorted-array/0153-find-minimum-in-rotated-sorted-array.cpp | class Solution {
public:
int findMin(vector<int>& nums) {
int len = nums.size();
int start = 0 ,end = len-1,mid;
int minEle = 1e4;
while(start<=end){
mid = start + (end-start)/2;
if(nums[mid]<=nums[end]){
minEle = min(minEle,nums[mid]);
... | ALGO | 0.999964 | 5.858799 |
84ff24c5-50a5-45c3-8407-bafd64570e09 | Dinakarluffy/ASTA-DSA-StriverCode | Algorithms_Striver/Array_Techniques/Hard/ex.cpp | #include <bits/stdc++.h>
using namespace std;
// Swap elements in arr1 and arr2 if arr1[ind1] > arr2[ind2]
void swapIfGreater(vector<int>& arr1, vector<int>& arr2, int ind1, int ind2)
{
if (arr1[ind1] > arr2[ind2])
{
swap(arr1[ind1], arr2[ind2]);
}
}
void merge(vector<int>& arr1, vector<int>& arr2... | ALGO | 0.999998 | 5.292535 |
dc39330a-c49f-4eaf-81b2-b45a92f3ee13 | snai2019/greenhouse_forecast | fastapiserver/Lib/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/libs/spirit/example/qi/sum.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A parser for summing a comma-separated list of numbers using phoenix.
//
// [ JDG June 28, 2002 ] spirit1
// [ JDG March 24, 2007 ] spirit2
//
///////////////////////////////////////////////////////////////////////////////
#inc... | TOOL | 0.896012 | 6.890997 |
d980a519-c53e-477c-a97c-3a694d45fe50 | mearth99/Problem | SWEA/D4/8382. 방향 전환/방향 전환.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <string>
using namespace std;
struct moves{
int x, y, cnt, dir;
};
vector<int> outputs;
bool visited[201][201][2];
int dx[4] = {-1,1,0,0};
int dy[4] = {0,0,-1,1};
int BFS(int x1, int y1, int x... | ALGO | 0.999496 | 4.145666 |
3c34bcf7-1b41-48c8-ac2e-fbcf73a9165f | DUSERNAM3/shit-programming | STRUCT5/STRUCT5/Source.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <conio.h>
#define clear system("cls")
int swap;
void printArray(int array[], int size) {
for (int i = 0; i < size; i++) {
printf("%d ", array[i]);
}
printf("\n");
}
void sortByIns(int array[],... | ALGO | 0.999813 | 3.732084 |
46618000-d287-4007-9afb-bd731efb7f3e | sony-string/beakjoon | Beakjoon/30471-hovanwoo.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long li;
typedef vector<int> vi;
class union_find {
private:
vi r;
vi p;
vi gsize;
int merge_cnt;
int size;
public:
union_find(int n) : size(n), merge_cnt(0) {
r.assign(n + 1, 0);
p.assign(n + 1, 0);
for (int i = 0; i <= n; i++) {
p[i] = i;
}... | ALGO | 0.999968 | 4.496748 |
f196b167-29aa-4d1d-94a4-db2961b675c5 | ValentinNM/cpp-learn | pbinfo/387.cpp | // Se citește un număr natural n. Să se determine suma divizorilor impari ai săi.
// 30 => 24
#include <iostream>
using namespace std;
int main() {
int n, i;
cin >> n;
long long s = 0; // data type for when the sum is past long
for (i = 1; i * i < n; i++) { // enter loop to check up to n
... | ALGO | 0.999913 | 5.227728 |
4d120536-4bbe-416e-b1d2-91d757f9d3fb | moqsad/solved-problems | LightOJ/1116 - Ekka Dokka(LOJ).cpp | #include <cstdio>
#include <cstring>
using namespace std;
int main()
{
long long t, cnt, n, ans;
scanf("%lld", &t);
for(cnt = 1; cnt <= t; ++cnt)
{
scanf("%lld", &n);
ans = 1;
while(n % 2 == 0)
{
ans *= 2;
n /= 2;
}
if(n != 1 && an... | ALGO | 0.999518 | 3.578158 |
0c0ed8c5-9d06-4549-b89c-f9ef53ba7904 | himanshu-901/Love-Babbar-Dsa- | temperature_convert.cpp | // convert fahrenhiet to celcius
/*
// c = (f-32)*5/9
#include<iostream>
using namespace std;
int main(){
int f,c;
cin>>f;
c = (f-32)*5/9;
cout<<"celcius is "<<c;
}
*/
// convert celcius to fehrenheit
// f = (c*9/5) + 32
/*
#include<iostream>
using namespace std;
int main(){
int f,c;
cin>>c;
f = (c*9/5)+32;
... | ALGO | 0.992595 | 3.196838 |
804480c1-037a-4d84-b85c-6c2a06d75455 | NMRanaHamid/Problem_Solving | Personal/C_No_Prime_Differences.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
ll mod = 1e9+7;
#define n... | ALGO | 0.999576 | 3.133856 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.