uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
83988ff0-8dbd-4815-8c99-8a4cb84ddd45 | 4HadiRaza/Programming-in-C | Loops/9..cpp | #include <stdio.h>
main()
{
int num1;
int num2;
int result = 1;
printf("Enter the base number: ");
scanf("%d", &num1);
printf("Enter the exponent: ");
scanf("%d", &num2);
while (num2 != 0)
{
result *= num1;
--num2;
}
printf("Result: %d", result);
return 0;... | ALGO | 0.999688 | 3.772676 |
5c4ebd00-f2ed-44e2-8513-698d7251e467 | cunterrainer/Pi-Plotter | Dependencies/multiprecision/example/exercise_threading_log_agm.cpp | // This example exercises Boost.Multiprecision in concurrent
// multi-threaded environments. To do so a loop involving
// non-trivial calculations of numerous function values
// has been set up within both concurrent as well as
// sequential running environments. In particular,
// this example uses an AGM method to do ... | ALGO | 0.994947 | 7.00739 |
73bd17f2-0d3a-4e82-a1be-cc30436eac23 | mahadodla4/GFG_solutions | Medium/Rat in a Maze Problem - I/rat-in-a-maze-problem-i.cpp | //{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution{
public:
void spoiler(int i,int j,int n,vector<vector<int>>&m,string ans,vector<string>&paths,vector<vector<int>>&visited)
{
if(i... | ALGO | 0.999821 | 6.505559 |
ca00e0e1-cdba-479d-af5d-84f89a63a569 | otavioon/COLA-2022-Tools | datasets/src/algo/codenet/4/s578411500.cpp | #include <iostream>
#include <set>
using namespace std;
int main(){
int N,M;
int K;
int n;
int num;
int incre = 1;
set<int> m;
cin >> N >> K;
while(K--){
cin >> n;
m.insert(n);
}
num = N;
M = N;
if(N!= 0)
{
while(num){
n = num%10;
while(m.find(n)... | ALGO | 0.999604 | 3.774691 |
5c62d36a-59b5-4043-80a5-1d79120c0504 | zianed/leetcode | cpp/145. 二叉树的后序遍历.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:
vector<int> postorderTraversal(TreeNode* root) {
vector<int> res;
if (ro... | ALGO | 0.999978 | 5.786848 |
e55ef4ef-9679-4acb-8008-ba17f60eb895 | namnguyen215/CTDLGT | minhminh-main/chia mang thanh hai mang con co tong lon nhat.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
int a[n];
long long s=0;
for(int i=0;i<n;i++) {
cin>>a[i];
s+=a[i];
}
sort(a,a+n);
int m=min(k,n-k);
long long s1=0;
for(int i=0;i<m;i++) s1+=a[i];
cout<<(s-s1)-s1<<endl;
}
}
| ALGO | 0.999948 | 3.780999 |
960e58c5-9688-4f6d-b825-9ad8d2131e79 | BajajGirik/DS-Algo | algo-analysis/stringMatching/definitions/stringMatching.cpp | #include "../headers/stringMatching.h"
#include <bits/stdc++.h>
bool naive_string_matching(std::string s, std::string pattern) {
int s_len = s.size();
int pat_len = pattern.size();
for(int i=0; i<s_len; ++i) {
int tempi = i;
int j = 0;
while(tempi<s_len and s[tempi] == pattern[j]) {
++tempi;
++j;
i... | ALGO | 0.999943 | 5.745913 |
df1ef95c-7c1e-4130-9810-2667d5d9c27c | ricardodalarme/Competitive-Programming | Uri/2754.cpp | // https://www.urionlinejudge.com.br/judge/pt/problems/view/2754
#include <bits/stdc++.h>
using namespace std;
int main() {
printf("234.345000 - 45.698000\n");
printf("234 - 46\n");
printf("234.3 - 45.7\n");
printf("234.34 - 45.70\n");
printf("234.345 - 45.698\n");
printf("2.343450e+02 - 4.569... | TOOL | 0.92636 | 3.24493 |
c136e242-1af2-4312-862b-892fe9da662a | ASilins/Randomised-Algorithms | hashing/hash_functions/FourWiseIndependentHash.cpp | #include "FourWiseIndependentHash.h"
#include "../../utils/NumberUtils.h"
FourWiseIndependentHash::FourWiseIndependentHash(const uint32_t r) : r(r)
{
a = NumberUtils::generate_random_uint(p-1);
b = NumberUtils::generate_random_uint(p-1);
c = NumberUtils::generate_random_uint(p-1);
d = NumberUtils::gene... | ALGO | 0.999447 | 5.514 |
9f746ec2-237f-476c-bae2-bdf1b9289384 | rainbow-auto/rainbow-codes | Luogu/CF1994D.cpp | #include <bits/stdc++.h>
// #pragma GCC optimize(2)
using i64 = long long;
using f64 = long double;
#define fastread std::ios::sync_with_stdio (false); std::cin.tie(nullptr);
#define rep(QWQ, qwq, qaq) for (i64 QWQ = (qwq); (QWQ) <= (qaq); QWQ++)
#define per(QWQ, qwq, qaq) for (i64 QWQ = (qwq); (QWQ) >= (qaq); QWQ--... | ALGO | 0.999968 | 3.363048 |
3bd11716-afd7-46ef-be21-6fa4914a882d | Pragna235/Coding-Ninjas-Problems | Middle Of Linked List.cpp | /*
Following is the class structure of the Node class:
class Node
{
public:
int data;
Node *next;
Node()
{
this->data = 0;
next = NULL;
}
Node(int data)
{
this->data = data;
this->next = NULL;
}
Node(int data, Node* next)
{
this->data = d... | ALGO | 0.999597 | 5.474332 |
ac010471-4992-4435-988f-1c255ec245f5 | mastyki/OperatingSystems | lab2/main.cpp | #include <iostream>
#include <windows.h>
struct Array
{
int *arr;
int arrSize;
int minInd = 0;
int maxInd = 0;
int average;
Array (int size){
arrSize = size;
arr = new int[arrSize];
int elem;
for(int i = 0; i < arrSize; ++i ){
printf("Input array elem... | ALGO | 0.998318 | 3.662633 |
75c59d97-3e2a-4bf0-8f81-deebb701d591 | crhurley1234/PPP-Using-CPP-Second-Edition-Homework | Chapter20/chapter.20.1.2-1.cpp |
//
// This is example code from Chapter 20.1.2 "Generalizing code" of
// "Programming -- Principles and Practice Using C++" by Bjarne Stroustrup
//
#include "../std_lib_facilities.h"
//------------------------------------------------------------------------------
double* get_from_jack(int* count); // jack puts dou... | ALGO | 0.984375 | 4.830382 |
819ec6f8-a821-4225-943b-3f6bbac51cfa | sxu39/TP-RPMD | lammps-stable_2Aug2023_update2/src/KOKKOS/npair_kokkos.cpp | // clang-format off
#include "npair_kokkos.h"
#include "atom_kokkos.h"
#include "atom_masks.h"
#include "domain_kokkos.h"
#include "update.h"
#include "neighbor_kokkos.h"
#include "nbin_kokkos.h"
#include "nstencil.h"
#include "force.h"
#include "kokkos.h"
#include "transpose_helper_kokkos.h"
namespace LAMMPS_NS {
/... | TOOL | 0.910387 | 6.704671 |
f82ccfcf-5faa-4602-b235-6e4aa18f8d21 | ornob011/HackerRank | Lonely_Integer.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("/home/ornob/Downloads/Practice/input.txt", "r", stdin);
freopen("/home/ornob/Downloads/Practice/output.txt", "w", stdout);
int t, result=0, x;
cin>>t;
while(t--)
{
cin>>x;
result=result^x;
}
cout<<result<<endl;
return 0;
}
| ALGO | 0.999614 | 3.842065 |
5e7c4f77-fe43-4770-ad5c-3ef80f8c75b6 | akhil-maker/DSA | Arrays/remodupliSort.cpp | //remove duplicate elements from sorted array
#include<iostream>
using namespace std;
//O(n), O(1)
void remoDupli(int a[], int n){
if(n==0 || n==1)
return;
int j=0;
for(int i=0; i<n-1; i++)
if(a[i]!=a[i+1])
a[j++] = a[i];
a[j++] = a[n-1];
for(int i=0; i<j; i++)
co... | ALGO | 0.999832 | 4.821776 |
c9541387-a3e1-42e8-b13a-a7dae24a2481 | Swapno963/Phitron-Batch-3 | 2_.c++/module-3.5/I_Smallest_Pair.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int test_case;
cin >> test_case;
// doing job for test case time
for(int i=0; i<test_case; i++)
{
int n;
cin >> n;
int arr[n];
// taking arr input
for(int p=0; p<n; p++)
{
cin >> a... | ALGO | 0.999561 | 3.911163 |
ba7c73ed-15bc-4b29-9c0c-2da51640ebd1 | eastgerm/eastgerm-algo | BOJ/Basic/2558. A+B 2.cpp | //
// Created by kimdong on 2018-05-18.
//
#include <iostream>
using namespace std;
int A = 0, B = 0;
void inputAB();
void HelloWorld();
void AB();
int main()
{
ios_base::sync_with_stdio(false);
//HelloWorld();
AB();
return 0;
}
void inputAB() {
cin >> A >> B;
}
void HelloWorld() {
cout ... | ALGO | 0.982492 | 3.595828 |
106c7253-2dcf-49f5-940f-7765077f4774 | maksasGit/UMCS | C++/algorithms/seif.cpp | #include<iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n , m , k;
cin >> n >> m >> k;
string tab[n];
int pos_tab[2][n][2];
for (int i = 0; i < n; i++) {
cin >> tab[i];
pos_tab[1][i][m%2] = n-i-1;
}
int las... | ALGO | 0.999987 | 3.454626 |
a1fa5a2e-719f-4597-9496-c74e4c0dd034 | gatsjy/algorithm | Bakjoon/1463(1로 만들기).cpp | #include <bits/stdc++.h>
using namespace std;
namespace _1463 {
int dp[1000001] = { 0,0,1, };
int n;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 3; i <= n; i++) {
dp[i] = dp[i - 1] + 1;
if (i % 3 == 0) {
dp[i] = min(dp[i], dp[i / 3] + 1);
}
... | ALGO | 0.99993 | 4.156304 |
76736162-7b52-4c2a-9f9f-fd719bf3aeef | wassimalharaki/Codeforces | 800/CompareT-ShirtSizes.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define all(v) v.begin(), v.end()
#define nl << '\n'
#define v vector
#define vi vector<int>
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define INF LONG_LONG... | ALGO | 0.999991 | 4.562773 |
bde5c5e1-e77f-4d2f-9355-c96376d029e2 | devnowk/Algorithm-Study | it 취업을 위한 알고리즘 문제풀이 (with CC++)/02. 자연수의 합.cpp | #include <iostream>
int main() {
// freopen("input.txt", "rt", stdin);
int a, b; // 입력 : a~b 합을 수식과 함께 출력
int sum=0; // 출력
std::cin >> a >> b;
for(size_t i=a; i<b; i++)
{
std::cout << i << " + ";
sum+=i;
}
std::cout << b << " = " << sum+b;
return 0... | ALGO | 0.998146 | 4.24714 |
e44e124c-1321-4485-beab-3763c97d84e6 | haitien/retinaface_ncnn | src/layer/absval.cpp | #include "absval.h"
namespace ncnn {
DEFINE_LAYER_CREATOR(AbsVal)
AbsVal::AbsVal()
{
one_blob_only = true;
support_inplace = true;
}
int AbsVal::forward_inplace(Mat& bottom_top_blob, const Option& opt) const
{
int w = bottom_top_blob.w;
int h = bottom_top_blob.h;
int channels = bottom_top_blob.c... | TOOL | 0.861117 | 6.135556 |
958a8a8b-5b92-42ee-b173-a9c58b49e4e2 | tradecraftio/tradecraft | src/test/fuzz/mini_miner.cpp | #include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <test/fuzz/util/mempool.h>
#include <test/util/script.h>
#include <test/util/setup_common.h>
#include <test/util/txmempool.h>
#include <test/util/mining.h>
#include <node/miner.h>
#include <node/mini_miner.h>
#in... | TEST | 0.960639 | 6.785335 |
38fb8366-c547-4572-b776-6af45d8f9401 | SummerS-tars/CodeServerCodeStore | CodeDocuments/codes/1_1cpp_basicgrammar/6function/10example6.cpp | #include <iostream>
using namespace std;
void print2D ( int a [ ] [ 100 ] , int row , int col )
{
for ( int i = 0 ; i < row ; i ++ )
{
for ( int j = 0 ; j < col ; j ++ )
printf ( "%d " , a [ i ] [ j ] ) ;
cout << '\n' << endl ;
}
}
int main()
{
int row , col ;
... | ALGO | 0.946279 | 3.360184 |
584303db-40ec-4cf5-8bdc-3c157af38429 | Biswajitmohapatra1/GFG | Difficulty: Medium/Interleave the First Half of the Queue with Second Half/interleave-the-first-half-of-the-queue-with-second-half.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
vector<int> rearrangeQueue(queue<int> &q){
queue<int>first;
int n=q.size()/2;
vector<int>v;
whil... | ALGO | 0.999819 | 5.677304 |
53237dc4-80f6-4ba5-b4d7-b20e5451267d | Mabsas/Code_Forces | HQ99+.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin >> s;
bool found = false;
for (int i = 0; i < s.size(); i++)
{
if ((s[i] == 'H') || (s[i] == 'Q') || (s[i] == '9') )
{
found = true;
break;
}
}
if (found)
{
... | ALGO | 0.994754 | 3.923453 |
fb88285e-ff67-4a97-944c-681d6d2fcaa4 | HYDRARITIK/basic-Algo-Templates | basic tree algorithm/Generic Tree Pepcoding/Generic Tree Multisolver(height,min,max,size).cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
vector<Node *> children;
};
Node* construct(int* arr,int n){
Node* root=new Node();
root->data=arr[0];
stack<Node*> st;
st.push(root);
for(int i=1;i<n;i++){
if(arr[i]==-1){
st.pop();
... | ALGO | 0.999904 | 4.028846 |
3f1a6a4d-195f-42ff-bcdb-d24c93d41c01 | ishandutta2007/codeforces | black_horse2014/normal/799/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<int, LL> PIL;
typedef pair<LL, int> PLI;
typedef vector<int> VI;
typedef vector<PII> VPII;
typedef double DB;
#define pb push_back
#define mset(a, b) memset(a, b, sizeof a)
#define al... | ALGO | 0.999914 | 3.71324 |
fcc283a9-da8a-4974-af8b-d55513b93601 | zenoalbisser/chromium | third_party/skia/src/effects/SkBlurImageFilter.cpp | #include "SkBitmap.h"
#include "SkBlurImageFilter.h"
#include "SkColorPriv.h"
#include "SkDevice.h"
#include "SkGpuBlurUtils.h"
#include "SkOpts.h"
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
#endif
// This rather arbitrary-looking value results in a maximum box blur ... | TOOL | 0.855245 | 7.422444 |
4d9d3fb6-a801-4e3b-92c3-0457695a8eaf | mohammedowez/Ds-and-algo | Dynamic Programming/string/Longest Common Substring .cpp |
Example 1:
Input: S1 = "ABCDGH", S2 = "ACDGHR"
Output: 4
Explanation: The longest common substring
is "CDGH" which has length 4
int longestCommonSubstr (string S1, string S2, int n, int m)
{
// your code here
vector<vector<int>> dp(1001,vector<int>(1001,0));
int ans=0;
... | ALGO | 0.999862 | 5.22233 |
89b30d22-54e0-4c57-a617-114e1784ddbe | XeFreya/Detector_Rostros | opencv-4.x/opencv-4.x/3rdparty/carotene/src/scharr.cpp | #include <vector>
#include "common.hpp"
namespace CAROTENE_NS {
bool isScharr3x3Supported(const Size2D &size, BORDER_MODE border, s32 dx, s32 dy, Margin borderMargin)
{
return (dx == 0 && dy == 1 &&
isSeparableFilter3x3Supported(size, border, 3, 1, borderMargin)) ||
(dx == 1 && dy =... | ALGO | 0.968426 | 4.749222 |
2c4fbd16-af21-4279-bfc8-d8db2313f470 | MeRonak/Practise | A_Cheap_Travel.cpp | #include<bits/stdc++.h>
using namespace std;
#define v vector<int>
#define ll long long
#define loop(i, n) for(int i = 0; i< n ; ++i)
int main(){
int n, m, a, b; cin>>n>>m>>a>>b;
if(b/m >= a){cout<<n*a<<endl;}
else
{
int temp = n % m;
// cout<<temp<<" ";
cout<<min(temp * a+ ((n - temp)/m)*b, (n/m+1)*b)<<e... | ALGO | 0.999613 | 3.47575 |
041f0e0b-1e84-45e9-9c65-c134520b31a6 | mozilla-spidermonkey/rust-frontend | security/ct/BTVerifier.cpp | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
#include "BTVerifier.h"
#include <stdint.h>
#include "CTUtils.h"
#include "SignedCertificateTimestamp.h"
#include "hasht.h"
#include "mozpkix/pkixnss.h"
#include "mozpkix/pkixutil.h"
namespace mo... | ALGO | 0.932483 | 7.699156 |
1d0b606a-4678-44f9-b6c5-65612637f31c | shivanshsanoria1/LeetcodeSolutions | CPP [1001-1500]/1277.count_square_submatrices_with_all_ones [1].cpp | class Solution {
private:
// returns true if square matrix of k*k with
// upper-left corner at (a, b) is filled with all 1's
bool isValidSquare(vector<vector<int>>& matrix, int a, int b, int k){
for(int i=a; i < a + k; i++)
for(int j=b; j < b + k; j++)
if(matrix[i][j] ==... | ALGO | 0.999826 | 5.687948 |
3aba83c6-58f1-4775-b9f2-08d425d8d232 | thakursachin05/Practice_CP | Maths Propblems/1358A-ParkLightning.cpp | // https://codeforces.com/problemset/problem/1358/A
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n,m;
cin>>n>>m;
int k = n*m;
int ans = 0;
if(k&1){
ans++;
}
ans += k/2;
cout<<ans<<endl;
... | ALGO | 0.999846 | 5.050644 |
06df3ca3-fd6e-4b2c-9f54-4960eb00530f | NSKernel/llvm-reusable-enclaves | libcxx/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp | // UNSUPPORTED: c++03, c++11
// <vector>
// vector.bool
// template <class... Args> reference emplace_back(Args&&... args);
// return type is 'reference' in C++17; 'void' before
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
int main(int, char**)
{
{
typedef std... | TEST | 0.880591 | 5.428818 |
d448f374-493c-4f01-9048-67ff6a300a61 | joaabjb/ifpi_ads_estrutura_de_dados_i | LISTA2/q08_pesquisa_eleitoral.cpp |
#include <stdio.h>
#include <math.h>
main(){
float voto, serra = 0, dilma = 0, ciro = 0, indeciso = 0, outro = 0, nulobranco = 0, total = 0;
float pserra, pdilma, pciro;
do{
printf("\nDigite a opcao de voto:\n Serra = 45\n Dilma = 13\n Ciro = 23\n");
printf(" Indeciso = 99\n Outros = 98\n Nulo/branco = 0\n... | ALGO | 0.992334 | 3.679241 |
7d052eb1-0c4b-410b-bba1-28a583ad67b3 | Koanrade/cppexc | chessboardszal.cpp | #include <iostream>
using namespace std;
int a;
int main() {
cin>>a;
cout<<a*a/2<<endl;
if(a%2==0){
cout <<a*a/2<<endl;
}
else{
cout <<a*a/2+1<<endl;
}
return 0;
} | ALGO | 0.999418 | 3.347092 |
e3762df3-c4dc-4334-8fc0-a328bf0b27f8 | aicanhelp/ai-bookcodes | content/C++Primer-Plus/Chapter 4/address.cpp | // address.cpp -- using the & operator to find addresses
#include <iostream>
int main()
{
using namespace std;
int donuts = 6;
double cups = 4.5;
cout << "donuts value = " << donuts;
cout << " and donuts address = " << &donuts << endl;
// NOTE: you may need to use unsigned (&donuts)
// and unsigned... | TOOL | 0.958824 | 5.206332 |
24b4093c-d75d-47e4-99d6-c3a280012c07 | mdunggggg/DSA-PTIT | DSA08008.cpp | /* Hoang Manh Dung - D21 ProPTIT */
#include<bits/stdc++.h>
using namespace std;
#define Faster() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const double PI = 2 * acos(0);
const int MOD = 1e9 + 7;
const int MAX = 1e6 + 5;
void Process(){
long long n, k;
cin >> n;
queue<long long> q;
... | ALGO | 0.999134 | 4.182499 |
3bac1f74-ad80-424a-b8de-a61748482973 | Android4SAM/platform_frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_alias_reduction.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_alias_reduction.cpp
Date: 09/21/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
----------------... | ALGO | 0.998786 | 3.930718 |
2542e43f-87a2-47af-bf00-12934e1c0674 | cangxue/cx_quick_lua | frameworks/cocos2d-x/cocos/math/MathUtil.cpp | #include "math/MathUtil.h"
#include "base/ccMacros.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include <cpu-features.h>
#endif
//#define USE_NEON32 : neon 32 code will be used
//#define USE_NEON64 : neon 64 code will be used
//#define INCLUDE_NEON32 : neon 32 code included
//#define INCLUDE_N... | TOOL | 0.974015 | 6.360316 |
2f79db03-4bd2-4467-a0d4-0850669b4090 | itlezy/eMule-mods-archive | eMule-0.50a-AcKroNiC_v6.0-src/cryptopp/blowfish.cpp | // blowfish.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "blowfish.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
void Blowfish::Base::UncheckedSetKey(const byte *key_string, unsigned int keylength, const NameValuePairs &)
{
AssertValidKeyLength(keylength);
unsigned i, j=0, k... | ALGO | 0.998528 | 7.377288 |
5c09553c-22f2-46d8-91ab-270af8529e54 | TUS123456/DSAjourney | checkmax.cpp | #include<iostream>
using namespace std;
main(){
int N;
cout<<"enter size";
cin>>N;
int arr[N];
int max=0;
int prev;
for(int i=0; i<N; i++){
cin>>arr[i];
}
for(int i=0; i<N; i++){
if(max<arr[i]){
prev=max;
max=arr[i];
}
}
cout<<endl<<prev;
}
| ALGO | 0.999878 | 3.411169 |
4ee694a5-7b43-4807-ae88-8f73e6fd67d5 | Sriyansh2001/Leetcode | 2572-append-characters-to-string-to-make-subsequence/append-characters-to-string-to-make-subsequence.cpp | class Solution {
public:
int appendCharacters(string s, string t) {
int n = s.length();
int j=0;
for(int i=0 ; i<n ; ++i) {
if(s[i]==t[j]) {
j+=1;
}
}
return t.length()-j;
}
}; | ALGO | 0.999957 | 6.078969 |
6f06ebea-07bc-4975-b1fa-df6fa537d526 | Manojit-Das-10/Coding | Special/TCS_code_vita_1.cpp | #include<bits/stdc++.h>
using namespace std;
int minimumClicksToReachEndPage(int N, vector<vector<int>>& pages, int start_page, int end_page) {
vector<vector<int>> links(N + 1);
for (int i = 1; i <= N; i++) {
links[i] = pages[i - 1];
}
vector<bool> visited(N + 1, false);
queue<pair<in... | ALGO | 0.999894 | 4.696592 |
bd6b2550-0bcf-42a7-b94c-441d1905dbbc | RyoSci/AtCoder | くじかつ/20221109/e.cpp | // #define _GLIBCXX_DEBUG
#include <algorithm>
#include <atcoder/all>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using namespace atcoder;
using lli = long long;
// usin... | ALGO | 0.999982 | 4.72958 |
60f16642-6e25-4316-b28a-99d7f0ed0c92 | Hassagi/Podstawy-programowania-UG | Programy/main_(25).cpp | #include <iostream>
using namespace std;
int main()
{
int n, j;
float suma = 0, srednia;
int tab[100];
cout << "podaj ilość elementów ";
cin >> n;
cout << endl;
for(int i = 0 ; i < n ; i++)
{
cin >> tab[i];
}
for(j = 0 ; j < n ; j++)
{
suma = suma + tab[j... | ALGO | 0.960516 | 3.152563 |
84e42775-1121-4c8b-bf5b-b398b4f61608 | itsdevansh5/DSA-OOPS | OOPS/copyconstructor.cpp | #include<iostream>
using namespace std;
class A{
int a=10;
int b=5;
public:
A(){
cout<<"parameterized constructor";
}
A(A &t){
cout<<"copy constructor";
}
};
int main() {
A a1;
A a2(a1);
return 0;
} | TOOL | 0.863283 | 3.9468 |
55ad4c36-f1bc-458c-a7f2-c61297138a6c | HemaGarima/DSA-Cpp | 12_LinearSearch.cpp | // Linear search + Code in C++ language.
#include<iostream>
using namespace std;
int linearsearch(int element,int array[],int size){
for(int i=0;i<size;i++){
if(array[i] == element){
return i;
}
}
return -1;
}
int main(){
// Unsorted array for linear search
int array[]... | ALGO | 0.998984 | 4.298187 |
f8b44e5b-f589-4e9e-89c6-f801f33eda80 | QuiverDance/Algorithm | level6/2444.cpp | #include<iostream>
using namespace std;
int n, b, s;
int main(void){
cin >> n;
for(int i = 0; i < 2 * n - 1; i++){
if(i < n){ b = n - 1 - i; s = 2 * i + 1; }
else{ b = i - n + 1; s = (2 * n - 1) - 2 * (i % n + 1); }
for(int j = 0; j < b; j++) cout << " ";
for(int j = 0; j < s; j... | ALGO | 0.999862 | 3.270227 |
5dfbf262-fd4b-4a82-8d67-85a10f966ad4 | ishandutta2007/codeforces | babanin_ivan/normal/316/B1.cpp | #include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <string>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long int64;
typedef long double ld;
const ld eps =... | ALGO | 0.999999 | 3.693411 |
e69a969a-4b1d-4669-8e8a-e607c28a68fb | sarvex/leetcode-small-basic | solution/1000-1099/1034.Coloring A Border/Solution.cpp | class Solution {
public:
vector<vector<int>> colorBorder(vector<vector<int>>& grid, int row, int col, int color) {
int m = grid.size();
int n = grid[0].size();
bool vis[m][n];
memset(vis, false, sizeof(vis));
int dirs[5] = {-1, 0, 1, 0, -1};
function<void(int, int, in... | ALGO | 0.999804 | 6.293697 |
d9c34e26-45f4-4a3f-aab3-6f91f0bde2bc | gharuks/001 | algo/algords/lab1/a.cpp | #include<iostream>
using namespace std;
#define null 1e9
int n=0;
long long m;
long long s[100000];
bool error(){
return n-1<0;
}void push(){
cin>>m;
s[n]=m;
n++;
cout<<"ok\n";
}void pop(){
if(error()) cout<<"error\n";
else{
cout<<s[n-1]<<endl;
s[n-1]=null;
n--;
... | ALGO | 0.974273 | 3.708717 |
a6f6ea51-86df-4274-9e33-80e8512e62db | vibinvp/musicplayer | 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.998685 | 6.798058 |
fe3b7562-9eb0-4188-ab71-630339247b13 | Aurake/Cataclysm-DDA | src/crash.cpp | #if defined(BACKTRACE)
#include "crash.h"
#include <cstdlib>
#include <csignal>
#include <cstdio>
#include <exception>
#include <initializer_list>
#include <typeinfo>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#if defined(TILES)
# if defined(_MSC_VER) && defined(USE_VCPKG)
# incl... | TOOL | 0.858639 | 7.379965 |
87e37428-cbf1-4523-9bbc-370dce0b5f86 | HG-IMMORTALS/Dynamic-Programming-master | 0-1 KNAPSACK Problems/1_Subset_Sum.cpp | // 0-1 KnapSack subsetsum Problem
#include <iostream>
using namespace std;
bool subsetsum(int arr[], int sum, int n)
{
bool t[n + 1][sum + 1];
for (int i = 0; i < n + 1; i++)
{
for (int j = 0; j < sum + 1; j++)
{
if (i == 0) // Initialisation (base case)
t[i][j]... | ALGO | 0.999981 | 6.126643 |
afce6728-d440-4585-b3d3-52ce68b09c36 | brenimcode/CompetitiveProgramingSolving | Aleatorios/faltandoEnergia.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,a,b,c,d;
cin >> n;
// n = número de casos de testes. a = ano, b = consumo por ano, c = outro ano, d = consumo do ano c.
while(n--){
cin >> a >> b >> c >> d;
// Calculo da taxa de crescimento
long double a... | ALGO | 0.997385 | 4.103812 |
0f2a5bae-e32d-4027-af11-fe8938a7ff0d | cla7aye15I4nd/kTsunemori | llvm-project/libcxx/test/std/containers/sequences/vector.bool/resize_size.pass.cpp | // <vector>
// vector<bool>
// void resize(size_type sz);
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
int main(int, char**)
{
{
std::vector<bool> v(100);
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() >= 100);
v.resi... | TEST | 0.85248 | 5.319684 |
a7ac0ada-0bf5-42b2-97bb-3be887c13d3b | yash5734/450-DSA-Cracker-Topics-Array | 746. Min Cost Climbing Stairs.cpp | class Solution {
public:
int solve(int ind, vector<int>&nums,vector<int>&dp){
if(ind>=nums.size()){
return 0;
}
if(dp[ind]!=-1) return dp[ind];
int first = solve(ind+1,nums,dp)+nums[ind];
int second = INT_MAX;
if(ind<nums.size()-1){
second = s... | ALGO | 0.999985 | 6.011461 |
26081866-e094-45f9-8436-6ea38d797805 | Vitaliy-X/ITMO_education | algorithms-and-data-structures/term2/LCA/TaskG.cpp | //
// Created by Виталий on 27.05.2023.
//
#include <set>
#include <vector>
#include <cstdio>
#include <string>
using namespace std;
constexpr int MAX = 1000005;
int color[MAX], res[MAX];
vector<vector<int>> g;
set<int> s[MAX];
void dfs(int v) {
s[v].insert(color[v]);
for (int to : g[v]) {
dfs(to);
if (s[v].... | ALGO | 0.999925 | 4.836659 |
afc4b4e7-d4bc-4d81-bf5b-9d62f701b355 | Afraz-M/cses-solutions | graph/teleportersPath.cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int>>> g;
vector<int> path;
vector<bool> vis;
void dfs(int node)
{
while (!g[node].empty())
{
int v = g[node].back().first;
int edge = g[node].back().second;
g[node].pop_back();
if (vis[edge])
con... | ALGO | 0.999992 | 4.367156 |
310f4649-dfd0-46f6-9553-3402b8aa276f | devartstar/Algorithms | GFG_DP/longestIncreasingSubsequence_Product.cpp | /*
-------------------------------------
| |
| Author - Devjit Choudhury |
| Date - 15.06.2021 |
| Time - 06:57:13 |
| |
-------------------------------------
Link - https://www.geeksforgeeks.org/maximum-product-increasing-subsequence/
*/
#include <bits/stdc++.h>
using namespace s... | ALGO | 0.999997 | 4.344613 |
4dff3780-10a1-4aed-8bd5-a8c662f38dcb | Sushant-Bansode/Standard-Template-Library-In-CPP | 01. Introduction to STL/Templates2.cpp | #include <iostream>
using namespace std;
template <typename T> class Array {
private:
T* ptr;
int size;
public:
Array(T arr[], int s);
void print();
};
template <typename T> Array<T>::Array(T arr[], int s)
{
ptr = new T[s];
size = s;
for (int i = 0; i < size; i++)
ptr[i] = arr[i];
}
template <typename T> v... | TOOL | 0.885234 | 5.049361 |
c2a7c921-59ed-45f4-98f2-164e46ff0c45 | Ozan7146/C-Works | swap1.cpp | #include<iostream>
using namespace std;
void swap(int *k,int *l){
int temp;
temp= *k;
*k = *l;
*l=temp;
cout<<"swap result is:"<<*k<<*l<<endl;
}
int main(){
int a =4;
int b =5;
swap(&a,&b);
return 0;
}
| ALGO | 0.99689 | 3.592232 |
e2eeb4cb-d127-4d5b-9530-9cec42be8636 | cakgok/AoC24 | 05 - Print Queue/5.cpp | #include <fstream>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <sstream>
#include <chrono>
#include <algorithm>
void parseRules(std::string& line, std::unordered_map<int, std::unordered_set<int>>& rules) {
size_t pos = line.find('|');
int x = std::stoi(line.... | ALGO | 0.997676 | 5.833714 |
d2f2d7d7-9f13-4779-ac3b-151726e01d3f | MMSS9402/algorithm | ProblemSolving/mincode/level29.5/29.5-9.cpp | #include <iostream>
#include <cstring>
using namespace std;
char vect1[20] = "ABABCGKABABC";
char vect2[20] = "BTBCKABABCT";
int n1, n2;
int getMaxSize(int a, int b)
{
int size = 0;
while (1)
{
if (a == n1 || b == n2)
break;
if (vect1[a] != vect2[b])
break;
... | ALGO | 0.99998 | 3.338085 |
72db9ad9-5a38-40e0-8373-90e515dccd27 | CDPS/Competitive-Programming | Codeforces/Ladders/1300/100-Adding Digits.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,n;
scanf("%d %d %d",&a,&b,&n);
int aux; bool f=0;
for(int i=0;i<10;i++){
aux = a*10; aux += i;
if(aux%b==0){ f=1;break;}
}
if(!f){
printf("-1\n");
return 0;
}
printf("%d",aux);
for(in... | ALGO | 0.998056 | 3.232343 |
c1e36f6d-559c-4630-bbc4-852f01f217d3 | tejasav-saxena/leetcode | 0445-add-two-numbers-ii/0445-add-two-numbers-ii.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 {
public:
ListNode* addTwoNumbe... | ALGO | 0.999911 | 6.426715 |
6a35afa9-7fe0-46ab-a49a-41e7b04a3aa4 | faci2000/Algorithms | Algorytmy grafowe/Mosty i punkty artykulacji/Rozwiazanie.cpp | #include<cstdio>
#include<vector>
#include<stack>
#include<utility>
using namespace std;
enum color
{
white=0,
grey=1,
black=2
};
void calculate(vector<vector<int> > &Diet, vector<int> &SubtreeSize, vector<bool> &ArticulationPoint, vector<bool> &FallAway, vector<int> &Level, int envoys)
{
for(int i=0;... | ALGO | 0.99973 | 4.11858 |
7e33bc0d-0e34-4ebd-ac38-520810c8514e | xifoxy/42Algorithm | W04/sgang/1660.cpp | #include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
const int SZ = 3e5 + 1;
int n, cnt = 1, tri = 1, ans;
int dp[SZ];
vector<int> num{1};
int min(int a, int b) { return a > b ? b : a; }
int main() {
scanf("%d", &n);
while (num.back() <= n)
num.push_back(num.back() + (tri += ++cnt))... | ALGO | 0.999981 | 3.852847 |
fb35bc96-3a16-45df-9418-7e265ef416f5 | vladkirakosyan/exercisesinCplus | Ex_42.cpp | #include <iostream>
int f1(int num){
while (num > 0) {
std::cout << num << " ";
return f1(--num);
}
}
int main() {
std::cout << "Insert positive number.\n";
int number = 0;
std::cin >> number;
f1(number);
return 0;
}
// Գրել ֆունկցիա, որը որպես արգումենտ ստանում է num ամբողջ տիպի
// փոփոխականը և տպում է n... | ALGO | 0.99919 | 5.243786 |
55b2df1b-6794-4bdf-8e21-4bd78f274db6 | DanilaKholod/study | 2019.09.25.ДЗ-Graph/SE_in_MS.cpp | #include <iostream>
using namespace std;
void SE_in_MS(int** A, int** B, int N, int M) {
for (int i = 0; i < M; i++) {
int j = 0;
int a, b;
a = B[i][j];
b = B[i][j + 1];
A[a-1][b-1] = A[b-1][a-1] = 1;
}
}
int main() {
int N, M;
cin >> N >> M;
int** spisok = new int*[M];
for (int i = 0; i < M; i++) {... | ALGO | 0.999954 | 3.052686 |
27872407-6cf6-4791-a1aa-f33ff3f2ab02 | lclpsoz/competitive-programming | CSES/dp/1145.cpp | #include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define LEN(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
using ll = long... | ALGO | 0.999901 | 4.444864 |
28a75633-2c46-4416-944f-723fc7c0b818 | Ismail-Upal/CP-Campaign | CP YKW/Phase 1 Part 2/Class 2/Product_of_Three_Numbers.cpp | #include<bits/stdc++.h>
using namespace std;
#define opt() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using ll = long long;
#define endl "\n"
#define sz(x) (ll)(x).size()
#define tc int t; cin >> t; for (int _ = 1; _ <= t; _++)
//-------------------------------------------
bool is_prime(int n){
if(n == 2)... | ALGO | 0.999902 | 4.862122 |
1af28053-9363-4d38-bee0-eeae0780f576 | lakshayarora8/Leetcode | 1326-minimum-number-of-taps-to-open-to-water-a-garden/1326-minimum-number-of-taps-to-open-to-water-a-garden.cpp |
class Solution {
public:
int minTaps(int n, vector<int>& ranges)
{
int taps = 0;
int maxi = 0, mini = 0; // initially both are zero
int lastTap = 0;
while(maxi < n)
{
for(int i = lastTap; i <= n; i++)
{
if(i - ranges[i] <= mini &... | ALGO | 0.999995 | 6.005734 |
f8480aea-79ff-4792-b9b2-c53f12fe897d | 1sks1/Data-Structure | 2. Bitwise Operators/is_power_of_2/is_power_of_2.cpp | #include<bits/stdc++.h>
using namespace std;
bool isPow2(int num)
{
while(num>0&&num!=2)
{
if(num%2==1)
return false;
num=num/2;
}
return num==2;
}
int main()
{
int num;
cin>>num;
cout<<isPow2(num);
return 0;
}
// time complexity is (logn) | ALGO | 0.999007 | 4.991267 |
0f702ce0-f083-4a96-889b-7beed3c5284c | Abhinav7076/My-Codes | LeetCode-Solutions-master/C++/prime-number-of-set-bits-in-binary-representation.cpp | // Time: O(log(R - L)) = O(1)
// Space: O(1)
class Solution {
public:
int countPrimeSetBits(int L, int R) {
static const unordered_set<uint32_t> primes{2, 3, 5, 7, 11, 13, 17, 19};
int result = 0;
for (int i = L; i <= R; ++i) {
result += primes.count(bitCount(i));
}
... | ALGO | 0.999945 | 6.083005 |
94ed5c31-72bd-41da-a0b9-876b2091c436 | xannik/SweKo-Lens | ecchi_PJ2_ImageProcessing/PJ2_ImageProcessing/main.cpp | #include <opencv2/opencv.hpp>
#include <iostream>
#include "ptr.h"
#include "myfunc.h"
using namespace std;
using namespace cv;
ptr psrc = ptr();
ptr pdst;
int main()
{
Mat src, temp;
try
{
src = imread("C:\\card.jpg", CV_LOAD_IMAGE_COLOR);
temp = imread("C:\\card.jpg", CV_LOAD_IMAGE_GRAYSCALE);
if (src.emp... | ALGO | 0.963578 | 3.968922 |
bb04b515-67fb-4e11-a22d-3578b0f3ba36 | K0nnyaku/Code | Data/CSP-JS2021二轮提高组数据/SD-00459/airport/airport.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int n,m1,m2,rk[200008];
bool vis[200008];
struct plane {
int t,val,tag;
} p1[200008],p2[200008];
bool cmp(plane pp1,plane pp2) {
return pp1.t < pp2.t || (pp1.t == pp2.t && pp1.val < pp2.val);
}
int coun... | ALGO | 0.99992 | 4.052218 |
89549736-6f6c-4368-af38-f6479a3ab194 | dldmldlsy/coding_test | 프로그래머스/unrated/120802. 두 수의 합/두 수의 합.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int num1, int num2) {
return num1+num2;
} | ALGO | 0.99524 | 4.671599 |
f71e977a-47ed-433d-8eb3-891e0d5567c8 | himanshusisodiya6377/DSA-QUESTIONS | 0976-largest-perimeter-triangle/0976-largest-perimeter-triangle.cpp | class Solution {
public:
// bool isValidTriangle(int a, int b, int c) {
// return (a + b > c) && (a + c > b) && (b + c > a);
// }
int largestPerimeter(vector<int>& nums) {
int n=nums.size();
sort(begin(nums),end(nums));
int maxi=0;
int i=n-1;
while(i-2>=0){
... | ALGO | 0.999906 | 5.075655 |
32c9f1c3-3977-48df-af15-9efbff406374 | vajanko/homeworks | 08. semester/Levenshtein/Levenshtein/Backup.cpp | void print_matrix(const std::vector<std::vector<size_type>> &matrix)
{
for (auto& row : matrix)
{
for (auto& item : row)
{
std::cout << item << " ";
}
std::cout << std::endl;
}
}
void calculate_diagonal(size_type base, size_type block_count, size_type block_size, const char*s, const char *t, size_type *d... | ALGO | 0.999868 | 3.54747 |
b8a8a3bb-bc3b-4abb-a621-5e6a3c7cc423 | luodi-7/VEX-Robtics | src/auto/auto_left_5.cpp | #include "../_includes.h"
// //抢中杆粽子;吐通道;吸预装,侧面网放预装;怼墙校准;挖角落粽子;推通道粽子
void auto_left_5() {}
// void auto_left_5() {
// int dist_fwd = 1255;
// dig.act_for_enc_absolute(enc_dig_prepare_to_cellect_triball, 100, 1500,
// Block::no); // 解锁
// chassis.stable_forward_dist_relative(dist_fwd, 1... | ALGO | 0.979588 | 3.84321 |
cfde7439-a98b-452b-a946-9fd227516bc1 | nickedes/Ni-Algos | Practice/Unorganised-Random/search.cpp | // Input - Sorted array, pivoted at some point.
#include <iostream>
using namespace std;
int binarySearch(int arr[], int low, int high, int num)
{
if (high < low)
return -1;
int mid = (low + high)/2;
if (num == arr[mid])
return mid;
if (num > arr[mid])
return binarySearch(arr, (mid + 1), h... | ALGO | 0.999983 | 5.477047 |
40938439-d353-4d33-a78d-c3958c14888f | ImMasterSam/SCIST-Solutions | 三章:資料結構與演算法/第四節:貪心與分治/貪心法/Watering Grass/Watering Grass.cpp | #include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
bool cmp(const pair<double, double> &a, const pair<double, double> &b){
if(a.f == b.f)
return a.s < b.s;
else
return a.f < b.f;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, l, w;
while(cin >> n >>... | ALGO | 0.999953 | 3.648078 |
3d93a3fa-cf54-4d5a-9da8-cd47565dea53 | NurAdlina-coder/uthm-dentcare | dark_mode_app/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.998307 | 6.776823 |
88bba526-06be-4ce5-87c0-8ed1694af931 | sweeneychris/TheiaSfM | libraries/akaze/akaze_features.cpp | /**
* @file akaze_features.cpp
* @brief Main program for detecting and computing binary descriptors in an
* accelerated nonlinear scale space
* @date Oct 07, 2014
* @author Pablo F. Alcantarilla, Jesus Nuevo
*/
#include <ctime>
#include "cimg/CImg.h"
#include "src/AKAZE.h"
#include "src/AKAZEConfig.h"
#include ... | TOOL | 0.962219 | 7.618206 |
d72e3daa-5bb5-444a-b15b-d0a6d27cf47a | caesr-uwaterloo/MapleBoard | benchmarks/parsec-3.0/pkgs/libs/tbblib/src/examples/pipeline/square/square.cpp | //
// Example program that reads a file of decimal integers in text format
// and changes each to its square.
//
#include "tbb/pipeline.h"
#include "tbb/tick_count.h"
#include "tbb/task_scheduler_init.h"
#include "tbb/tbb_allocator.h"
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
using nam... | DATA | 0.902855 | 5.409476 |
b406773b-c276-43dc-8c7e-7b6a15bc649c | Boshugege/Cpp_Primer | 1.10.cpp | #include <iostream>
int main(){
int val = 10;
while (val >=0){
std::cout << val << std::endl;
val --;
}
return 0;
}
| TOOL | 0.937084 | 3.014888 |
82cccbf3-9f9d-43ef-aae0-3d9fec8a4ddd | Koyingtw/CP | Codebook-master/Math/外星模運算.cpp | //a[0]^(a[1]^a[2]^...)
#define maxn 1000000
int euler[maxn+5];
bool is_prime[maxn+5];
void init_euler(){
is_prime[1] = 1; //一不是質數
for(int i=1; i<=maxn; i++) euler[i]=i;
for(int i=2; i<=maxn; i++) {
if(!is_prime[i]) { //是質數
euler[i]--;
for(int j=i<<1; j<=maxn; j+=i) {
is_prime[j]=1;
euler[j] = euler[j... | ALGO | 0.999912 | 3.655387 |
54c8e409-d895-4171-bc7d-9f4c098e3073 | AadityaShukla01/Interview-Preparation | 2503-longest-subarray-with-maximum-bitwise-and/2503-longest-subarray-with-maximum-bitwise-and.cpp | class Solution {
public:
int longestSubarray(vector<int>& nums) {
int n = nums.size();
int mxLen = 0;
int mx = *max_element(nums.begin(), nums.end());
int i = 0;
while(i < n)
{
int pre = i;
if(nums[i] == mx)
{
int j... | ALGO | 0.999909 | 5.892288 |
76895b0f-d2ab-4839-b169-0523461fb4e5 | akasharora506/LeetcodePractice | palindromic-substrings/palindromic-substrings.cpp | class Solution {
public:
int countSubstrings(string s) {
int n=s.length();
vector<vector<bool>> dp(n,vector<bool> (n,0));
int ans=0;
for(int i=0;i<n;i++){
for(int j=0;j<=i;j++){
if(i==j){
ans++;
dp[i][j]=1;
... | ALGO | 0.999981 | 6.193474 |
f9541769-467b-46a6-8d3b-87e5e28d943a | algorithm2020/Algorithm_PJH | stack_queue/boj_1874.cpp | #include <iostream>
#include <deque>
#include <vector>
std::vector<int> stack;
std::vector<char> resArr;
int initArr[100000];
int main() {
int n, temp;
std::cin >> n;
for (int i = 0; i < n; i++) {
std::cin >> initArr[i];
}
int idx = 1;
for(int i =0; i< n; i++){
if (stack.empty() || stack.back() != initArr[... | ALGO | 0.999995 | 4.209028 |
41272e1f-604d-445c-b990-6a51fc1b1cdc | Johannyjm/c-pro | AtCoder/abc/abc155/d.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;
const ll INF = 1LL << 60;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll n, k;
cin >> n >> k;
vector<ll> a(n);
r... | ALGO | 0.999931 | 3.636292 |
5b867179-dc0a-4edb-930a-7f4158269f06 | VaibhavYT/Codechef_Problem_Solving | Contest/Starter_66/Good_binary_string.cpp | #include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
string s;
cin>>s;
int n = s.size();
if(s[0]==s[n-1]){
cout<<n-2<<endl;
}
else{
cout<<2<<endl;
}
}
return 0;
}
| ALGO | 0.999639 | 4.080449 |
7a92cc6d-4762-4fdc-a8e9-652230226386 | Hitaansh04/Codeforces | 1806-a.cpp | #include <iostream>
using namespace std;
#include <vector>
int main(){
long long int t;
cin>>t;
while(t--){
int a,b,c,d;
cin>>a>>b>>c>>d;
pair <int,int> A,B;
A.first = a;
A.second = b;
B.first = c;
B.second = d;
int moves = 0;
if(B.seco... | ALGO | 0.999854 | 3.566991 |
59af6573-ced9-4bca-aadc-933bec968172 | GANJI-PRAVEEN/Leetcode-Solution | 0053-maximum-subarray/0053-maximum-subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int sum=0;
int ans=0;
bool pos=false;
for(auto it:nums){
sum+=it;
if(it>0)pos=true;
if(sum<0)sum=0;
ans=max(ans,sum);
}
if(!pos){
ans=INT... | ALGO | 0.999994 | 6.038773 |
1ee05a86-369f-4ea9-865b-4ae0d576fd7d | dwg03079/ardupilot_malddugi | libraries/AP_Math/polygon.cpp | #include "AP_Math.h"
#pragma GCC optimize("O2")
/*
* The point in polygon algorithm is based on:
* https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html
*/
/*
* Polygon_outside(): test for a point in a polygon
* Input: P = a point,
* V[] = vertex points of a polygon V[n+1] with V[n]=... | ALGO | 0.999879 | 7.160966 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.