uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7dd67430-ebd4-4ff9-837a-437cb92b6d02 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5865_2.cpp | #include <bits/stdc++.h>
const double esp = 1e-8;
int ll, v1, v2;
int n, nn;
double a[200010], ans[100010];
double dl, dr, len;
void solve() {
int i;
int l, r;
dl = 0;
dr = len;
l = r = 1;
while (a[l] - esp < dl) l++;
while (a[r] < dr) r++;
while (l <= n + 1) {
if (a[r] - dr < a[l] - dl) {
if ... | ALGO | 0.999828 | 3.135248 |
89f74151-e669-4a8e-81cb-2417e561aecb | MehulGarg22/Algo_Engineering | Program/Algorithms/Euclid.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int GCD(int a, int b)
{
while(b!=0)
{
int rem=a%b;
a=b;
b=rem;
}
return b;
}
int main()
{
int a, b;
cout<<"Enter Number: ";
cin>>a>>b;
cout<<GCD(a, b);
return 0;
}
| ALGO | 0.999495 | 4.49481 |
38ad44e2-fedb-455c-9e71-4be4b051866d | T1duS/CompetitiveProgramming | Olympiad/IOI/17-train.cpp | /*
Soln:
http://ioi2017.org/tasks/editorial/train.pdf
*/
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pb push_back
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(int i = a; i < b; i++)
const int MAXN = 5005;
int n,m;
int outdeg[MAXN];
vi adj[MAXN... | ALGO | 0.999913 | 3.938123 |
47f14181-fefc-47f3-9e26-da74c0696f24 | ripidipi/Cpp-learning | PSP.cpp | //#include <iostream>
//#include <algorithm>
//#include <vector>
//#include <cmath>
//
//using namespace std;
//
//typedef long double ld;
//typedef long long ll;
//
//const ll MOD = pow((ll)10, 9) + 7;
//
//ll psp(int n, int k) {
// vector<vector<ll>> dp(n + 1, vector<ll>(k+1));
// dp[0][0] = 1;
// for (int i... | ALGO | 0.999985 | 4.570075 |
da1faf0b-4d4a-4530-bc0c-1c9ead0b46a8 | hkathome/CP_solutions | 1849A.cpp | #include <bits/stdc++.h>
#include <set>
#include <map>
#define ull unsigned long long
#define lld long double
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define deb(x) cerr<<#x<<" "<<x<<"\n";
#define debug2(x,y) cerr<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#incl... | ALGO | 0.999101 | 4.386258 |
373790a4-ddf4-4118-83de-150bf4d8d044 | Soulike/LeetCode | src/2025/2106.maximum-fruits-harvested-after-at-most-k-steps.cpp | /*
* @lc app=leetcode id=2106 lang=cpp
*
* [2106] Maximum Fruits Harvested After at Most K Steps
*/
#include <algorithm>
#include <vector>
// @lc code=start
class Solution {
public:
int maxTotalFruits(const std::vector<std::vector<int>>& fruits,
const int startPos,
con... | ALGO | 0.99999 | 6.408008 |
c7f562f6-aaca-4d4a-b634-b7899cbe7076 | nibtehaz/Codechef | CHEFKEY.cpp | /* بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ */
/* رَّبِّ زِدْنِى عِلْمًا */
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <iostream>
#include <string>
#include <map>
#include <list>
#include <stack>
#include ... | ALGO | 0.999723 | 3.504846 |
10650a0e-4872-4a36-8e36-e4e3a3e073d8 | ApoorvaSunkad/ArrayQuestions-C- | noOfgoodPairs.cpp | /*
Given an array of integers nums, return the number of good pairs.
A pair (i, j) is called good if nums[i] == nums[j] and i < j.
Example 1:
Input: nums = [1,2,3,1,1,3]
Output: 4
Explanation: There are 4 good pairs (0,3), (0,4), (3,4), (2,5) 0-indexed.
Example 2:
Input: nums = [1,1,1,1]
Output: 6
Explanation: Each... | ALGO | 0.999949 | 6.019159 |
1004a878-1e15-4402-ac42-c7e9695fdad4 | jingtaozhang18/algorithm-exercises | leetcode/程序员面试金典(第六版)/17/面试题 17.16. 按摩师.cpp | // https://leetcode-cn.com/problems/the-masseuse-lcci/
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int massage(vector<int>& nums) {
int m=nums.size(), i, j;
int dp[m+1][2]; // dp[i][0] 第i个预约不约
dp[0][0]=dp[0][1]=0;
for(i=0;i<m;++i){
dp[i+1][1]=dp... | ALGO | 0.999862 | 5.66016 |
da5fa910-235f-48c1-8911-fb4dc0d160aa | prajjwals-stack/CODE_DAILY | 416-partition-equal-subset-sum/416-partition-equal-subset-sum.cpp | class Solution {
public:
bool helper(vector<int>nums,int target,int ind, vector<vector<int>>&dp){
if(target==0)return true;
if(ind==0)return (nums[0]==target);
if(dp[ind][target]!=-1)return dp[ind][target];
bool not_take=helper(nums,target,ind-1,dp);
bool take=false;
... | ALGO | 0.999975 | 5.846597 |
3ab9b811-d89e-4714-988b-dc2c450aef11 | antoninoLorenzo/antoninoLorenzo-codecrafters-shell-cpp | src/parsing.cpp | #include "parsing.h"
void Parsing::split_arguments(
std::vector<std::string> *argv,
std::string command
)
{
std::string buffer("");
// 0: in single quotes, 1: in double quotes
int state[2] = {0}, SINGLE = 0, DOUBLE = 1;
for (int i = 0; i < command.size(); i++)
{
char c = command[i]... | TOOL | 0.961853 | 3.991016 |
6e8f94dc-726e-4982-a474-00624b877ccb | sajjadjuel/DATA_STRUCTURE | Lab Task 6/Binary_Search.cpp | #include<iostream>
#include<conio.h>
using namespace std;
void swap(int arr[], int i, int j)
{
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
void BubbleSort(int arr[], int n)
{
bool swapped = false;
do {
swapped = false;
int i,j;
for (i=0;i<n-1;i++)
for (j=0;j<n-1-i;j++)
if( ... | ALGO | 0.999913 | 4.115411 |
2230c4d2-ed3a-4e7f-9883-1793fa178b81 | kapoorz/cpptopics | mathematics/birthday paradox.cpp | #include <iostream>
using namespace std;
int bparadox(float p)
{
int n = 1;
float prob = 100;
while (prob > p)
{
n++;
prob = prob * (365 + 1 - n) / 365;
}
return n;
}
int main()
{
float p; // atleast p % have same day bday
cin >> p;
cout << bparadox(100 - p);
r... | ALGO | 0.99961 | 3.034889 |
52ab8efe-3c71-4f3d-ae51-252a632f6595 | 1m188/algorithm | 洛谷/P1923 【深基9.例4】求第 k 小的数.cpp | /**
* @file P1923 【深基9.例4】求第 k 小的数.cpp
* @date 2022-06-01
*/
/*
# 【深基9.例4】求第 k 小的数
## 题目描述
输入 $n$($1 \le n < 5000000$ 且 $n$ 为奇数)个数字 $a_i$($1 \le a_i < {10}^9$),输出这些数字的第 $k$ 小的数。最小的数是第 $0$ 小。
请尽量不要使用 `nth_element` 来写本题,因为本题的重点在于练习分治算法。
## 输入格式
## 输出格式
## 样例 #1
### 样例输入 #1
```
5 1
4 3 2 1 5
```
### 样例输出 #1
... | ALGO | 0.999935 | 4.346403 |
f5a3d9f6-9cbc-4539-bb80-282f84bd7c3e | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/minimum-sum-of-values-by-dividing-array-Solution3.minimumValueSum/177792_DoS_Exec_Code_Overflow.cpp | SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPad,
SplashColorMode modeA, GBool alphaA,
GBool topDown) {
width = widthA;
height = heightA;
mode = modeA;
switch (mode) {
case splashModeMono1:
rowSize = (width + 7) >> 3;
break;
case splashModeMono8:
rowSize = width;
br... | TOOL | 0.890731 | 4.709689 |
e0010f1b-9930-4618-85dd-0fbf4e66ea11 | atuly31/Leetcode-Solutions | 0077-combinations/0077-combinations.cpp | class Solution {
public:
vector<vector<int>> ans;
void combo(vector<int>&v,int n,int k,int i)
{
//if(v.size()>k) return;
if(i>n || v.size()>k)
{
if(v.size()==k) ans.push_back(v);
return;
}
v.push_back(i);
combo(v,n,k,i+1);
v.pop_back();
combo(v,n,k,i+1);
}
... | ALGO | 0.999973 | 5.979565 |
4ba167da-7093-4fe0-93d3-3e3ad6be1ffa | rSparsh/Cpp-codes | templates c++.cpp | // CPP code for bubble sort
// using template function
#include <iostream>
using namespace std;
// A template function to implement bubble sort.
// We can use this for any data type that supports
// comparison operator < and swap works for it.
template <class T>
void bubbleSort(T a[], int n) {
for (int i = 0... | ALGO | 0.999856 | 5.066678 |
c09b781e-c62b-44ae-b6d8-97455e5d7315 | brainerazer/crypto_heys_cypher | src/byte_utils.cpp | //
// Created by Bohdan Rybak on 08.05.2017.
//
#include "byte_utils.h"
namespace
{
// http://stackoverflow.com/questions/8011700/how-do-I-extract-specific-n-bits-of-a-32-bit-unsigned-integer-in-c
inline fragm_t extract_fragment(block_t orig16BitWord, uint8_t from, uint8_t to)
{
block_t mask = ((1... | ALGO | 0.966508 | 4.096635 |
c2350a3a-c1e8-4462-be37-b1c9a55dc56b | maruf-hossain74/Codeforces_problem_Solve | Rating_1400-1500/Sports Betting.cpp | /*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ $
$ Author: marufhussain745 $
$ Institute: JKKNIU $
Problem: C_Sports_Betting
$ Date: 2025/04/26 $
$ Time: 17:03:58 ... | ALGO | 0.999972 | 4.354238 |
600df3f0-4d48-49d6-a916-5d7dc880edeb | MuhammadRazi99/C-Lessons | Lecture/PostLab7.cpp | #include<iostream>
using namespace std;
// DECLARATION OF THE FUNCTIONS
#define rightCircular(p,q,r,s)(s*1000+p*100+q*10+r) //macro function used for right circulation.
#define leftCircular(p,q,r,s)(q*1000+r*100+s*10+p) //macro function used for left circulation.
inline int Add(int add){return add*1000+add*100+add*10+a... | ALGO | 0.99929 | 3.706874 |
afff0e9a-d04d-48f5-8422-19da5c7271ab | Adiihub/DSA | 08 - Binary Search Tree/07_ZigZag_LevelOrder_Traversal.cpp | #include<bits/stdc++.h>
#include<queue>
using namespace std;
class node{
public:
int data;
node* left;
node* right;
node(int data){
this->data=data;
this->left=NULL;
this->right=NULL;
}
};
node* BulidTreeLevelOrder( ){
... | ALGO | 0.999986 | 4.374755 |
4d9ee63c-c8cd-43ab-aea1-1929140a70ee | TristinL/C-plus-plus | double_negative_and_reverse_logic.cpp | //Tristin Lehman
//Double negatives and reverse logic operations
#include<iostream>
using namespace std;
bool reverseLogicBall(bool ball);
int main(){
bool ball = false;
if(ball == true){ //asking "did the ball go through the basket"
cout<<"The ball did go through the basket"<<endl;
}
else{
cout<<... | TOOL | 0.992539 | 4.20438 |
1f73938d-a064-4b8a-8f52-274d1b2183c0 | Devang-soni/Leetcode | Easy/2037. Minimum Number of Moves to Seat Everyone/2037.Minimum-Number-of-Moves-to-Seat-Everyone.cpp | /*
There are n seats and n students in a room. You are given an array seats of length n, where seats[i] is the position of the ith seat. You are also given the array students of length n, where students[j] is the position of the jth student.
You may perform the following move any number of times:
Increase or decrease ... | ALGO | 0.999982 | 6.028795 |
69d57172-be13-4e59-826e-6cf646e485c1 | sarvex/leetcode-scala | solution/0900-0999/0907.Sum of Subarray Minimums/Solution.cpp | using ll = long long;
const int mod = 1e9 + 7;
class Solution {
public:
int sumSubarrayMins(vector<int>& arr) {
int n = arr.size();
vector<int> left(n, -1);
vector<int> right(n, n);
stack<int> stk;
for (int i = 0; i < n; ++i) {
while (!stk.empty() && arr[stk.top(... | ALGO | 0.999997 | 5.287407 |
e34384a2-ec62-44b4-a956-1bc07b4759e6 | sikuner/book-code | C++ Standard Library Quick Reference/Chapter 2/21 - bind.cpp | #include <iostream>
#include <functional>
#include <vector>
#include <algorithm>
#include <string>
bool my_less(int x, int y) { return x < y; }
void f(std::string& x, char y) { x += y; }
int main()
{
using namespace std::placeholders; // contains _1, _2, _3, ...
auto my_greater = std::bind(my_less, _2, _1); ... | TOOL | 0.985154 | 4.807721 |
93489ac9-a0ce-4031-8934-8e273effb2a1 | hlebec-tukallec/ITMO-University | Labs A&DS/2/F.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int>a;
vector<int>sort;
vector<string>ans;
int main() {
int n;
int x;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
if (i > 0) {
for (int j = a.size() - 1; j >= 0; j--) {
if (a[j] < x) {
... | ALGO | 0.999983 | 3.842982 |
9c8c6c08-b0a0-494d-b8f2-2549ca2336ba | tonicaletti/ex_2022_03_03 | leet.cpp | #include <iostream>
#include <map>
#include <string>
#include <vector>
int trivial_sol(int *array, int size)
{
return 0;
}
bool anagramcheck(std::string s, std::string t)
{
std::map<char, int> dict_s;
std::map<char, int> dict_t;
for (int i = 0; i < s.size(); i++)
{
if (dict_s.find(s[i]) !... | ALGO | 0.999922 | 5.368 |
3b246319-a3d0-4eba-8a1d-2680cb6bbfb7 | elizabeth-suehr/LIGGGHTS_CFDRC | lib/poems/onbody.cpp | #include "onbody.h"
#include "body.h"
#include "inertialframe.h"
#include "joint.h"
#include "onfunctions.h"
#include "virtualmatrix.h"
#include "matrixfun.h"
#include <iostream>
#include "norm.h"
#include "eulerparameters.h"
using namespace std;
OnBody::OnBody(){
system_body = 0;
system_joint = 0;
parent = 0;
... | ALGO | 0.962764 | 5.106004 |
83c582d3-ba5f-47b3-9fa5-b51d9f001922 | songzy12/CodeJam | codejam/2016/Round 1C/Problem C. Fashion Police.cpp | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1000000007
#define MAX 0x3f3f3f3f
#define MAX2 ... | ALGO | 0.998324 | 3.017392 |
de0e62cd-03c0-4fc8-9388-5b5ea2248f75 | waseemnabi08/OOP-Lab-CEME-NUST- | Lab1/complex.cpp | #include <iostream>
using namespace std;
struct Complex {
int real;
int imag;
};
void getComplex(Complex &c1, Complex &c2) {
cout << "Number 1:" << endl;
cout << "Real part: ";
cin >> c1.real;
cout << "Imaginary part: ";
cin >> c1.imag;
cout << "Number 2:" << endl;
cout << "Real p... | ALGO | 0.946785 | 5.686474 |
0792d8d1-dec8-4eef-bcd3-dfc6e71b33fc | csl-iisc/SUV-MICRO24 | llvm/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/bitset/main.cpp | #include <bitset>
#include <stdio.h>
template <std::size_t N> void fill(std::bitset<N> &b) {
b.set();
b[0] = b[1] = false;
for (std::size_t i = 2; i < N; ++i) {
for (std::size_t j = 2 * i; j < N; j += i)
b[j] = false;
}
}
template <std::size_t N>
void by_ref_and_ptr(std::bitset<N> &ref, std::bitset<... | TOOL | 0.977341 | 4.019959 |
fe2ac80f-d968-4d63-b07c-f2362e6b8fb3 | hly1204/library | test/enumerative_combinatorics/partition_function.0.test.cpp | #define PROBLEM "https://judge.yosupo.jp/problem/partition_function"
#include "famous_sequence.hpp"
#include "modint.hpp"
#include <iostream>
#include <vector>
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
using mint = ModInt<998244353>;
int n;
std::cin >> n;
const auto... | ALGO | 0.999756 | 4.340606 |
a7797669-ffd4-406f-9537-adb9016c0f73 | 304825521/Work | data/Lab08/executive.cpp | #include "executive.h"
#include "LeftListHeap.h"
#include <stdexcept>
#include <string>
executive::executive(std::string _filename) {
ifstream input;
string name;
float distance;
int count_review;
string temp;
int count = 0;
input.open(_filename);
if (input.is_open()) {
while (!input.eof()) {
... | ALGO | 0.994117 | 3.71137 |
22a77c77-908a-4a20-9373-7c4188f00a1e | FireF0xIl/Algorithms-Data-Structures | 1-course/7-lab/K.cpp | #include <bits/stdc++.h>
using namespace std;
struct query {
int point, index;
query() = default;
query(int v, int i) : point(v), index(i) {}
};
struct dsu_node {
int parent, rank, ancestor;
bool visited;
dsu_node() {
rank = 0;
visited = false;
parent = -1;
anc... | ALGO | 0.999953 | 5.318126 |
7eae334e-ffb0-4153-ba6e-afe140d01564 | ISU-PAAL/DL-VD-Empirical-Study | models/Code2Vec/code/astminer/src/test/resources/examples/cpp/realExamples2/5.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <cassert>
#include <queue>
using namespace std;
#define cl... | ALGO | 0.954627 | 3.681771 |
82b801c0-8a99-47d2-95b6-efc05b3408a9 | sqmax/PAT-A | 1068.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=10010;
const int maxc=1<<24;
int g[maxn][maxn];
int color_cnt[maxc];
int m,n,tol;
bool isTypical(int i,int j){
bool flag=false;
int t=g[i][j];
int l=g[i][j-1],r=g[i][j+1],u=g[i-1][j],d=g[i+1][j];
int lu=g[i-1][j-1],ru=g[i-1][j+1],ld=g[i+1][j... | ALGO | 0.999309 | 3.749665 |
aadfb1b8-712a-4e0d-bb54-fd4746082474 | Tinker-Twins/3D-LIDAR-Localization | fast_gicp/thirdparty/Eigen/bench/spmv.cpp |
//g++-4.4 -DNOMTL -Wl,-rpath /usr/local/lib/oski -L /usr/local/lib/oski/ -l oski -l oski_util -l oski_util_Tid -DOSKI -I ~/Coding/LinearAlgebra/mtl4/ spmv.cpp -I .. -O2 -DNDEBUG -lrt -lm -l oski_mat_CSC_Tid -loskilt && ./a.out r200000 c200000 n100 t1 p1
#define SCALAR double
#include <iostream>
#include <algor... | ALGO | 0.960583 | 4.293816 |
640bb99f-0b11-4520-ad01-fb734862add9 | insaneprem/LeetCode-Solutions | 0416-partition-equal-subset-sum/0416-partition-equal-subset-sum.cpp | class Solution {
public:
bool canPartition(vector<int>& nums) {
int dp[20001]={};
int n=nums.size();
dp[0]=1;
int sum=accumulate(begin(nums),end(nums),0);
for(auto &num:nums){
for(int i=20000;i-num>=0;i--) if(dp[i-num]) dp[i]=1;
}
return (sum%2 =... | ALGO | 0.999634 | 5.856279 |
bb99b3ea-0157-4a55-9c49-6a9ad5c8c3ed | Coach-Academy/Winter1 | Level 1/CPU - Premium - L1 - C108/Practice/Week 11/I.cpp | #include <iostream>
#include <vector>
using namespace std;
vector< int > a;
int n, x;
void rec(int i) {
if(i >= n) {
return;
}
if(a[i] != x) {
cout << a[i] << ' ';
}
rec(i + 1);
}
int main() {
cin >> n >> x;
a = vector< int > (n);
for(int i = 0; i < n; i++) {
c... | ALGO | 0.999885 | 3.525272 |
3c784fe9-5dcf-488f-a00c-9ad6b0107bf4 | maskmind/LeetCode-solution | 0820.单词的压缩编码/0820-单词的压缩编码.cpp | class Solution {
public:
int minimumLengthEncoding(vector<string>& words) {
set<string> word_set(words.begin(), words.end());
for (int i = 0; i <words.size(); ++i)
{
for (int j = 1; j < words[i].length(); ++j)
{
word_set.erase(words[i].substr(j));
... | ALGO | 0.999923 | 5.816462 |
b78cfcfd-9a1b-411b-8c83-cf2d380f42aa | cppalliance/cuda-math | test/test_cbrt_nvrtc_double.cpp | #define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false
#include <iostream>
#include <iomanip>
#include <vector>
#include <random>
#include <exception>
#include <boost/math/special_functions/cbrt.hpp>
#include <boost/math/special_functions/relative_difference.hpp>
#include ... | ALGO | 0.942242 | 6.70187 |
46ed7e1b-764c-43c1-8ae8-e7bf97e04252 | ishandutta2007/codeforces | aidos/normal/259/A.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#define pb push_back
#define ll long long
#define mp make_pair
#define ff first
#define sc second
#define pii pair<int,int>
#define pis pair<i... | ALGO | 0.999662 | 3.334112 |
522f419b-017e-4ab8-8ba0-600b05efbbe1 | DEEDS-TUD/TraceSanitizer | target-programs/parsec/pkgs/apps/facesim/src/Public_Library/Collisions_And_Interactions/COLLISION_BODY_LIST_3D.cpp | using namespace PhysBAM;
//#####################################################################
// Function Triangulated_Surface_Intersection_With_Any_Body
//#####################################################################
template<class T> bool COLLISION_BODY_LIST_3D<T>::
Triangulated_Surface_Intersection_With_A... | ALGO | 0.993259 | 5.288301 |
c4618531-db8c-4e8b-aca4-cdf2048f0fc3 | arvindr9/competitive-programming | Contests/Codeforces/previous/1427/E.cpp | // 1427 E: Xum
#include <bits/stdc++.h>
using namespace std;
typedef int int2;
#define int long long
#define pi pair<int, int>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define f first
#define s second
const int inf = 1e18;
// based on summitwei's solution
vector<string> calcs;
vector<int>... | ALGO | 0.999935 | 3.655924 |
38250498-f2e3-4f5d-9cff-54c2f849b1ab | priyanshuranjan2024/dsa | arrayQues/sumOfAllSubArray.cpp | //given an array a[] of size n. output sum of wach subarray of the given array.
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int currentSum=0;
int count=0;//will count the number of subarrays
//nested loop... | ALGO | 0.99984 | 4.351008 |
88deb563-8e73-41e7-981d-82dbb344e6c1 | postech-dblab-iitp/turbograph-v3 | src/function/aggregate/distributive/entropy.cpp | #include "common/exception.hpp"
#include "common/vector_operations/vector_operations.hpp"
#include "function/aggregate/distributive_functions.hpp"
#include "planner/expression/bound_aggregate_expression.hpp"
#include "function/function_set.hpp"
#include <unordered_map>
namespace duckdb {
template <class T>
struct Ent... | TOOL | 0.85979 | 7.82399 |
3c2cc720-ea3b-4897-ab75-dd53b98fa24b | Admer456/burektech2 | neo/cm/CollisionModel_debug.cpp | /*
===============================================================================
Trace model vs. polygonal model collision detection.
===============================================================================
*/
#include "precompiled.h"
#pragma hdrstop
#include "CollisionModel_local.h"
/*
=================... | TOOL | 0.940768 | 5.969801 |
487fe0eb-0317-4b40-8979-a0c44e7baaf6 | mamunurRoshid14/cf-solves | 1896A | Jagged Swaps/234269128.cpp | //https://codeforces.com/profile/mamunur_roshid_517
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define mod 1000000007
void solve(){
ll n,i,j; cin>>n;
ll aa[n+2];
for(i=1;i<=n;i++){
cin>>aa[i];
}
if(aa[1]==1){
cout<<"YES\... | ALGO | 0.999527 | 3.667452 |
293c424a-39ea-4de3-8db1-86fb8d70f469 | suppertails66/yunatools | blackt/src/util/TEdcCalc.cpp | #include "util/TEdcCalc.h"
#include <iostream>
namespace BlackT {
TEdcCalc::TEdcCalc() {
// initialize table
for (unsigned int i = 0; i < 256; i++) {
unsigned int x = i;
for (unsigned int j = 0; j < 8; j++) {
bool shiftOut = ((x & 0x01) != 0);
x >>= 1;
if (shiftOut) x ^= ... | ALGO | 0.990319 | 4.490011 |
0053d1c4-a188-425b-bf66-8e698841408e | ishandutta2007/codeforces | tomek/normal/1616/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int _n=(n), i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define TRACE(x) cerr << "TRACE(" #x ")" << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << endl;
void init_io() {
c... | ALGO | 0.999882 | 4.207492 |
f65485c0-aca8-4d2b-8e81-a69a8d125a85 | infitake/pcp | gfg/Maximum sum Rectangle .cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define pii pair<ll,ll>
#define vec1 vector<ll>
#define vec2 vector<ll,ll>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep1(i,b) for(ll i=1;i<=b;i++... | ALGO | 0.9999 | 3.751434 |
74a7dd00-325f-4e61-8c0b-d1bc7b8b9933 | Lee-Duck-03/template_cp | codetumlumtala/Codeforces Round 868.cpp | #include<bits/stdc++.h>
#define fo(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
#define ff first
#define ss second
#define vt vector
#define ins insert
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
using... | ALGO | 0.999808 | 3.963385 |
e7f6be19-6a99-413d-9df0-23f6a4d4702a | Zalez95/sombra-engine | sombra/src/se/physics/collision/Simplex.cpp | #include <algorithm>
#include <glm/gtc/epsilon.hpp>
#include "Simplex.h"
namespace se::physics {
bool isOriginInside(const Simplex& simplex, float epsilon)
{
switch (simplex.size()) {
case 1: {
if (!glm::all(glm::epsilonEqual(simplex[0].getCSOPosition(), glm::vec3(0.0f), epsilon))) {
return false;
... | ALGO | 0.996421 | 7.156448 |
d4ce439c-2712-4b2c-8353-63a3eaed2f66 | mwgit00/cpoz | CameraHelper.cpp | #include <iostream>
#include <opencv2/highgui.hpp>
#include <opencv2/calib3d.hpp>
#include "CameraHelper.h"
namespace cpoz
{
CameraHelper::CameraHelper()
{
// create ideal camera calibration data for testing
// real calibration data must be applied with load method
img_sz = { 640, 480 ... | TOOL | 0.971563 | 6.637298 |
7612ea39-8245-4dca-94cc-d617e0446e87 | strengthen/LeetCode | C++/652.cpp | __________________________________________________________________________________________________
sample 28 ms submission
class Solution {
public:
vector<TreeNode*> findDuplicateSubtrees(TreeNode* root) {
vector<TreeNode*> ans;
unordered_map<long,pair<int,int>>m;
helper(root, m, ans);
retur... | ALGO | 0.999944 | 5.65323 |
cdbe536e-0381-41ba-b36a-b1ac45c772b3 | KagariET01/cpptemp | lib/exgcd.cpp | #include<cmath>
namespace ET01{
using INT=long long int;
#define PII std::pair<INT,INT>
#define PIPII std::pair<INT,PII>
PIPII exgcd(INT a,INT b){
if(b==0){
return PIPII(a,PII(INT(1),INT(0)));
}else{
INT lst[3][3]={
{a,1,0},
{b,0,1},
{0,0,0}
};
INT i=2;
while(1){
INT nw=lst[(i+1)%... | ALGO | 0.999811 | 4.230375 |
10a4f6b4-22a2-47e1-b8df-3a2a8424a18e | ancorp134/cp-problems | A_GamingForces.cpp | // Author : Ankit Tyagi
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define fri(i, a, b) for (int i = a; i < b; i++)
#define frd(i, a, b) for (int i = a; i >= b; i--)
#define pb push_back
#define vi... | ALGO | 0.999723 | 4.942222 |
db0b7df2-9905-44da-9e48-c80a465584f1 | HONGJICAI/LeetCode | cpp/636.cpp | // singleScan-iteration.cpp
class Solution {
public:
vector<int> exclusiveTime(int n, vector<string> &logs) {
vector<int> res(n, 0);
int lastTime = 0, lastId = 0;
vector<int> st(1, 0);
for (auto &str : logs) {
int first = str.find(':'), second = str.rfind(':');
int id = stoi(str.substr(0, ... | ALGO | 0.968227 | 6.117194 |
d4d3cf52-9ac3-4743-b73d-861a346f98ff | sKAR04/CP-Practice | Codeforces/282/282C.cpp | /*
#####################################################
# I will win.. maybe not immediately but definitely #
#####################################################
*/
#include <bits/stdc++.h>
using namespace std;
//save time
#define endl '\n'
typedef long long ll;
//for sorting
#define all(a) a.begin(),a.end()
//C... | ALGO | 0.999979 | 4.005257 |
4d1cdee1-bac7-41ff-a010-9e83626ef4d5 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3460_28.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
long long a, b, c, d;
cin >> a >> b >> c >> d;
cout << b << " " << c << " " << c << "\n";
}
int main() {
long long tt;
cin >> tt;
while (tt--) {
solve();
}
}
| ALGO | 0.998939 | 3.914936 |
6b8c5aa1-09bc-437b-beda-187df2a4de35 | nopslide/firovm | src/cryptopp/bench2.cpp | // bench2.cpp - written and placed in the public domain by Wei Dai
#include "cryptlib.h"
#include "pubkey.h"
#include "gfpcrypt.h"
#include "eccrypto.h"
#include "bench.h"
#include "validate.h"
#include "files.h"
#include "filters.h"
#include "hex.h"
#include "rsa.h"
#include "nr.h"
#include "dsa.h"
#include "luc.h"
... | TEST | 0.901231 | 7.308697 |
74ea1060-0439-4754-9196-2c72892028f6 | Akshay1705/dsa-practice-ak | parttens/pt2p5.cpp | #include<iostream>
using namespace std;
int main(){
//input
int num;
cout<<"enter num : ";
cin>>num;
//for column
int col=1;
while(col<=num){
//for row
int row=1;
while(row<=num){
//what you want to print
cout<<col;
row = row + 1;
}
cout<<endl;
col = col + 1;
}
retu... | ALGO | 0.999301 | 3.84731 |
923df926-9152-44e2-81ad-e21e410e8796 | SenseLogic/MYST | BOOST/boost_1_76_0/libs/multi_index/example/composite_keys.cpp | #if !defined(NDEBUG)
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
#endif
#include <boost/call_traits.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/order... | TOOL | 0.924885 | 6.667601 |
271e6a79-efac-49c3-b87a-49b975b8e2f7 | nguyenvan1604/Code | test.cpp | #include <stdio.h>
#include <string.h>
enum {MAX_WORD_LEN = 20};
enum {MAX_LINE_LEN = 50};
int IsWhitespace(int ch)
{
return (ch == ' ') || (ch == '\n') || (ch == '\t');
}
int ReadWord(char *word)
{
int ch, pos = 0;
ch = getchar();
while (IsWhitespace(ch))
ch = getchar();
while (!IsWhitesp... | TOOL | 0.998825 | 4.484375 |
15b5bef7-ddd8-491d-9f07-9fbdbbd42f88 | cebaz/SEBASTIAN-FERRARO-TRABAJOS-2022 | PROGRAMACION/C++/codigos/EJERCICICIOS DE VECTORES/ejercicio 4/main.cpp | #include <iostream>
using namespace std;
int a[10],b[10],c[10];
void cargarLosVecatoresABC(){
for(int c=0;c<3;c++){
cout<<"ingrese un numero para el vector 'A'"<<endl;
cin>>a[c];
}
for(int c=0;c<3;c++){
cout<<"ingrese un numero para el vector 'B'"<<endl;
cin>>b[c];
}
for(i... | ALGO | 0.999343 | 3.431283 |
92938289-0f44-4662-906d-9f6367c513f5 | ffrige/SDC-PathPlanning | src/Eigen-3.3/unsupported/doc/examples/MatrixPower.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
Matrix3d A;
A << cos(1), -sin(1), 0,
sin(1), cos(1), 0,
0 , 0 , 1;
std::cout << "The matrix A is:\n" << A << "\n\n"
"The matrix power A^(pi/4) is:\n"... | ALGO | 0.999625 | 3.790203 |
55b49262-e675-42c8-8cb9-9012e6e40401 | SchlossLab/clustur | src/RAbundVector.cpp | //
// Created by Gregory Johnson on 6/17/24.
//
#include "MothurDependencies/RAbundVector.h"
/***********************************************************************/
RAbundVector::RAbundVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0) {}
/*****************************************************************... | ALGO | 0.950728 | 7.072197 |
00de0cf4-fcf3-4f4b-a038-a777a5ca6623 | FaiyajAmin/Competitive_Programming | Gym - 102058M Coke Challenge.cpp | //#include<bits/stdc++.h>
//
//#define sf(n) scanf("%d", &n);
//#define pf(n) printf("%d", &n);
//#define rep(q, i, n) for(int q=i; q<n; q++)
//#define ll long long
//#define ull unsigned long long
//#define pb push_back
//#define all(v) v.begin(),v.end()
//#define ff first
//#define ss second
//#define pii pair<int,in... | ALGO | 0.999684 | 3.456612 |
2f8e7ab5-270f-4f7e-b01e-78b1e9ca61ab | Adarshsingh7890/learning_React | LLD/TicTacToe.cpp | #include <iostream>
using namespace std;
char board[3][3] = {{'1', '2', '3'}, {'4', '5', '6'}, {'7', '8', '9'}};
int curr_player;
int curr_player_mark;
void displayBoard(){
cout << "------Board--------" << endl;
for (int i = 0 ; i < 3; i++){
cout << " | ";
for (int j = 0 ; j < 3; j++){
... | ALGO | 0.999666 | 4.983161 |
b4184454-ace1-4cc2-8faa-2aa278915267 | yangxy01/School_Codes | C++Code/Experience_7/Experience_7/test.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<math.h>
#include<iomanip>
#include<string>
#include<cstring>
using namespace std;
////---------- B. Ʊƣ죩------------
//class lottery
//{
// int num;
// int *group1;
// int**groupn;
//public:
// lottery(int* p, int n)
// {
// num = n;
// group1 = new int[... | ALGO | 0.998319 | 3.312656 |
91e65b9c-3c2b-4117-84a0-7b6c7f281b76 | sskrolkina/ITMO_Algorithms_1_sem | LAB_5/B.CheckingCorrectness.cpp | #include <iostream>
using namespace std;
struct Tree{
int data = 0;
Tree* lkid = nullptr;
Tree* rkid = nullptr;
Tree* mama = nullptr;
int min;
int max;
};
Tree tree[200000];
bool check = true;
void Checking(int i,int min,int max){
if(tree[i].mama -> data >= tree[i].data && tree[i].mama -> ... | ALGO | 0.999997 | 3.934318 |
74bb2268-a322-4dab-9ce9-52b4a240cf77 | Abhishek0421/Leetcode-solution | Egg Dropping Puzzle - GFG/egg-dropping-puzzle.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find minimum number of attempts needed in
//order to find the critical floor.
int dp[201];
int solve(int e,int f){
if(f==0 || f==1){
return f;
... | ALGO | 0.999965 | 5.811597 |
1029a4d3-1b10-4d5a-829f-181e2328328a | tsawke/OI | JDOJ/JDOJ 2169.cpp | #include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
using namespace std;
typedef unsigned long long unll;
inline void readLL(unll&);
inline void read(int&);
int n, a, b;
int f[11000];
int main(){
read(n), read(a), read(b);
// if(!n){printf("No Solution\... | ALGO | 0.999965 | 3.535267 |
e33692c1-ab38-4525-b6e0-8c9e8a8fcf28 | cuonggpham/300-codes-for-kids | 747-min-cost-climbing-stairs/min-cost-climbing-stairs.cpp | class Solution {
public:
int minCostClimbingStairs(vector<int>& cost) {
int n = cost.size();
int F[1001]={0};
F[0] = cost[0];
F[1] = cost[1];
for(int i=2; i<n; i++){
F[i] = min(F[i-1] + cost[i], F[i-2]+cost[i]);
}
return min(F[n-1], F[n-2]);
}
... | ALGO | 0.999962 | 6.141343 |
4b223a66-de6f-41a0-8c08-0880ddab9756 | bingbingzhenbang/LeetCode_Answers | LeetCode/Remove_Duplicates_from_Sorted_List.cpp | //Given a sorted linked list, delete all duplicates such that each element appear only once.
//
// For example,
// Given 1->1->2, return 1->2.
// Given 1->1->2->3->3, return 1->2->3.
//
#include "ListNode.h"
#include <cstdlib>
struct ListNode* deleteDuplicates(struct ListNode* head)
{
struct ListNode *p, *q;
if (... | ALGO | 0.999448 | 4.58304 |
5911ff2f-5886-4eb3-84a2-3af19579f06d | hyperether/android-freeimage | jni/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmap.cpp | //-----------------------------------------------------------------------------
//
// Environment maps
//
//-----------------------------------------------------------------------------
#include "ImfEnvmap.h"
#include "ImathFun.h"
#include "ImfNamespace.h"
#include <algorithm>
#include <math.h>
using namespace std;
... | ALGO | 0.895037 | 7.053075 |
82917532-3bbf-42e9-84f2-0b13c36a135b | GuacheSuede/MSSubmission1234567890 | submission/ema/boost_1_69_0/libs/contract/example/features/optional_result_virtual.cpp | #include <boost/contract.hpp>
#include <boost/optional.hpp>
#include <vector>
#include <cassert>
template<typename T>
class accessible {
public:
virtual T& at(unsigned index, boost::contract::virtual_* v = 0) = 0;
// Could program class invariants and contracts for following too.
virtual T const& operator... | TOOL | 0.891195 | 5.100717 |
5e4e662f-793b-42c2-ad1e-8e9d406214ae | ishandutta2007/codeforces | andreasyan/normal/1270/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
const int N = 200005;
int n;
int a[N];
pair<int, int> t[N * 4];
pair<int, int> mer(const pair<int, int>& a, const pair<int, int>& b)
{
if (a.second < b.second)
return a;
return b;
}
void ubd(int tl, int tr, int x, int y, int pos)
{
... | ALGO | 0.999947 | 3.441821 |
bbf2a6ee-58a2-4c95-892e-ecc7c3b69c1a | homer6/c_reading | boost-trunk/libs/fusion/example/performance/accumulate.cpp | #include <boost/array.hpp>
#include <boost/timer.hpp>
#include <boost/fusion/algorithm/iteration/accumulate.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/algorithm/transformation/zip.hpp>
#include <boost/fusion/sequence/intrinsic... | TEST | 0.987527 | 6.407534 |
9ef736f3-2ead-461f-816e-581dec625aed | ironwaste/acm | hduoj/uni_sch/8-4/1008.cpp | // 看什么看,以为我厉害吗?
// 我只是戾气很重,不厉害只需要114514分钟就能变厉害了
// 而你我的朋友只需要2.5年就可以了
#include<bits/stdc++.h>
#include<climits>
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define i64 long long
#define fi first
#define se second
#define endl '\n'
#define mod3 998244353
#define mod7 1000000007
#define de(x) cerr << #x ... | ALGO | 0.999937 | 3.632685 |
7da784fe-70a0-4b19-b751-041dc0e3af5c | ishandutta2007/codeforces | i_love_dasha_karpenko/normal/1593/A.cpp |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
void solve(){
int a,b,c;
cin>>a>>b>>c;
cout<<max({0,b+1-a,c+1-a})<<' '<<max({0,a+1-b,c+1-b})<<' '<<max({0,b+1-c,a+1-c})<<endl;
}
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t;
c... | ALGO | 0.999946 | 4.765584 |
78cb3a2e-a3ae-4f62-8ea3-05f2a9210814 | matiego1/sio2 | Klasa 1 (22-23)/dos.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int suma = 1;
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
suma += i;
suma += (i == n / i ? 0 : n / i);
}
}
if (n == suma) {
cout << "TAK";
} else {
cout <... | ALGO | 0.999975 | 5.221399 |
ec715d54-7cbf-4f47-8012-18311fb8290d | David-5-5/tutorial | cplus/codeforce/algo3c.cpp | #include <bits/stdc++.h>
using namespace std;
char ttt[3][3];
string lines[8];
// return 0, if count(X) == count(0)
// return 1, if count(X) == count(0) + 1
// return -1, illege
// return 3, if count(X) = 5, count(0) = 4
int count()
{
int cnt_x = 0, cnt_0 = 0;
for (int i = 0; i < 3; i++)
for (int j = ... | ALGO | 0.999927 | 3.579779 |
b5eb442f-c520-4150-9d41-edc1466163be | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_6300_45.cpp | #include <bits/stdc++.h>
double p[111], q[111], L[111], R[111];
int c[111];
int N;
int main() {
scanf("%d", &N);
for (int i = 1; i <= N; i++) {
scanf("%lf", &p[i]);
p[i] /= 100;
q[i] = 1 - p[i];
}
double ans = 1, mul = 1;
for (int i = 1; i <= N; i++) ans = ans * p[i], mul = mul * q[i];
ans = ans... | ALGO | 0.999915 | 3.435434 |
b2117b46-ecae-41ff-8b0c-3c85b9857755 | Rizwankhan0001/Leetcode | Vertical Traversal of Binary Tree - GFG/vertical-traversal-of-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
... | ALGO | 0.999978 | 6.512373 |
737981f5-41c9-41df-9af0-d30607aa5dbd | ataykaylar/CS202-HW1 | sorting.cpp | #include "sorting.h"
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
}
void mergeSort(int *arr, int size, unsigned long &compCount, unsigned long &moveCount)
{
mergeSort(arr, 0, size-1, compCount, moveCount);
}
void mergeSort(int* arr, int first, int last, unsigned long& compCount, unsigne... | ALGO | 0.999843 | 4.592441 |
b9d3a29c-a78b-4397-b115-3b6c0cad15c3 | yingchi1130/2023aaia3 | week09/week09-4.cpp | //week09-4.cpp 學習計畫 Math 第2題 扣掉最大、最小,再平均
//1491. Average Salary Excluding the Minimum and Maximum Salary
class Solution {
public:
double average(vector<int>& salary) {
int max = salary[0]; //要找最大值,先拿最前面的那個人,當預設值
int min = salary[0]; //要找最小值,先拿最前面的那個人,當預設值
double total = 0;
for(int i=0;i<sala... | ALGO | 0.99857 | 4.661656 |
3c366283-e5b5-4e55-9348-726e75e55809 | seifmohamed0/Leetcode-solutions | 1557-minimum-number-of-vertices-to-reach-all-nodes/1557-minimum-number-of-vertices-to-reach-all-nodes.cpp | class Solution {
public:
vector<vector<int>>v;
stack<int>st;
vector<bool>vis , vis2;
void dfs(int node){
vis[node] = true;
for(auto it: v[node]){
if(!vis[it])dfs(it);
}
st.push(node);
}
void dfs2(int node){
vis[node] = true;
for(auto it... | ALGO | 0.99995 | 5.957592 |
8872e075-23d8-423c-aff1-df9e09e5b8de | KappaDistributive/advent_of_code | cpp/src/2023/day_15.cpp | #include "../utils/input.hpp"
#include <cassert>
auto hash(const std::string &s) {
int result{0};
for (const auto c : s) {
result += int(c);
result *= 17;
result %= 256;
// std::cout << std::format("Hashing: {} -> {}", s, c, result) << std::endl;
}
return result;
}
auto part_one(const std::vec... | ALGO | 0.975549 | 6.009278 |
72667127-2c66-4c91-a695-223c944ead00 | thepith/cpp | blatt-01/Pentecost.cpp | int DayOfPentecost(int year) {
int K = year/100;
int M = 15 + (3*K + 3)/4 - (8*K +12)/25;
int S = 2 - (3*K + 3)/4;
int A = year % 19;
int D = (19*A + M) %30;
int R = (D + A/11)/29;
int OG = 21 + D - R;
int SZ = 7 - (year + year/4 + S)%7;
int OE = 7 - (OG - SZ) % 7;
int OS = OG + OE; // easter in da... | ALGO | 0.998958 | 4.869421 |
5cfc061c-eefa-4b4e-ab8d-32ad59a36807 | MarcioCerqueira/KinectFusionForFaces | src/Mediators/HeadPoseEstimationMediator.cpp | #include "Mediators/HeadPoseEstimationMediator.h"
HeadPoseEstimationMediator::HeadPoseEstimationMediator(char *HPEConfigFileName) {
this->HPEConfigFileName = HPEConfigFileName;
headPoseEstimator = new HeadPoseEstimator(HPEConfigFileName);
}
HeadPoseEstimationMediator::~HeadPoseEstimationMediator() {
delete head... | ALGO | 0.968161 | 5.017563 |
552d1031-a6e4-4c59-90e2-249364ff37ba | Shahraaz/CP_P_S5 | Atcoder/ARC_113/a.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "/debug.h"
#else
#define db(...)
#endif
#define all(v) v.begin(), v.end()
#define pb push_back
using ll = long long;
const int NAX = 2e5 + 5, MOD = 1000000007;
void solveCase()
{
int n;
cin >> n;
vector<ll> cnt(n + 1);
for (size_t i ... | ALGO | 0.999908 | 4.498345 |
b98bf4a0-ddac-4e0d-8806-ee071c100a40 | Charishma-Coders/dev-diary | May 17, 2025/Vector.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
// Declaring of vector
vector<int> v={1,3,5,7,9};
cout<<v[2]<<endl;
// adding elements at the end
v.push_back(11); // adds 11 at the end
v.emplace_back(13); // adds 13 at the end
cout<<v[5]<<" "<<v[6]<<endl;
// Other approach... | TOOL | 0.938352 | 4.063368 |
9bbfe232-3aef-497e-95bb-1b0d5771ca49 | benyusouf/algorithms-and-data-structure | src/linked-list/3.MiddleNode/cplusplus.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* middleNode(ListNode* head) {
ListNode* slow = head;
ListNode* fast = head->next;
while(... | ALGO | 0.999668 | 5.777823 |
d524516f-fc62-4727-8546-0d4b20c76522 | RD345/266-Mid-Term | idlib/hashing/Honeyman.cpp |
#include "../precompiled.h"
#pragma hdrstop
#define HONEYMAN_INIT_VALUE 0x00000000L
#define HONEYMAN_XOR_VALUE 0x00000000L
#ifdef CREATE_CRC_TABLE
static unsigned long crctable[256];
/*
Create the CRC table for the simplified version of the pathalias hashing function.
Thanks to Steve Belovin and Peter Honeyman... | ALGO | 0.999175 | 5.858497 |
5038d6d6-4f97-469c-9c86-9dabbe54de66 | LiamBindle/gchp-thirdparty | ESMF/src/Infrastructure/Mesh/src/Moab/MergeMesh.cpp | #include "moab/MergeMesh.hpp"
#include "moab/Skinner.hpp"
#include "moab/AdaptiveKDTree.hpp"
#include "moab/Range.hpp"
#include "moab/CartVect.hpp"
#include "Internals.hpp"
#include <vector>
#include <algorithm>
#include <string>
#include <vector>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <s... | ALGO | 0.956606 | 4.644223 |
d52f9d45-c8da-4d89-a91c-b947093c6ada | shahzodbahtiyorov/prod-test | TMessagesProj/jni/third_party/openh264/src/codec/processing/src/denoise/denoise.cpp | #include "denoise.h"
#include "cpu.h"
WELSVP_NAMESPACE_BEGIN
#define CALC_BI_STRIDE(iWidth, iBitcount) ((((iWidth) * (iBitcount) + 31) & ~31) >> 3)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
CDenoiser::CDenoiser (int32_t iCpuFlag) {
m_CPUFlag =... | ALGO | 0.997636 | 4.754971 |
3ced3e7e-0ea2-4fe4-a6ef-c15e1c81cda1 | AkshayKohad/Leetcode-Problems | Bit manipulation/XOR Queries of a Subarray.cpp | class Solution {
public:
vector<int> xorQueries(vector<int>& arr, vector<vector<int>>& queries) {
int n = arr.size();
vector<int>prefix_xor(n);
prefix_xor[0] = arr[0];
for(int i=1;i<n;i++)
{
prefix_xor[i] = prefix_xor[i-1] ^ arr[i];
}
v... | ALGO | 0.999967 | 5.980388 |
4323321c-0d3b-4e5c-a9cd-d3630d1c2636 | CAHLR/pyBKT | source-cpp/pyBKT/Eigen/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A;
A << 1, 2, 2, 3;
cout << "Here is the matrix A:\n" << A << endl;
SelfAdjointEigenSolver<Matrix2f> eigensolver(A);
if (eigensolver.info() != Success) abort();
cout << "The eigenvalues of A ... | ALGO | 0.999429 | 3.846247 |
4068fd13-5d27-4e20-8b05-69221b23a4d5 | bonnth80/school-work-stuff | containerMinMax.cpp | // SortLargeFile.cpp
#include <iostream>
#include <list>
#include <map>
#include <vector>
#include <string>
#include <iterator>
#include <algorithm>
using namespace std;
template<typename eType, typename cType>
eType maxElement(cType& container) {
eType x = *container.begin();
for (auto p = container.begin() + 1;... | ALGO | 0.993011 | 4.506724 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.