uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
4e583cb0-3a11-4fdb-9883-3cdde4be15aa | ishandutta2007/codeforces | maspy/normal/1216/B.cpp | #line 1 "main.cpp"
#include <bits/stdc++.h>
#line 3 "/home/maspy/library/my_template.hpp"
using namespace std;
using ll = long long;
using ld = long double;
#define int ll
using pi = pair<int, int>;
using vi = vector<int>;
#define FOR(i, n) for (int i = 0; (i) < (int)(n); ++(i))
#define FOR3(i, m, n) for (int i = (m... | ALGO | 0.99999 | 4.384975 |
b61912e6-ec59-4a28-acff-beba56ef2970 | PulkitBxtra/90DaysDSA | Day 42/Diameter Of a Tree (More Efficient).cpp | #include <iostream>
#include <queue>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int val)
{
data = val;
left = NULL;
right = NULL;
}
};
int calcDiameter(Node* root,int* height){
if(root==NULL){
*height=0;
return 0;
}
... | ALGO | 0.99969 | 5.657163 |
445418ef-1487-4b9f-8afc-e02c0094924b | Anurag1224/DSA-Step-by-Step | Day_3 - Patterns/P16 - Pyramid Pattern/pattern16.cpp | // Pyramid pattern
// 1
// 1 2 1
// 1 2 3 2 1
// 1 2 3 4 3 2 1
// #include<iostream>
// using namespace std;
// int main() {
// int n;
// cout<<"Enter the value of n ";
// cin>>n;
// for(int i=0; i<n; i++){
// for(int j=i; j<n; j++){
// cout<<" ";
// }
//... | ALGO | 0.99993 | 5.008093 |
2f0cf702-78d5-4cef-8630-e84186259233 | Krish9220/cpp | Lecture_119_Russian_Doll/Russian_Dall_Problem.cpp | #include<iostream>
#include<vector>
using namespace std;
static bool comp(vector<int>&a,vector<int>&b)
{
if(a[0]==b[0])
return a[1]>b[1];
return a[0]<b[0];
}
int TimeOpti(int n,vector<vector<int>>&envelopes)
{
if(n==0)
return 0;
vector<int>ans;
ans.push_back(envelopes[0][1]);
... | ALGO | 0.999991 | 5.390279 |
16ee347f-4974-406a-96e7-91884e9a6b18 | Eve-Lyn/Mong2-Trinity | dep/g3dlite/source/filter.cpp | /**
@file filter.cpp
@author Morgan McGuire, http://graphics.cs.williams.edu
@created 2007-03-01
@edited 2007-03-01
Copyright 2000-2007, Morgan McGuire.
All rights reserved.
*/
#include "G3D/filter.h"
namespace G3D {
void gaussian1D(Array<float>& coeff, int N, float std) {
coeff.resize(N);
flo... | ALGO | 0.998611 | 4.061213 |
19cb74c4-a245-4fcc-a916-0d6a2c29394d | jadermcg/biomapp-chip | sources/smt/smt.cpp | #include "smt.h"
#include "smt_utils.h"
std::condition_variable cv, wrt;
std::mutex mtx;
std::queue<const arma::SpMat<uint64_t>*> save_queue;
std::ofstream smtdb;
std::atomic<bool> done_processing(false);
std::atomic<bool> done_writing(false);
//'Creates batches.
//'@name computeBatchSizes.
//'@param n Number of sequ... | ALGO | 0.995639 | 6.213501 |
322ab226-0d8f-47ad-bc71-a298c04932e2 | aryankd123/Coding_Problem_Solutions | cp_code/stl9.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include<unordered_map>
#include<cmath>
using namespace std;
typedef long long int lli;
void solve(){
unordered_map<int,string> m;
m[1]="abc"; //O(1). where n is the size of our map
m[6]="bcd";
m[3]="xyz";
for(auto it:m){ //h... | ALGO | 0.99796 | 4.621906 |
c185abeb-7505-47e2-95e4-15f7ae62eb41 | jk2g15/easyQgroundcontrol | libs/qwt/qwt_math.cpp | #include "qwt_math.h"
/*!
\brief Find the smallest value in an array
\param array Pointer to an array
\param size Array size
*/
double qwtGetMin( const double *array, int size )
{
if ( size <= 0 )
return 0.0;
double rv = array[0];
for ( int i = 1; i < size; i++ )
rv = qMin( rv, array... | TOOL | 0.997521 | 6.543721 |
db983da4-4361-4a90-895c-aee1342f9bcc | vaibhav0415/leetcode | 1047-maximize-sum-of-array-after-k-negations/1047-maximize-sum-of-array-after-k-negations.cpp | class Solution {
public:
int largestSumAfterKNegations(vector<int>& nums, int k) {
priority_queue<int, vector<int>,greater<int>> pq(nums.begin(),nums.end());//O(N)
int sum=0;
for(int i=0;i<nums.size();i++) sum+=nums[i];
while(k-->0){
int ele=pq.top();
if(ele==... | ALGO | 0.999989 | 5.16029 |
32b78e5b-8e99-48ba-af9b-f459c12e53ed | MoreDrinkHotWater/Blender | extern/quadriflow/src/adjacent-matrix.cpp | #include "config.hpp"
#include "adjacent-matrix.hpp"
#include "dedge.hpp"
#include <fstream>
namespace qflow {
void generate_adjacency_matrix_uniform(
const MatrixXi &F, const VectorXi &V2E, const VectorXi &E2E,
const VectorXi &nonManifold, AdjacentMatrix& adj) {
adj.resize(V2E.size());
#ifdef WITH_OMP
#pragma omp... | ALGO | 0.979911 | 4.479256 |
9859f17e-d128-4253-affa-fdeb131d922d | Kaitlyn-Williams/LudoVariant-Final | Board.cpp | #include <iostream>
#include "Board.h"
#include "Piece.h"
using namespace std;
/* constructor - sets up initial board state*/
Board::Board() {
for(int i = 0; i < 15; i++) {
for(int j = 0; j < 15; j++) {
if ((i == 0 || i == 14) && (j > 5 && j < 9)) //top and bottom ends
{ grid[i... | ALGO | 0.850084 | 3.552144 |
fd066077-9efe-489d-8ce5-ff8e6d5bd09e | kamyu104/LeetCode-Solutions | C++/determine-color-of-a-chessboard-square.cpp | // Time: O(1)
// Space: O(1)
class Solution {
public:
bool squareIsWhite(string coordinates) {
return (coordinates[0] - 'a') % 2 != (coordinates[1] - '1') % 2;
}
};
| ALGO | 0.983367 | 5.796758 |
19e03256-e57d-4e36-a7f6-d32dceac2ec6 | naguimaraes/compilers | Etapa5/tac.cpp | // Federal University of Rio Grande do Sul - Institute of Informatics - Compilers 2025/1
// Three Address Code (TAC) implementation file made by Nathan Alonso Guimarães (00334437)
#include "tac.hpp"
#include <iostream>
#include <sstream>
#include <iomanip>
// Forward declarations for internal functions
TAC* tacCreate... | TOOL | 0.965694 | 6.451064 |
d7b4b557-0aa7-4209-86c0-39114c9ce244 | yosh20004/RotNet-MishOpt | opti/mymish_onnxpool.cpp | #include <cmath>
#include <cstdio>
#include <xmmintrin.h> // for SSE
#include <immintrin.h> // for AVX2
#include "avx_mathfun.h"
// ONNX Runtime C++ API 头文件
#include "onnxruntime-linux-x64-1.22.0/include/onnxruntime_cxx_api.h"
#include "onnxruntime-linux-x64-1.22.0/include/onnxruntime_c_api.h"
con... | DATA | 0.983743 | 6.13969 |
0dd39657-2017-48ae-84fd-ae6d6475c988 | ishandutta2007/codeforces | emilan/normal/1305/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define vt vector
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fi first
#define se second
using ll = long long;
using pii = pair<int, int>;
void solve() {
... | ALGO | 0.999894 | 3.797448 |
47f6c3b8-4ebb-4dce-b799-7f55b44e4c61 | nyankosama/leetcode | cpp/src/WildcardMatching.cpp | /*=============================================================================
#
# Author: Nyankosama email:<EMAIL>
#
# Last modified: 2015-02-02 01:22
#
# Filename: WildcardMatching.cpp
#
# Description: https://oj.leetcode.com/problems/wildcard-matching/
#
=============================================================... | ALGO | 0.99981 | 4.811227 |
8495eaac-8e5f-4b76-b50b-b21a56a90999 | ishandutta2007/codeforces | oleh1421/normal/1665/D.cpp | #include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(NULL));
//#define endl '\n'
typedef long long ll;
typedef long double ld;
const int N=200010;
const int L=20;
const ll mod=998244353;
ll ask(ll a,ll b){
cout<<"? "<<a<<" "<<b<<endl;
ll ans;cin>>ans;
return ans;
}
void solve(){
ll a=0ll;
... | ALGO | 0.999696 | 3.647475 |
cc77dcad-2df7-4485-b6f6-db4c89927377 | Coconut-X/LeetCode-DSA | 0806-domino-and-tromino-tiling/0806-domino-and-tromino-tiling.cpp | class Solution {
public:
unordered_map<long,long> dp;
int numTilings(int n) {
const int MOD=1e9+7;
dp[1]=1;
dp[2]=2;
dp[3]=5;
if(n<=3) return dp[n];
for(int i=4;i<=n;i++)
dp[i]=(2*dp[i-1]+dp[i-3])%MOD;
return dp[n];
}
}; | ALGO | 0.999983 | 5.873945 |
fb9dd564-ee8d-4769-8e71-5580d1c72c21 | tarang0/searching-sorting | sorting/inserstionSort.cpp | #include <iostream>
#include <vector>
using namespace std;
void insertionSort(vector<int> arr){
int n=arr.size();
// rounds 1 to n-1
for (int round=1;round<n;round++){
// STEP 1- fetch
cout<<"round "<<round<<endl;
int val=arr[round];
int j;
for (j=round-1;j>=0;j--)... | ALGO | 0.999976 | 4.646724 |
51ad1cb8-06e4-46ed-88bc-fc9d52e58a1b | durgaprasadpara/TOC | nfa.cpp | #include<stdio.h>
#include<string.h>
int main()
{
int i,j,k,l,m,next_state[20],n,mat[10][10][10],flag,p;
int num_states,final_state[5],num_symbols,num_final;
int present_state[20],prev_trans,new_trans;
char ch,input[20];
int symbol[5],inp,inp1;
printf("How many states in the NFA : ");
sc... | ALGO | 0.999383 | 4.128811 |
4c02ac7f-b180-4b4d-aae5-3a3a90dfc483 | aanjaneykumarverma/CSES | Dynamic_Programming/Book_Shop.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n, x;
cin >> n >> x;
vector<int> h(n + 1, 0), s(n + 1, 0);
vector<vector<int>> dp(n + 1, vector<int>(x + 1, 0));
for (int i = 1; i ... | ALGO | 0.999953 | 3.836087 |
7cda61ea-d3bd-48a6-afba-061b35c3e9f6 | jkcollins1024/ball-game | dependencies/Box2D/Box2D/Dynamics/Contacts/b2CircleContact.cpp | #include <Box2D/Dynamics/Contacts/b2CircleContact.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Dynamics/b2WorldCallbacks.h>
#include <Box2D/Common/b2BlockAllocator.h>
#include <Box2D/Collision/b2TimeOfImpact.h>
#include <new>
b2Contact* b2CircleContact::Create(b2Fixture*... | ALGO | 0.961174 | 6.984516 |
b815b919-9d48-4f94-97ef-984934d5149d | boatinw99/CompetitiveProgramming | SSWT 2.2/MATCHING - Fast Maximum Matching.cpp | #include<bits/stdc++.h>
using namespace std ;
const int N = 1e5+9 ,inf = 2e9 ;
queue<int> q ;
vector<int> g[N];
int match[N],dist[N],n,m ;
bool bfs()
{
for(int i=1;i<=n;i++)
{
if(!match[i])
{
dist[i]=0;
q.push(i);
}
else dist[i]=inf ;
}
dist[0]=inf... | ALGO | 0.999789 | 4.034293 |
0182a22f-cf25-4fb0-bb53-4aa0b5ae474e | HARSHA-VSK1/stacks | stacks.cpp | #include <iostream>
using namespace std;
#define max 5
class stack{
public:
int stack_arr[max];
int top = -1;
void Push(stack s, int val){
if(s.top!=max-1){
s.stack_arr[++s.top] = val;
++s.top;
cout << s.top << endl;
}... | ALGO | 0.977136 | 3.972775 |
eee1f9bf-18bc-4c96-91f2-67cff52bb572 | zorkian/http-headerparser-xs | headers.cpp | #include "headers.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
using namespace std;
/******************************************************************************
* HELPER FUNCTIONS ***********************************************************
*******************************************************... | TOOL | 0.94013 | 3.564225 |
06ae438b-da9e-4ce5-a468-504d7a88b8d9 | ZZiAnnn/XMU-Learning | 大二下/计算机图形学/Lab/计图实验5/eigen-3.3.7/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the vector b:\n" << b << endl;
Vector3f x = A.colPivHouseholderQr... | ALGO | 0.999967 | 3.366961 |
85487123-bf2e-4160-b5a8-2bfa4abb0f73 | beenchangseo/algorithm-study | practice/DP/11726.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n; vector<int> dp(1001,0);
cin >> n;
dp[1] = 1;
dp[2] = 2;
dp[3] = 3;
for (int i = 4; i <= n; ++i) {
dp[i] = (dp[i-1] + dp[i-2]) % 10007;
}... | ALGO | 0.999984 | 4.697257 |
3f2be738-fc60-4cf8-b3de-cccaba45dbe0 | sss-lehigh/rdtsc-versioning | basic_rdtsc_tests/timestamp.cpp | // Author: Olivia Grimes
#include <iostream>
#include <thread>
#include <vector>
#include <chrono>
#include <atomic>
#include <mutex>
#include <unistd.h>
#include <cstdlib>
#include <cstring>
#define MILLION 1000000
// configure based on machine used for testing:
#define CUTOFF 96
#define NUMA_ZONES 4
#define NUMA_Z... | TOOL | 0.962724 | 5.311153 |
ce5de28c-d4a1-40a2-997d-179e8e0ac8fa | RobyDoge/PPDC-SortingComparison | SortingAlgorithms/SortingAlgorithms/SelectionSort.cpp | // selection_sort.cpp
#include "SelectionSort.h"
#include <algorithm>
#include <iostream>
#include <queue>
SelectionSort::SelectionSort() {
// Initialize MPI environment
MPI_Comm_size(MPI_COMM_WORLD, &_size);
MPI_Comm_rank(MPI_COMM_WORLD, &_rank);
}
std::string SelectionSort::GetName() const
{
return ... | ALGO | 0.999974 | 4.932053 |
d0634ebf-7324-410e-838f-05421964e4bf | ArutoriaWhite/Competitive-programming | tcd015.cpp | #include <bits/stdc++.h>
#define de(x) cout << #x << "=" << x << ", "
#define dd cout << '\n';
#define rep(i,j,k) for (int i=j; i<=k; i++)
#define ShinraTensei ios::sync_with_stdio(0), cin.tie(0);
#define ff first
#define ss second
#define int long long
#define SZ(x) ((int)x.size())
#define pb push_back
#define mem(a,x... | ALGO | 0.999979 | 3.066183 |
c24ac414-26a4-49f4-9e1d-028ab6d301be | ellynhan/challenge100-codingtest-study | hall_of_fame/wi-seong-cheol/BOJ/0x0C BackTracking/15650.cpp | //
// 15650.cpp
// wi-seong-cheol
//
// Created by wi_seong on 2022/11/22.
//
/*
[Input]
4 2
[Output]
1 2
1 3
1 4
2 3
2 4
3 4
*/
// 시간복잡도: O(2^n)
// 최악시간: 256
// 난이도: Silver 3
// Timer: 10m
// Url: https://www.acmicpc.net/problem/15650
#include <iostream>
#include <algorithm>
#include <vector>
using nam... | ALGO | 0.999997 | 4.362667 |
ef2e7c44-a042-4196-bdb2-510b1968a602 | camilorojas10/Laboratorio_01 | Problema8/main.cpp | #include <iostream>
using namespace std;
int n,num=1,k=0,cont=0,primo=0;
int main()
{
cout<<"Ingrese un numero para hallar el primo "<<endl;cin>>n;
while(n>cont){
for(int i=1;i<=num;i++){
if (num%i==0){
k+=1;
}
}
if (k==2){
cont++;
... | ALGO | 0.996886 | 3.033501 |
fa6bc27b-27dc-4f07-b794-68f5cb198536 | Pxguin/cpp | advent_of_code/2023/trebuchet_1.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define v vector
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int n = 1000;
string s;
ll ans = 0;
F0R(i,n) {
cin >> s;
v<int> num;
for (char c : s) {
if (c-'... | ALGO | 0.999435 | 4.365186 |
43022234-1bd5-4add-9be3-367ae19b0157 | GersonCavalheiro/OpenMPSnapshot | May2023/RepC/121274041/matrix_multiplication_openmp.cpp | #include <iostream>
#include <stdlib.h>
#include <sys/time.h>
using namespace std;
int thread_count = 1;
void multiply(double ** &mat1,double ** &mat2,double ** &res,int m,int n,int o);
void transpose(double ** &res, int m, int o);
void matAlloc(double ** &mat, int row, int col);
void matClean(double ** &mat, i... | ALGO | 0.991594 | 3.861164 |
69a8de35-d866-4949-8a80-b28e82a0c318 | Raushan-Sharma/Code_world | BinaryTree/BinaryTree.cpp | #include<iostream>
#include<queue>
using namespace std;
typedef pair<int,int> pii;
class TreeNode{
public:
int data;
TreeNode* left, *right;
TreeNode(int d){
data=d;
left=NULL;
right=NULL;
}
};
class BinaryTree{
private:
TreeNode * root;
public:
BinaryTree(){root=NULL;... | ALGO | 0.999962 | 4.599473 |
ec3397b9-0111-4e28-8943-4fc1059bee05 | grympan/Object-Oriented_Programming_1 | 09week/EX1-2 (1) 9WEEK.cpp | #include <iostream>
using namespace std;
int main()
{
int aa[4];
int sum = 0;
int i;
for(i=0; i<=3; i++)
{
cout << "Enter the " << i+1 << "th number : ";
cin >> aa[i];
sum += aa[i];
}
cout << "Sum : " << sum << endl;
} | ALGO | 0.978358 | 3.351692 |
850e682c-9125-42e3-857f-a984ac8cebfd | UrvashiKishnani/codeforces | 1139A_Even_Substrings.cpp | #include <bits/stdc++.h>
#define boost1 ios::sync_with_stdio(0)
#define boost2 cin.tie(0)
using namespace std;
int main()
{
boost1; boost2;
long long n, c = 0;
cin>>n;
string s;
cin>>s;
for(long i = 0; i < n; i++) {
if((int)s[i] % 2 == 0) {
c += i + 1;
}
}
... | ALGO | 0.999539 | 3.641413 |
8a8dd187-77dd-4c9d-82a5-7bb9309e20d2 | sahan11/leetcode-submissions | 3413-find-the-first-player-to-win-k-games-in-a-row/find-the-first-player-to-win-k-games-in-a-row.cpp | class Solution {
public:
int findWinningPlayer(vector<int>& skills, int k) {
int cur = skills[0];
int cur_ind = 0;
int streak = 0;
for(int i = 1;i<skills.size();i++) {
if(cur > skills[i]) {
streak++;
}
else {
streak ... | ALGO | 0.999981 | 5.658566 |
64c03d94-65a4-4e67-8ace-94d7a499867f | raziullah7/DSA-in-C-Plus-Plus | Sorting Techniques/Heap Sort/Heap Sort.cpp | // Heap Sort.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
using namespace std;
#include <iostream>
// declaring and defining the Max Heap class
template<class T>
class MaxHeap
{
private:
T* arr;
int n;
public:
MaxHeap(int size);
void Display();
void Insert(int size);
... | ALGO | 0.999912 | 4.734754 |
08acdd93-a188-4b31-b352-042561c75a7e | AhongBOSS/coding | C++/ZeroJudge/a003.cpp | #include <iostream>
using namespace std;
int main()
{
int M,D,S;
cin >> M >> D;
S = (M*2+D)%3;
if(S==0)
{
cout <<"普通\n";
}
else if (S==1)
{
cout <<"吉\n";
}
else
{
cout <<"大吉\n";
}
return 0;
} | ALGO | 0.999869 | 3.224512 |
6af529b0-1b30-49ab-ad04-5d9098b226ab | MedranoApol/Cplusplus-Fall2024 | Chapter 1 Programs/Jim and Paul 3.cpp | #include <iostream>
using namespace std;
int main ()
{
int JimScore, PaulScore, JimTota1, PaulTota1;
cout << "Press return (enter key) after you insert a number. \n";
cout << "Jim and Paul have a competition to see who has the highest score on each test! \n";
cout << "Whoever wins on a test gets 100 points added to... | ALGO | 0.992856 | 3.472868 |
1f5b8d63-3f0a-4b90-92ab-e1140ffb1242 | yexis/OI | nowcoder/norank/香港城市大学(东莞)2024新生排位赛/a.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/hash_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
template<class KT, class VT = null_type>
using RBTree = tree<KT, VT, std::less<KT>, rb_tree_tag, tree_order... | ALGO | 0.999735 | 4.650623 |
f682a090-0930-44cd-bc9a-401bf0d02c68 | Vignesh1399/Programming-Contests | Topcoder/ChristmasLightsFixing.cpp | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define sz(a) signed(a.size())
using namespace std;
class ChristmasLightsFixing {
public:
ll ncr(int n, int r, vector<ll>... | ALGO | 0.999952 | 4.182669 |
e8562933-7250-4a50-bdcd-3dda00851874 | justin0u0/LeetCode | problems/2070-most-beautiful-item-for-each-query/solution.cpp | /**
* Author: justin0u0<<EMAIL>>
* Problem: https://leetcode.com/problems/most-beautiful-item-for-each-query/
* Runtime: 31ms (100.00%)
*/
const static auto _ = []() {
cin.tie(nullptr)->sync_with_stdio(false);
return nullptr;
}();
class Solution {
public:
vector<int> maximumBeauty(vector<vector<int>>& items... | ALGO | 0.999946 | 6.092794 |
0e7f11d4-10b7-48aa-bab5-2130291c3963 | gratus907/Gratus_PS | BOJ Originals/[BOJ Steps] BOJ 단계별로 풀어보기/[08] 문자열/01316 그룹 단어 체커.cpp | #include <cstdio>
#pragma warning(disable:4996), _CRT_SECURE_NO_WARNINGS
using namespace std;
int occurence[26];
int check()
{
char word[102];
scanf("%s", word);
for (int i = 0; i < 103; i++)
{
if (word[i] < 'a' || word[i] > 'z')
break;
if (i > 0)
{
if (word[i] == word[i - 1])
continue;
}
if (... | ALGO | 0.999762 | 3.658597 |
616195d7-f326-476b-8920-71a0ea631ea6 | npv2k1/CTDLvaGT | ZCode/Cpp/DSA06024.cpp | #include<iostream>
using namespace std;
void out(int *a,int n){
for (int i = 0; i < n; i++)
{
cout<<a[i]<<' ';
}
cout<<endl;
}
int main(){
int n;
cin>>n;
int *a = new int[n];
for (int i = 0; i < n; i++)
{
cin>>a[i];
}
for(int i=0;i<n-1;i++){
int... | ALGO | 0.999943 | 3.816465 |
9557e468-d994-4ed5-9819-6ee7c9624cb3 | Apress/beginning-cpp20 | Examples/NoModules/Chapter 12/Ex12_17/Ex12_17.cpp | // Using a linked list
#include "RandomBoxes.h"
#include "Truckload.h"
int main()
{
Truckload load1; // Create an empty list
// Add 12 random Box objects to the list
const size_t boxCount {12};
for (size_t i {} ; i < boxCount ; ++i)
load1.addBox(randomSharedBox());
std::cout << "The first list:\n";
... | ALGO | 0.985719 | 4.989976 |
e02c0a49-c447-44ac-ba7b-fe60b452caf1 | Arpitpundir/Binary-Tree | verticalOrder.cpp | class Solution {
public:
vector<vector<int>> verticalOrder(TreeNode* root) {
map<int, vector<int> > mp;
queue<pair<TreeNode*, int> > q;
vector<vector<int> > ans;
if(!root) return ans;
q.push({root, 0});
q.push({NULL, 0});
/*
* initialize queue... | ALGO | 0.999994 | 6.060634 |
39fa4e45-3b3e-4db0-a03b-f91f863c0870 | chyhhwen/image-recognition-java | opencv/sources/modules/stitching/src/exposure_compensate.cpp | #include "precomp.hpp"
namespace cv {
namespace detail {
Ptr<ExposureCompensator> ExposureCompensator::createDefault(int type)
{
if (type == NO)
return makePtr<NoExposureCompensator>();
if (type == GAIN)
return makePtr<GainCompensator>();
if (type == GAIN_BLOCKS)
return makePtr<Blo... | ALGO | 0.935011 | 5.976672 |
0e9065ea-7965-4742-9de9-756c4bef47ec | Axnjr/snn_be_pro | cpp-core/src/mlpack/tests/nca_test.cpp | /**
* @file tests/nca_test.cpp
* @author Ryan Curtin
*
* Unit tests for Neighborhood Components Analysis and related code (including
* the softmax error function).
*
* mlpack is free software; you may redistribute it and/or modify it under the
* terms of the 3-clause BSD license. You should have received a cop... | TEST | 0.909306 | 7.548658 |
0bd71fcc-f9b5-4ff5-b443-0ea6e54ab09e | nh0znoisung/Online_Judge-Competitive_Programming | Codeforces/2021/Round#697.Div 3/A_Odd_Divisor.cpp | #include <bits/stdc++.h>
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i)
#def... | ALGO | 0.999871 | 4.822219 |
a2a592ec-1328-4a29-8fa4-4ccba8cb5371 | ishandutta2007/codeforces | babanin_ivan/normal/45/G.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <queue>
#include <memory.h>
#include <stack>
#define mp make_pair
#define pb push_back
#define setval(a,v) mems... | ALGO | 0.999942 | 3.277493 |
1eabe988-372a-4bc7-aeab-31ee53bf39b1 | IncoCura/qt5 | qtwebengine/src/3rdparty/chromium/third_party/WebKit/Source/platform/transforms/Rotation.cpp | #include "platform/transforms/Rotation.h"
#include "platform/animation/AnimationUtilities.h"
#include "platform/transforms/TransformationMatrix.h"
namespace blink {
namespace {
const double kAngleEpsilon = 1e-4;
Rotation ExtractFromMatrix(const TransformationMatrix& matrix,
const Rotatio... | TOOL | 0.883669 | 7.741171 |
fd5fed4b-1b31-4acb-9390-ac512d7df354 | TenNeon/AdventOfCode2020 | AdventOfCode2020/Day3/Day3.cpp | #include <vector>
#include <algorithm> // transform
#include "Helper.h"
using namespace Helper;
struct Slope
{
int right;
int down;
};
struct Position
{
int x;
int y;
bool tree;
Position() : x(-1), y(-1), tree(false){}
Position(int x_in, int y_in, bool tree_in) : x(x_in), y(y_in), tree(tree_in) {}
... | ALGO | 0.999912 | 5.792717 |
c4d45af1-b722-44c4-ab67-79dcc0f897de | Hooollin/codeforces | div3/847/D.cpp | #include <iostream>
#include <map>
using namespace std;
void solve() {
int n;
cin >> n;
map<int, int> mp;
for(int i = 0; i < n; i += 1) {
int v;
cin >> v;
mp[v] += 1;
}
mp[1000000005] = 0;
int ans = 0;
int prev = -1, now = 0;
for(auto &[curr, count] : mp) {
if(prev == curr - 1) {
... | ALGO | 0.999883 | 5.297902 |
30498204-7a45-448e-ae5c-2a6b1ae65167 | bhagwan8815/CodeSync | BackEnd/src/services/codes/0bc31351-5f84-4285-99f9-94c50b9e302d.cpp | #include <iostream>
int main() {
int num1 = 80, num2 = 83, num3 = 5;
int sum = num1 + num2 + num3;
std::cout << "The sum of " << num1 << ", " << num2 << ", and " << num3 << " is: " << sum << std::endl;
return 0;
} | ALGO | 0.998884 | 4.187676 |
c3ae845d-a7dc-4f86-9e02-f100d87cdae2 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3306_4.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j;
long long a[100000], min1 = 1e18;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a[i];
if (a[i] < min1) min1 = a[i];
}
long long k = min1 / n;
long long t = k * n;
for (i = 0; i < n; i++) {
a[i] -= t;
}
for (j = 0; j < 2... | ALGO | 0.999986 | 3.392435 |
c33bf7b2-74dc-4ee1-a64f-faf747fc1f1e | Tphuong612/DSA | DSA codeptit/0. sap xep-tim kiem/dsa06008 dem cap.cpp | #include <bits/stdc++.h>
using namespace std;
long long binpow(int a, int b)
{
long long res=1;
if(b==0) return 1;
long long x =binpow(a,b/2);
if(b%2==1) return x*x*a;
else return x*x;
}
int main()
{
int t;
cin>>t;
while(t--){
int n, m;
cin>>n>>m;
int x[n+5], y[m+5];
for(int i=0;i<n;i++) cin>>x[i];
fo... | ALGO | 0.999877 | 3.654716 |
8375fa8d-4bcd-481f-9c82-ea09bee55dca | satishSingh0710/LeetCoding | 0236-lowest-common-ancestor-of-a-binary-tree/0236-lowest-common-ancestor-of-a-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 Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
if (!root ) ... | ALGO | 0.999976 | 5.981971 |
c270c833-2d94-4852-9d1c-a46c99c7e3a2 | Abhi2359/abhi_2359 | 0033-search-in-rotated-sorted-array/0033-search-in-rotated-sorted-array.cpp | int getPivot(vector<int>& arr, int n) {
int s = 0;
int e = n-1;
int mid = s + (e-s)/2;
while(s<e) {
if(arr[mid] >= arr[0])
{
s = mid+1;
}
else{
e = mid;
}
mid = s + (e-s)/2;
}
return s;
}
int binarySearch(vector<int>& ar... | ALGO | 0.999997 | 6.170393 |
9dfd78dd-0f01-4baa-a6f3-36b99d5620f0 | Rodrigo61/GUAXINIM | URI/2667/main.cpp | bool debug = true;
//<editor-fold desc="GUAXINIM TEMPLATE">
/******** All Required Header Files ********/
#include "bits/stdc++.h"
using namespace std;
#define all(container) container.begin(), container.end()
#define mp(i,j) make_pair(i,j)
#define space " "
#define pb push_back
typedef pair<int,int> pii;
typedef ... | ALGO | 0.999144 | 3.079324 |
9450a9d1-989f-47de-83d2-ee04dbe75af2 | KRaval-tech/rewarded_ad | 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 |
ee73c7aa-c515-4e99-b143-2989336cbf74 | bhataasim1/iust3rdsem | Assignment 3 OOPS C++/Q1.cpp | #include <iostream>
#define PI 3.14159
using namespace std;
float cirarea (float radius) //declaration of Function
{
radius = PI * (radius * radius); // Calculating Area of Circle
return radius;
}
int main()
{
float rad;
cout <<"Enter the Radius of Circle : ";
cin >> rad;
cout <<"Area o... | ALGO | 0.99796 | 4.110354 |
321aa14b-b10f-4b89-ab7e-8bd8050d8394 | xfu2006/zkregex | code/zkregex/jsnark/libsnark/depends/libfqfft/depends/libff/libff/algebra/curves/bn128/bn128_g2.cpp | /** @file
*****************************************************************************
* @author This file is part of libff, developed by SCIPR Lab
* and contributors (see AUTHORS).
* @copyright MIT license (see LICENSE file)
***********************************************************************... | ALGO | 0.941886 | 6.818189 |
a34087ea-a444-4397-b8f7-52d17bacaa7f | 7hokerz/bakjoon | bakjoonmoeum(C++)/그외 유형/자료구조/(연결리스트)/31857번(연결리스트).cpp | #include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
int N, R, Q;
string input;
char inp;
list <char> first, s... | ALGO | 0.999778 | 4.267741 |
0e1f4bc6-0175-4630-8df8-9e10ec10204a | OSCC-Project/iEDA | src/operation/iPNP/source/module/optimizer/PdnOptimizer.cpp | /**
* @file PdnOptimizer.cpp
* @author Jianrong Su
* @brief
* @version 1.0
* @date 2025-06-23
*/
#include "PdnOptimizer.hh"
#include "PNP.hh"
#include "PNPConfig.hh"
#include "SimulatedAnnealing.hh"
#include "idm.h"
#include "log/Log.hh"
namespace ipnp {
PdnOptimizer::PdnOptimizer()
: _opt_score(0.0),
... | ALGO | 0.999146 | 6.334635 |
d2202ec5-edd8-4d16-b46f-f0ba96aaf67e | tobiasnmf/kattis | moneymatters/moneymatters.cpp | #include <iostream>
#include <vector>
using namespace std;
vector < pair<int, vector<int>>> person;
vector<bool> visited;
int visit(int ind) {
if (visited[ind])
return 0;
visited[ind] = true;
int sum = person[ind].first;
for (const auto& next : person[ind].second) {
sum += visit(next);
}
return sum;
}
in... | ALGO | 0.999977 | 4.484436 |
b74f4d93-4bcc-47ba-bd42-7f6ad3538eb9 | xl-r-8/Leetcode-Solns | 542-01-matrix/01-matrix.cpp | #define LC_HACK
#ifdef LC_HACK
const auto __ = []() {
struct _ {
static void writeRuntime() { std::ofstream("display_runtime.txt") << 0 << '\n'; }
};
std::atexit(&_::writeRuntime);
return 0;
}();
#endif
class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {
... | ALGO | 0.999983 | 6.239016 |
d256112e-c68a-4120-bdfb-b4c8842aba32 | b1129006/data-structure | Hw1/main2-1(0).cpp | #include <iostream>
#include <string>
#include <cstring>
#include <string.h>
using namespace std;
int main() {
int x;
int y;
cout << "Number of people:" << endl;
cin >> x;
cout << "The maximun length of the name: " << endl;
cin >> y;
cin.get(); // cin.get 吃掉換行
char a[y+1];
char **p ... | ALGO | 0.994999 | 3.747723 |
292341f2-42dc-4e58-8b1c-4079eaf03b78 | syafiraarif/ParadigmaOOP2_0194 | polymorph/polymorph.cpp |
#include <iostream>
using namespace std;
class seseorang
{
public:
//pure virtual function
virtual void pesan() = 0;
//virtual function biasa
/*virtual void pesan()
{
cout << "Pesan Dari Seseorang" << endl;
}*/
};
class joko : public seseorang
{
public:
//deklarasi
void p... | TOOL | 0.951228 | 5.810472 |
aa789513-90a3-48e9-9238-02a6e4af9652 | Anurag340/Recursion | Factorial.cpp | #include<bits/stdc++.h>
using namespace std;
int fact(int n){
//base case
if(n==1){
return 1;
}
return n*fact(n-1);
}
int main(){
int n;
cin>>n;
int ans=fact(n);
cout<<"Factorial of "<<n<<" is : "<<ans<<endl;
} | ALGO | 0.999929 | 5.107708 |
fbcfc2fe-aae5-427b-94af-99872d635245 | jacklin5168/LeetcodeLocal | cpp/113.path-sum-ii.cpp | /*
* @lc app=leetcode id=113 lang=cpp
*
* [113] Path Sum II
*
* https://leetcode.com/problems/path-sum-ii/description/
*
* algorithms
* Medium (50.01%)
* Total Accepted: 438.9K
* Total Submissions: 866.2K
* Testcase Example: '[5,4,8,11,null,13,4,7,2,null,null,5,1]\n22'
*
* Given the root of a binary tr... | ALGO | 0.999925 | 6.863641 |
72fce9c3-6a5f-4e24-afd6-80524a552091 | MuVen/LeetCode | 655. Print 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 Solution {
vector<vector<string>> ans;
public:
int getHeight(TreeNode* root){
if(root == nullptr)
... | ALGO | 0.99997 | 6.140948 |
30cfd369-25b7-4840-bd01-9bc78b1ce4e8 | jongyeon95/algorithmStudy | 백준/c++ 로 풀어본 문제/2156번 포도주 시식.cpp | #include <iostream>
using namespace std;
int main(){
int grape[10001];
int dp[10001];
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> grape[i];
}
dp[1]=grape[1];
dp[2]=grape[2]+grape[1];
for (int i = 3; i <= n; i++)
{
dp[i]=max(dp[i-2]+grape[i],max(dp[i-1],dp[i-3]+grape[i-1]+grape[i]));
}
co... | ALGO | 0.999988 | 4.180447 |
ca90b687-e5e6-4ae8-9357-d35ba60ded9b | Harshit44/spoj | GANNHAT.cpp | #include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
inline void getmin(int &x,int y) { if(y<x) x = y; }
#define debug() printf("%d\n",__LINE__)
struct p { int x, y, ix; };
int lxly(const p& a,const p &b) {
if(a.x == b.x && a.y == b.y) return a.ix<b.ix;
if(a.x == b.x) return b.y>a.y;
... | ALGO | 0.999926 | 3.567174 |
257ed3bc-a14e-499f-8b98-72af9816389d | LegalizeAdulthood/opencv-tutorials | tutorials/calib3d/real_time_pose_estimation/src/PnPProblem.cpp | /*
* PnPProblem.cpp
*
* Created on: Mar 28, 2014
* Author: Edgar Riba
*/
#include <iostream>
#include <sstream>
#include "PnPProblem.h"
#include "Mesh.h"
#include <opencv2/calib3d/calib3d.hpp>
/* Functions for Möller-Trumbore intersection algorithm */
static cv::Point3f CROSS(cv::Point3f v1, cv::Point3f ... | ALGO | 0.999331 | 6.166176 |
b7a83c8d-d1d2-4720-a873-f244ae9b7ab2 | CrealityOfficial/CrealityPrint | src/libigl/igl/mat_min.cpp | template <typename DerivedX, typename DerivedY, typename DerivedI>
IGL_INLINE void igl::mat_min(
const Eigen::DenseBase<DerivedX> & X,
const int dim,
Eigen::PlainObjectBase<DerivedY> & Y,
Eigen::PlainObjectBase<DerivedI> & I)
{
assert(dim==1||dim==2);
// output size
int n = (dim==1?X.cols():X.rows());
... | ALGO | 0.998026 | 4.845345 |
e24b3c5b-f59e-4514-86ed-d0c6a5e1bf17 | vikashChouhan/CP | nextGreaterInArrayUsingStack.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
stack<int>s;
int n;
cin>>n;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
if(!s.empty() && s.top()<x)
{
cout<<s.top()<<"->"<<x;
s.pop();
}
else
{
s.push(x);
}
}
if(!s.empty())
{
while(!s.empty())
{
int t = s.top();
s.pop();
... | ALGO | 0.99999 | 3.888106 |
e60414c4-1808-4277-8870-6be699962593 | anuragpratap05/C_N_language_tools | hussain_set_codechef.cpp | # C_N_language_tools
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n,m;
cin>>n>>m;
ll a[n];
for(ll i=0;i<n;i++)
{
cin>>a[i];
}
sort(a,a+n);
queue<ll> q;
ll count_m=0;
ll end_p=n-1;
ll ans;
while(m--)
{
ll curr_m;
... | ALGO | 0.99999 | 3.698213 |
58bfdd68-c262-466e-af08-e10a28a62856 | bvrstich/jastrow_gfmc | Random.cpp | #include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_real_distribution.hpp>
#include <omp.h>
#include <time.h>
#include "include.h"
/* Written by Sebastian Wouters <<EMAIL>> on September 4, 2013 */
using namespace std;
Random::Random(){
#ifdef _OPENMP
num_omp_threads = omp_get_max_thread... | TOOL | 0.946931 | 3.057027 |
b921167c-f38c-4bd7-a424-dac86acbda81 | ishandutta2007/codeforces | kimden/normal/988/A.cpp | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
int main() {
ios_base::sync_with_stdio(false);
int n, k;
cin >> n >> k;
int x;
vector<int> v(103, 0), w;
... | ALGO | 0.999998 | 4.000152 |
cb8dd3b9-4e3f-4734-83dc-6ff85f89bac0 | duanshuai123/MyQGIS318 | src/3d/qgsraycastingutils_p.cpp | #include "qgsraycastingutils_p.h"
#include "qgis.h"
#include "qgsaabb.h"
#include <Qt3DRender/QCamera>
///@cond PRIVATE
namespace QgsRayCastingUtils
{
Ray3D::Ray3D()
: m_direction( 0.0f, 0.0f, 1.0f )
{
}
Ray3D::Ray3D( QVector3D origin, QVector3D direction, float distance )
: m_origin( origin )
... | TOOL | 0.908491 | 7.520697 |
2d395497-22c4-480c-b04d-871da2b8be73 | HawieLong/sgx-pytorch | aten/src/ATen/native/Embedding.cpp | #include <ATen/ATen.h>
#include <ATen/Parallel.h>
#include <ATen/TensorUtils.h>
#include <ATen/NativeFunctions.h>
#include <cstring>
#include <memory>
#include <sstream>
#include <vector>
namespace at { namespace native {
Tensor embedding(const Tensor & weight, const Tensor & indices,
int64_t paddin... | DATA | 0.963512 | 7.266453 |
10e043bb-5867-4825-968e-7af355c88dea | junaiddshaukat/DSA-LeetCode-Solutions | 457-circular-array-loop/circular-array-loop.cpp | class Solution {
public:
int next(vector<int>& nums, int i) {
int n = nums.size();
return ((i + nums[i] % n) + n) % n;
}
bool circularArrayLoop(vector<int>& nums) {
int n = nums.size();
for (int i = 0; i < n; i++) {
int slow = i;
int fast = next(nums, ... | ALGO | 0.99999 | 5.500535 |
bb12e6ed-1eec-4eaf-9e64-79931391b141 | Saumyajeet-Varma/DSA-cpp | GeeksForGeeks/Reverse a linked list/Solution2.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *next;
};
class Solution
{
public:
struct Node *reverseList(struct Node *head)
{
if (head == NULL || head->next == nullptr)
return head;
Node *prevNode = NULL;
Node *temp = head;
... | ALGO | 0.999917 | 4.852475 |
123fa047-54ff-47df-af3b-f87effced3c8 | Andrewjcarroll/NLSigma | NLSigma/src/nlsmCtx.cpp | #include "nlsmCtx.h"
namespace nlsm
{
NLSMCtx::NLSMCtx(ot::Mesh* pMesh) : Ctx()
{
m_uiMesh = pMesh;
// variable allocation for evolution variables
m_evar = DVec();
m_evar.create_vector(m_uiMesh,ot::DVEC_TYPE::OCT_SHARED_NODES,ot::DVEC_LOC::HOST,NLSM_NUM_VARS,true);
m_ev... | TOOL | 0.907881 | 5.263365 |
00d6fd96-1916-45cb-881c-e45cd7d8fcf7 | leomaurodesenv/contest-codes | contests/uri/uri-2021.cpp | /*
* Problema: Luzes de Natal
* https://www.urionlinejudge.com.br/judge/pt/problems/view/2021
*/
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <locale>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
... | ALGO | 0.999751 | 3.365081 |
ce0f1fd4-63ee-4b10-9fab-51ef02449036 | HHS-Proclub/hhs-pro-club-website | solutions2020/PRA7/kevinlc221@gmail.com.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const int INF = 1000 * 1000 * 1000;
int main() {
int ok;
cin >> ok;
for (int a = 0; a < ok; a += 1) {
long long n;
cin >> n;
string s = to_string(n);
int ans = INF;
int len = s.size();
for (int i = 0; i < len; ++i) {
... | ALGO | 0.999786 | 4.147119 |
7fd83f22-33e5-44ad-a9fe-5fca7779948b | mahendra150/dsa_with_example | 0149-max-points-on-a-line/0149-max-points-on-a-line.cpp | class Solution {
public:
int maxPoints(vector<vector<int>>& points) {
int n= points.size();
int ans= 0;
for(auto it1:points){
unordered_map<double,int> h;
for(auto it2:points){
if(it1==it2)continue;
do... | ALGO | 0.999961 | 5.869945 |
5fc3fe04-6ee9-4887-8e5a-978dbfa54426 | Mahad-Saffi/Programming_Fundamentals | Lab 9/task5.cpp | #include <iostream>
using namespace std;
bool isAlreadyEntered(int arr[], int size, int);
int main()
{
int size;
cout << "Enter the number of elements: ";
cin >> size;
int arr[size];
cout << "Enter " << size << " numbers, one per line:" << endl;
for (int i = 0; i < size; i++)
{
ci... | ALGO | 0.994956 | 4.680486 |
4823fb78-8bde-4c6e-b513-e8d011a24586 | ayush-1560/DSA | 975-range-sum-of-bst/range-sum-of-bst.cpp |
class Solution {
public:
int inorder(TreeNode* root,int low, int high,int& sum){
if(!root) return 0 ;
if(root->val >=low && root->val<=high){
return root->val + inorder(root->left,low,high,sum)
+inorder(root->right,low,high,sum);
}
else if(root->val < low) re... | ALGO | 0.999997 | 6.723897 |
ca22eed0-f310-465a-afbd-3301d1c5ac5e | navinder/code | TwoBinaryTreesIdentical.cpp | /**
* Definition for binary tree
* Given two binary trees, write a function to check if they are equal or not.
* Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeN... | ALGO | 0.999971 | 6.676023 |
972d4773-f145-409c-8092-0caafbd4c970 | owitisteve/Privacy-Preserving-Data-Mining-Using-SomeWhat-Homomorphic-Encryption | SEAL/native/examples/1_bfv_basics.cpp | #include "examples.h"
using namespace std;
using namespace seal;
void example_bfv_basics()
{
print_example_banner("Example: BFV Basics");
/*
In this example, we demonstrate performing simple computations (a polynomial
evaluation) on encrypted integers using the BFV encryption scheme.
The first t... | ALGO | 0.986062 | 6.123254 |
adf436c3-aaef-469b-abf2-1b8217f77f5b | Shivanilowanshi/MyDevlopmentCode | Cpp/Cpp/Day4/Day4_1.cpp | #include<iostream>
using namespace std;
inline int max(int n1,int n2)
{
int result=(n1>n2)?n1:n2;
return result;
}
int main(void)
{
int num1,num2;
int res;
cout<<"Enter First Number ";
cin>>num1;
cout<<"\n Enter second number :";
cin>>num2;
res=max(num1,num2);
cout<<"\n Maximum... | ALGO | 0.99533 | 4.458524 |
abd5741a-58af-4199-9453-fea46b9bb38c | Dinesh-22/leetcode | Given a linked list of 0s, 1s and 2s, sort it. - GFG/given-a-linked-list-of-0s-1s-and-2s-sort-it..cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
/* Link list Node */
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
struct Node *start = NULL;
// } Driver Code Ends
/*
Node is defined as
struct Node {
int data;
s... | ALGO | 0.999924 | 5.688806 |
0341ad8d-8e1b-471e-8708-265940668d40 | XJDKC/University-Code-Archive | Course Experiment/Algorithm Design and Analysis Course Exp/Interval Scheduling.cpp | #include<iostream>
#include<algorithm>
using namespace std;
const int N = 10005;
struct Interval
{
int left, right;
bool operator <(Interval &b)const
{
return right < b.right;
}
Interval()
{
left = 0;
right = 0;
}
};
struct Classroom
{
int target;
int course[N... | ALGO | 0.999916 | 3.949615 |
c56c9cef-ae64-4094-bc80-bc68b0c08111 | Ascend/op-plugin | op_plugin/ops/aclops/RotatedIouKernelNpu.cpp | #include "op_plugin/AclOpsInterface.h"
#include "op_plugin/utils/OpAdapter.h"
namespace acl_op {
using npu_preparation = at_npu::native::OpPreparation;
namespace {
at::Tensor& rotated_iou_npu_nocheck(
at::Tensor& iou,
const at::Tensor& boxes,
const at::Tensor& query_boxes,
bool trans,
int64_t mode... | ALGO | 0.875693 | 7.423736 |
69ddc5d7-457b-43a4-9a9c-49794799db36 | vijaymanikantareddy/LeetCode_GFG_solved | 0992-subarrays-with-k-different-integers/0992-subarrays-with-k-different-integers.cpp | class Solution {
public:
int fun(vector<int>& nums, int k){
if(k==0)
return 0;
unordered_map<int,int> mpp;
int curdiff = 0, l = 0 , res = 0;
for(int r = 0 ; r < nums.size() ; r++){
mpp[nums[r]]++;
if(mpp[nums[r]] == 1)
curdiff++;
... | ALGO | 0.999979 | 6.039927 |
3cb8dd70-384b-443f-9110-b3d8597962d4 | XifanYu/codeforces | 1038/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef double db;
typedef complex<db> cd;
ll qpow(ll x,ll k,ll mod)
{
ll ret=1;
while(k)
{
if(k&1)
{
ret=ret*x;
ret=ret%mod;
}
x=x*x;
x=x%mod;
k=(k>>1);
}... | ALGO | 0.999981 | 3.282948 |
92ecab62-844b-4a27-a63e-6266c0f69d81 | Tatatroi/DSA-Informatica-Germana-An-1 | Lab5 DSA Bag/SortedBag.cpp |
#include "SortedBag.h"
#include "SortedBagIterator.h"
#include<iostream>
using namespace std;
SortedBag::SortedBag(Relation r) : r(r), root(nullptr), nr_elems(0) {
}
/*
* Best Case: Theta(1)
* Average Case: Theta(log n)
* Worst case: Theta(n) degenerat
* Complexity O(n)
* */
void SortedBag::insert_rec(Node*& ... | ALGO | 0.998655 | 5.267889 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.