uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
349f803e-4921-4891-96ae-d47a772e1fb5 | kurone02/competitive_programming | VNOJ/C11TRCNT.cpp | #include<bits/stdc++.h>
#define up(i,a,b) for(int i=int(a);i<=int(b);i++)
#define down(i,a,b) for(int i=int(a);i>=int(b);i--)
#define X first
#define Y second
#define CL(x) (x<<1)
#define CR(x) (x<<1)+1
#define pb push_back
/*----------------------------------------------*/
using namespace std;
typedef long long ll; ty... | ALGO | 0.999834 | 3.93854 |
84904c63-b455-4774-b498-1d58aa3a06df | bryant/pdse | lib/CodeGen/LiveRangeCalc.cpp | #include "LiveRangeCalc.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
using namespace llvm;
#define DEBUG_TYPE "regalloc"
void LiveRangeCalc::resetLiveOutMap() {
unsigned NumBlocks = MF->getNumBlockIDs();
Seen.clear();
Seen.resize(N... | TOOL | 0.99594 | 7.968129 |
bd586dc9-d6fd-49cc-98a0-158bc3c10a35 | CodeTest-StudyGroup/Code-Test-Study | ChanhuiSeok/[1]SWEA/3주차-SWEA-2105-디저트카페.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
/*
Ȯϰ ..
ʹ ð ȴ...
迭 ȣ Ʈ ̴..
̰Ŵ Ʈ ִ Ծ ϴ°ǵ
迭 ȣ Ʈ ߸ ϰ
յ ִ밡 θ ĭ ϴϱ ڲ Ʋȴ..
.
.
.
...
.
..%^%^^
*/
using namespace std;
int N;
// Ʒ 0, 1, Ʒ 2, 3
int dy[4] = { 1,-1,1,-1... | ALGO | 0.99988 | 3.90614 |
745bb942-c1e6-4ab2-868e-8cf29c1986da | DevTheTester/cs-projects | cpp-programs/simple-programs/Week4/Practice/q2-ten-to-one.cpp | #include <iostream>;
using namespace std;
int main(){
for (int i = 10; i > 0; i--){
cout << i << endl;
}
} | TOOL | 0.997371 | 3.217767 |
75fb9b2c-031c-427d-847a-108f42783d30 | hacch141/Coding-Practice | LeetCode/0605.Can-Place-Flowers.cpp | // 605. Can Place Flowers
class Solution {
public:
bool canPlaceFlowers(vector<int>& flowerbed, int n) {
int size = flowerbed.size();
int ans = 0;
if(size==1) {
ans = !flowerbed[0];
return ans>=n;
}
if(flowerbed[0]==0 && flowerbed[1]==0) {
... | ALGO | 0.999992 | 6.807676 |
79cd4d7b-178e-4eb9-960e-577c0c7a855a | rapel02/competitive-programming | UVa/596.cpp | #include<bits/stdc++.h>
using namespace std;
int n,k;
struct Point{
int x,y;
}p[150000],hull[15000];
string in;
string name;
bool cmp(Point a,Point b)
{
if(a.x > b.x) return true;
if(a.x == b.x) return a.y < b.y;
return false;
}
double cross(Point a,Point b,Point c)
{
return (b.x - a.x) * (c.y - a.y) - (b.y - ... | ALGO | 0.999826 | 3.310309 |
cb491b56-f370-437e-b438-9e0d42a9fd34 | chaubey-aditya/DSA-CPP | CPP/Vectors/lastOccurenceOfX.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> arr = {3,4,2,1,4};
int x=4;
for(int i=arr.size()-1; i>0; i--){
if(arr[i] == x) cout<<i;
break;
}
} | ALGO | 0.999625 | 4.76529 |
8dde8131-ac3d-41ca-81c5-7d068c43d1a9 | nicebub/CPP_CrashCourse | chptr2/calc.cpp | #include <cstdio>
enum class Operation {
ADD,
SUBTRACT,
MULTIPLY,
DIVIDE
};
struct Calculator {
Calculator(Operation in_op){
op = in_op;
}
Calculator(){
op = Operation::ADD;
}
// ~Calculator(){}
Operation get_op(){
return op;
}
void set_op(Operation in_op){
op = in_op;
}
int calculate(int a, int ... | ALGO | 0.966972 | 4.562418 |
25f094f9-58f9-4d25-a503-059267283d9e | algo-data-platform/PredictorService | thirdparty/eigen/bench/geometry.cpp |
#include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace std;
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 8
#endif
typedef SCALAR Scalar;
typedef NumTraits<Scalar>::Real RealScalar;
typedef Matrix<RealScalar,Dynamic,Dynamic> A;
type... | ALGO | 0.944184 | 5.941502 |
872556ee-7ac8-4183-8cca-727f37fd3a27 | Djazy-Faradj/Leetcode | Easy/169. Majority Element/solution2.cpp | /*
Author: Djazy Faradj
Problem: 169. Majority Element
Description:
- 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.
Note:
Optimal solution (Moore Voting Alg... | ALGO | 0.999978 | 6.325666 |
186643f1-8386-401b-9165-7296b065fea1 | Lexarymade/FDU-DL-Course | gaussian-splatting/SIBR_viewers/src/core/view/IBRBasicUtils.cpp | #include "IBRBasicUtils.hpp"
namespace sibr {
std::vector<uint> IBRBasicUtils::selectCameras(const std::vector<InputCamera::Ptr>& cams, const Camera & eye, uint count)
{
// Select one method
return selectCamerasAngleWeight(cams, eye, count);
//return selectCamerasSimpleDist(cams, eye, count);
}
std::vector<... | ALGO | 0.994745 | 6.356331 |
2f9c75e0-743c-4813-a9d1-7348c23b954e | Amir7009/bp | search/search.cpp | #include <iostream>
using namespace std;
#define SIZE 50
int searching ( int s[], int n, int d ){
for ( int i=0 ; i<n ; i++ )
if ( s[i] == d ){
return i;
}
}
int main( ) {
int s[SIZE], n, x, i;
int tmp;
cout << "enter input data end by -10000: ";
cin >> x;
n=0;
while(x!=-10000){
s[n++]=x;
... | ALGO | 0.998934 | 3.90261 |
1fd34f57-c244-42ff-91bf-81bada759b8c | Caro23333/Root | src/VAS.cpp | /*******************************
* VAS bisection method by panjq22(<EMAIL>)
* Created on 2022/10/02
*******************************/
#include <CP_Root.h>
#include <VAS.h>
mpq mobius::rootlimit;
int rootlimitlog2;
std::ostream & operator << (std::ostream & out, mobius x) {
out << "(" << x.a.get_d() << "x+" << x.b.get... | ALGO | 0.999931 | 4.395362 |
64603609-0176-4d45-9b1c-50b7b25024e1 | Nilerm/Projet_MOPSI | Scripts/CPP/FFT/dirac_fft.cpp | #include "fftw3.h"
#include <iostream>
using namespace std;
int main(){
int size=32;
fftw_complex *in, *out;
fftw_plan p;
in=(fftw_complex*) fftw_malloc(sizeof(fftwf_complex)*size); //allocation d'un tableau prenant les variables d'échantillonage en entrée
out=(fftw_complex*) fftw_malloc(sizeof(fftwf_complex)*s... | ALGO | 0.996769 | 3.129468 |
43d81985-0e46-4f65-bbfb-08a038c7e6fe | hashiryo/Library | test/atcoder/arc123_d.test.cpp | // competitive-verifier: IGNORE
// competitive-verifier: PROBLEM https://atcoder.jp/contests/arc123/tasks/arc123_d
// competitive-verifier: TLE 0.5
// competitive-verifier: MLE 128
#include <iostream>
#include "src/Optimization/PiecewiseLinearConvex.hpp"
using namespace std;
signed main() {
cin.tie(0);
ios::sync_with... | ALGO | 0.999882 | 4.733957 |
d7620f2a-7ce7-48a9-9368-60b7c35fdf4a | realthunder/hm_sun7i_android | frameworks/av/media/libstagefright/codecs/amrnb/common/src/div_32.cpp | /*
Filename: /audio/gsm_amr/c/src/div_32.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template. Changed function interface to pass in a
pointer to overflow flag into the function instead of using a
global flag. R... | ALGO | 0.999435 | 6.675967 |
4f43012e-5019-4671-914c-7bfe9830cd0c | luckyIITR/dsa450solved | Dynamic Programming/edit_distance.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
int editDistance(string s, string t)
{
int m = s.length(), n = t.length();
int dp[m + 1][n + 1];
for (int i = 0; i <= m; i++)
{
for (int j = 0; j <= ... | ALGO | 0.999994 | 6.608323 |
d7a91289-5f8a-4f24-bf4c-9fb89bf75efb | princeragh1801/Love-Babbar-Dsa-Sheet | Array/15.cpp | //{ Driver Code Starts
// Initial template for C++
// Revise it time to time
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
int getMinDiff(int arr[], int n, int k) {
// code here
sort(arr, arr+n);
int minDi... | ALGO | 0.999839 | 5.741448 |
82a9779b-8c87-4754-a2ba-c69fbb984c81 | panospantazo/Cpp | Exersices From Youtube (Psounis)/Lesson_5/Exersices/Exersice_1.cpp | #include <iostream>
#include <cstring>
#define N 3
using namespace std;
class tictactoe
{
public:
tictactoe();
~tictactoe();
bool play(int ,int );
char check_win();
void print();
void next_player();
char get_player() const;
private:
char **board;... | ALGO | 0.968893 | 4.201756 |
5f67a0c6-136a-4f0d-accf-d53449c0a576 | divayjindal95/Algorithms | Stack/postfix_evaluation.cpp | #include <iostream>
#include <stack>
#include <map>
using namespace std;
int evaluate(string s,int len){
stack<int> mystack;
int res;
for(int i=0;i<len;i++){
if((s[i]<='9'&&s[i]>='0'))//||(s[i]>='a'&&s[i]<='z'))
mystack.push(s[i]-48);
else{
int temp,temp1;
temp=mystack.top();
mys... | ALGO | 0.999948 | 4.168652 |
95f0e674-8f47-4fa3-9544-d4ee2faaede7 | shahadathossain3/URI-Online-Judge-Solution-Using-C-Plus-Plus | 1174 - Array Selection I.cpp | #include<iostream>
#include<iomanip>
using namespace std;
int main()
{
double A[100],j,k,l;
int i;
i=0;
while(i<100)
{
cin>>A[i];
if(A[i]<=10)
{
cout<<"A["<<i<<"] = "<<fixed<<setprecision(1)<<A[i]<<endl;
}
i++;
}
return 0;
}
| ALGO | 0.994587 | 3.180525 |
f877b1e4-a853-4158-b8e1-2b7cb3093e25 | liangzai90/Liang_interview_Cpp_2020 | 剑指offer/第2章 面试需要的基础知识/面试题03:[解法1]数组中重复的数字.cpp | /********************************
《剑指offer》做题笔记
面试题3:数组中重复的数字
题目一:找出数组中重复的数字
在一个长度为n的数组里的所有数字都在0~n-1的范围内。
数组中某写数字是重复的,但不知道有几个数字重复了,
也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。
例如,如果输入长度为7的数组{2,3,,1,0,2,5,3},
那么对应的输出是重复的数字2或者3
题目地址:
https://www.nowcoder.com/practice/623a5ac0ea5b4e5f95552655361ae0a8?tpId=13&tqId=11203&rp=3&ru=/ta... | ALGO | 0.999737 | 4.96747 |
9db3d96a-67d2-4cf8-90c0-8eed5f849e48 | siwenhongyi/leetcodeAlgorithms | cpp/math/69.sqrt-x.cpp | /*
* @lc app=leetcode.cn id=69 lang=cpp
*
* [69] Sqrt(x)
*/
#include "head.h"
using namespace std;
// @lc code=start
class Solution {
public:
int mySqrt(int x) {
double res = 1;
while (abs(res * res - x) > 0.1) {
res = (res + x / res) / 2.0;
}
return int(res);
}
};
// @lc code=end
| ALGO | 0.999909 | 5.768766 |
e7b5073d-3c54-4993-8a26-7934f100c0e9 | Glasspham/Summary_exercises | Bai_87/main.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
string compressed;
cin >> compressed;
string res;
for(int i = 0; i < compressed.size(); ++i){
if(isdigit(compressed[i])) {
int count = 0;
while (i < compressed.size() && isdigit(compressed[i])) {
c... | ALGO | 0.999797 | 4.783059 |
c154af3c-fb8a-41e7-b863-cbb66858803f | Dan13llljws/CP-Solutions | CCC/ccc07s5.cpp | #include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define LL_INF 0x3f3f3f3f3f3f3f3f
#define ms(x, y) memset(x, y, sizeof(x))
#define flood(x) ms(x, 0x3f)
#define sp ' '
#define nl '\n'
void sc(){}template<class T,class...A>void sc(T&t,A&...a){cin>>t,sc(a...);}
void pr(){}template<class T,class...A>vo... | ALGO | 0.999966 | 3.453049 |
19c4c1ad-00cf-4dc4-9611-6a7dc0fd0b84 | yyppsk/LeetCode | December 2023/2108FindFirstPalindromicStringintheArray.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
class Solution
{
public:
string firstPalindrome(vector<string> &words)
{
string ans = "";
for (auto &word : words)
{
int low = 0, high = word.size() - 1;
bool pallind... | ALGO | 0.999627 | 5.644911 |
23f13ab0-e7a7-4841-8f51-b7f031bb67b8 | xfwang/BStools | resources/brat/Check_strands.cpp | /*
Same seeds as in Brat-1.1.4, but less space since it treats chroms as one continuous genome
*/
#include<iomanip>
#include<map>
#include<bitset>
#include<ctime>
#include<list>
#include<cmath>
#include<vector>
#include<string.h>
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<ass... | DATA | 0.898019 | 4.438598 |
9bc14e53-1f69-4f0c-991e-4e5610d063fc | IDA-TUBS/lwW2RP | thirdparty/boost_1_73_0/libs/sort/example/randomgen.cpp | // See http://www.boost.org/libs/sort for library home page.
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int_distribution.hpp>
#include <stdio.h>
#include "stdlib.h"
#include <fstream>
#include <iostream>
using namespace boost;
int main(int argc, const char ** argv) {
random::mt1993... | TOOL | 0.992326 | 4.155019 |
1d992783-c27c-4cae-95f5-f3a2ddf9d291 | Ganbilly/algostudy-BS | C++basic/[9]기본 수학2/[1929]소수 구하기/hs1929(3).cpp | #include <iostream> //dp알고리즘
#include <vector>
// v.pushback(값이나 변수) = v의 맨 뒤에 상수나 변수의 값을 추가
// v.end() = v의 크기
// v[i] = v벡터의 i번째 값
using namespace std;
int main(){
int n;
vector<int> v; // 소수가 들어있는 배열(벡터)
bool prime = true;
cin >> n;
v.push_back(2);
for (... | ALGO | 0.999608 | 4.601483 |
38f153fa-e893-4314-9fb1-95008cfca845 | JunctureX/ProgramCompetition | OtherColleage/UESTC/2022校赛初赛/N.cpp | #include<bits/stdc++.h>
using ll=long long;
using pii=std::pair<int,int>;
using std::cin;
using std::cerr;
using std::cout;
const int mod=998244353,i2=(mod+1)/2;
inline int add(int a,int b){return a+b>=mod?a+b-mod:a+b;}
inline int dec(int a,int b){return a-b<0?a-b+mod:a-b;}
inline int mul(int a,int b){ll r=(ll)a*b;re... | ALGO | 0.999986 | 4.338007 |
999dda76-a969-4489-9f75-41530250887d | jset-issta2024/jset | z3-4.4.1/src/tactic/smtlogics/quant_tactics.cpp | #include"tactical.h"
#include"simplify_tactic.h"
#include"propagate_values_tactic.h"
#include"solve_eqs_tactic.h"
#include"elim_uncnstr_tactic.h"
#include"qe_tactic.h"
#include"qe_sat_tactic.h"
#include"ctx_simplify_tactic.h"
#include"smt_tactic.h"
static tactic * mk_quant_preprocessor(ast_manager & m, bool disable_ga... | ALGO | 0.998619 | 5.986834 |
ad621471-cb9b-4c26-9c72-ff678fe8994e | a-alperen/C-Codes | C Kodlari/pointer_denemesi_1.cpp | #include<stdio.h>
int topla(int* a,int* b);
int main(){
int sayi1,sayi2;
printf("Bir sayi giriniz:");
scanf("%d",&sayi1);
printf("Bir sayi daha giriniz:");
scanf("%d",&sayi2);
printf("%d + %d = %d",sayi1,sayi2,topla(&sayi1,&sayi2));
return 0;
}
int topla(int *a,int *b){
return *a+ *b;
}
| TOOL | 0.99829 | 3.633938 |
887b61de-bbd9-4cd1-8854-8e97ebdc78f1 | veraposeidon/CodeWar2LeetCode | 39.组合总和.cpp | /*
* @lc app=leetcode.cn id=39 lang=cpp
*
* [39] 组合总和
*/
// @lc code=start
class Solution {
vector<vector<int>> ans;
public:
void dfs(vector<int>& candidates, int startPos, int target, vector<int> &cur) {
if (target == 0) {
ans.push_back(cur);
return;
}
for (... | ALGO | 0.999987 | 6.728282 |
a258e5b0-aff1-4222-a1d9-7a33e952537b | Colonial-Dev/VEX-21417B | src/Other/RobotSetup.cpp | #include "robokauz/PRELUDE.hpp"
#include "robokauz/COMMON.hpp"
#include "robokauz/ROBOT.hpp"
#include "robokauz/PURE_PURSUIT.hpp"
#include "robokauz/Autonomous/IMUOdometry.hpp"
#include "robokauz/Other/TaskGate.hpp"
//Acquire the controller for global use
pros::Controller master (CONTROLLER_MASTER);
//Initialize driv... | TOOL | 0.884617 | 4.856884 |
8a745e89-1552-420f-ab4e-c4afadc3dbe8 | purple-jwl/atcoder | src/ABC/186/D.cpp | #include <bits/stdc++.h>
#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define un... | ALGO | 0.999871 | 3.787145 |
c9dce1f5-6da6-4016-8011-a5d11a168c31 | neozhangthe1/experimental-code-archive | sna/acrush/cpp/Source/lsp/glib/xmath.cpp | /////////////////////////////////////////////////
// Mathematical-Utilities
double TMath::E=2.71828182845904523536;
double TMath::Pi=3.14159265358979323846;
double TMath::LogOf2=log(double(2));
/////////////////////////////////////////////////
// Special-Functions
void TSpecFunc::GammaPSeries/*gser*/(
double& gamser,... | ALGO | 0.998041 | 3.522737 |
7c0d93e6-61cb-4327-ba2f-54cd09e5ed85 | call-me-bammer/montmartre-hill | codeforces/313A/main.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
if (n >= 10)
{
cout << n << endl;
return 0;
}
int max_account = -1000000001;
for (int i = to_string(n).size() - 2; i < to_string(n).size(); i++)
{
str... | ALGO | 0.985397 | 4.363498 |
fbb05024-95a4-4fc7-9ee8-9564e1f0ec65 | tholian-network/retrokit | Source/JavaScriptCore/dfg/DFGLICMPhase.cpp | #include "config.h"
#include "DFGLICMPhase.h"
#if ENABLE(DFG_JIT)
#include "DFGAbstractInterpreterInlines.h"
#include "DFGAtTailAbstractState.h"
#include "DFGClobberSet.h"
#include "DFGClobberize.h"
#include "DFGControlEquivalenceAnalysis.h"
#include "DFGEdgeDominates.h"
#include "DFGGraph.h"
#include "DFGMayExit.h"
... | ALGO | 0.979611 | 5.725196 |
5ca7f8ac-7e3a-44dd-ac6e-5c1c44fa4ecf | Warawreh/CP-Library | Contests/IEEE/r2.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define fast ios::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<string> g;
string dir = ">... | ALGO | 0.999877 | 4.789721 |
693b5502-c13e-4c36-b7c1-1e49a146d7fa | Eng-Gamal-megahed/Problem_Solving | Anton_and_Danik.cpp | #include <iostream>
using namespace std;
int main()
{
long long N;
cin >> N;
string game;
cin >> game;
long long A_D[2] = {0};
for (char c : game)
{
(c == 'A') ? A_D[0]++ : A_D[1]++;
}
if (A_D[0] == A_D[1])
{
cout << "Friendship\n";
}
else if (A_D[0] > A... | ALGO | 0.999942 | 4.065375 |
1caab54a-cff4-4a6f-b568-cde24f1f537d | krishna4040/DSA | gfg_practice/strings/minIndexed.cpp | # include "bits/stdc++.h"
# include <unordered_set>
using namespace std;
//Given a string str and another string patt. Find the minimum index of the character in str that is also present in patt.
int minIndex(string str , string patt)
{
unordered_set<char> s(patt.begin(),patt.end());
for (int i = 0; i < str.le... | ALGO | 0.999616 | 4.747812 |
ad2265d4-7a4e-4137-9b33-220d2f7d5114 | DziQ21/GeneticSudokuSolver | src/Genotype.cpp | #include <vector>
#include <random>
#include "SudokuLoader.h"
#include "Genotype.h"
#include <unordered_set>
#include <iostream>
#include <cassert>
#include <algorithm>
#include <random>
#include <iostream>
// Implementations of the copy constructors
SoloNumGenotype::SoloNumGenotype(const SoloNumGenotype& other)
... | ALGO | 0.992615 | 5.612905 |
73e7b02b-4ef8-476e-903e-dd15467c325b | saral7/AOC2023 | 10.1/10.1.cpp | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
const int N = 100100;
int t, n, m;
void read (string name, vector<string> &v) {
fstream file;
file.open(name, ios::in);
string line;
while (getline(file, line)) {
v.push_back(line);
}
file.close();
}
bool inside (int x, int y, const vect... | ALGO | 0.999829 | 3.628331 |
533f07bb-cbe3-499c-be70-3ea83380ccc3 | Veljko28/cpp-data-algrtms | codeforces/263/RemoveDuplicates.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <numeric>
#include <string>
#include <cstring>
#include <ctime>
#include <set>
#include <list>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <unordered_map>
#include <queue>
#include... | ALGO | 0.999991 | 3.718368 |
66c6c708-4371-4af8-8f8f-265a1df7cf6e | yeshvikaa1212/operating-systems | exp 30.cpp | #include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
void* func(void* arg)
{
pthread_detach(pthread_self());
printf("Inside the thread\n");
pthread_exit(NULL);
}
void fun()
{
pthread_t ptid;
pthread_create(&ptid, NULL, &func, NULL);
printf("This line may be printed"
" before thread terminates\n");
if(pthread_equ... | TOOL | 0.859553 | 3.846314 |
3b07c06d-3528-468c-aae3-002c540f69d4 | Somahc/c_practice | abc337/c.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); i++)
using namespace std;
using ll = long long;
int main(){
map<int, int> mp;
int n;
cin >> n;
rep(i,n){
int tmp;
cin >> tmp;
if(tmp == -1) mp[0] = i+1;
else mp[tmp] = i+1;
}
// string ans;
queu... | ALGO | 0.999963 | 3.873881 |
ff60eff2-6614-4287-8f0e-d0c89ce6252d | hmofrad/CodingPractice | skinnyleetcode/largestUniqueNumber.cpp | /*
* https://leetcode.com/problems/largest-unique-number/submissions/
* (c) Mohammad Hasanzadeh Mofrad, 2020
* (e) <EMAIL>
*/
class Solution {
public:
int largestUniqueNumber(vector<int>& A) {
A.push_back(INT_MAX);
A.push_back(INT_MIN);
std::sort(A.begin(), A.end());
int m =... | ALGO | 0.999641 | 5.407285 |
9183df85-253c-4713-9bdc-eeca865eb3c8 | yxyang/cajun | third_party/eigen3/include/unsupported/doc/examples/PolynomialUtils1.cpp | #include <unsupported/Eigen/Polynomials>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
Vector4d roots = Vector4d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,5,1> polynomial;
roots_to_monicPolynomial( roots, polynomial );
cout << "Polynomial:... | ALGO | 0.998984 | 4.015535 |
bd833e7f-9341-41e1-8cea-908979775bb7 | huenguyentran/OOP_uit | TH3/IntSet_project/main.cpp | #include "IntSet.h"
using namespace std;
int main() {
int* list = new int[3];
list[0] = 2;
list[1] = 2;
list[2] = 1;
IntSet s1, s2(list, 3), s3;
cin >> s1;
s3 = s1 - s2;//Unions
cout << s3 << "\n";
s3 = s1 + s2;
s3 = s1 - s2; //S1\S2 diff
cout << s3 << "\n";
cout << s3[0... | ALGO | 0.998791 | 3.698191 |
0010b832-835b-45de-85c6-d8c26a2b6990 | CLDP/ACM-ICPC | Regional-2016/North-America-Qualifier/C.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
using namespace std;
const int MAXN = 110;
const int INF = 10000000;
int V[MAXN];
int f[MAXN][MAXN], g[MAXN][MAXN];
int h[MAXN], in[MAXN];
int main() {
int N, M;
... | ALGO | 0.999933 | 3.821383 |
f2edee26-b849-4974-a9a4-601602214605 | embecosm/agc-llvm-project | llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp | #include "llvm/CodeGen/GlobalISel/RegBankSelect.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
#include "llvm/CodeGen/GlobalISel/Utils.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/Ma... | ALGO | 0.940414 | 5.913189 |
d5d2139b-1422-44d7-8837-a26152577a3b | curtischung/UNR-CS | CS-477/hw6_1.cpp | #include <iostream>
using namespace std;
int getMin(int a, int b);
int getMax(int a, int b);
int main()
{
const int n = 4;
int x[n] = {1, 10, 10, 1};
int f[n] = {1, 2, 4, 8};
int A[n];
for(int i = 0; i < n; i++)
{
A[i] = getMin(x[i], f[i]);
for(int j = 0; j < i; j++)
{
A[i] = getMax(getMin(x[i], f[i... | ALGO | 0.999693 | 3.814959 |
2ae029f9-b776-4611-8e27-4726b0088519 | Shawdox/Instrumented-WasmEdge | examples/embed_cxx/script/fibonacci.cpp | #include "fibonacci.h"
auto fib(int32_t n) -> int32_t {
if (n < 2) {
return 1;
}
return fib(n - 2) + fib(n - 1);
}
| ALGO | 0.998936 | 6.502968 |
2ca75b5a-7bc6-475d-b8f3-3ea27b60d93d | rahul-singh-takuli56/LeetCode-Solution | 1137-n-th-tribonacci-number/1137-n-th-tribonacci-number.cpp | class Solution {
public:
int tribonacci(int n) {
vector<unsigned int>arr{0,1,1};
if(n<arr.size())
return arr[n];
for(int i=2;i<=n;i++){
arr.push_back(arr[i]+arr[i-1]+arr[i-2]);
}
return arr[n];
}
}; | ALGO | 0.999982 | 6.070522 |
a67086c1-45aa-47a1-b462-03d3cba62fff | Genist-Systems/flight-control-firmware | src/lib/atmosphere/atmosphere.cpp | /**
* @file atmosphere.cpp
*
*/
#include <geo/geo.h>
#include "atmosphere.h"
namespace atmosphere
{
float getDensityFromPressureAndTemp(const float pressure_pa, const float temperature_celsius)
{
return (pressure_pa / (kAirGasConstant * (temperature_celsius - kAbsoluteNullCelsius)));
}
float getPressureFromAltitu... | TOOL | 0.8872 | 4.141071 |
55c3077b-ae79-4b4b-81f6-8c3abdfb9888 | vanlaukaus/PSTU_Labs_24 | Sem_2/LabClass1/LabClass1.cpp | #include "fraction.h"
#include <iostream>
int main() {
aripr ap1;
std::cout << "Enter progression parameters:\n";
ap1.read();
ap1.show();
int j;
std::cout << "Enter element index to calculate: ";
std::cin >> j;
std::cout << "a" << j << " = " << ap1.element(j) << std::endl;
... | TOOL | 0.914735 | 4.522183 |
d41d4064-2f50-4955-b267-9f54062aa1a3 | Chnmii/Nam1_Ky2 | Xaydungham/BTHAM.cpp | #include <stdio.h>
#include <math.h>
#include <conio.h>
void nhapmt(int a[100][100], int *n)
{
printf("Nhap cap cua ma tran: ");
scanf("%d", n);
for (int i=1; i<=*n; i++)
{
for (int j=1; j<=*n; j++)
{
printf("Nhap phan tu a[%d][%d]: ", i,j);
scanf("%d", &a[i][j]);
}
}
}
void inmt(int a[100][100], int... | ALGO | 0.991385 | 3.166654 |
8260f288-87e2-4619-a014-4b3e23fcc101 | kevinmj12/Algorithm_BOJ | 백준(풀이용)/Gold4/21475_Треугольнаярамка.cpp | #include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
long double Heron(long double a, long double b, long double c){
long double s = (a+b+c)/2;
return pow((s*(s-a)*(s-b)*(s-c)), 0.5);
}
long double insideCircle(long double a, long double b, long double c, long double size){
long d... | ALGO | 0.99907 | 3.369622 |
a3b3fc47-7e6d-42f5-9944-e04cff471528 | lesliefish/Algorithm | Coder/华为机试_在字符串中找出连续最长的数字串/main.cpp | #include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
int main()
{
string inputString;
while (cin >> inputString)
{
string numStr;
map<int, vector<string>> myMap{};
for (int i = 0; i < inputString.size(); ++i)
{
char ch = inputString[i];
if (isdigit(ch))
{
... | ALGO | 0.995983 | 3.972455 |
e5c0648c-289e-4059-aeae-b788ad3d597e | gama13146/Arboles | Estructuras/Estructura nodo.cpp | #include <iostream>
#include <conio.h>
#include<string.h>
using namespace std;
struct Nodo{
int valor;
struct Nodo *puntero;
};
int main(){
struct Nodo dato1,dato2,dato3,dato4,dato5;
struct Nodo *inicio;
struct Nodo *aux;
inicio=NULL;
aux=new Nodo();
aux->valor=100;
aux->puntero=NULL;
// cout<<"Valor del Aux... | ALGO | 0.98966 | 3.33299 |
4ed11243-ad16-4449-a11a-296aa2366db0 | BestChain/Source | src/miner.cpp | #include "txdb.h"
#include "miner.h"
#include "kernel.h"
using namespace std;
//////////////////////////////////////////////////////////////////////////////
//
// BitcoinMiner
//
extern unsigned int nMinerSleep;
int static FormatHashBlocks(void* pbuffer, unsigned int len)
{
unsigned char* pdata = (unsigned char... | ALGO | 0.998375 | 4.265584 |
86e64837-2c0e-4ede-9656-d8f10751c9d2 | RuiRuihigh/Sort_Method | tut1.cpp | #include <iostream>
//#include<array>
//#include "bs.h"
#include"binaryS.h"
//#include"Inseration.h"
#include "merge_sort.h"
//g++ tut1.cpp merge_sort.cpp binaryS.cpp -o tut1
//g++ tut1.cpp Inseration.cpp binaryS.cpp -o tut1
using namespace std;
int main(){
int list[] = {4,6,3,7,8,1,5,9,10};
//BubbleSoft(lis... | ALGO | 0.999868 | 3.266721 |
cf333f2a-d75a-4c4b-8999-be085ea0ce30 | dgonzalezarbelo/AceptaElReto | 607.cpp | #include <iostream>
#include <fstream>
#include <vector>
#pragma warning(disable:4996)
using namespace std;
vector <int> potencias;
int resolver(int num) {
int i = 0;
while (potencias[i] < num) i++;
return i;
}
void resuelveCaso() {
int num;
scanf("%d", &num);
printf("%d\n", resolver(num));
}
int main() {
int... | ALGO | 0.99869 | 4.624101 |
5282963e-1866-4d3c-9800-13b142686c7a | ainokila/relaccionEjerciciosEstructuraDatos | relaccion_STL/ejercicio8.cpp | #include<iostream>
#include<list>
using namespace std;
template<typename T>
list<T> crearLista(list<T> &l, const list<T> &li){
// l = 2 4 5
// li = 2 1 0
//sol = 5 4 2
list<T> solucion;
for( int i = 0 ; i < l.size() ; i++ ) {
typename list<T>::const_iterator posicion;
typename list<T>::const_iterator... | ALGO | 0.99989 | 4.020564 |
f17a4f07-9e29-45fb-a8d6-172a823e4a49 | ishandutta2007/codeforces | spycheese/normal/772/B.cpp | #include <bits/stdc++.h>
#ifndef LOCAL
#define cerr dolor_sit_amet
#endif
#define mp make_pair
#define sz(x) ((int)((x).size()))
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int , int > ipair;
typedef pair < ll , ll... | ALGO | 0.999811 | 4.262452 |
370b8093-ab1f-49ad-ae76-0798665f3342 | mansi104-ai/Leetcode_interview_ques | codeforces/546A.cpp | #include <iostream>
using namespace std;
int main(){
int k , n ,w;
std::cin >> k >> n >> w;
int totalCost = k *((w*(w+1))/2);
if(totalCost - n >0){
std::cout << totalCost-n;
}else{
cout << 0;
}
return 0;
} | ALGO | 0.999863 | 3.668079 |
8ff20cf3-d679-4943-bb44-6a2a12b893e8 | Durden-T/C-beginning-of-the-world | HeaderFiles/Graph.cpp | #include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <forward_list>
#include <climits>
#include <list>
#include <set>
using namespace std;
#define ElemType int
#define NONE -1
using Graph = vector<Vertex *>;
struct Edge
{
int start;
int end;
int weight;
Edge(int _start, ... | ALGO | 0.999988 | 4.523619 |
982ee0c0-eba3-41ca-acf4-6ef7e5e39186 | salmonfishycooked/CP | luogu/problem/P3382/P3382.cpp | #include <iostream>
#include <vector>
#include <iomanip>
double pow(double a, int x) {
double res = 1;
for (; x; x >>= 1) {
if (x & 1) {
res *= a;
}
a *= a;
}
return res;
}
void solve() {
int N;
std::cin >> N;
double l, r;
std::cin >> l >> r;
s... | ALGO | 0.999956 | 4.627514 |
7ca74b3c-3abb-475a-921f-d71d808de812 | subhajit2024/Infinity_grind-GFG | xor_sum.cpp | class Solution {
public:
int subsetXORSum(vector<int>& nums) {
int n = nums.size();
int total_xor = 0;
for (int i = 0; i < (1 << n); ++i) {
int xor_val = 0;
for (int j = 0; j < n; ++j) {
if (i & (1 << j)) {
xor_val ^= nums... | ALGO | 0.999986 | 6.045856 |
8460e649-7044-4164-9da3-1771a0688d22 | Coder-Vippro/Code | Archived/Colinh/LIQ/LIQ.cpp | #include <bits/stdc++.h>
using namespace std;
int a[100001];
int f[100001];
int maxx=0;
int vt;
int main()
{
freopen("LIS.INP","r",stdin);
freopen("LIQ.OUT","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long n;
cin>>n;
for(int i=1;i<=n;i++)cin>>a[i];
f[... | ALGO | 0.999982 | 4.116621 |
60fd8ef2-3094-4535-996c-3241e2a43e68 | matteogilioli/llvm-17.0.6 | src/libcxx/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter>
// requires ShuffleIterator<Iter>
// && LessThanComparable<Iter::value_type>
// void
// stable_sort(Iter first, Iter last);
#include <algorithm>
#include <cassert>
#include <iterator>
#include <random>
#include "count_new.h"
#include "test_macros.h"... | TEST | 0.998007 | 7.65667 |
61ccfa67-ca99-4bef-a5a9-76814f09902c | SaiyemRaiyan/Vjudge--Uradhura-cp | C++/Sum of Factorials.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long int fact[25];
long long int i,j,k,l,m,n,t;
fact[0]=1;
for(i=1;i<=20;i++)
{
fact[i]=fact[i-1]*i;
//cout<<fact[i]<<endl;
}
scanf("%lld",&t);
for(i=1;i<=t;i++)
{
stack<int>s;
... | ALGO | 0.99922 | 3.744963 |
307b63d6-b15e-4e92-b298-f01ac6191360 | xndtmfdl/codetree-TILs | 241007/입력받아 계산 5/input-calculate-5.cpp | #include <iostream>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
int a,b;
cin >> a >> b;
cout << a+b;
return 0;
} | ALGO | 0.984877 | 3.90414 |
51269dae-b27c-4461-a4b4-d994d4780fcc | cliu268/cs202 | hw5a/q1.cpp | // A. KFC date
// https://www.xinyoudui.com/contest?courses=459&books=252&pages=6608&fragments=12065&problemId=3586
/*
Time Limit:0.2s Memory Limit:32M
Description:
As the summer holiday draws near, you and your friend plan to eat at KFC. But on the map there are many KFC's so you should come up with a
way to choose ... | ALGO | 0.999923 | 5.435423 |
7cd2a4a3-8896-4979-84de-53051c754654 | Arnav-code-1/DSA_2 | 0287-find-the-duplicate-number/0287-find-the-duplicate-number.cpp | class Solution {
public:
int findDuplicate(vector<int>& nums) {
int slow=nums[0];
int fast=nums[0];
while(true)
{
slow=nums[slow];
fast=nums[nums[fast]];
if(slow==fast)
break;
}
fast=nums[0];
while(slow!=fast)
... | ALGO | 0.999986 | 6.154156 |
cdecd8b4-cd0a-4207-9ec9-297a89e84e66 | aogara-ds/csci104 | hw3/heur.cpp | #include <cmath>
#include "heur.h"
#include <vector>
#include <set>
using namespace std;
// Complete
size_t BFSHeuristic::compute(const Board& b)
{
return 0U;
}
// To be completed
size_t DirectHeuristic::compute(const Board& b)
{
// Avoid compiler warnings -- replace this
return 0;
}
// To be completed
s... | ALGO | 0.99968 | 4.561471 |
b1992451-3b8f-4ad8-bfbe-887d9fa0f60d | uppala75/CarND-MPC-Project | src/Eigen-3.3/unsupported/doc/examples/BVH_Example.cpp | #include <Eigen/StdVector>
#include <unsupported/Eigen/BVH>
#include <iostream>
using namespace Eigen;
typedef AlignedBox<double, 2> Box2d;
namespace Eigen {
Box2d bounding_box(const Vector2d &v) { return Box2d(v, v); } //compute the bounding box of a single point
}
struct PointPointMinimizer //how to compute squa... | ALGO | 0.999787 | 6.502348 |
e5110dc3-9e32-470e-931e-f4c9eea7aee2 | ordinary-developer/lin_education | books/techno/cpp/___pre-intermediate/exploring_cpp_11_2_ed_r_lischner/code/exploration_07-FOR_LOOPS/03-compute_sum_of_integers/main.cpp | #include <iostream>
int main() {
int sum{ 0 };
for (int i{ 10 }; i < 21; ++i)
sum += i;
std::cout << "sum of 10 to 20 = " << sum << '\n';
return 0;
}
| TOOL | 0.968213 | 3.954627 |
544da091-f1ec-41fc-b90f-db5739ed47bd | krishna146/DSASheetAndSolution | 5.Array/Class/15KadanesAlgo.cpp | //Problem Link -
/* By Krishna Kumar */
#include<iostream>
using namespace std;
int max(int a, int b){
return (a > b) ? a : b;
}
int longestContinuousSubarraySum(int arr[], int size){
//kadane's Algo
int maxSoFar = INT_MIN;
int start = 0 , right = 0, left = 0;
int maxEnding = 0;
int sum = 0;
... | ALGO | 0.999894 | 4.326478 |
dedf391a-bd50-49ab-8624-c75a92b09396 | soc05272/University-Class | 도박사의 확률.cpp | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int initial_money = 50;
int goal = 250;
int i;
int wins = 0;
for(i=0; i<100; i++)
{
int cash = initial_money;
while(cash > 0 && cash < goal)
{
if(((double)rand() / RAND_MAX) < 0.5)
{
cash++;
}
else
{
cash--;
}
}
if(cash... | ALGO | 0.999717 | 3.104097 |
773e415d-daf7-4517-ba33-3fbc7c648eae | ishandutta2007/codeforces | bench0310/normal/1327/G.cpp | #include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
typedef long long ll;
const int K=14;
struct Vertex
{
char c;
int p;
array<int,K> trie;
array<int,K> go;
int link;
ll val;
ll sum;
Vertex(char nc='$',int np=-1):c(nc),p(np)
{
trie.fill(-1);
... | ALGO | 0.999965 | 4.057754 |
6b9a4058-a465-4c81-bb54-c69631882a29 | ishandutta2007/codeforces | martin53/normal/1023/B.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,k;
cin>>n>>k;
if(n>=k)
{
cout<<(k-1)/2<<endl;
return 0;
}
if(n+(n+1)<k)
{
cout<<0<<endl;
return 0;
}
long long ans=n-(k-n)+1;
if(ans%2)ans--;
ans=ans/2;
cout<<ans<<endl;
return 0;
} | ALGO | 0.999951 | 3.540614 |
8471e87e-04cd-4627-a488-de2628dda805 | Ariel1986/LeetCode | 036.ValidSudoku.cpp | /*
Question:
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
A partially filled sudoku which is valid.
Note:
A valid Sudoku board (partially filled) is not necessarily solvable. Only the filled cel... | ALGO | 0.999426 | 6.75183 |
786a8400-60d1-4b75-a32c-db4110ac2fdc | ElTantawy/mimd_to_simt | SSDE/LLVM/llvm/tools/clang/tools/libclang/CIndexer.cpp | #include "CIndexer.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclVisitor.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Version.h"
#include "clang/Sema/CodeCompleteConsumer.h"
#include "llvm/ADT/StringExtras.h"
#include "l... | TOOL | 0.878184 | 7.101995 |
3fb27914-67a6-456b-8c80-09be6f37ee29 | Ngocmai04/Algorithm-c- | cbus.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 50; // Số lượng đỉnh tối đa
const int oo = 1e9; // Giá trị vô cùng lớn
int n, K, cmin = oo; // n: số lượng khách, K: dung lượng tối đa, cmin: chi phí tối thiểu
int C[2*N + 1][2*N + 1], x[2*N + 1], xOpt[2*N + 1]; // Ma trận chi phí, mảng giải pháp hiện tại và ... | ALGO | 0.999924 | 4.134911 |
60da48f8-c962-44ce-a638-fcc1331f3cf9 | fabianlim/programming_challenges | threeNPlusOne/problem.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <unordered_map>
#include <algorithm>
int cycle_length(int const& x, std::unordered_map<int, int>& cache)
{
int cnt = 0, curr = x;
while (curr != 1)
{
auto entry = cache.find(curr);
if (entry != cache.end())
{
... | ALGO | 0.999851 | 4.944606 |
99584207-5dc5-45ac-88a5-775e39a38afc | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-cot-gpt35/Codenet/p01336/170876195/original.cpp | #include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <s... | ALGO | 0.999951 | 3.831787 |
934f20b5-8872-45b6-93c6-b7ba07a4b541 | yashmittal-git/LeetCoding | perfect-number.cpp | // 507. Perfect Number
// We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself.
// Now, given an integer n, write a function that returns true when it is a perfect number and false when it is not.
// Example:
// Input: 28
// Output: True
// Explanation:... | ALGO | 0.999882 | 5.60534 |
e96d4f87-2385-44f6-807a-74ea9579bd26 | g1ac3/MyPassWorld | PWAUTH.cpp | #include <bits/stdc++.h>
#include <conio.h>
#include "PWAUTH.h"
const int N = 79;
std::string ofile = "pw.txt";
//パスワード入力させて入力した文字列を返す。
std::string PWAUTH_input(){
std::string s;
char c;
std::cout<<"PW : ";
while(1){
if(kbhit()){
if((c=getch())=='\r') break;
std::cout<<"*";
s+=c;
}
}... | TOOL | 0.97311 | 3.497953 |
676d704c-17bf-473c-9152-8541a50e271c | masoudbehzadinasab/Trilinos_12_11 | packages/teuchos/core/src/Teuchos_Utils.cpp | #include "Teuchos_Utils.hpp"
#include "Teuchos_GlobalMPISession.hpp"
namespace Teuchos {
double Utils::chopVal_ = 1.0e-16;
double Utils::chop(const double& x)
{
if (std::fabs(x) < chopVal_) return 0;
return x;
}
std::string Utils::trimWhiteSpace( const std::string& str )
{
typedef std::string::size_type size_ty... | TOOL | 0.930838 | 6.422687 |
aa2b9069-04fa-41ec-ab46-d666a3d99682 | pranjal021/LeetCode_Solutions | Easy/345-Reverse Vowels of a String.cpp | class Solution {
public:
bool isVowel(char c) {
c = tolower(c);
return (c == 'a') || (c == 'e') ||(c == 'i') ||(c == 'o') ||(c == 'u');
}
string reverseVowels(string s) {
int b = 0;
int e = s.length()-1;
while(b<e){
... | ALGO | 0.999864 | 6.61372 |
fc57b2d1-bdb6-49a7-8ec9-fb1808a2af1d | beberiche/Algorithms | Programmers/src/올바른 괄호/main.cpp | //
// Created by 김종현 on 2023/04/14.
//
#include<string>
#include <iostream>
#include <stack>
using namespace std;
bool solution(string s)
{
bool answer = true;
stack<char> stack;
stack.push(s[0]);
for(int i=1; i<s.size(); i++) {
if(stack.size() > 0 && s[i]==')' && stack.top() == '(') {
... | ALGO | 0.991291 | 5.644091 |
102ce6c0-4cd2-47bc-a980-af2ace7db59d | ShimejiAnna4191/Cpp_theory_example | vector and array/example3.cpp | #include <iostream>
#include <vector>
// int main(){
// std::vector numberical {1, 3 ,5 ,7 ,9};
// std::size_t numbers {numberical.size()};
// for (std::size_t length{0}; length < numbers; length++)
// {
// std::cout<<numerical[length]<<"\n";
// }
// return 0;
// }
int main(){
std:... | TOOL | 0.964695 | 3.910332 |
36d7f451-269c-46fd-8bf7-4949061f02af | sargun4/leetcode | 1653-number-of-good-leaf-nodes-pairs/number-of-good-leaf-nodes-pairs.cpp |
class Solution {
public:
vector<int>solve(TreeNode* root, int &dist,int &goodleafnodes){
if(root==NULL) return {0};
if(root->left==NULL && root->right==NULL)
return {1};
vector<int> ldist=solve(root->left,dist,goodleafnodes);
vector<int> rdist=solve(root->right,dist,good... | ALGO | 0.999987 | 5.941865 |
ce330e12-c755-4502-8e7f-b0231abd6263 | BlueSquid1/pwnisland_solution | gameLib/commonUtils.cpp | #include "commonUtils.h"
std::shared_ptr<std::vector<std::string>> commonUtils::ParseString(std::string input, std::string regex)
{
std::regex word_regex(regex);
std::sregex_iterator result_begin = std::sregex_iterator(input.begin(), input.end(), word_regex);
std::sregex_iterator result_end = std::sregex_iterat... | TOOL | 0.952977 | 4.593313 |
c10a1e86-064c-4c7d-9b5a-522b89da2ed5 | odroidodroid/bevfusion-variation | mmcv/ops/csrc/parrots/iou3d.cpp | // Modified from
// https://github.com/open-mmlab/OpenPCDet/blob/master/pcdet/ops/iou3d_nms/src/iou3d_nms.cpp
#include "pytorch_cpp_helper.hpp"
const int THREADS_PER_BLOCK_NMS = sizeof(unsigned long long) * 8;
#ifdef MMCV_WITH_CUDA
#include <cuda.h>
#include <cuda_runtime_api.h>
#define CHECK_ERROR(state) \
{ gpu... | ALGO | 0.993265 | 6.552179 |
1bf4280f-cead-42fe-bd96-3c8ec4dc1f51 | NguyennGiang/CP_tutorial | Codeforces/Summer Round/a.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while (t--){
int a, b;
cin >> a >> b;
int ans;
if ((a + b) % 2 == 1){
ans = -1;
}
else if (a == b){
ans = 1;
}
else ans = 2;
if (a == 0... | ALGO | 0.999711 | 4.566255 |
4ea4a05d-7394-411a-a169-fde3ebc9a98c | hexu1985/cpp_book_code | boost.intro/lambda/demo18_c++11.cpp | #include <iostream>
#include <string>
#include <algorithm>
template <typename String,typename Integral>
void is_it_long(const String& s,const Integral& i) {
[](const String &_1, const Integral &_2) {
if (_1.size() < static_cast<typename String::size_type>(_2)) std::cout << "Quite short...\n";
else std::cout ... | TOOL | 0.888786 | 4.256249 |
b6e81647-2d38-4c92-a049-f5535c3eda5f | esraa237/Cpp-Course | Section4_Datatypes&Variables/hard/task1/main.cpp | /*Problem #1: Swapping 3 numbers!
● Write a code to swap 3 numbers
● Let say we have numbers a = 115, b = 20, c = 301
● We wanna their final values to be: a = 20, b = 301, c = 115
● Challenge: Do the swap in 4 lines
*/
#include <iostream>
using namespace std;
int main()
{
int num1,num2,num3,temp=0;
cin>>num1>... | ALGO | 0.99865 | 3.641261 |
f22baafb-c84d-4f36-b018-efcc379ecc88 | manikanta2901/ubuntu | .history/codingChallenges/cpp/codeforcesCp/contest/B_20210125215912.cpp | #include <bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define trav(dataType,DataStruct,name) for(dataType<DataStruct>::itt ip = name.bb(); ip != name.ee(); ip++)
//Pre processors & typedefs
... | ALGO | 0.999771 | 3.564553 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.