uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0fed10ee-63f6-4d22-aa69-62303f6d7538 | omelkonian/snap | src/LinearHashTable.cpp | /*
* LinearHashTable.cpp
*
* Created on: 8/11/2014
* Author: Thanos Soulis
*/
#include "LinearHashTable.h"
using namespace std;
LinearHashTable::LinearHashTable(int m, int c) {
this->initialBucketNo = m; // increment the initialBucketNo += m at the end of each splitting round
this->currentBucketNo = m... | ALGO | 0.98849 | 4.596265 |
14e8a3bc-7e02-4935-b179-c62ca6b33c41 | Govindkm/DSA | Mathematical/isPrime.cpp | #include <iostream>
using namespace std;
// Worst case: O(n)
bool Naive_isPrime(int n)
{
if (n == 1 || n == 2)
{
return false;
}
for (int i = 2; i < n; ++i)
{
if (n % i == 0)
{
return false;
}
}
return true;
}
// Worst case: O(sqrt(n))
bool isPrim... | ALGO | 0.999572 | 5.579366 |
7524ffeb-db15-4b25-bb15-335ad483a08d | ArthurDetomi/Maratona_Treino | arcade/santo_antonio.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define pii pair<int, int>
using namespace std;
double solve(int n, double c) {
if (n == 0) {
return 0;
}
return (solve(n - 1, c) + c) / 2;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
double c;
cin >> n >> c;
cout << solve(n, ... | ALGO | 0.999866 | 3.239461 |
87c5e6a9-8e9a-47cd-afae-46a72132d4a4 | DevendraRahangdale/DSA-CPP | DecimalToBinary.cpp | #include<iostream>
#include<cmath>
using namespace std;
// decimal To Binary
// by division method
// int decimaltobinarymethod1(int n){
// int binaryno=0;
// int i =0;
// while(n>0){
// int bit=n%2;
// binaryno=bit*pow(10,i++)+binaryno;
// n=n/2;
// }
// return binaryno;
// }
//... | ALGO | 0.999881 | 5.428564 |
3221affd-94b0-41df-979d-8b861199b802 | AgarPiyush/Spoj | SUBS.cpp | //Author: Piyush Agarwal, MNNIT Allahabad
#include<bits/stdc++.h>
using namespace std;
#define inp1(a) scanf("%d",&a)
#define inp2(a,b) scanf("%lld %lld",&a,&b)
#define line(a) printf("%lld ",a);
#define next() printf("\n");
#define out(a) printf("%lld\n",a)
#define ll int
#define pb push_back
#define mp make_pair
#def... | ALGO | 0.999649 | 3.932464 |
1129e31d-b781-4956-b459-1d230a3a97ff | Joao-Silverio/Sokoban | movimentos.cpp | #include <conio.h>
#include "objetivo.cpp"
#include "voltarmov.cpp"
#include "movimentos.hpp"
void andarcima(MAPA &mapajogo) {
if(mapajogo.matriz[mapajogo.x-1][mapajogo.y] == 1 ){
return;
} else if(mapajogo.matriz[mapajogo.x-1][mapajogo.y] == 2 && mapajogo.matriz[mapajogo.x-2][mapajogo.y] == 1) { //Se ... | ALGO | 0.992975 | 3.472885 |
a084629b-756a-400d-86e6-acf74e93abd7 | ishandutta2007/codeforces | fizzydavid/normal/914/G.cpp | //by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
... | ALGO | 0.999982 | 3.860753 |
2a05230a-679e-4827-9fa4-c56ea67b45e9 | TonChan0828/AtCoder | ABC/ABC177/C.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
bool chmax(T &a, const T &b)
{
if (a < b)
{
a = b; // aをbで更新
return true;
}
return false;
}
template <typename T>
bool chmin(T &a, const T &b)
{
if (a > b)
{
a = b; // aをbで更新
return true;
}
return f... | ALGO | 0.99999 | 4.709801 |
3939cb50-2447-4685-8eb4-689c2a872200 | Liveinthecloud/C--CPlusPlus | 字符串排序/未命名1.cpp | #include<stdio.h>
#include<string.h>
#define LINEMAX 20
int main()
{
void sort(char **p);
int i;
char **p,*pstr[5],str[5][LINEMAX];
for(i=0;i<5;i++)
{
pstr[i]=str[i];
}
printf("input 5 string:\n");
for(i=0;i<5;i++)
{
scanf("%s",pstr[i]);
}
p=pstr;
sort(p);
printf("output string:\n")
for(i=0;i<... | ALGO | 0.99993 | 3.434341 |
44b4e4e3-7076-43c6-a503-e819cb8cd0be | louisfghbvc/Other-Online-Judge | CodeForces/Round #667 (Div. 3)/C - Yet Another Array Restoration.cpp | // first enum minimum d. because the difference.
// and just build the remain array.
#include <bits/stdc++.h>
#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef ... | ALGO | 0.999922 | 3.168565 |
85350a59-0a3a-4911-bba9-24ddf8ffa7e8 | sam5854/lc_submitter | C++/cinema-seat-allocation.cpp | // Time: O(n)
// Space: O(n)
class Solution {
public:
int maxNumberOfFamilies(int n, vector<vector<int>>& reservedSeats) {
unordered_map<int, unordered_map<int, bool>> lookup;
for (const auto& seat : reservedSeats) {
if (2 <= seat[1] && seat[1] <= 5) {
lookup[seat[0]][0... | ALGO | 0.998357 | 6.641209 |
e71ba971-3d56-4f5b-bade-56ef891310a4 | VedanttPandey/LeetCode | 0106-construct-binary-tree-from-inorder-and-postorder-traversal/0106-construct-binary-tree-from-inorder-and-postorder-traversal.cpp | class Solution {
public:
map<int, int> mp;
TreeNode* helper(vector<int> &inorder, int inStart, int inEnd,
vector<int> &postorder, int postStart, int postEnd) {
if (inStart > inEnd || postStart > postEnd) return NULL;
TreeNode* root = new TreeNode(postorder[postEnd]);
... | ALGO | 0.999976 | 6.145111 |
1ae09059-bb21-436b-b3e7-ece7121bc505 | Ethan-ZYF/CPTraining | train/1679D.cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...)
#endif
void solve() {
i64 n, m, k;
cin >> n >> m >> k;
vector a(n, 0);
for (auto& x : a) cin >> x;
vector<vector<int>> g(n);
for (int i = 0; i < m; i++) {
... | ALGO | 0.999976 | 5.073675 |
27256a5e-d469-41d5-bf55-420c184d8344 | Jashvinu/MIT | SEM 4/ADS Lab/CLASS 9 11-05-2022/multimap.cpp | #include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <map>
#include <iterator>
using namespace std;
void display(multimap<int,int> mp)
{
multimap<int,int>::iterator it;
for(it=mp.begin();it!=mp.end();++it)
{
cout<<"Key = "<<it->first<<" Value = "<<it->second<<endl;
}
cout<<endl;
}
void... | ALGO | 0.974481 | 4.496261 |
10534037-9e81-4c69-9db4-064097b30674 | ishandutta2007/codeforces | batrr/normal/1067/B.cpp | #include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
const int N = (int)1e5 + 123, inf = 1e9;
const ll INF = 1e18;
vect... | ALGO | 0.999998 | 4.401808 |
4f701ae1-c555-493a-8624-a07817c25aae | KennethYangle/CMPCC | Eigen/doc/examples/QuickStart_example2_fixed.cpp | #include <iostream>
#include <Eigen/Dense>
using Eigen::Matrix3d;
using Eigen::Vector3d;
int main() {
Matrix3d m = Matrix3d::Random();
m = (m + Matrix3d::Constant(1.2)) * 50;
std::cout << "m =" << std::endl << m << std::endl;
Vector3d v(1, 2, 3);
std::cout << "m * v =" << std::endl << m * v << std::endl;
}... | ALGO | 0.997951 | 3.598975 |
a7fb4b5c-671f-41a2-be46-8b33d2742c25 | ishandutta2007/codeforces | 12tqian/normal/1472/A.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iostream>
#include <iomanip>
#incl... | ALGO | 0.999818 | 4.995969 |
9f55a8ce-e77c-46fa-beab-5080c5bd9ae3 | Saharsh979/CP-Algorithms | A_Bit_.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
int val = 0;
while (t--)
{
string s;
cin >> s;
if (s[1] == '+')
{
val++;
}
else
{
val--;
}
}
cout << val << endl;
} | ALGO | 0.999818 | 4.338281 |
76bf0d81-42e5-4092-b147-6fa471e6dc3f | SoyOscarRH/CompetitiveSolutions | Leetcode/949-LargestTimeForGivenDigits.cpp | struct Solution {
auto largestTimeFromDigits(vector<int>& t) -> string {
sort(begin(t), end(t), greater<int> {});
do {
const auto hours = t[0] * 10 + t[1], minutes = t[2] * 10 + t[3];
if (hours < 24 and minutes < 60) {
auto time = string {"xx:xx"};
time[0] = t[0] + '0';
ti... | ALGO | 0.995234 | 6.639756 |
bbb6163d-7c8a-4bdd-9933-0e8b7c653564 | MoncefMhasni/MCPC18 | I.cpp | #include<bits/stdc++.h>
#define ll long long
#define max(a,b) a>b ? a:b
using namespace std;
const int NMAX =1e5+5,TMAX = 10+3;
class meeting{
public :
ll p,d,s,t;
friend bool operator<(const meeting a,const meeting x){return a.s<x.s;}
friend bool operator<(const meeting a,ll u){return a.s<u;}
};
ll dp[NM... | ALGO | 0.999847 | 3.326708 |
10a217f6-df6a-44a7-b637-39b5fbe976cb | IsaacZheng99/programming-language-learning | C++/83-Bitwise_Operators/Code/BitwiseOperators/BitwiseOperators/src/Main.cpp | #include <iostream>
#include <bitset>
int main()
{
// 2. <<
int i1 = 1;
int i2 = i1 * 2; // in fact, the compiler will produce "i2 = i1 << 1;"
int i3 = i1 << 1;
std::cout << i1 << ", " << i2 << ", " << i3 << std::endl;
// 4. | for combining
// 11111010 & 00001111 = 00001010
// 1100 << 4 = 11000000
// 110000... | ALGO | 0.999587 | 4.926698 |
7a70edcc-c56a-4282-b656-4273fff0c5a9 | harshdigi/Data-Structure-and-Algorithm | String/WordPattern.cpp | #include<bits/stdc++.h>
using namespace std;
bool wordPattern(string pattern, string s) {
unordered_map<char,string> pattern_to_s;
unordered_map<string, char> s_to_pattern;
int j=0;
int i=0;
string temp;
while(i<=s.length() && j<pattern.length()){
if( s[i] =... | ALGO | 0.999602 | 5.218771 |
83a80110-8171-4dfa-a5fe-f50f33fce909 | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/10/1019/personal_submission/cf255e_retyrn.cpp | const int N = 1e6;
int n;
void solve() {
vector<int> sg(N, 0);
int l = 0, r = 0;
map<int, int> mp;
for (int i = 1; i < N; i ++) {
while (r * r <= i and r < i) {
mp[sg[r]] ++;
r ++;
}
while (l * l * l * l < i) {
mp[sg[l]] --;
l... | ALGO | 0.999642 | 4.743046 |
696feff3-d273-4429-9883-4ff13bc096eb | sunqueen/vlc-2.1.4.32.subproject-2013 | modules/access/dshow/crossbar.cpp | /*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#ifndef _MSC_VER
/* Work-around a bug in w32api-2.5 */
# define QAC... | TOOL | 0.898159 | 4.675938 |
a3914e15-8c0d-49fb-9a3c-634b2c8c73a2 | zt5rice/LC-archive | 0948. Bag of Tokens/Solution0948.cpp | #include<vector>
#include<algorithm>
using namespace std;
class Solution0948 {
public:
int bagOfTokensScore(vector<int>& tokens, int power) {
int point = 0, res = 0;
sort(tokens.begin(), tokens.end());
int left = 0, n = tokens.size(), right = n - 1;
while (left <= right && (pow... | ALGO | 0.999898 | 6.093226 |
98d43144-5462-4b66-b996-1c597bd293f1 | ddubl/archiver | lib/opencv/3rdparty/openexr/Imath/ImathMatrixAlgo.cpp | //----------------------------------------------------------------------------
//
// Implementation of non-template items declared in ImathMatrixAlgo.h
//
//----------------------------------------------------------------------------
#include "ImathMatrixAlgo.h"
#include <cmath>
#include <algorithm>
#if defined(OPENE... | ALGO | 0.999787 | 6.941531 |
9b632cc1-71e2-4bbe-8a58-3b11954c3985 | Fardin2112/DSAByShradha | map/multimap.cpp | #include<iostream>
#include<map>
using namespace std;
int main(){
multimap<string,int>m;
m.emplace("tv",100);
m.emplace("tv",100);
m.emplace("tv",100);
m.emplace("tv",100);
// if we used normal map then even after inserting multiple times tv we get only one tv value but here not
for (... | ALGO | 0.900614 | 4.249814 |
793a2fb5-8768-4e38-8ee8-7efee39aacb2 | Souvik5051/C-Programming | Condition_Of.cpp/Calculate-The-Profit.cpp | #include <iostream>
using namespace std;
int main()
{
int cp, sp, amt;
cout << "Enter the cost price : ";
cin >> cp;
cout << "Enter the selling price : ";
cin >> sp;
if (sp > cp)
{
amt = sp - cp; // profit
cout << "Profit = " << amt;
}
else if (cp > sp)
{
... | ALGO | 0.978914 | 4.079326 |
4692f35a-ff25-40d0-b9fe-fd123ed5a3d8 | akiba-miku/Algorithms | src/class12/BagMod/knapsack.cpp | // 测试链接 : https://www.luogu.com.cn/problem/P1048
#include <bits/stdc++.h>
using namespace std;
const int N = 1001;
int costs[N], values[N];
int t, m;
int dp[N][N]; // 二维dp表
void compute() {
// 初始化dp数组, 全局初始化默认为0,这里不必显式初始化。
// for (int i = 0; i <= t; i++) {
// dp[0][i] = 0; // 如果没有物品,背包的最大值肯定是0
// ... | ALGO | 0.999986 | 5.194269 |
b018ede1-b99e-41b3-a404-dd5b2165bdbe | mahfuj10/Codeforces | 271A - Beautiful Year.cpp | #include <iostream>
using namespace std;
int main()
{
int year;
cin >> year;
while (true)
{
year++;
int a = year / 1000, b = year / 100 % 10, c = year / 10 % 10, d = year % 10;
if (a != b && a != c && a != d && b != c && b != d && c != d)
break;
}
cout <<... | ALGO | 0.995966 | 3.901894 |
0619ae62-41f6-4478-af59-24640956f4a2 | Jiwan/RADS | thirdparty/boost/libs/polygon/benchmark/voronoi_benchmark_points.cpp | // Boost.Polygon library voronoi_benchmark.cpp file
// See http://www.boost.org for updates, documentation, and revision history.
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <numeric>
#include <vector>
#include <utility>
#include <boost/random/mersenne_twister.hpp>
#includ... | TEST | 0.973116 | 7.029484 |
113c6c4d-1c6f-4e81-b978-02ebe1d5a75c | yitati/LCProject | Leetcode/SingleNumberII.cpp | /*************************************************************/
/*
* Question: #137 Single Number II
* Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one.
* Note:
* Your algorithm should have a linear runtime complexity. Could you implement it... | ALGO | 0.999657 | 5.576599 |
7cd46261-0827-46a4-a769-8a4c101eddb9 | Arman07N/D05M09Y2024_binarySearch | chapter_4/program_exs46.cpp | #include<bits/stdc++.h>
using namespace std;
inline int max(int a, int b, int c)
{
return(a>b?(a>c?a:c):(b>c?b:c));
}
int main()
{
int x,y,z;
cout<<"Enter three numbers: ";
cin>>x>>y>>z;
cout<<"\n";
cout<<"Maximum number is: "<<max(x,y,z);
cout<<"\n";
return(0);
} | ALGO | 0.999425 | 3.938237 |
3fee4acb-8b82-4c2d-a913-761a05f775f3 | ishandutta2007/codeforces | relyt871/normal/1592/C.cpp | #include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
using namespace std;
typedef long long LL;
const int MAXN = 100005;
template <typename T> inline void read(T &WOW) {
T x = 0, flag = 1;
char ch = getchar();
while (!isdigit(ch)) {
if (ch == '-') flag = -... | ALGO | 0.999972 | 5.023415 |
a5448859-230b-463d-98a3-4b4c5eefc9c0 | wootguy/SevenKewp | dlls/monster/h_ai.cpp | /*
h_ai.cpp - halflife specific ai code
*/
#include "extdll.h"
#include "util.h"
#include "monsters.h"
#include "game.h"
#define NUM_LATERAL_CHECKS 13 // how many checks are made on each side of a monster looking for lateral cover
#define NUM_LATERAL_LOS_CHECKS 6 // how many checks are made on each side of... | ALGO | 0.996106 | 6.181037 |
cba15e2e-c094-4cab-82da-64e23894ffc6 | ishandutta2007/codeforces | sonechko/normal/702/C.cpp | #include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
const int N = 100000+5;
const int M = 10;
const string st2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string s1 = "abcdefghijklmnopqrstuvwxyz";
const string d = ".BRG";
#define mod % MOD
#define filesio(x) freopen(x ".in", "r", stdin); freopen(x ".o... | ALGO | 0.999991 | 3.63731 |
2df8bd3c-8342-4df7-900e-e34e13a2efa6 | mdmohsin212/phitron | week 11/day 6/I_Subarray_Sums_I.cpp | #include<bits/stdc++.h>
using namespace std;
#define fastio() \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ln '\n'
#define gcd(a, b) __gcd(a, b)
#define ll long long
typedef vector<ll> vi;
typed... | ALGO | 0.999986 | 4.633938 |
79e9cfb3-d7a7-44fd-9e4f-47c3272f93fe | matheus1ima/ED-UFC | Atividade14/14 - Algoritmos de Ordenação - Quicksort - Mínimo de Trocas.cpp | #include <iostream>
#include <vector>
using namespace std;
void printvector(vector<int> &arr, int a){
if(a == 0) return;
cout << "[" << arr[0];
for(int i = 1; i < a; i++){
cout << "," <<arr[i];
}
cout << "]";
}
int selection_sort(vector<int> &trocas, int a){
int cont = 0;
for(int i = 0; i < a; i++){
int m... | ALGO | 0.999311 | 3.765355 |
97f2ce33-5a43-4048-adbb-49d98456703f | shreyasmishragithub/Leetcode | 987-vertical-order-traversal-of-a-binary-tree/987-vertical-order-traversal-of-a-binary-tree.cpp | class Solution {
public:
vector<vector<int>> verticalTraversal(TreeNode* root) {
if(root == NULL) return {{}};
//queue for level order traversal
queue<pair<TreeNode*,int>>q;
q.push({root, 0});
// answer map ->> {vertical level, {vertical level element}}
... | ALGO | 0.999998 | 6.160645 |
b2237113-3d7f-4371-a2aa-4f1e8c70ea7f | anand3eight/CampusCodeVault | Sem 3/DS Lab/Graphs/2.cpp | // Type of Graph
#include <iostream>
#include <cstdlib>
using namespace std;
struct Graph
{
int v;
int **dir;
};
typedef struct Graph Graph;
Graph *createGraph(int v)
{
Graph *G = new Graph;
G->v = v;
G->dir = new int *[v];
for (int i = 0; i < v; i++)
{
G->dir[i... | ALGO | 0.99945 | 4.860703 |
6bfe37d9-2566-4480-a886-aa976f38e3e2 | AntonioVillatoro/cpp | EJERCICIOS/EJERCICIO24-Suma de Pares/sumapares.cpp | #include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int pares=0;
for (int i = 1; i <=100; i++)
{
if (i % 2 == 0)
{
pares = pares + i;
}
cout << i << " ";
}
cout << endl;
cout << "TOTAL PARES " << pares;
cout << endl;
return 0;
}
| ALGO | 0.991321 | 4.044453 |
54b468b5-f296-4a73-9a62-6f758bd01f38 | adityak54/cp | 24-aug-24/A_2_Make_Nonzero_Sum_hard_version.cpp |
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pi pair<int,int>
#define all(n) n.begin(), n.end()
#define rall(n) n.begin(), n.end(), greater<int>()
#define fr(i,a,b,c) for(int i=a;i<b;i+=c)
#define rfr(i,a,b,c) for(int i=a;i>=b;i-=c)
#define pb push_back
// Input Functions
template<t... | ALGO | 0.999611 | 4.612718 |
6dc40420-e483-4574-a90a-051234706a74 | BGlasgowww/Project3 | Source.cpp | #include "bTree.h"
#include<iostream>
#include<cstdlib>
using namespace std;
int main() {
int n;
bTree B;
cout << "This program will generate 40 random numbers. " << endl;
cout << "Then it will be wrapped with a node then inserted into the linked list. " << endl;
cout << "It will then traverse the tree in pre/... | ALGO | 0.996985 | 4.410732 |
29683cb1-efbd-4237-baae-9c3182cb00be | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4904_8.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
if (a < 3)
cout << "No";
else {
cout << "Yes" << endl;
int b = a / 2, c = a / 2 + a % 2;
cout << a << " ";
for (int i = 2; i <= a; i += 2) cout << i << " ";
cout << endl << c << " ";
for (int i = 1; i <= a; i... | ALGO | 0.999871 | 3.569655 |
e113242c-0cba-4e57-8821-a4c32d9a2f78 | Grissia/reirei_problemset | in-school_pre_test_2/p1.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int d,e,a,b;
cin >> d >> e >> a >> b;
int o_a = a;
int o_b = b;
bool flag1 = false;
bool flag2 = false;
int tmp = 0;
while(d--){
a -= e;
b -= e;
if(a <= 0) flag1 = true;
if(b <= 0) flag2 = true;
... | ALGO | 0.999959 | 3.104246 |
95004877-1372-444e-a272-5c78170e8dbc | Ekaterina-T44/Domashnee-zadanie-14_2 | zadanie 1/zadanie 1.cpp | // zadanie 1.cpp :
// Написать следующие функции для работы с динамическим маcсивом.
/*■ Функция распределения динамической памяти.
■ Функция инициализации динамического массива.
■ Функция печати динамического массива.
■ Функция удаления динамического массива.
■ Функция добавления элемента в конец массива.
■ Функция вс... | ALGO | 0.992035 | 3.632519 |
9cdcbcee-8afa-445c-9976-bc66ceda2d0b | BhishamGahlaut805/C_CPP_DSA_Algorithms | DSA_QUESTIONS/9_KruskalAlgorithm.cpp | #include <bits/stdc++.h>
using namespace std;
// Comparator function to sort edges by increasing weight
bool cmp(vector<int> &a, vector<int> &b)
{
return a[2] < b[2]; // Sort edges based on weight in ascending order
}
// Function to initialize Disjoint Set (Union-Find) with parent and rank arrays
void makeSet(vec... | ALGO | 0.999997 | 6.481476 |
ec4a7f02-f76e-4e4d-b10e-581877067c36 | Vojlok/tsmp_project | xrConverter/level_mesh_materials.cpp | #include <list>
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 1
#ifdef _MSC_VER
#include <hash_map>
#else
#include <map>
#endif
#include "xr_cform.h"
#include "xr_utils.h"
#include "level_mesh.h"
using namespace xray_re;
void level_mesh::create_debug_face(uint32_t v0, uint32_t v1)
{
if (!m_debug_cform)
retur... | ALGO | 0.990992 | 4.926249 |
10480a0d-c623-4c61-8b8d-b3a5b5c96bf2 | emil487646/NLDD | ddm/DahlgrenSpace.cpp | /*
* File: DahlgrenSpace.cpp
* Author: em3323en
*
* Created on April 18, 2023, 1:41 PM
*/
#include <math.h>
#include "DahlgrenSpace.h"
#include "VectorSpaceFunction.h"
DahlgrenSpace::DahlgrenSpace(int N, double tau, double alpha) {
this->N=N;
this->tau=tau;
this->alpha=alpha;
this->spectral =... | ALGO | 0.998567 | 6.515048 |
7ee1f03a-c300-4a64-a8ee-206b1373e26c | xoyojank/nebula3 | code/extlibs/OGDF/src/upward/VisibilityLayout.cpp | /*
* $Revision: 2559 $
*
* last checkin:
* $Author: gutwenger $
* $Date: 2012-07-06 15:04:28 +0200 (Fr, 06. Jul 2012) $
***************************************************************/
#include <ogdf/upward/VisibilityLayout.h>
#include <ogdf/basic/simple_graph_alg.h>
#include <ogdf/basic/extended_graph_alg.h... | ALGO | 0.994803 | 6.168905 |
21e31085-382d-491c-9199-76f95c351176 | unofficial-risingos-backup/android_frameworks_native | vulkan/libvulkan/api.cpp | // The API layer of the loader defines Vulkan API and manages layers. The
// entrypoints are generated and defined in api_dispatch.cpp. Most of them
// simply find the dispatch table and jump.
//
// There are a few of them requiring manual code for things such as layer
// discovery or chaining. They call into functi... | CONFIG | 0.930953 | 4.624862 |
4e1ec8f3-a3c9-4d61-a752-b873ca88cee9 | microsoft/BlingFire | blingfirecompile.library/src/FATestCmpDfa.cpp | #include "blingfire-compile_src_pch.h"
#include "FAConfig.h"
#include "FATestCmpDfa.h"
#include "FARSDfaCA.h"
#include "FAState2OwCA.h"
#include "FAState2OwsCA.h"
#include "FAUtils.h"
#include "FAMealyDfaCA.h"
#include "FAFsmConst.h"
namespace BlingFire
{
FATestCmpDfa::FATestCmpDfa (FAAllocatorA * pAlloc) :
m_pDf... | ALGO | 0.913058 | 7.576153 |
52700148-a889-4fcb-9467-423fa8f367ca | vfolunin/archives-solutions | Kattis/countingdays.cpp | #include "countingdays.h"
int d = 1, h = 0, m = 0;
void lookAtClock(int hours, int minutes) {
d += hours < h || hours == h && minutes < m;
h = hours;
m = minutes;
}
int getDay() {
return d;
} | ALGO | 0.998143 | 4.143978 |
9e7fd492-8efa-4603-b8b8-92a922ce43bb | katariaNandini/LeetCode | 73-set-matrix-zeroes/set-matrix-zeroes.cpp | class Solution {
public:
void setZeroes(vector<vector<int>>& matrix) {
int col0=1;
int n=matrix.size();
int m=matrix[0].size();
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(matrix[i][j]==0){
matrix[i][0]=0;
if(j!=0... | ALGO | 0.99937 | 6.752607 |
7049c7b5-deb7-4384-a6a1-0e571b4e1d1f | TeamTwisted/external_llvm | lib/Transforms/Utils/CtorUtils.cpp | #include "llvm/Transforms/Utils/CtorUtils.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#define DEBUG... | TOOL | 0.92463 | 7.825929 |
1d07e7ec-f2fc-4621-b0ec-d4282b298cdc | wangmu0701/ReverseAD | ReverseAD/src/checkpointing/iterative_func_base.cpp | #include <iostream>
#include <cassert>
#include "reversead/activetype/base_active.hpp"
#include "reversead/algorithm/base_reverse_adjoint.hpp"
#include "reversead/algorithm/base_reverse_hessian.hpp"
#include "reversead/algorithm/base_reverse_third.hpp"
#include "reversead/common/reversead_core.hpp"
#include "reversead... | ALGO | 0.982196 | 6.48073 |
055c5c45-5b72-4139-a7ee-e7cb5425e843 | aghobrial/Challenges | C++/Staircase/staircase.cpp | #include <bits/stdc++.h>
using namespace std;
void staircase(int n) {
for (int height = 1; height <= n; height++) {
for (int spaces = n-height; spaces > 0; spaces--){
cout << " ";
}
for (int stairs = n-height; stairs < n; stairs++){
cout << "#";
}
co... | ALGO | 0.999294 | 4.233313 |
0393b421-5e76-4d87-ab09-7c58826790b3 | jhwest1/2024-1-snups-intermediate-mid | 1-data-structure/1-hashmap/11-lowest-points.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
int n; cin >> n;
map<int, int> mp;
for (int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
if (mp.find(x) == mp.end() || mp[x] > y) {
mp[x] = y;
}
}
... | ALGO | 0.999709 | 4.531962 |
d6130de7-b9c0-4335-86a9-550ddd546fb1 | ishandutta2007/codeforces | emthrm/normal/1687/C.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constex... | ALGO | 0.999978 | 4.420422 |
72cd00fd-c71d-4038-a134-c0b00c804f39 | Likaiqiang96/leetcode | 3_max_substring.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
unordered_map<char, int> windows;
int left = 0, right = 0;
int length = 0;
while (right < s.size()) {
char c = s[right];
right++;
windows[c]++;
// windows not valid
... | ALGO | 0.999876 | 6.015069 |
384ec733-f60c-4105-bb79-7898c5189cf8 | iampiyush/Algorithms_interview | N_Largest_BST_Amazon.cpp |
void nLargestUtil(node* root,int &ans,int &count,int N)
{
if(root==NULL)
return ;
nLargestUtil(root->right,ans,count,N);
if(count==N)
{
ans=root->data;
count++;
}
else
count++;
nLargestUtil(root->left,ans,count,N);
}
int nLargeBST(node* root, int N) {
{
if(root==NULL) // condition check
{
re... | ALGO | 0.999978 | 4.272672 |
b439f907-0bbd-4e08-9dcc-e25f3cd12819 | kkoma2623/ProblemSolving | Baekjoon/18511Baek.cpp | #include <iostream>
#include <vector>
using namespace std;
int N;
vector<int> k;
int maxi;
void getInputs(){
cin >> N;
int temp; cin >> temp;
for(int i=0; i<temp; ++i){
int t; cin >> t;
k.push_back(t);
}
}
void dfs(int currNum){
if(currNum > N)
return;
maxi = max(curr... | ALGO | 0.999481 | 4.382515 |
5fa472dd-925b-4cdf-808b-7a225a2486f7 | sanjiv0286/Leetcode-Problem-Submissions | 0047-permutations-ii/0047-permutations-ii.cpp |
class Solution {
public:
vector<vector<int>> res;
void solve(vector<int>& nums, int i) {
if (i == nums.size()) {
res.push_back(nums);
return;
}
unordered_set<int> s;
for (int j = i; j < nums.size(); j++) {
if (s.find(nums[j]) != s.end()) {
... | ALGO | 0.999996 | 6.544009 |
599e6046-9d03-4d98-95f3-bafe26e71c36 | rapel02/competitive-programming | UVa/444.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string in;
while(getline(cin,in))
{
int len = in.length();
if(in[0] >='0' && in[0] <= '9')
{
int num = 0;
for(int a=len-1;a>0;a-=2)
{
num = (in[a]-'0')*10 + in[a-1]-'0';
if(num < 32)
{
num*=10;
num += (in[a-2] -'0');
... | ALGO | 0.999474 | 3.726853 |
34ac5481-f65f-4f5c-88c6-388358715b1e | rohitpoks/competitive-programming | CP Problems/cf2029c.cpp | #include <stdio.h>
#include <iostream>
#include <list>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <climits>
#include <cassert>
using ll = long long;
using namespace std;
ll new_rating(ll cur, ll contest) {
retu... | ALGO | 0.999909 | 4.337353 |
7a6eca04-d2c7-43cd-8334-6cba6b2f3ea1 | sarvex/leetcode-brainfuck | solution/1900-1999/1961.Check If String Is a Prefix of Array/Solution.cpp | class Solution {
public:
bool isPrefixString(string s, vector<string>& words) {
string t = "";
for (string& w : words) {
t += w;
if (t.size() == s.size()) return t == s;
}
return false;
}
}; | ALGO | 0.999851 | 6.174648 |
9bdd288b-80b8-405a-9db2-73b0565f4ee1 | starswap/CompetitiveProgramming | ICPC/UKIEPC/2015/A.cpp | #include <bits/stdc++.h>
using namespace std;
//All we need to do is fill up the edges list.
struct Edge {
int from, to, capacity;
double cost;
Edge(int from, int to, int capacity, double cost):from(from),to(to),capacity(capacity),cost(cost) {}
};
vector<vector<int>> adj, capacity;
vector<vector<double>... | ALGO | 0.999884 | 4.220817 |
c5425f49-374c-44b9-adfa-ff5b47660786 | jiguang123/Big-Data-Learning-Note | 07_数据结构与算法/LeetCode_C++版本V2/beautiful-arrangement-ii_1_AC.cpp | #include <vector>
using std::vector;
class Solution {
public:
vector<int> constructArray(int n, int k) {
vector<int> v(n);
int i = 0;
v[i++] = 1;
int f = 0;
int i1 = 2;
int i2 = n;
while (k > 1) {
f = 1 - f;
if (f) {
... | ALGO | 0.999983 | 4.904027 |
5731c594-4c2a-43a2-a850-60fa635899e1 | Hi-Van/cse-3150 | week-2/lab/wellBalanced.cpp | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
/*
DOCTest unit tests
*/
//#include "../doctest.h"
#include "fisherYates.h"
#include "../assignment/prefixsum.h"
#include <iostream>
using namespace std;
int nums_0[] = {};
int nums_1[] = {-5};
int nums_2[] = {35};
int nums_3[] = {2,-3,3,2};
int nums_4[] = {1,1,-1,1};
in... | TEST | 0.8948 | 5.73965 |
b5a1eb1a-c95c-4585-8fd0-40a902f01d00 | eric-heiden/tds-dev | examples/old/contact_discovery.cpp | #include <stdio.h>
#include <chrono> // std::chrono::seconds
#include <thread> // std::this_thread::sleep_for
#include <type_traits>
#include <ceres/ceres.h>
#include "assert.h"
#include "fix64_scalar.h"
#include "tiny_dual.h"
#include "tiny_matrix3x3.h"
#include "tiny_quaternion.h"
#include "tiny_smooth_constrain... | ALGO | 0.992079 | 5.571967 |
5fe3c4f0-a34d-4053-82c5-b7e8cd341ad2 | DionysiosB/LeetCode | 2971-FindPolygonWithTheLargestPerimeter.cpp | typedef long long ll;
class Solution {
public:
long long largestPerimeter(vector<int>& nums) {
const ll n = nums.size();
std::vector<ll> v(n); for(ll p = 0; p < n; p++){v[p] = nums[p];}
sort(v.begin(), v.end());
for(ll p = 1; p < n; p++){v[p] += v[p - 1];}
for(ll p = n - 1;... | ALGO | 0.9996 | 5.006923 |
abfacd58-dcd0-476b-b70e-92d87deed1b7 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/CodeLlama/top0-100/as-far-from-land-as-possible-Solution.maxDistance/177891_DoS.cpp | static RSA_PSS_PARAMS *rsa_pss_decode(const X509_ALGOR *alg,
X509_ALGOR **pmaskHash)
{
const unsigned char *p;
int plen;
RSA_PSS_PARAMS *pss;
*pmaskHash = NULL;
if (!alg->parameter || alg->parameter->type != V_ASN1_SEQUENCE)
return NULL;
p = alg->p... | ALGO | 0.999103 | 4.529393 |
0271d6f1-9491-4794-8b63-36d0657377d9 | GurleenRajpal/DS-Cpp-Codes | _10_Recursion_2/6_print_keypad_combination.cpp | // Print Keypad Combinations Code
// Send Feedback
// Given an integer n, using phone keypad find out and print all the possible strings that can be made using digits of input n.
// Note : The order of strings are not important. Just print different strings in new lines.
// Input Format :
// Integer n
// Output Format ... | ALGO | 0.999591 | 5.826822 |
8717cf05-ce00-4b5b-a2e0-e1d034c521c8 | shelleychen318/syde-121 | assignment4/exercise4.1.cpp | // This function illustrates how a function can return two values
#include<iostream>
using namespace std;
// This is the declaration for the function that reads the values for i and j
void get_input(int& i, int& j);
// This is the declaration for the function that adds 10 to i and 20 to j
void process(int& i, int& j);
... | ALGO | 0.993521 | 6.027649 |
1a43e6b5-410a-43d5-b29f-e755ed2e25f7 | leokang123/Algorithm | 1.9.백트래킹/비숍.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX 10
int n, cnt1, cnt2, max1, max2;
int board[MAX][MAX];
int vis1[MAX * 2];
int vis2[MAX * 2];
int back1 (int k) {
if (max1 < cnt1) max1 = cnt1;
// 이게 최대값임
if (max1 == n - 1) return 0;
for (int i = k ; i < n * n ; i ++) {
int crow = i /... | ALGO | 0.99987 | 4.223197 |
49939bbd-0c17-4771-8eb9-3aba75dd969f | kdg5424/nextfoam-cfd | ThirdParty-2404/sources/cgal/CGAL-4.14.3/examples/Periodic_2_triangulation_2/p2t2_info_insert_with_transform_iterator_2.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_2_Delaunay_triangulation_2.h>
#include <CGAL/Periodic_2_Delaunay_triangulation_traits_2.h>
#include <CGAL/Periodic_2_triangulation_face_base_2.h>
#include <CGAL/Periodic_2_triangulation_vertex_base_2.h>
#include <CGAL/Triangulation... | ALGO | 0.997426 | 6.889026 |
17908d40-bb49-44af-9633-5bcd308e9130 | bansalmukul-cse/LeetCode-Codes | 1561. Maximum Number of Coins You Can Get.cpp | class Solution {
public:
int maxCoins(vector<int>& piles) {
sort(piles.begin(),piles.end());
int j= piles.size()-2;
int res =0;
for(int i=0;i<piles.size()/3;i++){
res+=piles[j];
j =j-2;
}
return res;
}
};
| ALGO | 0.999907 | 5.891356 |
305fe7ef-30ba-4608-b64b-5aa945ab0cd6 | PixelExtended/frameworks_base | tests/Camera2Tests/SmartCamera/SimpleCamera/jni/stats_scorer.cpp | // Stats (mean and stdev) scoring in the native.
#include "stats_scorer.h"
#include <jni.h>
#include <math.h>
void Java_androidx_media_filterpacks_numeric_StatsFilter_score(
JNIEnv* env, jobject thiz, jobject imageBuffer, jfloatArray statsArray)
{
unsigned char* pImg = static_cast<unsigned char*>(env->GetDir... | ALGO | 0.92085 | 7.096336 |
a18870da-92b6-485c-9a0b-62e78d736211 | TheArchitectEngineer/Fuchsia_llvm | libc/src/math/nvptx/truncf.cpp | #include "src/math/truncf.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(float, truncf, (float x)) { return __builtin_truncf(x); }
} // namespace LIBC_NAMESPACE_DECL
| ALGO | 0.927304 | 6.370011 |
527f88aa-701c-44f2-9940-ec35285295e0 | ishandutta2007/codeforces | burnoutag7/normal/1288/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t,a,b;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>t;
while(t--){
cin>>a>>b;
ll cur=9,cnt=0;
while(cur<=b){
cur=cur*10+9;
cnt++;
}
cou... | ALGO | 0.999657 | 3.915812 |
b6b1b9d9-4370-4903-a489-59bd4b5ba46c | DanLoose/CplusplusStudyContent | Outras Implementacoes/Ponto3D/Ponto3D.cpp | #include<iostream>
#include<math.h>
using namespace std;
struct Ponto3D{
float x;
float y;
float z;
float calcularDistancia(Ponto3D* p2){
float dx = p2->x - this->x;
float dy = p2->y - this->y;
float dz = p2->z - this->z;
return sqrt(dx*dx + dy*dy + dz*dz);
}
};
int main(int argc, char const *argv[])
{
... | TOOL | 0.988189 | 3.960934 |
ddd6b4f5-a77d-4321-aeab-a9b2386e9de6 | sabyasachi073/Strivers-SDE-Sheet-Challenge | 61_NthRootOfM.cpp | #include <bits/stdc++.h>
/*
// Brute force
int NthRoot(int n, int m) {
for(int i=1; i<m; i++) {
long long int product = 1;
for(int j=1; j<=n; j++) {
product *= i;
}
if(product == m)
return i;
else if(product>m)
break;
}
return -1;
}
*/
// Optimized Approach
/*
Return 0 if... | ALGO | 0.999989 | 5.296931 |
eb628664-db7f-4e25-a0ce-4736786b3b15 | kamal-stark-dev/Learning | LeetCode/32. MED - Peak in a Mountain Array.cpp | // 852. Peak Index in a Mountain Array - https://leetcode.com/problems/peak-index-in-a-mountain-array/
#include <iostream>
#include <vector>
using namespace std;
// you need to find the element in log.n time complexity
int peakElement(vector<int> nums) {
int left = 1, right = nums.size() - 2;
while (left <= ... | ALGO | 0.999984 | 5.326039 |
5a386953-0fda-47e9-8c81-ab594b7d08ac | Molmin/Codes | 真题/NOIPS/[NOIPS 2022] 种花(plant).cpp | // 2022.11.26
#include <bits/stdc++.h>
using namespace std;
const long long mod=998244353;
int n,m,c,f;
bool a[1001][1001];
namespace calcC{
int getright[1001][1001]; // 向右最多几格(不含自己)
int getdown[1001][1001]; // 向下到 a[i][j]==false,getright 值之和(不含自己)
void solve(){
// calculate getright
for(... | ALGO | 0.999927 | 4.874351 |
091bf2d8-d465-4b6a-b96b-207fc79795e1 | Jacksynm/ardupilot | libraries/AC_PID/AC_PI_2D.cpp | /// @file AC_PI_2D.cpp
/// @brief 2-axis PI controller
#include <AP_Math/AP_Math.h>
#include "AC_PI_2D.h"
const AP_Param::GroupInfo AC_PI_2D::var_info[] = {
// @Param: P
// @DisplayName: PI Proportional Gain
// @Description: P Gain which produces an output value that is proportional to the current error v... | ALGO | 0.997151 | 6.135693 |
7db53c00-26ab-4960-bb7a-56ffe53b95ec | dipenkalsi/competitve_programming | striver_mock_interview1.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> f(int i, vector<double> &arr, vector<int> &ds, int sum)
{
if (i == arr.size())
{
if (sum == 0)
return ds;
vector<int> dummy;
return dummy;
}
ds.push_back(floor(arr[i]));
vector<int> fl = f(i + 1, arr, ds, s... | ALGO | 0.999978 | 3.966528 |
6fbef0e9-bde0-4db7-8fa5-c8f332ff839b | pranavbochare/DSA-CPP | bubble sort/almost_sorted_check_7.cpp | // #include<iostream>
// using namespace std;
// int main()
// {
// int arr[5]={4,2,7,9,8};
// int n=5;
// int brr[5];
// for(int i=0;i<n;i++){
// brr[i]=arr[i];
// }
// for(int i=0;i<n;i++){
// cout<<brr[i]<<" ";
// }
// cout<<endl;
// for(int i=0;i<n-1;i++){ ... | ALGO | 0.999948 | 4.965702 |
f8575dc1-e169-49fa-a5ac-8293f6395cb9 | ferez96/Road2BlackRed | 2018/100CodechefEasyProblems/ANUDTC.cpp | /*
* ANUDTC.cpp
*
* Created on: Nov 18, 2017
* Author: thaiminh
*/
#include <bits/stdc++.h>
using namespace std;
#define endl cout<<"\n"
int main(){
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin), freopen("out.txt","wb",stdout);
#endif
ios_base::sync_with_stdio(false), cin.tie(NULL);
int t;cin>>t;
w... | ALGO | 0.997754 | 3.780551 |
ed151897-f5df-4823-9f56-e8d8626d65eb | Pulkith/Competitive | CodeForces/1479/b/b.cpp | /**
* author: DespicableMonkey
* created: 07.03.2021 21:55:40
* Potatoes FTW!
**/
#include<bits/stdc++.h>
#if LOCAL
#include <DespicableMonkey/Execution_Time.h>
#include <DespicableMonkey/Debug.h>
#define debug_active 1
#endif
using namespace std;
#define pb push_back
#define f first
#define s secon... | ALGO | 0.999827 | 4.564677 |
86bb6e20-24de-43da-bb1a-1887b4e5eefa | algasami/program2425 | src/scist_w7_dp/1_kattis_rijeci.cpp | #include <bits/stdc++.h>
#define DEBUG
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int k;
cin >> k;
int a_c = 1, b_c = 0;
for (int i = 0; i < k; i++)
{
int tmp = b_c;
b_c += a_c;
a_c = tmp;
}
... | ALGO | 0.999972 | 3.425214 |
5aed1c28-0a37-47ac-a2c6-f27121c0c062 | jossy-elias/MiniGit | minigit.cpp | #include "minigit.hpp"
#include <iostream>
#include <filesystem>
#include <fstream>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <vector>
namespace fs = std::filesystem;
std::unordered_map<std::string, std::string> stagingArea;
void initMiniGit() {
if (fs::exists... | TOOL | 0.965579 | 6.33053 |
dc627b36-c237-4eb1-b855-6fff9b5bcda3 | veronicamuriga/18742-gem5 | src/systemc/tests/systemc/misc/v1.0/dash0/pulse.cpp | /*****************************************************************************
pulse.cpp -- Implementation of the pulse generator.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/*****************************************************... | TOOL | 0.906389 | 6.229115 |
0d08f673-76d6-458f-9d70-0616769d0a52 | AadityaShukla01/Interview-Preparation | 0460-lfu-cache/0460-lfu-cache.cpp | class LFUCache {
public:
map<int, list<vector<int>>::iterator> m;
map<int, list<vector<int>>> cache;
int size;
int cap;
LFUCache(int capacity) {
size = 0;
cap = capacity;
}
int get(int key) {
if (m.find(key) == m.end())
return -1;
auto &v = *(m[k... | ALGO | 0.998191 | 5.877298 |
f4594d3b-e588-4059-839b-24e53bf17186 | mavy731/UIUC-MSFE-FALL20-IE523 | Assignment8/Part2_Dynamic Programming.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <algorithm>
#include "newmat.h"
using namespace std;
double up_factor, uptick_prob, risk_free_rate, strike_price, downtick_prob;
double initial_stock_price, expiration_time, volatility, R;
int no_of_divisions;
doubl... | ALGO | 0.99991 | 5.537739 |
8b46390b-46b9-4fcb-95f3-318c98d66b4a | asdf77616385/ceph-12.2.1 | src/boost/libs/geometry/doc/index/src/examples/rtree/range_adaptors.cpp | //[rtree_range_adaptors
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/index/rtree.hpp>
// Boost.Range
#include <boost/range.hpp>
// adaptors
#include <boost/range/adaptor/indexed.hpp>
#include <boost/range/adaptor/tr... | ALGO | 0.996404 | 6.437651 |
cf8f7bee-3eb5-4dac-ae8c-893f16b4572b | bhavdxt10/ardupilot1 | libraries/AP_SurfaceDistance/AP_SurfaceDistance.cpp | #include "AP_SurfaceDistance.h"
#include <AP_RangeFinder/AP_RangeFinder.h>
#ifndef RANGEFINDER_TIMEOUT_MS
# define RANGEFINDER_TIMEOUT_MS 1000 // rangefinder filter reset if no updates from sensor in 1 second
#endif
#if AP_RANGEFINDER_ENABLED
#include <AP_AHRS/AP_AHRS.h>
#include <AP_Logger/AP_Logger.h>
#i... | TOOL | 0.916273 | 6.773003 |
fc1b9a47-1445-4db1-b917-601a255a3c07 | fedelebron/JugadorDeLadrillos | jugadores_ours/ia.cpp | #include "prelude.h"
#include "profiling.h"
#include "tablero.h"
#include "ia.h"
player_param def_player = (player_param){1,1,1,1,1};
bool alphabeta = false, adaptive = false;
int height = 0;
move jugada_optima(int quien, float alpha, float beta, int h) {
bool soyyo = quien == YO, dir, empty = true;
move mo(0, 0, so... | ALGO | 0.999901 | 5.084344 |
b550ba0f-0daa-4b1b-949d-5ddc1dc6a7ba | AbdoWael2003/Graduation-Project-QAgent2.0- | FlowChartGeneration/CPPSamples/Sample322/sample_code322.cpp | #include <vector>
using namespace std;
vector<int> right_rotate(vector<int>& arr, int n, int out_of_place, int cur) {
int temp = arr[cur];
for (int i = cur; i > out_of_place; i--) {
arr[i] = arr[i - 1];
}
arr[out_of_place] = temp;
return arr;
}
vector<int> re_arrange(vector<int>& arr, int ... | ALGO | 0.999987 | 4.86567 |
73edb4d6-1d71-4ecb-90ca-fec4a70dc325 | minkimgyu/TIL | Algorithm/DP/10844/10844/main.cpp | #include <iostream>
using namespace std;
int result = 0;
int n;
void dfs(int start, int loopCount)
{
if (start == 10 || start == -1) return;
if (loopCount == n)
{
result++;
return;
}
dfs(start + 1, loopCount + 1);
dfs(start - 1, loopCount + 1);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NU... | ALGO | 0.999819 | 4.398428 |
58a10c9d-d070-4dfa-bf93-4a1104b6e1ae | KrissApost/D_group | Pesho/k8.cpp | #include <bits/stdc++.h>
using namespace std;
bool prost(int n) {
for(int i = 2; i <= sqrt(n); i++) if(n % i == 0) return false;
return true;
}
int main() {
int n;
cin >> n;
int b, e, k = 0;
for(int i = 0; i < n; i++){
cin >> b >> e;
if(b <= 2 && e >= 2) k++;
for(int y = ... | ALGO | 0.999903 | 3.650284 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.