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 |
|---|---|---|---|---|---|---|
5e34df25-200d-48e1-9ddf-1e8c58aa710f | OguriMahesh/CSA0488-OS | Q24.cpp | #include <stdio.h>
#define MAX_BLOCKS 100
int memory[MAX_BLOCKS];
int processSize[MAX_BLOCKS];
// Function prototypes
void initializeMemory(int size);
int worstFit(int size);
void deallocateMemory(int blockIndex, int size);
void displayMemoryStatus(int size);
int main() {
int memorySize, choice, processSize, bl... | ALGO | 0.990744 | 4.998094 |
9a49d23d-0a0d-4232-b96f-d5bc3be3925e | shashank9aug/DSA_CB | Stack/Basics/recursivelyReverse.cpp | #include<iostream>
#include<stack>
using namespace std;
void insertAtBottom(stack<int>&st,int x){
//Base case :
if(st.empty()){
st.push(x);
return;
}
//Hypothesis :
int ele=st.top();
st.pop();
insertAtBottom(st,x);
//Induction :
st.push(ele);
}
void recursivel... | ALGO | 0.999939 | 5.140165 |
ffda6d16-973d-4453-a805-a3be6b91e9b9 | Adastra0121/LB | LB10/2391.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
getline(cin,s);
for (auto c :s)
if(isalpha(c) || c == ' ') cout << c;
return 0;
} | ALGO | 0.93943 | 4.069501 |
f3253a5a-80db-41d7-9391-f0631cda4ca0 | vaibhavchaubey/DSA-Practice | 0012-integer-to-roman/0012-integer-to-roman.cpp | class Solution {
public:
string intToRoman(int num) {
string ans;
string sym[] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
int val[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
for(int i = 0; num != 0; i++){
... | ALGO | 0.999522 | 6.306073 |
99af8972-2978-4f93-b837-4a28df620286 | URSec/SVA-Compiler | llvm/lib/Transforms/Utils/CodeMoverUtils.cpp | #include "llvm/Transforms/Utils/CodeMoverUtils.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/DependenceAnalysis.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Dominators.h"
using namespace llvm;
#define DEBUG_TYPE "codemover-utils"
STATISTIC(HasDe... | ALGO | 0.996575 | 8.030947 |
c8cb1b2b-8598-4595-a80d-183a02affca0 | whitewolf185/DA-labs | DA lab4/main.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
const int UNDEFINED = -5;
struct TValue {
unsigned val;
unsigned int lineCount;
unsigned int wordCount;
};
struct TAnsVal {
unsigned lineCount;
unsigned wordCount;
};
bool operator==(const unsigned lhs, const TValue &rhs) ... | ALGO | 0.944331 | 4.137125 |
aed178c2-953c-47cc-8116-2add0e37903b | ksood2004/gfg-solution | Difficulty: Medium/Power Set/power-set.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
void solve(string ip,string op,vector<string>& result){
if(ip.length()==0){
result.push_back(op);
return;
}
string op1=op;
string op2=op;
op2.push_back(ip[0]);
... | ALGO | 0.998942 | 6.337562 |
bea043e7-70ed-4815-8f8a-21aadc0c28be | ArcticFoox/Algorithm_C- | find_num.cpp | #include<iostream>
using namespace std;
int arr[1000005];
int n;
int binarysearch(int target){
int st = 0;
int en = n - 1;
while(st <= en){
int mid = (st+en)/2;
if(arr[mid] < target) st = mid + 1;
else if(arr[mid] > target) en = mid - 1;
else return 1;
}
return 0;
... | ALGO | 0.999926 | 4.907157 |
6046167f-e463-4d1a-8e87-ee2dd6d421dc | mudar-hussain/DSA_Leetcode_Practice | 0427-construct-quad-tree/0427-construct-quad-tree.cpp | /*
// Definition for a QuadTree node.
class Node {
public:
bool val;
bool isLeaf;
Node* topLeft;
Node* topRight;
Node* bottomLeft;
Node* bottomRight;
Node() {
val = false;
isLeaf = false;
topLeft = NULL;
topRight = NULL;
bottomLeft = NULL;
... | ALGO | 0.999941 | 6.398942 |
a58d225b-96c2-447c-a6aa-d81c9ee6f535 | haoping0901/LeetCode-Practice-Records | 0217-contains-duplicate/0217-contains-duplicate.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
unordered_map<int, bool> rec;
for (const int& num: nums) {
if (rec.count(num) > 0)
return true;
else
rec[num] = true;
}
return false;
}
}; | ALGO | 0.999387 | 6.169018 |
48af6100-d8b1-451d-8cc0-d646359cd726 | mahimalmuntashir/CodeForces | 1300-1399/1354B-TernaryString.cpp | #include <iostream>
long mn(long x, long y){return (x < y) ? x : y;}
int main(){
long t; std::cin >> t;
while(t--){
std::string s; std::cin >> s;
long last[4] = {-1,-1,-1,-1};
long len(s.size() + 1);
bool found(false);
for(long p = 0; p < s.size(); p++){
... | ALGO | 0.999274 | 3.876237 |
2ce8a692-8514-42dd-89b6-014d5c44ce77 | nimendoza/noi-2023 | training/week-2/kupido/solution.cpp | #include <bits/stdc++.h>
std::vector<std::vector<char>> get_adjacency_list(int& n, int& a, int& b, int& x, int& y) {
std::vector<int> degrees{};
for (int _{}; _ < x; ++_) {
degrees.push_back(a);
}
for (int _{}; _ < y; ++_) {
degrees.push_back(b);
}
std::sort(begin(degrees), en... | ALGO | 0.999906 | 4.661119 |
e639bc0f-52ce-4ad8-9d9f-b65b17a73a63 | pablomuniz/QuasarQuant | ql/methods/finitedifferences/utilities/localvolrndcalculator.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*! \file localvolendcalculator.cpp
\brief local volatility risk neutral terminal density calculation
*/
#include <ql/math/distributions/normaldistribution.hpp>
#include <ql/math/integrals/discreteintegrals.hpp>
#include <ql/math/inte... | ALGO | 0.999741 | 5.153344 |
2e239d32-ec3f-472d-9b45-85b496e2574e | alexandraback/datacollection | solutions_5766201229705216_0/C++/Qwaz/Study.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair < int, int > pii;
const int MAX = 1020;
int n;
vector < int > to[MAX];
int nodeCount(int root, int ignore){
int i, ret = 1;
for(i = 0; i<to[root].size(); i++){
if(to[root][i] != ignore)
ret += nodeCount(to[root][i], roo... | ALGO | 0.999527 | 4.748937 |
85e2d18d-bfce-4d5d-8821-43b7bbcff02b | Chongjx/NYP-framework | Common/Source/Mtx44.cpp | /******************************************************************************/
/*!
\file Mtx44.cpp
\author Wen Sheng Tang
\par email: tang_wen_sheng\@nyp.edu.sg
\brief
Matrix 4 by 4 use for affine transformation
*/
/******************************************************************************/
#include "Mtx44.h"
/**... | TOOL | 0.880914 | 6.096624 |
9c11a8ec-2d81-46f2-b65b-2a74dde961c6 | Apress/beginning-cpp20 | Exercises/Modules/Chapter 12/Soln12_07/Soln12_07.cpp | // Create a doubly-linked list of Packages
import box.random;
import truckload;
import <iostream>;
/*
To show reverse iteration, we've modified findSmallestBox() to iterate in reverse order
*/
SharedBox findLargestBox(const Truckload& truckload);
SharedBox findSmallestBox(const Truckload& truckload);
int main()
... | ALGO | 0.999919 | 5.81382 |
dff7cd8f-4e20-4c85-97c5-e23b21f5f54c | ishandutta2007/codeforces | realcomplex/normal/1455/G.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,ll> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N = (int)2e5 + 100;
const ll INF = (ll)1e18;
int ban;
struct myset{
set<pii> val; /... | ALGO | 0.999298 | 3.800669 |
f9b4c1a7-9f71-4bc9-ab67-f97f3c078afe | yaap/hardware_interfaces | neuralnetworks/aidl/utils/src/Burst.cpp | #include "Burst.h"
#include "Conversions.h"
#include "Utils.h"
#include <android-base/logging.h>
#include <android/binder_auto_utils.h>
#include <nnapi/IBurst.h>
#include <nnapi/IExecution.h>
#include <nnapi/Result.h>
#include <nnapi/TypeUtils.h>
#include <nnapi/Types.h>
#include <memory>
#include <mutex>
#include <... | TOOL | 0.940099 | 7.730744 |
53e81158-c844-4fce-ba15-5c8d34764d56 | Ravindranath-Porandla/LeetCode | 3329-find-the-length-of-the-longest-common-prefix/3329-find-the-length-of-the-longest-common-prefix.cpp | class Solution {
public:
int longestCommonPrefix(vector<int>& arr1, vector<int>& arr2) {
unordered_set<int> st;
for (int val : arr1) {
while (!st.count(val) && val > 0) {
st.insert(val);
val = val / 10;
}
}
int ans = 0;
... | ALGO | 0.999614 | 5.859667 |
2d29a107-b172-4de0-ba15-aaeca6ca5de3 | Eralien/TE-ORB_SLAM2 | ORB_SLAM2/Thirdparty/g2o/g2o/core/optimization_algorithm_gauss_newton.cpp | #include "optimization_algorithm_gauss_newton.h"
#include <iostream>
#include "../stuff/timeutil.h"
#include "../stuff/macros.h"
#include "solver.h"
#include "batch_stats.h"
#include "sparse_optimizer.h"
using namespace std;
namespace g2o {
OptimizationAlgorithmGaussNewton::OptimizationAlgorithmGaussNewton(Solve... | ALGO | 0.998992 | 6.723323 |
e8a06404-c628-4ba4-99b2-fb00a9ade5a2 | Benjaminhw/LeetCodeInterviewHot150 | 135-GivingAwayCandies/main.cpp | #include "function.h"
int main()
{
vector<int> temp = { 29,51,87,87,72,12 };
Solution A;
A.candy(temp);
return 0;
} | ALGO | 0.999294 | 4.568397 |
42f59d21-68d1-4b12-8690-fb512c88cabf | EKE-K/SP-practical | practical/assignment5/stack.cpp | // RA2211043010017 Alvin Ben George
// EKE - K Section
// Experiment no 5 Stacks
// Program 1 Create a stack of programming languages and display the top element of the stack.
#include<iostream>
#include<stack>
using namespace std;
int main() {
stack<string> languages;
languages.push("C++");
languages.pus... | ALGO | 0.959471 | 4.609129 |
abe642e3-388c-4f17-83fb-94a25505c18d | wuhao5/boost | libs/serialization/src/extended_type_info.cpp | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// extended_type_info.cpp: implementation for portable version of type_info
// See http://www.boost.org for updates, documentation, and revision history.
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) //... | TOOL | 0.904 | 6.760888 |
9df5a2cf-898a-40f4-8140-2676548e2c6d | ivan23kor/MIPT | 2DeadPool/src/Ball/Ball.cpp | #include "../Table/Table.hpp"
#include "../Ball/Ball.hpp"
#include "../Vector_aux/vector_operations.hpp"
#include <iostream>
#include <cmath>
Ball::Ball( const sf::Vector2f& position_, float radius_,
const std::string& name, int style_ )
{
position = position_;
velocity = sf::Vector2f( 0, 0 );
radius = radius_;
s... | TOOL | 0.877235 | 5.539583 |
bf5c3568-4f13-422d-8b54-06a37c6f27cd | kartikgupta321/DataStructuresAlgorithms | DSA/math algorithms/primes_to_n.cpp | #include<iostream>
#include<conio.h>
#include<vector>
#include<cstring>
using namespace std;
void sieveoferastosthenes(int n){
bool prime[n+1];
memset(prime,true,sizeof(prime));
for (int i = 2; i*i<=n; i++){
if(prime[i]==true){
for (int j = i*i; j <= n; j+=i){
prime[... | ALGO | 0.998601 | 4.155169 |
2ca0c177-2ba0-4b6e-8df9-58c595cca996 | meetdoshi90/CP-Algorithms | Math/Algebra/Euler-Totient-Function.cpp | //Also called phi function
//Counts the number of integers from 1 to n which are coprime to n
//Two numbers are coprime if their gcd is 1
//Time: O(nloglogn)
//Space: O(n)
#include<bits/stdc++.h>
using namespace std;
void phi(int n){
vector<int> cop(n+1);
for(int i=0; i<=n; i++)
cop[i] = i;
for(int i=2; i<=n; i++... | ALGO | 0.999184 | 4.741321 |
a9b1ca0f-c756-46b8-b65c-7fbabb4a8c4e | ishandutta2007/codeforces | sirshokoladina/normal/794/C.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef SG
#include <debug.h>
#else
template<typename T> struct outputer;
struct outputable {};
#define PRINT(...)
#define OUTPUT(...)
#define show(...)
#define debug(...)
#define deepen(...)
#define timer(...)
#define fbegin(...)
#define fend
#define pbegin(...... | ALGO | 0.999998 | 3.210585 |
c6894130-9014-42de-b7e7-a2550fb715d6 | nucleargezi/acm-icpc | BJTU_training/2025春/04-23 BJTU训练赛 -ak/H_Arthur_and_Brackets.cpp | #include "MeIoN_Lib/Z_H/MeioN.hpp"
#include "MeIoN_Lib/MeIoN_all.hpp"
void before() {}
// #define tests
void Yorisou() {
LL(n);
VEC(PLL, a, n);
vector<ll> s;
string ans;
FOR(i, n) {
meion &[l, r] = a[i];
ans += '(';
s += i;
l += len(ans);
r += len(ans);
while (not s.empty() and len(a... | ALGO | 0.999265 | 5.285681 |
1febefa3-0c1a-4c7f-a2cc-5cbdea9bafbd | T0peerakarn/competitive-programming | beta_programming/0025.cpp | #include <bits/stdc++.h>
using namespace std;
char a[110], b[110], opr;
int main()
{
scanf(" %s",a);
scanf(" %c",&opr);
scanf(" %s",b);
int la = strlen(a), lb = strlen(b);
if(opr == '*')
{
printf("1");
for(int i=0 ; i<la+lb-2 ; i++) printf("0");
}
else
{
if(la == lb)
{
printf("2");
for(int i=0 ;... | ALGO | 0.999824 | 3.15118 |
1a964eb0-a5a9-4e7a-8e7e-0efae49671af | stefdasca/CompetitiveProgramming | Infoarena/vmin.cpp | #include<bits/stdc++.h>
using namespace std;
ifstream f("vmin.in");
ofstream g("vmin.out");
struct points
{
long long a, b, pi;
};
points v[100002];
bool cmp(points a, points b)
{
if(a.a == b.a)
return a.b < b.b;
return a.a > b.a;
}
long long n, m, a, b;
long long t;
int pointer;
vector<long long>sl... | ALGO | 0.999997 | 4.115954 |
8756b5bc-64af-47d3-b7a6-c36db39ec1fe | TRANMINHBIBO/DSA | ThamLam/Bai13_SapDatXauKiTu.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s ; cin>> s;
int ans = 0;
map<char,int>mp;
for(char x : s)
{
mp[x]++;
ans = max(ans , mp[x]);
}
if((ans - 1) <= (s.length() - ans))
{
cout << "YES";
}
else cout << "NO";
} | ALGO | 0.999995 | 4.066019 |
7a325f50-480e-4dc9-9bc1-0f619e88f10f | Ritikpcl/Comp-Prog | united_airlines_OA.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
void initCode() {
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
static bool comp(vector<ll>& a, vector... | ALGO | 0.99999 | 3.930727 |
904d9390-95a3-4507-b521-9158b3c8a758 | rameshwarTiwari1/DSA | DSAPrcatics/DSAInCpp/Algorithm/linearSearch.cpp | #include<bits/stdc++.h>
using namespace std;
int linear_Search(vector<int>&arr,int n,int k){
for(int i=0;i<n;i++){
if(arr[i]==k){
return i;;
}
}
return -1;
}
int main(){
int n,k;
cin>>n>>k;
vector<int> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];... | ALGO | 0.999961 | 6.30996 |
ff378250-2c65-45fb-951c-b6d2c151c1ba | KazuakiTokunaga/competitive-programming | ABC251-275/ABC251/b.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define all(x) (x).begin(),(x).end()
int main() {
int N, W;
cin >> N >> W;
vector<int> A(N);
rep(i, 0, N) cin >> A[i];
... | ALGO | 0.999987 | 4.391828 |
74c42c82-0098-4c33-9bc4-517ba54ce9a8 | RalphVita/ProgramacaoCompetitiva | OneLittle.cpp | #include <iostream>
using namespace std;
//Swap32 eu encontrei como sujestão em:
//https://stackoverflow.com/questions/27506474/how-to-byte-swap-a-32-bit-integer-in-python
int main(){
int n,nc;
while (!cin.eof())
{
if(cin >> n){
//Swap32
nc = (((n << 24) & 0xF... | ALGO | 0.914206 | 3.561914 |
9ab2b0ad-ba3c-4ddf-92ad-24a96eecc81f | hritik2002/Leetcode-Problems | 1575-count-all-possible-routes/1575-count-all-possible-routes.cpp | class Solution {
public:
vector<vector<int>> dp;
int mod = 1e9 + 7;
int countPossibleRoutes(vector<int>& locations, int start, int finish, int fuel) {
if(fuel < 0) {
return 0;
}
int cnt = 0;
if(dp[start][fuel] != -1) {
return dp[start][fuel];
... | ALGO | 0.999903 | 5.887036 |
85f6d412-db7f-47a8-be6b-5c47a8b6c594 | FireworksZhang/-_-1619303 | 第五次上机题_zhy/1.cpp | #include<iostream>
using namespace std;
#define InitList SListInfo;
typedef char status;
typedef struct node//节点
{
status val;
struct node* lchild;
struct node* rchild;
}TreeNode, * BiTree;
class BinaryTree {
private:
node* head;
int depth=0;
public:
//初始化、销毁、清空、建表
BinaryTree();//InitBiTree... | ALGO | 0.999537 | 3.569918 |
5f1d47ca-69d4-46fe-8eb2-1784427375d5 | enderson-pan/qt-creator-gdbserver-fix | qt-creator-7.0.0/src/plugins/qmldesigner/components/curveeditor/detail/axis.cpp | #include "axis.h"
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <limits>
namespace QmlDesigner {
// The following is based on: "An Extension of Wilkinson's Algorithm for Positioning Tick Labels on Axes"
// by Justin Talbot, Sharon Lin and Pat Hanrahan.
// The Implementation uses the conventions ... | ALGO | 0.991683 | 7.433026 |
8173f1ba-cbee-4183-9ab1-90f8ec5d0d96 | sudhanshu1406/cpp | array/duplicate.cpp | // #include <iostream>
// using namespace std;
// int main() {
// int arr[] = {1,2,3,2,5};
// int n=5;
// for(int i=0; i<n/2; ++i)
// {
// for(int j=1; j<5; ++j)
// {
// if(arr[i]==arr[j])
// {
// cout<<arr[i];
// break;
// ... | ALGO | 0.9983 | 3.456236 |
7eeead8f-d17a-4deb-897a-55fb500e0b95 | Trina-SE/Competitive_Programming | Codeforces/C. Cypher.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,i;
cin>>n;
int a[n];
for(i=0;i<n;i++){
cin>>a[i];
}
}
}
| ALGO | 0.998722 | 3.170057 |
05a3fe87-44f7-4796-9660-ef44662406c9 | sp1newannafly/OAIP | 12.1.cpp | #include <iostream>
int K(int y)
{
if (y == 0)
return 0;
if (y == 1)
return 1;
return K(y - 1) + K(y - 2);
}
int main()
{
for (int x = 0; x < 30; x++)
std::cout << K(x) << " ";
return 0;
}
| ALGO | 0.999556 | 3.771414 |
67ba7619-56bc-4d34-b8af-c39eedc75082 | thekartikwalia/DS_Course | DS_Lab/Q11.cpp | #include<iostream>
using namespace std;
struct Node{
int data;
Node *left;
Node *right;
Node(int value) : data(value), left(nullptr), right(nullptr) {}
};
class BinarySearchTree{
public:
BinarySearchTree() : root(nullptr) {}
void insert(int value){
root = insertNode(root, value);
}
... | ALGO | 0.999974 | 5.678346 |
b586077a-eeef-4609-99a4-25537f94e8bf | rahulshah83/Leetcode | Solutions/2729. Check if The Number is Fascinating.cpp | class Solution {
public:
bool isFascinating(int n) {
std::stringstream ss;
ss << n << 2 * n << 3 * n;
std::string concatenatedString = ss.str();
long long ans = std::stoll(concatenatedString);
std::vector<int> v;
while (ans) {
int digit = ans % 10;
... | ALGO | 0.999747 | 6.252047 |
0c268f17-001f-49af-9069-91c849db4e93 | albertsegura/ammm-metaheuristic | brkga/src/samplecode.cpp | #include <iostream>
#include "SampleDecoder.h"
#include "myDecoder.cpp"
#include "MTRand.h"
#include "BRKGA.h"
#include <malloc.h>
#include <time.h>
#include <ctime>
using namespace std;
void print_chromosome(list<int> permutation);
list<int> get_chromosome_list(std::vector< double >& chromosome);
int main(int argc,... | ALGO | 0.99973 | 3.654137 |
0f9adc17-6390-425d-8fc5-d31ac5d348f2 | ria-garg17/Leetcode_Solutions | 0151-reverse-words-in-a-string/0151-reverse-words-in-a-string.cpp | class Solution {
public:
string reverseWords(string s) {
stack<string> st;
string temp = "";
for(int i = 0; i<s.length(); i++){
char ch = s[i];
if(ch == ' '){
if(temp != ""){
st.push(temp);
temp = "";
... | ALGO | 0.999986 | 6.241491 |
c716e2dd-d134-4e0d-9af2-ee37ee7cd9e1 | MuhammadShahriar/cpc-module-2-batch-2 | Class-11/Google Classroom Task-1.cpp | class Solution {
public:
int searchInsert(vector<int>& a, int x) {
int n = a.size();
int l = 0, r = n-1;
int ans = n;
while ( l <= r ) {
int mid = (l + r) / 2;
if ( a[mid] >= x ) {
ans = mid;
r = mid-1;
... | ALGO | 0.999875 | 5.934254 |
e25aa086-ace4-4e17-a3f9-29929eacd0f8 | prog1-eina-2019-20/tema-05-funciones | tablas-modular/tablas-modular.cpp | /*
* Curso de Programación 1. Tema 5
* Autores: Miguel Ángel Latre y Javier Martínez
* Última revisión: 7 de octubre de 2019
* Resumen: Programa interactivo que presenta por pantalla las tablas de multiplicar seleccionadas por el usuario.
* Versión modular (el código de la función main se apoya en una ... | ALGO | 0.98139 | 4.94022 |
60a0f76b-e6b2-4d42-a5a9-f37e7a503f74 | 28amit/CSES | Sorting and Searching/Distinct_Numbers.cpp | //
// Created by Amit.
//
#include <bits/stdc++.h>
#define int long long
#define MOD 1000000007
#define sort(a) sort(a.begin(, a.end()))
#define endl '\n'
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++)
using namespace std;
int32_t main()
{
#ifndef ONLINE_JUDGE
/* code */
freopen("input.txt", "r", stdin);... | ALGO | 0.99959 | 4.463629 |
e7b3f054-ba0c-4e99-b962-e3147695aee8 | ishandutta2007/codeforces | kotatsugame/normal/691/E.cpp | #line 1 "a.cpp"
#include<iostream>
using namespace std;
#line 3 "/home/kotatsugame/library/math/modint.cpp"
#include<utility>
template<int m>
struct modint{
unsigned int x;
constexpr modint()noexcept:x(){}
template<typename T>
constexpr modint(T x_)noexcept:x((x_%=m)<0?x_+m:x_){}
constexpr unsigned int val()const ... | ALGO | 0.999981 | 4.931648 |
a26dce2b-d95a-42ba-b469-0f8185b8cd90 | Jak57/14-design-patterns-coding-interview | 12. Top K elements/p2. Top K Frequent Elements.cpp | // https://leetcode.com/problems/top-k-frequent-elements/
class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
int i, j, n, val;
map<int, int> mp;
vector<int> ans;
n = nums.size();
for (i = 0; i < n; i++) {
val = nums[i];
... | ALGO | 0.999994 | 6.143056 |
ff8eb857-4e65-4c1e-9aa5-f388decb7de8 | fasterisk/BA-Teil2 | FreeImage/Source/FreeImage/NNQuantizer.cpp | ///////////////////////////////////////////////////////////////////////
// History
// -------
// January 2001: Adaptation of the Neural-Net Quantization Algorithm
// for the FreeImage 2 library
// Author: Herv Drolon (<EMAIL>)
// March 2004: Adaptation for the FreeImage 3 library (port to ... | ALGO | 0.999749 | 4.955767 |
186eb54d-0837-48cd-97fd-24994af65207 | delfinof/chromaprint | src/fft_lib_fftw3.cpp | #include "utils.h"
#include "fft_lib_fftw3.h"
using namespace std;
using namespace Chromaprint;
FFTLib::FFTLib(int frame_size, double *window)
: m_window(window),
m_frame_size(frame_size)
{
m_input = (double *)fftw_malloc(sizeof(double) * frame_size);
m_output = (double *)fftw_malloc(sizeof(double) * frame_size... | ALGO | 0.994219 | 5.88018 |
b553550b-adc9-4376-8d49-848d8d416bb8 | tfg1434/cp | Codeforces/1603A.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int T;
void solve() {
int n; cin >> n;
bool ok = true;
for (int i = 1; i <= n; i++) {
int x; cin >> x;
bool found = false;
for (int j = 2; j <= i+1; j++) {
if (x % j != 0) {
found = tru... | ALGO | 0.999556 | 5.433372 |
4d685ac3-b1b4-404a-901b-9039927115cc | PritomPaul99/CodesFromVScode | C++_programming/Contest_and_Problems/Random_Practice/CodeForces/A_Equidistant_Letters.cpp | // #include <iostream>
#include <bits/stdc++.h>
// Data Types
#define ll long long
#define lli long long int
#define ld long double
typedef unsigned long int uint32;
typedef unsigned long long int uint64;
// Constant Values & Numbers
#define pi acos(-1)
const ll Mod = 1e9 + 7;
#define POW(_x, _y) _x << _y
// File hand... | ALGO | 0.999918 | 5.363893 |
cf25c939-8918-4aa9-9b61-2909995f6eb3 | satya2022/-DSA-tree_for_placement | binary6_tree_height.cpp | #include<bits\stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* left;
Node* right;
//construct
Node(int d){
this->data = d;
this->left = NULL;
this->right = NULL;
}
};
Node* buildtree(Node* root){
cout<<"enter the data"<<endl;
int data ;
... | ALGO | 0.999196 | 4.746702 |
212198f6-ced8-4e17-859b-984240e96605 | ChanchalKumarMaji/LeetCode | 234. Palindrome Linked List/main.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
ListNode* reverseList(ListNode* head){
ListNode *prev = NULL, *curr = head, *next = NULL;
while(curr){
next = cu... | ALGO | 0.999588 | 5.732986 |
0bf965c6-4780-4a3b-a94b-97660f981ff6 | Sneha-14052003/Cpp-program-2 | 06.cpp | #include <iostream>
using namespace std;
int sum(int a, int b) {
return a + b;
}
int sum(int a, int b, int c) {
return a + b + c;
}
int sum(int a, int b, int c, int d) {
return a + b + c + d;
}
int main() {
cout << "Sum of 2 and 3: " << sum(2, 3) << endl;
cout << "Sum of 1, 4 and 5: " << sum(1, ... | ALGO | 0.947903 | 5.008532 |
3f6559b9-665c-469f-a9e8-f4465472b4b2 | viveknapit/CplusPlus | bit manipulation/challanges/unique3.cpp | #include<bits/stdc++.h>
using namespace std;
bool getBit(int n, int pos){
return (n & (1<<pos))!=0;
}
int setBit(int n, int pos){
return (n |(1<<pos));
}
int unique(int arr[], int n){
int result =0;
for(int i=0;i<64;i++){
int sum =0;
for(int j=0;j<n;j++){
if(getBit(arr[j],... | ALGO | 0.999653 | 4.432005 |
9705160b-9e9d-4a8b-a493-7d0a2d5d6b68 | Vivek-Khairnar31/DSA-Practice | Sorting Algorithms/Bubble_Sort.cpp | #include<bits/stdc++.h>
using namespace std;
void bubbleSort(int arr[],int n){
for(int i=n-1;i>=0;i--){
int didSwap=0;
for(int j=0;j<=i-1;j++){
if(arr[j]>arr[j+1]){
int temp=arr[j+1];
arr[j+1]=arr[j];
arr[j]=temp;
didSwap=1;... | ALGO | 0.999715 | 4.688522 |
b2027340-9701-424a-8eab-9d0838b82498 | GustavoAC/UVa-Online-Judge | 101.cpp | #include <iostream>
#include <algorithm>
#include <vector>
int findPos(const std::vector<int> &stack, const int &value) {
return std::find(stack.begin(), stack.end(), value) - stack.begin();
}
int main(int argc, char* argv[]) {
std::vector<std::vector<int>> blocks(25, std::vector<int>(25, -1));
std::vecto... | ALGO | 0.991786 | 4.298603 |
6cd02fd7-1b75-41b3-972e-cf82555d4754 | jsren/llvm-detex | llvm/lib/Support/SuffixTree.cpp | #include "llvm/Support/SuffixTree.h"
#include "llvm/Support/Allocator.h"
#include <vector>
using namespace llvm;
SuffixTree::SuffixTree(const std::vector<unsigned> &Str) : Str(Str) {
Root = insertInternalNode(nullptr, EmptyIdx, EmptyIdx, 0);
Active.Node = Root;
// Keep track of the number of suffixes we have t... | ALGO | 0.995291 | 7.201887 |
6f0ca4de-0b12-4494-9a9c-00c2b1bc8085 | SHOVON944/Codeforces | 800/A. Min Max Swap.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t; cin >> t;
while(t--){
int n;
cin >> n;
vector <int> a(n), b(n);
for(int i=0; i<n; i++) cin >> a[i];
for(int i=0; i<n; i++) cin >> b[i];
for(int i=0; i<n; i++){
if(a[i]>b[i]) swa... | ALGO | 0.999979 | 3.328883 |
c3188bf6-2b1b-4d40-b7d0-c25f3dded309 | hero9968/PaddlePaddle-book | paddle/parameter/FirstOrderOptimizer.cpp | #include "FirstOrderOptimizer.h"
#include "paddle/math/TrainingAlgorithmOp.h"
#include "paddle/utils/Flags.h"
#include "paddle/utils/Util.h"
#include <cmath>
DEFINE_bool(log_clipping, false, "enable log clipping or not");
namespace paddle {
SparseMomentumParameterOptimizer::SparseMomentumParameterOptimizer(
con... | ALGO | 0.978642 | 7.386411 |
7218b5cd-0b65-4e7a-95f8-5b7fb6c852c5 | Sartech-B/Competitive-Programming | CodeChef/p66.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int g;
cin>>g;
while(g--)
{
int init_state, q;
long int n;
cin>>init_state>>n>>q;
if(n%2==0) cout<<n/2<<endl;
else if(q==init_state) cout<<(n-1)/2<<endl;
else cout<<(n+1)/2<<endl;
}
}
} | ALGO | 0.999763 | 3.249092 |
720d1cb2-df87-4a92-8c04-df2f98423cd7 | ishandutta2007/codeforces | krk/normal/1234/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Maxn = 200005;
int n, m;
int X[Maxn];
ll upd[Maxn];
int main()
{
scanf("%d %d", &n, &m);
for (int i = 0; i < m; i++)
scanf("%d", &X[i]);
for (int i = 1; i < m; i++) {
int a = X[i - 1], b = X[i];
if (a >... | ALGO | 0.999978 | 3.377478 |
ebf0e9a1-8f7c-465b-9425-7fbb85c95ea1 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_3581_12.cpp | #include <bits/stdc++.h>
using namespace std;
int n, q, a[300005], r[300005];
struct bit {
int tree[300005];
void add(int x, int v) {
while (x <= n) {
tree[x] += v;
x += x & -x;
}
}
int sum(int x) {
int ret = 0;
while (x) {
ret += tree[x];
x -= x & -x;
}
return re... | ALGO | 0.999967 | 4.145566 |
1991eeed-a6db-49f7-9f14-202e38b99911 | KhoiBui16/Fullhouse_Code_Online | C/Source code/Buoi_01/Bai5.cpp | //1.5
//c1
#include <stdio.h>
#include <math.h>
int main(){
int n;
scanf("%d",&n);
printf("%d",abs(n));
return 0;
}
//c2
#include <stdio.h>
int main(){
int n;
scanf("%d",&n);
if (n < 0) n *= -1;
printf("%d",n);
return 0;
}
//c3
#include <stdio.h>
int main(){
int n;
scanf("%d",&n);
int x = n > 0 ? n : -... | ALGO | 0.999905 | 3.763028 |
78748776-8fdb-4e19-91ca-7f8bd4fa72d8 | priya2006/Algorithms | CP/Kruskal1.cpp | #include<bits/stdc++.h>
using namespace std;
bool cmp(pair<pair<int,int>,int>&p,pair<pair<int,int>,int>&p1)
{
return p.second <p1.second;
}
int checkparent(int x,int *parentarray)
{
if(parentarray[x]==x)
{
return x;
}
return checkparent(parentarray[x],parentarray);
}
int main()
{
int n,e,a,... | ALGO | 0.999996 | 3.878446 |
c6e8d84a-4e36-43ad-af9a-ab254a82208d | hoangpc0112/dsa-ptit | Hàng đợi/DSA08004 - GIÁ TRỊ NHỎ NHẤT CỦA XÂU.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (auto i = (a); i <= (b); ++i)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define sz(x) (int)(x).size()
#define pb push_back
#define ppb pop_back
#define endl '\n'
#define fi first
#define se second
#ifdef Juhan404
#include "debug.h"
#e... | ALGO | 0.999689 | 4.369468 |
8d8e50eb-1864-46aa-a36d-67863f98db19 | nikhilsoniii/-Ram-Ram-Bhai-Sareya-Ne-With-Frienducation--Nikhil- | 10_Candy.cpp | class Solution {
public:
int candy(vector<int>& ratings) {
int n= ratings.size();
vector<int> candies(n, 1);
for(int i=1; i<n; i++){
if(ratings[i]>ratings[i-1]){
candies[i]= candies[i-1]+1;
}
}
for(int i=n-2; i>=0; i--){
i... | ALGO | 0.999993 | 6.353982 |
8393d033-44d1-41bb-9a8d-df0b4dcfb65c | Aman31srivastava/leetcode | 2679-count-distinct-numbers-on-board/2679-count-distinct-numbers-on-board.cpp | class Solution {
public:
int distinctIntegers(int n) {
int i;
if(n==1){
return 1;
}
return n-1;
}
}; | ALGO | 0.999343 | 5.584895 |
7e115666-ae93-4c85-b5ee-06cdd080bb4a | sa-y-an/leetAction | solutions/problems/n-ary_tree_preorder_traversal/solution.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val) {
val = _val;
}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
vector <int> ans;
public:
... | ALGO | 0.99996 | 6.020465 |
272cfa67-e29b-44a1-8e9f-38081a0f2c0b | DVMirchev/PlanetExplorer | Explorer.cpp | // Explorer.cpp: implementation of the CExplorer class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PlanerExplorer.h"
#include "Explorer.h"
#include "World.h"
#include "math.h"
#include <array>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE... | ALGO | 0.885662 | 4.99105 |
6988f2a4-f19b-49f1-87b6-59122df07a92 | antin2NH/10Tin2Project | Newbies/Chap3/195pnhistory.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, x;
cin >> n;
for (long long i = 1; i <= n; i++) {
cin >> x;
if (x<2000) {
cout << "YES";
return 0;
}
}
cout << "NO";
} | ALGO | 0.996464 | 4.023379 |
69077e3e-b02e-43c3-aca4-f756a48b976b | CKCat/android2.3.3 | development/simulator/app/Semaphore.cpp | #if defined(HAVE_MACOSX_IPC)
# include <semaphore.h>
#elif defined(HAVE_SYSV_IPC)
# include <sys/types.h>
# include <sys/ipc.h>
# include <sys/sem.h>
#elif defined(HAVE_WIN32_IPC)
# include <windows.h>
#elif defined(HAVE_ANDROID_IPC)
// not yet
#else
# error "unknown sem config"
#endif
#include <utils/Log.h>
#include... | TOOL | 0.91383 | 6.557431 |
85f336c4-9bc2-47c6-9eb4-7f5f47bdfbcb | lord-cyclone100/Cpp-programs | mega-assignment/9.cpp | /*Write a menu driven program in C or C++ to implement a stack using single linked list and
perform the following operations.
(a) isEmpty() is to check whether the stack is empty or not.
(b) push() is to insert an item in the stack.
(c) pop() is to delete an item from the stack.
(d) display() is to show the entire stac... | ALGO | 0.996831 | 4.9893 |
5dc1995e-86a4-479f-8772-a4cb73b96637 | chiseungii/Algorithm_Study | JUNGOL/Beginner/#2813 소수의 개수/소수의 개수.cpp | #include <iostream>
#include <vector>
using namespace std;
#define MAX_NUM 3000000
int main() {
// 에라토스테네스의 체
vector<bool> isPrime(MAX_NUM+1, true);
isPrime[1] = false;
for(int i=4; i<=MAX_NUM; i+=2) isPrime[i] = false;
for(int i=3; i<=MAX_NUM; i+=2){
if(isPrime[i]){
for(int j=i*2; j<=MAX_NUM; j+=i)
is... | ALGO | 0.999907 | 4.540432 |
704ba8a1-1d9b-43d6-9ac0-37ffbb67e539 | bfeng/CryptoGRU | third_party/cryptoTools/thirdparty/linux/boost/libs/graph/example/boost_web_graph.cpp | template <class Distance>
class calc_distance_visitor : public boost::bfs_visitor<>
{
public:
calc_distance_visitor(Distance d) : distance(d) { }
template <class Graph>
void tree_edge(typename boost::graph_traits<Graph>::edge_descriptor e,
Graph& g)
{
typename boost::graph_traits<Graph>::v... | ALGO | 0.999492 | 4.907742 |
36864c0b-edcb-42c7-b179-a8344d605f9d | Vaneryn/6004cem-parallel | openmp/openmp_partc_matrix.cpp | #include <iomanip>
#include <iostream>
#include <omp.h>
#include <random>
#include <string>
#include <vector>
using Matrix = std::vector<std::vector<int>>;
/**
* @brief Prints a formatted table header with fixed column widths.
*
* @param headers A vector of column header title strings.
* @param widths A vector o... | TOOL | 0.997088 | 4.702785 |
2f0a824c-c0a8-4cd8-a82a-13ba2eafc5d1 | mayankdrvr/leetcode_cpp_solutions_collection_leethub | 72-edit-distance/72-edit-distance.cpp | class Solution {
public:
int minDistance(string word1, string word2) {
int m = word1.length();
int n = word2.length();
int dp[m + 1][n + 1];
for (int i = 0; i <= m; i++) {
for (int j = 0; j <= n; j++) {
if (i == 0)
dp[i][j] = j... | ALGO | 0.999998 | 5.927432 |
af086122-50bb-45b4-8e7e-b09659e719fe | AbdullahRFA/3-1_All_Resources | Computer Graphics Lab/Graphics Lab-6/362/liang-barsky.cpp | #include<bits/stdc++.h>
#include<graphics.h>
using namespace std;
int xmin, xmax, ymin, ymax;
// Function for Liang-Barsky line clipping
void liangBarskyClipping(int x1, int y1, int x2, int y2)
{
//setcolor(RED);
int dx = x2 - x1;
int dy = y2 - y1;
float p[4] = {-dx, dx, -dy, dy};
float q[4] = {x... | ALGO | 0.998679 | 3.187946 |
8aeaf886-acac-4ccf-bf97-3cdaa0ad19a6 | woopengcheng/LibCore | deps/RakNet/DependentExtensions/cat/src/codec/RangeCoder.cpp | #include <cat/codec/RangeCoder.hpp>
#include <cat/hash/MurmurHash2.hpp>
#include <cat/port/EndianNeutral.hpp>
#include <cmath>
#include <cstring>
using namespace cat;
using namespace std;
const u64 Top = (u64)1 << 56;
const u64 MaxRange = (u64)1 << 48;
#define SYMBOL_LUT_BITS 8
#define SYMBOL_LUT_SHIFT (16 - SYMBOL_L... | ALGO | 0.959134 | 7.236486 |
9be8a929-b670-4a3f-8a11-c126d8f8f59c | boj-dgsw/ps | hekaline/boj/cpp/purchase_cards_2-16194.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> memo(n);
for (int i = 0; i < n; i++)
{
cin >> memo[i];
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j <= i; j++)
{
memo[i] = min(memo[i], memo[j] + memo[i - j - 1]);
}
}
cout << me... | ALGO | 0.999962 | 3.915672 |
4274d619-83d8-446f-a944-dd0023a05863 | Samsung/ONE | compiler/record-minmax/src/MinMaxComputer.cpp | #include "MinMaxComputer.h"
#include "RecordFunction.h"
#include <luci/IR/CircleQuantParam.h>
namespace record_minmax
{
void PercentileComputer::update_qparam(
const std::unordered_map<const luci::CircleNode *, MinMaxVectors> *minmax_map)
{
if (minmax_map == nullptr)
throw std::invalid_argument("minmax_map i... | TOOL | 0.971263 | 7.016441 |
ae7a6256-36a9-4266-ab2a-a6023036dc53 | AndreyKoshlan/Programming | Practice/30/C++/C++.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <Windows.h>
using std::vector;
using std::ostream;
using std::string;
enum IT {
COIN, RUNE, WEAPON, ARMOR
};
enum ET {
FIRE, WATER, EARTH, AIR
};
union CT {
struct {
int count;
} Coin;
struct {
int level;
enum ET elem... | TOOL | 0.89119 | 3.827602 |
edd23ff8-0191-4f15-860a-2517c642b544 | BonedDeng/wangdao-datastructures | 线性表/链式实现大题/P40.2.cpp | #include <iostream>
#include <vector>
using namespace std;
//P40.2
//在带头结点的单链表中, 删除所有值为x的结点, 并释放其空间, 假设值为x的结点
//不唯一, 试编写算法以实现上述操作
#define ElemType int
#define _for(i,a,b) for(int i=(a);i<(b);i++)
#pragma region 建立带头结点的链表
typedef struct LNode {
ElemType data;
struct LNode* next;
}LNode, * LinkList;
//初始化链表
bool I... | ALGO | 0.999779 | 4.110965 |
43c07cdf-6eef-4577-be81-2d64a2f9552d | danieltrt/SBFL | results/py/LARGEST_SUBSEQUENCE_GCD_GREATER_1.cpp | int f_filled ( int arr [ ] , int n ) {
int ans = 0 ;
int maxele = max ( arr ) ;
for ( int i = 2 ;
i <= maxele ;
i ++ ) {
int count = 0 ;
for ( int j = 0 ;
j < n ;
j ++ ) {
if ( ( arr [ j ] % i == 0 ) && ( arr [ j ] % i == 0 ) ) count ++ ;
}
ans = max ( ans , count ) ;
}
retur... | ALGO | 0.999757 | 3.489497 |
670300bf-f585-401b-a68a-3cba9b7741db | jeete121/Coding | Programs/Practice/Prac/GraphAlgorithms/ditribute_candies_to_people.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> distributeCandies(int candies, int num_people)
{
vector<int> res(num_people);
for (int i = 0; candies > 0; candies -= i)
{
res[i % num_people] += min(i + 1, candies);
i++;
}
return res;
}
int main()
{
int candies = 7, nu... | ALGO | 0.999969 | 4.787054 |
c658fc29-2dfb-4a36-80fe-3fb0ee64c68a | physxz/cpp_heima | 05_advanced/78_stl_algorithm_count_if.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
// 常用查找算法 count_if
// 1.统计内置数据类型
class Greater20
{
public:
bool operator()(int &val)
{
return val > 20;
}
};
void test01()
{
vector<int> v;
v.push_back(10);
v.push_back(40);
v.push_ba... | ALGO | 0.998029 | 4.486866 |
b9af0009-b631-4877-980a-dd439e1e7116 | Zimse12345/Code | Other/AI1.cpp | // Author:Zimse Data:2024-03-
#include <bits/stdc++.h>
#define pc putchar
#define inv fpow
namespace OI{const int INF=1.001e9,Mod=998244353;int read(){int x=0
,y=1;char c=getchar();while(c<48||57<c){if(c==45)y=-1;c=getchar();}
while(47<c&&c<58)x=x*10+c-48,c=getchar();return x*y;}void wr(int x)
{if(x<0)pc(45),x=-x;if(x... | ALGO | 0.999557 | 3.525035 |
07ae0ab5-1312-487f-8f07-cb5e34abc940 | Silicon-Intelligence0808/duix.ai | duix-android/dh_aigc_android/duix-sdk/src/main/cpp/include/eigen3/bench/benchmarkSlice.cpp | // g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef REPEAT
#define REPEAT 10000
#endif
#ifndef SCALAR
#define SCALAR float
#endif
int main(int argc, char *argv[])
{
typedef Matrix<SCALAR, Eigen::Dynam... | TOOL | 0.857757 | 3.695716 |
7d0d0054-3efc-4fa9-a70a-f03185d87b5b | irejra09/Data-Structures-and-Algorithms | Recursion/quick-sort-using-recursion.cpp | #include <iostream>
using namespace std;
int partition(int *input,int si , int end)
{
int count = 0;
int i = si;
int j = end;
int pe = input[si];
for(int i = si+1;i<=end;i++)
{
if(input[i]<=pe)
{
count+=1;
}
}
swap(input[si],input[si+count]);
while(i<(si+count)&&j>(si+count))
{
... | ALGO | 0.999974 | 5.481498 |
4c083bb7-24c7-4b6d-90c7-addd8b712297 | BertonYang18/BARN-monkey | mmcv/ops/csrc/pytorch/cpu/points_in_boxes.cpp | #include "pytorch_cpp_helper.hpp"
inline void lidar_to_local_coords_cpu(float shift_x, float shift_y, float rz,
float &local_x, float &local_y) {
float cosa = cos(-rz), sina = sin(-rz);
local_x = shift_x * cosa + shift_y * (-sina);
local_y = shift_x * sina + shift_y * cosa;
... | ALGO | 0.98374 | 6.334296 |
3206a9ca-a65e-413f-8cc5-388d150e864c | intfloat/AlgoSolutions | codeforces/CF326/DuffBeach.cpp | #include <bits/stdc++.h>
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const ll MOD = (ll)(1e9 + 7);
vector<int> tmp;
int main() {
int n, k;
ll l;
cin >> n >> l >> k;
vector<int> arr(n);
FOR(i, n) scanf("%d", &arr[i]);
t... | ALGO | 0.99998 | 3.340168 |
d9965f64-68c9-44f8-b515-e75d526a2060 | huangmxsysu/leetcode | leetcode_69. Sqrt(x)_数学_0.0%.cpp | class Solution {
public:
int mySqrt(int x) {
if( x == 0 || x == 1 ) return x;
int e = 1;
while( x >= 0 ){
x -= e;
e += 2;
}
if( x == 0 ) return e/2;
else return e/2 - 1;
}
}; | ALGO | 0.999917 | 5.083558 |
b9e77fff-ccfb-4b90-826d-34394b9f1865 | wnstjd9288/PS | Solved.ac/Class_01/숫자의 개수/숫자의 개수.cpp | #include <stdio.h>
int main()
{
int num[10] = {
0,
};
int a, b, c;
int x;
scanf("%d %d %d", &a, &b, &c);
x = a * b * c;
while (x != 0)
{
num[x % 10]++;
x /= 10;
}
for (int i = 0; i < 10; i++)
printf("%d\n", num[i]);
return 0;
} | ALGO | 0.999553 | 4.228738 |
c0c7141e-f520-4142-bd89-750e92376e2b | Kiruba-Prakasan/flutter | FlutterProjects-main/weather_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998792 | 6.763549 |
f4a04af5-a8c8-4498-acf7-28e5499e24cf | BLUEMOON233/code-deprecated | competition/cpp/codeforces/Codeforces_Round_944_div.4/A_My_First_Sorting_Problem.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
#define rep(i, j, k) for (int i = int(j); i <= int(k); i++)
#define per(i, j, k) for (int i = int(j); i >= int(k); i--)
void solve() {
int x, y;
cin >> x >> y;
if(x > y) swap(x, y);
cout << x << ' ' << y << ... | ALGO | 0.999743 | 4.834337 |
59dc9238-d71c-433b-b47d-0b27c59b87fc | svatostop/anthrax-ai | engine/libs/assimp/code/PostProcessing/ImproveCacheLocality.cpp | /** @file Implementation of the post processing step to improve the cache locality of a mesh.
* <br>
* The algorithm is roughly basing on this paper:
* http://www.cs.princeton.edu/gfx/pubs/Sander_2007_%3ETR/tipsy.pdf
* .. although overdraw reduction isn't implemented yet ...
*/
// internal headers
#include "Pos... | ALGO | 0.993442 | 6.329373 |
584199a1-b76f-4217-9e8d-96b5c129ed3f | tanvirtareq/codeforces | 1353C.cpp | #include<bits/stdc++.h>
#define ll long long
#define dbg(a) cout<<#a<<"= "<<a<<endl
#define vl vector<ll>
#define pll pair<ll, ll>
#define fast ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0)
using namespace std;
int main()
{
fast;
int t;
cin>>t;
while(t--)
{
ll n;
... | ALGO | 0.999772 | 4.106901 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.