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 |
|---|---|---|---|---|---|---|
807b6aa7-19a4-4a7f-b717-59f05389e0fe | manthan0x23/codeforces-problems | tws/number-theory-maths/2091-E.cpp | #include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
void fastIO() {
ios::sync_with_stdio(0);
cin.tie(0);
}
int LARGE = 1e7 + 1;
vector<bool> isPrime(LARGE + 1);
vector<bool> sieve(int maxN = LARGE) {
vector<bool> isPrime(maxN + 1, 1);
isP... | ALGO | 0.999483 | 4.849375 |
c86f4263-2891-43a5-9027-d9b259eafc45 | arong/BlogSampleCode | undefined-behavior/e7.cpp | #include <iostream>
#include <vector>
int main() {
std::vector<int> vec = {1, 2, 3, 5, 6};
for (auto &item : vec) {
if (item == 3) {
vec.insert(vec.begin(), 4);
}
std::cout << item << std::endl;
}
return 0;
} | ALGO | 0.996381 | 4.757414 |
b6b16475-6ed6-4e1a-848a-1efd5d564c74 | krogueintel/asem | src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp | /****************************************************************************
* Copyright (C) 2014-2018 Intel Corporation. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the... | ALGO | 0.969272 | 7.159713 |
137eafc6-b588-45d1-954b-d031e552b186 | vansh-codes/Competitive-Coding-Approaches | Unit2-PrimalityTest/3_closestSumToPrime.cpp | // ? Given n, find nearest prime number to n whose sum = n
// example: n=74, pair would be 71 which is nearest and 3 => (71,3)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cout << "Enter n: ";
cin >> n;
// OPTIMIZED using Sieve of Eratosthenes
vector<int> prime(n+1, 1);
f... | ALGO | 0.999693 | 5.577543 |
d0cd7e4e-9b1d-4112-9864-1f14e988b388 | chapel-lang/chapel-attic | third-party/llvm/llvm-src/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | #include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen... | ALGO | 0.927048 | 7.298496 |
4222ecf1-1bd9-4005-b5f7-59d743e94498 | ahmed-rashed/PortMatlab_remote | Mex/MDOF_FRF/MDOF_Eig_Visc_cpp_Armadillo/mexFunction.cpp | #include <complex>
#include "ArmadilloMatrixOperations.hpp"
#include "ArmadilloMexOperations.hpp"
#include "mex.hpp"
#include "mexAdapter.hpp" //Include mexAdapter.hpp only once with the MexFunction class definition in MEX applications that span multiple files.
//[www.mathworks.com/help/matlab/matlab_external/... | ALGO | 0.998918 | 5.691165 |
6bf143e8-bc29-4a70-bf51-81c5ccfb5356 | VaibhavGaikwad03/Concurrency-in-Cplusplus | Thread_Pool.cpp | #include <iostream>
#include <thread>
#include <functional>
#include <queue>
#include <mutex>
#include <future>
#include <condition_variable>
class ThreadPool
{
bool stop;
std::mutex mtx;
unsigned int num_thread;
std::condition_variable cv;
std::vector<std::thread> threads;
std::queue<std::func... | TOOL | 0.992947 | 6.100629 |
bd881dff-f90e-41cd-bf85-f0ca11227dfb | Rachana-shaik19/cpp | functions/recursive_fibnoacci.cpp | #include<iostream>
using namespace std;
long fibnoacci(long number)
{
if(number <= 1)
{
return number ;
}
return fibnoacci(number - 1) + fibnoacci(number - 2);
}
int main()
{
cout<<"The fibnoacci of 5 is "<<fibnoacci(6)<<endl;
return 0;
} | ALGO | 0.997127 | 3.556944 |
3e6ba56c-3a82-4102-ad2b-3a0b32c47572 | insaneprem/LeetCode-Solutions | 2685-count-the-number-of-complete-components/2685-count-the-number-of-complete-components.cpp | class DSU{
vector<int> parent,size,rank;
public:
DSU(int n){
for(int i=0;i<=n;i++){
parent.push_back(i);
size.push_back(1);
rank.push_back(0);
}
}
int findpar(int node){
if(parent[node] == node){
return node;
}
... | ALGO | 0.999973 | 5.713165 |
3256fa75-b91e-4d4a-8e36-ced4f9d70ae0 | Saifu0/Competitive-Programming | CP/1500/llya_diplomas.cpp | // ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----
#include <bits/stdc++.h>
using namespace std;
#define NINJA \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int ... | ALGO | 0.999914 | 3.951535 |
4b4e7c06-e7ee-464c-b430-cbc564f48f8f | EmptyDust/Algorithm-Codes-and-writeups | codes/-0x30_competition/-0x36_nowcoder/newbie93/C.cpp | #include <bits/stdc++.h>
using i64 = long long;
constexpr int MAXN = 1e6 + 10, inf = 1e9, mod = 998244353;
int nums[MAXN], n;
using pt = std::pair<int, int>;
i64 qpow(i64 x, i64 p) {
i64 ret = 1;
while (p) {
if (p & 1)ret = ret * x % mod;
p >>= 1;
x = x * x % mod;
}
return ret;
... | ALGO | 0.999935 | 5.465223 |
3830944d-efe1-407b-82b8-7bf708900c71 | PhamLeBaDuong/Competitive_Programming_Submissions | Game with Colored Marbles/sol.cpp | #include <math.h>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <unordered_set>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
unordered_map<int, in... | ALGO | 0.99968 | 3.9409 |
1943f926-c254-4048-8c93-60d7b025a0fa | ashokabairwaideology/Leet-code-problem | solution/0500-0599/0547.Number of Provinces/Solution2.cpp | class Solution {
public:
int findCircleNum(vector<vector<int>>& isConnected) {
int n = isConnected.size();
int p[n];
iota(p, p + n, 0);
function<int(int)> find = [&](int x) -> int {
if (p[x] != x) {
p[x] = find(p[x]);
}
return p[x];... | ALGO | 0.999781 | 6.179013 |
fee15275-0ac0-4481-be16-ebb9ffa395cf | ishandutta2007/codeforces | dfcmd/normal/1304/E.cpp | #include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>
namespace fastIO{
#define getchar() my_getchar()
#define putchar(x) my_putchar(x)
static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;
char buf[IN_BUF], *ps = buf, *pt = buf;
inline char my_getchar() {
return ps == pt &&... | ALGO | 0.999979 | 4.345257 |
534ccff0-1c6e-4c10-8718-568a1830c739 | AlaaAlassi/Cpp-Lab | lock_guard_example_2.cpp | #include <iostream>
#include <thread>
#include <vector>
#include <future>
#include <mutex>
#include <algorithm>
std::mutex mtx;
double result;
void printResult(int denom)
{
std::cout << "for denom = " << denom << ", the result is " << result << std::endl;
}
void divideByNumber(double num, double denom)
{
try... | TOOL | 0.971502 | 6.937287 |
62d76a7e-ae52-4e95-a063-f5e472001742 | parsiyte/GPPRMon | gpu4s_bench/cudaApplications/cifar_10/hip/lib_hip.cpp | #include "hip/hip_runtime.h"
#include "../benchmark_library.h"
/**
* CUDA Kernel Device code
*
* Computes the vector addition of A and B into C. The 3 vectors have the same
* number of elements numElements.
*/
//#define BLOCK_SIZE 32
__global__ void
covolution_kernel(const bench_t *A, bench_t *B, const bench_t *k... | ALGO | 0.989354 | 3.397087 |
c5a1f91a-54eb-4935-a065-b40e54901d79 | vster/OOP_CPP | Ch11/Ch11-Exercises/AlgoTest/linklist/linklist.cpp | // linklist.cpp
//
#include <iostream>
using namespace std;
///////////////////////////////////////////////////////////
struct link //
{
int index;
int data; //
link* next; //
};
///////////////////////////////////////////////////////////
class linklist //
{
private:
link* first;
public:
l... | ALGO | 0.999219 | 3.424016 |
209e1df4-4a5c-4544-99f0-403ec9c5aea3 | bienhuynh/Big-Numbers | Lib/Src/Math/Expression/ExpressionDerive.cpp | #include "pch.h"
#include <Math/Expression/Expression.h>
Expression Expression::getDerived(const String &name, bool reduceResult /*=false*/) const {
if(getReturnType() != EXPR_RETURN_REAL) {
throwException(_T("Cannot get derived of an expression returning boolean"));
}
if(getTreeForm() != TREEFORM_STANDARD) ... | ALGO | 0.974256 | 6.123259 |
29fdbb24-f8af-48d5-a3fb-ae3a764b3baa | Adrien987k/SFV | openpose/src/openpose/net/bodyPartConnectorBaseCL.cpp | #include <openpose/net/bodyPartConnectorBase.hpp>
#include <iostream>
#include <openpose/gpu/cuda.hpp>
#include <openpose/pose/poseParameters.hpp>
#include <openpose/utilities/fastMath.hpp>
#ifdef USE_OPENCL
#include <openpose_private/gpu/opencl.hcl>
#include <openpose_private/gpu/cl2.hpp>
#endif
namespace op
... | ALGO | 0.93044 | 6.721515 |
553d8660-b7d0-46af-b55f-9fb4e199177d | Algorithm-Artisan-Sandip/GFG_My_Solved_Questions | Difficulty: Basic/First n Fibonacci/first-n-fibonacci.cpp | //{ Driver Code Starts
//Initial function template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution
{
public:
//Function to return list containing first n fibonacci numbers.
vector<long long> printFibb(int n)
{
//code... | ALGO | 0.999419 | 6.219115 |
852346e5-28d0-4ca5-b822-824375ce5354 | Samuel-K95/Competitive-programming | harshad.cpp | #include <iostream>
using namespace std;
int main()
{
int x, sum, y;
cin>>x;
for (int i=x; ; i++)
{
y=i;
sum=0;
while (y>0)
{
sum+=y%10;
y=y/10;
}
if (i%sum==0)
{
x=i;
break;
}
}
cout<<x;
} | ALGO | 0.999836 | 4.498712 |
b5cd1a86-21e8-479e-9438-82aa707da892 | macuser47/marlin-ender3pro | buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.cpp | #include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
// Digital PinName array
const PinName digitalPin[] = {
PA_0, // Digital pin 0
PA_1, // Digital pin 1
PA_2, // Digital pin 2
PA_3, // Digital pin 3
PA_4, // Digital pin 4
PA_5, // Digital pin 5
PA_6, // Digital pin 6
PA_7, // Dig... | CONFIG | 0.929981 | 6.350003 |
0db64e7e-de2a-4ad4-8332-0ff47a7a5dc2 | rsharifnasab/sbu_basic_programming | tamrin4/aval2.cpp | #include <iostream>
#include <math.h>
using namespace std;
/*
bool is_prime(int x)
{
if(x%2 == 0 && x != 2 ) return false;
for(int i = 2;i<x-1;i++)
{
if(x%i == 0) return false;
}
return true;
}*/
/*
int amel(int a , int i)
{
//if (is_prime(i)) cout << i << " ";
if (a%i == 0 && is_prime(i))
{
... | ALGO | 0.999944 | 3.566241 |
4b4a9b91-7b59-446f-8d6d-6aae2b0f04ff | m1sterzer0/DaveProgrammingCompetitions | codejam/cpp/2008/2/2_StarWars.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
#define FOR(i,a) for (ll i = 0; i < (a); i++)
#define len(x) (ll) x.size()
const ll INF = 1LL << 62;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = 4*atan(double(1.0));
int main ... | ALGO | 0.999509 | 3.502119 |
79fc38b3-6f79-4555-bc17-bb8dbf99861b | Ashfaqur4988/DSA-codes | Linked List/removeDups.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
~Node()
{
int val = this->data;
if (this->next != NULL)
{
delete next;
this->next = N... | ALGO | 0.999853 | 5.29368 |
e0b5d32f-5729-4dc2-986d-fe5b9bc9adef | sarvex/leetcode-tcsh | solution/2000-2099/2073.Time Needed to Buy Tickets/Solution.cpp | class Solution {
public:
int timeRequiredToBuy(vector<int>& tickets, int k) {
int ans = 0;
for (int i = 0; i < tickets.size(); ++i) {
if (i <= k) {
ans += min(tickets[k], tickets[i]);
} else {
ans += min(tickets[k] - 1, tickets[i]);
... | ALGO | 0.99997 | 6.26697 |
a95108e4-3094-40a4-84dd-799318e87b58 | remi349/projects | school projects/programing-concourse-cpp/sunny/Sunny.cpp | #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
using namespace std;
const double EPS = 1e-9;
struct point
{
int x, y;
bool operator==(point pt2) const
{
return (fabs(x - pt2.x) < EPS && (fabs(y - pt2.y) < EPS));
}
static bool b... | ALGO | 0.99866 | 4.025206 |
08fd0aa9-d5d3-4383-b2e3-5cb6c8a88fa3 | ishandutta2007/codeforces | orzdevinwang/normal/611/F.cpp | #include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define vi vector <int>
#define sz(a) ((int) (a).size())
using namespace std;
const int N = 5e5 + 7, M = 15, mod = 1e9 + 7;
int n, k, w[N], c[N], d[N];
int inv[M], ifac[M];... | ALGO | 0.999985 | 3.620813 |
bfde5fbc-f97f-4320-b798-dca92980af66 | Sudhir769/LeetCode-GFG-Daily | 15 October 2024/lc-/Solution.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
long long minimumSteps(string s)
{
int n = s.length();
int black = 0, white = n - 1;
long long cnt = 0;
while (black < white)
{
if (s[black] == '1' and s[white] == '0')
{
... | ALGO | 0.999987 | 5.312582 |
f9b6733b-f394-4377-9d11-84a58efba994 | UMich-BipedLab/C-Frost | Linux/src/JacGEvalMultiThread.cpp | #include "frost/JacGEvalMultiThread.h"
#include "frost/Document.h"
#include "frost/functionlist.hh"
#include "IpTNLP.hpp"
#include <iostream>
#include <thread>
#include <mutex>
#include <vector>
#include <condition_variable>
#include <cassert>
using namespace Ipopt;
using namespace std;
namespace frost
{
class Jac... | ALGO | 0.986867 | 6.564236 |
ef94d3f4-4613-462a-bfe5-5c018c24fef2 | jynxmagic/LLMs-for-System-Identification | defaults/generated_programs/lib/Eigen/doc/examples/TutorialLinAlgRankRevealing.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
A << 1, 2, 5,
2, 1, 4,
3, 0, 3;
cout << "Here is the matrix A:\n" << A << endl;
FullPivLU<Matrix3f> lu_decomp(A);
cout << "The rank of A is " << lu_decomp.rank() << endl;
c... | ALGO | 0.999564 | 3.720849 |
730a9ae9-1f36-4756-a38c-beb1dd77943c | jo3-l/cp-practice | src/main/cpp/ccc/2022/s1.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin.exceptions(cin.failbit);
int n;
cin >> n;
int cnt = 0;
for (int fives = 0; fives <= n / 5; fives++) {
cnt += (n - fives * 5) % 4 == 0;
}
cout << cnt << '\n';
}
| ALGO | 0.999404 | 3.714357 |
2d70e5e7-9499-4b53-bd9b-986ca40c3c02 | myeon9seon/Project-Euler | 10-99/Problem_#32_Pandigital products.cpp | // execution time: 112ms
#include <iostream>
#include <cmath>
#include <cstdio>
#include "Time.h"
using namespace std;
typedef struct _equation { int a, b, c; } Equation;
const int MAX = 9;
int countDigit(int num) {
int count = 0;
while (num > 0) {
num /= 10;
count++;
}
return count;
}
int getCharToInt(char... | ALGO | 0.999304 | 4.773494 |
0492e262-2005-4826-b24f-d6a46bd391fe | AKarunakaran/CodeForces | VCF484/A.cpp | #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <functional>
using namespa... | ALGO | 0.999889 | 3.382901 |
19a0962b-6c70-4485-ad10-af814f9a0822 | fishy15/competitive_programming | schools/utpc/040822/food_search.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <numeric>
#define ll long long
#define ld long double
... | ALGO | 0.999855 | 4.093347 |
c0d1bd21-50e7-4e0b-80b6-bc7b642b06dd | Ismail-Upal/CP-Campaign | Codechef/Time_Penalty.cpp | #include<bits/stdc++.h>
using namespace std;
#define opt() ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define tc int t; cin >> t; for (int _ = 1; _ <= t; _++)
using ll = long long;
#define endl "\n"
#define sz(x) (ll)(x).size()
//-------------------------------------------
int32_t main()
{ ... | ALGO | 0.997778 | 4.189006 |
8dc889d1-c3fd-4ee4-a1df-ec2ccd4f7373 | uchikhanz/CodeForces-Educational-Round | Round 8/B. New Skateboard.cpp | #include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int (i) = 0; (i) < (n); (i) ++)
int main(){
string s;
cin >> s;
int n = size(s);
long long int ans = 0;
vector<int> dig;
forn(i, n){
dig.push_back(s[i] - '0');
}
for(int i = 1; i < n; i ++){
if((dig[i - 1] * 10 + dig[i]) % 4 == 0){
... | ALGO | 0.999872 | 4.066553 |
d99b701a-f25c-4aa2-954c-acb6c4d2942f | farmpiggie/competitive-programming | codeforces/1919/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
int find(int a, vector<int>& par) {
if (a == par[a]) return a;
else return par[a] = find(par[a], par);
}
void merge(int a, int b, vector<int>& par, vector<int>& sz, vector<int>& mn, vector<int>& l, vector<int>& r) {
a = find(a, par);
b = fi... | ALGO | 0.999976 | 4.509547 |
eff819fe-7526-40cb-b9be-aa1289163a76 | wkdehdlr/Doo-it | Algorithm/백준/알고리즘 중급/다이나믹 프로그래밍/다이나믹 프로그래밍/BOJ 2482 색상환.cpp | #pragma warning(disable : 4996)
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
ll dp[1001][1001][2];
int N, K, ok;
ll func(int n, int k, int t)
{
//
if (ok == 1) {
if (n == N) {
if (t == 1)return 0;
else {
if (k == K)return 1;
else return 0;
}
}... | ALGO | 0.999962 | 3.973857 |
ab626e7a-a85c-413b-a45c-23a03b82ed80 | elemental/Elemental | src/matrices/deterministic/sparse_toeplitz/TriW.cpp | #include <El-lite.hpp>
#include <El/blas_like/level1.hpp>
#include <El/matrices.hpp>
namespace El {
template<typename T>
void TriW( Matrix<T>& A, Int n, T alpha, Int k )
{
EL_DEBUG_CSE
if( k < 0 )
LogicError("Number of superdiagonals must be non-negative");
Zeros( A, n, n );
FillDiagonal( A, ... | ALGO | 0.973827 | 4.142726 |
1d9d706e-dd4c-425a-a632-726912c9795a | Neel-2002/GeeksForGeeks | Difficulty: Medium/Diameter of a Binary Tree/diameter-of-a-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
/* A binary tree node has data, pointer to left child
and a pointer to right child */
class Node {
public:
int data;
Node* left;
Node* right;
Node(int val) {
data = val;
left = NULL;
right = NULL;
}
}... | ALGO | 0.998173 | 6.920227 |
0d9f0635-9d66-4792-b3e7-08d8f8fdc720 | toufunn/fun | amazon/freq/160_Intersection_of_Two_Linked_Lists.cpp | */
struct ListNode *getIntersectionNode(struct ListNode *headA, struct ListNode *headB) {
if(!headA || !headB) return NULL;
struct ListNode* A = headA;
struct ListNode* B = headB;
while (A && B && A!=B){
A = A->next;
B = B->next;
if(A==B) return A; // key if NULL make sure... | ALGO | 0.998976 | 4.139022 |
04f28c04-a690-4456-adf6-32185990cd74 | somu-bs/Leetcode | 0345-reverse-vowels-of-a-string/0345-reverse-vowels-of-a-string.cpp | class Solution {
private:
bool checkIsVowel(char c) {
string vowels = "aeiouAEIOU";
if(vowels.find(c) == string::npos) return false;
return true;
}
public:
string reverseVowels(string s) {
int n = s.size();
int i = 0, j = n-1;
while(i < j) {
if(che... | ALGO | 0.999989 | 6.690123 |
9ae4da7a-e029-4a7d-a41f-afb869d66f98 | Toysoft/NNvision | darknet_apache_nvenc/opencv_contrib-3.4.4/modules/xphoto/src/bm3d_image_denoising.cpp | #include "opencv2/xphoto.hpp"
#include "opencv2/core.hpp"
#ifdef OPENCV_ENABLE_NONFREE
#include "bm3d_denoising_invoker_step1.hpp"
#include "bm3d_denoising_invoker_step2.hpp"
#include "bm3d_denoising_transforms.hpp"
#endif
namespace cv
{
namespace xphoto
{
#ifdef OPENCV_ENABLE_NONFREE
template<typename ST, typena... | ALGO | 0.997421 | 5.59784 |
f568e758-15c9-4e99-9fae-fa24acf7d64a | zhangwj0101/codestudy | algorithm/HDU-ACM/ambition0109/2254.cpp | ////////////////////System Comment////////////////////
////Welcome to Hangzhou Dianzi University Online Judge
////http://acm.hdu.edu.cn
//////////////////////////////////////////////////////
////Username: ambition0109
////Nickname: Ambition
////Run ID:
////Submit time: 2010-09-18 21:37:38
////Compiler: Visual C++
////... | ALGO | 0.999965 | 3.599687 |
00eb1d05-d953-4221-bbb6-a60c3210f49c | KunalBahirat/DSA-Practice | problems/1_strings.cpp | #include <iostream>
using namespace std;
//Finding length of string in array of any size by finding \0
int main(){
char name[10]="KUNAL";
int i;
for(i=0;name[i]!='\0';i++){}
cout<<"\n"<<sizeof(name);
cout<<"\nLength of name is "<<i<<endl;
cout<<name<<endl;
//Changing uppercase to lowercase b ... | TOOL | 0.882234 | 3.502407 |
13f9d385-a022-4f65-9d28-e66e3cef4d15 | 309thEDDGE/tip | cpp/util/src/sha256_tools.cpp | #include "sha256_tools.h"
int ComputeSHA256(std::istream& input_stream, std::string& sha256_value,
size_t byte_count)
{
// fail bits
if (!input_stream.good())
{
printf("ComputeSHA256(): Fail bit(s) are set\n");
sha256_value = "null";
return EX_IOERR;
}
in... | TOOL | 0.940043 | 6.49145 |
e48b30ca-45ff-468b-832c-7f96659545ea | Yallaswamy/LEETCODE_PROBLEMS | 1568-pseudo-palindromic-paths-in-a-binary-tree/pseudo-palindromic-paths-in-a-binary-tree.cpp | /**
* Definition for a binary tree node.
* 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), l... | ALGO | 0.999919 | 5.65933 |
bd9e4f5e-28c0-4fec-89e4-5d2f0bdb22f4 | TheProbPro/Numeriskemetoder | NR_C301/legacy/nr2/CPP_211/recipes/newt.cpp | #include <cmath>
#include <limits>
#include "nr.h"
using namespace std;
Vec_DP *fvec_p;
void (*nrfuncv)(Vec_I_DP &v, Vec_O_DP &f);
void NR::newt(Vec_IO_DP &x, bool &check, void vecfunc(Vec_I_DP &, Vec_O_DP &))
{
const int MAXITS=200;
const DP TOLF=1.0e-8,TOLMIN=1.0e-12,STPMX=100.0;
const DP TOLX=numeric_limits<DP>... | ALGO | 0.999971 | 4.313645 |
16703223-be22-4552-86be-15e087cb1f19 | guricerin/algo-method-submissions | src/02-brute-force-search/01-array/10.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> ans(9);
for (int i = 0; i < n; i++)
{
int a;
cin >> a;
a--;
ans[a]++;
}
int pos = ans.end() - max_element(ans.begin(), ans.end());
cout << 9 - pos + 1 << "\n";
}
| ALGO | 0.999286 | 3.474646 |
1704c258-b4fc-4a86-90da-2bd9dd2723bb | mihkuno/CS121 | Topic 8/Cainday/Exercise 1.cpp | /*
(Compute total marks for each student)
Suppose the marks obtained by all students are stored in a two-dimensional array.
Each row records a student's marks for five tests. For example, the following
array stores the test marks for eight students. Write a program that displays
students and the tot... | ALGO | 0.999627 | 5.586603 |
ec400beb-b4e0-4f23-ba25-172503fa04c6 | arshsaini15/cpp-language | Linked List/linkedlist6.cpp | // Reverse a linked list.
#include<iostream>
using namespace std;
class node{
public:
int data;
node* next;
node(int val){
data = val;
next = NULL;
}
};
void insertathead(node* &head, int val){
node *n = new node(val);
n->next = head;
head = n;
}
node* reverse(node* ... | ALGO | 0.99991 | 4.841669 |
4bf5b05d-d0fb-432d-8e36-0f04b228e8d3 | ChristopherRabotin/GMAT | src/csalt/src/executive/OptimizerBase.cpp | /**
* the base class for SNOPT/IPOPT optimizer classes
*/
//------------------------------------------------------------------------------
#include "OptimizerBase.hpp"
#include "MessageInterface.hpp"
//#define DEBUG_OPTIMIZER
//------------------------------------------------------------------------------
// stati... | ALGO | 0.94081 | 6.179248 |
db9c7f70-5f34-4bad-aa94-e242cf95dd31 | ankikong/c- | src/hdu/3374.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6 + 100;
char str[maxn];
int nxt[maxn];
int len;
void getNxt() {
int k = -1; nxt[0] = -1;
for (int i = 1; i < len; i++) {
while (k != -1 && str[i] != str[k + 1]) k = nxt[k];
if (str[k + 1] == str[i]) k++;
... | ALGO | 0.999622 | 3.226829 |
98c6f242-b3b2-4398-a4aa-9bfa0a88b3b6 | shrimpvlad/contest | Алгоритмы_2_2/algorithms_2_2E.cpp | #include <iostream>
using namespace std;
int main() {
int n,a, max =0,sum=0;
cin>>n;
for (int i=0;i<n;++i) {
cin>>a;
if (max<a) max=a;
sum+=a;
}
cout<<(sum-max)<<endl;
}
| ALGO | 0.999519 | 3.292215 |
97bfa921-1eee-44da-a97d-243b53fe65ad | talaabusoud/Arch2_SIMD-Vectorization-project | src/MatrixVector.cpp | // Matrix - Vector
#include <immintrin.h> // portable to all x86 compilers
#include <stdio.h>
#include <time.h>
#define DATA float
const int SIZE = 512;
DATA __attribute__((aligned(16))) A[SIZE];
DATA __attribute__((aligned(16))) B[SIZE][SIZE];
DATA r[SIZE];
double seconds()
{
// Function to get the current tim... | ALGO | 0.998471 | 5.345063 |
8c8d9b35-31a0-4fbf-a94a-1d39361ea407 | Moremar/advent_of_code | aoc_2022/c++/day07/part1.cpp | #include "part1.h"
using namespace std;
namespace Day07 {
void compute_size(shared_ptr<Directory> directory) {
if (directory->size == 0) {
for (const auto& [name, size] : directory->files) {
directory->size += size;
}
for (auto& [name, folder] : directo... | ALGO | 0.993757 | 5.605233 |
ac82ca01-dd8f-43b6-a2a3-b1f283c6d456 | abhiXsliet/DSA-SHEETS | SDE Sheet Striver/Arrays-i/006-best-time-to-buy-and-sell-stock.cpp | // https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
#include <bits/stdc++.h>
using namespace std;
class Solution {
private:
// TC : O(N)
// SC : O(1)
int way_1(vector<int>& prices, int n) {
int minPrice = prices[0];
int maxProfit = 0;
for (int i = 0; i < n; i ++) {
... | ALGO | 0.999631 | 6.239298 |
1b46a6c9-7653-4784-838d-dfac2965f080 | timprepscius/mailiverse | cpp/Lib/xcode-botan/Botan-1.10.3-clean/src/math/numbertheory/mp_numth.cpp | #include <botan/numthry.h>
#include <botan/internal/mp_core.h>
#include <botan/internal/rounding.h>
#include <algorithm>
namespace Botan {
/*
* Square a BigInt
*/
BigInt square(const BigInt& x)
{
const size_t x_sw = x.sig_words();
BigInt z(BigInt::Positive, round_up<size_t>(2*x_sw, 16));
SecureVector<wor... | ALGO | 0.998108 | 7.128806 |
974964bf-fd57-4671-9e79-98441fd4affc | suxutao/LeetcodeList | cn/688-knight-probability-in-chessboard .cpp | #include "../../../stdc.h"
using namespace std;
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
public:
int arr[8][2]{{-1,-2},{-1,2},{1,-2},{1,2},{-2,1},{-2,-1},{2,1},{2,-1}};
double dp[26][26][101]{};
double knightProbability(int n, int k, int row, int column) {
... | ALGO | 0.999945 | 4.779474 |
58115586-5285-448a-bb3a-1034a5cb7ac7 | gmaheswaranmca/c2512 | phase2/case_study/bank/docs-01/01-crud.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
class BankAccount {
private:
double balance;
int number;
std::string name; //char name[255]
bool active;
int transCount;
public:
BankAccount() : balance(0), number(0), name(""), active(false), transCount(0) {}
BankA... | TOOL | 0.91189 | 7.270104 |
a5ff6a00-b6f4-4658-8d8e-3c17323cc831 | fideespinosa/SPACE-WAR-Videogame- | ArchivoRanking.cpp | #include "ArchivoRanking.h"
#include <iostream>
#include <cstring>
bool ArchivoRanking::CalculateFile(Score _Score)
{
FILE* p;
Score score[5];
fopen_s (&p, "score.dat", "rb");
if (p == NULL) {
std::cout << "no se abrio el archivo en calculate file";
system("pause");
}
for (int i = 0; i < 5; i++)
{
fr... | TOOL | 0.974574 | 3.101592 |
6575d1e7-43e3-423c-8791-4782c76cbfd9 | AllanNozomu/CompetitiveProgramming | UVa/00101.cpp | bool debug = false;
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<bitset>
#include<set>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
#include<math.h>
#include<time.h>
using namespace st... | ALGO | 0.999576 | 4.425498 |
5fb3beac-a6e9-4d97-8d57-f6ac05e94ee2 | Katsudon10/Competitive-programming | Atcoder/ABC/ABC253/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
const int inf = INT_MAX;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
vector<int>dxs={1,0,-1,0};
vector<int>dys={0,1,0,-1};
//fixed << setprecision(10)
//A[i].... | ALGO | 0.999835 | 4.067961 |
ffb128d4-dcb5-4ad2-b566-6057e9c08369 | yuren1978/DataStructureAlgorithm | Tree/largestRectange.cpp | #include <stack>
#include <vector>
#include <iostream>
using namespace std;
int largestRectangleArea(vector<int> &height) {
height.push_back(0);
stack<int> s;
int size=height.size();
int maxArea=0;
for(int i=0; i<size; i++){
if(s.empty()||height[i... | ALGO | 0.999777 | 5.777634 |
645cab2f-5daa-455b-8eed-c3980230082f | hjiang13/LLMs-in-IR | POJ-104/59/1074.cpp | #include <iostream>
using namespace std;
int main()
{
int n,m,i,j,t=0,day;
char bf1[101][101]={
'#'}
,bf2[101][101]={
'#'}
;
char kongbai[10];
cin >> "%d",&n);
gets(kongbai);
for(i=1; i<=n; i++){
for(j=1; j<=n; j++){
cin >> "%c",&bf1[i][j]);
}
gets(kongbai);
}
for(i=1; i<=n; i++){
for(j=1; j<=n; j++){
bf2[i][j]=bf1[i][... | ALGO | 0.998711 | 3.101722 |
fe3105f3-c899-49c2-b642-27c4bb3db679 | usmanibraheem09/QR_Code_generator | 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.998757 | 6.771107 |
c7ba0dbb-3a48-451f-b822-1404e9297a7c | google/dive | third_party/mesa/src/intel/compiler/brw_fs_live_variables.cpp | #include "brw_fs.h"
#include "brw_fs_live_variables.h"
using namespace brw;
#define MAX_INSTRUCTION (1 << 30)
/** @file brw_fs_live_variables.cpp
*
* Support for calculating liveness information about virtual GRFs.
*
* This produces a live interval for each whole virtual GRF. We could
* choose to expose per-co... | ALGO | 0.908666 | 7.561197 |
61d1fb39-c824-45c3-8c24-33b0d7c400c7 | seonha14/My-Codes | C++/ConstantQualifiers.cpp | #include <iostream>
using namespace std;
class Demo
{
public:
int x = 10;
int y = 20;
void Display() const
{
// x++; After writing const, The members of the function become read only
cout << "x = " << x << " y = " << y << endl;
}
};
int main()
{
// Usage 1
const int a = 20;... | TOOL | 0.877306 | 5.123053 |
771427ad-ddff-4d03-a868-7958d2a90891 | mikymaione/MAMEStreamingPlatform | 3rdparty/bgfx/3rdparty/meshoptimizer/src/vcacheanalyzer.cpp | #include <assert.h>
#include <string.h>
meshopt_VertexCacheStatistics meshopt_analyzeVertexCache(const unsigned int* indices, size_t index_count, size_t vertex_count, unsigned int cache_size, unsigned int warp_size, unsigned int primgroup_size)
{
assert(index_count % 3 == 0);
assert(cache_size >= 3);
assert(warp_si... | ALGO | 0.97191 | 5.778869 |
1f54bfdc-143d-4723-bf30-459ab93cac0d | chirantan-basu01/Daily-Problem-Solving | 200-number-of-islands/200-number-of-islands.cpp | class Solution {
public:
int numIslands(vector<vector<char>>& grid) {
int m=grid.size();
int n=grid[0].size();
int ans=0;
for(int currentRow=0;currentRow<m;currentRow++){
for(int currentCol=0;currentCol<n;currentCol++){
if(grid[currentRow][current... | ALGO | 0.999982 | 6.590309 |
c705ac19-0ff7-4fc7-84aa-c07e5665a72e | iamsyedzahid/OOP-Lab | Lab 1/7.cpp | #include <iostream>
using namespace std;
double calculateBill(int units)
{
double bill = 0;
if (units <= 50)
{
bill = units * 0.50;
}
else if (units <= 150)
{
bill = 50 * 0.50 + (units - 50) * 0.75;
}
else if (units <= 250)
{
bill = 50 * 0.50 + 100 * 0.75 +... | ALGO | 0.994781 | 5.806301 |
7d3291ad-d11f-4dca-901e-ab2c8bf1c62c | naiemofficial/Problem-Solving | Football (43A).cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n, goal = 0; cin >> n;
string team, win;
for(int i = 0; i < n; i++){
if(!goal){
cin >> win;
goal++;
} else {
cin >> team;
if(team == win){
goal++;
... | ALGO | 0.999765 | 3.899527 |
b32dad76-9319-44ce-827e-fc7d739179b1 | xiguayizu/ollvm4.0-and-llvm9.0 | llvm/lib/CodeGen/PostRAHazardRecognizer.cpp | #include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h... | ALGO | 0.860275 | 7.682414 |
036334a2-a0a8-47a6-b054-10d2219f638b | GodRishUniverse/dsa-practice | contest/bad_triangle.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <set>
using namespace std;
using ll = long long;
int main(){
ll tests {};
cin >> tests;
for (size_t t =0 ; t<tests; t++){
ll n;
cin >> n;
vector<ll> a(n+1,0);
for (size_t i =1; i < n+1; i++){
... | ALGO | 0.998432 | 3.377219 |
fb45b443-d0a7-4d88-8c12-266c918916b8 | mohammadi-milad-mim/Competitive-Programming | Implementations/Kattis/Impl-01/FlPrW01C3/c.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int m = n%3;
int li[n];
int t,s=0;
for (int i=0; i<n; i++){
cin>>t;
s+=t;
li[i]=t;
}
sort(li, li+n);
int mi =0;
for (int i=m; i<n; i+=3){
mi+=li[i];
}
cout<<s-mi;
} | ALGO | 0.999982 | 3.820529 |
bcc9556a-c3ad-45e9-bb53-7465e4917842 | maria-nastase/SYDE-223 | a3/binary-search-tree.cpp | #include "binary-search-tree.h"
#include <iostream>
#include <queue>
BinarySearchTree::Node::Node(DataType newval) {
left = nullptr;
right = nullptr;
val = newval;
}
int BinarySearchTree::getNodeDepth(Node* n) const {
if (n == nullptr)
return -1;
else if (n -> left == nullptr && n -> right... | ALGO | 0.998664 | 5.071764 |
d9df6bd9-6647-44df-87b2-c9ae731e5702 | egekabas/Competitive-Programming-Solutions | codeforces/egekabas/normal/837/D.cpp | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii... | ALGO | 0.999952 | 3.803155 |
c6732b13-5eb9-4421-baa4-fb43fdd88ba7 | Sphere-xx/mangoszero | dep/tbb/src/tbbmalloc/tbb_function_replacement.cpp | //We works on windows only
#ifdef _WIN32
#define _CRT_SECURE_NO_DEPRECATE 1
#include <windows.h>
#include <new>
#include "tbb_function_replacement.h"
inline UINT_PTR Ptr2Addrint(LPVOID ptr)
{
Int2Ptr i2p;
i2p.lpv = ptr;
return i2p.uip;
}
inline LPVOID Addrint2Ptr(UINT_PTR ptr)
{
Int2Ptr i2p;
i2p.... | TOOL | 0.928655 | 6.210963 |
d6a479f8-2376-4ef4-a86d-17cf62217777 | MPSLab-ASU/CCF-20.04 | llvm-project/libcxx/test/std/utilities/template.bitset/bitset.members/count.pass.cpp | // test size_t count() const;
#include <bitset>
#include <cassert>
#include <cstddef>
#include <vector>
#include "../bitset_test_cases.h"
#include "test_macros.h"
template <std::size_t N>
void test_count() {
std::vector<std::bitset<N> > const cases = get_test_cases<N>();
for (std::size_t c = 0; c != cases.si... | TEST | 0.906478 | 7.332307 |
9f35880e-8116-4e32-a0b2-65b7dd9b4072 | koughua/Homework_cs106b | serafini_starter/WordLadder/lib/StanfordCPPLib/dawglexicon.cpp | /*
* File: dawglexicon.cpp
* ---------------------
* A lexicon is a word list. This lexicon is backed by two separate data
* structures for storing the words in the list:
*
* 1) a DAWG (directed acyclic word graph)
* 2) a Set<string> of other words.
*
* Typically the DAWG is used for a large list read from a f... | TOOL | 0.943237 | 7.179744 |
2f0a917e-10a5-42fa-90fa-398d53a8c225 | dmorse/simpatico | src/mcMd/attic/hoomd/src/potentials/pair/HoomdDpdPair.cpp | #ifndef SIMP_NOPAIR
#ifndef HOOMD_DPD_PAIR_CPP
#define HOOMD_DPD_PAIR_CPP
#include "HoomdDpdPair.h"
namespace McMd
{
char classNameHoomdDpd[] = "HoomdDpdPair";
/**
* Default constructor.
*/
HoomdDpdPair::HoomdDpdPair()
: HoomdPair< EvaluatorPairDPDThermo, gpu_compute_dpdthermo_forces,
... | ALGO | 0.968125 | 6.155978 |
f3c6393a-e209-4a26-9ba7-9adda94d0ace | Sachindebug/LeetCode-Problems | 0706-design-hashmap/0706-design-hashmap.cpp | class MyHashMap {
public:
/** Initialize your data structure here. */
unordered_map<int,int> ump;
MyHashMap() {
}
/** value will always be non-negative. */
void put(int key, int value) {
ump[key]=value;
}
/** Returns the value to which the specified ke... | ALGO | 0.998166 | 6.313715 |
465461ec-9a62-48ed-a1ad-a4543778a5e2 | MorolShohan/Computer-Graphics-Codes | Translation/main.cpp | #include <iostream>
#include<GL/gl.h>
#include <GL/glut.h>
#include <windows.h>
#include<vector>
#include<math.h>
using namespace std;
int pntX1, pntY1, choice = 0, edges;
vector<int> pntX;
vector<int> pntY;
int transX, transY;
double scaleX, scaleY;
double round(double d)
{
return floor(d + 0.5);
}
void drawPolygon... | ALGO | 0.857601 | 4.424414 |
a497954f-2fe4-4e03-8c5c-aad72cd3e769 | AnnHarvard/algosTP | Module_1/HomeWork_1/2_3/main.cpp | // 2_3. Даны два массива неубывающих целых чисел, упорядоченные по возрастанию.
// A[0..n-1] и B[0..m-1]. n >> m. Найдите их пересечение.
// Требования: Время работы: O(m * log k), где k - позиция элемента B[m-1] в массиве A..
// В процессе поиска очередного элемента B[i] в массиве A пользуйтесь результатом поиска эл... | ALGO | 0.999958 | 4.778546 |
a6555f08-4efd-4245-8c15-5127f1e38d43 | UestcXiye/Leetcode | 637.二叉树的层平均值.cpp | /*
* @lc app=leetcode.cn id=637 lang=cpp
*
* [637] 二叉树的层平均值
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr),... | ALGO | 0.999923 | 7.329496 |
6c0fb6c6-05ad-4f27-81de-8d062a85935d | Ghansham2592/Data-structures | arrays/Dynamic Programming/longest_common_subsequence_2_string.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
void lcs(string s1, string s2, int m ,int n){
int l[m+1][n+1];
int i, j;
for(i= 0; i<=m;i++)
for(j =0; j<=n; j++){
if(i== 0 || j==0)
l[i][j] =0;
else
if(s1.at(i-1)==s2.at(j-1)){
l[i][j] = 1+l[i-1][j-1];
}
else{
l[i... | ALGO | 0.999854 | 4.463838 |
60a3babc-53ea-477e-8ef3-0ad3cfa7a4e8 | mr-loop-1/Leetcode | [1488]-Avoid-Flood-in-The-City-TLE/solution.cpp | vector<int> avoidFlood(vector<int>& rains) {
map<int, int> full;
list<int> dryIdx;
vector<int> ans(rains.size());
for(int i=0; i!=rains.size(); i++) {
if(rains[i] > 0) {
ans[i] = -1;
if(full.count(rains[i])) {
... | ALGO | 0.999988 | 5.714752 |
db1fb4c3-3c40-46d2-ad89-95b46f4992ee | kael-pam-pam/OOP | Lab1/Replace/Replace.cpp | #include <iostream>
#include <string>
#include <optional>
#include <fstream>
struct Args
{
std::string inputFileName;
std::string outputFileName;
std::string seacrhStr;
std::string replaceStr;
};
std::optional<Args> ParseArgs(int argc, char* argv[])
{
if (argc != 5)
{
std::cout << "Invalid arguments count.\n"... | TOOL | 0.908392 | 5.877363 |
4bd66a46-8845-4948-8cb8-099f2936588e | smadi0x86/Hallucina | obfuscator-llvm/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/ranges_equal_range.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
// <algorithm>
// template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
// indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
// constexpr subrange<I>
// equal_range(I first, S last, const T& value, Comp com... | TEST | 0.961356 | 7.519262 |
1a42b83f-6a46-4e9e-99c1-b3a1964a1295 | trivedikrunal/Apna-College-DSA-Series | Lecture 3/11doWhileLoop.cpp | #include<iostream>
using namespace std;
int main(){
int n ;
cout << "Enter Loop Range: ";
cin >> n;
int count = 1;
do{
cout << count << " ";
count ++;
}while(count <= n);
return 0;
} | ALGO | 0.867118 | 3.548068 |
d1a3466c-803b-4567-aec9-4f1c4adc52ba | bluarry/daily_problem | 西电acm/2017_tranning/组合数学/xdoj1063.cpp | #include <iostream>
using namespace std;
typedef long long ll;
const ll MOD=1000000007;
ll quick_pow(ll a,ll b){
ll ans=1;
a=a%MOD;
while(b){
if(b&1) ans=(ans*a)%MOD;
a=(a*a)%MOD;
b>>=1;
}
return ans;
}
int main()
{
int n;
while(cin >> n){
if(n%2)
cout << quick_pow(2,n-1) << endl;
else
{
cou... | ALGO | 0.999968 | 4.315562 |
33791287-bea2-4d7b-844e-abc8532f6b57 | xchmwang/algorithm | leetcode/leetcode110/balanced_tree.cpp | #include <iostream>
#include <algorithm>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
int max_depth_tree(TreeNode* root) {
if (!root) return 0;
return max(max_depth_... | ALGO | 0.999946 | 6.104772 |
54356f9e-3b67-4854-a89d-7f099dfb06e5 | deadxrk/Orthello- | COEN-244_Assignment02/Board.cpp | #include "Board.h"
char Board::getBoardCell(int row, int col) {
return board[row][col];
}
void Board::drawBoard() {
// display the current state of the board
cout << " ";
for (int i = 0; i < BOARD_SIZE; i++) {
cout << i << " ";
}
cout << endl;
for (int i = 0; i < BOARD_SIZE; i++) {... | ALGO | 0.934708 | 5.682569 |
b3cfa184-fb0d-4a66-b605-b17bee959449 | Anilshrestha/numericalMethod | lagrange Interpolation/lagrange_interpolation.cpp | #include<stdio.h>
#include<conio.h>
double x[5]={1,2,3,4,5};
double fx[5]={1,1.4142,1.7321,2,2.2361};
int n=5;
double point=2.5;
double lagrange(int i)
{
double value=1;
for(int j=0;j<5;j++)
{
if(i!=j)
{
value *=((point-x[j])/(x[i]-x[j]));
}
... | ALGO | 0.999981 | 3.27981 |
4969e915-3adf-415c-8604-0ad30e3688c5 | ebisenttt/atcoder | abc116/b/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1e9
typedef long long ll;
t... | ALGO | 0.999967 | 4.117954 |
84bb6a79-da73-4dfe-a2e0-db519e358749 | prakashkumar11/C-Program1 | CollegeProgram/Syntax PDF/MultipleInheritance01.cpp | /*Write a Program to Square root of a number check a number is even or not and swap
the values of two variables...*/
#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
class Base1
{
protected :
int n;
public:
void Input1()
{
cout <<"Enter a Number :\n";
ci... | ALGO | 0.998599 | 3.6614 |
77f12eb6-02f1-4d45-aea0-bcb9ee0cb6dc | hogsy/sbengine | Source/P5/Shared/MOS/XRModels/Model_BSP3/WBSP3Fog.cpp | #include "PCH.h"
#include "../Platform/Platform.h"
#include "MFloat.h"
#include "WBSP3Model.h"
#include "WBSP3Def.h"
//#include "../../XR/XRVBPrior.h"
#include "../../XR/XREngineVar.h"
// -------------------------------------------------------------------
// Stuff in MImage.cpp
// ----------------------------------... | TOOL | 0.915946 | 4.706354 |
d5e743fc-8702-4c23-8e62-cb145f8dc175 | 1Monurajput/CrackYourPlacement | Day-5/problem-4.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
sort(strs.begin(),strs.end());
string first = strs[0];
string last = strs[strs.size()-1];
int n = first.size();
int m = last.size();
int i = 0;
string ans;
while(i<n && i<m){
... | ALGO | 0.999956 | 5.831193 |
a0e19707-cba1-4380-8c5e-5c3f9d0dc6d1 | simonmikkelsen/the-errors-tour-of-code | cpp/prime_number_checker/prime_number_checker_4.cpp | #include <stdio.h>
#include <stdbool.h>
/*
* Prime Number Checker
* This program is designed to check if a given number is a prime number.
* A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.
* The program will prompt the user to enter a number and then determi... | ALGO | 0.918235 | 5.042878 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.