uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
88d99a9f-fd82-4389-9806-59a786215742 | milonsarker/dsa | LeetCode/Array/CPP/1929.cpp | //https://leetcode.com/problems/concatenation-of-array/description/
class Solution {
public:
vector<int> getConcatenation(vector<int>& nums)
{
vector <int> ans;
int n = nums.size();
for (int i = 0; i < n; i++)
{
nums.push_back(nums[i]);
}
return nums;... | ALGO | 0.99905 | 5.422918 |
c8db4d49-be44-4d42-81b2-9ae7408163e0 | jasha64/jasha64 | 2015/NOIP&NOI/NOIP2011puji/reverse.cpp | #include <fstream>
using namespace std;
ifstream cin("reverse.in");
ofstream cout("reverse.out");
int main()
{
int c;
cin >> c;
if (c == 0)
{
cout << '0' << endl;
return 0;
}
if (c < 0)
{
cout << '-';
c = -c;
}
while (c % 10 == 0) c /= 10;
do {
cout << c % 10;
c /= 10;
} while (c > 0);
cout ... | ALGO | 0.999977 | 4.209991 |
aa6882ae-72d6-46cb-8a13-caa920c5003a | abhishekrsingh/GFGProblems | Difficulty: Medium/Maximize the minimum difference between k elements/maximize-the-minimum-difference-between-k-elements.cpp | class Solution {
public:
// checks if it's possible to pick k elements
// with at least 'mid' difference
bool isPossible(vector<int>& arr, int k, int mid){
int count = 1;
int last = arr[0];
for (int i = 1; i < arr.size(); i++) {
if (arr[i] - last >= mid) {
... | ALGO | 0.99996 | 5.332327 |
e31240c9-f241-41a0-a8e7-7d102bb8d956 | eldeshue/PS | BOJ/unclassified/2342_failed.cpp | // greedy, failed
#include <iostream>
int curL = 0, curR = 0, curCost = 0;
void minMov(int nextNum)
{
if (curL == nextNum || curR == nextNum)
{
curCost++;
}
else if (curL == 0)
{
curL = nextNum;
curCost += 2;
}
else if (curR == 0)
{
curR = nextNum;
curCost += 2;
}
else if (std::abs(nextNum - curL)... | ALGO | 0.999859 | 3.704959 |
e02f8d0e-abb3-486f-8a08-2d42aae687d9 | priyanshu070702/leetcode | Check if Tree is Isomorphic - GFG/check-if-tree-is-isomorphic.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
Node* buildTree(string str)
{
// Corner Case
if(str.length() == 0 || str[0] == 'N')
retur... | ALGO | 0.999798 | 6.968157 |
a036829c-af2a-4492-9b79-93714d1dd23a | TzashiNorpu/Algorithm | Clion/ZeroTrac/1500_1600/maximumEvenSplit_2178.cpp | //
// Created by TzashiNorpu on 7/12/2022.
//
#include "../header/1500_1600.h"
using namespace ZeroTrac;
vector<long long> maximumEvenSplit_2178::maximumEvenSplit(long long finalSum) {
if (finalSum & 1) return {};
vector<long long> res;
long long sum = 0;
for (long long i = 2; i <= finalSum; i += 2) {
if ... | ALGO | 0.994148 | 4.904226 |
747423df-35fa-4993-83ea-ea5c115e7680 | rgsk/cpp-dsa-endgame | src/CSES/2. Sorting and Searching/17. Josephus Problem II/alternate.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;
// Alias for the PBDS tree
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
int main() {
int N, K;
cin >... | ALGO | 0.999963 | 4.813852 |
4f734b85-098a-43df-adcf-80b579b18437 | shuchitgandhi/Numerical-Computational-Codes | Lab 2/q1.cpp | #include <iostream>
#include <cmath>
#define MAXN 1000
using namespace std;
double f(double);
double fd(double);
double newton_method(double (*f)(double), double (*fd)(double), double, double);
int main(int argc, char const *argv[])
{
double ans = newton_method(f, fd, 1.5, 0.00001);
cout<<"Depth of the tank must... | ALGO | 0.999654 | 4.087996 |
bcb3201d-c440-4a9e-880c-b29e7c285617 | ChandlerNgo/CP | ACPC SPRING 2025 Week 2/A.cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a;int b;
cin >> a >> b;
cout << (a + b) * (a+b) <<endl;
} | ALGO | 0.993475 | 4.273385 |
94692683-b8b4-49d5-8555-a773b4253d35 | Arkesh009/Striver-SDE-DSA-Sheet | AdditionalBasics/Reccursion/reverseArrReccursion.cpp | // Reverse an array using Recursion
#include <bits/stdc++.h>
using namespace std;
// Function declaration: reverses the array from index i to j recursively
void revArr(int[], int, int);
int main()
{
int n;
cout << "Enter the size of the array\n";
cin >> n; // Input the size of the array
int arr[n];
... | ALGO | 0.999926 | 6.194313 |
38102283-03ef-4702-bbd5-42af24997e0e | vidalmatheus/codes | Study/CoinChangeDP.cpp | #include <bits/stdc++.h>
using namespace std;
/// Dynamic Program Coin Change Algorithm
int DPMakeChange(const std::vector<unsigned int> &denom,unsigned int value, std::vector<unsigned int> &coins, std::vector<unsigned int> &last) {
// moedas: vetor de moedas disponíveis (menor é de 1 centavo)
std::vector<unsigned ... | ALGO | 0.999961 | 4.638509 |
35afc1c8-288e-45d3-91df-92e5c8f67bd3 | swarupSikder/phitron_v2 | cpp_basic/min_in_array_object.cpp | //author: Swarup Sikder
//judge: ...
//problem: ...
#include <bits/stdc++.h>
using namespace std;
class Student{
public:
string name;
int roll;
int marks;
};
int main(){
int n;
cin>> n;
Student student[n];
for(int i=0; i<n ;i++){
cin>> student[i].name >> student[i].roll ... | ALGO | 0.998963 | 3.952156 |
6c5fec21-ce9f-4d4e-bc8c-6800eb0d872a | xiangzhaoDE/ORB_SLAM2_comment | Thirdparty/g2o/g2o/core/hyper_dijkstra.cpp | #include <queue>
#include <deque>
#include <vector>
#include <assert.h>
#include <iostream>
#include "hyper_dijkstra.h"
#include "../stuff/macros.h"
namespace g2o{
using namespace std;
double HyperDijkstra::TreeAction::perform(HyperGraph::Vertex* v, HyperGraph::Vertex* vParent, HyperGraph::Edge* e){
(void) v... | ALGO | 0.999782 | 4.596799 |
f3c201ea-c776-44c6-be4c-3fb02d935ae7 | shatanshu123/Shatanshu_CSIT_5thWeek | 215-kth-largest-element-in-an-array/215-kth-largest-element-in-an-array.cpp | //STRIVER_SDE_SHEET
class Solution {
public:
int findKthLargest(vector<int>& a, int k) {
/* priority_queue<int,vector<int>,greater<int>> pq;
for(int i=0; i<k; i++){
pq.push(a[i]);
}
for(int i=k; i<a.size(); i++){
if(a[i]>pq.top()){
pq.pop();
... | ALGO | 0.999941 | 4.986629 |
26e4eb8c-a36f-4d18-aa73-edc3895e86d6 | rmottola/Arctic-Fox | accessible/windows/msaa/nsWinUtils.cpp | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=2:
*/
#include "nsWinUtils.h"
#include "Compatibility.h"
#include "DocAccessible.h"
#include "nsAccessibilityService.h"
#include "nsCoreUtils.h"
#include "mozilla/Preferences.h"
#include "nsArrayUti... | TOOL | 0.859376 | 5.01459 |
caf6fac1-cb65-49f5-ae20-0fe17d3d04de | Beckhauser1/eda2 | bm_matcher.cpp | #include <iostream>
#include <string.h>
using namespace std;
#define ASIZE 256
void badC(const char *p, int badCShift[])
{
int i, m;
m = strlen(p);
for (i = 0; i < ASIZE; i++)
badCShift[i] = m;
for (i = 0; i < m - 1; i++)
badCShift[(int)p[i]] = m - i - 1;
}
int bmMatcher(const char ... | ALGO | 0.999651 | 4.241476 |
cf674df8-457e-4dc5-a5c5-a6b50990a5bf | ishandutta2007/codeforces | cyand1317/normal/617/B.cpp | #include <cstdio>
static const int MAXN = 104;
int n, ai, consec = 0; bool unlocked = false;
long long ans = 1;
int main()
{
scanf("%d", &n);
for (int i = 0; i < n; ++i) {
scanf("%d", &ai);
if (ai == 0) ++consec;
else {
if (unlocked) ans *= (consec + 1);
consec ... | ALGO | 0.999992 | 4.05161 |
ec542f48-c618-46ed-bdb9-036168c29099 | harshleet/leetsolution | 753-open-the-lock/open-the-lock.cpp | class Solution {
public:
int openLock(vector<string>& deadends, string target) {
set<string>de(deadends.begin(),deadends.end());
map<string,int>vis;
vector<char>cha={'0','1','2','3','4','5','6','7','8','9'};
queue<pair<string,int>>q;
if(de.find("0000")!=de.end() ){
... | ALGO | 0.999944 | 6.317999 |
87c86b9b-aadf-49bd-99fe-4ec0879b3f92 | kim7881/ninepatch_image | example/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.998771 | 6.797273 |
1ee91a21-f8fa-45a1-96d8-d38009de111b | ufolux/LeetCodeSolutions | Cpp/Solutions/DP/L140_WordBreakII.cpp | //
// Created by Sines on 2021/2/3.
//
#include "PublicHeaders.h"
#include "../BaseSolution.h"
namespace DP {
namespace L140_WordBreakII {
using namespace std;
class Solution: BaseSolution {
private:
unordered_set<string> wordSet;
vector<string> tmp;
int ... | ALGO | 0.999874 | 5.780692 |
3e51be24-6e4f-4498-9f3e-c0466d41528b | ShubhKharwar/CodeClash-R3 | problem5codeclash.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define nline "\n"
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ff first
#define ss second
#define PI ... | ALGO | 0.999896 | 3.76106 |
a19e52e5-e2df-49e0-9b69-8b629829b50b | Scotts-T0ts/GFG-interview-prep-Flow-Control-Function-Loops- | Matrix_star_printing.cpp | #include<iostream>
using namespace std; //N x N stars printing
int
main ()
{
int n,x;
cout << "Enter the number of rows\n";
cin >> n;
cout<<"Enter the number of columns\n";
cin>>x;
for (int i = 1; i <= x; i++)
{
for (int j = 1; j <= n; j++)
{
cout << "*";
}
cout << "\n";
}
... | ALGO | 0.98098 | 3.501993 |
92eb3575-6a3a-4512-975a-05cfe4d55c49 | Abdo-Islam/DataStructure_Assingment2- | problem1.cpp | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
class node{
public:
string URL;
node* next;
node(){
this->URL = "";
this->next = NULL;
}
node(string url){
this->URL = url;
this->next = NULL;
}
};
class LinkedStack{
node* top;
... | ALGO | 0.987248 | 4.590334 |
8fd753a6-db4a-417e-a8d4-845fdfaf2d0e | MASJV/LeetCode-DSA | 225(1).cpp | class MyStack {
queue<int> primary;
queue<int> auxillary;
public:
MyStack() {
}
void push(int x) {
if(primary.empty()){
primary.push(x);
}
auxillary.push(x);
while(!primary.empty()){
auxillary.push(primary.front());
... | ALGO | 0.976758 | 5.357875 |
bb87cdf3-6cf3-4c10-8d05-066dd0a3fb75 | krishnenduduttadc/DSA_Master_cpp | DPL1/ZeroOneKnapsack.cpp | #include <iostream>
#include <vector>
using namespace std;
int knapsack(int n, vector<int> &vals, vector<int> &wts, int cap)
{
vector<vector<int>> dp(n + 1, vector<int>(cap + 1, 0));
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= cap; j++)
{
if (j >= wts[i - 1])
... | ALGO | 0.999967 | 5.807887 |
d58ce2be-dc1e-4d55-90ba-dbac2600b776 | vnhmhl/Teor_Algoritm_i_Str_Dan | Lab_№8/Bin_derevo.cpp | #include <iostream>
using namespace std;
struct NameDataTree {
char* data;
NameDataTree* left, * right;
};
struct Tree {
NameDataTree* treetop = NULL;
void AddData(struct NameDataTree** root, char* d) {
if ((!root) && (treetop)) {
root = &treetop;
}
struct NameDataTree* _root = NULL;
if (root) {
... | ALGO | 0.997946 | 3.79795 |
f606f542-287c-4a61-a7b6-31cc65a70906 | brightlaboratory/llvm-project | libcxx/src/hash.cpp | #include "__hash_table"
#include "algorithm"
#include "stdexcept"
#include "type_traits"
#ifdef __clang__
#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare"
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
namespace {
// handle all next_prime(i) for i in [1, 210), special case 0
const unsigned small_... | ALGO | 0.999633 | 6.766524 |
5c5318c7-fdd3-4688-829f-0cad96d20c8f | utkar-sh-ukla/Data-Structures-Algorithms | Data Structures/Binary Tree/library/sum.cpp | #include "../header/binaryTree.h"
int btree::sum(node* leaf) {
if (leaf == NULL) return 0;
return leaf->value + sum(leaf->left) + sum(leaf->right);
}
void btree::sum() {
cout << sum(root) << endl;
} | ALGO | 0.997933 | 3.915659 |
cc8662e3-c57e-4efb-8741-8b630e6dad2b | kaylajrox/RodriguezKayla_CSC5_41202 | class/Homework/Assignment_6-7/Gaddis_8thEd_Chap8_Prob6/main.cpp | /*
* File: main.cpp
* Author: Kayla Rodriguez
* Created on January 4, 2016, 10:18 AM
* Purpose: Example Modification
* Gaddis 8thEd Chap8 Prob6
*/
//System Libraries
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
//User Libraries
//Global Constants
//Function prototypes
void ... | ALGO | 0.999693 | 4.36235 |
0b2887d3-158e-4d87-9f58-1b77a403a6c2 | tizbac/NavMeshViewer | G3D/Line.cpp | /**
@file Line.cpp
Line class
@maintainer Morgan McGuire, graphics3d.com
@created 2001-06-02
@edited 2006-01-28
*/
#include "G3D/Line.h"
#include "G3D/Plane.h"
namespace G3D {
Vector3 Line::intersection(const Plane& plane) const {
float d;
Vector3 normal = plane.normal();
plane.getEquat... | TOOL | 0.951619 | 5.67253 |
713cf517-2bd5-476d-9cbe-e8f7276221ba | richelbilderbeek/GTST | gtstgroup.cpp | //---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ProjectGtst.htm
//---------------------------------------------------------------------------
#include <algorithm>
#include <... | TOOL | 0.946254 | 6.031368 |
13647cc5-03f9-44e5-8534-55570477fc47 | aditijoshi-21/CPP-Programming | program27.cpp | //Input : 7
//Output: 7 6 5 4 3 2 1
#include<iostream>
using namespace std;
class Pattern
{
public:
int iRow;
Pattern(int X)
{
iRow = X;
}
void Display()
{
int i=0;
for(i=iRow;i>=1;i--)
{
cout<<i<<"\t";
}
}
};
int main()
... | ALGO | 0.999721 | 4.364283 |
f9ec815e-16fa-48a2-9a41-9bd57c4c9838 | JustPumpkin0526/Main | Main/opencv/sources/3rdparty/openexr/IlmImf/ImfRle.cpp | #include <string.h>
#include "ImfRle.h"
#include "ImfNamespace.h"
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
namespace {
const int MIN_RUN_LENGTH = 3;
const int MAX_RUN_LENGTH = 127;
}
//
// Compress an array of bytes, using run-length encoding,
// and return the length of the compressed data.
//
int
rleCompress... | ALGO | 0.996119 | 5.188163 |
398bbc58-005e-4842-a47a-4f2227d2b6c9 | StrokinConstantine/pet_projects | small_projects/optimization_methods_labs/lab_1/gr.cpp | #include <iostream>
#include <cstdint>
#include <cmath>
#include <algorithm>
double test_function_1( double x )
{
return x * ( x * ( x * ( x * ( -5 * x + 4 ) -12 ) + 11 ) -2 ) + 1;
}
double test_function_2( double x )
{
return -( std::log( x - 2 ) * std::log( x - 2 ) ) + ( std::log( 10 - x ) * std::log( 10 - x ) )... | ALGO | 0.999944 | 4.982517 |
3c1cc5fa-636a-4bd6-891c-606b8412f953 | Hyp3R0d/AlgorithmCompetition | 图论/最短路 差分约束/LG P5905.cpp | /* Johnson 全源最短路算法*/
#include<bits/extc++.h>
using i8 = signed char;
using u8 = unsigned char;
using i16 = signed short int;
using u16 = unsigned short int;
using i32 = signed int;
using u32 = unsigned int;
using f32 = float;
using i64 = signed long long;
using u64 = unsigned long long;
using f64 = double;
using i128 ... | ALGO | 0.999985 | 4.064245 |
cc7d15ae-b1ef-4122-b39c-e216d44e9047 | fwdzh/cp_code | Luogu/P3371/sol.cpp | // Author: Zhangwuji
// Date: 2025-02-18
// Time: 00:18:46
// #define YUANSHEN
#if defined(YUANSHEN)
#include "C:/cp_code/template/debug.hpp"
#else
#include <bits/stdc++.h>
using namespace std;
#define dbg(...) 42
#endif
template <typename T1, typename T2>
void cmin(T1& x, const T2& y)
{
x = x < y ? x : y;
}
templ... | ALGO | 0.99997 | 4.17325 |
ab73ed31-8efd-4c2a-9f37-c1c85e4e32e0 | Piousangel/ForCodingTest | 프로그래머스2단계/JadenCase문자열만들기.cpp | #include <string>
#include <vector>
using namespace std;
string solution(string s) {
string answer = "";
int count = 0;
for(int i = 0; i < s.length(); i++){
if(s[i] == ' '){
count = 0;
continue;
}
if(count == 0){
if... | ALGO | 0.999735 | 5.243329 |
89956104-ab30-4560-a73d-2f09db468356 | weizds/LeetCode | medium/849_Maximize_Distance_to_Closest_Person.cpp | class Solution {
public:
int maxDistToClosest(vector<int>& seats) {
int res = 0;
int left = -1;
int n = seats.size();
for(int i = 0; i < n; ++i) {
if(seats[i] == 0)
continue;
if(left == -1)
res = max(res, i);
else
... | ALGO | 0.999959 | 5.956975 |
b76380ee-b431-4168-bbc3-b408bf64f4df | md-qubais/DSA_updated | pepcoding_n_queens_branch_and_bound.cpp | #include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define int long long
#define endl "\n"
#define pb push_back
#define p push
#define fori(n) for(int i=0;i<n;i++)
#define ford(n) for(int i=n-1;i>=0;i--)
#define fl(x,n) for(int i=x;i<n;i++)
#define Maxheap priority_queue<int>
#define M... | ALGO | 0.999156 | 4.405984 |
eff5520a-842c-455c-b844-b297bb4b0d03 | squell/Lexicon | trie/impl/tree.cpp | #pragma once
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstddef>
#include "base.h"
template<class T, class K>
struct BinaryTree {
typedef T* pointer;
typedef T& reference;
typedef BinaryTree link;
pointer next;
pointer sib[2];
K key;
pointer l... | ALGO | 0.997384 | 5.506304 |
a7851c68-03d4-491d-91af-e81efeeb7e8e | Ownfos/Waffle | libraries/boost_1_72_0/libs/serialization/src/extended_type_info.cpp | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// extended_type_info.cpp: implementation for portable version of type_info
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) //... | TOOL | 0.905506 | 6.820876 |
edf7898c-826b-4da4-adcb-1b5afaf55e57 | AbdalnoorAlhajo/Problem-Solving | Level 1/11 - average pass or fail.cpp | // #11 - average pass or fail.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
using namespace std;
enum enPassFail { Pass = 1, Fail = 2 };
void ReadNumbers(int& mark1, int& mark2, int& mark3)
{
cout << "Enter first mark: ";
cin >> mark1;
cout... | ALGO | 0.948808 | 3.977504 |
863d97a7-0243-499c-81c3-b91f56a09e7f | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_10019_0.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t, n;
cin >> t;
while (t--) {
cin >> n;
int a[n], temp, flag = 0, n1 = n;
for (int i = 0; i < n; i++) cin >> a[i];
map<int, int> pos;
for (int i = 0; i < n; i++) {
pos[a[i]] = i + 1;
}
temp = pos[1];
for (int i = ... | ALGO | 0.999975 | 3.972281 |
e93ab8d9-740d-4c79-a525-6d7762ff0e52 | HPC-AI-Team/lammps-fugaku-threadpool-sc23 | src/PTM/ptm_graph_tools.cpp | // clang-format off
#include <cstring>
#include <algorithm>
#include "ptm_graph_tools.h"
#include "ptm_constants.h"
namespace ptm {
bool build_facet_map(int num_facets, int8_t facets[][3], int8_t common[PTM_MAX_NBRS][PTM_MAX_NBRS])
{
memset(common, -1, sizeof(int8_t) * PTM_MAX_NBRS * PTM_MAX_NBRS);
... | ALGO | 0.957605 | 6.76709 |
8adc58fc-5ea0-4568-8fc0-040d8a0b4420 | minhduc5a15/utc_code | Cpp/vitricanbang.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
long long sum = 0;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; ++i) {
cin >> arr[i];
sum += arr[i];
}
lo... | ALGO | 0.999791 | 4.216052 |
375b9be2-e8a1-408e-852d-62a3537e8afe | vinothalagupandi/openmp-snippets | total-nonpad.cpp | #include<bits/stdc++.h>
#include <chrono>
#include<omp.h>
using namespace std;
using namespace std::chrono;
static long num_steps = 1000000;
int main(){
auto start = high_resolution_clock::now();
int i,x,nthreads,constant;
long long int total;
long long int sum[4];
constant = 12;
omp_set_num_th... | ALGO | 0.998337 | 3.439176 |
dd03a80f-d166-46fe-9b21-6da2c6aa8621 | tridibsamanta/Codeforces_Solutions | 1632C.cpp | /*
~ Author : @tridib_2003
*/
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_orde... | ALGO | 0.999784 | 5.065831 |
1b7409c8-072c-4806-88ff-ec814d1564a1 | jacobsfo/lc | gk/llmid.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node* next;
Node(int x){
data = x;
next = NULL;
}
};
void printList(Node* node)
{
while (node != NULL) {
cout << node->data <<" ";
... | ALGO | 0.999713 | 6.167481 |
064cc87e-295f-463f-9c6a-ef0b13d02207 | giver-kdk/C_CPP_Ubuntu | CPP Programming/College/_8 Practice/Practice2/Operator_Overload_Binary.cpp | #include <iostream>
using namespace std;
class Score
{
int value;
public:
Score(){}
Score(int v) : value(v){}
Score operator +(Score obj)
{
Score temp;
temp.value = value + obj.value;
return temp;
}
void operator =(Score obj)
{
value = obj.value;
}
bool operator ==(Score obj)
{
if(... | TOOL | 0.886938 | 4.523708 |
e88afd91-ee77-4dfe-8c4a-95a704ecb210 | thegamer1907/Code_Analysis | contest/1542502870.cpp | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
#include<set>
#include<cstring>
#include<string>
#include<assert.h>
#include<bitset>
#include<cmath>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i_##END_=(b);i<=i_##END_;++i)
#define REP(i,a,b) for(int i=(a)... | ALGO | 0.999938 | 3.426397 |
387e3b3f-4e13-46bb-aa7c-32b67912b191 | itsax404/France-IOI | C++/Niveau 1/4 - Lecture de l'entrée/Socles de statues.cpp | #include <iostream>
using namespace std;
int main(){
int largeurSolMax;
int largeurSolMin;
cin >> largeurSolMax;
cin >> largeurSolMin;
int somme = 0;
for(int i = largeurSolMax; i >= largeurSolMin; i--){
somme += i*i;
}
cout << somme <<endl;
} | ALGO | 0.998884 | 4.25596 |
9381b62e-e361-4550-8f4a-2b0dda53ec35 | KenanRico/A-Star-Pathfinding | src/pathfinder.cpp | #include "pathfinder.h"
#include "pos.h"
#include <vector>
//#include <iostream>
//#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
//helper functions
bool Reachable(const Kha::Pos& a, const Kha::Pos& b){
return (float)sqrt(pow(a.row-b.row,2)+pow(a.col-b.col,2))==1.0f;
//return true;
}
... | ALGO | 0.999489 | 4.350495 |
fa43050e-68e4-41a4-9701-ff5dc8f849fa | adityanjr/code-DS-ALGO | HackerBlocks/More/THE CODING BLOCKS TRIO - BITMASKING - DP(MEDIUM).cpp | //https://www.hackerearth.com/practice/algorithms/dynamic-programming/bit-masking/practice-problems/algorithm/the-three-musketeers/description/
#include<bits/stdc++.h>
#include<unordered_set>
using namespace std;
#define fio ios_base::sync_with_stdio(false)
#define ll long long int
#define s(x) scanf("%lld",&x)
#de... | ALGO | 0.999831 | 4.400837 |
17d53a71-5619-4d2a-8d19-3cfdb57da6e1 | AvivBk/Shortest-way-on-graph | Heap.cpp | #include "Heap.h"
namespace Huffman
{
Heap::Heap() : _heap(nullptr), _maxSize(0), _heapSize(0), _allocated(false)
{
}
void Heap::BuildHeap(TreeNode* arr, int size)
{
_heapSize = _maxSize = size;
_allocated = false;
for (int i = 0; i < size; ++i) {
_heap[i] = arr[i];
_heap[i].setItem(arr[i].getNodeCh... | ALGO | 0.986833 | 4.581636 |
a41d55a8-5a5e-4415-b5fa-03bf1f5b8c0d | sarvex/leetcode-gravity | solution/0600-0699/0666.Path Sum IV/Solution.cpp | class Solution {
public:
int ans;
unordered_map<int, int> mp;
int pathSum(vector<int>& nums) {
ans = 0;
mp.clear();
for (int num : nums) mp[num / 10] = num % 10;
dfs(11, 0);
return ans;
}
void dfs(int node, int t) {
if (!mp.count(node)) return;
... | ALGO | 0.999914 | 6.686934 |
e69e6388-ccf9-4f16-89b1-95771577caf6 | xj7152069/useful_code | timespace.lslrt/code/slantstack3d.omp.cpp | /************update in 2022.06.14**************/
/*
version 2.0: 1. The number of iterations is consistent
2. The consistency of Tikhonov regularization is maintained
***********************************************/
#include <iostream>
#include <math.h>
#include <omp.h>
#include "./slantstack3d.omp.hpp"
#... | ALGO | 0.999572 | 4.102142 |
e8e3170b-df58-4b66-a45b-451d86e34ff5 | tol60/STROUSTRUP_C11 | STEPIK/ex1.11.8_set_map_latin_dictionary.cpp | // g++ -std=gnu++11 Hello.cpp -o Hello.exe
#include <iostream>
#include <map>
#include <string>
#include <set>
using namespace std;
/*
Однажды, разбирая старые книги на чердаке, школьник Вася нашёл англо-латинский словарь. Английский он к тому времени знал в совершенстве, и его мечтой было изучить латынь. Поэтому поп... | ALGO | 0.999538 | 5.161895 |
a3a2c561-82b9-4e7b-8382-43c9337f9512 | timmy61109/C-How-to-Program | example/C++教學手冊-第三版/範例程式/ch09/prog9_18.cpp | // prog9_18, N}CnӤȨNnum
#include <iostream>
#include <cstdlib>
using namespace std;
void replace(int *,int,int); // ŧireplace()ƪ쫬
int main(void)
{
int a[5]={1,2,3,4,5};
int i,num=100;
cout << "meA}Ce ";
for(i=0;i<5;i++) // meLX}Ce
cout << a[i] << " ";
cout << endl;
repla... | ALGO | 0.991398 | 3.333568 |
3f11f5d0-300a-4b2b-b1ee-0e5bd98b9e92 | raincross7/code-similarity | codes/train_code/problem423/problem423_46.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
const ll C = 1e9+7;
int main() {
ll N, M;
cin >> N >> M;
if(N == 1 && M == 1) cout << 1 << endl;
if(N == 1 && M >= 2) cout << M - 2 << endl;
if(M == 1 && N >= 2) cout << N - 2 << endl;
if(N >= 2... | ALGO | 0.999973 | 3.804215 |
f1b1a351-46fd-42af-ab09-a4e5280766bd | MukulMadaan/CodingCrashCourse | Transpose/TransposeMatrix.cpp | class Solution {
public:
vector<vector<int>> transpose(vector<vector<int>>& matrix) {
int len = matrix.size();
if (len == 0) return matrix;
int rowLen = matrix[0].size();
vector<vector<int>> result;
for (int i = 0; i < rowLen; i++){
vector<int> temp;
f... | ALGO | 0.999945 | 6.529908 |
3ecf6891-ba85-47d6-a661-7fad880d0313 | ds-umass/GraphMini | GraphMini/dependency/oneTBB/examples/parallel_pipeline/square/square.cpp | //
// Example program that reads a file of decimal integers in text format
// and changes each to its square.
//
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include "oneapi/tbb/parallel_pipeline.h"
#include "oneapi/tbb/tick_count.h"
#include "oneapi/tbb/tbb_allocator.h"
#include "oneapi... | DATA | 0.923532 | 5.74952 |
a6c743c1-832d-44b1-a537-49e74bf8be26 | davidchai21/leetcode-solutions | 364 Nested List Weight Sum II/NestedListWeightSumII.cpp | /**
* // This is the interface that allows for creating nested lists.
* // You should not implement it, or speculate about its implementation
* class NestedInteger {
* public:
* // Constructor initializes an empty nested list.
* NestedInteger();
*
* // Constructor initializes a single integer.
* ... | ALGO | 0.999771 | 5.824664 |
5f0e1397-d2d3-48e7-b375-423221682021 | nikhil4u8/Leetcode-solutions | Leetcode Solutions/539. Minimum Time Difference.cpp | class Solution {
public:
int min_diff(string t1, string t2){
int h1 = 0, h2 = 0, m1 = 0, m2 = 0;
bool flag = false;
for(int i=0;i<t1.length();i++){
if(t1[i] == ':'){
flag = true;
continue;
}
if(flag) m1 = m1*10 + (t... | ALGO | 0.999563 | 6.103482 |
a410a97a-43d4-4040-badd-80a8d813dbf1 | mikedungviet/UOIT-FirstYear-INFR1020-Assignment3 | Asteroid with Twist/Classes/SpaceShipHookState.cpp | #include "SpaceShipHookState.h"
#include "SpaceShip.h"
#include "SpaceShipNormalState.h"
#include "GameEntitiesSingleton.h"
Vector2 SpaceShipHookState::FindPerpendicularVectorCounterClockWise(Vector2& ar_Vector2)
{
auto lo_TempVector = ar_Vector2;
auto lo_Temp = lo_TempVector.x;
lo_TempVector.x = lo_TempVector.y;
... | ALGO | 0.975658 | 4.767495 |
11efd0a5-6c8e-42fc-b107-9ddf210d4b0a | Yaro2709/AlgoProblems | 16/1598C.cpp | #include<iostream>
#include<map>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int *a = new int[n];
long long sum = 0;
map<int, int> mp;
for (int i = 0; i < n; ++i) {
cin >> a[i];
sum = sum + a[i];
mp[a[i]]++;
}
if ((2 * sum) % n != 0) {
cout << 0 << ... | ALGO | 0.999789 | 3.68636 |
633f61d6-e992-443c-83a0-0eae5f54fc5b | ktjooho/problem_solving | 12913.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#define INF 1000000
int g[55][55];
int n,potion,cost[55],visitCnt;
int visit[55],dist[55],prev[55];
int back[55],numPath;
float ans;
void find(int visit)
{
if(visit==-1 || visit==0)
return ;
cost[visitCnt++] = g[prev[visit]][visit];
find... | ALGO | 0.999628 | 3.136742 |
0d067903-84d1-4962-a8d9-bb5978722d70 | wonanut/LeetCode-2020 | zjxy/0301.cpp | /*
* 0301-最大连续子列和
* 在线处理
*/
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int func0301() {
int N;
vector<int> vec;
cin >> N;
int inp;
for (int i = 0; i < N; ++i) {
cin >> inp;
vec.push_back(inp);
}
int ret = 0, temp_sum = 0;
for (int i = 0; i < N;... | ALGO | 0.999905 | 4.488992 |
28259f54-de1c-40a3-a6af-26f4924d55b4 | ishandutta2007/codeforces | fairy_tale/normal/1279/B.cpp | #include<bits/stdc++.h>
#define fi first
#define se second
#ifdef FEIFEI
#define Debug printf
#else
#define Debug(...)
#endif
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;
int a[maxn];
LL s[maxn];
int main() {
#ifdef FEIFEI
freopen("E:\\AC... | ALGO | 0.999973 | 3.202611 |
a26a1cd8-63bc-430b-819f-4ca5a5dc4cb3 | admin333-paper/3L-Cache | libCacheSim/scripts/LightGBM/compute/perf/perf_copy_to_device.cpp | #include <vector>
#include <cstdlib>
#include <iostream>
#include <boost/compute.hpp>
int main(int argc, char *argv[])
{
size_t size = 1000;
if(argc >= 2){
size = boost::lexical_cast<size_t>(argv[1]);
}
boost::compute::device device = boost::compute::system::default_device();
boost::compu... | ALGO | 0.941512 | 5.095197 |
1bfa14bf-e244-4051-baa8-6a1bfc5a48ef | pritik2402/cses-graph | shortestroutes2.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,t;
vector<pair<int,int>> adj[500+1];
ll dp[501][501];
bool sortbysec(const pair<int,int> &a,
const pair<int,int> &b)
{
return (a.second < b.second);
}
void bfs(int a)
{
bool visited[n+1];
ll distance[n+1];
... | ALGO | 0.999904 | 4.783396 |
d0221c59-e866-4657-b4b6-5fcb5aaf2120 | igooreqqq/Algorytmy-i-struktury-danych-2-2022 | Implementacja grafu/Graf macierzowo/grafMacierz.cpp | #include "grafMacierz.h"
Graf::Graf()
{
for(int i = 0; i < 1000; i++)
{
for(int j = 0; j < 1000; j++)
{
matrix[i][j] = false;
}
}
}
void Graf::createVertices(int ile)
{
/*for(int i = 0; i < ile; i++)
{
matrix[i][i] = true;
}*/
this->numberOfVert... | ALGO | 0.880177 | 4.170417 |
bc41b15d-1135-4fc8-8d9f-ab8f51492390 | Aniwis/VR | Thats how thou know/Library/PackageCache/com.unity.ide.visualstudio@2.0.12/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.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 made to Visual Studio can fail after ... | TOOL | 0.969413 | 6.969462 |
e9601965-f560-4a8a-b7f7-e4ff634a58f7 | Vant1032/AlgorithmSnippet | 30.大数类.cpp | /*
*/
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <iostream>
using namespace std;
class BigNumber{
private:
int *root;
int size;
int len;
bool isPositive;
void adjustSize(const BigNumber &n);//调整BigNumber的size的长度
public:
BigNumber(const int &size_ = 5000){
... | ALGO | 0.998671 | 3.46591 |
b5c1b43c-664b-4a67-92b5-8eb76bbf644b | StanaAndrei/AOC | 2019/day1.1.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
freopen("data.txt", "r", stdin);
uint64_t sum = 0;
for (int x; cin >> x;) {
sum += x/3 - 2;
}
cout << sum << endl;
return 0;
}
| ALGO | 0.998915 | 3.475835 |
36d13e09-feb3-4ba3-8849-c7551449a7ec | orihehe/Codeforces | Codeforces Round #526 (Div. 2)/A - The Fair Nut and Elevator.cpp | /*
x 츦 غ.
i x, tmp Ҹ ̴.
abs(i-j) ó ġ j , j-1 j 1 ,
i-1 1 x ̴. ٽ x ư .
*/
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
int n, arr[101], minE = 987654321, tmp;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &arr[i]);
}
for (int i = 1; i <= n; i++... | ALGO | 0.999964 | 3.506294 |
cfd38bd9-daf2-4ae8-b8c1-00abd61e8168 | NestZ/competitive-programming | CodeForces/427B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, t, c;cin >> n >> t >> c;
vector<int> ans;
int curr = 0;
for(int i = 0;i < n;i++){
int k;cin >> k;
if(k <= t)curr++;
else{
if(curr > 0)ans.push_back(curr);
curr = 0;
}... | ALGO | 0.999876 | 3.312764 |
8c17c8c6-9106-48a2-8504-4be80324ca49 | mehdinurzi/interview | 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 |
2d329b3c-cf7c-4054-8a42-082c53131ab2 | RaizelShah/Competitive-Programming | C_LR_remainders.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
void solve()
{
int n, m;
cin >> n >> m;
int mod = 1;
vector<int> v;
for (int i = 0; i < n; i++)
{
int k;
cin >> k;
v.push_back(k);
}
string s;
cin >> s;
int l = v.size();
for (int ... | ALGO | 0.999948 | 3.817801 |
d9e823b5-9761-44d2-b859-a5bc077fa7fb | BangKartavya/LeetCode | Modify Graph Edge Weights/main.cpp | class Solution {
public:
vector<vector<int>> modifiedGraphEdges(int n, vector<vector<int>>& edges, int source, int destination, int target) {
vector<vector<pair<int, int>>> adjacencyList(n);
for (int i = 0; i < edges.size(); i++) {
int nodeA = edges[i][0], nodeB = edges[i][1];
... | ALGO | 0.99992 | 6.623643 |
1977e9c0-6660-4f88-bc6d-dcf203216688 | nckcol/Lab-4.Threads-Sweep-Method | SweepMethod/SweepMethod.cpp | // SweepMethod.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <vector>
#include <thread>
#include <iostream>
#include "DiagonalMatrix.h"
#include "SOLE.h"
using namespace std;
void debug(int n, vector<double> & a, vector<double> & b, vector<double> & c, vector<double> & f... | ALGO | 0.993065 | 3.003697 |
3071c943-67e8-4217-8475-bcbd0cc235e4 | bothemrun/CAP-Complete-Algorithmic-Programming | Leetcode_All_Solved/59.cpp | #include<utility>
class Solution {
private:
vector<vector<int>> spiral;
int n;
vector<vector<bool>> visited;
inline bool legal(int i, int j){
if( !(0<=i && i<n && 0<=j && j<n) )return false;
if(visited[i][j])return false;
return true;
}
bool dfs(int i, int j, pair<int,int... | ALGO | 0.999971 | 5.862617 |
1b8ff2b8-5c7e-4a68-8691-9c3733c19d2b | zebreus/s16e | controller-esp-idf/components/lua-5.4.7/src/lstrlib.cpp | #define lstrlib_c
#define LUA_LIB
#include "lprefix.h"
#include <ctype.h>
#include <float.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
/*
** maximum number of cap... | TOOL | 0.877873 | 6.572724 |
6895f09d-d78b-4b39-b04b-8d6e25923f0d | Kondr48/gz_team_engine | trunk/3rd party/boost/libs/graph/example/prim-telephone.cpp | int
main()
{
using namespace boost;
GraphvizGraph g_dot;
read_graphviz("figs/telephone-network.dot", g_dot);
typedef adjacency_list < vecS, vecS, undirectedS, no_property,
property < edge_weight_t, int > > Graph;
Graph g(num_vertices(g_dot));
property_map < GraphvizGraph, edge_attribute_t >::type
e... | ALGO | 0.995947 | 4.540748 |
c7898806-102b-442f-926e-1fb76f68bc03 | wuzhiji37/OJ | HDOJ/1996.cpp | #include <iostream>
using namespace std;
int main()
{unsigned __int64 a[61],x,y;
a[0]=1;for(int i=1;i<=60;i++){a[i]=a[i-1]*3;}cin>>x;
while(cin>>x){cout<<a[x]<<endl;}
return 0;
}
| ALGO | 0.99965 | 3.287133 |
aaeaaa6a-6e7d-4744-a736-b82c06cbdcfe | xmpace/AlgorithmPractice | Graph/dijkstra.cpp | #include <iostream>
#include <climits>
#include <string>
#include <sstream>
using namespace std;
typedef struct _EdgeNode {
struct _EdgeNode *next;
int ver;
int w;
} EdgeNode;
// macros
#define MAX_VERTICES 1000
#define HEAP_IX(x) (g_heapIx[x])
#define VER_NUM(x) (g_heap[x])
// global_variables
EdgeNode* G[MAX... | ALGO | 0.999839 | 3.796228 |
a5466bf7-8cc1-4e90-82a5-6597146fcc3e | xiaofantuanw/Quantnet-CPP-Class | Level 2/1.7/1.7.4/Exercise4.cpp | /*File comments
* Author: Tengxiao Fan
* Objective: The user input a daynumber (1-7),
the program gives the name of the daynumber (i.e. Sunday for 1)
*/
#define _CRT_SECURE_NO_WARNINGS
#define WEEKDAY 7
#include <stdio.h>
#include <string.h>
void DayName(unsigned int day)
{
char dayname[7][10];//This array is to sto... | ALGO | 0.998779 | 3.62739 |
e327786a-8ee6-4845-bef7-532cba330cc6 | Shubhamdudhbhate/LEETCODE | LinkedList/DoublyLinkedLis.cpp | #include<iostream>
using namespace std;
class Node
{
public:
int data;
Node*next;
Node*prev;
Node(int val)
{
data = val;
next = nullptr;
prev=nullptr;
}
};
// Singly Linked List class
class DoublyLinkedList {
private:
Node* head;
Node*tail;
public:
//... | ALGO | 0.992293 | 6.00723 |
f10137ba-2b81-4859-9dce-73d71129e332 | svn2github/ChessGNU | branches/readline/src/engine/value.cpp | // value.cpp
// includes
#include "piece.h"
#include "search.h"
#include "util.h"
#include "value.h"
namespace engine {
// variables
int ValuePiece[PieceNb];
// functions
// value_init()
void value_init() {
int piece;
// ValuePiece[]
for (piece = 0; piece < PieceNb; piece++) ValuePiece[piece] = -1;
... | ALGO | 0.997291 | 7.192512 |
f68b4559-6c73-4457-8f2c-30e209da517d | Youngwook-Jeon/algorithm-problems-solving | codeforces/DislikeOfThrees.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pii;
#define FASTIO \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#defin... | ALGO | 0.999344 | 3.540837 |
eab9b5c3-8288-40d1-a39c-c2937957d38f | AnanyaSharma1953/termwork | q9termwork.cpp | #include <iostream>
using namespace std;
class UserTwo;
class UserOne
{
string name, fathername, mothername;
char gender;
public:
void InputInfo()
{
cout << "Enter the first person's name :";
getline(cin, name);
cout << "Enter father's name :";
getline(cin, fathername);
... | TOOL | 0.934315 | 3.24225 |
7f31b22d-20de-4bb5-b816-94dbbf8251cd | ksaveljev/UVa-online-judge | 494.cpp | #include <iostream>
#include <string>
using namespace std;
int main (void) {
string input;
while (getline(cin, input)) {
int counter = 0;
bool isWord = false;
for (int i = 0; i < input.size(); i++) {
if (input[i] >= 'a' && input[i] <= 'z' || input[i] >= 'A' && input[i] <= 'Z') {
if (!isWord) {
... | ALGO | 0.999323 | 4.354891 |
8fd717a6-e628-47a2-a19e-8eb2295bf484 | rahul-shiv/leetcode | 34-find-first-and-last-position-of-element-in-sorted-array/34. Find First and Last Position of Element in Sorted Array.cpp | class Solution {
int lb(vector<int>& nums, int target){
int l = 0, r= nums.size()-1,m;
while(l<r){
m = l+(r-l)/2;
if(nums[m]<target)l=m+1;
else r=m;
}
if(l<nums.size() and nums[l]<target)l++;
return l;
}
public:
vector<int> searchR... | ALGO | 0.999977 | 6.454592 |
ea1f716c-8b0d-4198-95dd-77b249e7eb93 | TM-DEV-PRO/DSA-CP | funtion-snippets/Atcoder/educational-dp-contest/coins-2-sol.cpp | #include<iostream>
#include<vector>
using namespace std;
double dp[3000][3000];
const long long INF = 1e18L + 5;
const long double D_INF = 1e10;
// double res = 0;
double probHead(vector<double> &prob,int n,int count){
if(n==0){
if(count>prob.size()/2)
return 1;
else
return... | ALGO | 0.999738 | 4.297265 |
5b0e7fee-d81b-499e-a80e-b25e9809dd9a | ZuhaFatima96/DSA | Grade_Sorting_And_Merging_System.cpp | #include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdlib>
#include <ctime>
#include <algorithm>
class GradeManager {
private:
std::map<std::string, std::vector<int>> courseGrades;
// Merge two sorted vectors
std::vector<int> merge(const std::vector<int>& left, const std::ve... | ALGO | 0.998827 | 6.628103 |
6b17b53d-e894-45f7-bee9-b4e66488ba5b | JoelDiaz0/EPCC-Ciencia-de-la-Computacion-II | Lab9/Ejercicio1/Numero.cpp |
//Numero.cpp
#include <iostream>
#include "Numero.h"
using namespace std;
template <class T>
Numero<T>::Numero()
{
num1 = 0;
num2 = 0;
num3 = 0;
}
template <class T>
Numero<T>::Numero(T num1, T num2, T num3)
{
this -> num1 = num1;
this -> num2 = num2;
this -> num3 = num3;
}
template <class ... | TOOL | 0.977651 | 4.412936 |
111675d9-e7da-445c-831f-7b075abf051f | Johannyjm/c-pro | AtCoder/agc/agc029/a.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
string s;
cin >> s;
int n = s.size();
int end = n;
for(int i = n... | ALGO | 0.999606 | 4.331225 |
d0d690db-6276-4671-b1d3-aca463ad08d4 | TkWarrior/DSA-practice | 67-add-binary/add-binary.cpp | class Solution {
public:
string addBinary(string a, string b) {
int i = 0 ;
int alen = a.length();
int blen = b.length();
string ans = "";
int sum = 0 ;
int carry = 0;
while( i<alen || i<blen || carry!=0){
sum = carry;
if(i<alen){
... | ALGO | 0.999981 | 6.47668 |
1374cd25-a030-496d-b208-154dc8c81611 | keshavop/all-code | DSA/05 Array/max_consectuive_ones.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int maxOnes(bool arr[], int n){
int res = 0, current = 0;
for (int i = 0; i < n; i++){
if (arr[i] == 0)
{
current = 0;
}
else
{
current++;
res = max(res, current);
... | ALGO | 0.999935 | 5.081232 |
ea4e1aed-b596-4101-9501-66f4c1bd7184 | ujjwalagrawal-1/CP_Problems | A_Secret_Sport.cpp | //"2023-11-25 23:30:14",
// Author Ujjwal_Agrawal
// Linkedin: https://www.linkedin.com/in/ujjwal-agrawal-9267b1253/
// Codeforces: https://codeforces.com/profile/unerring_coder
// Codechef: https://www.codechef.com/users/kumarujjwalagr
#include <bits/stdc++.h>
using namespace std;
//Speed
#define bullet() ios_base:... | ALGO | 0.999323 | 4.701133 |
915c3ac0-d525-4a4b-a807-469580471f01 | Xipog77/BTVN-DSA | 23020615 - BTH - T5/Stack.cpp | #include <iostream>
using namespace std;
// Sử dụng Linked-list.
// struct Stack
// {
// private:
// int Data;
// Stack* next;
// public:
// Stack(int d) {
// Data = d;
// next = NULL;
// }
// Stack* add(int d, Stack* head) {
// Stack* newStack = new Stack(d);
// newStack->next = head;
// ... | ALGO | 0.997842 | 3.840379 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.