uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
869505f8-dbbd-4f1f-a43c-278a3e6199a0 | StackDoubleFlow/LLVMStackPU | clang/test/Analysis/ptr-sort.cpp | // RUN: %clang_analyze_cc1 %s -std=c++14 -analyzer-output=text -verify \
// RUN: -analyzer-checker=core,alpha.nondeterminism.PointerSorting
#include "Inputs/system-header-simulator-cxx.h"
bool f(int x) { return true; }
bool g(int *x) { return true; }
void PointerSorting() {
int a = 1, b = 2;
std::vector<int> V1 ... | TEST | 0.909813 | 6.925001 |
99982d1b-fdb2-486d-aab3-7be12e77a889 | bhavyabhatia11/Leetcode-Solutions | 0162-find-peak-element/0162-find-peak-element.cpp | class Solution {
public:
int findPeakElement(vector<int>& nums) {
int lo = 0;
int hi = nums.size()-1;
while(lo<hi){
int mid = lo + (hi-lo)/2;
if(nums[mid]<nums[mid+1]){
lo = mid + 1;
}
else{
hi = mid;
... | ALGO | 0.999933 | 5.60536 |
558264f7-13c1-4abd-bbea-1af22aff367c | ParasAnxi/LeetCode-CPP | Q0101-0200/111. Minimum Depth of Binary Tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999916 | 6.640809 |
b732995e-0535-4605-aa59-f952bed3eb29 | jayp5545/Coding-Problems | Leetcode/Solutions/0072.cpp | class Solution {
public:
int solve(string &word1,string &word2,vector<vector<int>> &dp,int i,int j){
if(j<0){
return i+1;
}
if(i<0) return j+1;
if(dp[i][j] != -1) return dp[i][j];
if(word1[i] == word2[j]){
return dp[i][j] = solve(word1,word2,dp,i-1,j-1... | ALGO | 0.999998 | 5.953556 |
4cea6ffa-7465-4cb2-9183-6a78ff439cb6 | Aman5012/100DaysOfCode | Day43/The Earliest and Latest Rounds Where Players Compete.cpp | 1900. The Earliest and Latest Rounds Where Players Compete
//QUESTION LNK: https://leetcode.com/problems/the-earliest-and-latest-rounds-where-players-compete/description/?envType=daily-question&envId=2025-07-12
TOPIC: Dynamic Programming
Memoization
CODE:
// Time Complexity : O(1)
// Space Complexity : O(LogN)
class... | ALGO | 0.999634 | 7.220117 |
2b6ca10f-3040-4fbb-b524-2f55e310a7fb | ZYH223/GAMES202-Homework | homework2/prt/ext/eigen/doc/examples/Tutorial_BlockOperations_corner.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::Matrix4f m;
m << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10,11,12,
13,14,15,16;
cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl;
cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << ... | ALGO | 0.998805 | 4.092313 |
76891919-3666-4808-85a9-08535cd72e56 | mohammedjasam/Technical-Interview-Guide | HackerRank/make-it-anagram-mglines.cpp | /*
*
* Tag: Hash
* Time: O(n)
* Space: O(1)
*/
#include <cmath>
#include <cstring>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
char s1[10010], s2[10010];
cin >> s1 >> s2;
int a[26] = {0};
for(int i = 0; i < strlen(s1); i++) {
a[s1[i] - 'a']++; ... | ALGO | 0.999969 | 4.127683 |
e6cff676-ad7c-4cee-815d-a4e0c7c8e6c6 | ManaswibRane/DSA | 344-reverse-string/reverse-string.cpp | class Solution {
public:
void reverseString(vector<char>& s,int x=0) {
int n=s.size();
if(x==n/2){
return;
}
swap(s[x],s[n-x-1]);
reverseString(s,++x);
}
}; | ALGO | 0.999802 | 5.894462 |
4acd0846-3a11-4d72-be52-1f5a1160f4f3 | 0xecho/KattisSubmissions | detaileddifferences.cpp |
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, l... | ALGO | 0.999626 | 3.637758 |
811ffc50-5d78-4527-9123-c1bdae49cbfc | xSeditx/AliensSandBox | src/Organism.cpp | #include "Organism.h"
#include "Window.h"
int Organism::NumberOfCreatures = 0;
std::vector<Organism*> Organism::CreatureList;
// Organism UPDATE
// Cell UPDATE
// APPLYFORCE
// Edges UPDATE
// APPLYFORCE
// RENDER
// RENDER
// ... | ALGO | 0.97567 | 4.418321 |
d3a2a576-6dbd-4ca0-8f3a-f2503eac940d | ishandutta2007/codeforces | ssrs_/normal/901/C.cpp | #include <bits/stdc++.h>
using namespace std;
void dfs(vector<vector<pair<int, int>>> &E, vector<pair<int, int>> &C, vector<int> &d, vector<int> &p, int v, int e = -1){
for (auto P : E[v]){
if (P.first != e){
int w = P.second;
if (d[w] == -1){
d[w] = d[v] + 1;
p[w] = v;
dfs(E, ... | ALGO | 0.999978 | 4.62665 |
9920d9a4-28cc-487f-a5a5-22bd52a2eca8 | OwenHushka1/StacksAndQueuesIntro | QueueLL.cpp | #include <iostream>
#include "QueueLL.hpp"
using namespace std;
QueueLL::QueueLL()
{
queueFront = nullptr;
queueEnd = nullptr;
}
QueueLL::~QueueLL()
{
while( !isEmpty() )
dequeue();
}
bool QueueLL::isEmpty()
{
/*if(queueFront == nullptr || queueEnd == nullptr)
return true;
return... | TOOL | 0.994208 | 3.764239 |
25d79e26-05e9-40b5-943d-3b8bf6acf891 | fethx/CS-Notes | leetcode/list/lc82.cpp | //82. Remove Duplicates from Sorted List II
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
ListNode* dummy = new ListNode();
dummy->next = head;
ListNode* pre = dummy;
while(head != NULL) {
while(head->next != NULL && head->val == head->next->val) ... | ALGO | 0.999923 | 5.455763 |
3331fd4f-5313-4aa5-930d-a2955e2e1f8c | y0gesh02/LeetCode_Solution | 513-find-bottom-left-tree-value/513-find-bottom-left-tree-value.cpp | class Solution {
public:
int findBottomLeftValue(TreeNode* root) {
if(!root) return 0;
int val;
queue<TreeNode *> q;
q.push(root);
while(!q.empty()){
int n = q.size();
int cnt=0;
for(int i=0;i<n;i++){
TreeNode *node = q.front(); q.pop();
if(cnt==0) va... | ALGO | 0.999995 | 6.067988 |
f82e7bc9-b014-461c-b14a-ddb90224804b | YoelYonata/LC30-day | May-11-FloodFill.cpp | class Solution {
public:
void DFS(vector<vector<int>>& image, int r, int c, int startColor, int newColor){
if (image [r][c] == startColor){
cout<<"Colouring "<<r<<","<<c<<endl;
image[r][c] = newColor;
if(r+1 < image.size()){
DFS(image, r+1, c, startColor, ... | ALGO | 0.991927 | 6.074486 |
4046b93c-f220-43bb-8dc0-37edce508810 | peaceminusones/Leetcode | Leetcode/数据结构/STL/leetcode295_MedianInData.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <set>
using namespace std;
/**
* 方法一:优先队列!!!!
*/
class MedianFinder
{
// 优先队列
priority_queue<int, vector<int>, less<int>> p; // 大顶堆,维护左一半儿
priority_queue<int, vector<int>, greater<int>> q; // 小顶堆,维护右一半儿
public:
MedianFinder()
{
... | ALGO | 0.999992 | 5.315766 |
4efee392-aa56-4afd-b5f2-84881a157874 | Nasim0008/Set | Multiset/print_iterator.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
multiset<int>ms;
ms.insert(1);
ms.insert(1);
ms.insert(2);
ms.insert(2);
ms.insert(2);
ms.insert(5);
ms.insert(5);
ms.insert(3);
ms.insert(4);
ms.insert(4);
int sz = ms.size();
cout<< sz<<endl;
multiset<i... | ALGO | 0.998874 | 3.080618 |
b5e37f06-1ce6-44b8-b772-cb5773db43d5 | Raffaello/discOpt | eigen/test/sparseLM.cpp | #include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template <typename Scalar>
struct sparseGaussianTest : SparseFunctor<Scalar, int>
{
typedef Matrix<Scalar,Dynamic,1> VectorType;
typedef SparseFunctor<Scalar,int> Base;
typedef typename Base::JacobianType JacobianT... | TEST | 0.973905 | 6.130261 |
12712362-59ce-4f7d-aed9-2dda2f914e57 | Josue-Chango/Repositorio | FuncionesColas.cpp | #include <iostream>
using namespace std;
class Cola {
private:
int *arreglo;
int frente;
int final;
int tamanio;
int elementos;
public:
Cola(int tam) {
tamanio = tam;
arreglo = new int[tamanio];
frente = 0;
final = -1;
elementos = 0;
}
bool esta... | ALGO | 0.994827 | 5.439238 |
7f397ce9-4d36-410e-a4d2-9963e2103cdf | thewantedx/CPP-Code-PTIT | CPP0220.cpp | #include <bits/stdc++.h>
using namespace std;
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int main() {
faster;
int test;
cin >> test;
while (test--) {
long long n;
cin >> n;
long long A[n][n], B[n][n];
for(long long i = 0; i < n;i++){
... | ALGO | 0.999724 | 3.210903 |
cbea70de-ac9a-4fc8-96b3-7519232687a6 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-gpt4/Codenet/p02400/486402840/response_0.cpp | #include <iostream>
using namespace std;
constexpr double PI = 3.141592653589;
int main() {
double r;
cin >> r;
double s = PI * r * r;
double l = 2 * PI * r;
cout.precision(9);
cout << fixed << s << ' ' << l << '\n';
} | ALGO | 0.930982 | 5.005425 |
9df79e15-efcc-4f1f-b995-445432ca895d | Nidhideveloper/SDEchallenge-By-Nidhi | uniquepath.cpp | #include <bits/stdc++.h>
int solve(int i, int j, int m, int n, vector<vector<int>> &dp){
if(i>=m || j>=n) return 0;
if(i==m-1 && j==n-1) return 1;
if(dp[i][j]!=-1) return dp[i][j];
//right
int rt=solve(i, j+1, m, n, dp);
//down
int dw=solve(i+1,... | ALGO | 0.999988 | 5.765609 |
c3a9f49a-8d8f-4694-b587-d6b58c0e3a9b | ishandutta2007/codeforces | tob123/normal/1331/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
typedef long long ll;
typedef pair<int,int> pii;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int x;
vector<int> v = {4, 1, 3, 2, 0, 5};
cin >> x;
int res = 0;
for(int i=0; i<6; i++){
if(x & (1<<i))
res... | ALGO | 0.999867 | 4.160458 |
3f1cacfe-d94a-424e-94ad-1f84d6700cad | mirrortku/1071-C-programming | w07/oddsum.cpp | #include<stdio.h>
int oddsum1(int n){
if(n==1)
return 1;
else
return oddsum1(n-1)+2*(n-1)+1;
}
int oddsum2(int n){
if(n==1)
return 1;
else
return oddsum2(n-2)+n;
}
int main(){
int n;
printf("Enter n:");
scanf("%d",&n);
printf("oddsum1(%d) = %d\n",n,oddsum1(n));
pr... | ALGO | 0.99992 | 3.965029 |
1bccd796-5ee8-4a85-a213-27b6e4f8070e | libretro-mirrors/higan | higan/sfc/coprocessor/sharprtc/time.cpp | const uint SharpRTC::daysInMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
auto SharpRTC::tickSecond() -> void {
if(++second < 60) return;
second = 0;
tickMinute();
}
auto SharpRTC::tickMinute() -> void {
if(++minute < 60) return;
minute = 0;
tickHour();
}
auto SharpRTC::tickHour() -> void ... | TOOL | 0.908076 | 6.118728 |
f3191d23-49ae-4b39-a781-40610bc65309 | anmarchenko/acm | Timus/T1222.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <string>
using namespace std;
const int maxn=10000;
int A[maxn], n;
void mult (int x)
{
int carry = 0;
for (int i=maxn-1; i>=maxn-A[0]; --i)
{
A[i]=A[i]*x+carry;
carry=A[i]/10;
A[i]%=10;
if (i==maxn-A[0] && carry)... | ALGO | 0.999947 | 3.773675 |
c1e78963-3487-47fc-839c-fd2332147f0a | callmepandey/Code-Geass | Code-Geass-Backend-main/codes/810bf481-2b87-4abc-a4e7-bca4197d1da6.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n, target;
cin >> n>>target;
vector<int> a(n);
for (auto& x : a) {
cin >> x;
}
map<int, int> mp;
for (int i = 0; i < n; i++) {
mp[a[i]] = i;
}
for (int ... | ALGO | 0.999934 | 3.986255 |
3bdbff6e-673f-451f-b592-e9e6c1594a8b | EmcsiCodes/Competitive-Programming | Problems for NT/Graph, BFS/Randi/main.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
/*
The problem is about finding the minimum number of transfers for Adam and Eve to meet at a given meeting point, given a train schedule.
The input consists of the number of cities (N), the location of Eve (E) and Adam (A), t... | ALGO | 0.999981 | 5.630099 |
3ab116e8-db60-49d6-95d5-d3f37ded52af | connorkauf/simulicore | cla3p.mod/examples/src/ex03d_permutation_matrix_create_random.cpp | /**
* @example ex03d_permutation_matrix_create_random.cpp
*/
#include <iostream>
#include "cla3p/perms.hpp"
#include "cla3p/dense.hpp"
/*-----------------------------------------------------*/
cla3p::dns::RdMatrix permToDense(const cla3p::prm::PiMatrix& P)
{
cla3p::dns::RdMatrix ret(P.size(), P.size());
ret = 0;
... | ALGO | 0.996704 | 4.759014 |
2c61cd30-cd28-4ccb-9133-6d2cf061b5f7 | ArastunM/Pathfinder | src/map.cpp | /**
* implements the map.hpp header file
*/
#include "map.hpp"
/* === pathfinder map class implementation ========================== */
Map::Map() = default;
Map::Map(unsigned int width, unsigned int height) {
this->size = sf::Vector2u{width, height};
randMap(); // sets up a random map
}
void Map::draw(sf:... | TOOL | 0.852636 | 5.062604 |
5b846b94-36a4-4606-8886-6cf07ec631fc | Aadish-Sanghvi/DSA | LinkedList/singlyLL.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data){ //parametric constructor
this -> data = data;
this -> next = NULL;
}
~Node(){ //destructor
int value = this -> data;
if(this -> next... | ALGO | 0.99355 | 4.42134 |
2b1cbc3d-e84b-45fd-b538-b5803bea7a15 | adamhasselwander/cf | 903/903/B/B.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define sd(n) scanf("%d",&n) == 0
#define sl(n) scanf("%I64d",&n) == 0
#define ss(n) scanf("%s",n) == 0
#define sc(n) scanf(" %c",&n) == 0
#define pd(x) printf("%d", x)
#define ps(x) printf("%s\n", x)
#define pl(x) printf("%I64d", x)
#define rep(i, begin, end)... | ALGO | 0.999893 | 3.019446 |
ea9727af-ca7d-4ae5-93bb-0a78e41dc6bb | usks213/Core3D-Engine | Core3DEngine/Core3DEngine/Library/Bullet3/include/BulletCollision/Gimpact/gim_box_set.cpp | #include "gim_box_set.h"
GUINT GIM_BOX_TREE::_calc_splitting_axis(
gim_array<GIM_AABB_DATA>& primitive_boxes, GUINT startIndex, GUINT endIndex)
{
GUINT i;
btVector3 means(btScalar(0.), btScalar(0.), btScalar(0.));
btVector3 variance(btScalar(0.), btScalar(0.), btScalar(0.));
GUINT numIndices = endIndex - startIn... | ALGO | 0.999961 | 6.326968 |
e987884d-2a0b-48c2-8919-146425d634c7 | soura07/365-Days-of-Leetcode-Question-Solving-Challenge | 229-majority-element-ii/majority-element-ii.cpp | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
int cnt1 = 0, cnt2 = 0;
int el1 = INT_MIN;
int el2 = INT_MIN;
for(int i=0; i<nums.size(); i++){
if(cnt1 == 0 && el2 != nums[i]){
cnt1 = 1;
el1 = nums[i];
... | ALGO | 0.999989 | 5.5675 |
e92855c3-2860-43a8-9ef2-f78fe9283edd | Jerry2423/CS106X_2018 | assignment/cs106x-hw3-recursion/Fractals/src/fractals.cpp | /*
* File: fractals.cpp
* --------------------------
* Name:
* Section leader:
* This file contains fractal problems for CS106X.
*/
#include "fractals.h"
#include <cmath>
#include "gbufferedimage.h"
#include "plasmacolor.h"
#include "complex.h"
using namespace std;
const double pi = 3.1415926;
/**
* Draws a S... | ALGO | 0.988416 | 5.112272 |
155cd79b-62a9-49ec-886e-a4ac61139bdd | liardanc3/algorithm | cpp/1966.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef struct paper {
int paper_num;
int priority;
}paper;
int main() {
int test_case_num;
cin >> test_case_num;
string answer = "";
vector<paper> vect;
vector<paper> ans_vect;
int print_num, value, prio_tmp;
for (int i = 0; i < t... | ALGO | 0.999936 | 3.77329 |
f7b4172b-bd77-4f16-b32b-d1cba6ce1a19 | andrefakhoury/competitive-programming | problems/solutions/GEMA/GEMA Strings/GEMA Strings 02/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define pb push_back
#define mk make_pair
#define fi first
#define se second
typedef pair<int, int> pii;
typedef long long ll;
const int MAXN = 1e5 + 5;
vector<int> prefixFunction(string& s) {
int n = s.size();
vector<int> pi(n);
for (int i =... | ALGO | 0.999918 | 4.723292 |
fc55f805-fcc4-4dd9-8b6a-bf892a465d09 | rzuccolo/rz-Model-Predictive-Control-MPC | src/Eigen-3.3/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.998476 | 4.659281 |
1ff3935b-db76-47d9-9022-25affb77fe14 | ishandutta2007/codeforces | intothenight/normal/759/B.cpp | #include <bits/stdc++.h>
using namespace std;
template<typename T, typename U> T &ctmax(T &x, const U &y){ return x = max<T>(x, y); }
template<typename T, typename U> T &ctmin(T &x, const U &y){ return x = min<T>(x, y); }
// DEBUG BEGIN
#ifdef LOCAL
template<typename L, typename R> ostream &operator<<(ostream &out, co... | ALGO | 0.999876 | 3.857243 |
6918041b-d48b-4cad-93f7-722dc779ff4a | abdelrahmanbassam/LeetCode-Problems | 0719-find-k-th-smallest-pair-distance/0719-find-k-th-smallest-pair-distance.cpp | class Solution {
public:
int numberOfDiffsNotGreaterThanP(vector<int>& nums, int p)
{
int n = nums.size();
int i = 0, j = 0;
int count = 0;
while(i < n)
{
while(j < n && nums[j] - nums[i] <= p)
j++;
count += j - i - 1;
... | ALGO | 0.999986 | 5.677348 |
2530ace5-99f4-422a-a9a1-548ad4e9ab20 | quark0/TOP | tools/eigen/bench/sparse_trisolver.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL
// -I /home/gael/Coding/LinearAlgebra/CSparse/... | ALGO | 0.997983 | 4.875646 |
513b04d1-cd8a-41e5-9b5f-5e19bc4b0822 | liyangxxx/code----- | 22/main.cpp | #include <stdio.h>
//#include <iostream>
#include <algorithm>
using namespace std;
bool cmp(int a, int b)
{
return( a>b );
}
int main()
{
int n;
int buf[100];
while(scanf("%d",&n)!=EOF)
{
for(int i=0; i<n; i++)
{
scanf("%d",&buf[i]);
}
sort(buf,buf+n,cm... | ALGO | 0.997443 | 3.124842 |
d44431d3-e51f-43ce-af58-77e9bb32bfea | AdiInfiniteLoop/Data-Structures-and-Algorithms | Stacks/decode_string.cpp | #include<iostream>
#include<stack>
using namespace std;
int main(){
stack<char> currstr;
stack<int> currnum;
string str = "a3[df]f";
for(char itr: str){
if(itr >= '1' && itr <= '9')
currnum.push(itr);
else currstr.push(itr);
if(itr == ']'){
while(itr != '... | ALGO | 0.992295 | 3.614004 |
d991175f-b2ee-494c-a807-6587002035b7 | mmcs-work/Leetcode-solutions | smallest-string-with-swaps/smallest-string-with-swaps.cpp | class uf{
private:
vector<int> root,rank;
public:
uf(int sz): root(sz),rank(sz){
for(int i = 0; i < sz; i++){
root[i] = i;
rank[i] = 1;
}
}
void join(int x, int y){
int rootx = find(x);
int rooty = f... | ALGO | 0.999999 | 5.669273 |
f5db00b1-4e6d-4460-b915-d9358f5cc674 | wyl-lab/raspbian | IntelligenceHomeSys/SecuritySubsystem/SecuritySubsystem/基于OpenCV的人脸识别/opencv-master/3rdparty/openexr/Half/half.cpp | // Primary authors:
// Florian Kainz <<EMAIL>>
// Rod Bogart <<EMAIL>>
//---------------------------------------------------------------------------
//
// class half --
// implementation of non-inline members
//
//---------------------------------------------------------------------------
#include <assert.h>
... | TOOL | 0.953431 | 6.789237 |
9b1ab788-d378-4392-b355-39f1a923338b | Yrmek/Functions-lab-5- | Project1/5.3.cpp | /*Выполнить задание, оформив его через функции(ввода, вывода, сортировки).Пе -
редачу массива в функции организовать через указатели.
Дана действительная матрица порядка n× m.Перебор строк / столбцов мат -
рицы осуществить с использованием указателей.Обосновать выбор метода сор -
тировки.
2. Упорядочить столбцы по нев... | ALGO | 0.99902 | 3.366968 |
957f2ed7-cbf6-42e0-9129-c0999b9160e4 | malcolmmckellips/Data-Structures | Data Structures/Assignments/A9/A9/Graph.cpp | #include "Graph.hpp"
#include "Graph.hpp"
#include <vector>
#include <iostream>
#include <queue>
#include <stack>
using namespace std;
Graph::Graph(){}
Graph::~Graph(){}
void Graph::addEdge(std::string v1, std::string v2, int distance)
{
for(int i = 0; i < vertices.size(); i++){
if(vertices[i].name == v... | ALGO | 0.963064 | 3.969317 |
330d3004-abe7-4d49-b202-b99abdda59e9 | Muzahid037/Online-Judge-Problems | CodeForces/A. Gravity Flip.cpp |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int x[n+5];
for(int i=0;i<n;i++)
{
cin>>x[i];
if(i>0)
{
if(x[i-1]>x[i])
{
// cout<<x[i-1]<<" "<<x[i]<<endl;
int y=x[i-1]-x[i];
x[i... | ALGO | 0.999993 | 3.739794 |
d208ddf8-20c5-442a-beed-615c65f3ddb2 | Sharadkadam45/Leetcode-solutions-in-CPP | 0054-spiral-matrix/0054-spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
int n=matrix.size();
int m=matrix[0].size();
int cnt=n*m;
int left=0;
int right=m-1;
int top=0;
int bottom=n-1;
vector<int> ans;
while(top<=bottom && left<=right... | ALGO | 0.999998 | 6.323408 |
adab71b5-8166-48ed-ae64-c2043cc1371e | aaryanXcode/Data-structures-and-Algorithms | LinkedList/prct2.cpp | #include<iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data=data;
this->next=NULL;
}
};
Node* createNode()
{
int data;
cin>>data;
Node *head=NULL;
Node *tail=NULL;
while(data!=-1)
{
Node *newNode=new N... | ALGO | 0.998339 | 4.191505 |
ae3416d1-9cfa-4814-b1ad-3f4dcd8d83da | ishandutta2007/codeforces | davidberard/normal/1129/A1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef long double ld;
const int NMAX = 5050;
vector<int> at[NMAX];
int pre[NMAX];
int mlen[NMAX];
int xtra[NMAX];
int n, m;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> n >> m;
for(int i=0;i<... | ALGO | 0.999981 | 4.017341 |
2f4d1f2b-ddd7-4353-9870-6eb6bd90d907 | jacobo-mc/darkmod2.09 | game/IniFile.cpp | #include "precompiled.h"
#pragma hdrstop
#include "IniFile.h"
#if defined(ID_DEBUG_MEMORY) && defined(ID_REDIRECT_NEWDELETE)
#undef new
#endif
#include <set>
#include <fstream>
#include <sstream>
#include "StdString.h"
IniFile::IniFile()
{}
IniFile::IniFile(const std::string& str)
{
ParseFromString(str);
}
Ini... | TOOL | 0.973988 | 6.086714 |
c479ab8a-3399-4029-a6de-2ffc0af102fb | louishust/map | storage/ndb/src/mgmsrv/InitConfigFileParser.cpp | #include <ndb_global.h>
#include "InitConfigFileParser.hpp"
#include "Config.hpp"
#include "MgmtErrorReporter.hpp"
#include <NdbOut.hpp>
#include "ConfigInfo.hpp"
#include <m_string.h>
const int MAX_LINE_LENGTH = 1024; // Max length of line of text in config file
static void trim(char *);
static void require(bool v... | CONFIG | 0.918649 | 6.120582 |
b2c0f0c8-374b-4571-8518-3bd0278a9572 | ARYANAayu/dsa-algorithms | AddTwoNumbers.cpp | class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
ListNode *dummy = new ListNode();
ListNode *temp = dummy;
int carry = 0;
while (l1 != NULL || l2 != NULL || carry) {
int sum = 0;
if (l1 != NULL) {
sum += l1->val;
... | ALGO | 0.999732 | 6.252425 |
1a4fd311-58fe-42df-a7bb-44c1f5333bdd | staftermath/algorithm | leetcode/143.reordered.list.v1.cpp | //
// Created by gwengww on 9/23/18.
// 56ms 30.17%
// time O(n)
// space O(1)
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void reorderList(ListNode* head) {
// get pa... | ALGO | 0.999913 | 5.624317 |
7e5863ab-ff40-4f2b-bae4-b8bd0db3484e | anujm08/SPOJ_Solved | tfriends.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
struct node
{
bool isexplored;
vector<int> edgeto;
vector<int> edgefrom;
node()
{
isexplored=false;
}
};
void allottime(node* person,int* sequence,int N);
int calcSCC(node* person,int* sequence,int N);
void timeDFS(node* person,int ... | ALGO | 0.999799 | 4.48282 |
63af8955-ef8a-4e93-8b13-cbe73ccc577e | SIPp/sipp | src/message.cpp | #include "sipp.hpp"
#include "message.hpp"
struct KeywordMap {
const char *keyword;
MessageCompType type;
};
typedef std::map<std::string, customKeyword> kw_map;
kw_map keyword_map;
/* These keywords take no parameters. */
struct KeywordMap SimpleKeywords[] = {
{"remote_ip", E_Message_Remote_IP },
{"... | TOOL | 0.887627 | 4.170393 |
7ad6ba58-e111-4448-95fb-ca1e52c781ab | isundeep0/Codeforces | Math & Constructive/1385A - Three Pairwise Maximums.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while (t--){
int x, y, z;
cin>>x>>y>>z;
if (x > y) swap(x, y);
if (x > z) swap(x, z);
if (y > z) swap(y, z);
if (y == z){
cout<<"YES"<<endl;
cout<<x<<" "<<x<<" "<<z<<endl;
}
else{
cout... | ALGO | 0.999902 | 3.728397 |
68e469d1-6d74-4d3c-b62b-6968fede44b7 | oneofsunshine/program_learning | C_C++/oop_assignment/assignment/week4/tqsort.cpp | #include<iostream>
#include<cstdlib>
#include<cstring>
using namespace std;
int CompareString( const void * e1, const void * e2)
{
return strcmp((char *)e1,(char *)e2);
}
int main()
{
string s[4] = {"Sadasd", "cascs","aacasas","ojisjads"};
//cout<<strcmp(s[1].c_str(),s[2].c_str());
qsort(s,4,sizeof(str... | ALGO | 0.998799 | 3.900478 |
ec4df5f4-44ff-41f3-acd1-a3371133f098 | Sadat-09/Codeforces | B_Pashmak_and_Flowers.cpp |
#include <bits/stdc++.h>
#define IO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
typedef long long int ll;
typedef long double LD;
#define w(t) \
int t; \
cin >> t; \
while (t--) \
{ \
so... | ALGO | 0.997269 | 3.970419 |
97aa3b28-9b48-46f8-932f-bc61721b6768 | sarai701/programacion1-tareas | lab.1Grupal_Grupo5/torneoFutbol/main.cpp | //Laboratorio Grupal No. 5
//Este programa realizara el control del campeonato de futbol de ida y vuelta
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <algorithm>
using namespace std;
#define NUM_EQUIPOS 6
#define MAX_GOLES 10
#define MAX_LONGITUD_CADENA 100
/... | ALGO | 0.999411 | 5.015756 |
b9ee28cb-b082-4997-b1b1-38e3ab3e81e5 | airen3339/GuiShou_Pack | 3.0 增加反调试/GuiShouPack/AES.cpp | #include "stdafx.h"
#include "string.h"
#include "AES.h"
AES::AES(unsigned char* key)
{
unsigned char sBox[] =
{ /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76, /*0*/
0xca,0x82,0xc9,0x7d,0xfa,0... | ALGO | 0.992069 | 3.244147 |
fc1ae501-76bb-4577-99e3-dcb4dcf104ea | ds-sww/codebase | 13307130057/assignment8/src/Preorder.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int n,m;
void work(int x)
{
m++;
if (m==n)
{
cout<<x<<endl;
return;
}
cout<<x<<' ';
if (x*2<=n) work(x*2);
if (x*2+1<=n) work(x*2+1);
}
int main()
{
while ((cin>>n)&&(n))
{
m=0;
work(1);
}
... | ALGO | 0.999808 | 4.217148 |
fca38bc8-d47e-4765-b240-5295478929f3 | spinlockirqsave/examples | algorithms/dfs_task_order/main.cpp | /*
* File: main.cpp
* Author: peter
*
* Created on April 24, 2014, 10:13 AM
*/
#include <vector>
#include <iostream>
#include <stdexcept>
/**
*
* @param graph dag as a vector of vectors
* @param i current index in graph
* @param color vector of colors
... | ALGO | 0.999897 | 6.579013 |
15084971-c3f5-4a39-ad6e-8a86fcd53824 | KimYeonJun/ProblemSolving | BOJ/17822/17822ver2.0.cpp | /*
BOJ 17822:
ȣ xi di(0: ð, 1:ݽð) kiĭ ȸ
ǿ ϸ鼭 ͵ ã´.
1. ϸ鼭
2. ǿ ϰ պ ū 1 , 1
*/
#include <iostream>
#include <vector>
#include <queue>
#include <set>
using namespace std;
struct rot {
int x;
int d;
int k;
};
struct point {
int x;
int y;
int v;
};
int N, M, T; // , ǿ ִ , ȸ
vector<rot> r... | ALGO | 0.999845 | 4.482625 |
13467245-7a05-4446-ac1a-5f0e985122cc | Amitkr-2004/CPP | CP/Maths/A_Candies_and_Two_Sisters.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t-->0){
int n;
cin>>n;
if(n%2==0) cout<<(n/2)-1;
else cout<<(n/2);
cout<<endl;
}
} | ALGO | 0.999517 | 4.99269 |
865baf62-5d58-4c56-a02a-62f6da2a44b0 | SahilKundu19/DSA-Programs | CodingNinjas_Problems_Solutions/Patterns/Pattern13.cpp | #include<iostream>
using namespace std;
/*
Pattern:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
*/
void print1(int n) {
int count=1;
for(int i=1;i<=n;i++) {
for(int j=1;j<=i;j++) {
cout << count << " ";
count++;
}
cout << endl;
}
}
i... | ALGO | 0.999854 | 5.082404 |
36acc065-c675-43fb-8c16-2807cf547fa3 | Lauu029/EDA | Ejercicios Juez/Tema 2/Tema2.9/Tema2.9/Tema2.9.cpp | // Nombre del alumno Laura Gómez Bodego
// Usuario del Juez VJ23
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
using namespace std;
// función que resuelve el problema
int posicion(vector<int> const& datos, int ini, int fin)
{
//si solo hay un elemento, devuelve esa posición
if ... | ALGO | 0.999596 | 4.853775 |
37a2fd79-be4b-49fe-ad43-76cafcbb5158 | Blueredgray/FilesMisis | kursov_m_a/0136A.cpp | #include <iostream>
#include <array>
int main() {
std::array<int, 101> b = {};
int n = 0;
std::cin >> n;
int p = 0;
for (int i = 1; i <= n; i += 1) {
std::cin >> p;
b[p] = i;
}
for (int i = 1; i <= n; i += 1) {
std::cout << b[i] << " ";
}
}
| ALGO | 0.999926 | 4.29067 |
d5613626-5be6-4798-9cba-953bb2e6ff10 | Lambert00/maats_optimization | src/eigen-3.4.0/bench/product_threshold.cpp |
#include <iostream>
#include <Eigen/Core>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
#define END 9
template<int S> struct map_size { enum { ret = S }; };
template<> struct map_size<10> { enum { ret = 20 }; };
template<> struct map_size<11> { enum { ret = 50 }; };
template<> struct ... | TOOL | 0.957855 | 5.102006 |
abb12cb4-ea37-4223-aa6e-64face1b887f | amujika/SWERC-UPV-EHU | cpp/SWERC2012-A.cpp | //============================================================================
// Name : Beehives.cpp
//============================================================================
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int minimo;
int recorridos[600];
void dfs(vector<... | ALGO | 0.999654 | 4.6163 |
3325d4b4-9f5f-4e2b-90ff-71330298b5f0 | govind-geethub/codeforcesLadders | rating-1300/puzzles.cpp | #include<bits/stdc++.h>
using namespace std;
int puzzle(int m, int n, vector<int>&v)
{
sort(v.begin(), v.end());
/*for(int i=0; i<n; i++)
{
cout << v[i] << " ";
}*/
int i=0;
int currMinDiff=INT_MAX;
int minDiff=v[i+m-1]-v[i];
//cout << v[i+m-1] << " " << v[i] << endl;
//cout ... | ALGO | 0.999935 | 3.504869 |
69a76a10-bf1f-4f56-9a22-06d6664f4cb6 | ishandutta2007/codeforces | tle/normal/465/B.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
int n;
bool read[100001];
int main()
{
cin>>n;
int total=0,now=0;
for(int i=1;i<=n;i++) cin>>read[i];
bool f=0;
while(now<=n)
{
int readed=0,tothis=-1,untilthis=-1;
for(int i=now+1;i<=n;i++)
{
if(read[i])... | ALGO | 0.999964 | 3.588852 |
98f1c599-04d5-4429-89a7-d6602a38a44a | debjani1413/DSA-Practice | 8. Remove duplicates from an unsorted linked list - GFG/8.-remove-duplicates-from-an-unsorted-linked-list.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
void print(Node *root)
{
Node *temp = root;
while(temp!=NULL)
{
cout<<temp->data<<" ";
temp=temp->next;
}
}
// } Driver Code Ends
/*
The structur... | ALGO | 0.999868 | 5.740347 |
42aea7d5-38c1-4ee7-93d4-33bb404b6bdd | TaiLe1602/C-Programing-Language | check hk211.cpp | #include <stdio.h>
#include <conio.h>
#include <math.h>
main(){
int n;
printf("nhap gia tri n: "); scanf("%d",&n);
while(n<=0){
printf("vui long nhap lai gia tri n: "); scanf("%d",&n);
}
int b=n;
int count =0;
while(n%2==0){
count++;
n=n/2;
}
printf("Co %d thua so 2 trong so %d",count,b);
}
| ALGO | 0.998711 | 3.005216 |
036b8791-9fb7-4873-9d8b-38c1a08ade40 | Ratchathon/lab15 | lab15_4.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void shuffle(int &,int &,int &,int &);
int main(){
int a = 50, b = 100, c = 500, d = 1000;
srand(time(0));
for(int i = 0;i < 10;i++){
shuffle(a,b,c,d);
cout << a << " " << b << " " << c << " " << d << endl;
}
return 0;
... | ALGO | 0.992374 | 3.056981 |
82df5af1-c434-4591-9122-a9b08191003e | Mq-b/Cpp20-STL-Cookbook-src | src/6.6查找特定项.cpp | #include"print.h"
#include<vector>
#include<algorithm>
struct City {
std::string name{};
unsigned pop{};
bool operator==(const City& o)const {
return name == o.name;
}
std::string str()const {
return std::format("[{}, {}]", name, pop);
}
};
int main() {
const std::vector<int>v{ 1,2,3,4,5,6,7,8,9,10 };
au... | TOOL | 0.950474 | 5.735403 |
b68b7429-fcac-458b-a146-bcb7dfd106a7 | Sumonta056/My-Codes | BASIC Pratices/unordered_map.cpp | /*
unordered_map vs map :
map (like set) is an ordered sequence of unique keys whereas in unordered_map key can be stored in any order,
so unordered.
Map is implemented as balanced tree structure that is
why it is possible to maintain an order between the elements (by specific tree traversal).
Time complexity of m... | TOOL | 0.945146 | 5.575903 |
87ce6353-c0d1-43b1-8219-3eb973d23ac9 | marcosolanki/high-performance-computing-for-weather-and-climate | openacc/main.cpp | #include "host.hpp"
#include "kernels.hpp"
#include "parallel.hpp"
#include <chrono>
#include <fstream>
#include <iostream>
#include <sstream>
#ifdef _OPENACC
#include <openacc.h>
#endif
using time_point = std::chrono::time_point<std::chrono::steady_clock>;
// run_simulation<T>():
// Runs the 4th-order diffusion si... | ALGO | 0.964839 | 6.167612 |
dfa09f2b-86fa-4734-a131-b1626b569594 | feuvan/opencore-amr-iOS | opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/scale_signal.cpp | /*
------------------------------------------------------------------------------
Filename: scale_signal.cpp
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
int16 signal[], (i/o) : signal to scale
int16 lg, (i) : ... | ALGO | 0.976157 | 5.960022 |
b5dc7280-9316-430a-b98b-1c6c88ad948d | Jinsun-Lee/Algorithm-template | 3_barkingdog/0x18/solutions/1325.cpp | // Authored by : scsc3204
// Co-authored by : -
// http://boj.kr/8fd2c4a42ad5491caa20c09336e319c5
#include <bits/stdc++.h>
using namespace std;
const int NMX = 10'002;
int mx;
int sc[NMX];
vector<int> adj[NMX];
bool vis[NMX];
void trav(int cur) {
vis[cur] = 1;
sc[cur]++;
mx = max(mx, sc[cur]);
for(int nxt : ... | ALGO | 0.999871 | 4.247942 |
59ab02e9-d582-424b-b870-f6e4d5ffe7e6 | nioooo15/p.nitish | java classtest-2 (one).cpp |
abstract class Shape {
abstract double calculateArea();
abstract double calculatePerimeter();
}
class Circle extends Shape {
double radius;
Circle(double radius) {
this.radius = radius;
}
@Override
double calculateArea() {
return Math.PI * radius * radius;
}... | ALGO | 0.995315 | 3.981266 |
409ae324-c838-4df9-902d-cc6f1666ccb0 | chrishaukap/GameDev | angel_1_1/Code/Angel/Libraries/Box2D/Source/Collision/Shapes/b2PolygonShape.cpp | #include "b2PolygonShape.h"
void b2PolygonDef::SetAsBox(float32 hx, float32 hy)
{
vertexCount = 4;
vertices[0].Set(-hx, -hy);
vertices[1].Set( hx, -hy);
vertices[2].Set( hx, hy);
vertices[3].Set(-hx, hy);
}
void b2PolygonDef::SetAsBox(float32 hx, float32 hy, const b2Vec2& center, float32 angle)
{
SetAsBox(hx,... | ALGO | 0.998241 | 7.899953 |
c62b77e6-cba6-4f76-9e11-6b6ef3e81e75 | venkyvt7/competitive-programming-1 | Training Gate - TLC/7. Graf/7B. Shortest Path/A. Perjalanan Teringan.cpp | #include<bits/stdc++.h>
using namespace std;
int N, M, INF = 1000005, petak[1005][1005], dist[1005][1005];
typedef pair< int, pair<int , int > > ii;
int main ()
{
ios_base::sync_with_stdio(false);
cin >> N >> M;
for (int i = 1; i <= N; i ++)
for (int j = 1;j <= M; j ++)
{
cin >> petak[i][j];
dist[i][j... | ALGO | 0.99988 | 4.057999 |
f717e953-448c-44e0-a1f8-55531efee305 | XiyouLinuxGroup-2019-Summer/TeamE | Acm/tttt/1824.cpp |
/*Farmer John建造了一个有N(2<=N<=100,000)个隔间的牛棚,这些隔间分布在一条直线上,坐标是x1,...,xN (0<=xi<=1,000,000,000)。
他的C(2<=C<=N)头牛不满于隔间的位置分布,它们为牛棚里其他的牛的存在而愤怒。为了防止牛之间的互相打斗,Farmer John想把这些牛安置在指定的隔间,所有牛中相邻两头的最近距离越大越好。那么,这个最大的最近距离是多少呢?
*/
#include<iostream>
#include<algorithm>
using namespace std;
int a[100005];
int judge(int);
int n,flag;
... | ALGO | 0.999898 | 3.520812 |
b98fce8f-fc93-4149-842a-9f4b717e46c7 | Ayckinn/CPP | FRANCE_IOI/LEVEL_01/4_Lecture_entree/02_retraite_spirituelle/main.cpp | #include <iostream>
int main()
{
const int SEC_IN_MN = 60;
const int MN_IN_HR = 60;
const int DURATION_SPELL = 16;
const int NB_SPELL = ((SEC_IN_MN * MN_IN_HR) * DURATION_SPELL);
int duration_walk = 0;
std::cin >> duration_walk;
std::cout << NB_SPELL * duration_walk << std::endl;
return 0;... | ALGO | 0.975907 | 3.297706 |
7ed3fd12-f07b-4551-bfa5-638a4fa4ef3d | Xxxjudge/Leetcode | algorithm/106.从中序与后序遍历序列构造二叉树.cpp | /*
* @lc app=leetcode.cn id=106 lang=cpp
*
* [106] 从中序与后序遍历序列构造二叉树
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nu... | ALGO | 0.999971 | 6.341709 |
32d422a3-826a-4df7-8653-6f32548ef480 | tushhaar12/Strivers-SDE-Sheet-Challenge | Strings/ReverseWordsInString.cpp | string reverseString(string str)
{
// Write your code here.
vector<string> v;
int st = 0, cnt = 0;
for (int i = 0; i < str.size(); i++)
{
if (str[i] != ' ')
{
cnt = 0;
while (str[i] != ' ')
{
cnt++;
i++;
... | ALGO | 0.999881 | 4.888396 |
c0610b03-c83f-4b90-a354-08a7f7c15935 | dkrasnykh/practice-yandex-cpp | training_3_0_A/23.cpp | //https://contest.yandex.ru/contest/45469/problems/23/
#include <iostream>
#include <vector>
using namespace std;
int main() {
unsigned long long n;
cin >> n;
unsigned long long ans = n * n;
vector<unsigned long long> dp(n, 0);
if (n == 1) {
cout << ans;
return 0;
}
dp[1] = 1;
ans += dp[1];
if (n == 2) {... | ALGO | 0.9999 | 4.223587 |
f4929a12-037d-4bac-bdca-e17ba84f4943 | Cythonic1/advent_of_code_2024 | day2/part_1/main.cpp | #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
void file_reader_into_vector(const string file_name, vector<vector<int>> &myverctor){
ifstream myfile(file_name, ios::in);
int next;
string line;
w... | ALGO | 0.995571 | 4.192999 |
7c4bc80a-b7e9-4dc4-a8fa-5b5d381e6594 | ajb-0/aoc24 | day5/main.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <stdexcept>
#include <map>
using namespace std;
vector<string> parse_data(const string& filename) {
ifstream inputFile(filename);
string line;
vector<string>... | ALGO | 0.999738 | 5.946135 |
6a3820ee-89ab-4864-94d5-024ec3621461 | YkiWu/EmbodiedOcc | utils/chamfer_distance/chamfer_distance.cpp | #include <torch/torch.h>
// CUDA forward declarations
void ChamferDistanceKernelLauncher(
const int b, const int n,
const float* xyz,
const int m,
const float* xyz2,
float* result,
int* result_i,
float* result2,
int* result2_i);
void ChamferDistanceGradKernelLauncher(
const int b, ... | DATA | 0.98258 | 7.32016 |
cad843df-8e90-49a9-bfce-4a4ff4ba6000 | Swami5911/GFG_Code | Medium/Minimum number of jumps/minimum-number-of-jumps.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// Function to return minimum number of jumps to end of array
class Solution{
public:
int minJumps(int arr[], int n){
// Your code here
int maxi=0;
int maxrange=0;
int jump=0;
if(n==... | ALGO | 0.999966 | 5.755311 |
0d637237-d6c8-460e-835c-cc957ef31d1b | rewicks/ICPC | oct8/e.cpp | #include <iostream>
using namespace std;
bool test(int t[], int index, int arr[]){
for (int i = 0; i < 14; i++){
if (arr[i] == index +1){
arr[i] = 0;
arr[i+1] = 0;
break;
}
}
for (int i = 0; i < 14; i++){
cout << arr[i] << " ";
}
cout << endl;
t[index]--;
... | ALGO | 0.999202 | 3.838454 |
03968581-61cd-4147-b9dd-103009c05020 | abubakaristiak/CSE-Fundamentals | Selection Contest/Final_Contest/Range_Sum_or_Pain_Sum.cpp | #include <iostream>
#define ll long long
using namespace std;
ll isSum(int n) {
if (n<=0) return 0;
ll div=n/2;
ll isSum=(div*(div + 1));
if (n%2 == 1) {
isSum+=div+1;
}
return isSum;
}
ll tSum(int left, int right) {
return isSum(right) - isSum(left-1);
}
int main() {
ios... | ALGO | 0.999793 | 4.983858 |
512675b6-909e-452e-b7c4-2c1c3fa75e97 | AliSultan136/AliSultan136 | 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 |
3af0b6b2-d3c4-4bad-8f25-c068a8915b9f | mohsend/Magnificent-University-Projects | 3-data_structures/Linked_List/linked_list.cpp | /*
*
*/
#include <iostream>
using namespace std;
class LinkedList
{
public:
int data;
LinkedList *link;
LinkedList()
{
link = NULL;
}
int setData(int in)
{
data = in;
return data;
}
int getData()
{
return data;
}
LinkedList* push(int in)
{
link = new LinkedList;
link... | ALGO | 0.999035 | 3.945285 |
7e8c8430-862e-42c1-b494-867cbf23fe6f | Autoratch/submissions | Evaluator/o60_oct_c1_house.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1 << 18;
struct node
{
int mxa,mxp,mxs,sum;
friend node operator+(const node &a,const node &b)
{
node ret;
ret.mxa = max(max(a.mxa,b.mxa),a.mxs+b.mxp);
ret.mxp = max(a.mxp,a.sum+b.mxp);
ret.mxs = max(b.mxs,b.sum+a.... | ALGO | 0.99995 | 4.676731 |
c654551a-e147-4b9c-9e1b-6e64371e0151 | Yosuamuliawan19/algorithm-bank | Vjudge/datstruct_14_04_2018/v_map.cpp | #include<iostream>
#include<map>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main (){
char n;
map <string, int> m;
vector<string> v;
string prev = "";
while (scanf("%c", &n) == 1){
//cout << n;
if ( ( n < 97 || n > 122 ) &&
... | ALGO | 0.997743 | 3.617732 |
5e575488-3314-4378-b46c-183f834f0b51 | lonnewolf120/DS_Algo | String DS&Algo/valid_parantheses.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i,e) for(ll i = 0; i < e;... | ALGO | 0.999463 | 5.862289 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.