uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0a091716-1530-49b4-8909-7cecad598263 | Alaxe/noi2-ranking | 2019/solutions/A/AJV-Sofia/trams.cpp | #include<iostream>
#include<map>
#include<vector>
#include<stack>
using namespace std;
long long n,m,f=0,a,b;
bool u[100001];
vector<long long>sys[100001];
map<pair<long long,long long>,long long>number;
vector<long long>NaTovaRebro[100001];
vector<long long>fR;
map<pair<long long,long long>,bool>used;
stack<long long>... | ALGO | 0.99997 | 3.925225 |
93a4a43e-5124-4718-acc9-d4172b38af93 | mortie/llvm | libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp | // <random>
// template<class RealType = double>
// class fisher_f_distribution
// template<class _URNG> result_type operator()(_URNG& g);
#include <random>
#include <cassert>
#include <vector>
#include <algorithm>
#include <cmath>
#include "test_macros.h"
double fac(double x)
{
double r = 1;
for (; x > 1;... | TEST | 0.970533 | 4.490033 |
13b704b0-d0ac-4c6d-9f4b-21fad694b2f9 | ZXPrism/CP-Solutions | LeetCode/1475.cpp | class Solution {
public:
vector<int> finalPrices(vector<int> &prices) {
int n = prices.size();
std::stack<int> s;
std::vector<int> ans = prices;
for (int i = n - 1; i >= 0; i--) {
while (!s.empty() && prices[i] < prices[s.top()]) {
s.pop();
}
... | ALGO | 0.999961 | 6.192638 |
a54632cb-041f-4d2f-b724-1fb580cc9eed | preetcoder12/DSA-Mastery | Sorting/selection_sort.cpp | #include <iostream>
using namespace std;
int main()
{
int A[5] = {20, 12, 34, 456, 546};
for (int i = 0; i < 5; i++)
{
int min = i;
for (int j = i + 1; j < 5; j++)
{
if (A[min] > A[j])
{
min = j;
}
}
if (min != i)
... | ALGO | 0.999836 | 3.440046 |
8e0e476e-770e-4831-be54-ffca3e02049b | wxxk/ALGORITHM-CPP | BakingDog/0x01강_시간복잡도와 기초 지식 연습문제_구버전/2562.cpp | #include <bits/stdc++.h>
using namespace std;
//vector<int> num;
//int n = 9;
//int input;
//
//int max_index;
//
//int main() {
// for (int i = 0; i < n; i++) {
// cin >> input;
// num.push_back(input);
// }
//
// int max = num[0];
// for (int i = 1; i < n; i ++) {
// if (num[i] > max) {
// max = num[i];
// m... | ALGO | 0.999951 | 4.198193 |
3dd692b3-157d-4121-b4ee-af1643cdfb45 | Qazaq159/pp1 | lab7/b.cpp | #include<iostream>
#include<string>
using namespace std;
string s = "";
string bin(int n){
if(n == 0)
return s;
s = char(n % 2 + 48) + s;
return bin(n/2);
}
int main(){
int n;
cin >> n;
cout << bin(n);
} | ALGO | 0.999883 | 4.861379 |
3422e413-de69-4da3-abd3-20f294d59235 | Malvika18/CPP_Dev | passing 2D array.cpp | #include<iostream>
using namespace std;
int M=3;
int N=3;
int print(int arr[3][3])
{
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
cout<<arr[i][j]<<endl;
}
}
}
int main()
{
int arr[3][3] = {{1,2,3},{4,5,6}};
print(arr);
return 0;
}
| ALGO | 0.979814 | 3.626267 |
5c4b6117-983a-4663-a201-c3b0e0b99dfe | shaheerbeig/Queue | queueonLL.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node *next;
Node(int data){
this->data = data;
next = NULL;
}
};
class Queue{
public:
Node *rear;
Node *front;
Queue(){
rear = front = NULL;
}
void enqueue(int data){
N... | ALGO | 0.999578 | 4.674268 |
6fbee027-ff6b-4bf4-aee5-4db0993ff6c7 | piyush1146115/Competitive-Programming | Code forces/Educational Codeforces Round 37/B.cpp | /*
* FILE: B.cpp
*
* @author: Piyush Kanti Das <piyush123kantidas[at]gmail[dot]com>
*
* LINK:
*
* DATE CREATED: 08.02.2018 17:21:38 +06
*
* DESCRIPTION:
*
* DEVELOPMENT HISTORY:
* Date Version Description
* --------------------------------------------------------------
* 08-02-2018 1.0 ... | ALGO | 0.999938 | 4.573493 |
11d0ba83-992c-46d8-832b-eaac7cc7cebd | SaCHiMiJi/Work_Linux | com pet/mini_contest/13.cpp | #include <bits/stdc++.h>
using namespace std;
void findMin(long long V, vector<long long>& denomination)
{
sort(denomination.rbegin(), denomination.rend());
vector<long long> ans;
for (long long i = 0; i < denomination.size(); i++) {
while (V >= denomination[i]) {
ans.push_back(denomin... | ALGO | 0.999954 | 3.754846 |
ef45225d-bb89-4e38-8b36-8aa92cdd345f | junwha/ACMICPC | 15650.cpp | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int seq[8] = {};
int N, M;
void printSeq(int n, int lv){
if(lv==M){
for(int i=0; i<M; i++) cout << seq[i] << ' ';
cout << '\n';
return;
}
for(int i=n; i<=N; i++){
seq[lv] = i;
printSeq(i... | ALGO | 0.999968 | 3.458974 |
7bd8cf0a-9d16-47d6-8550-74ed9469d6a1 | tmasmaliyev/Design-Of-Algorithms | Week 1/10.1.cpp | #include <stdio.h>
const int CUSTOMMOD = 9929;
int extendedGCD(int a, int b, int* x, int* y) {
if (b == 0) {
*x = 1;
*y = 0;
return a;
}
int gcdVal = extendedGCD(b, a % b, x, y);
int x_temp = *x;
*x = *y;
*y = x_temp - (a / b) * (*y);
return gcdVal;
}
int comb... | ALGO | 0.999977 | 4.971673 |
8ca0e797-43ff-4928-b19b-d3e2764340e0 | Rubicsoft/osn_cpp_practice | Source/Searching/LinearSearch/linearSearch.cpp | /*
LINEAR SEARCH
Date : May 14, 2025
*/
#include <iostream>
// #include <array>
int linearSearch(int array[], int size, int target);
// std::array<int, 9> rawData = {2, 3, 6, 4, 7, 8, 5, 1, 9};
int rawData[9] = {2, 3, 6, 4, 7, 8, 5, 1, 9};
int main() {
std::cout << "LINEAR SEARCH by Reymo Je" << std::e... | ALGO | 0.999317 | 4.639586 |
a957ad06-fb66-4196-bc7d-9b14024a1f8f | Malkeet786/Striver_AtoZ_DSA | Binary Search/Easy/numberofoccurance.cpp | class Solution{
public:
/* if x is present in arr[] then returns the count
of occurrences of x, otherwise returns 0. */
int find(int arr[],int l,int h,int x)
{
int ind=-1;
while(l<=h)
{
int mid=(l+h)/2;
if(arr[mid]<=x)
{
ind=max(ind,mid);
... | ALGO | 0.999975 | 5.789582 |
24fb8065-1459-4578-8e6d-b7f004bb72cb | ishandutta2007/codeforces | kal013/normal/1372/D.cpp | /*/ Author: kal013 /*/
// #pragma GCC optimize ("O3")
#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;
template<class T>
using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update> ... | ALGO | 0.999994 | 4.216352 |
1784e2a0-30ab-4f2f-8322-076dc851e3cd | HaxiSnake/EXERCISE | leetcode/answer/235.二叉搜索树的最近公共祖先.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:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
return LCA(roo... | ALGO | 0.999971 | 6.301589 |
bac54fe8-7041-4279-a073-d566e961f25e | arzhangrafii/perf_monitor | hls/packet_counter.cpp | #include "hls_stream.h"
#include "ap_int.h"
struct gulf_axis {
ap_uint<512> data;
ap_uint<64> keep;
ap_uint<16> dest;
ap_uint<1> last;
};
void packet_counter (
hls::stream <gulf_axis> in_stream,
ap_uint <1> measure, //used to start and stop measurements
ap_uint <64> &bandwidth,
ap_uint <64> &packet_size,
... | TOOL | 0.858642 | 4.144923 |
5b579431-687f-4b9d-9284-f6959f1684bb | ishandutta2007/codeforces | se1ka2/normal/1530/B.cpp | #include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--){
int h, w;
cin >> h >> w;
int ans[22][22];
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++) ans[i][j] = 0;
}
for(int j = 0; j < w; j += 2) ans[0][j] = ans[h - ... | ALGO | 0.999828 | 3.213759 |
97402a82-25d2-4b50-bf4d-82a99cb7051b | zjxjwxk/PAT | C++/Basic Level/B1022.cpp | #include <cstdio>
int main() {
int a, b, d;
scanf("%d %d %d", &a, &b, &d);
int sum = a + b;
int num[31];
int i = 0;
do {
num[i++] = sum % d;
sum /= d;
} while(sum != 0);
for (i = i - 1; i >= 0; i--) {
printf("%d", num[i]);
}
return 0;
}
| ALGO | 0.999955 | 3.759242 |
f11ac0d8-8349-4ba7-a780-f78a51b48881 | billhsu/hexapod-sim | bullet3/src/Bullet3OpenCL/BroadphaseCollision/b3GpuGridBroadphase.cpp |
#include "b3GpuGridBroadphase.h"
#include "Bullet3Geometry/b3AabbUtil.h"
#include "kernels/gridBroadphaseKernels.h"
#include "kernels/sapKernels.h"
//#include "kernels/gridBroadphase.cl"
#include "Bullet3OpenCL/Initialize/b3OpenCLUtils.h"
#include "Bullet3OpenCL/ParallelPrimitives/b3LauncherCL.h"
#define B3_BROADPHA... | ALGO | 0.971649 | 6.278336 |
464335fe-da07-4923-b948-d3f34a953803 | Shaqundalond/AoC2020 | Reinhard/AoC-05/src/AoC-05.cpp | /**
* @file AoC-05.cpp
* @author Reinhard Pfaff
* @brief AoC Puzzle 2020 #05
* @version 0.1
* @date 2020-12-05
*
* @copyright Copyright (c) 2020
*
*/
#include "AoC.h"
using namespace std;
#include "AoC-Tools.h"
// Fcuntion declarations
int Puzzle_5(const vector<string> &vs, int iPuzzle);
bool CheckForKeyO... | ALGO | 0.995061 | 5.370507 |
0cdc35fe-a40b-4f2d-910d-447fbcd7ffb2 | NSchertler/GeneralizedMotorcycleGraph | ext/libigl/igl/point_simplex_squared_distance.cpp | template <
int DIM,
typename Derivedp,
typename DerivedV,
typename DerivedEle,
typename Derivedsqr_d,
typename Derivedc,
typename Derivedb>
IGL_INLINE void igl::point_simplex_squared_distance(
const Eigen::MatrixBase<Derivedp> & p,
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<Deriv... | ALGO | 0.999776 | 6.450988 |
d2d6e87e-9bbb-4fde-b586-54121701b85e | paolo-torres/interview-prep | leetcode/all/all/remove_duplicates_from_sorted_list.cpp | /*
Given head of sorted linked list, delete all duplicates
Ex. head = [1,1,2] -> [1,2]
Compare adjacent nodes, remove by changing prev->next ptr
Time: O(n)
Space: O(1)
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(... | ALGO | 0.999885 | 6.18344 |
1e6723a9-3f50-4cb1-b64d-19f3cb6ea53b | muj123-fastpwr/Codes | OpenMp/Matrix Multiplication.cpp | #include <stdio.h>
#include <omp.h>
#define SIZE 4000
double A[SIZE][SIZE];
double B[SIZE][SIZE];
double C[SIZE][SIZE]={{0}};
int main()
{
int t, u;
for (t = 0; t < SIZE; t++) {
for (u = 0; u < SIZE; u++) {
A[t][u] = B[u][t] = 1;
}
}
double start_time = omp_get_wtime();
int tid;
#pragma omp parallel nu... | ALGO | 0.999391 | 3.337172 |
1a51581d-9bf1-4b11-8e7c-3dded34e4529 | hhhnnn2112/NOI-ACcode-Explanation | Explanation2/P5709.cpp | #include<bits/stdc++.h>
using namespace std;
int m,t,s,a;
int main()
{
cin>>m>>t>>s;
if(t==0)
{
cout<<0;
return 0;
}
a=m-ceil((double)s/t);
cout<<max(a,0);
return 0;
}
| ALGO | 0.999858 | 3.475252 |
f6ffe246-5855-4999-9cda-bf5fd1f77bb8 | gurkiratsingh-1/hacktoberfest2020 | odd_num.cpp | using namespace std;
int main() {
int i, n;
// Take input from user.
cout << "Print all odd numbers till : ";
cin >> n;
cout << endl << "Odd numbers from 1 to " << n << " are : " << endl;
for(i = 1; i <= n; i++) {
// Check for odd or not.
if((i % 2) != 0) {
cou... | ALGO | 0.959136 | 4.3743 |
781e1cd0-128c-4782-bddf-ef655c26f4a7 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4180_2.cpp | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 1e18;
inline int readint() {
int x = 0, s = 1, c = getchar();
while (c <= 32) c = getchar();
if (c == '-') s = -1, c = getchar();
for (; isdigit(c); c = getchar... | ALGO | 0.999966 | 3.350533 |
6b3e7039-582d-4db4-ab97-e281d9323ee2 | Badoum92/AdventOfCode | 2023/src/day1.cpp | #include "common.h"
using Input = std::vector<std::string>;
Input parse_input(const char* path)
{
return input_to_lines(path);
}
uint64_t step1(const Input& input)
{
uint64_t total = 0;
for (const auto& line : input)
{
char first = 0;
for (auto it = line.begin();; ++it)
{
... | ALGO | 0.995142 | 6.06755 |
4241ee83-8b51-46da-8c07-7b1e7189ab83 | vincent-tr/rpi-js-os | ext/libcxx-5.0/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp | // <algorithm>
// template<InputIterator Iter, Callable<auto, Iter::reference> Function>
// requires CopyConstructible<Function>
// Function
// for_each(Iter first, Iter last, Function f);
#include <algorithm>
#include <cassert>
#include "test_iterators.h"
struct for_each_test
{
for_each_test(int c) : cou... | TEST | 0.976485 | 6.755924 |
0bb7d93e-dc46-4ff0-be24-cc9e188a6456 | krishna9809/DSA-with-cpp | Day026/Questions/3rd.cpp | // 1346. Check If N and Its Double Exist
class Solution {
public:
bool checkIfExist(vector<int>& arr) {
for(int i = 0; i< arr.size(); i++){
for(int j = i+1;j<arr.size();j++){
if(arr[i] == 2*arr[j] || arr[j] == 2*arr[i]){
return true;
}
... | ALGO | 0.999326 | 5.888086 |
89991f7d-e851-40aa-98b2-20d9bf2f8abc | JustJie2002/Leetcode | Contest/W413/B.cpp | /********************************************
* author : Jie Chen (4th Year CS)
* school : Rochester Institute of Technology
* created: 09.06.2024 01:36:30
*********************************************/
using i64 = long long;
class Solution {
public:
vector<int> resultsArray(vector<vector<int>>& queries, int k... | ALGO | 0.999969 | 5.957926 |
d9979bf7-c9a0-4d7f-a8dc-9d68e302628e | soursin/LeetCode-Submission | lc-2692.cpp | class Solution {
public:
long long countSubarrays(vector<int>& nums, int k) {
int i=0,j=0,n=nums.size();
int target=*max_element(nums.begin(),nums.end());
long long cnt =0;
long long res=0;
for(;i<n;i++){
if(nums[i] == target){
... | ALGO | 0.999974 | 5.833101 |
a9cca0d4-f80f-4c5e-b334-6184e562ce84 | sadid369/provider_overview_02 | 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.998693 | 6.797273 |
a426a0ca-fbb9-4bb1-b207-f57847308e23 | fingerchips9/DSA-supreme-3.0 | 04 Complete Cpp STL/Containers/Priority Queue/max_heap.cpp | #include<iostream>
#include<queue>
using namespace std;
int main(){
//creation
priority_queue<int> pq;
//max-heap -> highest priority ->maximum value
//insertion
pq.push(10);
pq.push(25);
pq.push(55);
pq.push(21);
//top() -> highest priority element
cout<<pq.top()<<endl;
... | ALGO | 0.980037 | 4.247639 |
69811a93-f36e-49e9-be1a-fa3e1265d286 | jayadevgh/Algorithms | Misc/VirtualContest/SubstringAndSubsequence/SubstringAndSubsequence.cpp | #include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int mod = (1e9)+7;
char s[5005], t[5005];
int a[5005][5005], i, j, ans;
int dp[5003][5003];
int main() {
//Console
ios::sync_with_stdio(false);
cin.tie(nullptr);
//string s, t;
cin >> s >> t;
// int i, j;
// for(i ... | ALGO | 0.999988 | 4.923421 |
c4217d2c-073e-4541-b39c-c44f76dc2edf | david4u/AlgoICPC | Else/1003/tempCodeRunnerFile.cpp | #include <iostream>
using namespace std;
int N;
int T;
int dp[41];
int main() {
dp[0] = 0;
dp[1] = 1;
dp[2] = 1;
for (i = 3; i <= 40; i++) {
dp[i] = dp[i-1] + dp[i-2];
}
cin >> T;
while (T--) {
cin >> N;
cout << dp[N-1] << " " << dp[N] << '\n';
}
} | ALGO | 0.999855 | 4.270257 |
5f3814aa-a4ef-49a5-b208-b81d868bbed1 | wandin/Cpp-Data-Sctructures-and-Algorithms | Queue/Queue_ADT.cpp | // Queue ADT - using abstract Data Type
#include <iostream>
using namespace std;
template<class T>
class Queue
{
private:
int Front, Rear, Size, Len;
T* Q;
public:
Queue(int s); // constructor
~Queue() { delete [] Q; } // destructor
void Enqueue(T);
void Dequeue(T&);
bool Find(int, T&);
int Search... | TOOL | 0.944833 | 4.530025 |
90ca8d55-0c66-4872-9e6f-272c46c89abc | ishandutta2007/codeforces | geothermal/normal/1325/E.cpp |
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typede... | ALGO | 0.99987 | 3.910779 |
e76b198d-f598-49a4-b139-2fc6a6bf9b54 | mir183/CodeForces | 183Can I Square/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define endl '\n'
#define fasterio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
int main() {
fasterio;
// Your code here
// Al... | ALGO | 0.997021 | 4.767497 |
8202ff2e-4cb2-48e9-bcf6-3a17b6b1b414 | mmatrosov/FKN2020 | preliminary/D/33908187.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <fstream>
#include <iomanip>
#include <set>
#include <math.h>
#define ll long long
#define ld long double
using namespace std;
struct vec {
ll x;
ll y;
vec(){}
vec(ll x, ll y) : x(x), y(y){}
};
v... | ALGO | 0.999841 | 3.404569 |
ca3bea59-7bef-4114-89fa-9eb876f427aa | ayushmaan02/DSA_CPP-Progress | OOPs/OperatorOverloading.cpp | #include<iostream>
using namespace std;
class B
{
public:
int a, b;
int add()
{
return a+b;
}
void operator + (B &obj)
{
int value1 = this->a;
int value2 = obj.a;
cout<<"Value after overloading = "<< value2 - value1 << endl;
}
};
int main()
{
B obj... | TOOL | 0.889222 | 4.588583 |
4574e099-c26c-4523-b1ad-62a6d85cc849 | Hengle/client-tools | src/engine/shared/library/sharedGame/src/shared/object/GroupPickupPoint.cpp | #include "sharedGame/FirstSharedGame.h"
#include "sharedGame/GroupPickupPoint.h"
#include "sharedGame/TravelManager.h"
#include "sharedMath/Vector.h"
#include "sharedObject/Object.h"
#include <map>
// ======================================================================
bool GroupPickupPoint::isGroupPickupAllowedA... | ALGO | 0.86983 | 6.289688 |
66ce7cfc-6d62-41dc-aaff-f5e234506cc9 | Certseeds/CS203_DSAA_template | algorithm/array/leetcode_56.cpp | #include "leetcode_56_test.hpp"
namespace leetcode_56 {
vector<vector<int32_t>> leetcode_56::merge(const vector<vector<int32_t>> &intervals) {
vector<vector<int32_t>> nums{intervals};
const size_t nums_size{nums.size()};
if (nums_size <= 1) {
return nums;
}
std::sort(std::begin(nums), std:... | ALGO | 0.999695 | 6.012136 |
03819e62-519c-4ae1-8555-98fb507a48cc | Jneror/EstructuraDeDatos | clase1/4-condicionales.cpp | #include <iostream>
#include <cstdio>
using namespace std;
//if else
int main() {
cout << "Insert a number: ";
int num;
cin >> num;
//check parity
if (num % 2 == 0) {
cout << num << " is even\n";
}
else {
cout << num << " is odd\n";
}
//check sign
if (num > 0) {... | ALGO | 0.999094 | 3.76869 |
ce16fbd1-927c-4dcd-951d-d7a1f23498f8 | IsratTasnimEsha/Algorithms | Time Complexityy/Merge_Sort.cpp | #include <bits/stdc++.h>
using namespace std;
int cnt=0;
void _merge(int a[], int p, int q, int rr)
{
int n1 = q - p + 1;
cnt++; //n1
int n2 = rr - q;
cnt++; //n2
int l[n1], r[n2], i=0, j=0;
cnt+=2; //i=0, j=0
for (; i < n1; i++)
{
cnt+=2; //i<n1, i++
l[i] = a[i + p];
... | ALGO | 0.999965 | 4.498072 |
ce4f71a0-e6f3-4123-86fe-135c263322a3 | GrootTheDeveloper/OLP-ICPC | 800+BAI_CODE_HAY/Code/seq__.cpp | #include <bits/stdc++.h>
using namespace std;
long long a[100005], lef[100005], rig[100005];
signed main()
{
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n; cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
lef[1] = a[1];
for (int i = 2; i <= n; i++)
lef[i] = max(lef[i - 1], a[i]);
rig[n]... | ALGO | 0.999919 | 3.977138 |
14e2fbe9-e10d-4050-b28a-83d3019d7652 | Mootikins/kattis | reverseRot/reverseRot.cpp | #include <bits/stdc++.h>
int main( int argc, char *argv[] ) {
std::string set = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_.";
int rotate;
while ( std::cin >> rotate && rotate != 0 ) {
std::string pre;
std::cin >> pre;
for ( int i = pre.length() - 1; i >= 0; --i ) {
std::cout << set.at( ( set.find( pre.at( i ) ) + rotate... | ALGO | 0.999124 | 4.609244 |
9077b128-f9b8-47d5-a3e3-aaf053fc0dd4 | ManishxNinja/DSA-Code | Graph/LCS.cpp | #include<bits/stdc++.h>
using namespace std;
int max(int a, int b)
{
if (a > b)
return a;
else
return b;
}
int rLCS(int i, int j, const string &s1, const string &s2)
{
if (s1[i] == '\0' || s2[j] == '\0')
return 0;
else if (s1[i] == s2[j])
return 1 + rLCS(i + 1, j + 1, s1... | ALGO | 0.999974 | 4.9755 |
c693168d-c0d1-4b7c-95a6-a25aaeabb13a | roytam1/VisualBoyAdvance | src/CheatSearch.cpp | #include <stdlib.h>
#include <memory.h>
#include "CheatSearch.h"
CheatSearchBlock cheatSearchBlocks[4];
CheatSearchData cheatSearchData = {
0,
cheatSearchBlocks
};
static bool cheatSearchEQ(u32 a, u32 b)
{
return a == b;
}
static bool cheatSearchNE(u32 a, u32 b)
{
return a != b;
}
static bool cheatSearchL... | TOOL | 0.989915 | 4.038125 |
d4ccae00-90ed-4701-94b1-6987f7bab441 | utkarshbhatnagar34/Competitive-Programming-Subsmission | CSES graph/StronglyConnectedComponent.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define SPEED ios_base::sync_with_stdio(0); cin.tie(0);
#define print(v) {for(auto i:v) cout<<i<<" ";cout<<endl;}
#define endl "\n"
//nodes start for 1 to N in it
int N, M;
vector<vector<int>> adj, adj_rev;
vector<int> visited;
void... | ALGO | 0.999943 | 4.802144 |
8c5f651f-0dad-427b-8cfb-000b49c6bbc9 | Argus817/CFCodes | ProblemSet/2110B.cpp | #include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define REDIRECT freopen("error", "w", stderr);
#else
#define REDIRECT
#endif
#define ERREND "\n "
#define ll long long int
#define sp ' '
#define abs(x) (((x)>0)? (x) : -(x))
#define pb push_back
ll power(ll base, ll power);
ll mod_power(ll base... | ALGO | 0.999663 | 4.021103 |
90a4cd46-26ed-4d0d-9d94-425be68a3934 | pranjalssh/CP_codes | anta/!FenwickTree.cpp | /*
Fenwick
Binary Indexed Tree, BIT ƂĂ
ݐϘaERMQłB
Ez[k] = z[k] + a ƍXV
Ez[i] + z[i+1] + ... + z[j] vZ
ŁA+Zq͉ZłȂĂmin,max₻̑A
CŠ KvB
ZqɂĂ͋tZq-ȂA
ft.add(x - ft.sum(i, i+1))
Ƃ邱ƂɂĈl̐ݒ肪łB
tTɊ܂܂邪APȃ[vȂ̂őxɑ
*/
//Vver. f[^̎ɋver.Ƃ̌݊̂ŒӁB
struct FenwickTree {
typedef int T;
vector<T> v; int highestOneBit;
F... | ALGO | 0.998741 | 4.988263 |
285d3453-a26d-4dd2-ace2-5ab3e003fcaf | Latasharma26/Array | 2599-take-k-of-each-character-from-left-and-right/2599-take-k-of-each-character-from-left-and-right.cpp | class Solution {
public:
int takeCharacters(string s, int k) {
// Count the total occurrences of 'a', 'b', and 'c'
vector<int> total(3, 0);
for (char c : s) {
total[c - 'a']++;
}
// If any character appears less than k times, it's not possible
if ... | ALGO | 0.999966 | 6.489711 |
70bb2038-8188-4e64-82bc-d39bce9b51e2 | pincher-chen/lammps-induced-dipole | src/USER-REAXC/reaxc_nonbonded.cpp | #include "pair_reaxc.h"
#include "reaxc_types.h"
#include "reaxc_nonbonded.h"
#include "reaxc_bond_orders.h"
#include "reaxc_list.h"
#include "reaxc_vector.h"
void vdW_Coulomb_Energy( reax_system *system, control_params *control,
simulation_data *data, storage *workspace,
... | ALGO | 0.999801 | 5.760056 |
7d850745-990c-41f2-85c0-ff2410ca72fd | ojusvini/Coding-Practice | FARIDA.cpp | #include <stdio.h>
long long int max(long long int a,long long int b){
return b>a?b:a;
}
int main(){
long long int t,i,j;
scanf("%d",&t);
j = 1;
while(t--){
long long int n;
scanf("%lld",&n);
if(n==0) printf("Case %lld: 0\n",j);
else {
long long int a[n];
long long int t[n+1];
for(i=0;i<n;i++){
... | ALGO | 0.999721 | 3.307264 |
2f6876ba-3309-472e-a881-53c96b2899e5 | alexandraback/datacollection | solutions_5695413893988352_1/C++/Eragon77/GCJ_2016_1B_B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
#ifndef M_PI
#define M_PI acos(-1.0)
#endif
typedef tuple<ll, ll, ll, string, string> score;
vector<score> pos;
void dfs(string coders, string jammers, int loc, int dir){
if(loc==coders.size()){
pos.emplace_bac... | ALGO | 0.999878 | 4.814826 |
cbd8f95d-4f1a-43f4-b1e5-0446359cbbb3 | RishabhSkr/LeetcodeProblem | 2692-take-gifts-from-the-richest-pile/2692-take-gifts-from-the-richest-pile.cpp | class Solution {
public:
long long pickGifts(vector<int>& gifts, int k) {
priority_queue<int>pq;
for(auto x :gifts)pq.push(x);
while(k--){
int x = pq.top();
pq.pop();
pq.push(sqrt(x));
}
long long ans =0;
while(!pq.empty()){
... | ALGO | 0.999967 | 5.359648 |
07e17a18-9ddd-4bc2-8636-1e989998931c | Math-Computing-Society-MCS/Algorithms | Sorting/BubbleSort.cpp | #include <iostream>
using namespace std;
// Sort arr[] of size n using Bubble Sort.
void BubbleSort (int arr[], int n)
{
int i, j;
for (i = 0; i < n; ++i)
{
for (j = 0; j < n-i-1; ++j)
{
// Comparing consecutive data and switching values if value at j > j+1.
if (arr[j] > arr[j+1])
{
arr[j] = ar... | ALGO | 0.999919 | 4.510695 |
3fb19103-f23d-4b6e-8ba0-05644fa47b81 | VoidUI/frameworks_av | media/codecs/amrnb/dec/src/dec_lag3.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/dec_lag3.c
Functions: Dec_lag3
Date: 01/31/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description:
(1) Updated to accept new parameter... | ALGO | 0.99985 | 7.141467 |
e77b731b-1bf0-4d16-ace8-624726e13c8c | adrianpar1/CMPE-126 | Labs/Lab 7 - Stacks/myInfixPostfix.cpp | #include "linkedListStack.h"
#include <stack>
std::string infixtoPostFix(std::string expression);
double evaluatePostFix(std::string expression);
int main(){
std::cout<<evaluatePostFix("2 10 5 * +");
//std::cout<<infixtoPostFix("9*(10/3+4");
return 0;
}
int precedence(char op) {
if (op == '+' || op == '-')... | ALGO | 0.998553 | 3.976399 |
aee68491-f30a-4a65-b515-0e906de23ea1 | ice1000/OI-codes | codeforces/731/c-unfinished.cpp | #include <stdio.h>
#include <math.h>
#define size 200005
// 鼯
int c[size], l[size], r[size], uset[size];
int n, m, k, tot;
int find(int a) {
return uset[a] == a ? a : find(uset[a]);
}
void merge(int x, int y) {
if (find(x) != find(y)) uset[x] = y, ++tot;
}
int main(int argc, char *argv[]) {
int i, j, x, y, z;
... | ALGO | 0.999931 | 3.522774 |
ee06f723-2fb3-4b58-8c26-ab46ad185660 | ishandutta2007/codeforces | sexpert/normal/1538/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while(t--) {
int n;
cin >> n;
vector<int> v(n);
for(auto &x : v)
cin >> x;
int a = distance(v.begin(),... | ALGO | 0.999834 | 4.377226 |
ce28483b-66d5-41ed-9419-a01d1a7c406e | iamrohit1/pcl | doc/tutorials/content/sources/kdtree_search/kdtree_search.cpp | #include <pcl/point_cloud.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <iostream>
#include <vector>
#include <ctime>
int
main ()
{
srand (time (NULL));
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
// Generate pointcloud data
cloud->width = 1000;
cloud->height = 1;
... | ALGO | 0.979645 | 7.05793 |
be1dc26b-33ff-46d7-8911-e9d6e190cd79 | sushant0709/DSA | Sliding Window/housing.cpp | // Problem Link -
/* By Sushant Khattar */
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000... | ALGO | 0.999752 | 4.678906 |
716191a9-c530-4bd0-a112-806f53a7462a | sanlal/sem2 | QUEUE/queueFunctional.cpp | #include <iostream>
using namespace std;
#define CAPACITY 5
char arr[CAPACITY];
int frontIdx = -1;
int rearIdx = -1;
int count = 0;
int capacity = CAPACITY;
int size(){
return count;
}
bool isEmpty(){
return count == 0;
}
bool isFull(){
return count == capacity;
}
bool enqueue(char u){
if(isFull())
return f... | ALGO | 0.983666 | 4.768878 |
aad15bd4-14d2-4e5c-9907-4482d202120a | NamDiagezzi/DSA_CodePtit | DSA04003 - Dem day.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll base=123456789;
ll Pow(ll n, ll k){
if (k==0) return 1;
ll x = Pow(n, k/2);
if (k%2==0) return x*x%base;
return n*(x*x%base)%base;
}
int main(){
int t; cin >> t;
while (t--){
ll n; cin >> n;
cout << Pow(2, n-1) << endl;
}
return 0;
} | ALGO | 0.999843 | 4.812531 |
bb6289ea-f4ba-4c8d-aea8-c26e62d26b30 | AhmadHirzallah/Programming-Foundations-and-Algorithms-Courses-01-13- | 04__using_c_and_c++_101_to_153_problems/140_cpp_join_string_from_vector.cpp | #include <string>
#include <iostream>
#include <vector>
using namespace std;
string ft_get_str_of_vector_elements(vector<string> &v_string, string delimiter = " ")
{
string str_of_vector;
short c;
c = -1;
str_of_vector = "";
while (++c < v_string.size())
if (c != (v_string.size() - 1))
str_of_vector += ... | TOOL | 0.959556 | 4.480108 |
13d53b23-ae16-484d-9ada-af4b893b757d | yuchenle/OOBS | hostOMPTask/tp-parsec/pkgs/libs/tbb/src/examples/graph/stereo/stereo.cpp | #define TBB_PREVIEW_FLOW_GRAPH_NODES 1
#define TBB_PREVIEW_FLOW_GRAPH_FEATURES 1
#include "tbb/tbb_config.h"
#include "../../common/utility/utility.h"
#if __TBB_PREVIEW_OPENCL_NODE && __TBB_CPP11_LAMBDAS_PRESENT
#if _MSC_VER
// suppress warning C4503: decorated name length exceeded, name was truncated
#pragma warni... | ALGO | 0.908643 | 6.975602 |
9878187a-ae67-4685-a097-a9eaeca7b99c | vaibhavkhanduja/Samples | graph.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int minDistance(int **&a, int s, int d, int nodes)
{
int distance = -1;
bool visited[nodes + 1][nodes + 1];
for (int i = 0; i <=nodes; i++) {
for (int j = 0; j <=nodes; j++) {
visited[i][j] ... | ALGO | 0.999819 | 4.122873 |
56941975-e694-4529-9480-69d7c373a18e | yih301/LLMFP | LLMs-Planning/planner_tools/VAL/src/SearchSpace.cpp | #include "SearchSpace.h"
namespace Planner {
SearchSpace::SearchSpace() :
derivRules(VAL::current_analysis->the_domain->drvs,VAL::current_analysis->the_domain->ops),
val(&derivRules,0.001,*VAL::theTC,VAL::current_analysis->the_domain->ops,VAL::current_analysis->the_problem->initial_state,
&dummyPlan,VAL::curren... | ALGO | 0.994191 | 3.552961 |
d171a72c-7714-420a-9060-329d00ac4473 | junybike/leetcode-daily | 2024_Nov/796_Rotate_String.cpp | // 2024 Nov 3
class Solution {
public:
bool rotateString(string s, string goal)
{
// Case: Returns false when string 's' and 'goal' have different length.
if (s.length() != goal.length()) return false;
string substring = ""; // To store substring
bool sign = true; // A ... | ALGO | 0.999949 | 6.139104 |
f6a63d19-ed88-4b65-9edf-5cfeef10056d | Avichal14/Problem-Of-The-Day | Hard/Longest repeating and non-overlapping substring/longest-repeating-and-nonoverlapping-substring.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
long long mod = (1LL << 45) - 1;
string possible(int p, string& txt){
int t = txt.size();
unordered_map<long long, int> mp;
long long pr = 1;
long long pp = 31;
... | ALGO | 0.999988 | 6.146042 |
707488f4-9f44-44ed-a413-d0a705da13ba | spcl/cppless-clang | libcxx/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp | // UNSUPPORTED: c++03
// <forward_list>
// template <class... Args>
// iterator emplace_after(const_iterator p, Args&&... args);
#include <forward_list>
#include <cassert>
#include "test_macros.h"
#include "../../../Emplaceable.h"
#include "min_allocator.h"
int main(int, char**)
{
{
typedef Emplace... | TEST | 0.86225 | 5.28892 |
12b3a38e-a948-4d80-9b89-692b2f6cbd71 | brokenfiles/webserv | srcs/classes/parser/Parser.cpp | #include <algorithm>
#include "Parser.hpp"
Parser::Parser(void)
{
}
Parser::~Parser(void)
{
}
void Parser::parseHeader(Request &req, std::string& keeper)
{
//std::cout << "-------------- REQUEST BEFORE PARSING -----------------" << std::endl;
//std::cout << keeper << std::endl;
//std::cout << "--------... | WEB | 0.85886 | 3.284656 |
a91f3adc-d094-405e-9343-dfd24fdafe72 | mcabinaya/Digital-Image-Processing | 27-Structured-Edge-Detector/private/edgesNmsMex.cpp | #include <mex.h>
#include <math.h>
#ifdef USEOMP
#include <omp.h>
#endif
// return I[x,y] via bilinear interpolation
inline float interp( float *I, int h, int w, float x, float y ) {
x = x<0 ? 0 : (x>w-1.001 ? w-1.001 : x);
y = y<0 ? 0 : (y>h-1.001 ? h-1.001 : y);
int x0=int(x), y0=int(y), x1=x0+1, y1=y0+1;
fl... | ALGO | 0.999867 | 6.312156 |
18cda134-78ce-4515-95d2-1196a342df2c | Im-dex/xray-162 | code/plugins/lw/Export/scenscan/vecmat.cpp | #include "stdafx.h"
/*
======================================================================
vecmat.c
Basic vector and matrix functions.
====================================================================== */
#include "vecmat.h"
#pragma warning (disable:4995)
float dot( LWFVector a, LWFVector b )
{
return a[ 0... | ALGO | 0.997225 | 5.404999 |
1d13ccc9-45e2-4867-8483-3f9e11797672 | PabloPC05/EstructuraDeDatos | 2022_Junio/Ejercicio1.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <stdexcept>
#include <list>
#include <algorithm>
#include <list>
#include "ListLinkedDouble.h"
using namespace std;
bool resuelveCaso(... | ALGO | 0.997279 | 3.449328 |
c03167e5-d22f-4896-a677-912ee89968ee | chelsi83/C-Programs | Delete alternate node of singly linked list.cpp | #include <stdio.h>
#include <stdlib.h>
// Define the structure for a singly linked list node
typedef struct Node {
int data;
struct Node* next;
} Node;
// Function to create a new node
Node* createNode(int data) {
Node* newNode = (Node*)malloc(sizeof(Node));
if (!newNode) {
printf("Memory allo... | ALGO | 0.999413 | 6.25422 |
a224f096-883a-48c5-b4ab-0cceb08b8a01 | abhiram4580/DSA_CODE_BABBAR | Bit Magic/NOT_Signed_int.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int x=5;
cout<<~(x)<<endl; // Output is compiler dependent
return 0;
} | ALGO | 0.977508 | 3.244446 |
d6ba0502-ab1c-4169-ac81-5a624e9971be | Baizx98/awesome-leetcode | 135.分发糖果.cpp | /*
* @lc app=leetcode.cn id=135 lang=cpp
*
* [135] 分发糖果
*/
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <iostream>
using namespace std;
// @lc code=start
class Solution
{
public:
int candy(vector<int> &ratin... | ALGO | 0.999999 | 6.47727 |
6b8f2d8c-62b0-4ee3-a0c5-6ab14e862f41 | rc-rohan/web-assembly- | math.cpp | int fib(int n)
{
if (n <= 1){
return 1;
}
return fib(n - 1) + fib(n - 2);
} | ALGO | 0.998963 | 5.488877 |
c5a71021-4b08-40de-b064-719edfc434c4 | csh1668/ProblemSolving | ps_cpp/competitions/scpc2024/test2.cpp | #include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;
int arr[300000];
int main(int argc, char** argv)
{
std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
int t; cin >> t;
for (int i = 0; i < t; ++i){
int n; ll ans = 0; cin >> n;
for (int j = 0; j < n; j++) cin >... | ALGO | 0.99881 | 4.233943 |
96ce4365-e855-400c-b67e-6d15b1a4753c | Hiyabye/Baekjoon | 10xxx/10163.cpp | #include <iostream>
#include <vector>
using namespace std;
void solve(void) {
int n; cin >> n;
vector<vector<int> > v(1001, vector<int>(1001, 0));
for (int i=1; i<=n; i++) {
int a, b, w, h; cin >> a >> b >> w >> h;
for (int j=a; j<a+w; j++) {
for (int k=b; k<b+h; k++) {
v[j][k] = i;
... | ALGO | 0.968889 | 3.342107 |
68699023-558b-4325-8d1b-432aba113e30 | LLstream/atcoder | abc387/d.cpp | #include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
#endif
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, s, n) for (ll i = s; i < n; i++)
int main() {
ll h,w;
cin >>... | ALGO | 0.999976 | 4.27567 |
4e29cd8d-34d3-4470-832a-3cee90c267d1 | john4477/simplessd | src/systemc/tests/systemc/misc/user_guide/chpt11.6/mean.cpp | /*****************************************************************************
mean.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | ALGO | 0.999418 | 4.632813 |
b1fcecb0-4656-4a2c-b0d0-790dac238220 | ishita41/cpp-codes | majorityelement.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int majority, count = 0;
... | ALGO | 0.999962 | 4.676191 |
1f43bcb1-fb50-415b-a287-00d4600fbf8a | gaoxam123/CP | Backtrack/Minimum_Cycle.cpp | // https://oj.vnoi.info/problem/backtrack_a
#include <bits/stdc++.h>
using namespace std;
int n, k, mn = 1e9;
vector <int> ans;
vector <int> test;
int a[51][51], check[51];
int middle_vectices[51][51];
void find_middle_vertices() {
for(int i = 1; i < n; i ++) {
for(int j = i + 1; j <= n; j ++) {
... | ALGO | 0.999993 | 3.875456 |
cf510084-01ae-4268-8512-5de54bdf015b | itsmeEVIL/TFB1013_StructuredProgramming | LAB/08/3.cpp | #include <iostream>
using namespace std;
int main() {
const int numStudents = 5;
const int numSubjects = 3;
int marks[numStudents][numSubjects];
string subjects[numSubjects] = {"Maths", "English", "Drawing"};
for (int i = 0; i < numStudents; i++) {
cout<<"Enter marks for Student "<<(i + 1... | TOOL | 0.96361 | 4.344614 |
c6d8ca72-106c-4008-b554-00886532ab94 | prabhxjottsingh/leetcode-practise-problems | Recursion/0695 - Max Area of Island.cpp | //Problem link: https://leetcode.com/problems/max-area-of-island/
//Time Complexity: O(N * M)
//Space Complexity: O(1)
class Solution
{
private:
vector<pair<int, int>> moves = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};
bool isPossible(int i, int j, int n, int m)
{
if (i < 0 || i >= n)
return ... | ALGO | 0.999966 | 6.705167 |
7dcbbbcc-66ac-45e9-bb78-c13e26489a60 | liangyh911/ATTNChecker | pytorch/third_party/ideep/mkl-dnn/src/cpu/ref_convolution.cpp | #include "common/c_types_map.hpp"
#include "common/dnnl_thread.hpp"
#include "common/dnnl_traits.hpp"
#include "common/math_utils.hpp"
#include "common/type_helpers.hpp"
#include "cpu/cpu_primitive.hpp"
#include "cpu/ref_io_helper.hpp"
#include "cpu/ref_convolution.hpp"
#include "cpu/ref_convolution_utils.hpp"
names... | ALGO | 0.985641 | 7.431224 |
e084fa97-307e-4c74-afed-56b59a86352e | AnkitRupal/Codechef_Beginner | Chef and Dolls.cpp | #include <bits/stdc++.h>
using namespace std;
void input_array(int a[],int size){
for(int i=0;i<size;i++){
cin>>a[i];
}
}
int check (int a[],int n){
for(int i=0,j=1;i<n-1;i+=2,j+=2){
if(a[i]!=a[j]){
return a[i];
}
}
return a[n-1];
}
int main() {
int t,n;
cin>... | ALGO | 0.999779 | 4.173416 |
17ef5129-252c-4fb9-8b8d-e557f10f744b | Applopie/fall_term_2023_2add | week05/1.cpp | #include <iostream>
using i32 = int32_t;
using u64 = uint64_t;
/*template <class T>
T sum(T&& a, T&& b) {
return a+b;
}*/
template <class T, class U>
T sum(T &&a, U &&b)
{
return a + b;
}
template <class T, class U>
struct SumResult {
using type = /*typename*/ decltype(std::declval<T>() + std::declval<U... | ALGO | 0.944272 | 5.39647 |
3eb4eaee-b4f1-4370-8afb-62ca28c4efbf | gmelossc/algorithms | math/prime-factors.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> factors(long long n) {
vector<int> f;
for(int d=2; n>1; ) {
while(n%d == 0) {
f.push_back(d);
n /= d;
}
d++;
if(d * d > n) d = n;
}
return f;
}
/*
Sieve based solution - FASTER FOR MULTI... | ALGO | 0.999827 | 4.723849 |
cba6950d-b11a-46d8-8fd5-2aae1d8eecc6 | sczzq/symmetrical-spoon | algorithm/findMaxForm1.cpp | /*************************************************************************
> File Name: findMaxForm.cpp
> Author: ziqiang
> Mail: <EMAIL>
> Created Time: Mon 24 Apr 2017 10:11:15 PM CST
************************************************************************/
#include <iostream> // cout, endl
#include <string> /... | ALGO | 0.99992 | 5.485583 |
3b05c020-1e85-430c-b479-40ccb58b77fe | uddipan/LeetCode | 106. BT from post and inorder/source.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:
TreeNode* helper(vector<int>& inorder, vector<int>& postorder, int start, int end, int rootidx)... | ALGO | 0.999892 | 6.13696 |
110fe179-4da4-44e9-99a8-55e7c1b7824c | Md-Rakib-Hassan/PROBLEM-SOLVING | 724_Find_Pivot_Index(LeetCode).cpp | //https://leetcode.com/problems/find-pivot-index
class Solution {
public:
int pivotIndex(vector<int>& nums) {
vector<int> prefix, suffix; // Vectors to store prefix sums and suffix sums
int n = nums.size(); // Get the size of the input vector
// Calculate prefix sums
prefix.push_ba... | ALGO | 0.999973 | 6.792452 |
7102c6d3-9d44-475c-883f-da9f919c2911 | ngng628/competitive-programming | atcoder/ABC/ABC101/C/main.cpp | # include <bits/stdc++.h>
# ifndef ngng628_library
# define ngng628_library
# define int long long
# define float long double
# define fi first
# define se second
# define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i,n) for(int i=((int)... | ALGO | 0.999713 | 3.780538 |
567ff680-e8f2-4a3f-8b58-5931313f37d4 | santoshsharma9757/nikah_forever_assingment | 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 |
369c72af-07fa-41ff-90b6-e04c98a419e5 | ishandutta2007/codeforces | flying2018/normal/710/F.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#define N 300010
using namespace std;
int ch[N*4][26],nxt[N*4][26],val[N*4],ed[N*4],fail[N*4],tot;
int ton[N*4],tt;
int new_node(){if(tt) return ton[tt--];return ++tot;}
void erase(int &u){memset(ch[u],0,sizeof(ch[u]));memset(nxt[u],0,sizeof(nxt[u]))... | ALGO | 0.99963 | 3.799556 |
80969f0e-3455-4dad-9819-54a267783450 | rt500/Heads-Up-Push-or-Fold | src/strategy.cpp | #include "strategy.h"
#include <utility>
#include <iomanip>
#include <iostream>
Strategy::Strategy(double value)
{
for (int i = 0; i < 13; i++)
{
for (int j = 0; j < 13; j++)
{
strategy[i][j] = value;
}
}
}
double Strategy::get_strategy(int card1, int card2, bool is_index_rep)
{
if (is_index... | TOOL | 0.981488 | 4.604397 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.