uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
62d03fcf-081b-41c2-b3ce-94c3edaa52fe | kc1212/SCALE-MAMBA | src/Offline/FHE_Factory.cpp | #include "FHE_Factory.h"
#include "FHE/ZKPoK.h"
#include "LSSS/PRSS.h"
#include "Tools/Crypto.h"
#include "Tools/Timer.h"
#include <list>
#include <unistd.h>
using namespace std;
extern Timer global_time;
FHE_Industry::FHE_Industry(unsigned int maxnumber)
{
Factory_List_Lock= new mutex[maxnumber];
Current_Factor... | ALGO | 0.984368 | 4.025571 |
aef2789b-c272-4bab-911e-c62e4d6e6d0c | JvanKatwijk/sdr-j-fm | src/various/pllC.cpp | #include "pllC.h"
//#include "utilities.h"
//
// rate is the samplerate
// lofreq and hifreq the frequencies (in Hz) where the lock is
// kept in between,
// bandwidth the bandwidth of the signal to be received
pllC::pllC (int32_t rate,
DSPFLOAT freq,
DSPFLOAT lofreq, DSPFL... | ALGO | 0.994432 | 4.632899 |
da8d22a7-5dbc-438c-adc7-005e8e63b581 | nawaz677/PD-LAB-06 | task03.cpp | #include<iostream>
using namespace std;
string Show_Zodiac_Sign(int,string);
main()
{
int date;
string month;
string sign;
cout<<"Enter your date of birth: ";
cin>>date;
cout<<"Enter your month of birth: ";
cin>>month;
sign=Show_Zodiac_Sign(date,month);
cout<<"Your Zodiac Sign i... | ALGO | 0.99622 | 4.038803 |
e8e5690a-044c-4384-b245-d1c6435cc46a | nikita-1910/DSA-450 | kth_smallest_element_in_BST.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* left, *right;
Node(int x){
data=x;
left=right=NULL;
}
};
Node* insert(Node* root, int x){
if(root==NULL){
return new Node(x);
}
if(x<root->data){
root->left= insert(root->left, x);
... | ALGO | 0.999967 | 3.74696 |
6a0f9b73-ccd2-401f-8b78-ca12171d7d5d | RayoNicks/Cracking-the-Coding-Interview | ch16/16.18 Pattern Matching-1.cpp | class Solution {
public:
bool patternMatching(string pattern, string value) {
char MainPat = pattern[0];
char AltPat = pattern[0] == 'a' ? 'b' : 'a';
size_t MainCnt = 0, AltCnt = 0;
for(char c : pattern)
{
if(c == MainPat) MainCnt++;
else AltCnt++;
... | ALGO | 0.99962 | 5.683705 |
7fc3bade-2299-4fa0-99f4-4c4777dc5e7b | anmolalgorist7110/dsa-codes | priority Queue/running median.cpp | #include<bits/stdc++.h>
using namespace std ;
void findmedian(int arr[] , int n)
{
priority_queue<int> max ;
priority_queue<int , vector<int> , greater<int>> min ;
for(int i=0 ; i<n; i++)
{
if(i == 0)
{
max.push(arr[i]) ;
}
else
{
if(arr[i] < max.top())
{
max.push(arr[i]) ;
}
else
... | ALGO | 0.999994 | 4.221136 |
db0fd602-df2b-4b74-a8f0-b1267fc8a364 | flyingbeat/Nori2-2024 | src/direct_ems.cpp | NORI_NAMESPACE_BEGIN
class DirectEmitterSampling : public Integrator
{
public:
DirectEmitterSampling(const PropertyList &props)
{
/* No parameters this time */
}
/*
* REFERENCES: Task description in assignment, direct whitted integrator
*/
Color3f Li(const Scene *scene, Sampler *sa... | ALGO | 0.986889 | 7.080554 |
f22ad887-3038-4993-a193-b2fa4560e0f9 | conlacda/algo-practice | atcoder/BeginnerContest/318/E - Sandwiches.cpp | #include<bits/stdc++.h>
typedef long long ll;
using uint = unsigned int;
using ull = unsigned long long;
const ll mod = 1000000007; // 998244353 1000000009 1000000007 // đừng dùng ull
#define ld long double
#define int long long
const int INF = std::numeric_limits<int>::max();
using namespace std;
#ifdef DEBUG
#in... | ALGO | 0.999922 | 4.068784 |
11e3a213-8e62-49ef-a8a2-a8f549b8d4eb | gtxygyzb/OI_and_ICPC | 上海大学/G.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int T;
int b, r, d, s;
scanf("%d", &T);
while (T--)
{
scanf("%d%d%d%d", &b, &r, &d, &s);
int dmg;
if (r) dmg = b * ((r * s + 60) / 60);
else dmg = 0;
//cout<<"dmg:"<<dmg<<endl;
puts(d > dmg ? "gua!" : "ok");
}
return 0;
}
| ALGO | 0.927323 | 3.772237 |
9cec8f7c-5b88-46f6-879d-9c186de83ec8 | Mayurakkar10/c-practicals | String/string25-05-2024/findSumofdigitInString.cpp | #include<stdio.h>
#include<string.h>
int main()
{
char str[20];
int len = strlen(str),sum=0;
//input string
printf("\nEnter a string: ");
gets(str);
//logic
for(int i= 0;i<len;i++)
{
if(str[i]>=48&&str[i]<=57)
{
sum = sum+str[i]-48;
}
}
... | ALGO | 0.997444 | 3.282209 |
a25cf177-53c9-4af8-b1df-4d8ed48bf793 | ccivetta/PersonClassReferencePractice | main.cpp | #include <iostream>
#include "Person.h"
using namespace std;
void PassByValue(int x){
using namespace std;
cout<<"Inside PassByValue"<<endl;
x++;
cout<<x<<endl;
}
void PassByRef(int& x){
using namespace std;
cout<<"Inside PassByRef"<<endl;
x = 50;
cout<<x<<endl;
}
void ModifyPerson(Pers... | TOOL | 0.865573 | 4.256113 |
613fe5da-330b-40a2-895c-07ab4eaa7d34 | rajveer-09/HustlerWorkspaceLeetcode | 1044-find-common-characters/find-common-characters.cpp | class Solution {
public:
vector<string> commonChars(vector<string>& words) {
vector<vector<int>> v(words.size(), vector<int>(26, 0));
char c;
for (char ch = 'a'; ch <= 'z'; ch++) {
for (int i = 0; i < words.size(); i++) {
string s = words[i];
for (... | ALGO | 0.999967 | 5.879424 |
262a8268-63a7-460d-b176-cdf4394a8192 | ishandutta2007/codeforces | vercingetorix/normal/1459/B.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <cstring>
#include <set>
#include <bitset>
#include <map>
#include <chrono>
#include <random>
#include <unordered_map>
#include <stdio.h>
using namespace std;
typedef long long ll;
typedef long do... | ALGO | 0.999763 | 3.894699 |
ea78ab43-f763-45df-a708-18090342be70 | Rgtemze/MemoryEfficientTetMeshGen | Hybrid/include/igl/list_to_matrix.cpp | #include <cassert>
#include <cstdio>
#include <Eigen/Dense>
#include "max_size.h"
#include "min_size.h"
template <typename T, typename Derived>
IGL_INLINE bool igl::list_to_matrix(const std::vector<std::vector<T > > & V,Eigen::PlainObjectBase<Derived>& M)
{
// number of rows
int m = V.size();
if(m == 0)
{
... | TOOL | 0.883393 | 5.258767 |
26025404-925c-4ed5-bcb9-168e35b9ecff | zanj0/Contest-Solutions | LeetCode/BiWeekly59/Number of Ways to Arrive at Destination.cpp | typedef long long int lli;
const lli MOD = 1e9 + 7;
lli add(lli a, lli b) {
return ((a % MOD) + (b % MOD)) % MOD;
}
const lli inf = 1e18;
class Solution {
public:
vector<vector<pair<lli, lli>>> graph;
int n;
lli dijkstra(int src) {
vector <lli> dist(n, inf);
vector <lli> ways(n);
ways[0] = 1;
dist[0] = 0;
... | ALGO | 0.999791 | 4.768406 |
8477b4a4-5f2d-48aa-b584-224859a8ce6e | mohityadaviitb/cp | codeforces/1121.cpp | // #include <bits/stdc++.h>
// using namespace std;
// #define ll long long int
// #define fu(i, a, b) for (ll i(a); i < b; i++)
// #define fd(i, a, b) for (ll i(a); i >= b; i--)
// #define pb push_back
// #define pll pair<ll, ll>
// #define MOD 998244353
// #define MODE 1000000007
// #define sor(v) v.begin(), v.end()
... | ALGO | 0.999887 | 5.271249 |
aaee4e85-49bc-4e5f-97dc-672958c6379d | ronakgadhiya09/CP-DSA | LeetCode/Design-Add-and-Search-Words-Data-Structure.cpp | struct TrieNode {
TrieNode* children[26];
bool isWordEnd;
};
TrieNode* getNode() {
TrieNode* pNode = new TrieNode;
pNode->isWordEnd = false;
for (int i = 0; i < 26; i++) pNode->children[i] = nullptr;
return pNode;
}
class WordDictionary {
TrieNode* root;
public:
WordDictionary() {
... | ALGO | 0.99961 | 6.484678 |
079b0fe5-19bd-400b-9865-7c6ee4918f6d | Aryan810/programming | learn/learn_cpp/hackerrank/coding_week_2025_cp/Strength_hard_version.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #pragma GCC optimize("Ofast,unroll-loops")
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define rep(i, n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),... | ALGO | 0.999888 | 3.567099 |
c8b69540-fee8-4399-9978-261e3ea44b6b | hyuntohoon/ALGO_study | baekjoon/week0/14501/[14501] 퇴사_박지훈.cpp | #include <iostream>
#include <algorithm>
#define endl '\n'
using namespace std;
int N;
int T[16];
int P[16];
int DP[16];
int result;
int main()
{
ios::sync_with_stdio(NULL);
cin.tie(NULL);
cin >> N;
for (int i = 0; i < N; i++) {
cin >> T[i] >> P[i];
if (T[i] + i <= N) DP[i] = P[i];
}
for (int i = N - 1; i >... | ALGO | 0.999912 | 3.775912 |
5b51ed87-d0da-4017-b362-5531f1721c23 | shriharshpatil23/Data-Structures-and-Algorithms | 445-add-two-numbers-ii/445-add-two-numbers-ii.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 * reverse(Li... | ALGO | 0.999939 | 6.054953 |
91717291-e5e7-41e8-8006-c3dc3d7fc6e2 | OanaGaskey/Model-Predictive-Control | src/Eigen-3.3/doc/examples/TutorialLinAlgComputeTwice.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A, b;
LLT<Matrix2f> llt;
A << 2, -1, -1, 3;
b << 1, 2, 3, 1;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the right hand side b:\n" << b << endl;
cout << "Computing LLT... | ALGO | 0.999903 | 3.145425 |
4fb47cd6-b0e7-4405-88b9-6d716221db02 | letelete/algorithms-and-data-structures | codeforces/practice/000376_B.cpp | #include <bits/stdc++.h>
#pragma GCC target("popcnt")
#define fastIO \
std::cin.tie(0); \
std::cout.tie(0); \
std::ios::sync_with_stdio(0);
template <typename T>
using v = std::vector<T>;
template <typename T>
using q = std::queue<T>;
template <typename T>
using pq = std::priority_queue<T>;
template <typ... | ALGO | 0.99997 | 4.278671 |
cee84be1-cb94-47f2-b29b-c8bffab819d6 | ZIYOCHIRO/LeetCode_repo | Leetcode_solutions_cpp/125.valid-palindrome.cpp | /*
* @lc app=leetcode id=125 lang=cpp
*
* [125] Valid Palindrome
*/
// @lc code=start
class Solution {
public:
bool isPalindrome(string s) {
string pStr;
for (char c:s) {
if (isalnum(c)) {
pStr += tolower(c);
}
}
string pStr_rev(pStr.rbegi... | ALGO | 0.999598 | 6.591279 |
fabdc7e2-1c99-4455-b037-2d00cde31b81 | sharad2307/Competitive_Programming | Codeforces/Practice/466C.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
typedef unsigned long long ull;
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define f(i,a,b) for(ll i=a;i<=b;i++)
#define testcases ll t;cin>>t;while(t--)
#define dec(x) greater<x>()
/*** Define Values ***/
#define mx 200005
#define m... | ALGO | 0.999975 | 3.813655 |
5e3a197b-027e-434d-8d41-ed471796817a | codexuhy/c_plus_plus_learning | C++基础入门/5 数组/5.4-一维数组-案例-元素逆置.cpp | #include <iostream>
using namespace std;
int main(){
int arr[] = {0,1,2,3,4};
cout << "数组逆置前:" << endl;
for (int i = 0; i < 5; i++)
{
cout << arr[i] << endl;
}
int start = 0;
int end = sizeof(arr) /sizeof(arr[0]) -1 ;
while (start < end)
{
int temp = arr[start];
... | ALGO | 0.999475 | 3.935398 |
e1e46963-8e56-4160-a46e-bc84e8cb55d3 | raincross7/code-similarity | codes/train_code/problem297/problem297_54.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i,... | ALGO | 0.999947 | 3.951378 |
611cba88-9f6c-4561-bc0f-9430c6fa3200 | nirvik-alpha/GeeksForGeeks-DSA | Number of Provinces - GFG/number-of-provinces.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution {
public:
void dfs(vector<vector<int>>& adj , int V , vector<int>&visited , int src)
{
visited[src] = 1;
for(int i=0;i<V;i++)
{
if(adj[src-1][... | ALGO | 0.99998 | 6.438015 |
a495469f-8c00-4ef2-ad95-ac1575a20d3e | mapsme/omim | routing/pedestrian_directions.cpp | #include "routing/pedestrian_directions.hpp"
#include "routing/road_graph.hpp"
#include "routing/turns_generator.hpp"
#include "base/assert.hpp"
#include "base/logging.hpp"
#include <utility>
using namespace std;
namespace routing
{
PedestrianDirectionsEngine::PedestrianDirectionsEngine(DataSource const & dataSour... | TOOL | 0.876423 | 7.206409 |
06936dd1-d179-464e-b54c-411a1c754799 | vikasjha11/DAA-Lab-2025 | Week 14/q41.cpp | /*Date: 26/May/2025
Prog. Find mother vertex in a directed graph*/
#include <bits/stdc++.h>
using namespace std;
void dfs(int v, vector<vector<int>> &adj, vector<bool> &visited) {
visited[v] = true;
for (int u : adj[v]) {
if (!visited[u]) {
dfs(u, adj, visited);
}
}
}
int find... | ALGO | 0.999957 | 5.842253 |
1e6b9a4f-e72d-4f09-8b01-7fe66e19fc80 | achyuth-k-t/Strivers-SDE-sheet-Daily | 03_Arrays/Yashwanth/Hard/01_PascalsTri.cpp | // Brute force only upto N=22-----------
// then it furtur causes overflow
long long fac(int num){
if(num <= 1)return 1;
return num*fac(num-1);
}
vector<vector<int>> pascalTriangle(int N) {
// Write your code here.
vector<vector<int>>sol(N);
int formula = 0;
for (int i = 0; i < N; i++) {
... | ALGO | 0.999994 | 5.433744 |
32a26f37-5e48-4d0a-8508-542a92cdc7c7 | Moeez-Rajpoot/C-Programs | Level 5 Tasks/TASK 9.cpp | #include<iostream>
using namespace std;
int main()
{
int cap,sma;
char alpa,ch2;
do{
cout<<"ENTER A LETTER = "<<endl;
cin>>alpa;
if(alpa>=65&&alpa<=90){
cout<<"YOU ENTERED CAPITAL LETTER "<<endl;
cap++;
}
else if(alpa>=61&&alpa<=122){
cout<<"YOU ENTERED SMALL LETTER "<<endl;
sma++;
}
else{
... | ALGO | 0.96701 | 3.446239 |
a23f5e0d-59a5-4db5-9660-559595f4aef4 | wphu/SmileiSE | src/ElectroMagnSolver/MF_Solver1D_Yee.cpp |
#include "MF_Solver1D_Yee.h"
#include "ElectroMagn.h"
#include "Field1D.h"
MF_Solver1D_Yee::MF_Solver1D_Yee(PicParams ¶ms)
: Solver1D(params)
{
}
MF_Solver1D_Yee::~MF_Solver1D_Yee()
{
}
void MF_Solver1D_Yee::operator() ( ElectroMagn* fields )
{
Field1D* Ey1D = static_cast<Field1D*>(fields->Ey_);
... | ALGO | 0.996212 | 4.811054 |
165f5355-3270-48fd-888d-174109d60566 | Sky199710/C-C-questions | C++/chapter_8/1.cpp | /*************************************************************************
> File Name: 1.cpp
> Author: Sparks
> Mail: <EMAIL>
> Created Time: Sun 04 Jul 2021 11:45:42 PM PDT
************************************************************************/
#include<iostream>
using namespace std;
static int summon=1;
voi... | TOOL | 0.989227 | 3.915109 |
a86d4a04-bd8c-4043-8444-52105f631709 | Avdhesh-Varshney/CPMasterLog | CodeChef/Practice-Problem/APPENDOR.cpp | // Append for OR
// Problem Code - APPENDOR
// https://www.codechef.com/problems/APPENDOR
// Solution:
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin >> t;
while(t--) {
int n, y;
cin >> n >> y;
int a[n], z = 0, x = 0;
for(int i =... | ALGO | 0.999937 | 4.728544 |
268b5d6c-fa35-44d5-9f8c-43fb6c6e8140 | loopg/CPU-Scheduling-Algorithms | main.cpp | #include <bits/stdc++.h>
#include "parser.h"
#define all(v) v.begin(), v.end()
using namespace std;
/** Global Constants **/
const string TRACE = "trace";
const string SHOW_STATISTICS = "stats";
const string ALGORITHMS[9] = {"", "FCFS", "RR-", "SPN", "SRT", "HRRN", "FB-1", "FB-2i", "AGING"};
bool sortByServiceTime(... | ALGO | 0.99977 | 3.583536 |
80c6e190-5376-47cd-abbd-8191ae263d11 | Nitdroid-Reborn/arceans-platform_frameworks_base | media/libstagefright/codecs/amrnb/dec/src/dec_lag3.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/dec_lag3.c
Functions: Dec_lag3
Date: 01/31/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description:
(1) Updated to accept new parameter... | ALGO | 0.999865 | 7.152905 |
b30b6529-8f5c-4c22-9532-e51d3c6ff56f | tritech-cyber/ccode | sort-study/sorts.cpp | #include <iostream>
#include <array>
#include <string>
using namespace std;
const int arraylength = 26;
array<string,26> selectSort(array<string,26>list);
array<string,26> insertSort(array<string,26>list);
void printArray(array<string,26>list);
int main(){
array<string,26> natorev {"zulu","yankee","xray","whiskey","v... | ALGO | 0.999671 | 4.811002 |
2cd52c08-92f6-4a6e-814d-5707c2821b90 | VenkateshBH99/InterviewBit-Solutions | Math/GreatestCommonDivisor.cpp | // https://www.interviewbit.com/problems/greatest-common-divisor/
int Solution::gcd(int A, int B) {
// Do not write main() function.
// Do not read input, instead use the arguments to the function.
// Do not print the output, instead return values as specified
// Still have a doubt. Checkout www.interv... | ALGO | 0.99933 | 5.252595 |
7974da02-124b-456c-bf4f-f91b93277a3b | sthsuyash/CSIT_Labs | 3rd_Semester/DSA/3_Queue/linearQueue.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
// A class to store a queue
class Queue
{
int *arr; // array to store queue elements
int capacity; // maximum capacity of the queue
int front; // front points to the front element in the queue (if any)
int rear; // rear points to th... | ALGO | 0.993606 | 5.785826 |
26f408c4-330d-45c4-9f45-902fcc57a760 | MartinNikolov/cuckoochess | DroidFish/jni/rtb/rtb-probe.cpp | #include "piece.hpp"
#include "position.hpp"
#include "moveGen.hpp"
#include <type_traits>
#include "rtb-probe.hpp"
#include "rtb-core.hpp"
#include "rtb-core-impl.hpp"
int Syzygy::TBLargest = 0;
// Given a position with 6 or fewer pieces, produce a text string
// of the form KQPvKRP, where "KQP" represents the wh... | ALGO | 0.999286 | 6.585368 |
fa18dd18-359a-4651-b5a5-03e7bffc8b7b | vinhdq842/Cpp-CP | 11-2020/sumtable.cpp | #include<bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
int n, q, x, y, u, v;
ll bit[1001][1001];
void update(int x, int y, int w) {
for (int i = x; i <= n; i += i & (-i)) {
for (int j = y; j <= n; j += j & (-j)) {
... | ALGO | 0.998929 | 4.692898 |
8264a510-9f88-48f6-9665-8a29ca3fae1d | Divyanshu7001/DSA_Problems_cpp | 0344-reverse-string/0344-reverse-string.cpp | class Solution {
public:
void reverseString(vector<char>& s) {
int l=0,j=s.size()-1;
while(l<=j){
swap(s[l],s[j]);
l++;
j--;
}
}
}; | ALGO | 0.999532 | 6.167353 |
75c68d72-63ff-4c34-8010-0291fa9596b2 | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J01311/poker/poker.cpp | #include<bits/stdc++.h>
using namespace std;
long long n,c[100],d[100],h[100],s[100],sum=0;
char x,y;
int main(){
freopen("poker.in","r",stdin);
freopen("poker.out","w",stdout);
cin>>n;
for(int i=1;i<=n;i++){
cin>>x>>y;
if(x=='C') c[y]++;
if(x=='D') d[y]++;
if(x=='H') h[y... | ALGO | 0.995131 | 3.438407 |
3548b53f-0741-490d-a2f2-871d8ad5411f | vlakom17/MAI_OOP_2023 | laba3/pentagon.cpp | #include <string>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include "pentagon.hpp"
Pentagon::Pentagon() : _area(0)
{
_points.resize(n);
_middle_point.first = 0;
_middle_point.second = 0;
}
Pentagon::Pentagon(std::vector<std::pair<double, double>> &points)
{
// Points amount check
... | ALGO | 0.973471 | 5.248728 |
5cd90e17-7b18-4d0a-a024-17eba17ab19d | RugvedGadakh/DSA | Sorting/sort_arr.cpp | #include <iostream>
using namespace std;
int main(){
int arr[100];
int n;
cin>>n;
for(int a=0 ;a<n ; a++ ){
cin>> arr[a];
}
for (int i =0; i<n-1; i++){
int min_index =i;
for (int j =i+1; j<n; j++){
if(arr[j]< arr[min_index]){
min_index =... | ALGO | 0.999976 | 3.951389 |
f296605f-e725-4ff2-88c1-ad1dcd040ce8 | shivgupta198922/CodeForces-Master-in-cpp | 1611E2.cpp | /*
~ Author : @tridib_2003
*/
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_orde... | ALGO | 0.999838 | 5.019115 |
c082b3e5-9e39-44d4-94a5-799a7ae145a5 | chirag-singhal/Coding-Interview-101 | Miscellaneous/InterviewBit/Maths/ExcelColumnNumber.cpp | #include <bits/stdc++.h>
int titleToNumber(std::string A) {
int ans = 0;
for(int i = 0; i < A.length(); i++) {
ans = ans * 26 + (A[i] - 'A' + 1);
}
return ans;
}
| ALGO | 0.999904 | 5.650871 |
9f495540-dc21-40cb-affe-1349cca71833 | GoatGirl98/Walkthrough-of-ACCoding-in-BUAA | 2015级-软件学院-算法分析与设计/C2-2015级算法第二次上机/BUAAOJ466 sort.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
inline void write(int x) {
if (x < 0)putchar('-'), x = -x;
if (x > 9)write(x / 10);
putchar(x % 10 + 48);
}
inline int read() {
int k = 0, f = 1;
char c = getchar();
while (c < '0' || c>'9') {
if (c == '-')f = -1;
c = getc... | ALGO | 0.999884 | 3.484013 |
06d23a0b-c571-4a1e-b074-6ec7fa5f9cd6 | lymph12138/Algorithm-notes-finaltest | Advanced/Map/(star)Battle_overCities.cpp | /*
*/
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <cstring>
using namespace std;
#define maxn 1010
vector <int> G[maxn];
bool vis[maxn];
int CurrentNode,n,m,k;
void DFS(int node){
if(node==CurrentNode) return ;
vis[node]=true;
for(... | ALGO | 0.999942 | 4.169258 |
4a428dab-ea5c-4ca3-8c88-806370c906b1 | HAJTIDev/Cplusplus | powtorzenie/main.cpp | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
fstream dane ("dane.txt");
ofstream odp ("odp.txt");
string s;
bool pop[4];
char tab[4];
char p;
int punkt=0;
tab[0]='A';
tab[1]='B';
tab[2]='C';
tab[3]='D';
tab[4]='A';
if(!d... | ALGO | 0.976376 | 3.227653 |
3a61b938-90f5-4add-b79c-ed9a91e2a4a8 | maidat1708/PTIT_CPP | Code_PTIT_C++/214 ( so lon nhat cua day con lien tuc ).cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>> t;
while (t--)
{
int n,k;
cin >> n >> k;
int a[n];
for (int i=0;i<n;i++) cin>>a[i];
multiset<int> ms;
for (int i=0;i<k;i++) ms.insert(a[i]);
cout << *ms.rbegin() << " ";
for (int i=k;i<n;i++)
{
ms.erase(ms.find(a[i-k]));
m... | ALGO | 0.999974 | 3.244609 |
7a4c5a9e-3bd6-41d1-9768-5af6162c5c4a | jakev/CobraDroidBeta | src/frameworks/base/media/libstagefright/codecs/amrwb/src/noise_gen_amrwb.cpp | /*
------------------------------------------------------------------------------
Filename: noise_gen_amrwb.cpp
Date: 05/08/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
---------------------------------------------------------------------... | ALGO | 0.984205 | 5.300429 |
f066f58e-1c6c-4849-b460-9eb0dd151ce3 | csl-iisc/SUV-MICRO24 | llvm/mlir/lib/Dialect/Linalg/Transforms/Split.cpp | #include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "llvm/ADT/STLExtras.h"
using namespace mlir;
using namespace mlir::linalg;
/// Extract the slices of `operands` s... | TOOL | 0.854884 | 7.841155 |
06877dff-8899-418f-b1f8-e030aceb799f | BIAOXYZ/variousCodes | _CodeTopics/LeetCode/201-400/000300/tran/000300_impl_like_official.cpp | class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
int length = nums.size();
vector dp(length, 1);
for (int i = 1; i < length; ++i) {
for (int j = 0; j < i; ++j) {
if (nums[j] < nums[i])
dp[i] = max(dp[i], dp[j]+1);
}
... | ALGO | 0.999985 | 5.966226 |
50b41051-9b4e-4248-b8a9-081e05991cdc | Harshitv21/TCS-NQT-Coding-Sheet | Arrays/19.cpp | #include <iostream>
#include <map>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
/*
{1,2,3,2,4,3,1,2}
{-199,6,7,-199,3,5}
*/
/*
brute force approach is -
1. sort the array first
2. create a 2d array with first row as distinct elements & second as their corresponding count
3. ??? do t... | ALGO | 0.999915 | 4.029706 |
bba570e5-3f0b-4f99-b924-6083e1f85e52 | tibitTW/metaheuristic-algorithm-implementation | v2/EA - OMP/OneMaxProblemEA.cpp | #include <iomanip>
#include <iostream>
#include <time.h>
#define BIT_SIZE 100
#define TIME_LIMIT_IN_SEC 1800.0
using namespace std;
int main() {
clock_t begin = clock();
unsigned sum, max_of_sum = 0;
unsigned long long n = 0, n_2 = 0, tmp, tmp2;
while (1) {
tmp = n;
tmp2 = n_2;
... | ALGO | 0.999493 | 3.949754 |
e2e9a987-6a51-4545-a905-25df2ebf5f1f | patrick-burasan24/pbinfo | s_p_c_2.cpp | #include <bits/stdc++.h>
std::ifstream fin("s_p_c_2.in");
std::ofstream fout("s_p_c_2.out");
std::vector<std::string> subiecte;
std::vector<std::string> predicate;
std::vector<std::string> complemente;
void solve() {
std::string s;
while (fin >> s) {
if (s.find("S#") != std::string::npos)
... | ALGO | 0.99166 | 3.354521 |
1b180ae4-3507-4c68-87a4-25f80dd5c5b7 | ishandutta2007/codeforces | rafi22/normal/1375/B.cpp | #include <bits/stdc++.h>
#define int long long
#define double long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
using namespace std;
double PI=3.14159265359;
int inf=1000000000000000007;
int mod=1000000007;
int mod1=998244353;
int tab[307][307];
signed main()
{
ios_base::sync_... | ALGO | 0.999528 | 4.048467 |
39941f37-3934-4391-a5b9-a331e8a1a047 | aritraghose/code-archive | striver-a2z-sheet/Longest Consecutive Sequence.cpp | // https://leetcode.com/problems/longest-consecutive-sequence/description/
class Solution {
public:
int longestConsecutive(vector<int>& nums) {
if (nums.size() == 0) return 0;
int longest = 1;
unordered_set<int> st;
for (int i=0; i<nums.size(); i++) {
st.insert(nums[i])... | ALGO | 0.999793 | 5.936648 |
8819aea5-2f81-4eb7-b5c4-b75e2f636c68 | BangKartavya/LeetCode | Remove Nodes From Linked List/main.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* removeNodes... | ALGO | 0.999992 | 5.997483 |
007cab58-0d76-4dce-b231-a468ce688481 | ultimatepp/ultimatepp | uppsrc/Geom/polyalg.cpp | #include "Geom.h"
namespace Upp {
#define POLY_TIMING(n) // RTIMING(n)
#define POLY_LOGGING 0 // 1 = on, 0 = off
/*
static bool ContainsPoints(const Point *poly, int count, Point P)
{
if(count <= 2 || IsNull(P))
return false;
bool in = false;
Point A = poly[count - 1];
Size ap(cmp(A.x, P.x), cmp(A.y, P.y));
... | ALGO | 0.997556 | 5.945828 |
8c314fa1-916f-4be0-a3c5-f5e281b392fb | ishandutta2007/codeforces | hogloid/normal/763/C.cpp | #include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
using namespace std;
#ifndef ONLINE_JUDGE
#define dump... | ALGO | 0.999986 | 3.636452 |
4f0d3b82-377b-4044-bda6-ef63ccbc6b77 | chingoduc/parallel-bayesian-toolbox | src/pbt/noise.cpp | #include "noise.h"
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
Noise::Noise(){
}
frowvec Noise::sample(unsigned int number){
frowvec sampleOutput = zeros<frowvec>(number);
return sampleOutput;
}
frowvec Noise::eval(frowvec x){
frowvec result = zeros<frowvec>(x.n_cols);
return re... | ALGO | 0.891685 | 4.814545 |
d30d4adb-a17d-4b14-bcdc-5a6a1776d2de | Almoontasir/C--C-plus-plus-ProblemSolving | recursion/Gegsforges/Mathmetical/12.cpp | #include<bits/stdc++.h>
using namespace std;
void sol(char a[],int n,int k=0,string s="")
{
if(k==n)
{
return;
}
for(int i=0;i<n;i++)
{
string new_string;
new_string = s+a[i];
cout<<new_string<<endl;
sol(a,n,k+1,s+a[i]);
}
}
int main()
{
char a[]={'a',... | ALGO | 0.999898 | 3.41743 |
b7b57209-cca4-400c-b9e7-767efd8f7183 | 12Sounak/C-_Practice | 4.1_pattern qs-3(Inverted half Pyramid).cpp | //4.1_pattern qs-3 (Inverted half pyramid)
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=n;i>=1;i--){
for(int j=1;j<=i;j++){
cout<<"*";
}
cout<<"\n";
}
}
| ALGO | 0.999952 | 3.733689 |
b5740ab2-62e4-452d-80e4-aa3436594003 | Yeonji-Lim/ps-log | Programmers/PGS_12951_JadenCase만들기.cpp | #include <string>
#include <vector>
using namespace std;
string solution(string s) {
string answer = "";
bool first = true;
for(int i = 0; i < s.length(); i++) {
if(first) {
if(s[i] >= 'a' && s[i] <='z')
s[i] -= 'a'-'A';
first = false;
} else {
... | ALGO | 0.999051 | 5.838357 |
b532cfef-148f-4662-8dc5-a2915b6da5ac | KDE/android-qt | src/xmlpatterns/schema/qxsdparticlechecker.cpp | #include "qxsdparticlechecker_p.h"
#include "qxsdelement_p.h"
#include "qxsdmodelgroup_p.h"
#include "qxsdschemahelper_p.h"
#include "qxsdstatemachine_p.h"
#include "qxsdstatemachinebuilder_p.h"
#include "qxsdtypechecker_p.h"
#include <QtCore/QFile>
QT_BEGIN_NAMESPACE
using namespace QPatternist;
namespace QPatter... | TOOL | 0.925078 | 3.661104 |
46f216c6-d83f-4ad0-ae25-1f1b0c4a4f69 | ishandutta2007/codeforces | tabasz/normal/NA/370.cpp | #include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define pb pop_back
#define ALL(c) (c).begin(), (c).end... | ALGO | 0.999902 | 3.182676 |
3f3e28a0-bad4-4c89-ba52-92ac050930ce | ishandutta2007/codeforces | lackadaisical_lad/normal/961/G.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
ll binpow(ll a, ll p, int mod = MOD) {
ll res = 1;
a %= mod;
while (p) {
if (p & 1) {
(res *= a) %= mod;
}
p >>= 1;
... | ALGO | 0.999997 | 4.630801 |
054040b1-fca8-48a0-a617-1358e1af40fe | dementrock/acm | poj/Archives/1679/7091113_CE.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct
{
int w;
int x;
int y;
}a[10000];
int r[105],ms,sms;
int used[105]; //记录最小生成树的每一条边
int cmp(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}
int find(int x)
{
int t=x;
while (r[x]!=x)
x=r[x];
r[t]=x;
return x;
}
int bing (int x,int... | ALGO | 0.999915 | 3.83185 |
386be93a-5ed2-42b2-946d-03e264fc905c | ytrsk/ICPC_training_respository | OJ/lightoj/1317.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define sqr(x) (x)*(x)
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int maxn=100007;
const int inf=1<<29;
int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9') {if(ch=='-') f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'... | ALGO | 0.999031 | 3.307784 |
4973267f-5602-435e-bc56-8ba277a517b9 | Sameer-Mann/codes | cpp/Dynamic Programming/magical_string.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define range(s,e,d,i) for (ll i =(s); i <= (e); i+=(d))
#define fst first
#define sd second
#define vll vector<ll>
#define print(a) cout<<a<<"\n";
#define input(a,n) range(0,n-1,1,i) cin>>a[i];
#define test ll Testcases;cin>>Te... | ALGO | 0.999951 | 4.085397 |
d8c1ba52-3da9-4b08-871d-8abc066fb7e7 | AnkitPatel27/CSES | Mathematics/Common_Divisors.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vvi vector<vector<int>>
#define vi vector<int>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define FOR(start, end, step) for (int i = start; i <= end; i += step)
int main(){
ios_base::sync... | ALGO | 0.999935 | 4.111057 |
4f77d4bf-cc75-4478-804e-865efe532a57 | yuanwanttoeat/CPE-preparation-and-gpe | Divisor.cpp | #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
using namespace std;
int prime[32000];
vector<int> v;
int main()
{
int N,L,U;
int i,j;
for(i=2; i<32000; i++)
{
if(prime[i]==0)
{
v.push_back(i);
for(j=2*i; j<32000; j+=i)
{
... | ALGO | 0.999944 | 4.217516 |
7a6f51d5-843f-4696-85b2-659080cca680 | Mohit-IITM/CP | 1849B.cpp | #include <bits/stdc++.h>
#include <chrono>
#include <random>
#include <iomanip>
#include <fstream>
using namespace std;
/* ************************************************************************************************************************************ */
typedef long long ll;
typedef long double ld;
#define forn(... | ALGO | 0.99994 | 3.45524 |
3b5ee744-176c-4c69-bb53-5d11c4b56bec | CyanogenMod/android_external_pdfium | core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp | #include "JBig2_HuffmanTable.h"
#include "JBig2_BitStream.h"
#include <string.h>
CJBig2_HuffmanTable::CJBig2_HuffmanTable(const JBig2TableLine *pTable, int nLines,
FX_BOOL bHTOOB)
{
init();
m_bOK = parseFromStandardTable(pTable, nLines, bHTOOB);
}
CJBig2_HuffmanTable::CJBig2_HuffmanTable(CJBig2_BitStr... | ALGO | 0.878883 | 4.985719 |
c1beaf70-bbb8-4ba5-a35e-11a34932263f | Lotuses-robot/Codes | Exercise/CF/1826B/1826B.cpp | template<typename T>
void read(T &r) { r = 0; static char ch, last; ch = getchar(), last = 'z'; while (ch < '0' || ch > '9') last = ch, ch = getchar(); while (ch >= '0' && ch <= '9') r = (r << 1) + (r << 3) + (ch ^ 48), ch = getchar(); r = (last == '-') ? -r : r; }
template<typename T, typename...Ts>
void read(T &arg, ... | ALGO | 0.999931 | 4.653264 |
40dc1d6f-828a-4dc6-addc-793dc0792980 | yzs997/c-primer | chp11/11.20/Source.cpp | #include <map>
#include <string>
#include <iostream>
using namespace std;
int main()
{
map<string, size_t> map_word_count;
string word;
while (cin >> word)
{
auto p = map_word_count.insert({ word, 1 });
if (!p.second)
++p.first->second;
}
for (auto p : map_word_count)
cout << p.first << '\t' << p.secon... | ALGO | 0.99855 | 4.947328 |
bf3105e1-3a9c-45e6-9c6c-ad3c321ecb0b | paularnav/lab-5 | a5q3.cpp | #include <iostream>
using namespace std;
int klarge(int a[100],int n,int k)
{int c;
c=a[n-k];
return c;}
int ksmall(int a[100],int n,int k)
{int c;
c=a[k-1];
return c;}
int main() {
int a[100],n,b,k;
cout<<"Enter the number of elements of the array ";
cin>>n;
cout<<"\nEnter the elements ";
for(int i=0;i<n;i++)
... | ALGO | 0.999969 | 3.537403 |
3a2c7987-6a22-4031-8a13-ed9fbe61135c | VikashTiwari1208/MyLeetcodeSolutions | 2127-maximum-employees-to-be-invited-to-a-meeting/2127-maximum-employees-to-be-invited-to-a-meeting.cpp | class Solution {
public:
int ans=0;
vector<int>vis;
unordered_map<int,vector<int>>adj;
int dfs(int src,int par)
{
vis[src]=1;
int d=0;
for(auto x:adj[src])
{
if(vis[x]==-1&&x!=par)
{
d=max(d,1+dfs(x,src));
}
... | ALGO | 0.999927 | 5.058352 |
994c2525-a985-4f2d-9d86-fec596112059 | ishandutta2007/codeforces | keshi/normal/551/E.cpp | //In the name of GOD
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll maxn = 6e5 + 100;
const ll tof = 720;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt" , "r+"... | ALGO | 0.999951 | 4.169669 |
2a8b3ffd-e18e-47c3-bf02-b4a31ad19120 | ethz-randomwalk/polytopewalk | src/sparse/SparseJohnWalk.cpp | #include "SparseJohnWalk.hpp"
#include "LeverageScore.hpp"
VectorXd SparseJohnWalk::generateWeight(
const VectorXd& x,
const SparseMatrixXd& A,
int k
){
double d = A.cols() - A.rows();
double n = k;
double alpha = 1 - 1/(log2(2.0 * n / d));
double beta = (double)d / (2.0 * n);
if (w_... | ALGO | 0.999817 | 5.342656 |
b6bdff82-a8ed-46a8-8f1e-3dcb484d1ce7 | KSP-07/LeetCode-Questions | First non-repeating character in a stream - GFG/first-nonrepeating-character-in-a-stream.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
//isme basicaly ye dekhna ki agr koi naya character aaya wo immediate purane se same hai to fir jitni ans string hogi ,
//usme se wo phla character le aayga jiski count 1 ho
// aur jo nhi mila koi ... | ALGO | 0.999952 | 5.670784 |
01d7cd95-26d5-417b-af57-4ce025f36b96 | MohamedIrsathworks/LeetcodeSolutions | Programming_Skills/7.cpp | class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
int len = digits.size();
for (int i = len - 1; i >= 0; --i) {
if (digits[i] < 9) {
digits[i]++;
return digits;
}
digits[i] = 0;
}
... | ALGO | 0.999898 | 6.990611 |
3efaf88e-85ca-4add-b74c-9b562b9b7e3e | David-Willo/blensor_modified | extern/recastnavigation/Detour/Source/DetourStatNavMeshBuilder.cpp | #include <math.h>
#include <stdlib.h>
#include <string.h>
#include "DetourStatNavMesh.h"
struct BVItem
{
unsigned short bmin[3];
unsigned short bmax[3];
int i;
};
static int compareItemX(const void* va, const void* vb)
{
const BVItem* a = (const BVItem*)va;
const BVItem* b = (const BVItem*)vb;
if (a->bmin[0] < ... | ALGO | 0.988493 | 6.939585 |
4bec44b5-eca1-4277-a4c1-b1c535f49a52 | Mcdouglas-X/KANGAROO-256-CUSTOM | Merge.cpp | #include "Kangaroo.h"
#include <fstream>
#include "SECPK1/IntGroup.h"
#include "Timer.h"
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#ifndef WIN64
#include <dirent.h>
#include <pthread.h>
#endif
using namespace std;
bool Kangaroo::MergeWork(std::string& file1,std::string& file... | TOOL | 0.946426 | 4.520474 |
eb2262f8-e085-42f1-bfd6-18e66789adc6 | hqwang815/HybridModel | DiffFVMTool/gptoolbox/mex/eltopo.cpp | // Based on `collide_eltopo_mex.cpp` by Leonardo Sacht, 2014.
#include <igl/massmatrix.h>
#include <igl/matlab/MexStream.h>
#include <igl/matlab/mexErrMsgTxt.h>
#include <igl/matlab/parse_rhs.h>
#include <igl/matlab/prepare_lhs.h>
#include <eltopo.h>
#include <iostream>
typedef Eigen::Matrix<double,Eigen::Dynamic,3,E... | ALGO | 0.99931 | 5.934815 |
b076e071-5c80-4202-9b5c-361ecba9e03b | Fenharel1/Competitive-Programming | UVA solutions/1195C.cpp | #include <bits/stdc++.h>
using namespace std;
int heights[2][100005];
int main() {
memset(heights, 0, sizeof(heights));
int n;
cin >> n;
long long sumn1 = 0, sumn2 = 0;
for (int i = 0; i < n; i++) {
cin >> heights[0][i];
}
for (int i = 0; i < n; i++) {
cin >> heights[1][i];
}
long long dp[... | ALGO | 0.999981 | 3.788703 |
96a1a4ea-cf51-408b-a8ac-ec6799ffec18 | aditiagarwal30/Data-Structures-Algorithms | Arrays/All (-)ve on right.cpp | #include<stdio.h>
#include<stdlib.h>
struct Array
{
int A[10];
int size;
int length;
};
void Display(struct Array arr)
{
int i;
printf("\nElements are\n");
for(i=0;i<arr.length;i++)
printf("%d ",arr.A[i]);
}
void Neg_on_Left(struct Array arr)
{
int i=0,j=arr.length-1;
while(i<j)
{
whi... | ALGO | 0.999984 | 3.50578 |
073cd1bf-5dc5-4647-bfd7-442191d0eb0b | Sivasai28/CSA0698-Design-Analysis-and-Algorithms- | 3-gcd recursion.cpp | #include <stdio.h>
int gcd(int a, int b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
int main()
{
int num1, num2;
printf("Enter two numbers: ");
scanf("%d %d", &num1, &num2);
if (num1 < 0 || num2 < 0)
{
printf("Both numbers should be positive.\n");
return... | ALGO | 0.999199 | 5.482651 |
35071c85-dc6e-46a6-a750-03ca9390b9e8 | Avinash0308/GFGProblemOfTheDaySolution_2023 | JAN 6 2023 -- Flattening a LL Solution.cpp | class Solution {
public:
Node *flatten(Node *root)
{
// NOTE - I used merge sort to sort the given ll matrix but recursive method can also be used which have less lines of code;
if(root == NULL || root->next == NULL)return root; // if root is null or the next to root is null we will return it as... | ALGO | 0.99998 | 5.289536 |
97e36062-6d75-4606-b08f-6af989ddfb7e | VisheshPandita/os | worstFitMemoryManagement.cpp | #include<bits/stdc++.h>
using namespace std;
void worstFit(int blockSize[], int m, int processSize[],
int n)
{
int allocation[n];
memset(allocation, -1, sizeof(allocation));
for (int i=0; i<n; i++)
{
int wstIdx = -1;
for ... | ALGO | 0.999819 | 4.209522 |
f434b581-39ca-4776-9b52-2e2198813ee6 | Zaber30/Codeforces-Github | A_Prefix_and_Suffix_Array.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int t,i;
cin>>t;
for(i=1;i<=t;i++)
{
int n,j;
vector<string>v;
vector<pair<int,int>>o;
cin>>n;
string s[(n*2-2)];
for(j=0;j<((2*n)... | ALGO | 0.999956 | 3.880972 |
4f42a9a4-84e0-47a8-89a8-9a6e4b7f8555 | lordtrev4/ENSF480 | Lab1/Exercise B/dictionaryList.cpp | /*
* File Name: dictionaryList.cpp
* Assignment: Lab 1 Exercise C
* Completed by: Trevor Nguyen and Zachary Lam
* Submission Date: Sept 13, 2024
*/
#include <assert.h>
#include <iostream>
#include <stdlib.h>
#include "dictionaryList.h"
#include "mystring_B.h"
using namespace std;
Node::Node(const Key& keyA,... | TOOL | 0.888179 | 4.963274 |
00503e7c-9210-460d-aa09-96a8f6a123d5 | arujbansal/competitive-programming-algorithms | YouTube/Sparse_Table.cpp | #include <bits/stdc++.h>
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N, Q;
cin >> N >> Q;
vector<int> A(N);
for (auto &x : A)
cin >> x;
vector<int> lg(N + 1); // lg[i] = log2(i)
lg[1] = 0;
for (int i = 2; i <= N; i++)... | ALGO | 0.999971 | 5.012735 |
fa6ebedd-bf41-4bfb-99ba-0dd5aad9cd60 | Jimin15/Linklist | UnsortedList.cpp |
template<class T>
UnsortedList<T>::UnsortedList() {
length = 0;
head = nullptr;
}
template<class T>
void UnsortedList<T>::MakeEmpty() {
length = 0;
while(head != nullptr){
Node* tmp = head;
head = head->next;
delete tmp;
}
}
template<class T>
bool UnsortedList<T>::IsFull... | TOOL | 0.892854 | 4.977114 |
a629ae5b-d01f-4b6b-bf37-bd5943442559 | Sujit-kushwaha9/Flutter | my_mobile/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.998888 | 6.76775 |
9d6c2516-9438-4d8c-a969-d3f3006f6b4f | fathink/DataStruct | tmp/ShortestPath_Dijkstra.cpp | //ShortestPath_Dijkstra algorithm by adjacency matrix of directed graphs
//2015/12/13
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
#define numVertex 6 //Graph's vertex numbers
#define INFINITY 65536
typedef int Patharc[numVertex]; //save the shortest path's inferior
typedef int Short... | ALGO | 0.999917 | 3.953721 |
0a7b1f8e-780c-4f64-ab5e-5a7dedf9f793 | nazibur175/C- | Distinct_Numbers.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define test int t; cin>>t; while(t--)
void solve(){
int n;
cin>>n;
int a[n];
set<int>s;
for(int i=0;i<n;i++){
int x;
cin>>x;
s.insert(x);
}
cout<<s.size()<<... | ALGO | 0.999146 | 4.615353 |
49662fe2-44b3-48d2-8225-fb83290f7584 | myunghong/baekjoon | 그리디/공주님의정원.cpp | #include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
pair <int,int> board[100005];
int main(void){
cin.tie(0);
ios::sync_with_stdio(0);
int day[12] = {0,31,59,90, 120, 151, 181, 212, 243, 273, 304, 334};
int n, cnt = 0, fin = 0, tempfin = 0; cin >> n;
for(int i = 0; i<n; i++)... | ALGO | 0.999947 | 3.854315 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.