uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
fd9799ac-0cc1-4593-88e6-9f1ba8ab2231 | AKoudounis/refactored-journey | bisectionmethod.cpp | #include <iostream>
#include <cmath>
double polynomial(double x)
{
return (x*x*x -x*x -2);
}
bool checksign(double fa, double fc){
if ((fa>0 && fc>0) || (fa<0 && fc<0))
{
return false;
}
else return true;
}
int main()
{
const double epsilon{0.000001};
short counter{0};
co... | ALGO | 0.999954 | 4.917667 |
14c77a18-5dea-41f0-88c9-5a78f63bfaba | RadsammyT/coding-playground | playground c++/rad/ShitShuffler.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
#include "timer.h"
#include <stdlib.h>
#include "input.cpp"
#pragma once
using namespace std;
namespace ShitShuffler {
void printVector(vector < int > v);
void randomizeVector(vector < int > & v);
bool isUnique(vector < int > v);
void printVector... | ALGO | 0.95667 | 4.300721 |
5c185b0a-8410-4ea7-91dd-824205a8d825 | yannyesteban/SevianEngine | Engine/MovementSystem.cpp | #include "MovementSystem.h"
void SEVIAN::MovementSystem::init ( std::vector<std::shared_ptr<Entity>>& entities, float deltaTime ) {
}
void SEVIAN::MovementSystem::update ( std::vector<std::shared_ptr<Entity>>& entities, float deltaTime ) {
for (auto& entity : entities) {
auto input = entity->getComponen... | ALGO | 0.859284 | 4.373396 |
47452806-334a-4129-b3df-78cdede8a3b6 | ishandutta2007/codeforces | hank55663/normal/894/D.cpp | #include<bits/stdc++.h>
using namespace std;
#define LL long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define N 131072
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(... | ALGO | 0.999963 | 3.382885 |
65cd490d-976d-46fa-a302-728b2f74d727 | gnn-benchmark/reordering | reordering/rescience_gorder/src/order/order_deg.cpp | #include "order_deg.h"
#include "../utils/adjlist.h"
#include "../utils/edgelist.h"
#include <algorithm>
using namespace std;
inline bool compare_nodedeg_desc (Keyvalue &a, Keyvalue &b) { // sort degree DESC, node ASC
return ( a.val > b.val or (a.val == b.val and a.key < b.key) );
}
inline bool compare_nodedeg_asc (... | ALGO | 0.999882 | 5.722808 |
92653170-7068-496b-a01e-41a4b2107e64 | MAKIYAMA-ma/AtCoder | APG4b/ex18.cpp | #include <bits/stdc++.h>
using namespace std;
// 参照渡しを用いて、呼び出し側の変数の値を変更する
void saiten(vector<vector<int>> &a, int &c, int &w) {
// 呼び出し側のAの各マスを正しい値に修正する
// Aのうち、正しい値の書かれたマスの個数を correct_count に入れる
// Aのうち、誤った値の書かれたマスの個数を wrong_count に入れる
// ここにプログラムを追記
c = 0;
w = 0;
for(int i = 0; i < 9; i++) {
for... | ALGO | 0.999539 | 4.078324 |
a1eadcc8-4ac4-4081-b49e-92ccb6930499 | AmpleCoder/Leetcode-Solving | Adhocs/Matrix/54. Spiral Matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& a)
{
int top,bottom,left,right,i,j;
top=left=0;
bottom=a.size()-1;
right=a[0].size()-1;
vector<int> ans;
while(top<=bottom && left<=right)
{
for(i=left;i<=r... | ALGO | 0.999993 | 5.523108 |
020e4d85-1786-422b-bb43-60106c6bda2e | ArchishmanSengupta/lc | 1996-the-number-of-weak-characters-in-the-game/1996-the-number-of-weak-characters-in-the-game.cpp | class Solution {
public:
static bool comp(vector<int>& a,vector<int>& b){
if(a[0]==b[0])return a[1]>b[1];
return a[0]<b[0];
}
int numberOfWeakCharacters(vector<vector<int>>& properties) {
int n=properties.size();
sort(properties.begin(),properties.end(),comp);
int maxdef=INT_MIN;
int co... | ALGO | 0.999935 | 5.693827 |
4745fc81-27fe-4649-bed4-dfa9d9fef284 | EDWINSOM/ucd-csi2312-pa2 | KMeans.cpp | //
// Created by marisa on 11/8/15.
//
#include "KMeans.h"
#include <fstream>
#include <sstream>
#include <iostream>
#include <cmath>
using namespace std;
namespace Clustering {
KMeans::KMeans() {
point_space = new Cluster;
// cout << endl << "point_space assigned a cluster" << endl;
}
... | ALGO | 0.994769 | 4.21449 |
7798df64-3182-420e-bc4e-d531cbfd973d | shamikh1014/code | complexNumberClassUse.cpp | #include<iostream>
using namespace std;
#include"complexNumberClass.cpp"
int main(){
int real1, imaginary1, real2, imaginary2;
cin>>real1>>imaginary1;
cin>>real2>>imaginary2;
complexNumberClass c1(real1, imaginary1);
complexNumberClass c2(real2, imaginary2);
int choice;
cin>>choice;
... | ALGO | 0.975879 | 4.081935 |
37a4c881-fa54-4de6-ad3d-cda1bd6542a0 | Mr-Phoebe/ACM-ICPC | OJ/Leetcode/Algorithm/689. Maximum Sum of 3 Non-Overlapping Subarrays.cpp | class Solution {
public:
vector<int> maxSumOfThreeSubarrays(vector<int>& nums, int k) {
int n=nums.size();
vector<int> sum(n,0);
vector<int> l (n,0);
vector<int> li (n,0);
for(int i=0;i<k;i++)
sum[0]+=nums[i];
l[0]=sum[0];
li[0]=0;
for(in... | ALGO | 0.999952 | 5.399836 |
ea919e0f-968b-41ad-9101-97f5a64a1c51 | qiweishen/Plant2Skeleton | deps/geometry-central/src/surface/fast_marching_method.cpp | #include "geometrycentral/surface/fast_marching_method.h"
#include <queue>
#include <tuple>
namespace geometrycentral {
namespace surface {
namespace {
// The super fun quadratic distance function in the Fast Marching Method on triangle meshes
// TODO parameter c isn't actually defined in paper, so I guess... | ALGO | 0.999952 | 7.295692 |
a5b93574-fd6a-406d-ad1c-8e49abc81775 | vugartaghiyev/e-olymp-cplus | 8629.cpp | #include<iostream>
#include<iomanip>
using namespace std;
int main(){
long long num=0,n;
string a="NO"
cin>>n;
while(n!=0){
if(n%2==1){
a="YES";
}
n/=10;
}
cout<<a;
return 0;
}
| ALGO | 0.999458 | 3.232213 |
bced1e33-096a-4aa4-91a0-e4a413de88ef | HPMkwn/Codding | coding_mafia/25.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
while(n--){
int a,b;
cin>>a>>b;
cout<<min(a,b)<<" "<<a+b<<"\n";
}
return 0;
} | ALGO | 0.99856 | 3.674714 |
cca7ad49-a164-43b4-ab54-80a8645babe3 | los-kenzo/android_build | tools/zipalign/ZipAlign.cpp | /*
* Zip alignment tool
*/
#include "ZipFile.h"
#include <stdlib.h>
#include <stdio.h>
using namespace android;
/*
* Show program usage.
*/
void usage(void)
{
fprintf(stderr, "Zip alignment utility\n");
fprintf(stderr, "Copyright (C) 2009 The Android Open Source Project\n\n");
fprintf(stderr,
... | TOOL | 0.904948 | 5.654994 |
9a60a3db-379a-4400-92a4-c0136112c252 | Danyal-Rana/LeetCode | 404-sum-of-left-leaves/sum-of-left-leaves.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.999866 | 6.501711 |
5544280d-6914-487d-9e39-ecfb3393d825 | XinXin9527/nori | nori/ext/openexr/IlmBase/ImathTest/testProcrustes.cpp | #include "ImathMatrixAlgo.h"
#include "ImathRandom.h"
#include "ImathEuler.h"
#include <iostream>
#include <assert.h>
#include <cmath>
#include <vector>
#include <limits>
// Verify that if our transformation is already orthogonal, procrustes doesn't
// change that:
template <typename T>
void
testTranslationRotationMat... | TEST | 0.965071 | 7.265359 |
a7108868-28d9-43c8-a9ff-e13bd643a88d | monhime/atcoder_charter | ABC/304/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define debug(x) std::cerr << #x << ": " << x << '\n'
constexpr int MOD = 1000000007;
constexpr long long llinf = 1LL << 62;
constexpr int inf = 1LL << 30;
constexpr int dy[4] = {-1, 0, 1, 0}, dx[4] = {0, -1, 0, 1};
using ll = long lo... | ALGO | 0.999844 | 5.441693 |
102e2826-8b47-4d1e-8b05-10087346551f | joydip10/UVA | 10114.cpp | #include<iostream>
using namespace std;
int main()
{
int M,dep_m;
double down_payment,insurance,depr_arr[101];
while(cin>>M>>down_payment>>insurance>>dep_m){
if(M<0) return 0;
depr_arr[101]={0};
int m;
double dd;
while(dep_m--)
{
cin>>m>>dd;
for(int i =m;i<101;i++) ... | ALGO | 0.999512 | 3.289755 |
6ec7c8a2-3023-47c9-93ed-ec423e5152bf | PJ-FDU/fudancraft | cocos2d/extensions/Particle3D/PU/CCPUInterParticleCollider.cpp | #include "CCPUInterParticleCollider.h"
#include "extensions/Particle3D/PU/CCPUParticleSystem3D.h"
NS_CC_BEGIN
// Constants
const float PUParticle3DInterParticleCollider::DEFAULT_ADJUSTMENT = 1.0f;
const PUParticle3DInterParticleCollider::InterParticleCollisionResponse PUParticle3DInterParticleCollider::DEFAULT_COLLIS... | TOOL | 0.91961 | 6.903987 |
412b132c-8736-4679-b8be-76a13a8eff24 | PERAPRO/codigosCP | RPC_s/RPC2023/07/Pseudo.cpp | /// Write by Daniel Perez .PERAPRO
#include<bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(), s.end()
#define mp make_pair
typedef long long ll;
typedef unsigned long long ull;
typ... | ALGO | 0.99999 | 3.201036 |
b7d4066f-6307-456a-a58c-06578d73ef63 | Kristoff-starling/Problem-Solving-Solutions | 2020/Problem Solving III - 01/最短路1.cpp | #include <bits/stdc++.h>
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define LL long long
#define pb push_back
#define Pair pair<int,int>
#define pLL pair<LL,LL>
#define x first
#define y second
#define mp make_pair
using namespace std;
const int MAXN=2e5;
const LL LINF=2e16;
int n,m;
vector<Pair> v[MAXN+48];
priority_... | ALGO | 0.999702 | 3.883305 |
262c17c1-b8d6-46e2-a9ae-b0f425b8d630 | SourovCodes/c-programming | contest/AtCoder Beginner Contest 351/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
void solve()
{
int n;
cin >> n;
char grid1[n][n], grid2[n][n];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cin >> grid1[i][j];
}
}
for (int i = 0; i < n... | ALGO | 0.999515 | 3.408484 |
6615cf4f-821d-4f61-8669-f3bb2a22125c | dmfrodrigues/feup-prog-ex | tp/04/04_11.cpp | #include <iostream>
#include <vector>
#include <set>
using namespace std;
vector<int> union_(const vector<int> &v1, const vector<int> &v2){
set<int> s;
s.insert(v1.begin(), v1.end());
s.insert(v2.begin(), v2.end());
return vector<int>(s.begin(), s.end());
}
vector<int> intersection_(const vector<int> ... | ALGO | 0.999473 | 3.923202 |
533e0d11-3784-4a42-8988-fb72b6d96f8e | Prakharsahu10/DataStructure_Algorithms | ARRAYS/Maximum_consecutive_ones.cpp | /* Count maximum consecutive one in the array */
/*
Problem Statement: Given an array that contains only 1 and 0 return the count of maximum consecutive ones in the array.
Examples:
Example 1:
Input: prices = {1, 1, 0, 1, 1, 1}
Output: 3
Explanation: There are two consecutive 1’s and three consecutive 1’s in the ... | ALGO | 0.999971 | 6.663993 |
6208e0fb-fe81-4ab2-b700-90c983298009 | ProjectBlaze-Reborn/frameworks_av | media/module/codecs/amrnb/enc/src/levinson.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/levinson.c
Funtions: Levinson_init
Levinson_reset
Levinson_exit
Levinson
------------------------------------------------------------------------------
MODULE DESCRIPTI... | ALGO | 0.998658 | 6.290952 |
c1f1a104-72bd-40ce-8e33-4f133628d702 | sukirth-singh-gaur/Leetcode | leetcode/dynamicprog/Subsequences/518_leetcode.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int change(int amount, vector<int>& coins) {
int ans = f(amount,coins,0);
return ans;
}
private:
int f(int amount, vector<int>& coins,int ind){
if(ind == coins.size() && amount != 0) return 0;
if(amount ==... | ALGO | 0.999975 | 5.062727 |
870105d5-5377-492c-a520-16113c4ac322 | aminurrahmanashik/codeforces | 1244B.cpp | // codeforces 1244B..
// online er osthirr solution...
/*
#include <bits/stdc++.h>
using namespace std ;
#define N 100005
#define pb push_back
#define ll long long
#define mod 1000000007
#define pll pair<ll, ll>
#define double long double
#define fi first
#define se second
#define INF 10000000000000000
#define Bas... | ALGO | 0.999946 | 4.888859 |
255e9c1e-615a-4245-a9b0-a95038a5cb83 | Devansh968/LEET-CODE-SOLUTIONS | 1822-sign-of-the-product-of-an-array/1822-sign-of-the-product-of-an-array.cpp | class Solution {
public:
int arraySign(vector<int>& nums) {
int p=1;
for(int n: nums) {
if(n<0) p*=-1;
if(n==0) return 0;
}
return p>0 ? 1 : -1;
}
}; | ALGO | 0.999993 | 5.626546 |
43bb007d-8ba3-40c0-ba5f-be9c7ad3d953 | Paxing939/Coursera-tasks | YellowBelt/4 week/Demography.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
enum class Gender {
FEMALE,
MALE
};
struct Person {
int age; // возраст
Gender gender; // пол
bool is_employed; // имеет ли работу
};
// Это пример функции, его не нужно отправлять вместе с функцией PrintStats
template <typ... | ALGO | 0.998772 | 5.602192 |
5e51bfb3-d7d2-48cd-995a-a4eefb13a74d | prashantsingh20/LeetCode-Solutions | Hash Table/49. Group Anagrams.cpp | /* 49. Group Anagrams
https://leetcode.com/problems/group-anagrams/
*/
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
vector<vector<string>> answer;
unordered_map<string, vector<string>> mpp;
for(string str:strs)
{
string s = str;
... | ALGO | 0.999997 | 6.774488 |
d41f31c5-ac8e-4b0a-a127-d6138e817d46 | marinvhs/coding | codeforces/056D.cpp | #include <cstdio>
#include <cstring>
#include <string>
#include <vector>
using namespace std;
string h, w;
char word[1024];
int type[1024][1024], memo[1024][1024];
int l1, l2;
int min(int a, int b){ return a < b ? a : b; }
int r(int a, int b){
if(memo[a][b] != -1) return memo[a][b];
if(a == l1 && b == l2){ // Done
... | ALGO | 0.999877 | 3.11633 |
34887da7-fd98-4dc5-b4fd-96588dc5016f | muhammadjamalmatloob/PF_Pd04_tasks | task09cp.cpp | #include<iostream>
using namespace std;
void check_TP(int people, int tp_rolls);
int main()
{
int people, tp_rolls;
cout << "Number of people in the household: ";
cin >> people;
cout << "Number of rolls of TP: ";
cin >> tp_rolls;
check_TP(people,tp_rolls);
return 0;
}
void check_TP(int people, i... | ALGO | 0.991449 | 4.513662 |
41e9557e-092b-4259-9eb7-b99c003b6ff3 | BrunoArmondBraga/TCC | src/tango/RedBlack.cpp | #include "RedBlack.h"
//This implementation of a red-black tree is heavily based in the Chapter 13
//of the book Introduction to Algorithms of Cormen, Leiserson, Rivest and Stein
void fix_depths(Node* u){
//Given a node u, recalculate u->min/max_depth based on its children
if(u == nullptr){
return;
... | ALGO | 0.999283 | 4.570291 |
bda9700f-e07f-470b-8208-bc9d39cb089c | hasib1224/CP | CP/Placement_1/CF/StringMInimiz_round809A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t, n, m;
cin>>t;
while(t--)
{
cin>>n>>m;
int arr1[n+1];
bool arr2[m+1];
for(int i=1;i<=m;i++)
{
arr2[i]=true;
}
for(int i=1;i<=n;i++)
{
cin>>arr1[i];
... | ALGO | 0.999922 | 4.340935 |
6a137de1-00d4-4975-a5c9-8b141dc711f8 | ishandutta2007/codeforces | maximumshot/normal/490/A.cpp | #include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <fstream>
#include <string>
#include <algorithm>
#include <stack>
#include <stdio.h>
#define ALL(x) (x).begin(), (x).end()
#define mp make_pair
#define vec vector
typedef long long LL;
typedef long double L... | ALGO | 0.999922 | 3.431965 |
8fe37f30-cf11-4c09-a269-c561e8a92da8 | shuv-on/Codeforces | Insomnia cure.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main ()
{
int k,l,m,n,d;
int cnt=0;
cin>>k>>l>>m>>n>>d;
for (int i=1;i<=d;i++)
{
if (i%k==0 || i%l==0 || i%m==0|| i%n==0)
{
cnt++;
}
}
cout<<cnt;
}
| ALGO | 0.999785 | 3.461888 |
8abb4595-e56e-43bf-8f02-f0559be6bc09 | cmxuu/NCTU-OOP-2020 | HW/HW1/OOP_HW01_NET2010_202007_Summer_Template/00_StudentWork/00_SimpleInteractiveSystem/mySystem_StudentRecordManager.cpp | //
// Instructor: Sai-Keung WONG
// Email: <EMAIL>
// <EMAIL>
//
// National Chiao Tung University, Taiwan
// Computer Science
// Date: 2020/07/14
//
#include "mySystem_StudentRecordManager.h"
#include <iostream>
using namespace std;
STUDENT_RECORD_MANAGER::STUDENT_RECORD_MANAGER( )
{
mNumStudents = 0;
}
void STU... | ALGO | 0.942377 | 4.6196 |
d88e4a5e-e956-4528-ba56-ea0fd9649235 | RamazanFIT/algorithms | part1/segment_tree/ot3.cpp | #include <bits/stdc++.h>
#define ENDL "\n"
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define endd return 0;
#define int ll
#define goodluck ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
using ll = long long;
using namespace std;
signed main(){
goodluck
// fre... | ALGO | 0.999936 | 4.575788 |
33d9db51-2308-4bbf-b61d-28e455a57a1a | alicealys/tpp-mod | src/common/utils/io.cpp | #include "io.hpp"
#include "nt.hpp"
#include <fstream>
namespace utils::io
{
bool remove_file(const std::string& file)
{
return DeleteFileA(file.data()) == TRUE;
}
bool move_file(const std::string& src, const std::string& target)
{
return MoveFileA(src.data(), target.data()) == TRUE;
}
bool file_exists(co... | TOOL | 0.855994 | 6.466884 |
7d3ff608-7a5e-4c4c-b9c3-14ceedb7fbbf | varawa/Striver_SDE_Sheet | Array/Medium/LC2191.cpp | #include<bits/stdc++.h>
using namespace std ;
class Solution {
public:
vector<int> sortJumbled(vector<int>& mapping, vector<int>& nums) {
vector<pair<int, int>> store ;
for (int i = 0 ; i < nums.size() ; i++) {
int mapped = 0 ;
int temp = nums[i] ;
int place = ... | ALGO | 0.999981 | 5.510382 |
9da2289d-5153-47a4-9b99-731bf7d1a6da | taruna29/DS-A-assignments | Day4/Q2.CPP | #include<bits/stdc++.h>
using namespace std;
int main()
{
int num;
cin>>num;
vector<int> arr(num);
for(int i=0;i<num;i++)
{
cin>>arr[i];
}
sort(arr.begin(),arr.end(),greater<int>());
int sum=0;
for(int i=1;i<num;i+=2)
{
sum+=arr[i];
}
cout<<sum<<endl;
return 0;
}
| ALGO | 0.99997 | 3.510094 |
66be9ba1-4ed6-4fd1-be06-99b8294ed69e | swaraj29/LeetCode_Solution | 0328-odd-even-linked-list/0328-odd-even-linked-list.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) {}
* };
*/
//Approach-1 (Time : O(n), Space : O(1))
class Sol... | ALGO | 0.99987 | 5.956889 |
ad9345a2-66f7-477f-a491-62b7eb84ebbf | Kaustav97/CPP_Reference | Categories/DataStructs/Trie/HashMap.cpp | #include <bits/stdc++.h>
using namespace std;
#define tr1(cont) for(auto it=cont.begin();it!=cont.end();it++)
#define tr2(cont,it) for(;it!=cont.end();it++)
#define rep(n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define ll long long
#define fs first
#define sc second
struct node{
bool isend;
unordered_map<cha... | ALGO | 0.999879 | 3.064897 |
25ff6f5a-4980-4e43-80b1-cbdb99cd042d | mikity-mikity/KingOfMonsters | eigenwrapper/libigl-main/libigl-main/include/igl/vertex_components.cpp | template <typename DerivedA, typename DerivedC, typename Derivedcounts>
IGL_INLINE void igl::vertex_components(
const Eigen::SparseCompressedBase<DerivedA> & A,
Eigen::PlainObjectBase<DerivedC> & C,
Eigen::PlainObjectBase<Derivedcounts> & counts)
{
using namespace Eigen;
using namespace std;
assert(A.rows()... | ALGO | 0.997917 | 6.885439 |
f91dd2d0-35ce-4685-921c-6922d7bfba4c | H-Shen/MyCodeCollection | Leetcode/2156/2156.cpp | using ll = long long;
constexpr int MAXN = 2*1e4+5;
ll Pow[MAXN];
ll H[MAXN];
inline ll getHash(string &s, int l, int r, ll mod) {
ll h = 0;
for (int i = l; i <= r; ++i) {
h = (h + (s[i]-'a'+1)*Pow[i-l])%mod;
}
return h % mod;
}
class Solution {
public:
string subStrHash(string s, int po... | ALGO | 0.999989 | 5.67197 |
ba89c36e-f4d8-452c-b608-9efee6611f3e | ishandutta2007/codeforces | sooke/normal/1195/F.cpp | #include <bits/stdc++.h>
inline int read() {
char c, _c; int x; for (c = _c = getchar(); !isdigit(c); c = getchar()) { _c = c; }
for (x = 0; isdigit(c); c = getchar()) { x = x * 10 + c - '0'; } return _c == '-' ? -x : x;
}
const int N = 1e6 + 5;
int n, k, q, id, num, len, now, a[N], lb[N], rb[N], ans[N], pos... | ALGO | 0.999949 | 4.016818 |
6fd4eb29-03f0-44e6-915f-be8490d81b77 | yu1879/datastructure | 10_03_Dance.cpp | #include <iostream>
#include <queue>
using namespace std;
int main()
{
queue<char> boys, girls;
int rounds, number_boy, number_girl;
cout << "Please enter rounds, number of boys and girls:" << endl;
cin >> rounds >> number_boy >> number_girl;
for(int i=0;i<number_boy;i++){
boys.push('A'+... | ALGO | 0.999291 | 4.042684 |
93edadb2-90aa-477c-8109-b2062a8df91f | momenator/3d-scanning | ex1/libs/Eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
VectorXf v(2);
MatrixXf m(2,2), n(2,2);
v << -1,
2;
m << 1,-2,
-3,4;
cout << "v.squaredNorm() = " << v.squaredNorm() << endl;
cout << "v.norm() = " << v.norm() << endl;
cout << "v.lpN... | ALGO | 0.996429 | 4.03798 |
29584888-5b12-4abc-924e-5b173de0130f | Foysal-Munsy/Rush-Roadmap | Week-30/Day 04/B_Sequential_Nim.cpp | //
// Created by Foysal Munsy on 25 / 12 / 2023
// Time: 21 : 55 : 09
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define nl '\n'
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#ifdef LOKAL
#include "DEBUG_TEMPLATE.h"
#else
#define HERE
#define ... | ALGO | 0.999894 | 5.087852 |
cfb3e4e5-f6e4-43a2-842f-c666bad8b137 | sarvex/leetcode-jai | solution/1100-1199/1156.Swap For Longest Repeated Character Substring/Solution.cpp | class Solution {
public:
int maxRepOpt1(string text) {
int cnt[26] = {0};
for (char& c : text) {
++cnt[c - 'a'];
}
int n = text.size();
int ans = 0, i = 0;
while (i < n) {
int j = i;
while (j < n && text[j] == text[i]) {
... | ALGO | 0.99998 | 5.989851 |
3484798d-b592-45db-a028-213751d670ad | nayanGowdaM/LeetCodeSolns | 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.999933 | 6.714783 |
d3718f3c-babc-4cad-9c64-b0260524482f | foradarsh/QuestionsSolved | 322-coin-change/322-coin-change.cpp | class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
int n =coins.size();
vector<int> dp(amount+1, INT_MAX);
dp[0] = 0;
for(int i=1;i<= amount;i++){
for(int j=0;j<n;j++){
if(i-coins[j] >= 0 && dp[i-coins[j]] != INT_MAX)
... | ALGO | 0.999912 | 5.893577 |
953dc59a-4fb8-4a67-8598-c589af0c22c9 | Achsheyeh/hackerrank | rnd_maxSubsetSum.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
// Complete the maxSubsetSum function below.
int maxSubsetSum(vector<int> arr) {
int n = arr.size();
// for (auto elem : arr)
// cout << elem << endl;
int maxArrSize = n+3;
vector<int> maxVal(n+3);
int k = 0;
int ma... | ALGO | 0.999927 | 4.614016 |
43f95a3e-00c5-43b1-8d32-8a534e4dc56e | NaDaPuPu/https---github.com-NaDaPuPu-baekjoon | 1436.cpp | #include <iostream>
using namespace std;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(0);
int n, cnt = 0, start = 666;
cin >> n;
while (true)
{
int temp = start;
while (temp >= 666)
{
if (temp % 1000 == 666)
{
cnt++;
... | ALGO | 0.999186 | 3.746779 |
7e14942e-9bf4-4ad1-8f3e-f87eed0d1ad9 | flash1729/Leetcode_Grind | 14-longest-common-prefix/longest-common-prefix.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
string ans = "";
sort(strs.begin(),strs.end());
int n = strs.size();
string first = strs[0],last = strs[n-1];
for(int i = 0; i < min(first.size(),last.size());i++){
if(first[i] != last[i]... | ALGO | 0.999929 | 5.806367 |
0e4c7362-fd76-4c14-a91e-9ad7e14dc37c | ashryaagr/STL_Algorithms | multiply_strings.cpp | class Solution {
public:
string addString(string s1, string s2) {
if ( s1.size() == 0)
return s2;
if (s2.size() == 0)
return s1;
if (s1.size() < s2.size())
swap(s1, s2);
int n = s1.size() - 1;
int m = s2.size() - 1;
int c = 0;
string sum = "";
int sumint = 0;
while ( n >= 0 || m >= 0 || c > 0) {
su... | ALGO | 0.999933 | 5.455358 |
58a5a950-1514-49a5-9810-8117cafcb5da | efortanely/LeetCode-Solutions | snap_prep/0121.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int max_val = 0;
int profit = 0;
if(prices.size() == 0){
return profit;
}
for(int i = prices.size() - 1; i >= 0; i--){
max_val = max(max_val, prices[i]);
int new_profit ... | ALGO | 0.999911 | 6.37083 |
ee14cb81-db1a-4855-b1b8-795126029870 | Kano-Hiroki/ESCAP-ERUINS | ES Game Library/MyClass/Collision.cpp | #include "Collision.h"
bool Collision::collision(MODEL model1, MODEL model2) {
bool hit = false;
OrientedBoundingBox model_obb1 = model1->GetOBB();
OrientedBoundingBox model_obb2 = model2->GetOBB();
if (model_obb1.Intersects(model_obb2)) {
hit = true;
}
return hit;
}
bool Collision::collision(ANIMATIONMODEL mod... | ALGO | 0.998946 | 4.045104 |
83e1ce1e-c1c0-4297-9419-5d5bb4e3e0f5 | ravynsoft/ravynos | contrib/llvm-project/lldb/source/Host/common/GetOptInc.cpp | #include "lldb/Host/common/GetOptInc.h"
#if defined(REPLACE_GETOPT) || defined(REPLACE_GETOPT_LONG) || \
defined(REPLACE_GETOPT_LONG_ONLY)
// getopt.cpp
#include <cerrno>
#include <cstdlib>
#include <cstring>
#if defined(REPLACE_GETOPT)
int opterr = 1; /* if error message should be printed */
i... | TOOL | 0.895804 | 6.707003 |
5e625039-50ef-42d3-b37f-940ce7f11b06 | mpfeifer1/Kattis | meowfactor.cpp | // Michael Pfeifer
// Version 04, 2018/02/17
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
const ld pi ... | ALGO | 0.999989 | 5.184944 |
f1af37ba-d6c1-4396-94e7-672c7b5d41de | shreyasvbhat/CPlusPlus_Porgrams | programs/matix_search.cpp | //Program to find an element in matrix
#include<iostream>
using namespace std;
int main(){
int n,m;
cout<<"Enter the order:\n";
cin>>n>>m;
int a[n][m];
cout<<"Enter the elements:\n";
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>a[i][j];
}
}
int target;
... | ALGO | 0.998282 | 4.228403 |
5ac725f9-ccd7-403b-9747-340ad91e3bbc | Sysmic-Robotics/old-robocup-software-robojackets | soccer/src/soccer/planning/planner/path_target_path_planner.cpp | #include "planning/planner/path_target_path_planner.hpp"
#include <utility>
#include <spdlog/spdlog.h>
#include "planning/instant.hpp"
#include "planning/planner/plan_request.hpp"
#include "planning/primitives/velocity_profiling.hpp"
#include "planning/trajectory.hpp"
using namespace rj_geometry;
namespace plannin... | TOOL | 0.948764 | 7.536818 |
34ba83bd-129d-4228-811c-6ed94881d8f1 | kuno4n/TopCoder | src/570-div2-1000/CentaurCompanyDiv2.cpp |
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#def... | ALGO | 0.996868 | 3.942638 |
a255eda3-545b-44b3-b603-e0303cc10292 | Ignat-Kononenko/Course1 | 1semestr/ОАИП/лаб. 15 c++/Project1/Project1/Source.cpp | #include<iostream>
using namespace std;
float integ(float(*) (float), float, float, float);
float f(float); //
float integ(float(*f) (float), float a , float b, float n) {
float x = a,s=0,h;
h = (b - a) / n;
while (x < (b - h))
{
s += h * (f(x)+f(x+h));
x = x + h;
}
return s / 2;
}
int main()
{
setloc... | ALGO | 0.999864 | 4.254737 |
42f2b96d-5a1f-4c3a-8ebc-b9854b1a0ea8 | aqsis/aqsis | libs/core/geometry/marchingcubes.cpp | /** \file
\brief MarchingCubes Algorithm
\author Thomas Lewiner <<EMAIL>>
\author Math Dept, PUC-Rio
\version 0.2
\date 12/08/2002
*/
#ifndef _WIN32
#pragma implementation
#endif // AQSIS_SYSTEM_WIN32
#include <aqsis/aqsis.h>
#include <cstring> // for memcpy, memset
#include <math.h>
#include... | ALGO | 0.998721 | 3.421213 |
12c8e4d4-f648-4d0b-b91e-a537d307de50 | ishandutta2007/codeforces | yutaka1999/normal/367/B.cpp | #include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <vector>
#define SIZE 200005
using namespace std;
typedef long long int ll;
vector <int> vx,ans;
int sum[SIZE*2],now[SIZE*2];
int in[SIZE],ob[SIZE];
int cnt;
void add(int x)
{
cnt-=sum[x]==now[x];
now[x]++;
cnt+=sum[x]==now[x];
... | ALGO | 0.999996 | 3.247391 |
695abb57-c815-44a9-9f64-64ca5dc93d4e | stevens-crag/crag | ranlib/src/linpack.cpp | #include <math.h>
float sdot(long n,float *sx,long incx,float *sy,long incy)
{
static long i,ix,iy,m,mp1;
static float sdot,stemp;
stemp = sdot = 0.0;
if(n <= 0) return sdot;
if(incx == 1 && incy == 1) goto S20;
ix = iy = 1;
if(incx < 0) ix = (-n+1)*incx+1;
if(incy < 0) iy = (-n+1)*incy+1;
f... | ALGO | 0.999978 | 3.552643 |
874e59b4-4c9d-4293-9464-4599860df18f | arpan-xalxo/MovieDexApp | ani_dex_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.998799 | 6.76073 |
cd670f8f-3154-4a6f-ba11-66284d4aeeea | MohamedIrfanAM/cp | AoC2024/2b.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define pb push_back
#define endl "\n"
#define all(p) p.begin(), p.end()
#define fi first
#define se second
const int mod = 1e9 + 7;
#ifdef IRFAN_DEBUG
#define bug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename... | ALGO | 0.999492 | 4.81306 |
a071ae76-1f2f-4efd-bc3f-88f8fb47b9fd | TSGames/Libraw-Android | app/src/main/ndk/Libraw_Open/jni/src/internal/wf_filtering.cpp | #define P1 imgdata.idata
#define S imgdata.sizes
#define O imgdata.params
#define C imgdata.color
#define T imgdata.thumbnail
#define IO libraw_internal_data.internal_output_params
#define ID libraw_internal_data.internal_data
int LibRaw::wf_remove_banding()
{
#define WF_IMGMODE_BAYER4PLANE 4
#define WF_IMGMODE_BAYER1... | TOOL | 0.966598 | 3.415218 |
b224d398-28d3-4ada-a8d3-88362abcd2f9 | tausif39/Leetcode | 2453-destroy-sequential-targets/2453-destroy-sequential-targets.cpp | class Solution {
public:
int destroyTargets(vector<int>& nums, int space) {
int n=nums.size();
int k=space;map<int,int> p;
for(auto i : nums)
p[i%k]++;
sort(nums.begin(),nums.end());
int l=0,id;
for(auto i : nums)
{
if(l<p[i%k])
... | ALGO | 0.999992 | 5.367815 |
6ae0ed03-322e-48da-a061-2d5e48499482 | Shadab9/DSA-problems | 329-longest-increasing-path-in-a-matrix/329-longest-increasing-path-in-a-matrix.cpp | class Solution {
public:
int check(vector<vector<int>>&matrix,int i,int j,int row,int col,vector<vector<int>>&result)
{
if(result[i][j]>0)
return result[i][j];
vector<int>dx={1,-1,0,0};
vector<int>dy={0,0,1,-1};
int count=0;
for(int k=0;k<4;k++)
... | ALGO | 0.999991 | 6.042672 |
28bf16cb-d15a-4803-9010-63f3956508e3 | csj0oe/3D-Raytracing | ext/nanogui/ext/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Eigen::MatrixXf m(2,4);
Eigen::VectorXf v(2);
m << 1, 23, 6, 9,
3, 11, 7, 2;
v << 2,
3;
MatrixXf::Index index;
// find nearest neighbour
(m.colwise() - v).colwise().squaredNorm()... | ALGO | 0.999949 | 4.138078 |
5115b135-cf72-4278-917e-782ce41183b5 | nilaysrivastava/DSA | Basic Recursion/reverseArr.cpp | // Reverse a given Array
// Problem Statement: You are given an array. The task is to reverse the array and print it.
// Examples:
// Example 1:
// Input: N = 5, arr[] = {5,4,3,2,1}
// Output: {1,2,3,4,5}
// Explanation: Since the order of elements gets reversed the first element will occupy the fifth
// position, t... | ALGO | 0.999333 | 6.056324 |
a6abcc95-e465-4b22-9af2-f846c8bea702 | cc031023/LeetCodeProblemSet | 2023.04.20LeetCode_0232.cpp | // 两个栈模拟.
class MyQueue
{
public:
stack<int> s1, s2;
MyQueue() {}
void push(int x)
{
s1.push(x);
}
int pop()
{
if (s2.empty())
{
while (!s1.empty())
{
s2.push(s1.top());
s1.pop();
}
}
... | ALGO | 0.999709 | 4.897376 |
52ea73e9-6e68-41b3-93d5-d7d8ca7d3696 | hoarffrost/loving-DSA | Recursion 1/All Programs/recurion 1 lecture programs/first_index_of_a_number.cpp | // Given an array of length N and an integer x, you need to find and return the first index of integer x present in the array. Return -1 if it is not present in the array.
// First index means, the index of first occurrence of x in the input array.
// Do this recursively. Indexing in the array starts from 0.
// Input F... | ALGO | 0.999952 | 5.483787 |
e810506b-40df-4b1f-b246-de58bfe030dc | lexasy/DA_labs | lab7/main.cpp | #include <bits/stdc++.h>
size_t find_min_idx(std::vector<int64_t> vec)
{
int64_t min = 0;
for (size_t i = 1; i < vec.size(); ++i)
{
if (vec[i] < vec[min])
{
min = i;
}
}
return min;
}
int main()
{
int64_t rows, columns;
std::cin >> rows >> columns;
s... | ALGO | 0.999898 | 4.314867 |
1b6d01e9-3281-44ea-aadc-31f126799a11 | yongwhan/codeforces | 599A.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int d1,d2,d3; cin>>d1>>d2>>d3;
cout << min({d1+d2+d3, 2*(d1+d2), 2*(d1+d3), 2*(d2+d3)}) << endl;
return 0;
}
| ALGO | 0.999622 | 3.855816 |
30457e3b-6801-48a0-af78-92ad27c082d5 | raincross7/code-similarity | codes/train_code/problem414/problem414_225.cpp | // In The Name Of Allah
// Mohammad Hosseini
#include <bits/stdc++.h>
#define ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se... | ALGO | 0.999989 | 4.630394 |
4c2fd66e-13ce-4a4f-b3ca-4ef64161aa61 | parambedi1453/codes | NO_OF_ROTATIONS_BINARY.cpp | /*
Counting number of rotation in circulary sorted array
No of rotation is equal to index of min element or the pivot element that is
where the prev and the next element both are greater than the mid element
next = (mid+1)%n; so that if mid points to last then mid+1 point to first
prev = (mid+n-1)%n; so that is mid p... | ALGO | 0.999993 | 5.113211 |
0b5ac972-450e-4696-89da-d18a1756741e | Denomantl/yes | bigint.inc.cpp | // TODO
#include <iostream>
#include <utility>
#include <vector>
class bigint{
std::vector<char> number;
public:
explicit operator unsigned int()const{
unsigned int answer = 0;
unsigned mult = 1;
for (unsigned int i = number.size(); i != 0; i--){
answer+=number[i]*mult;
... | ALGO | 0.995634 | 4.73049 |
9e78a6bd-5510-4378-9e7e-dd6f1f09b848 | oxygen-hunter/Flashboom | data/leetcode_cpp/find-xor-beauty-of-array.cpp | // Time: O(n)
// Space: O(1)
// bit manipulation, math
class Solution {
public:
int xorBeauty(vector<int>& nums) {
return accumulate(cbegin(nums), cend(nums), 0, [](int a, int b) {
return a ^ b;
});
}
};
| ALGO | 0.999972 | 5.832813 |
cfc8a8ea-0b15-4599-ba91-d926415597f2 | sinian666/codes_41_14 | cpp_副本13/chapter_searching/hashing_search.cpp | /**
* File: hashing_search.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 哈希查找(数组) */
int hashingSearchArray(unordered_map<int, int> map, int target) {
// 哈希表的 key: 目标元素,value: 索引
// 若哈希表中无此 key ,返回 -1
if (map.find(target) == map.end())
return -... | ALGO | 0.999718 | 5.437144 |
7a2f7a18-f970-470b-a701-6817bf0db8a5 | Aman0106/DSA-Learning | Love Babbar DSA/OperartionsOnArrays/mergeSortedArray.cpp | #include <iostream>
#include<vector>
using namespace std;
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int p1=0;
int p2=0;
vector<int> temp;
while(p1 < m && p2 < n){
if(nums1[p1] <= nums2[p2]){
temp.push_back(nums1[p1++]);
}
else
... | ALGO | 0.999902 | 4.955788 |
5c81e160-afa0-478c-aec3-d992bf2872da | Abhinav2604/Competitive-Programming | Codeforces/road.cpp | #include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#defi... | ALGO | 0.99995 | 3.057274 |
5a56d9c9-9a41-4027-aa95-b5ce2d9e77c3 | Mohitpanjikar/Codechef | ARRSWAP.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
//initializing variables
int n;
cin>>n;
int arr_a[n];
int arr_b[n];
vector<int> intotal_Array;
//value inserting in the array
for(int i=0;i<n;i++)
... | ALGO | 0.999978 | 3.941033 |
647626df-1496-4aa4-9ccc-c001d6594876 | KooroshNaderi/DiscoveringClimbingMoves | DiscoveringClimbingMovements/ode-0.12/ode/demo/demo_motor.cpp | #include <ode/ode.h>
#include <drawstuff/drawstuff.h>
#include "texturepath.h"
#ifdef _MSC_VER
#pragma warning(disable:4244 4305) // for VC++, no precision loss complaints
#endif
// select correct drawing functions
#ifdef dDOUBLE
#define dsDrawBox dsDrawBoxD
#endif
// some constants
#define SIDE (0.5f) // side leng... | ALGO | 0.897424 | 4.898517 |
15264352-4fde-4dcc-bf44-4d385f6a2f8e | epilex63/Calculator | Source.cpp | #include <iostream>
#include <math.h>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <math.h>
using namespace std;
struct Lecsema
{
char Cheker; // 'c' -cos ; 's' - sin; 't' - tg; 'e' - exp; '^' - , 'p' -
double value;
};
int Rang(char Operator) {
if (Operator == '^') {
return 3... | ALGO | 0.999778 | 3.759693 |
70860917-a7dc-41c2-afae-8d7bfe62e628 | Mr-Python-in-China/LuoguProblem | CF1966A.cpp | #include <bits/extc++.h>
using namespace std;
namespace pbds = __gnu_pbds;
using ui = unsigned int;
using uli = unsigned long long int;
using li = long long int;
int main(void) {
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
size_t T;
cin >> T;
while (T--) {
size_t n, k;
cin >> n >> ... | ALGO | 0.999899 | 3.915359 |
c2af1717-0bcc-40b7-aecf-1328fd4233b4 | Ali-hey-0/Bullet-Physics-SDK | examples/TinyRenderer/our_gl.cpp | #include <cmath>
#include <limits>
#include <cstdlib>
#include "our_gl.h"
#include "Bullet3Common/b3MinMax.h"
namespace TinyRender
{
IShader::~IShader() {}
Matrix viewport(int x, int y, int w, int h)
{
Matrix Viewport;
Viewport = Matrix::identity();
Viewport[0][3] = x + w / 2.f;
Viewport[1][3] = y + h / 2.f;
Vie... | ALGO | 0.947116 | 6.018985 |
a46b4091-336c-450c-9ab3-f16e74eb030c | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/party/kosaraju/test/6551d195-02b2-11ec-b095-2cf05d84bfc2.cpp | #include <cstdio>
#include <vector>
using namespace std;
vector<int> v[210],vt[210];
int q[210],n,nr;
char vaz[210],sol[210];
int non(int x)
{
if(x<=n) return x+n;
else return x-n;
}
void add_edge(int x,int y)
{
v[x].push_back(y);
vt[y].push_back(x);
}
void dfs1(int nod)
{
vaz[nod]... | ALGO | 0.99999 | 3.670162 |
d14dd158-754e-4c98-a25e-33eb92bab113 | Aniypon/leetcode | 1014-k-closest-points-to-origin/1014-k-closest-points-to-origin.cpp | class Solution {
public:
vector<vector<int>> kClosest(vector<vector<int>>& points, int k) {
vector<vector<int>> ans;
priority_queue<vector<int>, vector<vector<int>>, greater<>> minHeap;
for(vector<int> c: points){
int x = c[0], y = c[1];
minHeap.push({x*x+y*y, x, y}... | ALGO | 0.999998 | 5.91742 |
648768b9-515c-420a-9ebc-956d4770487c | coldMater/bigstone_algorithm | 4J_14391.cpp | // https://www.acmicpc.net/problem/14391
#include <bits/stdc++.h>
using namespace std;
int N, M, n;
char m[4][4];
int mr;
string l;
int main () {
cin >> N >> M;
for (int i = 0; i < N; ++i) {
cin >> l;
for (int j = 0; j < M; ++j) {
m[i][j] = l[j];
// cout << m[i][j] << " ";
}
// cout << ... | ALGO | 0.99993 | 5.007617 |
b7e6be9d-6ac2-46f0-819c-240d88561d3c | hwngtr/BigIntCalculator | BigInt.cpp | #include "BigInt.h"
#include <algorithm>
#include <stdexcept>
using namespace std;
BigInt::BigInt(const string& s) {
if (s.empty()) throw runtime_error("Empty number");
size_t start = 0;
isNegative = false;
if (s[0] == '-') {
isNegative = true;
start = 1;
}
// Va... | ALGO | 0.991465 | 6.639536 |
e5e69773-6064-4496-a5d4-7097ef3025a9 | imakathuria/Practice | Graphs Implementation/Graph.cpp | #include<iostream>
#include <bits/stdc++.h>
using namespace std;
//print the graph using DFS
void print(bool **edges,int n,int startingVertex,bool *visited){
cout<<startingVertex<<endl;
visited[startingVertex]=true;
for(int i=0;i<n;i++){
if(i==startingVertex){
continue;
}
... | ALGO | 0.999993 | 4.73455 |
98614e6f-1767-43e7-a6d1-2d5a90bba449 | raincross7/code-similarity | codes/train_code/problem102/problem102_251.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long... | ALGO | 0.99985 | 3.558192 |
1a1e692b-d47b-478c-9dc1-7576d3cb1762 | cristina763/ArduPilot | libraries/AP_Common/tests/test_sorting.cpp | #include <AP_gtest.h>
/*
tests for AP_Common/sorting.cpp
*/
#include <AP_Common/AP_Common.h>
#include <AP_Common/sorting.h>
#include <stdlib.h>
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL || CONFIG_HAL_BOARD == HAL_BOARD_LINUX
static int comp16(const uint16_t *v1, const uint16_t *v2) {
return int32_t(*v1) - int32... | TEST | 0.912952 | 7.448337 |
bc78ec33-6169-4afa-80bb-5cc3240869a9 | erhant/parallel-programming | projects/first-primes/src/main.cpp | #include "first-primes.hpp"
int main(int argc, char **argv) {
// default parameters
unsigned int n = 100;
runtype_e runType = SERIAL;
// overrides
for (int ac = 1; ac < argc; ac++) {
if (MATCH_ARG("-n")) {
int x = atoi(argv[++ac]);
n = x < 0 ? -x : x; // rather than underflow, just flip it
... | ALGO | 0.968142 | 5.194227 |
ec607b56-1abd-4801-95f0-d09f0479c53e | mikebrandin/Programming-in-CPP | labs/lab3/main.cpp | /*
Mike Brandin
CPSC 1021
January 30th, 2020
*/
#include "stddev.h"
#include <iostream>
using namespace std;
int main()
{
int n = 0;
cout << "Please type the size of your array : " << endl;
cin >> n;
float* data = new float[n];
for(int i = 0; i < n; i++)
{
data[i] = (i+1)*4;
cout <<... | ALGO | 0.959384 | 3.849223 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.