uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f5826d65-91c8-4328-a021-3a0634a4a4b4 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_4908_3.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int *p = new int[100010];
fill(p, p + 100010, -1000000000);
for (int i = 0; i < n; ++i) {
int x, y;
int res = 0;
scanf("%d%d", &x, &y);
int q = (int)sqrt((double)x);
for (int j = 1; j <= q; ++j) {
if (x % j =... | ALGO | 0.999883 | 3.880024 |
034574cc-3f5b-4b5a-9d88-9982dad24501 | ChangjingLiu/remote-medical-monitoring | tj-iothealth_platformio/Test/lib/MAX30102/algorithm_by_RF.cpp | //#include <Arduino.h>
#include "algorithm_by_RF.h"
#include <math.h>
void rf_heart_rate_and_oxygen_saturation(uint32_t *pun_ir_buffer, int32_t n_ir_buffer_length, uint32_t *pun_red_buffer, float *pn_spo2, int8_t *pch_spo2_valid,
int32_t *pn_heart_rate, int8_t *pch_hr_valid, float *ratio, float *corre... | ALGO | 0.972267 | 3.714933 |
b156b785-5caf-4eae-8490-5c01bfc5c77e | sirAdarsh/CP-files | Rough/codejam-03.cpp | #include<iostream>
using namespace std;
int C[1440]={};
int J[1440]={};
char solve(int s,int e){
if(e-s==1){
}
if( C[s]!=1 ){
int ones=0;
for(int i=s;i<=e;i++){
if(C[i]!=0){
ones++;
}
if(ones>1){
goto jay;
}
}
for(int i=s;i<=e;i++){
C[i]=1;
}
return 'C';
}... | ALGO | 0.999928 | 3.882761 |
8ee2c5e5-3810-4637-b56a-b161d557afce | ignabelitzky/codeforces | problem-490A.cpp | /*
* 490A. Team Olympiad
*
* The School N 0 of the capital of Berland has n children strying in it. All the children in this
* school are gifted: some of them are good at programming, some are good at maths, others are
* good at PE (Physical Education). Hence, for each child we know value t_i.
*
* t_i = 1, if th... | ALGO | 0.999953 | 4.13689 |
a3c9d188-5cd3-4f40-9c31-18e9d4ca5258 | rcocco/Cpp_Primer_5th | ex11/ex11_14.cpp | #include <iostream>
#include <map>
#include <utility>
#include <vector>
#include <string>
#include <initializer_list>
using std::map;
using std::vector;
using std::string;
using std::initializer_list;
using std::pair;
using std::cout;
using std::endl;
void addChildren(map<string, vector<pair<string,string>>> &families,... | TOOL | 0.908917 | 4.286894 |
d4458bb2-7d87-465e-987a-ca09337e80ef | tsksnhr/programming_contest | atcoder/abc254a.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int N;
cin >> N;
int mod = N%100;
string ans = "";
if (mod < 10){
ans = '0' + to_string(mod);
}
else{
ans = to_string(mod);
}
cout << ans << endl;
return 0;
} | ALGO | 0.999376 | 4.778826 |
151edcf7-8b09-4d9a-a161-bf41c6123f8c | Anva41103/gfg | Medium/Cheapest Flights Within K Stops/cheapest-flights-within-k-stops.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int CheapestFLight(int n, vector<vector<int>>& flights, int src, int dst, int k) {
// Code here
vector <pair <int,int>> adj[n];
for(auto it:flights)
{
a... | ALGO | 0.999743 | 5.649697 |
57f7998d-9fa7-4d81-8f28-b547e5be1212 | CCTHD/This-Is-A-Test | deps/icu-small/source/i18n/numparse_impl.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
// Allow implicit conversion from char16_t* to UnicodeString for this file:
// Helpful in toString methods and elsewhere.
#define UNISTR_FROM_STRING_EXPLICIT
#include <typeinfo>
#include <array>
#include "number_types.h"
#include "number_patternstring.h"
#includ... | TOOL | 0.885093 | 7.743069 |
e71837fe-ec67-42d4-b298-4634bc546ebd | Anjali-225/CPP_A_Beginners | Section_9/MultiplicationTable/main.cpp | // Section 9
// Nested Loops - Multiplication Table
#include <iostream>
using namespace std;
int main() {
for (int num1 {1}; num1 <=10 ; ++num1) {
for (int num2 {1}; num2 <=10; ++num2) {
cout << num1 << " * " << num2 << " = " << num1 * num2 << endl;
}
cout << "----------... | DATA | 0.999183 | 4.113008 |
1524afb4-5422-4df8-966b-874466e9a42a | StarShares/StarShares | src/configuration.cpp | /*
* configuration.h
*
* Created on: 201698
* Author: ranger.shi
*/
#include "configuration.h"
#include <memory>
#include "bignum.h"
#include "uint256.h"
#include "arith_uint256.h"
#include "util.h"
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <vector>
using namespace s... | CONFIG | 0.901388 | 4.723666 |
c3f8f287-6c6d-48b0-b988-9764943b8340 | SMiles02/CompetitiveProgramming | CSES/Problemset/Graphs/roadconstruction.cpp | #include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
const int mn = 1e5+1;
int pt[mn],rk[mn],ans,mx=1;
int find_set(int v) {
if (v == pt[v])
return v;
return pt[v] = find_set(pt[v]);
}
void make_set(int v) {
for (int i=1;i<=v;++i)
{
pt[i] ... | ALGO | 0.999973 | 4.309824 |
be42f123-9dc2-498b-89db-24089922efa2 | vfolunin/archives-solutions | UVa Online Judge/11597.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
bool solve(int test) {
int n;
cin >> n;
if (!n)
return 0;
cout << "Case " << test << ": " << n / 2 << "\n";
return 1;
}
int main() {
freopen("input.txt", "r... | ALGO | 0.972446 | 4.578658 |
21e3b3ba-7880-4435-b4c2-617f3152a54f | alexandraback/datacollection | solutions_2700486_0/C++/netkuba/b.cpp | #include <cstdio>
#include <cmath>
using namespace std;
const int M = 2000;
long double p[M][M];
void prep() {
p[0][0] = 1;
for (int i=1; i<M; ++i) {
p[i][0] = p[i-1][0] / 2;
p[i][i] = p[i-1][i-1] / 2;
for (int j=1; j<i; ++j) {
p[i][j] = (p[i-1][j-1] + p[i-1][j]) / 2;
... | ALGO | 0.999619 | 3.874235 |
3396b982-5f21-4665-9477-de0802240511 | rkr3o/LeetCode | longest-common-prefix/longest-common-prefix.cpp | class Solution
{
public:
string longestCommonPrefix(vector<string> &strs)
{
string res = "";
for (int i = 0; i < strs[0].size(); i++) {
for (auto& s : strs)
{
if (i == s.size() || s[i] != strs[0][i]) {
... | ALGO | 0.999733 | 5.614762 |
84fa8ac3-5d64-4be6-b0bb-9d9dc255e850 | d3NNEb/NeuralAmpModeler- | eigen/unsupported/test/NumericalDiff.cpp | #include <stdio.h>
#include "main.h"
#include <unsupported/Eigen/NumericalDiff>
// Generic functor
template<typename Scalar_, int NX=Dynamic, int NY=Dynamic>
struct Functor
{
typedef Scalar_ Scalar;
enum {
InputsAtCompileTime = NX,
ValuesAtCompileTime = NY
};
typedef Matrix<Scalar,InputsAtCompileT... | TEST | 0.961683 | 6.173887 |
4d2fe4a6-211a-48ad-8100-fe86010254be | idumenskyi/learn_cpp | output_array.cpp | #include <iostream>
using namespace std;
int main() {
const int size = 5;
//int arr[size]{8, 4, 2, 7, 3};
int arr[size];
for(int i = 0; i < size; i++){
arr[i] = i;
}
for(int i = 0; i < size; i++){
cout << arr[i] << endl;
}
return 0;
}
| ALGO | 0.9405 | 3.411515 |
4771c985-cd0f-4fae-9d85-3f2933e904f7 | GoGradually/PS-Saved-Repository | 23_DEC/231225/1907F.cpp | #include <bits/stdc++.h>
#define ll long long
#define INF (int)1e9 + 10
#define lINF (ll)1e18 + 10LL
const ll MOD = 1000000007LL;
// #include <atcoder/modint.hpp>
// using mint = atcoder::modint998244353;
using namespace std;
void Solve() {
int n;
cin >> n;
vector<int> arr(n * 2);
for (int i = 0; i < ... | ALGO | 0.999413 | 4.647924 |
a964c1ab-7cf1-4e6e-bf9e-2eeb49b08492 | R-o-h-i-t-k-u-m-a-r/100-days-of-code-challenge | Day91/Number-of-Distinct-Islands_Solution.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
private:
void DFS(int row,int col,vector<vector<int>>& visited,vector<vector<int>>& grid,
vector<pair<int,int>>& list,int row0,int col0)... | ALGO | 0.999917 | 6.968602 |
095ab271-2289-4b66-94b7-fb5875880902 | TaurusSilver201/Online-Judge-Solutions | Where's_Waldorf?.cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> dirs = {{0,1},{1,0},{-1,0},{0,-1},{-1,-1},{-1,1},{1,-1},{1,1}};
int main()
{
int t,n,m,q;
string in;
scanf("%d",&t);
while(t--){
scanf("%d %d",&n,&m);
vector<string> grid;
for(int i=0;i<n;i++){
cin >>... | ALGO | 0.999649 | 3.895476 |
1361c375-16e2-44e4-b102-0add0d04a1d1 | ishandutta2007/codeforces | brovko/normal/846/D.cpp | #include <bits/stdc++.h>
#define int long long
#define ld long double
#define y1 sdopgh
using namespace std;
int n, m, k, q, x[250005], y[250005], t[250005], ps[505][505], a[505][505];
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> k >> q;
for(int i = 0... | ALGO | 0.999988 | 3.824682 |
cfa81beb-c987-45b4-b95a-01d3162cdc48 | dimenus/Breakout | GameBreakout/thirdparty/glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <stdio.h>
#include <stdlib.h> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if (static_cast<unsigned>(n) > 63) {printf("rotat... | ALGO | 0.999116 | 4.663313 |
412cb257-878a-4459-84a8-5254bc1f6fdc | mohan2106/cp | fillmat.cpp | #include<bits/stdc++.h>
using namespace std;
int root(int v,vector<int> &parent){
if(v == parent[v]){
return v;
}
return parent[v] = root(parent[v],parent);
}
void union_set(int x,int y,vector<int> &parent,vector<int> &rank){
x = root(x,parent);
y = root(y,parent);
if(x != y){
... | ALGO | 0.999952 | 4.905217 |
8254b90f-6c95-486b-b725-f12f843555a8 | hooser13/Honda-Van | phonelibs/qpoases/SRC/Utils.cpp | /**
* \file SRC/Utils.cpp
* \author Hans Joachim Ferreau, Eckhard Arnold
* \version 1.3embedded
* \date 2007-2008
*
* Implementation of some inlined utilities for working with the different QProblem
* classes.
*/
#include <math.h>
#if defined(__WIN32__) || defined(WIN32)
#include <windows.h>
#elif defined(... | TOOL | 0.850354 | 6.017424 |
f9e07118-58a4-4969-af84-d42653ff3ef2 | CitrusSin/AlgorithmProblemAnswers | HDU/HDU1099F.cpp | #include <bits/stdc++.h>
using namespace std;
int nearest_larger_square_number(int x) {
int v = sqrt(x);
while (v * v > x) v--;
while (v * v < x) v++;
return v * v;
}
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int i=0; i<n; i++) {
cin >> a[i];
}
vector<in... | ALGO | 0.999301 | 4.171653 |
48ac2eaa-018e-4508-b7a6-9cebc8b0297f | Chan531/BaekJoon_Online_Judge | 할로윈의사탕.cpp | #include <iostream>
#include <vector>
using namespace std;
int t, c, v;
void solve()
{
cin >> t;
while (t--)
{
cin >> c >> v;
cout << "You get " << c / v << " piece(s) and your dad gets " << c % v << " piece(s).\n";
}
}
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
s... | ALGO | 0.999562 | 5.094617 |
dd8e7f67-0832-4d18-b9e4-aeefabb5d119 | Jhe0031/csci135_project3 | dwarves2/state.cpp |
#include "common.h"
#include "state.h"
#include <queue>
#include <utility>
#include <cassert>
using namespace std;
bool in_range(State &st, int r, int c) {
return (r >= 0 && r < st.rows && c >= 0 && c < st.cols);
}
bool operator==(Loc &a, Loc &b) {
return a.r == b.r && a.c == b.c;
}
bool is_agent(Object &obj) ... | ALGO | 0.992908 | 4.00959 |
b9537168-7ab9-4740-a568-c33a040260d5 | mehoggan/sandbox | c++/algorithms/quadkeys/quadkeytree/quadkeytree.cpp | /**
* Serves as the main data source for all the tests below.
*/
struct QuadKeyTree
{
static const unsigned short cMaxDepth = 4;
template <unsigned short DEPTH>
class QuadKeyHeap
{
public:
/**
* ctor
*/
explicit QuadKeyHeap(const std::string& startKey = "")
: m_StartKey(startKey)
{
const unsig... | TEST | 0.861435 | 5.612833 |
38599cce-88cf-4092-9ac0-2522bb800633 | Chillee/CompProgramming | a2oj1700/11/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll R, G, B;
vector<ll> vals;
int main() {
cin >> R >> G >> B;
vals.push_back(R);
vals.push_back(G);
vals.push_back(B);
sort(vals.begin(), vals.end(), greater<ll>());
vals[0] = min(vals[0], (vals[1] + vals[2]) * 2);
cout <<... | ALGO | 0.997302 | 4.352117 |
4f353cca-f037-4124-bdb8-f826d6c4fbc7 | azcy-qwq/JZOI_ | Contests/2024-10-19-cfz-B.cpp | #include<bits/stdc++.h>
using namespace std;
namespace IN {
#define MAX_INPUT 25000003
#define getc()(p1 == p2 && (p2 = (p1 = buf) + inbuf -> sgetn(buf, MAX_INPUT), p1 == p2) ? EOF : * p1++)
char buf[MAX_INPUT], * p1, * p2;
template < typename T > inline bool redi(T & x) {
static std::streambu... | ALGO | 0.999874 | 3.875374 |
cc90b7ef-e5fd-4383-af6b-2d716907c792 | surajl7/Technologies | Software/C++/Chapter 11 - Templates/2K230315/templates_functionTemplates.cpp | // Templates
/*
Function Templates:
Like class templates, we can also define function templates that could be used to create a
family of functions with different argument types. The general format of a function template is:
template<class T>
returnType functionName (arguments of type T)
... | TOOL | 0.888865 | 5.814565 |
f4778f89-7395-4b32-b8a5-b63f9af8eac7 | omkaranu04/CP_DSA | Codeforecs/2050/2050A.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
void solve()
{
ll n, m;
cin >> n >> m;
vector<string> v(n);
for (ll i = 0; i < n; i++)
{
cin >> v[i];
}
ll ans = 0, curr_len = 0;
for (ll i = 0; i < n; i++)
{
if (curr_len + v[i].length() <= m)
... | ALGO | 0.999929 | 6.068883 |
6d099fe3-0952-448f-9eaf-0e351b0602ff | hangzhaosbu/Leetcode | 0326-power-of-three/0326-power-of-three.cpp | class Solution {
public:
bool isPowerOfThree(int n) {
if(n==1)return true;
if(n==0 || n%3!=0)return false;
return isPowerOfThree(n/3);
}
}; | ALGO | 0.999563 | 5.898562 |
424ed27e-96a2-4c51-a9d2-3ea59e4cdbff | MouryaVishal/A2Z_Questions | 14 Binary Search Trees/14.2 Practice Problems/3 Insert a given Node in Binary Search Tree.cpp | #include<bits/stdc++.h>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(... | ALGO | 0.999962 | 5.004794 |
1be7062d-3115-4249-bcbf-a05acfb22d1f | Gauravlamba1109/LeetCodeQuestions | 1398-number-of-ways-to-stay-in-the-same-place-after-some-steps/1398-number-of-ways-to-stay-in-the-same-place-after-some-steps.cpp | class Solution {
public:
int numWays(int steps, int arrLen) {
vector<vector<int>>dp(1000,vector<int>(steps+1,-1));
return dfs(0,steps,arrLen,dp);
}
// if(left ) -1
// if(right) +1
// if(stay ) +0
int mod = 1e9+7;
int dfs(int sum, int steps, int arrLen,vector<vector<int>>&dp){
// r... | ALGO | 0.999992 | 5.044205 |
f60cf819-b5dd-4656-affc-0de9344b32cd | IAMSHARIFUL/Comedians_of_Errors | Templates/DS/Heavy-Light-Decomposition.cpp | namespace HLD{
struct Node{
int mn=INT_MAX,unp=INT_MAX;
Node(){}
Node(int mn,int unp): mn(mn),unp(unp){}};
inline Node combine(Node a,Node b){
return {min(a.mn,b.mn),INT_MAX};}
inline Node propagate(Node to,Node from,int len){
if(from.unp==INT_MAX)
return to;
to.mn=min(to.mn,from.unp... | ALGO | 0.999928 | 4.118369 |
8adfd61f-916d-47c6-a584-f43af129e7b2 | Seraphimu/Hello-World | Algorithms/Aha/sort_1.cpp | #include <iostream>
#include <vector>
using namespace std;
void swap(int & a, int & b)
{
int t = a;
a = b;
b = t;
}
int main(void)
{
vector<int> a = {5, 3, 5, 2, 8};
int max = 0;
for (int i = 0; i < a.size(); i++)
{
max = i;
for (int j = max + 1; j < a.size(); j++)
... | ALGO | 0.999978 | 4.446064 |
c91fd884-a691-4dc6-9fcc-dc4d0370ccf0 | ishandutta2007/codeforces | abc864197532/normal/794/C.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define printv(a) {\
for ... | ALGO | 0.999998 | 4.41584 |
0d98916c-956b-420f-8e16-ffa95cdaf13c | Simon-0801/CodeHome | 牛客竞赛/2020牛客寒假算法基础集训营/3-D.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
const int maxn = 100000 + 5;
int t[maxn*4];
int fa[maxn],l[maxn],r[maxn];
void dfs(int p){
if(t[p]==-1){
return;
}
int lson=p*2,rson=p*2+1;
if(p==1){
... | ALGO | 0.999066 | 3.54723 |
5f61778f-1042-4b4b-bd62-fcefb1fce9f3 | ishandutta2007/codeforces | teja349/normal/839/C.cpp | //teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
//setbase - cout << setbase (16); cout << 100 << end... | ALGO | 0.999176 | 3.821618 |
1074e17f-2aba-41d1-afb7-b504b55c2ee3 | tgrants/programming-problem-set-solutions | codewars/tribonacci-sequence.cpp | #include <vector>
std::vector<int> tribonacci(std::vector<int> signature, int n) {
if (n < 3) return {signature.begin(), signature.begin() + n};
std::vector<int> result = signature;
for (int i = 3; i < n; i++)
result.push_back(result[i - 3] + result[i - 2] + result[i - 1]);
return result;
} | ALGO | 0.999779 | 6.165677 |
8ae74c7d-9f39-4e84-b394-b2e5838d908a | Muhammad-Farhan-Ali/PD-04 | task7cp.cpp | #include<iostream>
using namespace std;
void flowershop(int redRose,int whiteRose,int tulip);
int main()
{
int redRose,whiteRose,tulip;
cout<<"Red Rose:";
cin>>redRose;
cout<<"White Rose:";
cin>>whiteRose;
cout<<"Tulip:";
cin>>tulip;
flowershop(redRose,whiteRose,tulip);
return 0;
}
void flowershop(int redR... | ALGO | 0.984189 | 4.937235 |
d69b1fb7-67bc-4191-87be-665acba7c8e9 | heavenMOJANG/ICPC | .history/programmes_C_Cpp/Codeforces/CF2072/C_20250320203559.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, x; cin >> n >> x;
vector<int> ans(n);
int cnt{}, cur{};
for (int i = 0; i < n; ++ i) {
... | ALGO | 0.999956 | 4.565746 |
fab60e15-73b4-4407-9c56-47b07e4656c8 | Ri-Nai-BIT-SE/Lexue-Code | Data-Structure/464665.cpp | #include <bits/stdc++.h>
int main()
{
int n;
std::cin >> n;
std::vector<int> a(n + 1);
for (int i = 0; i <= n; ++i)
std::cin >> a[i];
using i64 = long long;
std::vector<std::vector<i64>> dp(n, std::vector<i64>(n + 1));
std::vector<std::vector<int>> from(n, std::vector<int>(n + 1));
... | ALGO | 0.999818 | 4.246951 |
503a4361-a020-4c4d-8ce4-abd95e1778db | ManavRastogi03/DSA | Diving_into_More/Function/GcdORhcf.cpp | #include<iostream>
using namespace std;
int hcf(int x,int y){
int gcf=1;
for(int i=min(x,y);i>=1;i--){
if(x%i==0 && y%i==0) {
gcf=i;
break;
}
}
return gcf;
}
int main(){
cout<<hcf(60,24);
} | ALGO | 0.999348 | 5.093629 |
c8c0a9f3-1179-492b-b812-14f57e4cb3ae | akashvadnala/DSA_implementations | Algorithms/06. Sorting Algorithms/5. Bubble Sort.cpp | void bubbleSort(vector<int>& arr){
int n=arr.size();
bool t;
for(int i=0;i<n-1;i++){
t=true;
for(int j=0;j<n-i-1;j++){
if(arr[j]>arr[j+1]){
swap(arr[j],arr[j+1]);
t=false;
}
}
if(t) return;
}
}
// Time complexity: b... | ALGO | 0.999909 | 5.520633 |
41b37413-cf21-4e86-a6cd-76ef7a3b591c | cjri/DiffusionCode | io.cpp | #include "diffusion.h"
#include "io.h"
#include "utilities.h"
#include <iostream>
#include <string>
#include <sstream>
void GetCMLOptions (options& o, int argc, const char **argv) {
string p_switch;
o.seed=(int) time(NULL);
o.radius=pow(10,-5);
o.opt_t0=0;
o.absorbing=1;
o.env="Office";
o.e... | ALGO | 0.970626 | 4.049101 |
f2a8b41b-9c43-4e19-81a2-239b03ca38c1 | kiran9k9/Spoj | AddRev.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int t,n,m;
cin>>t;
while(t--)
{
int x=0,y=0;
cin>>n>>m;
while(n!=0)
{
int i=n%10;
n/=10;
x=x*10+i;
}
while(m!=0)
{
int j=m%10;
m/=10;
y=y*10+j;
}
x=x+y;
y=0;
while(x!=0)
{
int i=x%1... | ALGO | 0.99983 | 4.056566 |
32ba0fc5-6a3b-484d-ada6-b74889dd5402 | Chenggouer/ubuntu | datastructures/queue/bank.cpp | #include<iostream>
#include<cstdlib>
#include<ctime>
#include "Queue.h"
const int MIN_PER_HR = 60;
bool newCustomer(double x);
int main()
{
using std::cout;
using std::endl;
using std::cin;
using std::ios_base;
std::srand(std::time(0));
cout << "Case study: bank of Heather Automatic Teller\n";
cout << "Enter... | ALGO | 0.978262 | 4.198537 |
7fc641b1-61d9-4609-9922-aaac71c5a052 | skystone1000/Coding-Problems | Youtube Playlists/Aditya Verma - DP/28 Min # of delections to make palindrome.cpp | // Aditya Verma - DP Playlist - 28 Min # of delections to make palindrome
/*
Ques - 28 Min # of delections in a string to make it a palindrome
You are given a strings S. You need to find Minimum Number
of delections to convert string S such that new string is palindrome
Print total number of deletions made
IP
S : ag... | ALGO | 0.99999 | 5.503331 |
b16060f7-4c03-4652-bfed-63e955edb3cd | shadowmydx/wikioi_OJ | 3117 高精度练习之乘法.cpp | /*
:<EMAIL>
Ŀ:p3117 ߾ϰ֮˷
*/
/*
//дһݿύĴ룿P1000 A+BΪ
#include <iostream>
using namespace std;
int main()
{
int a, b; //
cin >> a >> b; //ӱ
cout << a + b << endl; //
}
// ɳԺ·ύɿԽ
*/
#include <iostream>
#include <string>
using namespace std;
class Solution {
public:
string multiply(string num1, string... | ALGO | 0.999917 | 4.825692 |
c49c2ebc-da36-4784-8ab2-17be4c92a92b | anggamys/pemograman-lanjut | tugas-kedua/nomor-satu.cpp | #include <iostream>
#include <string>
using namespace std;
// Harga layanan streaming
const int NETFLIX = 39000;
const int DISNEY_PLUS = 45000;
const int HBO_GO = 40000;
void recommended(int dana) {
// Cek layanan tunggal yang bisa dibeli
if (dana >= NETFLIX) {
cout << "Netflix\n";
}
if (dana... | TOOL | 0.85665 | 4.683141 |
0c148c56-427f-402b-b2e6-1f8defe741ab | ddimitrov-fmi/up-2022-2023 | practicum_inf/group 2/week02/week02-solutions/task0.cpp | #include<iostream>
using namespace std;
int main(){
int number1, number2;
char choice;
cout << "\nPlease, enter first number1: ";
cin >> number1;
cout << "\nPlease, enter second number2: ";
cin >> number2;
cout << "\nPlease, choose [+, -, *, /]: ";
cin >> choice;
switch(choice){
case '+': cout <<... | TOOL | 0.96938 | 3.149522 |
b93d094e-446c-499d-8bd9-793db2205414 | shuqike/planning-LLaMA-family | backups/backup_VAL/src/LPGP.cpp | /*-----------------------------------------------------------------------------
VAL - The Automatic Plan Validator for PDDL2.2
$Date: 2009-02-05 10:50:19 $
$Revision: 1.2 $
Maria Fox and Derek Long - PDDL2.2 and VAL
Stephen Cresswell - PDDL2.2 Parser
Richard Howey - Continuous Effects, derived predicates,... | TOOL | 0.877757 | 4.065561 |
0b2b2595-41e8-422a-bc49-fc780a5532b1 | FaizaanAlFaisal/Movie-Recommendation-System | console_src/DoublyLinkedList.cpp | #ifndef DOUBLYLINKEDLIST_CPP
#define DOUBLYLINKEDLIST_CPP
#include <iostream>
using namespace std;
template <class T> class DLLNode
{
public:
T data;
DLLNode<T>* next; //points to node after this node in the list
DLLNode<T>* prev; //points to predecessor of this node in the list
DLLNode(T value) //parameterized... | ALGO | 0.999772 | 5.700381 |
73452994-4f93-4bb9-8892-0c9fdc8e9c2d | turneja123/competitive-programming-library | Problem/Data Structures/Maximize Count of Distinct Primes After Split.cpp | //https://leetcode.com/contest/weekly-contest-452/problems/maximize-count-of-distinct-primes-after-split/description/
const int N = 1e5 + 5;
bool is_prime[N];
struct Node {
int sum;
int lazy;
Node() {
lazy = 0;
}
Node(int x) : sum(x), lazy(0) {}
};
Node segtree[4 * N];
set<int> st[N];
clas... | ALGO | 0.999815 | 5.133791 |
e2ba9664-626d-4ad9-9cbc-97434466f3be | DanDanCool/seer | lib/opencv_contrib/modules/reg/src/mapprojec.cpp | #include "precomp.hpp"
#include <opencv2/imgproc.hpp>
#include "opencv2/reg/mapprojec.hpp"
namespace cv {
namespace reg {
////////////////////////////////////////////////////////////////////////////////////////////////////
MapProjec::MapProjec()
: projTr_(Matx<double, 3, 3>::eye())
{
}
//////////////////////////... | ALGO | 0.885476 | 6.185996 |
663506ad-2dab-43b0-ab02-1e9abff50099 | T-R0D/Past-Courses | CS682/Challenge01/challenge_01.cpp | #include <cstdio>
#include <iostream>
#include <functional>
#include <string>
#include <vector>
#include <list>
#include <queue>
class Person {
public:
enum class PersonType : bool {
MISSIONARY,
CANNIBAL
};
Person(const std::string& pName, const PersonType& pType) :
mName{pName}, mType{pType} {
}
... | ALGO | 0.994016 | 4.589301 |
5b2d1bc4-c9e9-46d3-afe4-cef7d504c06e | LucaDantas/Algorithms | icpc-notebook/stress-tests/geometry/LineHullIntersection.cpp | #include "../utilities/template.h"
#include "../../content/geometry/Point.h"
template<>
struct Point<double> {
typedef Point P;
typedef double T;
T x, y;
explicit Point(T x=0, T y=0) : x(x), y(y) {}
Point(const Point<ll>& other) : x((double)other.x), y((double)other.y) {}
P& operator=(const Point<ll>& other) { ... | ALGO | 0.999617 | 4.461544 |
2666bfaf-cba5-43b4-b1ee-659c4c288eba | mariaisabelmdrs/testea | meus projetos/fila_lista_enc_simples_circular/lista_circular.cpp | #include <iostream>
#include <cstdlib>
#include "lista_circular.h"
void inicializar_lista(No** lista) {
*lista = NULL;
}
void inserir_no_fim(No** lista, int valor) {
No* novo = (No*) malloc(sizeof(No));
if (novo == NULL) {
cout << "Erro: falha ao alocar memria.\n";
return;
}
novo-... | ALGO | 0.99844 | 5.413358 |
f3991883-1a2b-4593-bb5a-44a3b1d1801f | TTSS0529/leetcode-practice-in-cpp | cpp/hash_map/0242_valid_anagram/test.cpp | #include "valid_anagram.hpp"
static void runTest(std::string s, std::string t) {
Solution sol;
std::cout << (sol.isAnagram(s, t) ? "true" : "false") << std::endl;
}
int main() {
std::cout << ">>>>>>>>>> example 1 <<<<<<<<<<" << std::endl;
runTest("anagram", "nagaram");
std::cout << ">>>>>>>>>>... | ALGO | 0.999281 | 5.648077 |
f68e3e56-823d-4621-a44c-098843d997b0 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_6928_15.cpp | #include <bits/stdc++.h>
using namespace std;
struct point {
long long x, y;
friend point operator+(point a, point b) {
return (point){a.x + b.x, a.y + b.y};
}
friend point operator-(point a, point b) {
return (point){a.x - b.x, a.y - b.y};
}
friend long long operator*(point a, point b) { return a.x... | ALGO | 0.999942 | 4.060453 |
91c139ee-44ae-4d71-aa26-65a73f18b846 | iamrahul25/A2Z-DSA-Sheet | Array/Easy/10_Max_consecutive_ones.cpp | class Solution {
public:
//Time Complexity: O(N) and Space: O(1)
int findMaxConsecutiveOnes(vector<int>& nums) {
int n = nums.size();
int count = 0;
int maxx = 0;
for(int i=0; i<n; i++){
if(nums[i]==1){
count++;
... | ALGO | 0.999906 | 6.210617 |
7952b192-6fa4-431f-b0d6-b91a6222b28e | loceaner/OI_Code | luogu/luogu2822.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int t,k,n,m;
int c[2005][2005],s[2005][2005];
void prepare();
int main() {
memset(c,0,sizeof(c));
memset(s,0,sizeof(s));
cin>>t>>k;
prepare();
while(t--) {
cin>>n>>m;
if(m>n) m=n;
cout<<s[n][m]<<endl;
}
return 0;
}
void prepare()... | ALGO | 0.99997 | 3.791612 |
90c14a6f-0fea-4234-80ac-67293511a9fd | hjiang13/LLMs-in-IR | POJ-104/14/1095.cpp | #include <iostream>
using namespace std;
struct student
{
long number;
int chinese;
int math;
int sum;
struct student *next;
struct student *previous;
}
;
struct student *creat(long n)
{
struct student *head,*p1,*p2;
int i;
head=null;
p1=(struct student *)malloc(len);
cin >> "%d %d %d",&p1->number,&p1->chinese,&p1->mat... | ALGO | 0.998985 | 3.148417 |
0411011a-f708-4aa0-b200-b9e98ae7d2dd | thegamer1907/Code_Analysis | Graphs/1776.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair< long long int, long long int > pii;
const long long int MAX = 30000;
const long long int INF = 0x3f3f3f3f3f3f3f3f;
vector< pii > G[MAX];
long long int d[MAX];
void dijkstra(long long int start) {
long long int u, v, i, c, w;
priority_queue< pi... | ALGO | 0.999989 | 4.356236 |
7814844c-5c53-431c-a17e-ba24f2db96dc | User-ops678/CPP_LANGCSD | Lecture 2/LEC2_5.cpp | #include "std_lib_facilities.h"
int main() {
vector<double> temps; // a vector of doubles
double temp;
while (cin >> temp) { // we read a temp with cin
temps.push_back(temp); // store it in the vector
}
double sum = 0;
for(int i = 0; i<temps.size(); ++i) sum += temps[i];
cout << "M... | ALGO | 0.987242 | 5.61785 |
a262e55a-afae-4062-8a48-6102549f00da | mirandaholmes/stratification-paper | CodesOutputs/parline/Stratification.cpp | //
// Stratification.cpp
//
//
// Created by Miranda Holmes-Cerfon on 3/2/17.
//
//
#include "Stratification.hpp"
#include "Point.hpp"
// Constructor with functions, jacobian, and optional flag check
Stratification::Stratification(int whichcase0, VectorXd params0)
: whichcase(whichcase0), params(params0)
{
se... | ALGO | 0.998911 | 5.568976 |
b9ff839a-3a1b-4491-b475-62adb92c44fb | EduardDumitrescul/cnp-cypher | encoder.cpp | #include <iostream>
#include <fstream>
#include <unordered_map>
#include <stdexcept>
#include <string>
#include <sstream>
#include "checkFunctions.h"
#include "encoder.h"
Encoder::Encoder(std::string key) {
this->loadKey(key);
}
void Encoder::createMap() {
bool used[256] = {};
char currentLetter =... | TOOL | 0.951153 | 5.618359 |
ee39efa4-6179-4e59-aa9a-90245a167b5d | hako-975/file-dev-cpp | minmax.cpp | #include<iostream>
using namespace std;
int main()
{
int nilai_1, nilai_2, nilai_3, nilai_4;
cout<<"Masukkan Nilai 1 : ";
cin>>nilai_1;
cout<<"Masukkan Nilai 2 : ";
cin>>nilai_2;
cout<<"Masukkan Nilai 3 : ";
cin>>nilai_3;
cout<<"Masukkan Nilai 4 : ";
cin>>nilai_4;
if(nilai_1 > nilai_2 && nilai_1 > ... | ALGO | 0.99941 | 3.747227 |
63af75a7-d47f-493a-abf5-6a6b9f479f62 | vaibhavbichave/Leetcode | 0050-powx-n/0050-powx-n.cpp | class Solution {
public:
double myPow(double x, int n) {
long binary = n;
if (n < 0) {
x = 1 / x;
binary = -binary;
}
double ans = 1.0;
while (binary > 0) {
if (binary & 1)
ans *= x;
x *= x;
binary /=... | ALGO | 0.999776 | 6.09499 |
dc30f768-555f-4337-8128-757993cae329 | dhanendraverma/Daily-Coding-Problem | Day226.cpp | /**************************************************************************************************************************************
This problem was asked by Airbnb.
You come across a dictionary of sorted words in a language you've never seen before. Write a program that returns the correct order of
letters in thi... | ALGO | 0.999959 | 6.261744 |
c775bbbc-ec96-462e-bce5-06cf4fb58c11 | shikha7124v/Data-Structures | Trees/createBinaryTree.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *left, *right;
Node(){
this->data = 0;
left = NULL;
}
Node(int data){
this->data = data;
this->left = NULL;
this->right = NULL;
}
Node(int data, Node* left, Node *rig... | ALGO | 0.999975 | 5.145555 |
26608997-631c-48c0-9e10-ae436495de57 | sangeeta1998/exp2 | cpp_wasm/matrix.cpp | #include <iostream>
#include <vector>
#include <chrono>
// Simple LCG for random number generation
unsigned int lcg() {
static unsigned int seed = 123456789; // Initialize seed
seed = (1103515245 * seed + 12345) % (1u << 31); // LCG formula
return seed;
}
// Get current time in milliseconds
uint64_t curre... | ALGO | 0.999069 | 5.083803 |
b3d1b36b-3bfc-4e40-911d-ee61b64b42d3 | sshantanuagarwal/Python | Data Structure and Algorithm/code/special_multiple/main.cpp | #include <iostream>
#include<vector>
#include<deque>
#include <cstdio>
using namespace std;
typedef vector<int> VI;
vector<VI> a;
typedef deque<int> d;
deque<d> b;
VI mark;long long int cnt;
void bfs(int u)
{int x;
mark[u]=1;
cnt++;
for (VI::iterator v = a[u].begin(); v != a[u].end(); v++)
{
if(!mark... | ALGO | 0.999845 | 4.097017 |
baef9fe2-c2c9-4fd3-a3f8-c60ca8cf6607 | ishandutta2007/codeforces | conan1412yang99/normal/1104/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
stack<char> a;
string b;
int ans = 0;
cin>>b;
for(int i = 0 ; i < b.size() ; i++){
if(a.empty() || a.top() != b[i]) a.push(b[i]);
else if(a.top() == b[i]) ans++ , a.pop();
}
if(ans % 2 == 0) cout<<"No"<<endl;
else cout<<"Yes"<<endl;
} | ALGO | 0.999997 | 4.00282 |
84980ce0-0a29-4b87-938d-8c48412f5f87 | deepakdashcode/Coding | striver/L4 STL/vectors/erasing_vector.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v = {1, 3, 4, 7, 5};
v.erase(v.begin() + 1, v.end() - 1);
for(int i: v) cout << i << " ";cout << endl;
v.erase(v.begin());
for(int i: v) cout << i << " ";cout << endl;
return 0;
} | ALGO | 0.999331 | 3.857599 |
d24a0250-3c4c-45d2-a315-601b7fa5fc77 | Fraunhofer-AISEC/cryptsan-llvm-project | libc/src/math/remainderl.cpp | #include "src/math/remainderl.h"
#include "src/__support/common.h"
#include "utils/FPUtil/DivisionAndRemainderOperations.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(long double, remainderl, (long double x, long double y)) {
int quotient;
return fputil::remquo(x, y, quotient);
}
} // namespace __llvm_libc
| TOOL | 0.957668 | 5.648406 |
4ce852a9-a785-440c-8249-ba4c64eafc7e | Metrological/cobalt | src/third_party/llvm-project/clang-tools-extra/include-fixer/IncludeFixer.cpp | #include "IncludeFixer.h"
#include "clang/Format/Format.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Parse/ParseAST.h"
#include "clang/Sema/Sema.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#define DE... | TOOL | 0.952938 | 3.077182 |
958d3b44-3b3b-49a8-a547-53dada388ca7 | DAYHARIKA/LEETCODE-and-GFG-CODES | 0198-house-robber/0198-house-robber.cpp | class Solution {
public:
int solve(vector<int>& nums){
int n=nums.size();
int prev1=nums[n-1];
int prev2=0;
for(int i=n-2;i>=0;i--){
int inclu=nums[i]+prev2;
int exclu=prev1;
prev1=max(inclu,exclu);
prev2=exclu;
... | ALGO | 0.999966 | 5.678809 |
0f247980-3f4b-4436-9af2-3f2eb53768fc | jinhyeonseo01/Project-RhythmEngineer | lib/eigen/doc/examples/class_CwiseUnaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template unary functor
template<typename Scalar>
struct CwiseClampOp {
CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
const Scalar operator()(const Scalar& x) const { return x<m_... | ALGO | 0.906487 | 6.417363 |
30d0314c-3485-4f48-a36c-21e4cd6a288f | ishandutta2007/codeforces | sonechko/normal/1101/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
const int N = 1e6 + 11;
int xx[N],yy[N],pos[N];
pair<int,int> v[N*4];
void update(int i, int l, int r, int x, pair<int,int> p)
{
if (l==r) {v[i]=p; return;}
int mid... | ALGO | 0.99999 | 4.00706 |
66e277bb-0de4-4bdb-a6e9-e191117c3b47 | SimpleCode28/Leetcode-Exercise | 5.longest-palindromic-substring.cpp | /*
* @lc app=leetcode id=5 lang=cpp
*
* [5] Longest Palindromic Substring
*/
// @lc code=start
/**思路:**/
class Solution {
public:
string longestPalindrome(string s) {
for (int i = 0; i < s.length() + 1; i = i + 2)
{
s.insert(i, 1,'*');
}
string str = s.substr(0, 1); ... | ALGO | 0.99998 | 6.133813 |
082bd964-e6bb-4232-b42f-2fbf28d8714d | endo1322/AtCoder | typical90/027/main.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (int i = 0; (i) < (int)(n); ++ (i))
#define rep3(i,m,n) for (int i = (m); (i) < (int)(n); ++ (i))
#define rrep(i,n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define rrep3(i,m,n) for (int i = (int)(n) -... | ALGO | 0.999833 | 4.136967 |
ac874072-225c-4317-b6e6-532f76fd8bb5 | VarunVeginati/leetcode | least-number-of-unique-integers-after-k-removals/least-number-of-unique-integers-after-k-removals.cpp | class Solution {
public:
static bool compare(pair<int,int> a, pair<int,int> b) {
return a.second<b.second;
}
int findLeastNumOfUniqueInts(vector<int>& arr, int k) {
map<int,int> m;
for(int i=0; i<arr.size(); i++) m[arr[i]]++;
vector<pair<int,int> > vec;
... | ALGO | 0.999973 | 5.675937 |
b6004c06-889b-43a9-bbc8-451d223fde81 | d-monteiro/NN | src/main.cpp | #include <iostream>
#include <chrono>
#include <vector>
#include <random>
#include <iomanip>
#include <algorithm>
#include "MNIST.h"
#include "NeuralNetwork.h"
using namespace std;
//g++ main.cpp MNIST.cpp NeuralNetwork.cpp -o main && ./main
//Helper function
int getPrediction(const vector<NNNeuron*>& outputNeurons... | DATA | 0.981079 | 4.847891 |
427ed45e-7e47-4bee-be66-92e4cb04407a | mevivek3620/AtCoder | Contests/E_Third_Avenue.cpp | #include <bits/stdc++.h>
#define ll long long
#define MAXN 102
// #define M 1000000007
#define f(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define pii pa... | ALGO | 0.999944 | 3.700638 |
18957d4d-99c7-46b1-afac-d183f00e5301 | CESARO23/UvaSolutions | Uva10424.cpp | /*******************************************************
Name Problem:Love Calculator
Problem Category:funtion
Problem Tester: Julio Cesar Mamani Villena.
Email: <EMAIL>
*******************************************************/
#include<bits/stdc++.h>
#define PI 2*acos(0.0)
#define MOD 1000000007
#define EPS 1e-9
#defin... | ALGO | 0.997654 | 5.015125 |
a19852a5-df35-4540-8842-1853fcbcd405 | Mokuroh54/Comp_Prog | Codeforces/1501-2000/1801-1900/1841-1850/1847/1847_B_Hamon_Odyssey.cpp | /*
___
(o,o)
< . >
--"-"---
Rowlet is orz
_ _ _
>(.)__ >(.)__ >(.)__
(___/ (___/ (___/
I am dum duck
*/
#include <bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define pb push_back
#define ll long long
#define ld long double
#define ull unsigned ll
#define endl "\n"
#define... | ALGO | 0.999393 | 5.053631 |
69afdc44-3457-42c0-a7ec-1741b23ba3b9 | TimHung000/leetcode | 0015_3sum/main.cpp | #include <vector>
#include <algorithm>
class Solution {
public:
std::vector<std::vector<int>> threeSum(std::vector<int>& nums) {
std::vector<std::vector<int>> res;
std::sort(nums.begin(), nums.end());
int i, j, k, sum;
for(i = 0; i < nums.size()-2; ++i) {
if(i > 0 && num... | ALGO | 0.999908 | 5.89527 |
621bf2dd-b2e5-4dbc-aa16-33dfd5d769ce | harshareddy794/Placement-preparation | Ds and algo/Advanced/Array/left rotate rotate by d/method1.cpp | #include <iostream>
using namespace std;
void rotateArray(int arr[], int n){
int temp,i;
temp = arr[0];
for(i=1;i<n;i++){
arr[i-1] = arr[i];
}
arr[n-1] =temp;
}
int main()
{
int arr [] = {1,2,3,4,5},d=2,n=5,i;
for(i=0;i<d;i++){
rotateArray(arr,n);
}
for(i=0;i<n;i++){
cout<<a... | ALGO | 0.999924 | 5.519856 |
da070ee6-aa2e-4b8c-87f3-d22c20247884 | trust0219/DataStructureLab | week4_divide_and_conquer/4_number_of_inversions/inversions.cpp | #include <iostream>
#include <vector>
using std::vector;
long long get_number_of_inversions(vector<int> &a, vector<int> &b, size_t left, size_t right) {
long long number_of_inversions = 0;
if (right <= left + 1) return number_of_inversions;
size_t ave = left + (right - left) / 2;
number_of_inversions += get_n... | ALGO | 0.99996 | 4.447427 |
6fc46130-8ff6-4b26-9cbe-7b9c36cfe07b | sunchenyuan15/CPP-Basic-Tutorial | Object Oriented/Pointers and References/pass_by_pointer_reference.cpp | #include<iostream>
using namespace std;
void add1(int *const number)
{
*number += 2;
}
void add2(int &number)
{
number += 3;
}
int main(int argc, char const *argv[])
{
int number{10};
add1(&number);
cout << "add1:" << number << " " << &number << endl;
add2(number);
cout << "add2:" << num... | TOOL | 0.979121 | 3.817707 |
db92b601-1abc-4bc3-acbe-b5b810842891 | danoli3/FreeImage | Source/OpenEXR/IlmImf/ImfRle.cpp | #include <string.h>
#include "ImfRle.h"
#include "ImfNamespace.h"
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
namespace {
const int MIN_RUN_LENGTH = 3;
const int MAX_RUN_LENGTH = 127;
}
//
// Compress an array of bytes, using run-length encoding,
// and return the length of the compressed data.
//
int
rleCompress... | ALGO | 0.995757 | 5.188163 |
76a19d11-cd77-40d0-8a81-0fe18eaa4dc7 | ayushman-25/Codechef-Submissions | bigint.cpp |
struct bigint {
vector<int> a;
int sign;
bigint() :
sign(1) {
}
bigint(long long v) {
*this = v;
}
bigint(const string &s) {
read(s);
}
void operator=(const bigint &v) {
sign = v.sign;
a = v.a;
}
void operator=(long long v) {... | ALGO | 0.999817 | 4.041177 |
c6723a2f-5f19-4f94-86de-46a9a5049427 | Akshit1482/Practise | 196.cpp | class Solution{
public:
void createMapping( int in[], map<int,int>& nodeToIndex, int n){
for( int i=0; i<n; i++ ){
nodeToIndex[in[i]] = i; // enter address of that particular node in map
}
}
Node* solve( int in[], int pre[], int& index, int inorderStart, int inorderEnd... | ALGO | 0.999997 | 6.292762 |
9e6a6286-19e1-4cc8-b670-e27ee9083968 | awishnick/sidescroller | lib/boost_1_49_0/libs/math/src/tr1/fminf.cpp | extern "C" float BOOST_MATH_TR1_DECL boost_fminf BOOST_PREVENT_MACRO_SUBSTITUTION(float x, float y) BOOST_MATH_C99_THROW_SPEC
{
if((boost::math::isnan)(x))
return y;
if((boost::math::isnan)(y))
return x;
return (std::min)(x, y);
}
| ALGO | 0.944999 | 4.864094 |
7eab1212-6ec1-45ea-afea-43c8ca16753a | Fengxingzhe666/mahjong_ready-check | vector_app.cpp | // vector_app.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include <vector>
#include<algorithm>//包含sort()函数
#include<unordered_map>
#include "check_win.h"
#include <set>
#include<ctype.h>
#include<string>
using namespace std;
void displayMatrix(const std::vector<std::vector<int>>& matrix)
{
for ... | ALGO | 0.982165 | 5.041207 |
c7b591c9-4a0c-4a55-b625-26941d3755ad | Nikhil-Vinay/DS_And_Algo | Miscellaneous/kmp_String_Search.cpp | /*** KMP Algorithm for finding a pattern in a string ******************/
/*** Time complexity - O(n) *********/
/** Example:
* string: ABABABC
* pattern: ABABC
* lps[] : 00120
*
* o/p - pattern found at index 2.
*/
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define DEBUG 1
int KMPPatt... | ALGO | 0.999981 | 5.853965 |
b8e471b6-bf75-421d-95a1-cd215fb7c847 | jainsourav43/Assignments | DWDM Assignments/second.cpp | #include<iostream>
#include<fstream>
#include<bits/stdc++.h>
#define no_of_items 10
using namespace std;
int make_it_number(string s)
{
int i,no=0;
for(i=0;i<s.size();i++)
{
no=no*10+s[i]-'0';
}
return no;
}
struct transcation
{
int no_of_transaction;
vector<int> no_of_item;
};
int main()
{
int transaction_co... | TOOL | 0.857877 | 3.975646 |
8f799968-28d0-4c4e-81e6-071e2d308970 | xuyanbo03/Algorithm | PAT/A1060/main.cpp | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<sstream>
#include<algorithm>
using namespace std;
const int maxn=1e5+10;
const int maxm=1e4+10;
const int inf=0x3f3f3f3f;
const int mod=998244353;
const double epx=1e-10;
type... | ALGO | 0.9993 | 3.193726 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.