uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
ce7b8341-e26a-409f-a518-19c35551316a | Kunalsahuji/30DaysDailyTask | ReverseDigit/ReverseDigit.cpp | // Reverse a Number:
#include <iostream>
using namespace std;
int main()
{
int n, temp, reverse = 0;
cout << "Enter number: ";
cin >> n;
temp = n;
while (n > 0)
{
reverse = reverse * 10 + n % 10;
n /= 10;
}
cout << "Number: " << temp << " Reversed Number: " << reverse;
} | ALGO | 0.9993 | 4.36144 |
0cfeb6a8-5fad-40d6-a28b-1b5608cb5776 | raaihansvg/Toki | function/4.cpp | #include <iostream>
using namespace std;
int jantan[4] = {0, 10, 50, 60};
int betina[4] = {7, 80, 9, 40};
int biaya(int total_bebek){
int harga_bebek;
if(total_bebek < 10){
harga_bebek = 100000;
}
else if(total_bebek <=50){
harga_bebek = 75000;
}
else{
harga_bebek = 50... | ALGO | 0.994167 | 3.622323 |
62f9d56c-cc3e-4034-94ca-bf0bea0eca90 | quocdung2603/ALL_OF_C | CodeForces/B_Balanced_Remainders.cpp | #include <bits/stdc++.h>
using namespace std;
#define nl << '\n'
#define fi first
#define se second
#define vd vector<double>
#define vi vector<int>
#define vii vector<pair<int, int>>
#define vtr vector<string>
#define yes cout << "YES"
#define no cout << "NO"
#define int... | ALGO | 0.99995 | 4.171669 |
c5768a69-c664-4b8c-8781-718c210435dc | ishandutta2007/codeforces | ngochai94/normal/700/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mod 1000000007
#define reset(s,val) memset(s,val,sizeof(s))
#define eps 1e-8
#define pi acos(-1)
#define sqr(x) (x)*(x)
#define two(x) (1<<(x))
long long n,k,deg[200005],val,ans,mak[200005],dp[200005],par... | ALGO | 0.999907 | 3.885172 |
e64c404c-a358-4418-a37b-78ef6a4d74d9 | ndina/acm | algorithms/week14/dijkstra.cpp | #include <iostream>
using namespace std;
bool used[1000];
int d[1000];
int a[1000][1000];
int c[1000];
int main(){
//read matrix3333333333333333333
int n;
for(int i = 0; i < n; i ++){
int k = -1;
for(int j = 0; j < n; j++){
if(!used[j] && (k == -1 || d[k] > d[j])){
k = j;
}
... | ALGO | 0.999991 | 3.142502 |
42924285-500a-4461-8168-b1524dc2a546 | kiutao/suitesparse_android_lib | suitesparse/SuiteSparse/SPQR/Demo/qrdemo_gpu2.cpp | // =============================================================================
// === qrdemo_gpu2.cpp =========================================================
// =============================================================================
// A simple C++ demo of SuiteSparseQR. The comments give the MATLAB equival... | ALGO | 0.854127 | 3.912595 |
adffb883-97b9-4120-95f9-9e28d95999ca | gudwh14/algorithm | c++/swea/이진수 표현.cpp | #include<iostream>
using namespace std;
auto solution() {
int N, M;
register int i;
cin >> N >> M;
int temp = 0;
int flag = true;
for (i = 0; i < N; i++)
{
temp = temp | (1 << i);
if ((M & temp) != temp) {
flag = false;
break;
}
}
// M과 temp 비트 비교하기
if (flag) cout << "ON" << endl;
else cout ... | ALGO | 0.999838 | 4.745391 |
d848cc77-b16f-44e9-be4e-0b726efe8127 | cuhk-seclab/SPatch | main/split/z3/src/model/model_evaluator.cpp | #include"model.h"
#include"model_evaluator_params.hpp"
#include"rewriter_types.h"
#include"model_evaluator.h"
#include"bool_rewriter.h"
#include"arith_rewriter.h"
#include"bv_rewriter.h"
#include"datatype_rewriter.h"
#include"array_rewriter.h"
#include"float_rewriter.h"
#include"rewriter_def.h"
#include"cooperate.h"
s... | ALGO | 0.929252 | 7.802073 |
cbd08057-51da-44cc-8efd-990da0d4ae8d | Yukti-Batra/100-Days_Of_Code | Day8.cpp/Day8.NumberOfOccurrences.cpp | #include<bits/stdc++.h>
using namespace std;
int firstOccurance(vector<int>& arr, int n, int x){
int start=0;
int end=n-1;
int ans=-1;
while(start<=end){
int mid=start+(end-start)/2;
if(arr[mid]==x){
ans=mid;
end=mid-1;
}
else if(arr[mid]>x){
end=mid-1;
}
else{
st... | ALGO | 0.99995 | 5.495621 |
7eadc161-0a19-4a9f-9d59-f1092c8d7a46 | Pritee668/cpp-language | deleteChar.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
char str[10];
cin>>str;
char ch;
cout<<"enter the character you want to delete";
cin>>ch;
int index;
for(int i=0;i<strlen(str);i++){
if(str[i]==ch){
index=i;
break;
}
}
int i;
for(i=index;i... | ALGO | 0.998368 | 3.502228 |
967920e6-3f7d-443d-b16e-d840114a183b | ishandutta2007/codeforces | spy20051623/normal/1574/C.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long a[N];
int main() {
// freopen("in.txt", "r", stdin);
int n;
scanf("%d", &n);
long long s = 0;
for (int i = 0; i < n; ++i) {
scanf("%lld", &a[i]);
s += a[i];
}
sort(a, a + n);
int m;
scanf("%d", &m);
while (m--) {
long long... | ALGO | 0.999862 | 3.854292 |
a10fa3ab-38f9-4347-b10c-9d2166d6c0f9 | oushuai01/algorithm | LiKou/随想录/hot100/二刷/105_下一个排列.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void nextPermutation(vector<int>& nums) {
int pos = nums.size() - 1;
// 找到第一个不是升序的数字(从后往前)
while (pos > 0 && nums[pos] <= nums[pos - 1])
pos--;
reverse(nums.begin() + pos, nums.end()); //逆序
if (pos > 0){
... | ALGO | 0.999986 | 4.672136 |
84611e0c-978a-4369-98ee-15bd7bec95f5 | rishabhchowkikar/OOPS-code | arrays/addition_matrix.cpp | #include <iostream>
using namespace std;
int main()
{
int n, m;
cout << "enter the number of row and column in matrix: ";
cin >> n >> m;
int a[n][m];
int b[n][m];
int c[n][m];
cout << "enter the element in first array: ";
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m;... | ALGO | 0.999533 | 4.059628 |
3175ae21-8232-414c-8969-7496bb490ae9 | HEMAL1234/Code | y.cpp | #include<stdio.h>
int N,A[20];
int s[20];
int main(){
void read();
int solve();
}
int read (){
int i;
scanf("%d",&N);
for(i=0;i<N;i++)
scanf("%d",&s[i]);
}
void print()
{
int i;
//int is_First =1;
//print("{") ;
for(i=0;i<N;i++) if(A[i]==1){
// if(is_First)
... | ALGO | 0.999803 | 3.358837 |
34274c01-f0e3-42c2-84a6-9b2143a7cb9e | MaiLinhLinh/CodePTIT_DSA | DSA01010.cpp | #include <bits/stdc++.h>
#define ll long long
#define mod int(1e9 + 7)
#define nmax int(1e6 + 7)
using namespace std;
int n, k, ok;
int a[50];
void sinh()
{
int i = k;
while (i >= 1 && a[i] == (n - k + i))
i--;
if (i == 0)
ok = 0;
else {
a[i]++;
for (int j = i + 1; j <= k... | ALGO | 0.999979 | 3.494226 |
55ddfd0d-8552-46c6-bd07-fda14229a10a | nileshleve/CPPCompCoding | cc_oct_long/example.cpp | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
bool isGood(string a, int src, int visited[], int countVisited){
if(a.size() == 1)
return true;
for (int i = 0; i < a.size() - 2; ++i){
if(a[i] - 48 == 1)
continue;
if((a[i] - 48) == 2 && (a[i + 1] - 48) == 2 && (a[i + 2] - 48) == 1)... | ALGO | 0.999939 | 5.190824 |
8d0ff4c3-f874-4bcf-982d-b2d9fe710f4c | Ascend/ModelZoo-PyTorch | PyTorch/contrib/cv/semantic_segmentation/MMseg-swin/mmcv/mmcv/ops/csrc/onnxruntime/cpu/roi_align.cpp | #include "../ort_mmcv_utils.h"
// implementation taken from Caffe2
struct PreCalc {
int pos1;
int pos2;
int pos3;
int pos4;
float w1;
float w2;
float w3;
float w4;
};
void pre_calc_for_bilinear_interpolate(
const int height, const int width, const int pooled_height,
const int pooled_width, con... | DATA | 0.993534 | 7.09334 |
72ed5459-ebc2-4be1-97ae-ad1530562e04 | aryanSE7374/myCoding | coding/DSA/DSA-A2Z/00_Extras/LC287.cpp | #include<bits/stdc++.h>
using namespace std;
// LC 287 : https://leetcode.com/problems/find-the-duplicate-number/
// my sol 1
// TC : O( (N * logN) + N ) , SC : O(1)
class Solution {
public:
int findDuplicate(vector<int>& nums) {
sort(nums.begin() , nums.end());
int n = nums.size();
for(i... | ALGO | 0.999882 | 5.783304 |
956108a9-bffa-4801-aee1-fdfa2a7b89f0 | devdrx/cp-submissions | B_Two_Tables.cpp | #include "bits/stdc++.h"
#define int long long
#define uint unsigned long long
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define fr(i,n) for(int i=0; i<(n); i++)
#define rep(i,a,n) for(int i=(a); i<=(n); i++)
#define nl cout<<"\n"
#define dbg(var) cerr<<#var<<"="<<va... | ALGO | 0.999394 | 3.952503 |
6f7c22a8-a545-4549-8ee1-37ab09047069 | ninfane/Guia8-POO | Guia 8/ex_1.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdlib>
using namespace std;
int main() {
vector<int> v;
for(int i=0;i<15;i++) {
v.push_back(rand()%101);
}
//metodos para mostrar, todos funcionan
//pero la sobrecarga de corchetes solo funciona con vector
// y no ... | TOOL | 0.855575 | 3.433596 |
7fa95511-c026-4d99-b2bf-9077d7dc688e | Thebelovedcookie/CPP- | cpp09/ex01/RPN.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* RPN.cpp :+: :+: :+: ... | TOOL | 0.972653 | 4.366887 |
16aceba6-9381-4b8c-8e00-9b2175feb2c7 | cgmcname/Uark | PF1/CSCE2004/project1-cgmcname.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main()
{
// Set values
char grade;
float credithour1,credithour2,credithour3,credithour4,totalhours,formula;
float gpv1,gpv2,gpv3,gpv4;
//Beginning prompt
cout << "Welcome to the GPA calculator." << endl;
cout << "Please enter your class grade as ... | TOOL | 0.893581 | 3.274183 |
ee72e2c8-619a-4847-b938-4eb745f73af3 | raincross7/code-similarity | codes/train_code/problem205/problem205_145.cpp | #include <iostream>
#include <algorithm>
#include <cstdio>
int main() {
int h, w, d;
scanf("%d%d%d", &h, &w, &d);
for (int i = 1; i <= h; i++) {
for (int j = 1; j <= w; j++) {
int x = (i + j + w) / d, y = (i - j + w) / d;
x &= 1, y &= 1;
if (x && y) printf("Y");
... | ALGO | 0.991519 | 3.402636 |
cdbf0183-bbbb-4337-b243-bc8f91b417da | Yosuamuliawan19/algorithm-bank | Codeforces/266b.cpp | #include<iostream>
#include<stdio.h>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cctype>
#include<iomanip>
#include<vector>
using namespace std;
int main(int argc, char const *argv[])
{
int n , s ;
cin >> n >> s ;
string cons;
cin >> cons;
for (int i1 = 0; i1 < s ; i1 ++)
{
f... | ALGO | 0.998891 | 3.035367 |
7597e8db-48d4-45de-b037-1e2916520b71 | mateuszpoleski/small-projects | C/lambdas.cpp | //learning lambdas
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <cassert>
#include <numeric>
#include <cmath>
#include <type_traits>
using namespace std;
void print(const std::vector<int> &v)
{
for (auto x : v)
cout << x << " ";
cout << endl;... | ALGO | 0.998665 | 4.692752 |
bf933d41-afc6-4d17-94af-e9f03c3a0d97 | AdarshGaur/Competitive-Programming | Codeforces/Codeforces Round #805 (Div. 3)/F.cpp | // Author : @AdarshGaur
#include <bits/stdc++.h>
using namespace std;
#ifdef cicada
#include "debug.h"
#else
#define debug(...) "Yume o akiramete shinde kure."
#endif
#define int int64_t
#define endl "\n"
typedef pair<int,int> pii;
int const INF = 2e18;
int const mod = 1e9 +7;
void solve(){
int n;
cin >> n;
m... | ALGO | 0.999904 | 3.988648 |
8e042ddb-7567-4907-a352-2cb5eb983191 | ishandutta2007/codeforces | ssrs_/normal/1303/C.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int T;
cin >> T;
for (int i = 0; i < T; i++){
string s;
cin >> s;
if (s.size() == 1){
cout << "YES" << endl;
cout << "abcdefghijklmnopqrstuvwxyz" << endl;
continue;
}
vector<set<char>> A(26);
for (int j = 0; j < s... | ALGO | 0.999988 | 4.523049 |
b2f6c8f9-d9d3-471d-a776-20db24833fe7 | Mariya-Pchelnik/UniversityC- | C++/C++ , 2 сем/лаб7/лаб7/Source.cpp | #include <stdio.h>
#include <iostream>
#include <stdio.h>
#include <conio.h>
int findSubstring(char str1[], const char str2[])
{
int start, size;
for (int i = 0; str1[i];)
{
start = i;
for (int j = 0; str1[i] && str2[j];)
{
if (str1[i++] != str2[j++])
break;
if (!str2[j])
{
size = j - 1;
i... | ALGO | 0.99987 | 3.200665 |
e8e9b412-dd8a-45bd-9bbf-b884e3ef9ce6 | flysight/flysight-viewer-qt | src/GeographicLib/SphericalEngine.cpp | /**
* \file SphericalEngine.cpp
* \brief Implementation for GeographicLib::SphericalEngine class
*
* Copyright (c) Charles Karney (2011) <<EMAIL>> and licensed under
* the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/
*
* The general sum is\verbatim
V(r, theta, lambda) = s... | ALGO | 0.999507 | 6.135891 |
14773470-d573-4f14-86b2-be7b7686a02d | KuboCoin/KuboCoin | src/kubocoin-tx.cpp | #include "base58.h"
#include "clientversion.h"
#include "coins.h"
#include "core_io.h"
#include "keystore.h"
#include "primitives/block.h" // for MAX_BLOCK_SIZE
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sign.h"
#include "ui_interface.h" // for _(...)
#include <univalue.h>
#include ... | CONFIG | 0.858154 | 4.69789 |
cb1c6c4c-ecd2-4d33-9f34-85982921178a | davidmustea/cpp-probleme-scoala | 40 probleme do while/prob8.cpp | #include<iostream>
using namespace std;
int main(){
int nr_care_se_citeste, contor_nr_palindrom = 0, copie_nr_care_se_citeste, oglindit_nr_care_se_citeste, copie_nr_care_se_citeste_prim;
int div, contor_div, contor_nr_prim = 0;
do{
cin >> nr_care_se_citeste;
copie_nr_care_se_citeste = nr_... | ALGO | 0.999588 | 4.410502 |
b540a946-ce6e-4bc4-bf91-7590aded6a9c | ishandutta2007/codeforces | sevenkplus/normal/45/G.cpp | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int pr(int n)
{
if(n<2)return 0;
for(int i=2;i*i<=n;i++)
if(n%i==0)return 0;
return 1;
}
int ff2(int n)
{
int r=n*(n+1)/2;
for(int i=2;i<=r-2;i++)
if(pr(i)&&pr(r-i))
... | ALGO | 0.999883 | 3.597335 |
fcf69616-d69f-4e61-9e3f-7d237c2e326f | pachecowillians/URI | 3046.cpp | #include <iostream>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <stack> //pilha
#include <queue> //fila
#include <functional>
#include <tr1/functional> //hash
#include <vector>
#include <cstring>
#include <string>
#include <stdlib.h>
#include <bits/stdc++.h>
#include <unordered_map... | ALGO | 0.998949 | 4.075574 |
fe14ba28-5d15-4e6f-b66f-cd9f81151e96 | ertugrl/LeetCodeWorks | 678-valid-parenthesis-string/valid-parenthesis-string.cpp | class Solution {
public:
bool checkValidString(string s) {
int leftBalance = 0;
for (int i = 0; i < s.size(); ++i){
if (s[i] == '(' || s[i] == '*') leftBalance++;
else leftBalance--;
if (leftBalance < 0) return false; // ")..."
}
if (leftBalance =... | ALGO | 0.999365 | 5.696668 |
78bb4376-8ec1-404b-8786-1bc3c53c707a | beef-erikson/CustomUnrealEngineRider | Engine/Source/Runtime/AnimationCore/Private/SplineIK.cpp | #include "SplineIK.h"
#include "HAL/ThreadSingleton.h"
namespace AnimationCore
{
struct FSplineIKSolverScratchArea : public TThreadSingleton<FSplineIKSolverScratchArea>
{
TArray<float> SplineAlphas;
};
void SolveSplineIK(const TArray<FTransform>& BoneTransforms, const FInterpCurveVector& PositionSpline, const F... | ALGO | 0.977821 | 7.548892 |
ddfb74f9-2f19-40e7-8813-6e7604e3b151 | fornewgold/CPSC2120 | HW 4 Nearest-Neighbor Classification using kd-Trees/main.cpp | /*
CPSC 2120
Xi Zhao
12/3/2014
*/
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
struct Point
{
double label, pdcn;
double *position;
};
struct Node
{
Point *key;
Node *left;
Node *right;
Node(Point *k) { key = k; lef... | ALGO | 0.998333 | 6.163308 |
b1cfba64-6e64-432c-b16a-4263482aada7 | JoaQiong/leetcode | 292 Nim Game石子堆.cpp | /*
Nim Game
由题意分析“我先下”可得如下表:
heaps takes remain Win or lose
1 1 0 win
2 2 0 win
3 3 0 win
4 1~3 3~1 lose
5 1 4(相当于这次他先拿) win
6 2 4 win
7 3 4 win
8 1~3 ... | ALGO | 0.999135 | 4.002805 |
0cba7b10-7ead-4fb9-924e-a1927d675f9e | Yuulis/AtCoderSolution_old | AtCoder/ABC/241~260/248/D.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using lld = long double;
using Graph = vector<vector<int>>;
using mint = modint998244353;
#define all(x) (x).begin(), (x).end()
constexpr auto PI = 3.14159265358979;
constexpr auto INF = 1e+9;
constexp... | ALGO | 0.99999 | 5.603535 |
dfa3cffe-e74a-405c-a97d-9ff24d7adcf4 | ishandutta2007/codeforces | chen_zexing/normal/1677/A.cpp | #include <cstdio>
#include <iostream>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <climits>
#include <algorithm>
#include <complex>
#include <string.h>
#include <iomanip>
#include <assert.h>
#include <random>
using namespace std;
int a[5005];
int pre[5005][5005],suf... | ALGO | 0.999882 | 3.555877 |
a532b11f-f32b-4027-903f-cf5c856b7d1b | HaochenLiu/My-LintCode-CPP | 463.cpp | /*
463. Sort Integers
Given an integer array, sort it in ascending order. Use selection sort, bubble sort, insertion sort or any O(n2) algorithm.
Have you met this question in a real interview? Yes
Example
Given [3, 2, 1, 4, 5], return [1, 2, 3, 4, 5].
*/
class Solution {
public:
/**
* @param A an integer a... | ALGO | 0.999942 | 5.855217 |
f5d01c99-8e4c-48a4-b4f8-88886d173485 | jimmyhanh/Cmpr120 | Chapter 5/Challenge2/main.cpp | //Hung Anh Ho
//3-28-2023
//Characters for the Ascii codes
#include<iostream>;
using namespace std;
int main()
{
// Go through 127 characters 16 each line
for (int i = 0; i <= 127; i++)
{
if (i % 16 != 0)
{
cout << char(i) << " "; //Display Ascii characters
}
else
{
cout << "\n";
}
}
ret... | ALGO | 0.966306 | 3.563788 |
ebbbcae2-53a7-4cba-ac9b-70052af9ae70 | josephabrams/follicle_updated | .history/custom_modules/twoP_20230613202942.cpp | #include "./twoP.h"
//two parameter and three parameter equations for cryobiology
//includes a number of conversions for solutions
std::vector <double> cell_exterior_densities;
std::vector <double> cell_interior_densities;
std::vector <std::vector <double> > virial_coefficients;
double cell_volume=0.0;
std::vector<do... | ALGO | 0.999823 | 4.56813 |
f5ed9d60-c64e-4ffa-96a9-7cf4550814e1 | vagrantxiao/dirc_fccm2021 | input_src/data_move/operators/shift_data.cpp | #include "../host/typedefs.h"
void shift_data (
hls::stream<ap_uint<32> > & Input_1,
hls::stream<ap_uint<32> > & Output_1
)
{
#pragma HLS INTERFACE ap_hs port=Input_1
#pragma HLS INTERFACE ap_hs port=Output_1
bit8 in[1024];
bit32 out;
//bit32 data_array[32768];
to_dma_label0:for(int i=0; i<32768; i++){
#pra... | ALGO | 0.983053 | 3.413494 |
6d6cac7b-e805-4079-ac26-dfd829cd6176 | wilson30139/Immerse-Oneself-In-Exercises | 程式夏令營/2022_07_03/2022_07_03_1.cpp | #include <iostream>
#include <cstring>
using namespace std;
int main(){
string s = "MCMXCIV";
int total = 0;
int currentInteger = 0;
int laterInteger = 0;
char romanCharacter[7] = {'I', 'V', 'X', 'L', 'C', 'D', 'M'};
int romanInteger[7] = {1, 5, 10, 50, 100, 500, 1000};
for(int i = 0; i < s.length(); i++){
for... | ALGO | 0.997884 | 4.964855 |
431d2998-e123-458c-8554-a26d10d86f96 | ussr1285/Coding_test | submitted/10951.cpp | #include <iostream>
using namespace std;
int main()
{
int A;
int B;
while (true)
{
cin >> A;
cin >> B;
if (cin.eof())
{
break;
}
cout << A + B << "\n";
}
return 0;
} | ALGO | 0.985008 | 4.329207 |
374e31d0-c8ff-4609-986f-8dad5f719e92 | leverimmy/Codes | 比赛/2019暑假中山纪念中学模拟测/2019.08.01【NOIP提高组】模拟 B 组/T1 游戏/gen.cpp | #include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
#define ll long long
#define il inline
#define rgi register int
using namespace std;
il int read()
{
rgi x = 0, f = 0, ch;
while(!isdigit(ch = getchar())) f |= ch == '-';
while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar... | ALGO | 0.925631 | 3.044092 |
03aa4ba8-fb87-4df0-a1ae-7de84f8afe16 | KeyurDave002/skillqode_c_cpp | employee.cpp | #include<iostream>
using namespace std;
class Company
{
int salary,workinghvr,bonus,hvr,totalhvr;
string emplname;
public:
void Employeename()
{
cout<<"Enter Employee Name : ";
cin>>emplname;
}
void TotalHour()
{
cout<<"Enter Total month Hvr (176 hvr tota... | TOOL | 0.927645 | 3.881305 |
9a4e6afb-992b-4b1b-8d54-0b20fb15fe09 | marcoafo/firmware-mod-kit | src/others/squashfs-4.0-lzma/lzma/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp | // LzmaBench.cpp
#include "StdAfx.h"
#include "LzmaBench.h"
#ifndef _WIN32
#define USE_POSIX_TIME
#define USE_POSIX_TIME2
#endif
#ifdef USE_POSIX_TIME
#include <time.h>
#ifdef USE_POSIX_TIME2
#include <sys/time.h>
#endif
#endif
#ifdef _WIN32
#define USE_ALLOCA
#endif
#ifdef USE_ALLOCA
#ifdef _WIN32
#include <mall... | TOOL | 0.860314 | 7.229069 |
89ec9f8b-6f6c-478d-9b8b-7c7b05b7729e | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_11936_1.cpp | #include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
inline long long pow(long long a, long long b) {
if (b == 1) return a;
long long tmp = pow(a, b >> 1);
tmp = (tmp * tmp) % mod * (b & 1 ? a : 1) % mod;
return tmp;
}
int n, m;
int a[100005];
long long ans = 0, res = 1;
int main() {
... | ALGO | 0.999984 | 3.836262 |
41020fb7-5a89-4380-80c2-0e54badfd3e4 | ishandutta2007/codeforces | kyo20111/normal/1553/F.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 300000;
int n;
ll t1[300300]; // x a[i]
ll t2[300300]; // x a[i]
ll t3[300300]; // x a[i]
ll t4[300300]; // for(int i=k;i<=N;i+=k) update(i, N, k);
ll t5[300300], t6[300300];
ll t7[300300]; // r[x] r[a[i]]
ll ans;
void updat... | ALGO | 0.999935 | 3.261159 |
020773ca-62f4-4510-9d42-8aa24351ba1e | werner-yin/code-public-2 | CF/contest/1674/B.cpp | #include <bits/stdc++.h>
#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)
using namespace std;
using ll = long long;
using db = double;
... | ALGO | 0.999668 | 4.191337 |
5e1ae48a-9da5-4bb0-acef-d58a17f60597 | ekmonet1/KAUVOY-2025 | TrackRace/src/lidar/dbscan/src/lidar_dbscan.cpp | /*----------------------------------------------------*/
/*----------------------------------------------------*/
/* 아래 코드는 윤수빈이 장애물 회피를 위해 작성한 코드임_240902 */
/*----------------------------------------------------*/
/*----------------------------------------------------*/
/*----------------------------------------------... | ALGO | 0.94964 | 5.778835 |
e9db4bf1-ad96-436b-addf-9fad723f79c1 | DigvijayChavan6/GeeksForGeeks | Checkiftwoarraysareequalornot.cpp | // Given two arrays A and B of equal size N, the task is to find if given arrays are equal or not. Two arrays are said to be equal if both of them contain same set of elements, arrangements (or permutation) of elements may be different though.
// Note : If there are repetitions, then counts of repeated elements must al... | ALGO | 0.99996 | 5.503572 |
cff85d1b-4cc4-4a89-8424-84b7cb7f0006 | vivekpatidar549/GFG | Medium/Sequence of Sequence/sequence-of-sequence.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{
public:
int generate(int a, int m, int n){
int total = 0;
int lim = m>>n;
while(a <= lim){
if(n)
... | ALGO | 0.999932 | 5.850766 |
9f5dd54e-b754-4c8c-912a-6dc6227b3e1e | wind641727121/ACM-cpp-code | 新建文件夹/contest2/main.cpp | #include <iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=1000;
int sum[MAXN];
int a[MAXN];
int main(){
std::ios::sync_with_stdio(0);
memset(a,0,sizeof(a));
memset(sum,0,sizeof(sum));
a[53]=a[23]=a[31]=a[71]=a[17]=a[37]=a[73]=a[137]=a[173]=a[317]=a[11... | ALGO | 0.999448 | 4.166096 |
0ebd245f-a852-4986-81f5-256bfd416d09 | WeichenXu/shuati | 446_arithmetic_slices_II.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
// 1. Maintain a diff map <int, int>
// 2. Update one by one
using namespace std;
class Solution {
public:
int numberOfArithmeticSlices(vector<int>& A) {
using diff_map_t = unordered_map<int, int>;
vector<diff_map_t> diff_maps;
... | ALGO | 0.999836 | 5.489135 |
59ee1766-db1b-407d-97bc-fe2b466c4992 | ishandutta2007/codeforces | msg555/normal/103/A.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N; cin >> N;
long long res = 0;
for(int i = 1; i <= N; i++) {
long long AI; cin >> AI;
res += AI * i - (i - 1);
}
cout << res << endl;
return 0;
} | ALGO | 0.999752 | 3.913376 |
2b6c0f83-e699-4aee-bca0-c7066b38d76d | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5534_7.cpp | #include <bits/stdc++.h>
using namespace std;
int ans[100005];
int main() {
int n, k;
cin >> n >> k;
long long nn = 1ll * (n - k * (k + 1) / 2);
if (nn < 0) {
cout << "NO" << endl;
exit(0);
}
int x = 1 + nn / k;
if (x == 1 && nn % k == k - 1 && (k == 2 || k == 3)) {
cout << "NO" << endl;
e... | ALGO | 0.999978 | 3.931849 |
4ce96e27-4129-4f6a-9e1a-3effdd754ba4 | bytedance/terark-zip | 3rdparty/boost-include/libs/compute/perf/perf_bolt_max_element.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <bolt/cl/copy.h>
#include <bolt/cl/device_vector.h>
#include <bolt/cl/max_element.h>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>(rand() % 10000000);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std... | ALGO | 0.968347 | 5.044326 |
eaa41867-fb6d-4263-91c1-97ee2bc490df | Anmol-Baranwal/Leetcode-GFG-DS-Solutions | Dynamic Programming/Geeksforgeeks/Knapsack with Duplicate Items.cpp | /*
Problem Link: https://practice.geeksforgeeks.org/problems/knapsack-with-duplicate-items4201/1
*/
// -----Approach 1: Memoization ------------------------------------------------------------
class Solution{
private:
int sol(int idx,int W, vector<vector<int>>& dp, int val[],int wt[]){
if(idx==0) ret... | ALGO | 0.999999 | 5.64309 |
c85f6512-7189-4fd3-8071-6f0c19ecfda3 | wlrnfyd0329/algorithm | BaekJoon/33 Union-Find/10775 공항.cpp | // 결국 root가 0번이 되면 공항이 폐쇄되는 것이다.
#include <iostream>
#include <string.h>
#define endl "\n"
using namespace std;
int p[100'005];
int find(int x) {
if (p[x] < 0) return x;
return p[x] = find(p[x]);
}
bool uni(int x) {
x = find(x);
if (x == 0) return false;
p[x] = x - 1;
return true;
}
int ma... | ALGO | 0.999782 | 3.812288 |
1b9a913d-3c3c-4c93-9827-c3220254797b | goingbananaz505/codingcontests | DRT19_AB_Dependenta/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
class Solution {
public:
int long long getCoffeeCost(const int M, const int K,
const std::vector<int>& C) const {
auto coffeeCost = C;
std::sort(coffeeCost.begin(), coffeeCost.end());
std::ve... | ALGO | 0.999942 | 4.435389 |
1c42c645-cd11-4ae8-9a1a-ea03e0db0dbc | AcuLuis/KattisProblemas | Time Travelling Temperatures.cpp | #include <stdio.h>
int main()
{
int x, y;
scanf("%d %d", &x, &y);
if (x == 0 && y == 1) printf("ALL GOOD\n");
else if (y == 1) printf("IMPOSSIBLE\n");
else printf("%.6f\n", x / (1.0 - y));
return 0;
}
| ALGO | 0.998763 | 3.360652 |
a406c50c-9a81-437a-b940-712d8af4bd53 | marinicadenisandrei/leetcodeCpp | subsets_78.cpp | /* Leetcode - 78. Subsets (C++ language) - Medium */
#include <iostream>
#include <vector>
using namespace std;
vector<vector <int>> subsets(vector <int> numsVar);
void printVectorMatrix(vector <vector <int>> matrix);
void reset ();
void green ();
void yellow ();
void red ();
int main()
{
yellow();
cout <... | ALGO | 0.99835 | 6.485349 |
ee2fb6b0-9e37-4fce-9917-54dafbf70fd5 | ishandutta2007/codeforces | alexandr_ts/normal/489/A.cpp | #include <bits/stdc++.h>
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define fr(i, n) for (int i = 0; i < n; i++)
#define frab(i, a, b) for (int i = a; i < b; i++)
#define SSTR(x) dynamic_cast< std::ostringstream & >( \
( std::ostringstream() << std::dec << x ) ).str()
using namespace std;
typ... | ALGO | 0.999576 | 3.336551 |
1a57b5e7-e4f1-49c2-bb91-5a8904bdfa8a | claytonjwong/Algorithms-UCSanDiego | 1_course/1_week/1_sum_of_two_digits/cpp/APlusB.cpp | #include <iostream>
using namespace std;
class Solution
{
public:
int sum_of_two_digits( int first, int second )
{
return first + second;
}
};
int main()
{
Solution solution;
auto a{ 0 }, b{ 0 };
cin >> a >> b;
cout << solution.sum_of_two_digits( a, b );
return 0;
}
| ALGO | 0.999054 | 5.231874 |
b2f706ac-dfe2-44d4-b7c4-41d0f5b08e71 | ishandutta2007/codeforces | strawberryc/normal/1137/F.cpp | #include <bits/stdc++.h>
// 0830
inline int read()
{
int res = 0; bool bo = 0; char c;
while (((c = getchar()) < '0' || c > '9') && c != '-');
if (c == '-') bo = 1; else res = c - 48;
while ((c = getchar()) >= '0' && c <= '9')
res = (res << 3) + (res << 1) + (c - 48);
return bo ? ~res + 1 : res;
}
template <c... | ALGO | 0.999932 | 4.22698 |
85ee49e8-826b-4356-871f-50db5b583768 | TanviKapurwan23/LinkedList | deleteFirstNode.cpp | #include<iostream>
using namespace std;
// Node definition
struct Node{
int data; // integer data stored in the node
Node* next; // pointer to the next node in the list
Node(int x){ // constructor to initialize node with data
data = x;
next = NULL; ... | ALGO | 0.999948 | 6.107873 |
fa183f4d-8c90-48fd-889b-3aad04df3dc6 | dingyaguang117/USACO | Section1_5_2pprime/main.cpp | /*
ID:dingyag1
LANG:C++
TASK:pprime
*/
#include <stdio.h>
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
void do1(int a,int b);
void do2(int a,int b);
void do3(int a,int b);
void do4(int a,int b);
void do5(int a,int b);
void do6(int a,int b);
void do7(int a,int b);
void do8(int a,int b);... | ALGO | 0.999797 | 3.950799 |
335f873e-a2f2-4d42-be9e-85fa9856e33c | ishandutta2007/codeforces | arsijo/normal/522/B.cpp | /*
* Author: arsijo;
*/
#include <bits/stdc++.h>
using namespace std;
#define files(x) freopen(x ".in", "r", stdin); freopen(x ".out", "w", stdout);
//#define files(x) freopen(x ".dat", "r", stdin); freopen(x ".sol", "w", stdout);
#define input freopen("input.txt", "r", stdin);
#define ll long long
#define ui u... | ALGO | 0.999987 | 3.24552 |
bb04247a-2eca-40b8-8326-06eb917b279e | sky107/Repository-2 | make-string-subsq-of-01-10.cpp | //https://www.geeksforgeeks.org/find-if-it-is-possible-to-make-a-binary-string-which-contanins-given-number-of-0-1-01-and-10-as-sub-sequences/
#include <bits/stdc++.h>
using namespace std;
signed main(){
int zero=3,ones=2;
int zeroOnes=4,oneZeros=2;
bool ok= zero*ones==(zeroOnes+oneZeros);
cout<<(ok?"Yes\n":"No... | ALGO | 0.99987 | 4.006312 |
0d8667cf-57bf-43d7-b9aa-c0cf82d61e64 | pavelsimo/ProgrammingContest | uva/401_Palindromes/main.cpp | /* @BEGIN_OF_SOURCE_CODE */
/* @JUDGE_ID: 401 C++ "String Manipulation" */
#include <iostream>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#inclu... | ALGO | 0.999543 | 3.707048 |
24a74564-e13e-4520-a990-34af0449b1f1 | RayzaRodriguez/Algebra-Abstracta | cifradoAfin/cifradoAfin/afin.cpp | #include "stdafx.h"
#include "afin.h"
#include<stdlib.h>
#include<time.h>
#include <string>
#include <iostream>
using namespace std;
afin::afin(int n)
{
mod = n;
}
int afin::modulo(int a, int b)
{
int q = a / b;
int r = a - q*b;
if (r<0)
r += b;
return r;
}
bool afin::mcd(int num)
{
int a = num;
int b = mo... | ALGO | 0.998266 | 3.207756 |
03158065-6677-4077-bf23-ad3a8bb56441 | schopferisch-Priya/C---Programs | sum_of_digits.cpp | #include<iostream>
using namespace std;
int main()
{
int n, sum=0;
cout<<"Enter the number:";
cin>>n;
do{
int r=n%10;
sum=sum+r;
n=n/10;
}while(n>0);
cout<<"\n Sum of digits of n numbers="<<sum;
return 0;
}
| ALGO | 0.999794 | 3.692512 |
d408b41d-5a76-428a-a426-f822f6f72bce | huanghuoguoguo/miniob_2024 | src/observer/sql/optimizer/predicate_pushdown_rewriter.cpp | //
// Created by Wangyunlai on 2022/12/30.
//
#include "sql/optimizer/predicate_pushdown_rewriter.h"
#include "common/log/log.h"
#include "sql/expr/expression.h"
#include "sql/operator/logical_operator.h"
#include "sql/operator/table_get_logical_operator.h"
RC PredicatePushdownRewriter::rewrite(unique_ptr<LogicalOper... | ALGO | 0.979957 | 6.062851 |
bb51d6c1-2889-40a6-a668-7ea17c276b68 | ishandutta2007/codeforces | frodakcin/normal/1344/A.cpp | #include <cstdio>
#include <cstring>
using ll = long long;
const ll INF = 1e9 + 10;
const int MN = 2e5 + 10;
int N, T, a[MN];
bool works, u[MN];
int main(void)
{
scanf("%d", &T);
while(T--)
{
scanf("%d", &N);
for(int i=0;i<N;++i)
scanf("%d", a+i);
works = 1;
for(int i=0;i<N;++i)
{
int to =(int)((i+... | ALGO | 0.999559 | 3.801682 |
66a7dc5d-3701-43b7-a743-716e46c8734d | yuuki008/alds | tree/minimum_spanning_tree/prim.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <functional>
using namespace std;
typedef pair<int, int> P;
vector<vector<P>> adj;
int prim(int n) {
priority_queue<P, vector<P>, greater<P>> pq; // 最小ヒープと同義で常に最小の要素を取得できる
vector<bool> in_MST(n, false);
int mst_weight = 0;
pq.push({ 0, 0 });
... | ALGO | 0.999775 | 4.898405 |
5f2288b2-8395-45a8-880d-4c6501910dbe | JolenLi/leetcode_train | 数组/238. Product of Array Except Self.cpp | //
// Created by Jolen on 2022/3/23.
//
vector<int> productExceptSelf(vector<int> &nums) {
vector<int> prefix(vector<int>(nums.size(), 1));
vector<int> suffix(vector<int>(nums.size(), 1));
for (int i = 1; i < nums.size(); i++)
prefix[i] = prefix[i - 1] * nums[i - 1];
for (int i = nums.size() - ... | ALGO | 0.999989 | 5.815639 |
95de21cf-0df5-4aea-ba6e-b42efc9aab1f | WilderStill/C-Programs | 洛谷/主题库/P7076 [CSP-S2020] 动物园.cpp | #include<bits/stdc++.h>
#define ull unsigned long long
using namespace std;
ull s[70],tr,n,m,c,k,t;
int main()
{
scanf("%llu%llu%llu%llu",&n,&m,&c,&k);
if(!n&&!m&&k==64){printf("18446744073709551616");return 0;}//
for(ull i=1,tmp;i<=n;i++)
{
scanf("%llu",&tmp);
tr=tr|tmp;
}
for(ull i=1,p,q;i<=m;i++)
{
sca... | ALGO | 0.999654 | 3.38357 |
78d920f7-97c3-48c4-8842-b8f4ad89cf0c | madmaxujjwal/leetcode-solutions | 36-valid-sudoku/36-valid-sudoku.cpp | class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
for(int i=0;i<9;i++){
unordered_map<char,int> ht;
for(int j=0;j<9;j++){
if(board[i][j]=='.')
continue;
if(ht.find(board[i][j])!=ht.end())
... | ALGO | 0.999556 | 6.663886 |
100c02e7-6364-4c97-a7b5-1ccf2ce5fbec | ebasconp/cpp-overview | code/session-10/bst.cpp | #include <iostream>
template <typename T>
struct my_less
{
bool is_less_than(const T& a, const T& b) const
{
return a < b;
}
};
//Less is a policy
template <typename T, typename Less = my_less<T>>
class bst
{
struct bst_node
{
T elem;
bst_node* left;
bst_node* right;
};
Less less;
bst_node* root = n... | ALGO | 0.995713 | 5.354735 |
0ff07742-3fd5-4fc8-b495-5b6c29b7e747 | reisxd/TizenTubeCobalt | third_party/llvm-project/libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/ctor.in_place.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
// template<class ...Args>
// explicit <copyable-box>::<copyable-box>(in_place_t, Args&& ...args);
#include <ranges>
#include <cassert>
#include <type_traits>
#include <utility> // in_place_t
#include "types.h"
struct UnknownType { };
template<bool Noexcept>
struct Nothr... | TEST | 0.91737 | 6.924841 |
2322a817-ec81-4f66-a254-b056799da3f2 | ISOLDE-Project/riscv-llvm | llvm/lib/CodeGen/BasicBlockSections.cpp | #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/BasicBlockSectionUtils.h"
#include "llvm/CodeGen/BasicBlockSectionsProfileReader.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/Tar... | TOOL | 0.959359 | 4.751185 |
e0d52aac-2473-4b82-b724-c85a754f66b6 | Sears-Tian/Laboratory | C-Free5/Competition/2-3-5.cpp | /*
2018.05.12 10;03
1-1/4+1/7-1/10+1/13-1/16+ǰn ֮
*/
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int n;
double sum = 0.0;
int signal = 1; //
double item; //ÿһֵ
cout << "Enter n: ";
cin >> n;
for(int i = 1; i <= n; i++)
{
item = signal * 1.0 / (3 * i - 2);
sum += item;... | ALGO | 0.999683 | 3.433594 |
3c2a2d92-b857-48c5-b5c9-7a5fbb6fcfd6 | wells-wei-wei/smplify-x_in_docker | boost_1_72_0/libs/compute/perf/perf_erase_remove.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/remove.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 10.0);
}
int main(int argc, char *... | ALGO | 0.95293 | 6.561828 |
c662689c-509e-4ac0-b5ad-d096b499b2e3 | anishmokashi/Application_Programs | Basic_Application-programs/Generics.cpp | #include<iostream>
using namespace std;
// Application for specific programming
int AdditionI(int i, int j)
{
int result;
result = i + j;
return result;
}
float AdditionF(float i, float j)
{
float result;
result = i + j;
return result;
}
double AdditionD(double i, double j)
{
double resul... | TOOL | 0.856276 | 4.087775 |
6956e62b-ebd2-4a59-8575-938edeaffec4 | ahmedwael22/approximation-algorithms-case-study | Code/main.cpp | #include "Bruteforce.h"
#include "Approximation.h"
#include <iostream>
#include <vector>
using namespace std;
void RandomInstanceGenerator (int& L, int& C, int&D, vector<vector<int>>& P);
void InstancePrinter (int L, int C, int D, vector<vector<int>> P);
int main()
{
fstream dataDump;
dataDump.open( ... | ALGO | 0.992205 | 3.496956 |
bd078c20-1f65-44b7-88b5-e6b5aaca935a | camillamendess/EstudosFaculdade | API/CamillaMendes_Lab02_questao03.cpp | /*Faa um programa que pea dois nmeros, base e expoente, calcule e mostre o primeiro
nmero elevado ao segundo. No utilize a funo de potncia da linguagem.*/
#include <iostream>
using namespace std;
#include <locale.h>
int main(){
setlocale(LC_ALL, "Portuguese");
int base, exp;
int pot;
int cont = 2;
cout << ... | ALGO | 0.995288 | 4.23152 |
4b724fef-ee30-4fee-bb75-b30b0419a785 | JMarte03/tarea_6_apps | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
a082b325-917f-496b-82a9-85f5ef9818c8 | Anup-Nayak/dsa | Lecture013 Binary Search Interview Questions/peakInMountain.cpp | #include<vector>
using namespace std;
class Solution {
public:
int find_pivot(vector<int> v) {
int s = 0, e = v.size() - 1;
int mid=(s + e) / 2;
while (s < e)
{
if(v[mid] < v[mid+1])
s=mid+1;
else
e = mid;
mid = (s + e) / 2;
}
return s;
}
int peakIndexInMountainArra... | ALGO | 0.999982 | 5.465726 |
b1cdb674-32cb-4ccb-8fe1-8d18dc34f11a | revng/llvm-project | libcxx/test/std/algorithms/alg.sorting/alg.merge/ranges_inplace_merge.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
// <algorithm>
// template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
// class Proj = identity>
// requires sortable<I, Comp, Proj>
// I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // ... | TEST | 0.997886 | 7.793143 |
cb0bfb8a-cc15-4049-aff1-93bccb00827a | yezhangxiang/LeetCode | src/SetMatrixZeroes/SetMatrixZeroes.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
void setZeroes(vector<vector<int> > &matrix) {
}
}; | ALGO | 0.992704 | 3.958738 |
0f16221b-f015-4fc7-89e9-bdb8af7ffc2b | lesept777/BigNumbers-for-ESP32 | BigNumbers.cpp | #include "BigNumbers.h"
bigNumber::bigNumber() {
}
bigNumber::~bigNumber() {
}
void bigNumber::set (double mant, std::vector<double> const &expoVec, int nbexpo) {
double expo[MAXFLOORS] = {0};
uint8_t i = 0;
for (double x : expoVec) expo[i++] = x;
this->set(mant, expo, nbexpo);
}
void bigNumber::set(double ... | ALGO | 0.872134 | 3.608675 |
e8e4a403-ac5a-46b5-8a7e-e6cdceb67b7c | isac322/BOJ | 10570/10570.cpp11.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int main() {
short t, n, arr[1001], a;
scanf("%hd", &t);
while (t--) {
fill(arr, arr + 1001, 0);
scanf("%hd", &n);
while (n--) {
scanf("%hd", &a);
arr[a]++;
}
short *p = arr;
for (int i = 0; i < 1001; i++) {
if (arr[i] > *p) p = arr +... | ALGO | 0.999545 | 3.577181 |
9a1667e2-3c1d-4e76-87d1-34b320f91103 | CundariNicolas/unqui-estructurasdedatos-cundari | workspaceHaskell2.0/3.Practica-9/arrayLists/main.cpp | #include <iostream>
#include "arraylist.h"
using namespace std;
// funciones como usuario de arraylist
int sumatoria(ArrayList xs){
int res = 0;
for(int i = 0; i < lengthAL(xs); i++ ){
res = res + get(i, xs);
}
return res;
}
void sucesores(ArrayList xs){
for(int i = 0; i < lengthAL(xs); ... | ALGO | 0.857859 | 3.303782 |
41e10573-953c-42e2-a008-b8818b74aa48 | atulmahlan/Data-Structures-and-Algorithms | 01_Arryas/Q14_Majority_Element.cpp | // QUESTION: Given an array nums of size n, return the majority element.
// The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array.
int majorityElement(vector<int>& nums) {
int i = 0;
int n = nums.size();
int count... | ALGO | 0.999728 | 5.45517 |
e5b94750-cebb-4084-b25b-125d698252bc | NadavCohen10/Square_Matrix_Algebra_Library_in_CPP | SquareMat.cpp | // <EMAIL>
#include "SquareMat.h"
#include <iostream>
#include <stdexcept>
#include <cmath>
namespace matrix {
// Constructor: Initializes a square matrix of given size 'num'.
SquareMat::SquareMat(int num) {
if (num <= 0) {
throw std::invalid_argument("Number of rows and columns must be po... | TOOL | 0.990817 | 6.164096 |
e9ba50e6-6550-4625-a7e3-2c72fcd6be12 | adi64/terminus | source/util/catmullromspline.cpp | #include "catmullromspline.h"
#include <cassert>
#include <cmath>
namespace terminus
{
CatmullRomSpline::CatmullRomSpline(const std::vector<QVector2D> & controlPoints)
: m_controlPoints(controlPoints)
{
assert(m_controlPoints.size() >= 2);
calculateKnotSequence();
}
CatmullRomSpline::~CatmullRomSpline()
{
}... | ALGO | 0.995722 | 5.833932 |
35435e24-f7d3-4ea6-8295-73fc99d895d1 | LarryCCLai/NTUT-Special-Project-SKRMSim | modules/MOutOfN/MOutOfNModule.cpp | #include<algorithm>
#include<cmath>
#include"MOutOfNModule.h"
#define R true
#define L false
M_Out_Of_N_Module::M_Out_Of_N_Module() {
this->injection = 0;
this->remove = 0;
this->shift = 0;
this->detect = 0;
this->initialized = false;
this->track = nullptr;
this->params = nullptr;
this->datas = nullptr;
}
M_Ou... | ALGO | 0.998574 | 3.844006 |
ae558292-8401-4324-bf3b-0b1e52daf47c | Garker-gan/MachineLearning | decisionTree.cpp | /*
㷨ʵ
Garker-gan
2020-11-24 ʵ
2020-11-27 Ϣصļ
2020-11-28 Ϣļ
2020-11-28 ģͣbug
*/
#include<iostream>
#include<algorithm>
#include<sstream> //ostringstream istringstream stringstream
#include<string>
#include<vector>
#include<map>
#include<set>
#include<math.h>
using namespace std;
vector<s... | ALGO | 0.999283 | 4.917355 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.