uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
df676b70-dbc5-4b86-8f42-ae132091320d | Shaqlain07/DSA-PROBLEMS | Trees/lcaOfBinaryTree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
//last intersection node from top,iterate dfs if u find a node return node, if u find both the no... | ALGO | 0.999988 | 5.966528 |
b3a69ce6-ffb9-4543-8e61-cfedc2b2d713 | dlvguo/NoobOJCollection | LeetCode/Normal/1200-1299/1239.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<bitset<32>> bts;
bitset<32> tempB;
int maxLen = 0, tempLen = 0;
void dfs(int nowIndex)
{
if (nowIndex >= bts.size())
{
return;
}
//说明没交集
if (!(tempB & bts[nowIndex]).cou... | ALGO | 0.999931 | 4.777085 |
f7474119-6e9b-40b5-b961-773a1b34f08a | Jianxff/rd_vio | src/rdvio_map/src/track.cpp | #include <rdvio/estimation/solver.h>
#include <rdvio/geometry/stereo.h>
#include <rdvio/map/track.h>
namespace rdvio {
Track::Track() { tag(TT_STATIC) = true; }
Track::~Track() = default;
const vector<3> &Track::get_keypoint(Frame *frame) const {
return frame->get_keypoint(keypoint_refs.at(frame));
}
void Track... | ALGO | 0.991617 | 6.680863 |
25a991c9-ae4d-4c9a-82fb-cd097329ea00 | sardonicankita/6companies30days | google/Swim in rising Water (Jeff and the rising hat).cpp | class Solution {
public:
struct T {
int t, x, y;
T(int a, int b, int c) : t (a), x (b), y (c){}
bool operator< (const T &d) const {return t > d.t;}
};
int swimInWater(vector<vector<int>>& grid) {
int N = grid.size (), res = 0;
priority_queue<T> pq;
pq.push(T... | ALGO | 0.999978 | 5.895688 |
8321e86c-d350-4f8c-b5ae-5cacbb010047 | ishandutta2007/codeforces | errichto/normal/993/A.cpp | #ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > r... | ALGO | 0.99984 | 3.240803 |
0cba4b01-a14c-4fa4-9174-9c8c21f81987 | 23Aditi/LeetCode | 2570-merge-two-2d-arrays-by-summing-values/2570-merge-two-2d-arrays-by-summing-values.cpp | class Solution {
public:
vector<vector<int>> mergeArrays(vector<vector<int>>& nums1, vector<vector<int>>& nums2) {
vector<vector<int>> result;
int n1 = nums1.size();
int n2 = nums2.size();
int i = 0 , j = 0;
while(i<n1 && j <n2){
if(nums1[i][0]==nums2[j][0]){
... | ALGO | 0.999767 | 5.394277 |
401eb8fe-6a66-4cab-ad6a-c3bf04a74171 | kuotsanhsu/cses | cpp/Coin Piles.cpp | #include <iostream>
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
std::cin >> t;
while (t--) {
int a, b;
std::cin >> a >> b;
if (a < b) {
std::swap(a, b);
}
const auto c = b - (a - b);
std::cout << (c >... | ALGO | 0.999792 | 5.635711 |
aa3f675b-8bbf-4e9b-89fc-348177ea9dd0 | Sgewux/CompetitiveProgramming | codeforces/2024/contest_938_div3/YogurtSale.cpp | #include <bits/stdc++.h>
void solve(){
long long n;
long long a;
long long b;
std::cin>>n;
std::cin>>a;
std::cin>>b;
if(b < 2*a){
std::cout<< b*(std::floor(n/2)) + a*(n%2)<<'\n';
} else {
std::cout<< a*(n)<<'\n';
}
}
int main(){
std::ios_base::sync_with_stdio(... | ALGO | 0.999693 | 3.974699 |
4631f711-672a-450d-a5cb-99cc50e29ed6 | siddhantkhandelwal/competitiveprog-submissions | leetcode/#GoGetIt/25.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution
{
pair<ListNode *, ListNode *> ... | ALGO | 0.999995 | 5.954677 |
bc75cdbb-b39f-4324-879e-1070060bda42 | AimotoRyosuke/atcoder | work/abc/C/049_C.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
vector<string> divider = {"dream", "dreamer", "erase", "eraser"};
reverse(s.begin(), s.end());
for (int i = 0; i < divider.size(); i++)
reverse(divider.at(i).begin(), divider.at(i).end());
string target;
... | ALGO | 0.99983 | 4.282506 |
bbd99c1d-c06a-4f4d-9b38-78d610ec05ea | manhtran91/rxwen-blog-stuff | algorithm/codeforces/2/2b.cpp | /*
*
* http://codeforces.com/problemset/problem/2/B
*
* B. The least round way
* time limit per test5 seconds
* memory limit per test64 megabytes
* inputstandard input
* outputstandard output
* There is a square matrix n×n, consisting of non-negative integer numbers. You should find such a way on it that
*
*... | ALGO | 0.999979 | 4.417627 |
08e8faba-a227-46f8-a63d-5abbab3bedf7 | DiegoMartinez2021/Portafolio_Ciclo_01_2021 | Portafolio periodo 1/10 - Numero magico.cpp | //Juego del numero mgico
#include<iostream>
#include<ctime>
#include<conio.h>
using namespace std;
int main(){
cout << "Autor: Diego Fernando Martinez Garcia - Carnet: MG101120."<<endl<<endl;
int num1, numRand, num2;
cout << "Adivina el numero: "; cin >> num1;
srand(time(0));
numRand = rand()%100+1;
if(num1... | TOOL | 0.964529 | 3.242607 |
6a0f0156-7bc2-4c8f-bce2-ebd3a96f0ec1 | dustincys/msphy-SCNAClonal | dependencies/eigen/build_dir/doc/snippets/compile_Tridiagonalization_packedMatrix.cpp | static bool eigen_did_assert = false;
#define eigen_assert(X) if(!eigen_did_assert && !(X)){ std::cout << "### Assertion raised in " << __FILE__ << ":" << __LINE__ << ":\n" #X << "\n### The following would happen without assertions:\n"; eigen_did_assert = true;}
#include <iostream>
#include <Eigen/Eigen>
#ifndef M_PI... | ALGO | 0.997143 | 4.035321 |
c6fcaf34-7b2f-41bb-a6a7-ecaff49a209c | THOTHSM/Network-Anomaly-Detection | NAD/lib/python3.12/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.997593 | 7.198757 |
38dd7dfc-9e2f-425c-9501-e574997bba34 | FightingBoom/studycode | c++PrimerPlusSixthEdition/chapter_17/code_17.11/check_it.cpp | #include <iostream>
using namespace std;
int main()
{
cout << "Enter numbers: ";
int sum = 0;
int input;
while (cin >> input) // 遇到非数字输入时,返回false退出
{
sum += input;
}
cout << "Last value entered = " << input << endl;
cout << "Sum = " << sum << endl;
return 0;
}
/*
zhaoche... | ALGO | 0.91961 | 3.77642 |
66243489-8d45-428c-a8ff-ae7cd6b12f62 | npalgit/leet | Problem_089.cpp | // Problem 89
#include<biset>
typedef vector<string> Vector;
typedef Vector::iterator VectorItr;
typedef Vector::reverse_iterator VectorRItr;
typedef vector<int> intVector;
class Solution {
public:
void dispVector(Vector & myVect){
int size = myVect.size();
for(int i = 0; i < size; i++){
cou... | ALGO | 0.999534 | 4.920295 |
e2688992-74fd-40ed-bfc1-eb8772a58171 | akshatjain02/CP-snippets | Data_Structures/Segment_Tree/Segment Tree Offline.cpp | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define all(a) (a).begin(),(a).end()
#define lol 1000000007
#define endl '\n'
#define rep(i,a,b) for(int i=a;i<b;i++)... | ALGO | 0.999846 | 3.932631 |
c44278e2-e000-45a5-a800-74516a2a4882 | hargunmujral/Competitive-Programming | floodfill.cpp |
class Solution {
public:
void filler(vector<vector<int>>& image, int sr, int sc, int newColor, int original)
{
if(sr < 0 || sr >= image.size() || sc < 0 || sc >= image.at(0).size() || original == newColor || image[sr][sc] != original) return;
image[sr][sc] = newColor;
filler(... | ALGO | 0.997458 | 6.270936 |
8b5d95ce-c2b7-4e50-b82a-c3eda626b66d | JKSL12/cppchat | boost_1_83_0/libs/geometry/test/algorithms/distance/distance_geo_linear_box.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
#ifdef BOOST_GEOMETRY_TEST_DEBUG
#include <iostream>
#endif
#include <string>
#ifndef BOOST_TEST_MODULE
#define BOOST_TEST_MODULE test_distance_geographic_linear_areal
#endif
#include <boost/test/included/unit_test.hpp>
#include "test_distance_geo_... | TEST | 0.922066 | 7.742786 |
2c0916db-d5f7-4524-a725-fd638a2483be | ISOLDE-Project/riscv-llvm | libcxx/test/std/utilities/template.bitset/bitset.members/count.pass.cpp | // size_t count() const; // constexpr since C++23
#include <bitset>
#include <cassert>
#include <cstddef>
#include <vector>
#include "../bitset_test_cases.h"
#include "test_macros.h"
template <std::size_t N>
TEST_CONSTEXPR_CXX23 void test_count() {
std::vector<std::bitset<N> > const cases = get_test_cases<N>();
... | TEST | 0.944693 | 7.719549 |
4de14ae5-f2b8-4c0f-a159-1fd740b3d61d | yuhangzhang/kdtree | knn.cpp | #include "knn.h"
knn::knn(int k, vector<double>feature)
{
numneighbor = k;
v = new vector<double>[k];
dis.resize(k,DBL_MAX);
center = feature;
names.resize(k);
return;
}
void knn::add(vector<double>feature, int name)
{
printf("#\n");
double d = eud2(center, feature);
for(int i=0;i<numneighbor;i++)
{
if(d<... | ALGO | 0.993727 | 3.788222 |
2275ed16-8a79-4327-93c5-4bbe5969044c | Alexmnzlms/FP | Sesion 6/Ejercicio 23 AM B.cpp | /*
Programa que aproxima pi por Gregory-Leibniz
*/
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int i, tope, max_tope = 100000, min_tope = 1;
double pi = 0, sumatoria, potencia;
do{
cout << "Introduzca el tope:\t ";
cin >> tope;
}while(tope > max_tope || tope < min_tope);
for(i... | ALGO | 0.999729 | 3.503066 |
8ed10204-d977-4e01-9919-65aebbee3139 | Uauy-Lab/IBSpy | IBScpp/src/kmerdb.cpp | #include<kmerdb.h>
#include<algorithm>
/*
2021-6-18 10:09:52
author:<EMAIL>
*/
inline tuple<uint64_t, uint64_t> is_canonized_kmer_representation_flag(const uint64_t& k, const uint32& k_len) {
uint64_t k_rc = kmer_reverse_complement(k, k_len);
if(k<k_rc)
return make_tuple(k, 0x4000000000000000);
else
retur... | ALGO | 0.951928 | 4.693473 |
10fb22af-4514-4bd2-8401-c8aa9bdaa26c | HiDMadMad/advance-computer | MrAhmadi-codes/printNto1.cpp | #include<iostream>
using namespace std;
int main()
{
int N,i;
cout<<"Enter N: ";
cin>>N;
i=N;
while (i>0)
{
cout<<i<<"\t";
i--;
}
return 0;
}
| ALGO | 0.998083 | 3.436512 |
09ef1b1f-460b-4456-b924-f732a96ee263 | mosesstefanoch/DataStructure-C | Linked List/Case & Answer (Double Linked List)/soal3.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct song{
char name[100];
song *next, *prev;
}*head, *tail, *curr, *cursor;
void node(char name[])
{
curr = (song*)malloc(sizeof(song));
strcpy(curr->name, name);
curr->next = curr->prev = NULL;
}
void pushtail(char name[])
{
node(name);
if(head==... | TOOL | 0.986008 | 3.710849 |
4a572292-e7a4-4a77-b988-06036601bce0 | Hadi-Hajieghrary/Cpp-Code | neural_network/src/ml_perceptron.cpp | #include "ml_perceptron.hpp"
MultiLayerPerceptron::MultiLayerPerceptron(const unsigned int input_dimention, const unsigned int number_of_layers,
const unsigned int* number_of_perceptrons_in_layers , Perceptron** perceptrons)
:input_dimention_{input_dimention}, number_of_... | ALGO | 0.980184 | 3.924537 |
377efa06-6f99-4d99-8468-6ec01f1220ab | aeum1016/miscPrograms | src/UFPTPractice/problem_types/complete_search/closestsums.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
int c = 1;
vector<int> raw;
vector<int> sums;
while(scanf("%d\n", &a) != EOF) {
raw.clear();
sums.clear();
printf("Case %d:\n", c);
for(int i = 0; i < a; i++) {
scanf("%d\n", &b);
raw.push_back(b);
}
... | ALGO | 0.999906 | 3.320109 |
c0446dd8-6786-44e5-babb-44e28c0f67b1 | byoushinwokamu/baekjoon | src/11659.cpp | #include <iostream>
using namespace std;
int sum[100000];
int main() {
cin.tie(NULL);
cout.tie(NULL);
ios::sync_with_stdio(false);
int n, m, a, b, t;
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> t;
sum[i] = (i == 0 ? 0 : sum[i - 1]) + t;
}
for (int i = 0; i < m; i++) {
cin >> a >> b... | ALGO | 0.999868 | 4.198409 |
c41e3fb4-cff0-45bb-91d7-fcf055047e23 | CoderDream/java-architect-util | hello-algo/hello-algo-main/zh-hant/codes/cpp/chapter_array_and_linkedlist/list.cpp | /**
* File: list.cpp
* Created Time: 2022-11-25
* Author: krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
/* 初始化串列 */
vector<int> nums = {1, 3, 2, 5, 4};
cout << "串列 nums = ";
printVector(nums);
/* 訪問元素 */
int num = nums[1];
cout << "訪問索引 1 處的元素,得到 n... | ALGO | 0.978456 | 4.938916 |
8520389f-3961-4c8e-8a50-1ddad34f2d29 | raincross7/code-similarity | codes/train_code/problem188/problem188_166.cpp | #include<bits/stdc++.h>
#define For(i,a,b) for(i=(a);i<=(b);++i)
#define Forward(i,a,b) for(i=(a);i>=(b);--i)
using namespace std;
template<typename T>inline void read(T &x)
{
T s=0,f=1;char k=getchar();
while(!isdigit(k)&&(k^'-'))k=getchar();
if(!isdigit(k)){f=-1;k=getchar();}
while(isdigit(k)){s=s*10+(k^48);k=get... | ALGO | 0.999782 | 3.595948 |
697ba628-37da-43e7-853d-c44fdb57b4dd | martinz2002/cs225-sp22-zjui | assignments/Ass05/Ass5_Ex4solution/test.cpp | //
// test.cpp
//
//
// Created by KD on 09.05.21.
//
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include "listext.cpp"
#include "time.h"
using std::cout;
using std::cin;
using std::rand;
using std::srand;
int main()
{
KMP<char> *plist = new KMPlist<char>();
(*plist).append('a');
(*plis... | ALGO | 0.949584 | 4.011551 |
da4b8a79-3b03-41ce-939c-ae71ce8e024a | mahgulkhan/PD7 | 5op.cpp | #include <iostream>
using namespace std;
bool prime(int num);
int main()
{
int num;
cout << "Enter number: ";
cin >> num;
cout << prime(num);
}
bool prime(int num)
{
for (int number=2;number<num;number++)
{
if(num%number==0)
{
return false;
}
}
if ... | ALGO | 0.999399 | 3.514118 |
1ad63c9c-21a5-48b0-b10b-419f60868275 | jcaiced1/CIS054 | C++ Sum and Range Lab Assignment/C++SumAverageRange.cpp | // C++SumAverageRange.cpp
// CIS054 C/C++ Programming
// Jose Caicedo
// 03/26/2023
//
// Inputs: Enter 10 numbers
// Outpus: Sum of odd numbers, sum of even numbers, sum of all numbers
// lowest and highest number
#include <iostream>
#include <iomanip> // used to set 2 digits past the decimal
#include <cmath>
using... | ALGO | 0.994698 | 4.478205 |
76484d72-603a-434c-a327-dcf3098e17d3 | HekpoMaH/Olimpiads | grupa C/kontrolno2012/2012-06-14-JNacK2-tests&authors/C6-cakes/author/cakes.cpp | /*
Task: Cakes
Author: Petar Petrov
*/
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;
int sz, first_big, second_big, l, cn_first, cn_second, n;
string s = "", tmp1 = "", tmp2 = "";
vector <int> p;
void read ()
{
int n, i, num;
cin >> n;
for ( i = 0; i < n; i++... | ALGO | 0.999859 | 4.735664 |
733ee1fe-c5b2-49b9-845c-3b1a65aaca14 | gani0325/CppEmbedded | ProfessionalC++/solutions/Chapter6/6_2.cpp | // sum() 함수 중복 연습
#include <iostream>
using namespace std;
int sum(int a, int b)
{
int s = 0;
for (int i = 0; i <= b; i++)
s += i;
return s;
}
int sum(int a)
{
int s = 0;
for (int i = 0; i <= a; i++)
s += i;
return s;
}
int main()
{
cout << sum(3, 5) << endl;
cout << s... | ALGO | 0.99388 | 4.952298 |
1cda9250-e8c7-469e-a274-e6b7a9bf9480 | jadbassil/VisibleSimDemo | applicationsSrc/demoReconfC3D/demoReconfC3DCode.cpp | #include <climits>
#include "demoReconfC3DCode.h"
static const Cell3DPosition firstCell(4,2,0);
DemoReconfCode::DemoReconfCode(Catoms3DBlock *host):Catoms3DBlockCode(host),module(host) {
// @warning Do not remove block below, as a blockcode with a NULL host might be created
// for command line parsing
if... | TOOL | 0.974903 | 4.428058 |
e618e750-0b5f-4253-b894-40bc2d01ba33 | a-burlacu/CSCI-2421 | HW4/main.cpp | /********************************************
* This is the main driver function for the
* Doubly Linked List
*
* Author: Alina Burlacu
* Version: July 15, 2022
*********************************************/
#include <iostream>
#include "DoublyLinkedList.h"
using namespace std;
int main() {
//Initiate new l... | ALGO | 0.991706 | 5.553171 |
b82b9b29-9c7f-4ffb-82ff-991c28b24d12 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9285_5.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e18;
const int MX = 2e5 + 5;
int n;
int a[MX];
long long c, r;
long long res = 0;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (int i = (1); i <= (n); i++) cin >> a[i];
sort(a + 1, a + n + 1, g... | ALGO | 0.999954 | 4.292881 |
9fd1f0ac-016c-4b22-bdac-6e92507b64ee | Hasil-Sharma/leet-code | palindromic-substrings-iter.cpp | // https://leetcode.com/problems/palindromic-substrings/description/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int countSubstrings(string s) {
int n = s.length();
bool **p; // table to find if i to j is a palindrome
int **dp; // table to find number of palindrom... | ALGO | 0.999376 | 6.10428 |
129bc1d4-e4bb-4862-bf19-e7b82b37944e | egolgovskikh/ProgrammingCpp | Sonya/Sonya/main.cpp | #include <string>
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
string str="12 34 56";
istringstream ss(str);
int mas[100];
int n=0;
while(ss>>mas[n++])
;
n--;
for (int i = 0; i < n; i++)
cout<<mas[i]<<' ';
system("pause");
return 0;
}... | TOOL | 0.940962 | 3.224957 |
7492f8d0-df2a-41d6-a1c6-f1b93b983e17 | Kam-Sergei/PNRPU | 1 семестр/2_21/Код.cpp | #include <iostream>
#include<cmath>
using namespace std;
int a,b; //а,b-элементы последовательности.
int main()
{
setlocale(LC_ALL, "Rus");
cout << "Введи последовательность:" << endl;
bool found1 = false;
bool found2 = true;
cin >> b;
if (b == 0)
{
found1 = true;
}
while (found1 == false)
{
cin >> a;
... | ALGO | 0.999789 | 4.218392 |
1054379f-3396-49df-b853-90679c2f7f82 | ss5ssmi/OJ | codeforce/CF_985A.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n,s[100];
cin>>n;
for(int i=0;i<n/2;i++){
cin>>s[i];
}
sort(s,s+n/2);
int cnt1=0,cnt2=0,t=2;
for(int i=0;i<n/2;i++){
cnt1+=abs(s[i]-t);
t+=2;
}
t=1;
for(int i=0;i<n/2;i++){
cnt2+=abs(s[i]-t);
t+=2;
}
printf("%d\n",min(cnt1,cnt2));
retu... | ALGO | 0.999788 | 3.802185 |
4fb1ab32-2e06-4a29-87b2-3052bbd62571 | alexandraback/datacollection | solutions_6404600001200128_0/C++/climpet/A.cpp | #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include ... | ALGO | 0.9997 | 3.473237 |
3191c46d-50c1-441e-8637-3374a681b973 | developeSHG/Algorithm-Baekjoon_Programmers | 프로그래머스/unrated/154539. 뒤에 있는 큰 수 찾기/뒤에 있는 큰 수 찾기.cpp | #include <string>
#include <vector>
#include <stack>
using namespace std;
using p = pair<int, int>;
vector<int> solution(vector<int> numbers) {
vector<int> answer(numbers.size(), -1);
stack<p> st;
answer.resize(numbers.size());
for (int i = 0; i < numbers.size(); ++i)
{
while (!st.empty... | ALGO | 0.999996 | 5.328153 |
501de438-852d-4e7a-b4a5-709d88ab8a72 | hjlee6824/Problem-Solving | Baekjoon/11000~11999/11659/11659.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
int arr[100001];
int d[100001];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; ++i) {
cin >> arr[i];
d[i] = d[i - 1] + arr[i];
}
while (m--) {
int i, j;
cin >> i... | ALGO | 0.99998 | 4.898187 |
e6a3dea9-0550-424c-856b-6259db97247f | HPC-Programmer/vane | implementations/quartz103129/pclmulqdq/gf2ext-sse.cpp |
#include <stdint.h>
#include "gf2ext-sse.hpp"
/// gf2^103
/// X^103 + X^9 + 1
/// 103-64 = 39 --> X^142 + X^48 + X39
/// X^128 + X^34 + X^25
template <>
const uint32_t gf2ext_sse<103>::_mask_Wbit[4] __attribute__((aligned(16)))
= {0xffffffff,0xffffffff,0xffffffff,0x7f};
template <>
const uint64_t gf2ext_sse<103>... | CONFIG | 0.978379 | 3.107098 |
07355b94-c364-4df9-9c8f-d98c60fea458 | Tasmia-Chowdhury-Alif/XPSC-Batch---4-Problem-Solving-Club- | Week - 3/Day - 7/A_Compare_T_Shirt_Sizes.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
string a, b;
cin >> a >> b;
int xa = 0, xb = 0;
if (a[a.size() - 1] == 'L' or 'S')
{
xa = a.size() - 1;
}
if (b[b.size()... | ALGO | 0.999976 | 4.592091 |
a5a0bba9-fe2c-4b25-ae70-af615fe6bd2b | aman007-cpu/cppPlacement | function/arrays/string/cap.cpp | #include<iostream>
#include<string>
using namespace std;
int main(){
string str ="amanASDASFdsda";
for(int i=0;i<str.size();i++){
if(str[i]>='a' && str[i]<='z'){
str[i] -=32;
}
if(str[i]>='A' && str[i]<='Z'){
str[i] +=32;
}
}
cout<<str;
} | ALGO | 0.986356 | 4.245999 |
dd6fbce7-06cb-4970-a0e8-a9e1cc80e42f | Xnuvers007/Kuliah | semester 4/pert7/tugasakhir7.cpp | #include <iostream>
using namespace std;
void printArray(int arr[], int n) {
for (int i = 0; i < n; i++) {
cout << arr[i] << " ";
}
cout << endl;
}
void bubbleSortAscending(int arr[], int n) {
for (int i = 0; i < n - 1; i++) {
bool swapped = false;
for (int j = 0; j < n - i - ... | ALGO | 0.999947 | 5.321086 |
e996038f-736c-4441-b7a6-2183b1a4ad8c | nidhiupman568/C-PLUS-PLUS-PROBLEMS-SOLVED | Serialize and Deserialize Binary Tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Codec {
public:
// Encodes a tree to a single string.
string serialize(TreeNode* root) {
}
... | ALGO | 0.999544 | 6.118936 |
d15c4eeb-6d05-433c-9e0e-d0ae4713912d | PaimountLtd/open-source-vision-library | 3rdparty/carotene/src/reduce.cpp | #include "common.hpp"
#include <cstring>
namespace CAROTENE_NS {
void reduceColSum(const Size2D &size,
const u8 * srcBase, ptrdiff_t srcStride,
s32 * dstBase)
{
internal::assertSupportedConfiguration();
#ifdef CAROTENE_NEON
memset(dstBase, 0, size.width*sizeof(s32));
s... | ALGO | 0.996762 | 6.186884 |
a4d27c5e-99ca-4ea9-97b9-2e345d7a6f0b | Shashidhar99github/KARE100DAYCH | Day11C2.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int m;
cout <<"Enter the number: ";
cin >>m;
for(int i=1;i<=m;i++){
if(m%i==0){
cout << i <<" ";
}
}
return 0;
} | ALGO | 0.999606 | 3.440598 |
001fc8a8-a376-4e3d-943b-faef64fac0c2 | dooli1971039/Algorithm | DFS_BFS/BOJ_1325.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
//ٽ
vector<int> graph[10001];
vector<int> hacking;// ǻ ŷ ִ ǻ
//ŷ ŷڹ ݴ ̷
//c -> b -> a 尡 ־
//a ŷ ,b,c ŷ ϴ.
vector<int> visited;
int mmax = 0; // ŷ ִ ǻ
void dfs(int node) {
hacking[node]++; //ش 带 ŷ ǻ
mmax = max(hacking[node],... | ALGO | 0.999931 | 4.640051 |
647cbd7f-7e87-4387-9ceb-eed976ff5bd6 | dEsquilas/aoc2020 | boost_1_74_0/libs/spirit/classic/example/intermediate/ipv4.cpp | #include <boost/spirit/include/classic_core.hpp>
#include <boost/spirit/include/classic_push_back_actor.hpp>
#include <boost/spirit/include/classic_if.hpp>
#include <boost/spirit/include/classic_for.hpp>
#include <boost/spirit/include/phoenix1.hpp>
#include <iostream>
#include <string>
#include <vector>
#include <algor... | TOOL | 0.955229 | 6.156577 |
cac7b0a1-5d15-4fee-9cc7-4371929e0f34 | openeuler-mirror/openjfx8 | modules/web/src/main/native/Source/WebCore/rendering/updating/RenderTreeBuilderMultiColumn.cpp | #include "config.h"
#include "RenderTreeBuilderMultiColumn.h"
#include "RenderBlockFlow.h"
#include "RenderChildIterator.h"
#include "RenderMultiColumnFlow.h"
#include "RenderMultiColumnSet.h"
#include "RenderMultiColumnSpannerPlaceholder.h"
#include "RenderTreeBuilder.h"
#include "RenderTreeBuilderBlock.h"
#include "... | TOOL | 0.887676 | 7.638566 |
be62057c-8a09-412a-b0e0-5a5a233b0071 | hws2002/algorithm | boj/CPP/PrefixSum/25682/25682.cpp | #include <iostream>
#include <limits.h>
#define MAX_N 2'000
// #define DEBUG_PREFIX
using namespace std;
int N,M,K;
//'B' : 0, 'W" : 1
bool MAP[MAX_N][MAX_N] = {0};
int preSum[MAX_N+1][MAX_N+1] = {0};
int main(){
cin>>N>>M>>K;
char c;
for(int i = 0 ; i < N; i++){
for(int j = 0; j < M; j++){
... | ALGO | 0.999565 | 3.860852 |
2e6b5bd3-e68a-4acc-af00-3dd14a5d9dcd | moneypiaorui/MagicWand | libraries/Chirale_TensorFLowLite/src/tensorflow/lite/micro/kernels/logical_common.cpp | #include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/kernels/internal/reference/binary_function.h"
#include "tensorflow/lite/kernels/internal/tensor_ctypes.h"
#include "tensorflow/lite/kernels/op_macros.h"
#include "tensorflow/lite/micro/kernels/kernel_util.h"
#include "tensorflow/lite/micro/kernels/logical.... | TOOL | 0.95304 | 7.587815 |
dba9fa21-17eb-455a-9864-07638a1f1952 | geekonion/dyld-dyld-1042.1 | other-tools/dyld_closure_util.cpp | #include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <string.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/syslimits.h>
#include <mach-o/arch.h>
#include <mach-o/loader.h>
#include <mach-o/dyld_priv.h>
#include <bootstrap.h>
#include... | TOOL | 0.928065 | 6.828104 |
aeaf319a-d0cc-4aac-ba60-bd92ae878ffd | Amylo-jh/baekjoon | 14000s/14039.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
vector <vector <int>> arr(4, vector <int> (4));
for(int i = 0; i < 4; i++)
{
for(int j = 0; j < 4; j++)
{
cin >> arr[i][j];
}
}
int sum = arr[0][0] + arr[0][1] + arr[0][2] + arr[0][3];
... | ALGO | 0.999883 | 4.343144 |
9afef443-4049-4327-a2cd-57d87c42ad52 | deepin-community/llvm-toolchain-19 | libcxx/test/std/algorithms/alg.nonmodifying/alg.find/ranges.find_if_not.pass.cpp | // <algorithm>
// UNSUPPORTED: c++03, c++11, c++14, c++17
// template<input_iterator I, sentinel_for<I> S, class Proj = identity,
// indirect_unary_predicate<projected<I, Proj>> Pred>
// constexpr I ranges::find_if_not(I first, S last, Pred pred, Proj proj = {});
// template<input_range R, class Proj = ide... | TEST | 0.953072 | 7.376768 |
691d1d07-c03d-4898-905f-66bb573fdf70 | hyturing/Competitive-Programming | Codeforces/1680C.cpp | /**
* Author: hyturing
* Created: 30 May 2022 22:46:06 IST
**/
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9+7;
const int MM = 998244353;
const int N = 1e5+5;
const int INF = 1e18;
void solve() {
// code here
string s;
cin >> s;
int n = s.size();
vector<int> po... | ALGO | 0.999948 | 5.278369 |
722bc26c-0035-445f-a797-959c6d855115 | SaiSree-0517/becomecoder | eledel.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n, idx=-1, x;
cin>>n;
int arr[n];
for(int i=0; i<n; i++)
cin>>arr[i];
cin>>x;
for(int i=0; i<n; i++)
{
if(arr[i] == x)
{
idx = i;
break;
}
}
if(idx == -1)
{
... | ALGO | 0.999985 | 3.692837 |
7e2b5962-9901-49db-9924-2bc8b63e7c76 | chrisevett/LeetCode | 0709_To_Lower_Case/709.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
string toLowerCase(string s) {
for (int i = 0; i < s.size(); i++) {
if (s[i] >= 'A' && s[i] <= 'Z')
s[i] += 32;
}
return s;
}
};
int main() {
Solution a;
cout << a.toLowerCase("He... | ALGO | 0.911751 | 5.716637 |
9e01b695-89a0-4150-be06-a9059e57320a | Abhirai1/Leetcode | 0027-remove-element/0027-remove-element.cpp | class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int j=0;
for(int i=0;i<nums.size();i++){
if(nums[i]!=val){
nums[j++]=nums[i];
}
}
return j;
}
}; | ALGO | 0.999102 | 5.940022 |
4e538cd6-3645-42f1-8143-4706c484b9d8 | 101magikarp101/USACO | utpc-1-29-25/J.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD 998244353
#define MOD2 1000000007
#define vt vector
#define endl '\n'
#define pb push_back
#define pf push_front
#define all(x) x.begin(),x.end()
#define sz(x) (int)((x).size())
#define uset unordered_set
#define umap unordered_map
#define ... | ALGO | 0.999786 | 4.902209 |
3a1ccbec-3cdd-44c3-9d13-25e077d0aab9 | lanl/phoebus | src/geometry/boyer_lindquist.cpp | #include <array>
#include <cmath>
// Parthenon includes
#include <kokkos_abstraction.hpp>
// phoebus includes
#include "geometry/analytic_system.hpp"
#include "geometry/cached_system.hpp"
#include "geometry/geometry_defaults.hpp"
#include "geometry/geometry_utils.hpp"
#include "phoebus_utils/linear_algebra.hpp"
#inc... | TOOL | 0.928131 | 4.739557 |
146fb0cc-8b58-4b8e-9518-b0ace8c19ede | rajesh-gole/Leetcode-Array-Easy | 2114-maximum-number-of-words-found-in-sentences/2114-maximum-number-of-words-found-in-sentences.cpp | class Solution {
public:
int mostWordsFound(vector<string>& sentences) {
int res=0;
for(int i=0;i<sentences.size();i++){
// count length each sentence
int len = std::count(sentences[i].begin(), sentences[i].end(), ' ')+1;
res = max(res,len);
}
return res;
... | ALGO | 0.999951 | 5.933331 |
8be30242-9c7b-42bf-8f21-fd374328ea07 | juniors719/QXD-ED | aulas/novembro/BinarySearchTree/main.cpp | #include <iostream>
#include <sstream>
#include <string>
#include "bst.h"
using namespace std;
int main() {
BST t;
string skeys;
int k;
cout << "Digite as chaves separadas por espacos: ";
getline(cin, skeys);
stringstream ss{skeys};
while (ss >> k) t.add(k);
cout << "Menor chave: " ... | ALGO | 0.995492 | 4.183202 |
f22699eb-18a6-4495-ac7f-41fa5ded0997 | EducationalTestingService/python-zpar | src/zpar.lib.cpp | /****************************************************************
* *
* zpar.lib.cpp - a library that can be used by python *
* *
* Author: Nitin Madnani ... | DATA | 0.963379 | 5.682824 |
fdfd2690-b3fe-4a96-860e-222f96d3c4fb | Mizeva/2semestr | sem4_28_02_2.cpp | #include <iostream>
#include <chrono>
#include <random>
#include <fstream>
using namespace std;
int strat_a(int k, int n, int* numbers)
{
for (int i = 0; i < n; i++)
{
if (numbers[i] == k)
{
if (i != 0)
{
swap(numbers[0], numbers[i]);
ret... | ALGO | 0.998959 | 4.702822 |
6287b4e8-0478-49ec-868d-ddbb1cddb89d | ns-sck/LeetCode | 2524-largest-positive-integer-that-exists-with-its-negative/largest-positive-integer-that-exists-with-its-negative.cpp | class Solution {
public:
int findMaxK(vector<int>& nums) {
unordered_map<int, int> mp;
int ans = -1;
for (int i = 0; i < nums.size(); ++i) {
if (mp[-nums[i]]) ans = max(ans, abs(nums[i]));
++mp[nums[i]];
}
return ans;
}
}; | ALGO | 0.999968 | 5.465128 |
3e534883-f2f8-48a1-a67d-31e55ea0fd3f | Mameta29/zk-soc-main | libioplab/src/cubic_sim_Aurora.cpp | #include <cstdint>
#include <iostream>
#include <chrono>
#include <libff/algebra/curves/edwards/edwards_pp.hpp>
#include "libiop/snark/aurora_snark.hpp"
#include "libiop/relations/examples/r1cs_examples.hpp"
using namespace libiop;
using namespace std;
int main() {
libff::inhibit_profiling_info = true;
l... | ALGO | 0.929046 | 6.041962 |
cd5c481b-c981-4209-aba0-3d23a821d2f8 | noob-coder211/Coding_Practice | LC00050.cpp | class Solution {
public:
double pow(double y, long long int n)
{
cout<<n<<endl;
if(n == 1)
return y;
double val = pow(y, n/2);
if(n%2 == 0)
return val * val;
else
return y * val * val;
}
double myPow(double x, int n) {
... | ALGO | 0.999771 | 5.072418 |
0c77f6ad-9d8e-4906-aede-142daf3c2a34 | VDoring/CPP-My-Study-Functions | 초보자를 위한 C++ 200제/163.cpp | //163
//bitset ϱ, ڿ ȯ, ȯ
#include <iostream>
#include <bitset> //bitset ϱ include
#include <string>
using namespace std;
int main()
{
bitset<8> data1(1); //bitset 1 16 0x01 ʱȭѴ. ʱ 00000001 ̴.
bitset<8> data2(0x01);
cout << "data1 : " << data1 << endl; // bitset Ѵ. 00000001 Ȱ.
cout << "data2 : " << data2 <<... | TOOL | 0.896177 | 4.186552 |
1a445c25-7c57-44ba-a9c9-2184eaabfab9 | princethapa18/dsa | stackAndQueue/stockSpan.cpp | /* Week 02 15 Jan 2022
Stock Span problem
Example 1:
Input:
N = 7, price[] = [100 80 60 70 60 75 85]
Output:
1 1 1 2 1 4 6
Explanation:
Traversing the given input span for 100
will be 1, 80 is smaller than 100 so the
span is 1, 60 is smaller than 80 so the
span is 1, 70 is greater than 60 so the
span is 2 a... | ALGO | 0.999985 | 6.113066 |
a2903fce-fc35-4d8f-8c4a-41dfb2c0494f | yousleepwhen/APSS | problems/hanoi/hanoi.cpp | #include<cstdio>
#include<cassert>
#include<cstring>
#include<map>
#include<time.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
const int MAX_DISCS = 12;
int get(int state, int index) {
return (state ... | ALGO | 0.99874 | 4.374172 |
fa29bef5-2213-4bef-a077-8f80bed80a48 | ManojKumarPatnaik/Sr.SoftwareEngineerInterviewPrep | 12]. CodeChef/3]. Compete/1]. Long Challenge/Div 3/May/VPATH.cpp | /*
You are given a tree with N nodes numbered from 1 to N. A set S of nodes is called valid if there exist two vertices u and v (possibly, u=v) such that every node in S
lies on the simple path from u to v. Count the number of valid sets modulo 109+7. Two sets are different if one node is included in one set and not i... | ALGO | 0.999794 | 5.709401 |
ddbe4db9-03c4-46f9-b322-80c4cc611623 | raincross7/code-similarity | codes/train_code/problem459/problem459_457.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
long long res = 0;
if (n % 2 == 0) {
long long tenth = 5;
long long counter = 0;
while (tenth <= n) {
res += n / (long long)pow(5,counter)/10;
tenth *= 5;
counter++;
}
}
cout << res << endl;
return 0;
} | ALGO | 0.999721 | 4.089175 |
bc925722-95bb-45f1-a32a-005d894a5d90 | CharlesChou03/practice | c/bitwise/byteSwapping.cpp | #include <stdio.h>
#include <stdlib.h>
int main() {
short int a = 0x1234;
short int b = 0x3412;
a = ((a & 0xff00) >> 8) + ((a & 0x00ff) << 8);
if (a == b) {
printf("byte swap success!");
}
} | ALGO | 0.889817 | 3.604788 |
0ed3b10a-49d2-42fc-90e3-f4a57fc1bde2 | italocoin-project/italocoin-old | tests/performance_tests/main.cpp | #include <boost/regex.hpp>
#include "common/util.h"
#include "common/command_line.h"
#include "performance_tests.h"
#include "performance_utils.h"
// tests
#include "construct_tx.h"
#include "check_tx_signature.h"
#include "cn_slow_hash.h"
#include "derive_public_key.h"
#include "derive_secret_key.h"
#include "ge_fro... | TEST | 0.862127 | 6.189036 |
4e64670a-4185-4312-9922-bac10d694ad6 | shimaahamdy/competitive-programming | 11231/main.cpp | #include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int n=0,m=0,mod=0;bool c;
while(cin>>n>>m>>c)
{
if(n==0&&c==0&& c==0)break;
else
{
long long int p=(n-7)*(m-7);
if(p%2!=0 && c==... | ALGO | 0.999575 | 3.201911 |
d57ae886-7a94-44cb-9e87-69b065c143e7 | HammadAhmedQureshi/DSA-Data-Structure-and-Algo- | Stack.cpp | #include <iostream>
using namespace std;
const int stackSize = 5;
class Stack{
private:
int top;
char arr[stackSize];
public:
Stack(){
top = -1;
}
void push(int value){
if (top+1 >= stackSize){
cout<<"Stack Overflow"<<endl;
}else{
top = top + 1;
arr[top] = value;
}
}
int pop( ){
... | ALGO | 0.998064 | 4.699305 |
247194fc-a171-46bb-bcd1-24c739892ef3 | shelltdf/osgall | prebuild/boost_1_82_0/libs/mpi/example/random_content.cpp | // An example using Boost.MPI's skeletons and content to optimize
// communication.
#include <boost/mpi.hpp>
#include <boost/serialization/list.hpp>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iostream>
#include <stdlib.h>
namespace mpi = boost::mpi;
int main(int argc, char* argv[])
{
mpi... | ALGO | 0.981385 | 4.402016 |
379923ff-8715-4dbe-a039-b02658c84b21 | vridhipuri/Data-Structures-and-Algorithms | 179.cpp | //Diameter of a Binary Tree
//{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
/* A binary tree node has data, pointer to left child
and a pointer to right child */
struct Node {
int data;
struct Node* left;
struct Node* right;
};
Node* newNode(int val) {
Node* temp = new Node;
... | ALGO | 0.999449 | 6.70163 |
bfff39ef-6efc-47b4-8ed0-a66754468223 | ishandutta2007/codeforces | denisson/normal/1045/D.cpp | #include <bits/stdc++.h>
#define ll long long
#define TASKNAME ""
using namespace std;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 7;
const double EPS = 1e-8;
int n;
vector<vector<int> > data;
vector<double> my, sons, f;
void dfs(int vertex, int last){
f[vertex] = last;
for (int i=0; i < data[vertex].size... | ALGO | 0.999905 | 3.875216 |
fccca2f2-8a1d-43cd-8f97-97eb996a8ef1 | noob-coder211/Coding_Practice | LC00448.cpp | class Solution {
public:
vector<int> findDisappearedNumbers(vector<int>& nums) {
int n = nums.size();
vector<int>present(n+1, 0);
for(int num: nums)
{
present[num] = 1;
}
vector<int> ans;
for(int i=1;i<=n;i++)
{
if(present[i] =... | ALGO | 0.999354 | 5.125047 |
a5446f00-5999-4f46-9c1e-8fbb56d32cfa | calichii/Backtraking-Algorithm-for-Sudoku | main_visualization.cpp | #include <iostream>
#include "Sudoku.hpp"
#include <chrono>
using namespace std;
int main () {
// Time control variables:
auto t1_g = std::chrono::high_resolution_clock::now();
auto t2_g = std::chrono::high_resolution_clock::now();
auto duration_g = std::chrono::duration_cast<std::chrono::microseconds>( t2_g - ... | ALGO | 0.994514 | 3.463541 |
83a52854-7bc8-4161-a38c-b8d202822c14 | Santhosh-12345/Leetcode | 1250-longest-common-subsequence/1250-longest-common-subsequence.cpp | class Solution {
public:
int longestCommonSubsequence(string text1, string text2) {
int n=text1.size(),m=text2.size();
vector<vector<int>>dp(n+1,vector<int>(m+1,0));
for(int i=n-1;i>=0;i--)
{
for(int j=m-1;j>=0;j--)
{
if(text1[i]==text2[j])
... | ALGO | 0.999939 | 6.341595 |
891116df-7a93-4724-945c-17eb6dc0cda9 | alirazabugti1/Neetcode-150 | Stack/Two Sum 2.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& numbers, int target)
{
vector<int> allnumbers;
int left=0;
int right=numbers.size()-1;
while(left<right)
{
int sum=numbers[left]+numbers[right];
if(sum==target)
{
... | ALGO | 0.999797 | 6.230019 |
113922ab-46c6-44ab-a17e-bf0d0a77f935 | KitauraHiromi/atcoder | ABC152/d.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 200001
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--... | ALGO | 0.999607 | 4.377537 |
5172abe2-ebe9-40f4-a9da-aca2272add31 | Srinadhch07/General | LargestNumber3.cpp | //Written by SRINADHCH07
// CODE : FINDING LARGEST AMONG 3 NO.
#include<iostream>
using namespace std;
int main()
{
int i,m,a[3];
cout<<"Enter 3 Digits:\n";
for(i=0;i<3;i++)
{
cin>>a[i];
}
m=a[0];
for(i=0;i<3;i++)
{
if(a[i]>m)
m=a[i];
}
cout<<"The largest No. "<<m;
return 0;
}
#c++
| ALGO | 0.998399 | 3.530308 |
8f15e4dd-dbf3-4514-a108-325f5539d06f | pkini2002/DSA | Patterns1/Floyd's triangle/main.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter the value of n:"<<endl;
cin>>n;
int count=1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
cout<<count<<" ";
count++;
}
cout<<endl;
}
return 0;
}
| ALGO | 0.999548 | 3.65927 |
13705fe1-49d9-45c2-9d80-0295afcd8bde | HarudaySharma/DSA | Array/codequotient/last_module/mergeLinkedLists.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node *next;
Node(int d) {
data = d;
next = nullptr;
}
};
class LinkedList {
Node *head;
public:
LinkedList() {
head = nullptr;
}
Node* getHead(){return hea... | ALGO | 0.99986 | 5.105763 |
4a970703-ac03-42e5-99c4-06f544d70ed3 | sethcalebweeks/exercism | cpp/pacman-rules/pacman_rules.cpp | // eat_ghost returns a boolean value if Pac-Man is able to eat the ghost.
// The function should return true only if Pac-Man has a power pellet active
// and is touching a ghost.
bool can_eat_ghost(bool power_pellet_active, bool touching_ghost) {
return power_pellet_active && touching_ghost;
}
// score returns a b... | TOOL | 0.958798 | 4.217741 |
69494852-9ccc-4952-b082-1169294cdd31 | ishandutta2007/codeforces | kobus/normal/220/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define int long long
typedef long long ll;
typedef pair<int,int>pii;
#define MAXN 1123456
#define INF INT_MAX/2
#define MOD 1000000
int v[112345];
int vor[112345];
int32_t main(){
ios::sync_wit... | ALGO | 0.999979 | 3.799221 |
87e39823-548d-4d91-bca0-6928a4d042ee | sumanitian/DSA | Array/3_LargestNumber.cpp | #include<iostream>
using namespace std;
int main()
{
int arr[6] = {6, 5, 3, 11, 2, 7};
int largest = arr[0];
for(int i = 1; i < 6; i++){
if(arr[i] > largest){
largest = arr[i];
}
}
cout<<largest;
return 0;
} | ALGO | 0.99111 | 3.297884 |
0572599c-317f-44e9-95aa-9ad2c34b992d | ph4nt0mgui1d/Learning-DSA | Sorting/2typesofElements.cpp | /*
you need to segregate an array of elements containing two types of elements. The types are:
Segregate negative and positive elements.
Segregate even and odd elements.
Sort a binary array.
this is basically a application of partition algorithms
*/
// naive code (naive partition) does 3 traver... | ALGO | 0.999986 | 5.151856 |
a8461643-f726-467e-96d5-714c2f075796 | mccormeg/CS-161 | labs/lab2/cereal.cpp | #include<iostream>
using namespace std;
int main()
{
float cereal_weight;
float weight_ton;
float boxes;
cout << "Enter the weight (in ounces) of a box of cereal: " << endl;
cin >> cereal_weight; //cereal_weight contains input
weight_ton = (cereal_weight/35273.92);
cout << "The weight of a box of cereal... | TOOL | 0.930931 | 4.56892 |
b74d6ddc-99f8-4580-99eb-be6da1a4ed43 | Alex-DLQ/Data_Struct | avance5/programa7.cpp | //C2:P2 // 3.3
// 4. Optimización de Búsqueda en un Array
#include <bits/stdc++.h>
using namespace std;
int main() {
// Leer entrada una vez
int n, x;
cin >> n >> x;
vector<int> a(n);
for (int& y : a) cin >> y;
// Búsqueda normal O(n)
{
bool ok = false;
for (int i = 0; i < ... | ALGO | 0.999954 | 4.615197 |
b7f0e51e-8861-4df1-a92a-6e2850e9f445 | Hitesh-s0lanki/DSALeetcode | All Sorting/Selecton_Sort.cpp | #include<iostream>
#include<vector>
using namespace std;
void selectionSort(vector<int> &a){
int n=a.size();
for(int i=0;i<n-1;i++){
for(int j=i+1;j<n;j++){
if(a[i]>a[j]){
swap(a[i],a[j]);
}
}
}
}
int main(){
vector<int> a={4,2,3,1,3,2};
selec... | ALGO | 0.999944 | 4.540187 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.