uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3e106fd7-dc05-4122-a8a5-b43f34a00f7e | Abhinav7076/My-Codes | LeetCode-Solutions-master/C++/maximum-profit-of-operating-a-centennial-wheel.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
int minOperationsMaxProfit(vector<int>& customers, int boardingCost, int runningCost) {
int max_run = -1;
for (int i = 0, prof = 0, run = 1, waiting = 0, max_prof = 0;
i < size(customers) || waiting > 0; ++run) {
if (i ... | ALGO | 0.999726 | 5.509565 |
dc52b41a-934c-4407-9df1-1c7b3ced81de | ishandutta2007/codeforces | oscar114514/normal/1373/D.cpp | #include<bits/stdc++.h>
using namespace std;
int T,n,m,k;
int a[233333],s[233333],ss[233333];
int main()
{
ios_base::sync_with_stdio(false);
cin>>T;
while(T--)
{
cin>>n;
long long sum=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(i%2==1)sum+=a[i];
}
long long tmp=0,maxx=0;
for(int i=1;i<n;i+=2)
{
... | ALGO | 0.999909 | 4.22204 |
e7991a0e-4a8e-4d76-8fb6-3462fc81dbbe | MKXJun/XJudge | Release/Problems/Data Structure and Algorithm/2005 Array--Rotate Image [2]/test.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
void rotate(vector<vector<int> >& matrix);
int main()
{
vector<vector<int> > image;
int num, n;
cin >> n;
image.resize(n);
for (int i = 0;i < n;++i)
{
image[i].resize(n);
for (int j = 0;j < n;++j)
cin >> image[i][j];
}
clock_t r... | ALGO | 0.999393 | 4.153803 |
8033e571-3dff-44fa-95e7-a1dae6739c14 | Jahanvi09/DS-and-ALGO | Linked List 1/AppendLastNToFirst.cpp | /*You have been given a singly linked list of integers along with an integer 'N'. Write a function to append the last 'N' nodes towards the front of the singly linked list and returns the new head to the list.
Input format :
The first line contains an Integer 't' which denotes the number of test cases or queries to be ... | ALGO | 0.999563 | 5.866256 |
1148bcad-f475-4622-9278-fca330b97021 | Sandip-Kanzariya/Codeforces | Daily Dose/262_A_Where_do_I_Turn.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <numeric>
#include <iomanip>
using namespace std;
const int N = 1e7;
using I = int;
using SI = short int;
using LI = long int;
using LLI = long long int;
using ... | ALGO | 0.99995 | 4.06916 |
a10855a7-5eae-4860-a323-e6426a3f5e98 | jiakanglee/Codes-written-when-in-LZU | C++ experiment course work/c++实验课题目/1_数据表示与程序控制/exp 1.5 .cpp | #include <iostream>
using namespace std;
int main()
{
int operand1,operand2;
char operator1;
cout << "Please input arithmetic expression:" << endl;
cin >> operand1 >> operator1 >> operand2;
double result;
while(operand1 != 0 && operator1 !='0' && operand2 != 0)
{
switch(operator1)
{
... | ALGO | 0.91752 | 3.098152 |
f813efd7-e650-443b-82a8-9a6a55fa947a | Dup4/competitive-programming | jisuanke/3005/b.cpp | #include <bits/stdc++.h>
using namespace std;
namespace IO {
const int S = (1 << 20) + 5;
// Input Correlation
char buf[S], *H, *T;
inline char Get() {
if (H == T)
T = (H = buf) + fread(buf, 1, S, stdin);
if (H == T)
return -1;
return *H++;
}
inline int read() {
int x = 0, fg = 1;
ch... | ALGO | 0.999942 | 4.042161 |
b5cfb376-f543-4fdb-b89a-8770760adfea | LannyOakman/CS2082001-Homework-2-Group-6 | main.cpp | #include "SidePile.h"
#include <iostream>
#include "Deck.h"
void takeFromPile(Deck& my_deck, SidePile& my_sidepile) {
if (my_deck.getSize() >= 1) {
return;
}
else if (my_deck.getSize() < 1 && my_sidepile.getSize() > 0) {
my_deck.enqueue(my_sidepile.pop());
return;
}
throw std::underflow_error("Side Pile Emp... | ALGO | 0.948808 | 4.288786 |
d2d1f842-01c3-4526-94cd-cb4a46b16bad | knuu/competitive-programming | atcoder/past/past201912_m.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x... | ALGO | 0.999624 | 4.197082 |
42be0c2a-8b7c-4d08-9f23-57569de3c65a | alexanderkjeldaas/boost-mirror | libs/numeric/odeint/examples/harmonic_oscillator_units.cpp | #include <iostream>
#include <vector>
/* WARNING: Compilation in debug mode might consume enormous memory
(e.g. ~2GB on gcc 4.4 )
*/
// first increase fusion macro variables (now done by odeint itself)
//#define BOOST_FUSION_INVOKE_MAX_ARITY 15
//#define BOOST_RESULT_OF_NUM_ARGS 15
//[ units_define_basic_quanti... | ALGO | 0.900246 | 7.369054 |
82a69af2-ba45-4d10-b527-9e803ea56dd7 | farruhha/mentorship | src/problems/w3resource/NextLetter.cpp | // Write a C++ program to change every letter in a given string with the letter following it in the alphabet (i.e. a becomes b, p becomes q, z becomes a).
//Example:
//Sample Input: w3resource
//Sample Output: x3sftpvsdf
#include <iostream>
using namespace std;
string findLetter(string& text)
{
int code_position;... | ALGO | 0.986373 | 3.729049 |
c625f3b7-9c9d-44c2-b485-301af0830135 | Mahirshadid/codes_on_the_run | LongestSubStr.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s = "abcabcbdb",str;
int l = s.size();
int j=0;
unordered_map<char, int> freq;
for(int i=0;i<l;i++){
freq[s[i]]++;
if(freq[s[i]]==2){
str+=s[i];
}
}
cout<<str.size();
}
| ALGO | 0.999936 | 4.238439 |
6c74293d-ebfd-4413-8cd2-62f39112400e | yingziyu-llt/program_in_univ | programmingDesign/18/4.cpp | #include <algorithm>
#include <iostream>
using namespace std;
struct Node {
string name;
int cost, ddl;
int current_time;
int value() const {
auto relu = []( int x ) -> int { return x < 0 ? 0 : x; };
return relu( current_time + cost - ddl );
}
bool operator<( Node& rhs ... | ALGO | 0.999912 | 3.972085 |
f339aa24-6761-4aff-8ab0-b85b135ccd44 | robertshepherdcpp/codelite-git-files | for_storing_code/main.cpp | //template<typename T>
//class HeapArray {
//private:
// T* arr;
// int array_size;
// HeapArray(HeapArray&& to_move); // move constructor
//};
//
//template<typename T>
//HeapArray<T>::HeapArray(HeapArray&& to_move) { // move constructor definition
// array_size = to_move.array_size;
// arr = to_mo... | TOOL | 0.976364 | 3.890458 |
9bc1770e-6274-4484-9995-4de3334771a0 | MohamedAmirr/Competitive-Programming | Codeforces Gyms/100971 - 2016, IX Samara Regional Intercollegiate Programming Contest/G.cpp | //#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define besmellah ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const ll INF = 1e9 + 7;
const int OO = 0x3f3f3f3f;
c... | ALGO | 0.999825 | 3.692501 |
0f5ae08e-a228-448f-89a8-33da2e9110fa | dip4012/Striver_SDE_Sheet | Stack and Queue Part 2/LFU_cache.cpp | #include <bits/stdc++.h>
using namespace std;
class LFUCache
{
// key: frequency, value: listt of all key-value pairs with the same frequency. most recent accesed is at the end of the list.
unordered_map<int, list<pair<int, int>>> frequencies;
// key: key, value: frequency and the iterator to the correspo... | ALGO | 0.999421 | 5.875329 |
d50acc83-aa1e-403b-9546-7011243754e8 | tanvir-50198/Problem_Solving | code_forces_problem_solve/B_Studying_Algorithms.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,x;
cin>>n>>x;
vector<int>v(n);
for(int i=0;i<n;i++)cin>>v[i];
sort(v.begin(),v.end());
int sum=0,cnt=0;
for(int i=0;i<n;i++)
{
sum+=v[i];
if(sum<=x)
{
cnt++;
... | ALGO | 0.999988 | 4.038539 |
796180f6-7561-45fc-af9b-a53780e79a2e | Manisha152/GFG23 | Recursion/Trying_out _hard_problem/4m.cpp | ERROR: type should be string, got "\nhttps://practice.geeksforgeeks.org/problems/rat-in-a-maze-problem/1?utm_source=youtube&utm_medium=collab_striver_ytdescription&utm_campaign=rat-in-a-maze-problem\n\nclass Solution{\n \n void solve(int i,int j,vector<vector<int>>&m,int n,vector<string>&ans,string s, vector<vector<int>>&vis)\n {\n if(i==n-1 && j==n-1){\n ans.push_back(s);\n return;\n }\n\n if(i+1<n && !vis[i+1][j] && m[i+1][j]==1){\n \n vis[i][j]=1;\n solve(i+1,j,m,n,ans,s+\"D\",vis);\n vis[i][j]=0;\n \n }\n \n if(j-1>=0 && !vis[i][j-1] && m[i][j-1]==1){\n \n vis[i][j]=1;\n solve(i,j-1,m,n,ans,s+\"L\",vis);\n vis[i][j]=0;\n \n }\n if(j+1<n && !vis[i][j+1] && m[i][j+1]==1){\n \n vis[i][j]=1;\n solve(i,j+1,m,n,ans,s+\"R\",vis);\n vis[i][j]=0;\n \n }\n if(i-1>=0 && !vis[i-1][j] && m[i-1][j]==1){\n \n vis[i][j]=1;\n solve(i-1,j,m,n,ans,s+\"U\",vis);\n vis[i][j]=0;\n \n }\n\n }\n\nvoid solve(int i,int j,vector<vector<int>>&m,int n,vector<string>&ans,string s, vector<vector<int>>&vis,int di[],int dj[])\n {\n if(i==n-1 && j==n-1){\n ans.push_back(s);\n return;\n\n }\n \n string dir=\"DLRU\";\n \n for(int ind=0;ind<4;ind++)\n {\n int nexti=i+di[ind];\n int nextj=j+dj[ind];\n\n if(nexti>=0 && nextj>=0 && nexti<n && nextj<n && !vis[nexti][nextj] && m[nexti][nextj]==1)\n {\n \n vis[i][j]=1;\n solve(nexti,nextj,m,n,ans,s+dir[ind],vis,di,dj);\n vis[i][j]=0;\n }\n }\n \n }\n public:\n vector<string> findPath(vector<vector<int>>&m, int n) {\n \n /*vector<string>ans;\n vector<vector<int>>vis(n,vector<int>(n,0));\n \n if(m[0][0]==1)\n solve(0,0,m,n,ans,\"\",vis);\n return ans;*/\n\n vector<string>ans;\n vector<vector<int>>vis(n,vector<int>(n,0));\n \n int di[]={1,0,0,-1};\n int dj[]={0,-1,1,0};\n \n if(m[0][0]==1)\n solve(0,0,m,n,ans,\"\",vis,di,dj);\n return ans;\n }\n};\n\n " | ALGO | 0.999946 | 5.927081 |
7e8db640-a904-472a-add4-f7b584d29995 | Johniel/contests | atcoder/digitalarts2012/A/main.cpp | // atcoder/digitalarts2012/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/
#include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
using namespace std;
template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.... | ALGO | 0.999788 | 4.088586 |
49294bd0-73e8-4ded-9de2-456e35cf27bd | Varshh-hub/GFG-solutions-by-VARSHA | Difficulty: Basic/Reverse a String/reverse-a-string.cpp | // User function Template for C++
class Solution {
public:
string revStr(string s) {
// code here
reverse(s.begin(), s.end());
return s;
}
}; | ALGO | 0.99902 | 5.99473 |
95004fef-80e8-486f-9d4a-83f26e620a1c | Lokesh-Kumar-121/leetcode | 0162-find-peak-element/0162-find-peak-element.cpp | class Solution {
public:
int findPeakElement(vector<int>& nums) {
int n=nums.size();
if(n == 1)
return 0;
if(nums[0] > nums[1])
return 0;
if(nums[n-1] > nums[n-2])
return n-1;
int i=0,j=n-1;
int mid;
... | ALGO | 0.999967 | 5.599533 |
afaa608d-86f0-4824-9846-ad04d992efb8 | shacojx/SourceCodeGameTLBB | Game/boost/libs/iterator/example/filter_iterator_example.cpp | #include <boost/config.hpp>
#include <algorithm>
#include <functional>
#include <iostream>
#include <boost/iterator/filter_iterator.hpp>
#include <boost/cstdlib.hpp> // for exit_success
struct is_positive_number {
bool operator()(int x) { return 0 < x; }
};
int main()
{
int numbers_[] = { 0, -1, 4, -3, 5, 8, -2 }... | ALGO | 0.991222 | 5.656033 |
5cb61c72-1dc4-4b70-8007-e87a78324cb8 | SushiStar/LC | medium/IntegerToRoman.cpp | /*
* Given an integer, convert it
* to a roman numeral, input is guaranteed to
* be within the range from 1 to 3999.
*
* Date: March/03/2019
* Author: Wei Du
*/
class Solution {
public:
string intToRoman(int num) {
std::vector<string> M{"", "M", "MM", "MMM"};
std::vector<string> C{"", "C", "... | ALGO | 0.998021 | 6.479438 |
2de2db08-2de6-4f23-8697-a4f3017a1306 | Ajit-Parihar/CPP-Codes-Babber | lecture 45.cpp/Alinkdlistreversebyrecursion.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node * next;
Node(int data){
this->data=data;
this->next=NULL;
}
};
Node* create(int arr[], int n,int index){
//base case
if(index==n){
return NULL;
}
Node* temp;
temp=new Node(... | ALGO | 0.999862 | 4.172326 |
05e7f7ec-5189-4dbe-8a2c-6d7fdf269610 | kunljha/LeetCode | 2614-prime-in-diagonal/2614-prime-in-diagonal.cpp | class Solution {
public:
int diagonalPrime(vector<vector<int>>& a) {
int n = a.size();
int res = 0;
for(int i = 0; i < n; ++i) {
if(isPrime(a[i][i]))
res = max(res, a[i][i]);
if(isPrime(a[i][n-1-i]))
res = max(res... | ALGO | 0.999769 | 5.408028 |
458df263-7bdd-42d5-9680-a14f98a2c2cf | manas6699/All-Data-structures | tree/count_leaf.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
class tree_node
{
public:
T data;
vector<tree_node<T> *> children;
tree_node(T data)
{
this->data = data;
}
};
tree_node<int> *take_input()
{
int root_data;
cout << "Enter root data : ";
cin >> root_data;
... | ALGO | 0.997054 | 5.000178 |
d2cba6fe-568d-4a54-9934-16175060dbeb | Anupkp19/Coding-ninjas-Repository | Coding-Ninjas-Introduction-to-Cpp-and-DSA-in-HINGLISH-master/DSA-with-C++/Lecture-18-DP-1/Code/min-step-to-1-memoization.cpp | #include <iostream>
#include <cmath>
#include <climits>
using namespace std;
// Memoization
int countStepsToOneHelper(int n, int *ans){
if(n <= 1)
return 0;
if(ans[n] != -1)
return ans[n];
int x = INT_MAX, y = INT_MAX, z = INT_MAX;
x = countStepsToOneHelper(n - 1, ans);
if(n % 2 == ... | ALGO | 0.999979 | 5.244721 |
eaa9d773-8d90-4f0b-bd95-9644b458a6c9 | LavanyaRajeswari/Leet_Code | 985-bag-of-tokens/bag-of-tokens.cpp | class Solution {
public:
int bagOfTokensScore(vector<int>& tokens, int power) {
sort(tokens.begin(),tokens.end());
int i = 0,score = 0;
int j = tokens.size()-1;
while(i<=j){
if(tokens[i] <= power){
power-=tokens[i];
score++;
... | ALGO | 0.999981 | 6.13634 |
a58601bf-1c8b-4670-9ea1-3054f9b4e38e | shreyasvbhat/CPlusPlus_Porgrams | programs/buble_sort.cpp | //Program to sort elements using bubble sort
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the limit\n";
cin>>n;
int arr[n];
cout<<"Enter the elements:\n";
for(int i=0;i<n;i++){
cin>>arr[i];
}
//bubble sort algorithm
for(int i=0;i<n;i++){
... | ALGO | 0.999695 | 4.38412 |
29776ca3-3e11-4a04-9530-298a6acfe13f | SreeHaran/CPP-Assignments | Assignment-5(2).cpp | /*Make a class named Fruit with a data member to calculate the number of fruits in a basket.
Create two other class named Apples and Mangoes to calculate the number of apples and mangoes in the basket.
Print the number of fruits of each type and the total number of fruits in the basket.*/
#include <iostream>
using na... | ALGO | 0.956315 | 6.164193 |
e6f91978-ae20-4f30-bbc2-1cccd441c86b | raincross7/code-similarity | codes/train_code/problem053/problem053_91.cpp | /** author: __nishad__ **/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef vector<ll> vll ;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define precision(k) cout<<setprecision(k)<<fixed;
#define loop(i,a) for(int i=0; i<a;i++)
#de... | ALGO | 0.998427 | 3.490691 |
2a3eb4d4-fce5-4549-a61f-fc106a36a0a5 | ansh04196/DSA-Daily | Stock Buy and Sell – Multiple Transaction Allowed.cpp | class Solution {
public:
int maximumProfit(vector<int> &prices) {
// code here
int profit=0;
int n=prices.size();
for(int i=1; i<n; i++){
if(prices[i]>prices[i-1]) profit+=prices[i]-prices[i-1];
}
return profit;
}
};
| ALGO | 0.99945 | 5.864915 |
20e0649b-e279-4db3-9a98-99d5a2b862cf | tmuttaqueen/ContestTemplateLibrary | Zahin Vai Code/Directed MST.cpp | #include <bits/stdtr1c++.h>
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
#define dbg(x) cout << #x << " = " << x << endl
#define ran(a, b) ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a))
using namespace std;
struct Edge{
int u, v, w;
Edge(){}
Edge(int a, ... | ALGO | 0.999766 | 4.130574 |
1d6c9956-f5ff-4054-aba9-0186f1eee557 | ishandutta2007/codeforces | fivedemands/normal/1186/E.cpp | #include<bits/stdc++.h>
#define pc __builtin_popcountll
using namespace std;
typedef long long ll;
int n,m,q;
ll dp[9][9];
char c[1001][1001];
ll pf[1001][1001];
void funny(){
for(int i=1; i<=n ;i++){
for(int j=1; j<=m ;j++){
pf[i][j]=pf[i-1][j]+pf[i][j-1]-pf[i-1][j-1]+c[i][j]-48;
}
}
}
ll qr(ll x,ll y){
ll r... | ALGO | 0.999797 | 4.259815 |
9729dbc9-d8d9-4d42-b1c4-ff975d5f8e3f | squaresLab/BatFix | results/transcoder/translations/java/PRINT_NUMBER_ASCENDING_ORDER_CONTAINS_1_2_3_DIGITS.cpp | static std :: string printNumbers ( vector < int > numbers ) {
vector < int > array ;
for ( int number : numbers ) {
if ( findContainsOneTwoThree ( number ) ) {
array . push_back ( number ) ;
}
}
sort ( array . begin ( ) , array . end ( ) ) ;
std :: string strbuf ;
vector < int > :: iterator i... | ALGO | 0.996641 | 4.887674 |
40faa638-405a-43ac-9951-78037c08052a | pbraga88/exercism | workspace/cpp/sieve/sieve.cpp | #include "sieve.h"
namespace sieve {
std::vector<int> primes(int limit) {
std::vector<bool> is_sieve(limit+1, true);
std::vector<int> prime_list;
prime_list.reserve(limit/2);
for (int i = 2; i <= limit; i++) {
for (int j = i*i; j <= limit; j+=i) {
is_si... | ALGO | 0.999612 | 5.562273 |
f6a92557-dc7e-4426-abe5-16557f7a91d0 | TinkerBoard-Android/rockchip-android-external-skqp | src/compute/hs/cl/bench/sort.cpp | //
// Sort 1m 64-bit keys on Intel Core i7-7820HQ
//
// std::sort(std::execution::par_unseq)() : 23 msecs
// std::sort() : 88 msecs
// qsort() : 166 msecs
//
#include <stdint.h>
#include <chrono>
//
// Note: Visual C++ 2017 requires the following switches:
/... | ALGO | 0.998924 | 5.775912 |
76e61f55-ad89-41cb-bf74-02838b30be9b | Dowgen/Practise-Of-Books | C++primer 5th/1.11.cpp | #include<iostream>
using namespace std;
int main(void){
int i=0,j=0;
cout<<"请输入两个整数:"<<endl;
cin>>i>>j;
if(i>j){
for(;j<=i;j++){
cout<<j<<endl;
}
}else if(i<j){
for(;i<=j;i++){
cout<<i<<endl;
}
}else if(i=j)
cout<<i<<endl;
return 0;
}
| ALGO | 0.999424 | 3.335034 |
2d0e42cd-0e91-45d6-8b7c-0e8fd7a2d69e | ANI-IN/leetcode | 0169-majority-element/0169-majority-element.cpp | class Solution {
public:
int majorityElement(vector<int>& nums) {
int n=nums.size();
int e=0,c=0;
for(int i=0;i<n;i++)
{
if(c==0)
{
e=nums[i];
c=1;
}
else if(e==nums[i])
{
... | ALGO | 0.999888 | 5.617733 |
48457867-2b2f-40ad-86df-8a1031f2ba49 | chrysante/Worldmachine | Worldmachine/Core/Network/NetworkTraversal.cpp | #include "NetworkTraversal.hpp"
#include "Network.hpp"
#include <utl/hashset.hpp>
namespace worldmachine {
NetworkIterator::NetworkIterator(Network const* network,
std::size_t beginIndex,
Direction dir,
bool traverseUnique):
visited(network->nodes.size()),
traverseUnique(traverse... | ALGO | 0.997529 | 6.771049 |
0bee9932-b275-467b-8532-7c249ae8b84d | CSI-SRM-NCR-Chapter/100-Days-of-Code | Tanmay Jaiswal/day-60/60b_leetcode_228.cpp | class Solution {
public:
vector<string> summaryRanges(vector<int>& nums) {
int n = nums.size();
vector<string> res;
int i=0, j=0;
while (j<n) {
i = j;
while (j+1 < n && nums[j]+1 == nums[j+1]) j++;
if (i<j) res.push_back(to_s... | ALGO | 0.999961 | 6.563828 |
769130a7-ca2f-4fd9-8b06-2373caa9b6c2 | ris-2107/coding-practise | rough/practise.cpp | #include <bits/stdc++.h>
using namespace std;
int noOfWays(int src, int n){
if(n==0) return 1;
}
int main(){
int arr[] = {1,2,78,50,23,40,42,34,36,8,9,340, 289,286,299, 190,178,179,4};
int sz=sizeof(arr)/sizeof(arr[0]);
sortArray(arr,sz);
for(auto ele:arr){ cout << ele << ", ";}
cout << endl;
return 0;
} | ALGO | 0.999352 | 3.578723 |
03ff6907-c5c9-474e-98f0-150dc4287ace | wookim0719/codingTest-practices | baekjoon_3474.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
cin>>n;
for(int i=0; i<n; i++){
int value;
int value_2=0;
int value_5=0;
cin >>value;
for(int j=2; j<=value; j*=2){
value_2+= value/j;
}
for(int j=5; j<=value; j*=5){
... | ALGO | 0.999916 | 3.695282 |
f6b3c3dc-9751-4b99-a5d4-955a83db62ee | alexandraback/datacollection | solutions_2645486_0/C++/Krazul/crypt.cpp | #include <iostream>
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
using namespace std;
// activity, energy
int dp[20][20];
int v[20];
int main() {
int t; cin >> t;
for (int test = 1; test <= t; ++test) {
cout << "Case #" << test << ": ";
int e, r, n; cin >> e >>... | ALGO | 0.999982 | 3.999076 |
d7f4d5e5-d8aa-4df2-8062-5a9bd95ec0bb | hwa-yeon/BOJ | 10799.cpp | #include <iostream>
#include <stack>
#include <string>
#include <cstring>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string str;
cin >> str;
int result = 0;
char before = '(';
stack<char> S;
for (int i = 0; i < str.length(); i++) {
if (str[i] == '(') {
... | ALGO | 0.999316 | 4.206094 |
7b869c29-7e2e-474e-bcfa-ac34ea3080c6 | hg5fm/Nexus | src/core/kernel.cpp | #include <boost/assign/list_of.hpp>
#include "core.h"
#include "unifiedtime.h"
#include "../wallet/db.h"
#include "../wallet/wallet.h"
#include "../main.h" //for pwalletmain
#include "../LLD/index.h"
using namespace std;
/** Locate the Add Coinstake Inputs Method Here for access. **/
namespace Wallet
{
bool CWall... | ALGO | 0.975079 | 5.406024 |
d67259c5-b1b4-4e7d-b79f-01d490782099 | madeline12/CSC-110 | Program 2.cpp | // Madeline Navarro
// CSC 110 - Introduction to Computing
// Program 2.cpp - Determines whether an entered integer is positive or negative, and whether it is even or odd.
// 3/30/16
#include <iostream>
using namespace std;
int main()
{
int x,r;
char ans;
do
{
cout << "Enter an integer: ";
cin >> x;
r=x%2;
... | ALGO | 0.961875 | 3.86609 |
07cb22d6-8c6f-4814-bbf9-bf58e32670fd | arunnsit/allcodes | files/415c.cpp | #include<iostream>
using namespace std;
int prime[1000009]={0},sieve[10000009]={0};
int main(){
int i,j,k,pos=0,n,x,a,b;
for(i=2;i<100000;i++){
if(sieve[i]==0)
for(j=2*i;j<10000000;j+=i)
sieve[j]++;
}
for(i=1;i<10000000;i++)if(sieve[i]==0)prime[pos++]=i;
cin>>n>>k;
if(k==0&&n==1)cout<<"1\n";
else if(... | ALGO | 0.99994 | 3.756562 |
9f6509ac-0671-45d1-a343-42cdd782c61e | VancleyVieira/Estudando-C | Lista de vetores/ex6.cpp | #include <stdio.h>
#include <stdlib.h>
main(){
int A[10] = {1,2,3,4,5,6,7,8,9,10};
int B[10] = {};
printf("\nO dobro de cada elemento do vetor A no vetor B: \n\n");
for(int i = 0; i < 10; i++){
B[i] = A[i] * 2;
printf("Vetor A: %d ",A[i]);
printf("Vetor B: %d \n",B[i]);
... | ALGO | 0.922675 | 3.811966 |
c4c9510a-fc43-4ecc-b1f4-e23191d75091 | ValveSoftware/source-sdk-2013 | src/game/server/physics_fx.cpp | // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
static int BestAxisMatchingNormal( matrix3x4_t &matrix, const Vector &normal )
{
float bestDot = -1;
int best = 0;
for ( int i = 0; i < 3; i++ )
{
Vector tmp;
MatrixGetColumn( matrix, i, tmp );
float dot = fabs(DotProduct... | ALGO | 0.902772 | 6.75957 |
4d27ebee-418e-4cc1-a880-bc08e3894832 | Mellow-Sky/code | CpEditor_code/240703A.cpp | // Problem: A. Upload More RAM
// Contest: Codeforces - EPIC Institute of Technology Round Summer 2024 (Div. 1 + Div. 2)
// URL: https://codeforces.com/contest/1987/problem/A
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
const int N = 1e3;
us... | ALGO | 0.999889 | 4.032409 |
726f3e1b-db86-419b-8db5-1f54a4660492 | nutboltu/programming-problem-solutions | uva.online.judge/694 - The Collatz Sequence.cpp | #include<iostream>
#include<cstdio>
using namespace std;
long long L;
long long numofTerms(long long a,long long t)
{
if(a ==1)return t;
if(a>L) return --t;
if(!(a%2)) return numofTerms(a/2,++t);
return numofTerms(3*a+1,++t);
}
int main ()
{
long long A,terms,count =1;
while(cin>>A>>L)
... | ALGO | 0.998959 | 3.62587 |
b9611077-9270-4d81-9720-48ccce9168d2 | Ishan2721/DSA-questions-prev_sem | ESEARCH.cpp | #include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
int i,j,m,n,num;
cout<<"Enter number of rows :";
cin>>m;
cout<<"Enter number of columns :";
cin>>n;
int mat[m][n];
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>mat[i][j];
}
}
... | ALGO | 0.999392 | 3.392599 |
04e63a07-e433-44dd-9233-e2879889f748 | jorgenunezsiri/competitive-programming-solutions | Codeforces/405A.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> entrada;
int maxi = 0;
for (int i = 0; i < n; i++) {
int tmp; cin >> tmp;
entrada.push_back(tmp);
maxi = max(maxi, tmp);
}
// Counting sort
... | ALGO | 0.999991 | 5.11012 |
0b5f51aa-aca7-4d74-9a70-c6dcee483b78 | ITGuk/HomeWork14 | Task_2/Task_2.cpp | #include <iostream>
using namespace std;
int main()
{
//task2
const int SIZE = 30;
int mas[SIZE] = {};
srand(time(NULL));
cout << "Temperature every day: ";
for (int i = 0; i < SIZE; i++)
{
int temp = rand() % 18;
mas[i] = temp;
cout << temp << " ";//Temperature ever... | ALGO | 0.998466 | 3.539661 |
c12cf6ed-69a0-4dce-ada5-e4e54cf34498 | 565353780/open3d-manage | src/MeshSplit/distance.cpp | #include "MeshSplit/distance.h"
#include <filesystem>
#include <limits>
const bool toMeshVertexPcdDistanceVec(
std::shared_ptr<open3d::geometry::TriangleMesh> &o3d_mesh_ptr,
const std::string &pcd_file_path,
std::vector<float> &vertex_pcd_distance_vec) {
if (!std::filesystem::exists(pcd_file_path)) {
... | TOOL | 0.935956 | 6.145015 |
e757fd88-2497-4add-bcb2-341c2134e1d1 | Jesus0342/CS1D-Project-2 | graph.cpp | #include "graph.h"
#include "database.h"
#include <QDebug>
Graph::Graph()
{
initializeGraph();
dfsDistance = 0;
mstDistance = 0;
}
Graph::~Graph()
{
}
bool Graph::empty()
{
return graph.empty();
}
int Graph::size()
{
return graph.size();
}
void Graph::initializeGraph()
{
QVector<Edge... | ALGO | 0.992107 | 4.356813 |
7c60a851-7fa4-403b-8e12-15fa600b39c4 | yndoo/algorithm-study | 프로그래머스/0/181872. 특정 문자열로 끝나는 가장 긴 부분 문자열 찾기/특정 문자열로 끝나는 가장 긴 부분 문자열 찾기.cpp | #include <string>
#include <vector>
using namespace std;
// myString의 index번부터 패턴찾기 함수
bool FindPattern(string myString, string pat, int index)
{
int target = index;
for (int p = 0; p < pat.size(); ++p)
{
if (myString.size() <= target) return false;
if (myString[target++] == pat[p])
{
continue;
}
else... | ALGO | 0.999884 | 5.312094 |
d7fe4675-ce4b-4c56-b953-db07a44297c8 | ishandutta2007/codeforces | ainta/normal/855/E.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
long long D[12][12][120], INF = 2e18;
int w[100], C[12];
long long Calc(int b, long long n){
int i, j, k, cnt = 0;
long long res = 0;
while(n){
w[cnt++] = n%b;
n/=b;
}
int s = 0;
for(i=0;i<cnt-1;i++){
res += (b-1) ... | ALGO | 0.999704 | 3.603326 |
05541281-8f96-4359-b861-46a7a0d39666 | ishandutta2007/codeforces | a.k.e.e/normal/1063/B.cpp | #include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define mp make_pair
const int MAXN=2005;
int n,m,sx,sy,L,R;
int dir[4][2]={1,0,-1,0,0,1,0,-1};
char s[MAXN][MAXN];
... | ALGO | 0.999747 | 3.004939 |
ffd2ae13-510d-4fd8-ba0e-cc8c4d2bafa5 | jhanvee-khola/LeetCode | Minimum Platforms - GFG/minimum-platforms.cpp | //{ Driver Code Starts
// Program to find minimum number of platforms
// required on a railway station
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
//Function to find the minimum number of platforms required at the
//railway station such that no train waits.
... | ALGO | 0.999987 | 5.777536 |
a102d739-dc19-4296-8c99-174a070ee543 | atijmahesh/cs-32 | project3/Project3_Pt1/StudentWorld.cpp | #include "StudentWorld.h"
#include "GameConstants.h"
#include <string>
#include <sstream>
using namespace std;
GameWorld* createStudentWorld(string assetPath)
{
return new StudentWorld(assetPath);
}
// Students: Add code to this file, StudentWorld.h, Actor.h, and Actor.cpp
StudentWorld::StudentWorld(string assetPa... | TOOL | 0.856493 | 3.633108 |
c08c3790-a034-48ba-8329-047d6b94185e | ishandutta2007/codeforces | dhxh/normal/1095/D.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;
const int maxn = 2e5 + 5;
int n, m, t, k;
vector <int> e[maxn];
bool vis[maxn];
vector <int> ans;
vector<int> vec[maxn];
int addedge(int x, int y... | ALGO | 0.999977 | 3.829601 |
cef1b840-2f4f-475b-aa5d-e6ce67361ab3 | jaiminb2512/365-Days-of-Code | day_132/Minimize the Difference.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
class Array
{
public:
template <class T>
static void input(vector<T> &A,int n)
{
for (int i = 0; i < n; i++)
{
scanf("%d ",&A[i]);
}
}
template <class T>
static void print(vector<T> &A)
... | ALGO | 0.999972 | 5.341249 |
3fc0afdb-f6c2-4336-87fd-10a899235272 | omroy07/BeyondLimit | DSA/DSA_25.cpp | #include <iostream>
using namespace std;
void bubbleSort(int arr[], int n) {
bool swapped;
for (int i = 0; i < n - 1; i++) {
swapped = false;
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
swap(arr[j], arr[j + 1]);
swapped = true;
... | ALGO | 0.999962 | 5.774671 |
245a8df1-bd56-489d-a6a4-5b437d84057a | codyjrivera/int-dreal-artifact | ibex-lib/src/tools/ibex_Random.cpp | /*------------------------------------------------------------------------------*/
/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - */
/* version 3.8.1 */
/* ... | ALGO | 0.998924 | 5.622153 |
3d66b1bf-b75e-41ba-b4c5-3477cb338d7c | sivm205/cpp-development | programs/hollow_rec.cpp | #include<iostream>
using namespace std;
int main()
{
int row,col;
int i,j;
cout<<"enter the row\n";
cin>>row;
cout<<"enter the column\n";
cin>>col;
for(i=1;i<=row;i++){
for(j=1;j<=col;j++)
{
if(i==1 ||i==row || j==1 || j==col)
{
cout<<... | ALGO | 0.99607 | 3.128395 |
13c08e55-578e-493f-849e-7f4557115c6c | Olifrans/SenaiJavaFundation | Livro-Daily_Practice_CP-DSA-master/leetcode/decode_string.cpp | class Solution {
public:
string decodeString(string s) {
int i=0;
return decodeString(s,i);
}
string decodeString(const string& s, int& i) {
string res;
while (i < s.length() && s[i] != ']') {
if (!isdigit(s[i]))
res += s[i++];
... | ALGO | 0.999689 | 6.155429 |
9aa836f8-8d91-4304-81a3-411d2cb691b2 | dalris/CSC5-40772 | Hmwk/assignment_4/Savitch_9th_Ch4_P09/main.cpp | /*
* File: main.cpp
* Author: Danziel Nguyen
* Created on Jan 26
* Purpose: Max of Floats
*/
//System Libraries
#include <iostream>
#include <iomanip> //Input/Output Library
using namespace std;
//User Libraries
//Global Constants, no Global Variables are allowed
//Math/Physics/Conversions/Higher Dimensions... | ALGO | 0.995096 | 3.970954 |
06026c07-acf6-41d5-81e8-f5a23594cadd | Debmalya24/learningCpp | pointers.cpp/findTheKthElementInArrayUsingPointer.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;//4
cout<<"The size of the array is: ";
cin>>n;
int k;//3
cout<<"The position of the element = ";
cin>>k;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];//10 3 20... | ALGO | 0.99939 | 3.133399 |
7db217f4-8399-4c59-bd45-a7ccce93719f | Mukeshkumar1611/CPP | GenericTrees/takeInput(levelWise).cpp | // Take Input level wise
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
template <typename T>
class TreeNode
{
public:
T data;
vector<TreeNode<int> *> children;
TreeNode(T data)
{
this->data = data;
}
};
TreeNode<int> *takeInput()
{
int rootData;
cout... | ALGO | 0.999534 | 4.609089 |
f19c3865-26c1-4f48-8d77-f94fdcd96571 | AmamiyaRenn/GAMES202 | homework2/prt/ext/eigen/doc/examples/Tutorial_ArrayClass_mult.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(2,2);
ArrayXXf b(2,2);
a << 1,2,
3,4;
b << 5,6,
7,8;
cout << "a * b = " << endl << a * b << endl;
}
| ALGO | 0.996051 | 3.526179 |
939ddec9-9cd8-46b9-bc14-b55fdb78d22c | MDM007MDM/mind-pokemon | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
a7802e84-3a2d-436c-bb07-41c8d7b0eb2c | nurennafisa/UVA-Online-Judge | UVA Online Judge/uva-11934 Magic Formula.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int a, b ,c, d, l,r,c1;
while(scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&l)==5)
{
if(a==0 && b==0 && c==0 && d==0 && l==0)
{
break;
}
c1=0;
for(int i=0;i<=l;i++)
{
r=(a*... | ALGO | 0.999465 | 3.169225 |
68568ce9-3952-43a2-bbe0-e12f5804d94e | heavenMOJANG/ICPC | .history/programmes_C_Cpp/Codeforces/CF2096/B_20250424105843.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
void solve() {
int n, k; cin >> n >> k;
vector<int> l(n), r(n);
for (auto && x : l) cin >> x;
for (auto && x : r)... | ALGO | 0.999938 | 4.461671 |
dbe00508-d51a-4c17-bf2d-a8f743690837 | Deepanshurathore01/CoderArmy180Days_DSA | Backtraking/Sudoku SOlver/sudoku.cpp | class Solution {
public:
bool check(int num, vector<vector<char>>& board, int i, int j) {
char c = '0' + num;
// check at same row
for (int col = 0; col < 9; col++) {
if (board[i][col] == c)
return false;
}
// check at same col
for (int row... | ALGO | 0.999803 | 6.873318 |
9d64b7a7-06b6-42f6-9382-d7065da45972 | Vick7Coder/NhapMonLapTrinhHCMUTE | LEVEL6/BAI4.cpp | #include<stdio.h>
void InPut(int &n, int A[]);
float Sum(int n, int A[]);
void OutPut(float n);
int main()
{
int n;
int A[100];
InPut(n,A);
float Rs = Sum(n,A);
OutPut(Rs);
return 0;
}
void InPut(int &n, int A[])
{
printf("vui long nhap so phan tu mang: ");
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
printf("vu... | ALGO | 0.999456 | 3.028982 |
cd3c4783-8c84-4028-96a9-60db87100369 | ishandutta2007/codeforces | chiliudog/normal/936/A.cpp | #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)... | ALGO | 0.999708 | 3.323043 |
b72b1655-6b65-46b4-8c98-4315f4876fd8 | aHZAMp/leetcode | 2849-determine-if-a-cell-is-reachable-at-a-given-time/2849-determine-if-a-cell-is-reachable-at-a-given-time.cpp | class Solution {
public:
bool isReachableAtTime(int sx, int sy, int fx, int fy, int t) {
if(sx==fx&&sy==fy&&t==1)
return false;
int dis=max(abs(fy-sy),abs(fx-sx));
if(dis<=t)
return true;
else
return false;
}
}; | ALGO | 0.999913 | 5.753383 |
163156db-6702-46be-9252-5c33ff99e54e | TheKaushikGoswami/College-Work | Semester 4/CPP - DSA/Solution.cpp | #include <string>
#include <map>
using namespace std;
class Solution {
public:
bool isAnagram(string s, string t) {
if (s.length() != t.length()) {
return false;
}
int count[256] = {0};
for (int i = 0; i < s.length(); i++) {
count[s[i]]++;
count... | ALGO | 0.999966 | 6.336443 |
6d381685-c9c0-4606-b9e8-ecabe920bc5b | Kawser-nerd/CLCDSA | Source Codes/AtCoder/agc012/A/2748821.cpp | #include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>
#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int, int> P;
const int INF = 1e15;
const int MOD... | ALGO | 0.999931 | 3.67853 |
599a4784-b7d9-45fd-a140-39b03833e222 | khalid21456/Data-structures-in-C- | main.cpp | #include <iostream>
using namespace std;
class Node {
public :
int a;
Node *next;
Node (int a) {
this->a = a;
next = NULL;
}
void afficherA() {
cout<<a;
}
void setNext(Node *node) {
next = node;
}
};
Node* createNode(int val) {
Node *node = new N... | ALGO | 0.997101 | 3.906685 |
c5674722-f8ac-44f5-a1be-9406b0a513a6 | nur1208/test | Practice8.cpp | #include <iostream>
#include <math.h>
using namespace std;
class Point
{
private:
double x,y;
public:
Point (double x,double y):x(x),y(y){}
Point():x(0),y(0){}
Point(const Point &p):x(p.x),y(p.y){}//clone constructor
~Point(){}
double GetX()const{ return x;}
double GetY()const{ return y;}
void SetX(double x1... | ALGO | 0.996269 | 4.186526 |
b821701f-4cd4-4074-ac7f-feef872b65f5 | Syed-HamzaShah/playground | RemoveTrailingZerosFromAString.cpp | class Solution
{
public:
string removeTrailingZeros(string num)
{
int size = num.length() - 1;
while (size >= 0 && num[size] == '0')
size--;
return num.substr(0, size + 1);
}
};
| ALGO | 0.999281 | 5.700421 |
40393231-bb76-471d-9ebc-53f864ad3e3f | saadrahim/clr | ROCm-OpenCL-Runtime/ROCm-OpenCL-Runtime/amdocl/cl_d3d9.cpp | #ifdef _WIN32
#include "top.hpp"
#include "cl_d3d9_amd.hpp"
#include "platform/command.hpp"
#include <cstring>
#include <utility>
#define D3DFMT_NV_12 static_cast<D3DFORMAT>(MAKEFOURCC('N', 'V', '1', '2'))
#define D3DFMT_P010 static_cast<D3DFORMAT>(MAKEFOURCC('P', '0', '1', '0'))
#define D3DFMT_YV_12 static_cast<D... | TOOL | 0.940903 | 3.809069 |
9bc29046-87c9-4dbe-888d-3e62682e7274 | v21k93/PVPCore | dep/recastnavigation/Recast/RecastFilter.cpp | #define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
#include "Recast.h"
#include "RecastAssert.h"
void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb, rcHeightfield& solid)
{
rcAssert(ctx);
ctx->startTimer(RC_TIMER_FILTER_LOW_OBSTACLES);
const int w = solid.width;
const i... | ALGO | 0.991982 | 6.173068 |
b7cb34c6-52d0-4b62-8405-2c8c38854641 | UnePatate5010/3D-Programming_Course | WORK1/mds3d_work1/ext/nanogui/ext/eigen/doc/examples/Tutorial_ArrayClass_mult.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(2,2);
ArrayXXf b(2,2);
a << 1,2,
3,4;
b << 5,6,
7,8;
cout << "a * b = " << endl << a * b << endl;
}
| ALGO | 0.993544 | 3.527115 |
a2295c0d-687e-46ec-9439-1f3b7c9989e1 | sneha-vanani/array | pair-sum.cpp | #include<iostream>
using namespace std;
//pair sum
void psum(int arr[], int n, int s)
{
int a[10];
for(int i=0; i<n; i++)
{
for(int j=i+1; j<n; j++)
{
if(arr[i] + arr[j] == s)
{
cout << (min(arr[i], arr[j])) << " " << (max(arr[i], arr[j])) <... | ALGO | 0.999746 | 3.717392 |
1ae6e006-d358-4c0a-ba94-5ba7b4958efe | Yuvraj2606/cpp-programs | Pointer.cpp | /*#include<iostream>
using namespace std;
int main()
{
int a=3;
int *b=&a; // Pointer holds the address of the variable
// Address of the variable indicate by : &variable and we want to store it(address of the variable) in any other variable we use *nameofothervariable
cout<<"The value o... | ALGO | 0.922615 | 3.273825 |
2eb38b81-3198-4f0c-aeb5-348b14707374 | ddevilz/Cpp | leetcode/fibonacci.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int n = 5;
if (n == 0) {
cout << 0;
} else if (n == 1) {
cout << 0 << " " << 1 << "\n";
} else {
int fib[n + 1];
fib[0] = 0;
fib[1] = 1;
for (int i = 2; i <= n; i++) {
fib[i] = fib[i - 1] + fib[i - 2];
}
cout<<"The ... | ALGO | 0.999958 | 5.118052 |
ba058db6-cc77-44ee-8d04-6d827f990a47 | rahul-2211/Assignment | assignment/prob3DS.cpp | /*Print all nodes of a perfect binary tree in a specific order.
Given a perfect binary tree, print the values of alternating left and right nodes for each level in a topdown
and bottom-up manner.*/
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
Node(int ... | ALGO | 0.999958 | 5.090589 |
62e5c07c-d4ea-4051-9ec3-1f2fa42aaa34 | parrotfish813/Object-Oriented-Programming-Class | Homework/Assignment 4/Problem 3/MySet.cpp | #include "MySet.h"
//Default constructor
MySet::MySet() {
range = 0;
size = 0;
set = new bool[range];
for(int i = 0; i <= range; i++) {
set[i] = false;
}
}
//User defined constructor
MySet::MySet(unsigned int newRange, unsigned int newSize) {
range = newRange;
size = newSize;
... | TOOL | 0.917953 | 3.895386 |
5304a721-cc7f-4774-8065-d7de19a61712 | EdgarSargsyan2001/Sort_Algorithms | Selection_sort.cpp | #include <iostream>
#include <vector>
void SelectionSort(std::vector<int> &arr)
{
int n = arr.size();
for (int i = 0; i < n - 1; ++i)
{
int minIndex = i;
for (int j = i + 1; j < n; ++j)
{
if (arr[j] < arr[minIndex])
{
minIndex = j;
... | ALGO | 0.999873 | 6.656528 |
8c6d854a-d42d-4430-8b83-07f512eb4b99 | gt-shara/gt-shara.github.io | SHARA/src/opt/optsmt.cpp | #include <typeinfo>
#include "optsmt.h"
#include "opt_solver.h"
#include "arith_decl_plugin.h"
#include "theory_arith.h"
#include "ast_pp.h"
#include "ast_util.h"
#include "model_pp.h"
#include "th_rewriter.h"
#include "opt_params.hpp"
namespace opt {
void optsmt::set_max(vector<inf_eps>& dst, vector<inf_eps> con... | ALGO | 0.999938 | 7.549534 |
df51e648-6650-4a4c-833a-94f72f57d5bd | daidai411411/AOJ | Solved/1269.cpp | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
#define N_MAX (1120)
#define K_MAX (14)
using namespace std;
u... | ALGO | 0.999612 | 4.41034 |
ed76130a-9078-4fcf-b2c8-e58b0b57e608 | Ananda-01/Introduction-to-Algorithm | Module-6/weighted_graph.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=1e3+5;
int adj[N][N];
int main()
{
// input of weighted graph
int v,e;
cin>>v>>e;
for(int i=0;i<e;i++)
{
int u,v,w;
cin>>u>>v>>w;
adj[u][v]=w;
// adj[v][u]=w;
}
// for output
for(int i=1;i<=v;i+... | ALGO | 0.999958 | 3.645905 |
6c24ba6a-b244-4c7b-b97b-83502bdde4c7 | arnavarora1710/Competitive_Programming | Codeforces/1957C.cpp | // https://codeforces.com/contest/1957/problem/C
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pi;
#define f first
#define s second
#define MULTI_TEST (1)
const int maxn = 3e5 + 5, inf = 1e18;
int n, k;... | ALGO | 0.999898 | 5.078613 |
03462bb7-effd-4b02-a0c2-83c1a5399b3d | cryptowithacause/cwaccoin | src/libzerocoin/Commitment.cpp | /**
* @file Commitment.cpp
*
* @brief Commitment and CommitmentProof classes for the Zerocoin library.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This project is rele... | ALGO | 0.997693 | 7.159162 |
59337b14-24c9-4809-9d48-2041e135e98c | IgorAmashukeli/Neetcode | Arrays&_Hashing/7_groupAnagrams.cpp | /**
https://leetcode.com/problems/group-anagrams/
Given an array of strings strs, group the anagrams together. You can return
the answer in any order.
An Anagram is a word or phrase formed by rearranging the letters of a different
word or phrase, typically using all the original letters exactly once.
Example 1:
Inp... | ALGO | 0.999967 | 6.848402 |
6aa9b7b2-e6f6-4b8d-9cb5-2e6df6a08c4c | shariquealam18mca25/JMI-MCA | II-sem/DS/unit-II/stack(using_array)-2.cpp | //stack(using_array)-2.cpp on 18-03-19
//
//Program to implement stack using array
//
#include<iostream>
#include<stdlib.h>
using namespace std;
class stack{
int *arr,tos, maxsize;
public:
stack(int maxsize)
{
arr = new int [maxsize];
this->maxsize = maxsize;
tos = -1;
}
void push(int);
void ... | ALGO | 0.976862 | 4.705078 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.