uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
04fd1178-f1c5-4c52-9f41-5d2140d7d648 | dwhaynes/leetcode-solutions | 658-find-k-closest-elements/2022-09-28 19.59.55 - Accepted - runtime 80ms - memory 31.2MB.cpp | class Solution {
struct cmp {
int x;
cmp(int x): x(x){}
bool operator()(int a, int b){
if(abs(x-a) == abs(x-b)) return a < b;
return abs(x-a) < abs(x-b);
}
};
public:
vector<int> findClosestElements(vector<int>& arr, int k, int x) {
cmp c(x);
... | ALGO | 0.999999 | 5.290386 |
e07a3b8e-a228-491b-b966-c744ab1c93f4 | aniketsantra25/DSA | DSA/ReplaceSpaces.cpp | #include <bits/stdc++.h>
string replaceSpaces(string &str){
// Write your code here.
string res = "";
for(int i=0;i<str.length();i++){
if(str[i]==' '){
res.push_back('@');
res.push_back('4');
res.push_back('0');
}
else{
res.push_back(str[... | ALGO | 0.999398 | 5.369805 |
16f42f0d-4e65-465a-962e-2a580f3b3e6f | Alfeim/njuee_LeetCode_Solutions | Cpp/Submit Records/436. Find Right Interval.cpp | /********************************************
作者:Alfeim
题目:寻找右区间
时间消耗:160ms
解题思路:利用map自动排序
********************************************/
class Solution {
public:
struct
vector<int> findRightInterval(vector<vector<int>>& intervals) {
map<int,int> record;
vector<int> res;
int n = intervals... | ALGO | 0.999994 | 5.877184 |
a28426af-5d3f-46f4-8e2b-66cd477bf678 | MaxHotiuk/C- | module/033.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main()
{
int n;
int count = 0;
cout << "Input n: ";
cin >> n;
double **arr = new double*[n];
for(int x = 0; x < n; x++)
{
arr[x] = new double[n];
}
for (size_t i = 0; i < n; i++)
{
for (size_t j = 0... | ALGO | 0.999651 | 3.32001 |
fa6f6985-9179-4322-b809-620a7a8723c2 | MOON-CLJ/learning_cpp | algorithm/solution_1.3.40.cpp | #include <iostream>
#include "stack.h"
void printStack(stack<std::string>& s) {
Node<std::string>* curr = s.getFirst();
while (curr) {
std::cout << curr->val << " ";
curr = curr->next;
}
std::cout << std::endl;
}
int main() {
std::string val;
stack<std::string> s;
Node<std:... | ALGO | 0.999718 | 5.416044 |
29f0371f-287b-4163-be25-2a1e08b459a0 | kiheyunkim/senierproject-ChessServer | MainServer/MainServer/Encryption.cpp | #include"stdafx.h"
#include <cstring>
#include "Encryption.h"
const Encryption::UINT32 Encryption::sha256Key[64] =
{ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c... | ALGO | 0.999536 | 5.854593 |
783fe0b7-7bbc-4dd3-9405-ddbec17666e5 | zhangzxjzxj/Bridge-Program | Week3/HWSubmission/ces440_hw3_q1.cpp | /*
Author: Courtney E. Scott
Date: 09/22/2017
Task: Write two versions of a program that reads a positive integer n, and prints the first n even
numbers.
a) In the first, use a while loop.
b) In the second, use a for loop.
*/
#include <iostream>
using namespace std;
int main() {
int inputVal, tick, outpu... | ALGO | 0.999081 | 4.487973 |
4479de33-0dcb-4440-a7d4-b92d6e1bf160 | MAX-926/DataStructure | ch9/exercise/23..cpp | //使用车厢重排的第二个策略,在每次移到一个车厢时,即显示缓冲轨道的状态
//Queue_way
#include"../case/9-1.h"
#include"../../Tool.h"
//循环队列
template<class T>
class arrayQueue:public queue<T>
{
public:
//constructor, copy-constructor and destructor
arrayQueue(int initialCapacity = 10)
{
if(initialCapacity < 1)
... | ALGO | 0.999893 | 4.268087 |
296fc459-1582-42b1-be29-a2bf4b67a1c3 | QuasimodoJL/Unix | CPP Review/C++P+/stock2/usestock2.cpp | //
// Created by 梁佳皓 on 2018/7/5.
//
//
#include <iostream>
#include "stock2.h"
const int STKS = 4;
int main()
{
using std::cout;
using std::ios_base;
Stock stocks[STKS] = {
Stock("NanoSmart", 12, 20.0),
Stock("Boffo Objects", 200, 2.0),
Stock("Monolithic Obelisks", 130... | ALGO | 0.979543 | 4.034291 |
147e654a-f9ed-4d76-9fe2-1883245f1470 | sizhuo-zhang/boost_1_62_0 | libs/geometry/example/c04_a_custom_triangle_example.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
#include <iostream>
#include <boost/array.hpp>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/centroid.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/ring.hpp>
#include <boost... | TOOL | 0.996604 | 7.904403 |
4894b28e-c019-4ddb-96f2-3b741a9ad09f | alexandraback/datacollection | solutions_5753053697277952_0/C++/Miseri/A.cpp | #include <bits/stdc++.h>
using namespace std;
// Constants and macros
#define INF (int)1e9
#define EPS 1e-9
#define bitcount __builtin_popcount
#define gcd __gcd
#define forall(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define MAX(a,b) ( (a)>(b) ? (a):(b))
#define MIN(a,b) ( (a)<... | ALGO | 0.99913 | 3.426013 |
f876fbfc-3fbc-4d3d-973a-ba9fde52c413 | Vishwabvs/Algorithms | Sorting/3MergeSort.cpp | //Given an array, sort the array using merge sort
//Solution
#include<iostream>
using namespace std;
void merge(int *a, int low, int mid, int high)
{
int n1 = mid - low + 1;
int n2 = high - mid;
int arr[n1];
int brr[n2];
for(int i = 0; i < n1; i++)
{
arr[i] = a[low + i];
}
for(i... | ALGO | 0.999993 | 5.133382 |
9ec8fd2e-fc91-47ae-8dad-69f6bfd53b64 | ahmedyasser43/CodingInStyle | 2.AddTwoNumbers/2-Add-Two-Numbers.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* solve(ListN... | ALGO | 0.999941 | 6.284052 |
f20128fb-2987-40c2-b4f6-bc626b1d13e1 | ayushsiloiya619/Threshold-DKN | Best_must_try_2.0/best33.cpp | // Numbered triangle fliped
#include<iostream>
using namespace std;
int main(){
int n;cin>>n;
for(int i=1;i<=n;i++){
//spaces
for(int j=1;j<=n-i;j++){//bade se chota
cout<<" ";
}
//numbers
for(int k=1;k<=i;k++){//chote se bada
cout<<k;
}
... | ALGO | 0.99995 | 4.623186 |
8cf5b8f2-9f70-4f81-a56f-cb44b272a7c6 | qubo188612/mysunny | src/laser_line_center/test/width.cpp | #include "impl/center.hpp"
int main()
{
{
// One pixel
cv::Mat img(1, 20, CV_8U, cv::Scalar(0)), buf;
auto col = img.colRange(10, 11);
col = cv::Scalar(100);
auto pnts = center(img, buf, 1, 35, 2. * (1. + DBL_EPSILON));
assert(pnts[0] == -1);
pnts = center(img, buf, 1, 35, 2.);
asse... | TEST | 0.873479 | 6.330175 |
51983a98-7d1c-49ed-9892-2b4ac56913f9 | BrainDead59/CPCFI | Kattis/Difficulty/[2-3]/GreedilyIncreasingSubsequence.cpp | //Kattis: Greedily Increasing Subsequence
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
int main(){
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int elementos,elemento,maximo=0;
vi B;
cin... | ALGO | 0.999985 | 3.938868 |
f9607a64-2e9e-48ea-8d55-45ee60d471b4 | Dharamvirmuz/C-Cpp-DSA-Assignments | Assignment 23/6.cpp | // Write a C++ program to calculate an average of 3 numbers.
#include<iostream>
using namespace std;
int main()
{
float a,b,c;
float d,e;
cout<<"Enter Three numbers:"<<endl;
cin>>a>>b>>c;
d = a + b + c;
e = d / 3;
cout<<"Average of "<< a << " and "<< b << " and "<< c << " is " << e ... | ALGO | 0.991823 | 4.35916 |
9a83004a-269f-46de-88eb-6174918653ba | naveenls/Competitive-Coding | C++/test563.cpp | #include<bits/stdc++.h>
using namespace std;
int h,w;
const int maxh=1e3;
string arr[maxh];
int val[maxh][maxh];
void dfs(int i,int j,int cnt)
{
if(i>=h || i<0 || j>=w || j<0)
return;
if(arr[i][j]=='#' || val[i][j]!=-1)
return;
// cout<<i<<' '<<j<<' '<<cnt<<endl;
val[i][j]=cnt;
dfs(i+1,j,cnt);
dfs(... | ALGO | 0.999982 | 4.059654 |
5521112f-7681-4481-820b-b37fe68b0986 | JustJie2002/Leetcode | Problem/Medium/P2507/code.cpp | /********************************************
* author : Jie Chen (3rd Year CS)
* school : Rochester Institute of Technology
* created: 03.20.2024 23:08:53
*********************************************/
using i64 = long long;
using Factor = pair<int, int>;
constexpr int MAX_SIEVE = 1e6 + 5;
struct PrimeTable {
... | ALGO | 0.999991 | 6.023801 |
3426cf17-6e4a-4a8d-a5bc-edfa4b3ecf51 | mady4ever/Preparation | revision/questions/write-an-efficient-method-to-check-if-a-number-is-multiple-of-3.cpp | /*
1] if number is multiple of 3 then cound of digits is divisible by 3.
2] count of bits at odd position minus count of digits at even count if result recersively gives one then yes else no.
https://www.geeksforgeeks.org/write-an-efficient-method-to-check-if-a-number-is-multiple-of-3/
*/
#include<bits/stdc++.h>
... | ALGO | 0.999907 | 4.447545 |
ed7c8416-ec3f-45b3-93a5-a9b79056c75c | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/11/1119/personal_submission/cf201b_Bonelight.cpp | /*
Bonelight * v *
20241113:重 走 西 游
千 仇 万 恨 无 归 处, 封 灯 何 须 至 尊 骨
*/
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define INF 2e18
#define pii pair<int,int>
#define tiii tuple<int,int,int>
void solve(){
int n,m; cin >> n >> m;
... | ALGO | 0.999687 | 3.573596 |
87ecc581-8560-4552-9d28-82e16a607204 | thiagofigcosta/URI | 1120.cpp | #include <bits/stdc++.h>
using namespace std;
bool is0(string s){
for(int i=0;i<s.size();i++)
if(s[i]!='0')
return false;
return true;
}
string rmZero(string s){
int idx=-1;
for(int i=0;i<s.size();i++)
if(s[i]!='0'){
idx=i;
break;
}
if(idx>=0){
return s.substr(idx);
}else{
return "0";
}
}
i... | ALGO | 0.992644 | 3.553291 |
dc5127d8-f845-4870-81c7-eef6ef7476bb | vusec/stickytags | llvm-project/libcxx/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp | // <algorithm>
// template<InputIterator Iter1, InputIterator Iter2,
// Predicate<auto, Iter1::value_type, Iter2::value_type> Pred>
// requires CopyConstructible<Pred>
// constexpr pair<Iter1, Iter2> // constexpr after c++17
// mismatch(Iter1 first1, Iter1 last1, Iter2 first2, Pred pred);
//
// templa... | TEST | 0.867728 | 6.432628 |
bf7641b7-036a-4b4c-852a-c0a23cfb86e7 | nikhilij/data-structure-apna-college | ds/PredecessorAndSuccessor.cpp | // write the cpp program to compute the predecessor and successor of a given node in a binary search tree
#include<iostream>
#include <vector>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
Node(int val) {
data = val;
left = NULL;
right = NULL;
... | ALGO | 0.999999 | 6.063039 |
bc53efaa-46b3-4259-a8ae-8f70f2239efa | voldigoad-7/leetcode-gfg-solutions | 1451-rearrange-words-in-a-sentence/1451-rearrange-words-in-a-sentence.cpp | class Solution {
public:
string arrangeWords(string text) {
text[0]+=('a'-'A');
vector<pair<string,int>>pv;
int index=0;
string ans="";
stringstream ss(text);
string word;
while(ss>>word) pv.emplace_back(word,index++);
sort(pv.begin(), pv.end(), [](aut... | ALGO | 0.999908 | 5.184553 |
6e55b7a7-5253-49ff-8a2c-a11c8b48ef23 | imharsh94/ALGO-DS | ll18.cpp | // n th node from end limked list
#include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
struct Node *next;
};
void push(Node **head,int data)
{
struct Node *new_node = (struct Node*)malloc(sizeof(struct Node));
new_node->data = data;
new_node->next = (*head);
(*head) = new_node;
... | ALGO | 0.999887 | 3.276793 |
3c16618a-15e9-4265-911b-b37a20d7095c | rashmi-992/PracticeCode | size_of_variable.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
template <typename T>
// } Driver Code Ends
// Refer Template in C++ track for more details
// on template
int sizeOfValue(T value){
// You are given a variable value
// of unknown type.
// find the s... | ALGO | 0.992873 | 4.376677 |
7d586a6b-02e9-4b53-b25d-47eff19203b6 | Ryotaro25/leet_code | 1~100/15.3Sum/two_pointers.cpp | class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
sort(nums.begin(), nums.end());
vector<vector<int>> triplet;
for (int i = 0; i < nums.size(); i++) {
if (nums[i] > 0) {
continue;
}
if (i == 0) {
FindPair(nums, i, triplet);
continue;
... | ALGO | 0.99994 | 6.315307 |
de486944-41a4-4db2-971f-1097d52c16be | ishandutta2007/codeforces | se1ka2/normal/1381/B.cpp | #include <iostream>
using namespace std;
bool dp[4002][4002];
int main()
{
int t;
cin >> t;
while(t--){
int n;
cin >> n;
int p[4005];
for(int i = 0; i < n * 2; i++) cin >> p[i];
int d[4005];
int l = p[0];
int c = 1;
int k = 0;
for(int... | ALGO | 0.999982 | 4.013722 |
95f9a378-e97b-49ac-b4a3-ac325c030811 | jefersonvinicius/programming-problems-solutions | beecrowd/graph/1317.cpp | #include "assert.h"
#include <string>
#include <vector>
#include <unordered_map>
#include <queue>
#define MAX_PERSON 25
#define MAX_SPAM_ATTRIBUTE_LENGTH 23
#define MAX_PERSON_NAME_LENGTH 23
using namespace std;
class Spam {
public:
int initialThreshold, finalThreshold, personIdStart;
vector<stri... | ALGO | 0.998887 | 4.238935 |
92a43ed7-f0d8-4903-9fb1-2eb14be88050 | virajgudhetwar/CPP-DSA-Code-Library | 18.BinarySearchTree/05Two_Sum.cpp | //To find whether the sum of any two nodes is equal to the target or not
#include <bits/stdc++.h>
// Following is the Binary Tree node structure
/**************
class BinaryTreeNode {
public :
T data;
BinaryTreeNode<T> *left;
BinaryTreeNode<T> *right;
BinaryTreeNode(T data) {
this -> dat... | ALGO | 0.999997 | 6.502468 |
42ea53ba-26fb-43ab-be8a-db4c21f41c2d | austinwklein/cs201 | Lab/Lab06/Lab06b/main.cpp | // Boilerplate
/*
* Austin Klein
* CS 201
* 2/01/2021
* Lab 6b
* LAB TOPIC
*/
// Description:
/* Rewrite your function so that, instead of printing the length of the given string, it prints a line of “#”
* characters, where the number of characters is equal to the length of the string. So if your function is
*... | ALGO | 0.984759 | 5.103901 |
0d38bb63-a63d-455e-9a1b-58573efe23c3 | SHY-Corp/LeetCode-Solutions | C++/1310. XORQueriesOfASubarray.cpp | /*
PROBLEM - 1310. XOR Queries of a Subarray
DESCRIPTION -
Given the array arr of positive integers and the array queries where
queries[i] = [Li, Ri], for each query i compute the XOR of elements from
Li to Ri (that is, arr[Li] xor arr[Li+1] xor ... xor arr[Ri] ).
Return an array containing the result for the given q... | ALGO | 0.999992 | 6.148192 |
baf161d9-99c5-4339-8fcd-b3288598bb7b | twindb/twindb-xtrabackup-80 | boost_1_68_0/libs/graph/example/remove_edge_if_dir.cpp | #include <boost/config.hpp>
#include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
/*
Sample output:
original graph:
0 --> 3 2 3
1 --> 3
2 --> 0
3 --> 2
removing edges (0,3)
0 --> 2
1 --> 3
2 --> 0
3 --> 2
removing edge (0,2) and (3, 2)
... | ALGO | 0.969854 | 6.731273 |
074ddba3-a224-4645-8f57-314968793c02 | Ruchit-rt/fgpa_hardware_accelerateNN | dependencies/opencv-4.5.3/modules/calib3d/src/solvepnp.cpp | #include "precomp.hpp"
//#include "upnp.h"
#include "dls.h"
#include "epnp.h"
#include "p3p.h"
#include "ap3p.h"
#include "ippe.hpp"
#include "sqpnp.hpp"
#include "calib3d_c_api.h"
#include "usac.hpp"
#include <opencv2/core/utils/logger.hpp>
namespace cv
{
#if defined _DEBUG || defined CV_STATIC_ANALYSIS
static bool... | ALGO | 0.973247 | 6.162909 |
72f90c85-d279-42f5-bdec-fd3d48bb1879 | marmikshah/leetcode | 2.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
/**
* Ref: https://leetcode.com/problems/add-two-numbers/
* Problem Statement
* You are given two non-empty linked lists representing two non-negative
* integers. The digits are stored in reverse order, and each of their nodes
* contains a single digi... | ALGO | 0.999944 | 7.104353 |
9bbcf2c5-a843-4fdb-88ef-d695011d32d8 | dansonZhang/ZZX_RUN | navigation/base_local_planner/src/goal_functions.cpp | #include <base_local_planner/goal_functions.h>
#include <tf2/LinearMath/Matrix3x3.h>
#include <tf2/utils.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#ifdef _MSC_VER
#define GOAL_ATTRIBUTE_UNUSED
#else
#define GOAL_ATTRIBUTE_UNUSED __attribute__ ((unused))
#endif
namespace base_local_planner {
double getGoal... | TOOL | 0.994559 | 6.036627 |
dddb3aa2-2984-4130-b090-7023d1153d0c | ALiAkbaar35/CPP_Assignments | Solutions/lcm&hcm(8.4).cpp | #include<iostream>
#include <numeric>
using namespace std;
int main()
{
int num1, num2,hcf,lcm;
cout<<"Enter two numbers: ";
cin>>num1>>num2;
if(num1>0 && num2>0)
{
for(int i=1; i<=num1 && i <= num2;i++)
{
if(num1%i==0 && num2%i==0)
{
hcf=i;
}
}
lcm = (num1 * num2) / hcf;
... | ALGO | 0.999303 | 3.551386 |
d2f4a926-629d-4955-bb37-b55aee2b12b6 | s0metimes/aligothm | week9/16465_Bookend/16465_Bookend_youngwoo.cpp | #include <stdio.h>
int main(int argc, char const *argv[])
{
// n : 책의 개수 정수 n (1 ≤ n ≤ 100)
// m : 책장의 너비 정수 m (1 ≤ m ≤ 300)
// l : 북엔드의 바닥 면의 길이 정수 l (1 ≤ l ≤ 300)
// xi : 각 책의 너비인 정수 (1 ≤ xi ≤ 3)가 왼쪽 책부터 차례대로 n개 주어진다.
int n, m, l;
int sum = 0, xi;
scanf("%d %d %d", &n, &m, &l);
for... | ALGO | 0.999833 | 3.444527 |
2529ba2b-c27b-47a1-87d2-7710405ddd58 | whjkm/Csp-Code | 2014/201403-1/main.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main()
{
int n;
int a[505];
int count;
while(scanf("%d",&n)!=EOF)
{
count = 0;
for(int i=0; i<n; i++)
{
scanf("%d",&a[i]);
}
for(i... | ALGO | 0.999558 | 3.821223 |
84d42775-1921-4e27-ace7-b338b8a1dcd9 | suraj2530/TAOCP | 05C++/ex1_6.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
int main(int argc, char *argv[])
{
int initialDivisor = 5;
int totalIterations = 0;
for (int i = 1; i <= initialDivisor; i++) {
int dividend = i;
int divisor = initialDivisor;
int iterationsToSolveItCnt = 0;
... | ALGO | 0.999528 | 4.146851 |
3b2686a4-d372-4a91-b631-c681b3a55afd | manikanta2901/ubuntu | .history/SRM/elab/OOPS/OperatorOverloading/playWithFraction_20200907132632.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
class Fraction{
public:
int a,b,c,d;
void read(){
cin >> a >> b >> c >> d;
}
void operator +(Fraction &){
a = a * c;
b = b * d;
}
void print(){
cout << a <... | ALGO | 0.999693 | 4.120646 |
374e5fc8-356c-4c2c-a903-ea285164b440 | Adityagupta1625/450-DSA-Questions | string/p24.cpp | // Given a string of characters, find the length of the longest proper prefix which is also a proper suffix.
// Example 1:
// Input: s = "abab"
// Output: 2
// Explanation: "ab" is the longest proper prefix and suffix.
// question link: https://practice.geeksforgeeks.org/problems/longest-prefix-suffix2527/1#
#inclu... | ALGO | 0.999653 | 6.259578 |
86ce288c-0e8f-4c79-afaf-807ed7c79ef1 | yeyuzhen/EasonCodeShare | ProfessionalCpp2e/c22_code/atomic/inc_func_non_atomic.cpp | #include <iostream>
#include <vector>
#include <thread>
#include <functional>
void func(int& counter)
{
for (int i = 0; i < 10000; ++i) {
++counter;
}
}
int main()
{
int counter = 0;
std::vector<std::thread> threads;
for (int i = 0; i < 10; ++i) {
threads.push_back(std::thread{func, std::ref(counter)});
}
... | TOOL | 0.953572 | 5.81881 |
f29e8133-6861-47d9-aa85-1f5c5c5b19e9 | snehah7/Cpp-for-Game-Developers | Module 3/C++GameDevelopmentCookbook_Code/Chapter9/Source/Box2D/Contributions/Platforms/Box2D.Net/ManifoldPoint.cpp | #pragma once
#include "stdafx.h"
#include "Vector.cpp"
namespace Box2D
{
namespace Net
{
//TODO: is this class really necessary for the public interface?
public ref class ManifoldPoint
{
internal:
b2ManifoldPoint *point;
ManifoldPoint(b2ManifoldPoint *pointRef) : point(pointRef) { }
public:
prop... | TOOL | 0.858541 | 6.265174 |
ab9b3acf-28b7-4213-805c-09aa06411c6b | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/stramosi/lant/train/75089787-b110-45a0-9c2c-f50e01ca1888.cpp | #include <fstream>
#include <vector>
using namespace std;
ifstream fin("stramosi.in");
ofstream fout("stramosi.out");
struct nod{
int index;
vector<int> sons;
}v[250003];
struct wee{
int poz, p;
};
vector<wee> q[250003];
int sol[300003], n, m;
bool ... | ALGO | 0.999977 | 4.096588 |
86e4df53-1669-4861-9e55-14af78bd0f5c | MakeContributions/DSA | algorithms/CPlusPlus/Trees/in-order-morris-traversal.cpp | /**
* Conduct a morris in-order traversal of a binary tree,
* printing out the value at each node according to
* the traversal using user defined inputs.
* Node.val can take any number except -1
**/
# include <iostream>
# include <vector>
using namespace std;
// Basic tree definition
struct Node {
int val;
... | ALGO | 0.999994 | 6.157044 |
a368f315-7a23-4e9a-80af-697b906d92f4 | ducphanduyagentp/vbox-svn | src/VBox/Additions/3D/mesa/mesa-21.3.8/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp | /****************************************************************************
* Copyright (C) 2014-2018 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the... | ALGO | 0.922631 | 7.049687 |
a882d746-dd80-4b56-9451-f5296a15636f | jokerwyt/Gem5 | src/systemc/tests/systemc/misc/unit/data/datawidth_bool_to_signed/extension/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.9623 | 5.61622 |
94e61d1b-5d77-48be-80d5-383cb45b47f9 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_11814_119.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int m, n;
cin >> m >> n;
cout << (m * n) / 4;
}
| ALGO | 0.999587 | 3.283619 |
5a2ee0d2-e8b0-4775-aa44-312a5851809c | ishandutta2007/codeforces | lytqwq/normal/1322/A.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1000010;
char a[N];
int n,f[N];
/*
*/
int main(){
scanf("%d",&n);
scanf("%s",a+1);
int res=0,lastok=0,befok=1;
for(int i=1;i<=n;i++){
if(a[i]=='(')res++;
else res--;
if(res<0){
befok=0;
}
if(res==0){
if(befok){
f[i]=f[lastok];
}
else... | ALGO | 0.999912 | 3.623035 |
9ab77e9d-38a7-4041-be2f-6dd0ee77b1f5 | hampusekedahl/ChatGPT_Experiment_Extended | C++/GPT-4/Binary Search/Easy/Runtime and Memory/268. Missing Number/1.cpp | #include <vector>
using namespace std;
class Solution {
public:
int missingNumber(vector<int>& nums) {
int missing = nums.size();
for (int i = 0; i < nums.size(); ++i) {
missing ^= i ^ nums[i];
}
return missing;
}
};
| ALGO | 0.999712 | 5.738091 |
677dfa15-fead-4390-9641-d74d8b51ce6a | wr786/Key-to-PKUPC | src/附加题:1064 滑雪.cpp | include <cstdio>
#include <iostream>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cmath>
#include <cctype>
using namespace std;
#pragma GCC optimize(2)
#pragma warning(push,4)
#define FOR(i,start,end) for(int i=start; i<=end; i++)
#define FOR2(i,sta... | ALGO | 0.998327 | 3.44636 |
0429cea2-b34b-4cb8-aab3-1b291864fb68 | harshit3154/CipherSchoolPractiseQuestion | c++code/Factorial.cpp | /*
program to calculate the factorial of number.
*/
#include <iostream>
#include <unordered_map>
#include <algorithm>
using namespace std;
long long factorial1(int n){
if(n==0) return 1;
long long fact=1;
int i=1,j=n;
while(i<=j){
if(i!=j){
fact=fact*i*j;
}else{
... | ALGO | 0.99996 | 5.660591 |
d31d311a-1988-4f7a-a249-65be57548ffb | JeffMcClintock/SE2JUCE | SE_DSP_CORE/modules/VaFilters/VAFilters/Interpolator.cpp | #include "Interpolator.h"
CInterpolator::CInterpolator(void)
{
}
CInterpolator::~CInterpolator(void)
{
}
/* L-Point Interpolator
Input: Left and Right Input Samples xnL, xnR
Output: Left and Right Output Buffers with L samples per buffer
This function loops L times, interpolating the outputs and placing them ... | ALGO | 0.855149 | 4.634498 |
1765b1b2-dbb1-44f9-a64d-2b8e573de5db | wangAlpha/leetcode | algorithms/0122.best_time_to_buy_and_sell_stock_ii/best_time_to_buy_and_sell_stock_ii.cpp | class Solution {
public:
int maxProfit(const vector<int>& prices) {
int profit = 0;
int last = prices[0];
for (int i = 1; i < prices.size(); ++i) {
const int diff = prices[i] - last;
profit += max(diff, 0);
last = prices[i];
}
return profit... | ALGO | 0.999464 | 6.556869 |
e6edb3e7-a67a-46a8-a883-9827ff9680b5 | Anshika2022/GFG-POTD | Add Number Linked Lists.cpp | class Solution {
public:
Node* reverseList(struct Node* head) {
//CodeGenius
Node *curr=head, *prev=NULL, *next=curr->next;
while(curr){
next=curr->next;
curr->next=prev;
prev=curr;
curr=next;
}
return prev;
}
Node* ad... | ALGO | 0.999831 | 5.965515 |
d5bbc9dd-f2de-42d9-a0d0-e0412718b66e | Agniva-c11/CPP | insertion_sort.cpp | #include<iostream>
using namespace std;
void insertion_sort(int arr[], int n)
{
for(int i = 0;i<n;i++)
{ int temp = arr[i];
int j = i-1;
for(;j>=0;j--)
{
if (arr[j]>temp)
{
arr[j+1] = arr[j];
}
else
{
... | ALGO | 0.999883 | 4.496178 |
e82e1403-9f44-40e5-909e-2f66647e654d | Prgupta25/DSA | last-stone-weight.cpp | #include<bits/stdc++.h>
using namespace std;
class solution{
public:
int laststoneweight(vector<int>&stones){
priority_queue<int> pq; //max-heap
for(auto i:stones){ //for(auto) means for each element in a loop
pq.push(i);
}
while(pq.size(... | ALGO | 0.99974 | 4.681158 |
5fbdad9c-efcf-4372-b300-86fac896f3c6 | sirAdarsh/CP-files | CodeForces/ECAUG206.cpp | /*----- || Hare Krishna || -----*/
/* "WHY DO WE FALL, BRUCE?" */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define elif else if
#define pb push_back
#define pf push_front
#define PI 3.1415926535897932384
#define MOD 10000000... | ALGO | 0.99985 | 4.964272 |
f0e12bf0-a8ae-4abe-a3c8-1e88803e233f | DimitarSht/Informatics_9B_2024_2025 | Grade_8/Първи срок/Седмица_12_Оператори_06_12_2023/sumAndProduct.cpp | #include<iostream>
using namespace std;
int main()
{
/// <тип_на_променливата> <име_на_променливата> = <стойност>;
/// <тип_на_променливата> <име_на_променливата>;
int a1,a2,a3,a4,a5;
cin>>a1>>a2>>a3>>a4>>a5;
int sum = 10;
sum = a1+a2+a3+a4+a5;
cout<<sum<<endl;
sum = sum + a1+a2+a3+a4+a... | ALGO | 0.999604 | 3.209531 |
b4d353ef-9aec-41d4-b230-2195498b0212 | daahunii/solving_codetree | 250203/Top k 숫자 구하기/kth-number.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int N, k;
int nums[1000];
int main() {
cin >> N >> k;
for (int i = 0; i < N; i++) {
cin >> nums[i];
}
sort(nums, nums+N);
cout << nums[k-1] << endl;
return 0;
}
| ALGO | 0.999988 | 3.962845 |
1385a94f-80c9-4ec9-acb2-b3ddb3d379ff | s0urav6529/Codeforces-Solutions | Longest Path.cpp | #include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define read freopen ("in.txt","r",stdin);
#define out freopen ("out.txt","w",stdout);
#define reset(a,b) memset(a, (b), sizeof(a))
#define sortv(k) sort(k.begin(),k.end())
#define sortg(k) sort(k.begin()... | ALGO | 0.999743 | 4.133693 |
e5bdde5c-4a83-4c8c-821b-61e3a727d497 | ShashankBagda/ICT | Codes/C++/Data Structures using C++/Codes/TK2/Lab/Lab - 04 _ 22th July/P0008.cpp | #include<iostream>
using namespace std;
template <typename T> class Demo
{
public:
T a;
T b;
Demo(T p, T q)
{
a=p;
b=q;
}
void print()
{
cout<<endl<<" a = "<<a<<endl<<" b = "<<b;
}
};
int main()
{
Demo<int> d1(10,20);
d1.print();
Demo<double> d2(10.50,20.60);
d2.print();
Demo<char> d3('... | TOOL | 0.949464 | 4.84795 |
9e57827e-1f19-4539-8749-df538d6e4a7d | Aaaaa988/study | CLionProjects/Ruban/Свёртка через дискретное Фурье/LAb.cpp | #include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
const double Pi = 3.14159265359;
struct Complex
{
double Re;
double Im;
};
void ComplexMult(Complex *a, int k, Complex *b, int k1, Complex *rez)
{
rez->Re = ((a+k)->Re * (b+k1)->Re) - ((a+k)->Im * (b+k1)->Im);
rez->... | ALGO | 0.999944 | 3.158291 |
ea117dbc-e719-4fa9-9efe-48f65bedc3b6 | Thatpaulguy/MultiCoreDemo | MultiThread/BulletforEveryone/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp | #include "btSphereSphereCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
btSphereSphereCollisionAlgorithm::btSphereSphereCollisionAlgorithm(btPersistentM... | ALGO | 0.999099 | 6.586013 |
2fff8c4b-1d25-4128-93d3-c337d117f40e | Amaan262/Amaan-DSA | codehelp/0_basic/02_binarytodeci/code.cpp/code.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.1415926535897932384626
#define all(x) (x).begin(), (x).end()
#define ps(x, y) fixed << setprecision(y) << x
#define w(t) int t; cin >> t; while (t--)
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, k, n) for (int i = k; i < n... | ALGO | 0.999599 | 4.402415 |
fa552245-101c-41c4-98a2-e1bcf4aeadac | HuijinPark/CCEX | zlib/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.998932 | 4.092313 |
b1f2671a-00e6-4304-a591-e63d3ba6427a | zmx4/MySteps | acwing/DFSBFS/849. Dijkstra求最短路 I.cpp | #include <bits/stdc++.h>
#define endl "\n"
using ll = long long;
using ull = unsigned long long;
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 510;
int n, m;
int g[N][N], d[N];
bool vis[N];
int dijkstra()
{
memset(d, 0x3f, sizeof d);
d[1] = 0;
for (int i = 0; i < n;i++)
{
int t = -1;
for (int... | ALGO | 0.999972 | 4.83663 |
9a2fd6f4-7b68-4abc-8428-3f61374b5b9d | raincross7/code-similarity | codes/train_code/problem488/problem488_75.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
const ll mod = 1000000007;
ll n, k; cin >> n >> k;
ll ans = 0;
for (ll i = k; i <= n + 1; i++) {
ll tmpLeft = (i - 1) * i / 2;
ll tmpRight = n * (n + 1) / 2 - (n - i) * (n - i + 1) / 2;
ans+= tmpRi... | ALGO | 0.999944 | 4.68622 |
07e00ad3-0402-4314-ae8b-d0d8f87368d3 | ishandutta2007/codeforces | laycurse/normal/1626/F.cpp | #pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("inline")
#include<bits/stdc++.h>
using namespace std;
#define MD (998244353U)
struct Modint{
unsigned val;
Modint(){
val=0;
}
Modint(int a){
val = ord(a);
}
Modint(unsigned a){
val = ord(a);
}
Modint(lon... | ALGO | 0.999854 | 4.252367 |
5e2a6fb1-54fc-43eb-b61f-bb9d021af02e | sjtuyinjie/M3DGR | baseline_systems/R3LIVE_M3DGR/src/r3live/src/meshing/MVS/IBFS.cpp | /*
#########################################################
# #
# IBFSGraph - Software for solving #
# Maximum s-t Flow / Minimum s-t Cut #
# using the IBFS algorithm #
# ... | ALGO | 0.997921 | 4.836256 |
fe9343f7-b4ab-4422-a809-ab8a916edb90 | ishandutta2007/codeforces | leaf1415/normal/922/D.cpp | #include <iostream>
#include <string>
#include <algorithm>
#define llint long long
using namespace std;
struct Str{
string s;
llint scnt, hcnt;
Str(){}
Str(string a){
s = a;
scnt = hcnt = 0;
for(int i = 0; i < s.size(); i++){
if(s[i] == 's') scnt++;
else hcnt++;
}
}
bool operator<(const Str &obj)c... | ALGO | 0.999199 | 3.181476 |
4a270fed-032d-4e8f-a19e-80ab8dbf67ab | maharshi6864/college_programs | Sem4/DS/Queue/circularQueue.cpp | #include <iostream>
#define MAX 5
using namespace std;
int queue[MAX];
int front = -1, rear = -1;
void enqueue(int number)
{
if ((front == 0 && rear == MAX - 1) || rear + 1 == front)
{
cout << "Queue Overflow !!" << endl;
return;
}
if (front == -1 && rear == -1)
{
front = rear = 0;
queue[re... | ALGO | 0.996489 | 4.308976 |
8b3048f8-1aad-4f1d-9145-2308253ef8d6 | ahsamehx/Problem-Solving | Graphs/Number Maze.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define inf 1e18
const int N = 8;
int n, m;
int moves[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
bool valid (int x, int y) {
return (0 <= x && x < n && 0 <= y && y < m);
}
int DJK (int n,int m, vector<vector<int>> &board) {
vector<vector<in... | ALGO | 0.999867 | 5.664237 |
bb84cc88-aeda-4ac8-b466-4df9aee9e440 | Rimjhim20/Cpp | static.cpp | // #include <iostream>
// using namespace std;
// class A
// {
// int p; //normal data member of class
// static int q; //static data member
// public:
// A(); //default Constructor
// void increment(void);
// void display(void);
// };
// A::A() //we are assigning the value of constructor ou... | TOOL | 0.868619 | 5.214864 |
3f280343-ccff-47d9-b2f2-9ce7867643b1 | duduclx/PS3DEV | libs/rsxgl/extsrc/eigen-eigen-3.0.1/bench/sparse_randomsetter.cpp |
#define NOGMM
#define NOMTL
#include <map>
#include <ext/hash_map>
#include <google/dense_hash_map>
#include <google/sparse_hash_map>
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef DENSITY
#define DENSITY 0.01
#endif
#ifndef REPEAT
#define REPEAT 1
#endif
#include "BenchSparseUtil.h"
#ifndef MINDENSITY
#define M... | TOOL | 0.914559 | 4.487392 |
9737fda3-17ec-4069-8dc1-920faf5f2181 | cgupta3131/Competitive_Coding_Ninjas | 1_Dynamic_Programming/MaxSumRectangle.cpp | #include<bits/stdc++.h>
using namespace std;
bool check_all_negative(int *arr, int n)
{
for(int i=0;i<n;i++)
if(arr[i] > 0)
return false;
return true;
}
//Finds the maximum subarray sum in an array!
int kadane(int *arr, int n)
{
if(check_all_negative(arr,n) == true)
{
int max = INT_MIN;
for(int i=0... | ALGO | 0.999958 | 4.3608 |
fddfeea1-3d7a-46a7-b52a-fc9bc18296c4 | tmeid/C_lab | Idea/PatternLoops2D-2.cpp | #include<stdio.h>
int main() {
int i,j, n, len;
scanf("%d", &n);
len= 2*n-1;
int a[len][len];
for(i=0; i<= n-1; i++){
a[i][i]= n-i; //duong cheo qua tam arr[n-1][n-1] (quadrant II)
for(j= i+1; j<= n-1; j++){ //Ex: n=3 3 3 3
a[j][i]= n-i; //col (quadrant II)... | ALGO | 0.999982 | 3.252892 |
d41740cd-196b-4b95-a60b-8cbd2c731724 | godkingjay/LeetCode | Hard/847. Shortest Path Visiting all Nodes/sol.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <climits>
using namespace std;
class Solution
{
public:
int shortestPathLength(vector<vector<int>> &graph)
{
int n = graph.size();
vector<vector<int>> adjList(n);
for (int i = 0; i < n; i++)
{
for (int... | ALGO | 0.99992 | 5.164099 |
d1315e8d-efb7-4096-86bc-df00b2f9e224 | satyapsr13/LeetCode | 409-longest-palindrome/409-longest-palindrome.cpp | class Solution {
public:
int longestPalindrome(string s) {
map<char,int>mp;
for(auto &it:s)
{
mp[it]++;
}
bool isOdd=0;
int ans=0;
for(auto &it:mp)
{
if(it.second&1)
{
isOdd=1;
}
... | ALGO | 0.999966 | 5.900027 |
d7b82240-d1f6-4401-b7ec-7856cd2893db | AhJo53589/leetcode-cn | problems/n-ary-tree-preorder-traversal/SOLUTION.cpp | #define NODE_DEFINE_LEETCODE_589_N_ARY_TREE_PREORDER_TRAVERSAL
#include "../../test/Common/Node.cpp"
//////////////////////////////////////////////////////////////////////////
//class Node {
//public:
// int val;
// vector<Node*> children;
//
// Node() {}
//
// Node(int _val) {
// val = _val;
// ... | ALGO | 0.999964 | 6.37941 |
5262e6d1-29ff-4fd3-98e2-5a132db75499 | ra1an-dh1man/DSA-in-Cpp | Maths/PowerOfTwo.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main()
{
int n ;
cin>>n;
bool res = false;
for(int i = 0; i <= 30 ; i++)
{
if(pow(2,i) == n)
res = true;
}
if(res == true)
cout<<"true";
else
cout<<"false";
return 0;
}
| ALGO | 0.999537 | 4.441836 |
13628556-a8d5-4a54-8d72-6612b4618b72 | Garvit-1/DSA | 101-symmetric-tree/symmetric-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.999962 | 6.46925 |
cabb58a0-9e3d-4aed-b276-c0fd7811ed9a | C204/acm_templates | number-theory/gcdcnt.cpp | /**
* hdu 4746
* gcd cnt
*/
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 500050;
int sum[20][N];
bool isp[N];
int pr[N], miu[N], cn[N];
void init() {
miu[1] = 1; cn[1] = 0;
memset(isp, 1, sizeof isp);
for(int i=2;i<N;++i) {
if(i... | ALGO | 0.999973 | 4.076468 |
61d163d1-3cc7-44e3-ad72-73034e8dd1a0 | TimmyLU/Leetcode_Practices | EASY/1518. Water Bottles.cpp | class Solution {
public:
int numWaterBottles(int numBottles, int numExchange) {
int total = numBottles;
int empty = numBottles;
while(empty >= numExchange){
int news = empty / numExchange;
total = total + news;
empty = empty % numExchange + news;
}... | ALGO | 0.999748 | 5.518551 |
f04a4a5d-3543-4375-849b-31c28a157a32 | francisduvivier/adventofcpp2015 | day15/day15.cpp | #include <iostream>
#include <regex>
#include <string>
#include <vector>
#include "../util/processing.h"
using namespace std;
const bool DEBUG_V = 0;
const bool DEBUG_I = 0;
struct IngredientInfo
{
int capacity = 0; // (how well it helps the cookie absorb milk)
int durability = 0; // (how well it keeps the co... | ALGO | 0.872298 | 5.958758 |
118b0c5c-39d0-4982-b15b-24d33d462136 | Jminis/Custom-llvm | my-llvm-project/mlir/lib/Conversion/VectorToArmSME/VectorToArmSME.cpp | #include "mlir/Conversion/VectorToArmSME/VectorToArmSME.h"
#include "mlir/Dialect/ArmSME/IR/ArmSME.h"
#include "mlir/Dialect/ArmSME/Utils/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/BuiltinTypes.h"
#include "llvm/Support/Casting.h"
using namespace mlir;
/// Returns true if 'val' is a splat ... | TOOL | 0.946946 | 7.538624 |
838f7442-bfd6-48c9-b90e-6a265e286221 | ShivamDhamija/leetcodeQuestions | 198-house-robber/198-house-robber.cpp | class Solution {
public:
vector<int>v;
int call(vector<int>&n,int i)
{
if(i>=n.size())return 0;
if(v[i]!=-1)return v[i];
return v[i]=max(call(n,i+2)+n[i],call(n,i+1));
}
int rob(vector<int>& n) {
v.resize(n.size(),-1);
return call(n,0);
}
}; | ALGO | 0.999972 | 5.538672 |
5680de49-032b-47ec-9975-c6e791c27b13 | floreaadrian/AlgCodes | Infoarena/Lapte/Lapte.cpp | #include<fstream>
#include<math.h>
using namespace std;
ifstream fin("lapte.in");
ofstream fout("lapte.out");
int min(int a,int b)
{
if(a<b)return a;
return b;
}
int optim[101],sol;
int main()
{
int n,t,l,x[101],y[101];
fin>>n>>l;
for(int i=1;i<=n;++i)
fin>>x[i]>>y[i];
for(int i=1;i<=n;i++)
for(int j=l-x... | ALGO | 0.999934 | 3.015875 |
564d7742-cf7a-4ad7-893d-8e33187971ce | sumondebnath/Problems-Solutions | Leet code/Linked List/141_Linked_List_Cycle.cpp | /*
Link : https://leetcode.com/problems/linked-list-cycle/description/
*/
class Solution
{
public:
bool hasCycle(ListNode *head)
{
if (head == NULL or head->next == NULL)
return false;
ListNode *slow = head;
ListNode *fast = head;
while (fast != NULL and fast->... | ALGO | 0.999911 | 5.624093 |
de1591c3-54d1-4cb4-9bbe-68d3fd1da7f4 | JONATHAN-AMOS/Jonathan-Amos | Matrix Multiplication.cpp | #include <iostream>
using namespace std;
int main() {
int rows1, cols1, rows2, cols2;
// Input matrix dimensions
cout << "Enter rows and columns for matrix 1: ";
cin >> rows1 >> cols1;
cout << "Enter rows and columns for matrix 2: ";
cin >> rows2 >> cols2;
// Matrix multiplication is poss... | ALGO | 0.999841 | 4.632427 |
90a58746-756d-4047-8592-2ad918ba140c | rabelhmd/UVA-Solutions | UVA_10394_Twin_primes.cpp | #include <bits/stdc++.h>
using namespace std;
#define M 20000000//18409202 // 10^7
int prime[M];
int A[M];
long int t = 0;
bool flag[M];
void siv()
{
int i , j, val;
for(int i = 2; i <= M; i++)
{
flag[i] = 1;
}
for(int i = 2; i <= sqrt(M); i++)
{
if(flag[i])
{
... | ALGO | 0.999476 | 3.9285 |
dd252bd6-c583-411a-8a61-7e22263c9c08 | JazibEqbal/DSA-using-CPP | Basics C & C++/Swapping.cpp | #include <iostream>
#include <stdio.h>
// Call by pointer
// void swap(int *a, int *b)
// {
// int temp;
// temp = *a;
// *a = *b;
// *b = temp;
// }
// int main()
// {
// int x = 10, y = 20;
// swap(&x, &y);
// printf("%d %d", x, y);
// }
// Call by Reference
void swap(int &a,... | ALGO | 0.998664 | 4.471342 |
d11eafc2-697a-4982-aa6f-f60ab2a247c8 | jash459/Today | Striver/5. Bit manipulation/6. Single Number II.cpp | // link:
//video: https://www.youtube.com/watch?v=5Bb2nqA40JY&list=PLgUwDviBIf0rnqh8QsJaHyIX7KUiaPUv7&index=6
class Solution {
public:
int singleNumber(vector<int>& nums) {
int ans = 0;
for(int bitIndex = 0; bitIndex <= 31 ; bitIndex++) {
int cnt = 0;
for(int i = 0;i<nums.... | ALGO | 0.99983 | 5.680221 |
37ecefb5-4c23-49fa-91f4-2bd8d9098277 | bensapp/Stretchable-Models-for-Motion-Parsing | utils/mex_extractWindow.cpp | /*
// Timothee Cour, 04-Mar-2009 05:49:24 -- DO NOT DISTRIBUTE
function images=mex_extractWindow(image,rhulls,is_allow_outside);
images=mex_extractWindow(image,rhulls,is_allow_outside);
image=mex_extractWindow(image,rhull,is_allow_outside);
*/
#undef NDEBUG
#include <math.h>
#include <mex.h>
#include "mex_util.cpp"
#i... | ALGO | 0.952398 | 4.7494 |
17995189-1c94-4cef-8c02-ad4d340b1636 | Suzx057/algo | lab-quiz/juk/factorail.cpp | #include<iostream>
using namespace std;
int fac(int n){
cout<< n << "\n";
if(n == 1){
return 1;
}
int a = n * fac(n -1);
cout<< a << "\n";
return a;
}
int main(){
fac(5);
return 0;
} | ALGO | 0.999833 | 4.29079 |
1dd6397e-7de0-4280-a74a-8eece915f556 | StdDongcheol/AlgorithmTest | 7562/7562.cpp | // 7562.cpp : 이 파일에는 'main' 함수가 포함됩니다. 거기서 프로그램 실행이 시작되고 종료됩니다.
//
#include <iostream>
#include <queue>
int arr[301][301];
bool check[301][301];
int dx[8] = {1, 2, 1, 2, -1, -2, -1, -2};
int dy[8] = {2, 1, -2, -1, 2, 1, -2, -1};
int BFS(int _x, int _y, int _endX, int _endY, int _I)
{
std::queue<std::pair<int, i... | ALGO | 0.999592 | 4.986637 |
a818e717-53dd-4eef-a798-caf3c4df104c | EdyLaScoala/Lectii | Classwork/Exercises/24/MAR/04.03.24/Ex1/ex1.cpp | #include <iostream>
#include <cstring>
using namespace std;
void c(int v[], int n)
{
cout << "c)" << endl;
cout << "k: ";
int k=0;
cin >> k;
cout << "Max: " << k;
for(int i=0; i<n; i++)
{
cout << v[i];
}
cout << endl << "Min: ";
for(int i=0; i<n; i++)
{
cout... | ALGO | 0.997343 | 3.586823 |
6339e05b-2bb5-441b-a649-449d28f19aa0 | hackverket/bitcoin-core | src/key_io.cpp | #include <key_io.h>
#include <base58.h>
#include <bech32.h>
#include <script/script.h>
#include <util/strencodings.h>
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/static_visitor.hpp>
#include <assert.h>
#include <string.h>
#include <algorithm>
namespace
{
class DestinationEncoder : public boos... | TOOL | 0.889345 | 7.690852 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.