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 |
|---|---|---|---|---|---|---|
9e42a386-74df-466e-967e-b7e1bf45d343 | aoguangcheng/AlgorithmAndDataStructure | sum.cpp | //sum.cpp
#include<iostream>
using namespace std;
int main()
{int x, y, sum;
cout<<"please input two integers:"<<'\n';
cin>>x;
cin>>y;
sum = x + y ;
cout<<"x+y="<<sum<<endl;
return 0 ;
}
| TOOL | 0.940854 | 3.873418 |
f11a75e0-7223-4653-a396-42f7ab403803 | RainbowZerg/X-Ray_Engine_1.5.1.0 | src/Layers/xrRender/occRasterizer.cpp | // occRasterizer.cpp: implementation of the occRasterizer class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "occRasterizer.h"
occRasterizer Raster;
void __stdcall fillDW_8x (void* _p, u32 size, u32 value)
{
LPDWORD ptr = LPDWORD (_p);
LPDWORD end = ptr+si... | ALGO | 0.92592 | 5.404917 |
c7408ad3-29a1-4e1f-b6e0-e498afe30231 | mooleetzi/ICPC | contest/nowcoder-hj-1/1.cpp | #include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#define eps 0.000001
using std::cin;
using std::cout;
typedef long long ll;
int a[101];
ll num[101];
int main(){
std::ios::sync_with_stdio(false);
int n;
ll x;
cin>>n>>x;
for (int i=0;i<n;i++)
cin>>a[i]>>num[i];
fo... | ALGO | 0.999847 | 3.670938 |
e67b2529-f0fa-4dff-8158-116ab9d70687 | charleslockner/GeneralizedOctree | octree.cpp |
#include "octree.h"
#include "matrix_math.h"
#include <algorithm>
/* subcell order:
* 0: (-,-,-)
* 1: (-,-,+)
* 2: (-,+,-)
* 3: (-,+,+)
* 4: (+,-,-)
* 5: (+,-,+)
* 6: (+,+,-)
* 7: (+,+,+)
*/
Cell::Cell(Cell * parent, Eigen::Vector3f lowBound, Eigen::Vector3f highBound) {
this->parent = parent;
this-... | ALGO | 0.938424 | 6.970582 |
198a56c2-7cdf-4c3d-b091-8bcae1383139 | IvanovMichael/IMA_Public_C | Seaucee Friyacktiall/Seaucee Friyacktiall/Source.cpp | #include <SDL.h>
#undef main
struct point
{
double x, y;
point(double x, double y) : x(x), y(y) {};
};
point sqr(point p)
{
return point(p.x*p.x - p.y*p.y, 2 * p.x*p.y);
}
point pow(point p, Uint16 n)
{
if (n == 0)
return point(1., 0.);
point z = sqr(pow(p, n / 2));
if (n & 1)
return point(p.x*z.x - p.y*z.... | ALGO | 0.998778 | 4.408747 |
34f911ad-ccb2-4090-a056-af9066307d6e | ishandutta2007/codeforces | holyk/normal/1421/E.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#define dbg(args...) std::cerr << "\033[32;1m" << #args << " -> ", err(args)
#else
#define dbg(...)
#endif
inline void err() { std::cerr << "\033[0m\n"; }
template<class T, class... U>
inline void err(const T &x, const U &... a) { std::cerr << x << ' '; err(a...); }
template <class... | ALGO | 0.999994 | 4.065928 |
40d87490-89be-4c3c-8daf-f259c5824b89 | Tayebbb/Competitive-Programming | CodeForces/118-A.cpp | #include <bits/stdc++.h>
#define optimize() ios_base::sync_with_stdio(0), cout.unsetf(ios::floatfield), cout.precision(10), cout.setf(ios::fixed, ios::floatfield);
using namespace std;
int main() {
optimize();
string s, s2;
cin >> s;
for (char c : s) {
if (c == 'a' || c == 'e' || c == 'i' || c... | ALGO | 0.995116 | 3.490413 |
38557a78-d571-447c-bdd2-ffd266911b29 | lyccrius/OI-Solution | UVa/10891 Game of Sum.cpp | #include <iostream>
#include <cstring>
typedef long long lxl;
const int maxN = 100;
int n;
int a[maxN + 10];
lxl p[maxN + 10];
lxl res[maxN + 10][maxN + 10];
lxl pre[maxN + 10][maxN + 10];
lxl suf[maxN + 10][maxN + 10];
void mian() {
std::memset(res, 0, sizeof(res));
std::memset(pre, 0, sizeof(pre));
st... | ALGO | 0.997105 | 3.551087 |
72abcf1d-4a3c-442b-8e8d-a114d9986545 | linzagron/HW2 | HW2_318688009_316380013/Doubly_List.cpp | #include <stdlib.h>
#include "Doubly_List.h"
void initList(list* lst)
{
lst->head = lst->tail = NULL;
}
//is list empty
int isEmpty(list* lst)
{
return lst->head == NULL;
}
//return amount of nodes in the list
int length(list* lst)
{
int length = 0;
node* current;
for (current = lst->head; current != NULL; cur... | TOOL | 0.969961 | 3.879096 |
f02a8530-f4a7-4b10-8c93-cf547dbbf87d | komangputrasn/simple_notes | 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.998784 | 6.761023 |
bf163a12-b0b0-4d78-9e50-4b6cc9383279 | lsgwr/algorithms | Part13算法竞赛宝典/第二部资源包/第十一章 动态规划/树型动态规划/鸿门宴/src/标程/party.cpp | //
#include<iostream>
#include <cstdlib>
using namespace std;
#define MAX(a,b) ((a)>(b)?(a):(b))
int N,f[6001][2],parent[6001];
bool visited[6001];
void tree_dp(int node)
{
if(!visited[node])//if not visited and is not root
{
visited[node] = 1;
for(int i=1;i <= N;i++)
{
if(parent[i] == node)
... | ALGO | 0.999859 | 3.506787 |
49901784-5195-4f57-9b8b-bd469b222c23 | ishandutta2007/codeforces | yfhuang/normal/689/D.cpp | using namespace std;
typedef long long ll;
const int MAXN=200005;
int mm[MAXN];
struct ST
{
int dp[MAXN][20],ty;
void build(int n,int b[],int _ty)
{
ty=_ty;
for(int i=1;i<=n;i++)
dp[i][0]=ty*b[i];
for(int j=1;j<=mm[n];j++)
for(int i=1;i+(1<<j)-1<=n;i++)
... | ALGO | 0.999961 | 3.384633 |
ab79772f-eebb-4f61-857d-688d9023791a | iewang117/ORB-SLAM2-OT | Thirdparty/DBoW2/DBoW2/ScoringObject.cpp | #include <cfloat>
#include "TemplatedVocabulary.h"
#include "BowVector.h"
using namespace DBoW2;
// If you change the type of WordValue, make sure you change also the
// epsilon value (this is needed by the KL method)
const double GeneralScoring::LOG_EPS = log(DBL_EPSILON); // FLT_EPSILON
// ------------------------... | ALGO | 0.995184 | 5.906807 |
9f1d113e-42e7-4982-8f8e-c447f976523b | devfahad/Codeforces | 160A - Twins.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int arr[n],bsum = 0,asum = 0;
for(int i = 0 ; i < n ; i++){
cin >> arr[i];
asum = asum + arr[i];
}
int half = asum / 2;
sort(arr,arr+n);
for(int i = n-1 ; i >= 0 ; i--){
bsum = bsum + arr[i];
if(bsum > half){
int no... | ALGO | 0.999968 | 3.966649 |
9474ade7-d6ef-4fda-ab97-c5543dc5812e | ItsOnkar-dev/Data-Structures-and-Algorithms- | Assignment2.cpp | /******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
******************************************... | ALGO | 0.967266 | 3.996919 |
ff8389e5-5c4e-4ea5-b2dc-ff6caec75dee | Ufowoqqqo/Online-Judge | Codeforces/620B.cpp | #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
const int c[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
inline int calc(int x)
{
int o;
for(o = 0; x / 10; x /= 10) {
o += c[x % 10];
}
return o + c[x];
}
int main(void)
{
int... | ALGO | 0.996909 | 3.93243 |
e01de09d-8726-49c0-9c75-5474a1f914aa | kshatriya-25/Acd-ladder-solutions | BinarySearch/C_Pair_Selection.cpp | /* OM VIGHNHARTAYE NAMO NAMAH :*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
bool isfeasiblemax(vector<pair<int, int>> &pairs, int n, int k, double avg) {
vector<double> c(n);
for (int i = 0; i < n; i++) {
c[i] = pairs[i].first - (avg * pairs[i].second);
... | ALGO | 0.999926 | 4.741578 |
ff645d87-502d-4cef-b241-72f6d640d879 | jmaoito/happyCoding | algorithm/grayCode.cpp | /**************
LeetCode Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.
For example, given n = 2, return... | ALGO | 0.999909 | 6.678885 |
4174c3cd-48cb-41c7-967a-bbeee9ebf6a6 | DotUrDesign/Codeforces-Solutions | 1728C.cpp | /*
iiiiiiiiiiii iiiiiiiiiiii iiiiiiiiiiii ttttttttttt
i i i t
i i i t
i i i t
i i i t
i i i t
iiiiiiiiiiii ii... | ALGO | 0.999979 | 4.706957 |
f8a4fa57-4cba-4277-9747-9320b22e23a4 | thuang86714/leetCodeCpp3rd | LinkedList_82_RR_Remove_Duplicates_from_Sorted_List2.cpp | struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
if(!head || !head->next)return hea... | ALGO | 0.999982 | 5.778087 |
c166933c-a6b5-49b8-9a29-3bcf89efdfa2 | RebeccaZhang22/cpp_basic | vscode/algorithm/shell_sort.cpp | #include<iostream>
using namespace std;
int INCRGAP=3;
void shell_sort(int *a,int n)
{
for(int gap=n/ INCRGAP+1;gap>0;gap/= INCRGAP)
// 步长初始化,注意如果当len<INCRGAP时,gap为0,所以为了保证进入循环,gap至少为1
// 如果步进方式为gap=gap/2的话不用考虑
{
for(int i=0;i<gap;i++)
{
for(int j=i+gap;j<n;j+=gap)
... | ALGO | 0.999976 | 3.581291 |
3a664c7c-f4c1-488d-9cbf-34145a8ad6bd | jaewoopk/Cpp_Algorithm | Barking_Algorithm/B_10866.cpp | #include <bits/stdc++.h>
using namespace std;
const int MX = 1000005;
int dat[2*MX+1];
int head = MX, tail = MX;
int d_size = 0;
void push_front(int x){
dat[--head] = x;
d_size++;
}
void push_back(int x){
dat[tail++] = x;
d_size++;
}
void pop_front(){
if (head == tail)
{
cout << -1 << '\n';
return ;
}
c... | ALGO | 0.999137 | 4.059653 |
ddf795a3-5f33-47c0-be06-acc2ef267d7a | MuradNAqel/ecommerce | 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.998859 | 6.785645 |
7e0e7755-3cbe-4ac8-9069-0b3b367c1c08 | manikanta2901/ubuntu | .history/imp/cpp/Algorithm/BitManupulationBasics.cpp/basics_20210106190008.cpp | #include<bits/stdc++.h>
using namespace std;
// Get bit is to get a bit from binary number
int GetBit(int number,int position){
return (number & (1 << position)) != 0;
}
// Set a bit(1) at given position
int SetBit(int number, int position){
return (number | (1 << position));
}
// ClearBit means keeping a b... | ALGO | 0.99662 | 4.531569 |
979b13ff-1556-4039-a8ea-4b93f5a4fdf8 | BaoVStorm/CTDL-GT | thu nghiem stack.cpp | #include<bits/stdc++.h>
using namespace std;
int t;
string SS;
void doc()
{
cin>>SS;
}
void xuly()
{
stack <int> S;
int n=SS.length();
for(int i=0;i<n;i++)
{
if(SS[i]=='(') S.push(i);
else
{
if(!S.empty())
{
if(SS[i]=')')
{
cout<<S.top()<<"\t";
S.pop();
}
}
}
}
}
int main()
... | ALGO | 0.992317 | 3.593816 |
959eada3-00e5-4212-893a-f206474627cc | NguyenVietHoang725/TaiLieuCNTT-UTC | Nam_2/Ki_3/CTDL>/CTDL/VECTOR/CaidatVector.cpp | #include<iostream>
using namespace std;
#ifndef __vector__cpp__
#define __vector__cpp__
// Lop xu ly duyet nguoc cua vector
template <class T>
class vector_reverse_iterator {
T *curr; // Con tro toi phan tu hien tai
public:
vector_reverse_iterator(T *c = 0) { curr = c; }
// Toan tu gan cho reverse iterato... | ALGO | 0.971981 | 3.690545 |
7274ff86-8eee-4b9b-a407-aedad5de4d3f | abdallamaher/competitive_programming | Math/Algebra/Measure_Greedy/C_Phoenix_and_Distribution.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
inline void solve() {
int n, k; string s;
cin >> n >> k >> s;
sort(s.begin(), s.end());
if (s[0] != s[k - 1]) {
cout << s[k - 1] << endl;
return;
}
cout << s[0];
if (s[k] == s.back()) {
for (int i ... | ALGO | 0.999726 | 4.059691 |
6ef62434-5650-4f7f-a12a-5496e2f430ac | paveg/programming_contest | AtCoder/ABC/131/c.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <thread>
using namespace std;
typedef long long ll;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
const ll mod = 1e9 + 7;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(b, a % b) * b; }
ll f(ll... | ALGO | 0.999777 | 4.390787 |
6c3e8696-5c10-4368-aadf-219b81364118 | abednar0/UltraMegaBaza8000Optymalizacja | ode_solver.cpp | //Ten plik nie powinien by edytowany
#include"ode_solver.h"
matrix *
solve_ode(matrix(*diff)(double, matrix, matrix, matrix), double t0, double dt, double tend, matrix Y0, matrix ud1,
matrix ud2) {
try {
int N = static_cast<int>(floor((tend - t0) / dt) + 1);
if (N < 2)
throw ... | ALGO | 0.9995 | 5.113645 |
df5200c2-570d-4f80-a47a-09e4bf0ac129 | MPTCP-FreeBSD/FB13.1-ML-MPTCP-SRC | contrib/kyua/utils/stacktrace.cpp | #include "utils/stacktrace.hpp"
extern "C" {
#include <sys/param.h>
#include <sys/resource.h>
#include <unistd.h>
}
#include <cerrno>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
#include "utils/datetime.hpp"
#include "utils/en... | TOOL | 0.910287 | 7.651363 |
54253652-7458-446f-8d09-53fe639e9d8f | DLuCJ/miscellaneous | dlu/Cpp_Ver/card.cpp | // Andrew Kensler's business card raytracer
// Changed aek to DLu
#include <stdlib.h> // card > aek.ppm
#include <stdio.h>
#include <math.h>
typedef int i; //Save space by using 'i' instead of 'int'
typedef float f; //Save even more space by using 'f' instead of 'float'
//Define a vector class with const... | TOOL | 0.961993 | 3.812034 |
e1a5cb72-a6bb-4b92-99e2-bfc8d33383b1 | codingpotato/oh-my-cache | src/oop.cpp | #include <cmath>
#include <iostream>
#include <memory>
#include <vector>
#include "measure.hpp"
struct Shape {
Shape() = default;
Shape(const Shape&) = delete;
Shape(Shape&&) = delete;
Shape& operator=(const Shape&) = delete;
Shape& operator=(Shape&&) = delete;
virtual ~Shape() = default;
virtual doubl... | TOOL | 0.930952 | 7.653545 |
89357530-8759-435f-8d66-947b578a7adb | Maximus5/evil-programmers | DialogTools/src/dt.cpp | #include "dt.hpp"
#include <initguid.h>
#include "guid.hpp"
// {37123652-3645-4776-86D6-A94FB2B12FC8}
DEFINE_GUID(CaseGuid, 0x37123652, 0x3645, 0x4776, 0x86, 0xd6, 0xa9, 0x4f, 0xb2, 0xb1, 0x2f, 0xc8);
// {39AE5A2C-A38D-40de-AA59-207E96E5A17D}
DEFINE_GUID(FileGuid, 0x39ae5a2c, 0xa38d, 0x40de, 0xaa, 0x59, 0x20, 0x7e, 0x9... | TOOL | 0.880135 | 5.282444 |
23cf9afc-b931-4424-8776-8c82c61adf2d | baejun10/DataStructure-FileExplorer | fe.cpp | #include "include/argparse.hpp"
#include "Algorithm/fileinfo.hpp"
#ifndef __STDLIB_H__
#include <stdlib.h>
#endif
#ifndef __FSTREAM__
#include <fstream>
#endif
#ifndef __FILESYSTEM__
#include <filesystem>
#endif
using namespace std;
int main(int argc, char *argv[]) {
argparse::ArgumentParser program("FileExplo... | TOOL | 0.989427 | 4.501939 |
40b1700b-6f0a-4446-b6c6-5e4df8608656 | raincross7/code-similarity | codes/train_code/problem452/problem452_298.cpp | #define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void) {
int n;
cin >> n;
ll k;
cin >> k;
vector<P> v(n);
rep(i, n) {
int a,... | ALGO | 0.999987 | 3.815744 |
a24b1279-b731-47c6-8c6f-11e2042912e2 | khan0531/algorithm | BOJ/sort/test.cpp | #include <bits/stdc++.h>
using namespace std;
bool cmp(const pair<int, string>& a, pair<int, string>& b) {
if (a.first != b.first) return a.first < b.first;
return false;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
pair<int, string> p[100];;
for (int i = 0;... | ALGO | 0.999914 | 4.484353 |
9ff7f865-fd18-463f-9b96-017adfa21d7f | loliTerrorist/compstuff | sprout_pre/pB.cpp | #include <bits/stdc++.h>
#define pb push_back
#define endl "\n"
#define ll long long
using namespace std;
ll frac(int x){
int ans = 1;
if(x<=1) return 1;
if(x%2){
return 2*x*pow(frac((x-1)/2),2);
}else{
return 2*pow(frac(x/2),2);
}
}
void printvec(vector<string> vec){
for(auto s... | ALGO | 0.999918 | 4.486899 |
57e1244a-8e35-44fe-a93c-2e632b7f60bc | AliOsm/CompetitiveProgramming | UVA/1207 - AGTC.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <memory.h>
using namespace std;
const int N = 5000;
int dp[N][N];
string a, b;
int calc(int i, int j) {
if(i == a.size())
return b.size() - j;
if(j == b.size())
return a.size() - i;
int &res = dp[i][j];
... | ALGO | 0.999859 | 4.072427 |
00f78fb8-62a7-49a0-a296-24e22d354d18 | MohjjamDange/CPP-Programming_Practice | C++ Programing Practice/CL33.cpp | #include<iostream>
using namespace std;
class Demo
{
public :
void Addition(int x)
{
cout<<"Inside the 1st Function"<<endl;
}
void Addition(int x, int y)
{
cout<<"Inside the 2nd Function"<<endl;
}
void Addition(int x, int y, int z)
{
cout<<"Inside the 3rd Function"<<endl;
}
};
i... | TOOL | 0.95986 | 5.070018 |
d0a3eca4-0876-45ca-8bb9-31f89a5d2971 | ankitkgiri/LeetCode-Solutions | 77-combinations/77-combinations.cpp | class Solution {
public:
vector<vector<int>> combine(int n, int k) {
vector<vector<int>> result;
int i = 0;
vector<int> p(k, 0);
while (i >= 0) {
p[i]++;
if (p[i] > n) --i;
else if (i == k - 1) result.push_back(p);
else {
++i;
p[i] = p[i - 1];
}
}
return result;
}
}; | ALGO | 0.99998 | 5.84677 |
d8fee021-e4d6-40bf-a617-b23afb67eab3 | anand-96/Competitive-Codes | Hackerearth/sort_substring.cpp | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
int t,n,m;
string s,str="",x;
cin>>t;
while(t--){
cin>>s>>n>>m;
str="";
for(int i=0;i<n;i++)
str+=s[i];
x=s.substr(n,m... | ALGO | 0.999797 | 3.770235 |
c90e8874-f045-41c3-adc9-940e84949185 | Kang-il/TIL | math/math_ex01.cpp | #include <iostream>
//유클리드 호제법
int GCD(int a,int b){
if(b==0){
return a;
}else{
return GCD(b,a%b);
}
}
int GCD2(int a,int b){
while(b!=0){
int r=a%b;
a=b;
b=r;
}
return a;
}
bool prime(int n){
if(n<2){
return false;
}
for(int i=2; i... | ALGO | 0.999739 | 3.738081 |
fb7a566c-4c59-4412-bc81-485b4914fc88 | sprkrd/codeforces | contests/1985/E/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
uint64_t x;
cin >> x;
uint64_t y;
cin >> y;
uint64_t z;
cin >> z;
uint64_t k;
cin >> k;
ui... | ALGO | 0.999958 | 3.928328 |
28beaa2f-46bc-4d50-af68-6154bb89d86c | OptimAssaSin/Hacktober-Fest | C++/Hard/18.cpp | #include <iostream>
int faultyRecursiveFunc(int n) {
if (n < 0) {
return 0;
}
return faultyRecursiveFunc(n - 1);
}
int main() {
int result = faultyRecursiveFunc(1000000);
std::cout << "Result: " << result << std::endl;
return 0;
}
| ALGO | 0.999121 | 5.894433 |
d8ee8b25-9d89-4094-bd93-8144724d689d | Iam-Sodhi/DSA | Graphs/Representation.cpp | #include <iostream>
#include<vector>
using namespace std;
int main()
{ int n, m; // n-> no of nodes and m-> no of edges
cin>>n>>m;
int N=1e5+1;
vector<int> adj[N];
// 1
// / \
// 2 3
// /|\\ \
// 4 5 6\ |
// \ |
// 7
int x,y;
for (int i = 0; i < m; i++)... | ALGO | 0.999915 | 4.003516 |
afdb305a-fec5-4ff1-8bbc-ce64d2a2ed3e | ArnabDas2003/leetcode-solution | 0031-next-permutation/0031-next-permutation.cpp | class Solution {
public:
void nextPermutation(vector<int>& nums) {
int n = nums.size();
int i = n - 2;
// Step 1: find first decreasing element
while (i >= 0 && nums[i] >= nums[i + 1]) {
i--;
}
// Step 2: if found, find just larger element on right side
if (i >= 0) {
... | ALGO | 0.99998 | 6.150999 |
37fc38b1-b498-4ac8-8449-153110045aac | Loai-Hataba/Data-Structures-CS214 | Assignment 1/A1_20230553_20230231_20230121/Problem 4/main.cpp | #include <iostream>
#include <cstdlib>
#include <thread>
#include "SortingSystem.h"
#include "Methods.h"
using namespace std ;
#define RESET "\033[0m"
#define RED "\033[1;31m"
#define GREEN "\033[1;32m"
#define YELLOW "\033[1;33m"
#define BLUE "\033[1;34m"
#define MAGENTA "\033[1;35m"
#define CYAN "\03... | ALGO | 0.942621 | 4.450389 |
bf6478fb-ec60-400a-b9b0-af42d4210aa2 | raghuls33/day5 | day 5/5.3.cpp | #include <stdio.h>
int main() {
int n, t1 = 0, t2 = 1, nextTerm;
printf("Enter the number of terms: ");
scanf("%d", &n);
printf("Fibonacci Series: ");
for (int i = 1; i <= n; i++) {
printf("%d, ", t1);
nextTerm = t1 + t2;
t1 = t2;
t2 = nextTerm;
}
return ... | ALGO | 0.999736 | 4.376368 |
7e19fbd3-86ac-4dd4-8554-d3ba2593b139 | Abhijitt25/study_c | Lab Assignments/Lab1/add two numbers.cpp | #include <iostream>
using namespace std;
int main ()
{
int a , b ;
cout<<"enter the two numbers = "<<endl;
cin>>a>>b;
int sum = a+b ;
cout<<"sum is = "<<sum<<endl;
return 0;
}
| TOOL | 0.874521 | 3.311707 |
0968a06d-c257-44e5-9b2d-f8f7cbb714c8 | StdDongcheol/AlgorithmTest | 1743/1743.cpp | // 1743.cpp : 이 파일에는 'main' 함수가 포함됩니다. 거기서 프로그램 실행이 시작되고 종료됩니다.
//
#include <iostream>
#include <queue>
int arr[101][101];
bool Check[101][101];
int N, M, K;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int BFS(int _X, int _Y)
{
std::queue<std::pair<int, int>> q;
int Size = 1;
q.push({_X, _Y});
Chec... | ALGO | 0.999977 | 4.618153 |
d4f16bab-22e4-4d10-b5fb-c29e37aca903 | ocya/PAT-DatastructStudy2ndVersion | 6-1-7.cpp | #include <iostream>
#include <vector>
#define MaxVertexNum 101
#define INFINITY 65536
using namespace std;
typedef int Vertex;
typedef int WeightType;
typedef struct ENode *Edge;
struct ENode{
Vertex V1, V2;
WeightType Weight;
};
typedef struct GNode *MGraph;
struct GNode{
int Nv, Ne;
WeightType G[... | ALGO | 0.999962 | 3.766198 |
d6adbfcf-a905-446f-855c-895557e9bbc8 | BhavyaPopli7/CrackYourPlacement | Day 8/Topologicalsort.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return list containing vertices in Topological order.
vector<int> topoSort(int V, vector<int> adj[])
{
vector<int>indegree(V);
queue<int>qt;
for(int i=0;i<V;i++){
... | ALGO | 0.999917 | 6.760761 |
2a2b474c-953f-42a4-9430-78a06373d164 | Anup050/DSA | 0199-binary-tree-right-side-view/0199-binary-tree-right-side-view.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.999713 | 6.383526 |
740307f5-b45a-4161-81c9-fa4ac369499b | AniketKul/CMPS229_OpenLambda_Ceph | experiments/single-node/docker/boost/libs/spirit/classic/example/fundamental/stuff_vector.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// This sample demontrates a parser for a comma separated list of numbers
// This is the phoenix version of number_list.cpp.
// This is discussed in the "Phoenix" chapter in the Spirit User's Guide.
//
// [ JDG 1/12/2004 ]
//
///////... | TOOL | 0.979602 | 7.116484 |
90dc05c8-6e93-46a8-82ef-d93c12b3f0c5 | approjecthub/CP_practice | sliding window/distinctElements.cpp | // https://practice.geeksforgeeks.org/problems/count-distinct-elements-in-every-window/1/
vector<int> countDistinct(int A[], int n, int k)
{
// code here.
unordered_map<int, int> umap;
int strt = 0, mapSize = 0;
vector<int> ans;
for (int i = 0; i < n; i++)
{
umap[A[i]]++;
if (um... | ALGO | 0.999763 | 5.419069 |
bcda7bbe-b072-47dc-9c41-e5e9637ffc53 | nitinrathodsvnit/LeetCode | 114-flatten-binary-tree-to-linked-list/114-flatten-binary-tree-to-linked-list.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.999947 | 5.960843 |
0a24c1ec-f762-4bb3-80eb-c04299edbc8c | Storkycold/BOJ | 25305.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int N, k;
vector<int> v;
cin >> N >> k;
for (int i = 0; i < N; i++)
{
int x;
cin >> x;
v.push_back(x);
}
// sort
sort(v.begin(), v.end());
// k번째 상
cout << v[... | ALGO | 0.999977 | 4.262049 |
338c583a-598d-499f-9a74-0dad07a8c867 | NEELMCW/MCW_CPPAMP_TORCH | gputorch/lib/THC/gpunn-impl/SoftMax.cpp | #define MINUS_LOG_THRESHOLD -18.42
#define SOFTMAX_THREADS 256
void gpunn_SoftMax_updateOutput_kernel(Concurrency::array_view<float,1> &avOutput, long outOffset,
Concurrency::array_view<float,1>&avInp, long inpOffset,
int nframe, int dim)
{
... | DATA | 0.997849 | 6.478303 |
9baf1406-383b-45b5-b55b-b40160ddcbce | Ruben-Halmagyi/C-university-projects | Calculations-with-big-integers/NagyEgesz.cpp | #include <iostream>
#include "NagyEgesz.h"
using namespace std;
NagyEgesz::NagyEgesz(){
n=1;
elojel=1;
a=new int[1];
a[0]=0;
}
///NagyEgesz::~NagyEgesz(){delete []a;}
NagyEgesz::NagyEgesz(int e, int m, const int* szamjegyek){
if(szamjegyek[0]==0 && m!=1)
throw "Nem s... | ALGO | 0.997731 | 3.556404 |
ba685c5d-469a-4a15-85fc-46ab033d08f9 | ishandutta2007/codeforces | spacewalker/normal/948/B.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define MAX 1000000
using namespace std;
vector <int> maxDiv(MAX + 1, 0);
int main() {
maxDiv[0] = -1;
maxDiv[1] = -1;
for (int i = 2; i <= MAX; ++i) {
maxDiv[i] = i;
}
for (int i = 2; i <= MAX; ++i) {
if (maxDiv[i] == i) {
for (int toMark = 2*i; ... | ALGO | 0.99997 | 3.768219 |
2da7f3dc-9908-4291-b9ef-3fc2feb30784 | ashikapl/DSA | week1(intro)/tu3/pattern4.cpp | // Inverted Half Pyramid //
#include <iostream>
using namespace std;
int main()
{
int num;
cin >> num;
for (int row = 0; row < num; row = row + 1)
{
for (int col = 0; col < num - row; col = col + 1)
{
cout << "*"
<< " ";
}
cout << endl;
... | ALGO | 0.9999 | 4.500844 |
68a7d98d-7299-4b0e-b442-45b896e43c1a | fonte-nele/Competitive-Programming | URI Online Judge/uri1019.cpp | #include <iostream>
using namespace std;
int main()
{
int segundos, cont1=0, cont2=0;
cin >> segundos;
while(segundos >= 60)
{
if(segundos >= 3600)
{
segundos -= 3600;
cont1++;
}
else
{
segundos -= 60;
... | ALGO | 0.996239 | 3.900781 |
dfe07a64-2ef2-4143-85a1-04098924be82 | akshaykumar56/DataStructure | Tree/Traversal.cpp | // Binary Tree in C++
#include <stdlib.h>
#include <iostream>
using namespace std;
struct node
{
int data;
struct node *left;
struct node *right;
};
// New node creation
struct node *newNode(int data)
{
struct node *node = (struct node *)malloc(sizeof(struct node));
node->data = data;
node->left = NU... | ALGO | 0.999929 | 6.364759 |
6146f914-966d-43c1-86c6-b493a27f1a35 | kollarikbalint/LEET-Challenge | TwoSum.cpp | #include "vector"
class Solution {
public:
std::vector<int> twoSum(std::vector<int>& nums, int target) {
const int length = size(nums);
for(int i = 0; i <= length; i++) {
for(int j = 1; j <= (length - 1); j++) {
if(i == j) continue;
if((nums[i] + nums[j]... | ALGO | 0.999928 | 6.216346 |
58f17901-d42d-4198-8013-ff69483a6611 | Art3m1sHun/DSA | xau ki tu/Chuan hoa ten 3.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
char toupper(char ch) {
if (ch >= 'a' && ch <= 'z') {
return ch + 'A' - 'a';
}
return ch;
}
char tolower(char ch) {
if (ch >= 'A' && ch <= 'Z') {
return ch + 'a' - 'A';
}
return ch... | ALGO | 0.998842 | 4.959742 |
d38b5ad8-c749-4a71-803e-bd0e4057a2b8 | junah201/Atcoder | ABC308/D.cpp | /* Code By [ junah ]
GitHub : [ junah201 ] */
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define int long long int
#define INF LONG_LONG_MAX
void dprintf(const char *__format, ...)
{
#ifndef ONLINE_JUDGE
va_list args;
va_start(args, __format);
vprintf(__format, args);
... | ALGO | 0.999984 | 4.714115 |
119ad408-07e2-4e41-83da-486ef4afaeea | 8ad40n/DSA-Playground | Basic-Maths/euclidean_algorithm.cpp | #include<bits/stdc++.h>
using namespace std;
int findGCD(int n1, int n2)
{
// O(log phi(min(a,b)))
while (n1>0 && n2>0)
{
if(n1>n2)
{
n1%=n2;
}
else
n2%=n1;
}
if(n1==0)
{
return n2;
}
return n1;
}
int main()
{
int n... | ALGO | 0.999795 | 5.758104 |
43b0b7b9-0894-41ab-ab39-b5abf6aa586a | sultansakur/project | mobil_deneme/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.998452 | 6.763923 |
c2ceefa6-639a-4c84-ae69-9092ff6aa906 | Khang080704/Year-1 | NMLT/TH/22120152_Tuần 3/ReNhanh_Bai3.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
char c;
cout<<"Nhap vao 1 chu cai tu a den z: "; cin >> c;
if(c >= 'a' && c <= 'z'){
c = c - 32;
}
else{
if(c >= 'A' && c <= 'Z'){
c = c + 32;
}
}
cout <<"Ki tu chuyen doi sang chu hoa/thuong la: "<<c;
}
| ALGO | 0.954965 | 3.689323 |
5cd641a5-7670-468d-8140-223afb4a44c2 | uysal-uysal/realtime-weather | data/venv/lib/python3.10/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.997615 | 7.198757 |
4e770160-4301-4427-8921-904f81ad665f | dhruvrjain/DSA | Leet_Code/Day_79_Single Number_II.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int i,j,ans=0,t,n=nums.size();
for(i=0;i<32;i++){
t=0;
for(j=0;j<n;j++){
t+=nums[j]&1;
nums[j]>>=1;
}
if(t%3)
ans|=1<<i;
}
return... | ALGO | 0.999955 | 5.320968 |
b000a070-eb74-4528-b333-512a4d2adf75 | JeffMony/AndroidFFmpegCompile | fdkaac-src/libSBRenc/src/sbr_misc.cpp | /* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
The Fraunhofer FDK AAC Codec Lib... | TOOL | 0.997806 | 6.063576 |
5c86aa3f-a90f-4c60-9d3c-c9701a339b61 | VladBaiceanu/Structuri-de-date-si-algoritmi | lab-05-tasks-main/tests/test-utils.cpp | #include "test-utils.hpp"
TreeNode* newNode(int data) {
TreeNode* newNode = (TreeNode*)malloc(sizeof(TreeNode));
newNode->val = data;
newNode->left = NULL;
newNode->right = NULL;
return newNode;
}
void inorderRec(TreeNode* root, TreeNode **arr, int size) {
static int idx = 0;
if (root) {
... | TEST | 0.915193 | 4.760745 |
2836c419-0cdf-4ee5-a25a-9988edc4f253 | Turing1887/FEAS | FEAS/VideoPlayer/facerecognizer.cpp | /*
This example program shows how to find frontal human faces in an image and
estimate their pose. The pose takes the form of 68 landmarks. These are
points on the face such as the corners of the mouth, along the eyebrows, on
the eyes, and so forth.
This example is essentially just a version of ... | TOOL | 0.904762 | 4.194151 |
b3995875-f217-478e-9f87-5e2d57ebacf4 | apurva-bhardwaj/DSE | DAA Lab/WEEK 01/BinarySearchTree.cpp | #include<iostream>
using namespace std;
struct Node{
int data;
Node* llink;
Node* rlink;
};
Node* insert(Node* root,int d){
Node* temp = new Node();
temp->data = d;
temp->llink = temp->rlink = NULL;
if(root==NULL){
root = temp;
return root;
}
if(d<root->data){
... | ALGO | 0.999979 | 4.497273 |
2cba154e-bf41-472b-bcfa-ed7209e5a880 | Centinoughty/leetcode | 2843.cpp | // Count symmetric integers
// EASY
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int countSymmetricIntegers(int low, int high) {
int res = 0;
for (int i = low; i <= high; i ++) {
string s = to_string(i);
int len = s.length();
if (len % 2) {
continue;
... | ALGO | 0.999709 | 6.188245 |
23329dca-12a7-4759-afd7-9453d533ddc2 | bthdimension/ExercisesPhysicallyBased | Game/project/implementation/Solver.cpp | #include "Solver.h"
//#include "Utils.h"
Solver::Solver() {
_constraintStack = std::vector<ConstraintStackElement>();
//_lambda = VectorXf::Zero(_s);
}
void Solver::setRididBodyIndices(std::vector<ARigidBodyOctree*> bodies) {
for (std::vector<ARigidBodyOctree*>::size_type i = 0; i != bodies.size(); i++) {
bodies... | ALGO | 0.998372 | 5.305031 |
9b3ee9d0-913e-42f0-b053-33cb20ca5a19 | SakshamVerma122/C-Codingblocks-Algo- | 2_Character_array/5_finding_length_of_largest_string_effiecient.cpp | #include<iostream>
#include<cstring>
using namespace std;
int main()
{
int row;
cout<<"Enter the number of rows : ";
cin>>row;
//char ch_2[1000];//This is to assign memory to the pointer of type char
char ch_1[1000];
int max_len=0;
//char *ch;
char ch[1000];
//ch=ch_2;
for(int i=... | ALGO | 0.994709 | 3.834981 |
b248aaed-0a31-4792-bb64-f028c42b3a51 | jNikolov98/cpp-fundamentals-november-2017 | Lect01Homework/03.QuadraticEquationSolver.cpp | /*
Write a program that enters the coefficients a, b and c of a quadratic equation a*x2 + b*x + c = 0 and
calculates and prints its real roots. Note that quadratic equations may have 0, 1 or 2 real roots. You can check your
program against this: https://www.mathsisfun.com/quadratic-equation- solver.html
... | ALGO | 0.999028 | 4.959912 |
3b36fb82-9c39-4011-8a7b-d03d7e219b6c | ishandutta2007/codeforces | andreasyan/normal/487/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 100005;
int n;
int ast(int x, int m)
{
int ans = 1;
while (m)
{
if (m % 2 == 1)
ans = (ans * 1LL * x) % n;
x... | ALGO | 0.999967 | 3.756739 |
57f7a9ea-19af-4f95-a8a6-51eee2d13c2e | TahaHassan9614/Practice-C- | Bubble sort.cpp | #include<iostream>
using namespace std;
int main(){
int array[5];
cout<<"Enter 5 numbers randomly : "<<endl;
for(int i=0; i<5; i++)
{
cin>>array[i];
}
cout<<endl;
cout<<"Input array is: "<<endl;
for(int j=0; j<5; j++)
{
... | ALGO | 0.999783 | 3.361246 |
b06a9556-0874-42aa-b874-df8bb913955d | deepakkasera/Algorithms | Game Theory/GrundyNumbers.cpp | #include <bits/stdc++.h>
using namespace std;
int calculateMex(set <int> s)
{
int mex = 0;
while(s.find(mex) != s.end())
mex++;
return mex;
}
int calculateGrundy(int n)
{
if(n == 0)
return 0;
set <int> s;
for(int i=1;i<=n;i++){
s.insert(calculateGrundy(n-i));
}
return calculateMex(s);
}
int main(int ar... | ALGO | 0.999773 | 5.21888 |
942731d2-94f8-4c81-8c0e-10f20e4e7b8e | janisivanoov/Everything-CPP | Task_4_18_12_2021.cpp | #include <iostream>
using namespace std;
int getPentagonalNumber(int);
int main()
{
cout << "The first 100 pentagonal number are:" << endl;;
for (int i = 1; i < 101; i++) {
int num = getPentagonalNumber(i);
cout << num << endl;
}
}
int getPentagonalNumber(int n)
{
return n * (3 * n - 1) / 2;
} | ALGO | 0.998903 | 4.496887 |
174ab5ac-bb2a-4c89-94e5-d9d04473b91c | taschekuller/Metu_HWs | ceng301/3rd/301hw3/in/in55.cpp | #include <iostream>
#include "../your_code/ScapegoatTree.cpp"
int main() {
ScapegoatTree<int> *a=new ScapegoatTree<int>;
std::cout << "Line no:" << 5 << " " << (a->insert(487)) << std::endl;
std::cout << "Line no:" << 6 << " " << (a->remove(487)) << std::endl;
std::cout << "Line no:" << 7 << " " << (a->insert(151)) << ... | ALGO | 0.968366 | 3.381347 |
d0284436-aaf2-4e36-913f-dd373eae5c06 | dkmishra2407/Leetcode-Solutions | 100-same-tree/same-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.99993 | 6.369348 |
ca313745-e605-4ec1-b9af-3415318bfac7 | mdhanapal1812/Leetcode-Programming-Challenges | single_number_3/Solution.cpp | class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
map<int,int>numsCount;
vector<int>check;
for(int i=0;i<nums.size();i++){
if(numsCount[nums[i]] >= 1){
numsCount[nums[i]]++;
}else{
numsCount[nums[i]] = 1;
... | ALGO | 0.999939 | 5.536095 |
6d044da5-db27-4369-8e08-ff1e6440ce1e | smmahadee/learn_c_cpp_dsa | 3.phitron_algorithm/module-13(recap)/1.matrix_adjacency_list_edge_list_representation.cpp | #include <iostream>
using namespace std;
int main() {
int n, e;
cin >> n >> e;
// edge list for storing given edges
vector<pair<int, int> > edgeList;
for (int i = 0; i < e; i++) {
int a, b;
cin >> a >> b;
edgeList.push_back(make_pair(a, b));
}
for (int i = 0; i ... | ALGO | 0.99809 | 3.370827 |
59a1d57a-6b8e-4e38-9740-7bc573851ee2 | Mike-hd123/university | cpp/阶乘.cpp | #include<iostream>
using namespace std;
float fun(int n)
{
float j=1,s=1;
for(int i=2;i<=n;i++)
s+=1.0/(j+=i);
return s;
}
int main()
{
int n;
cout<<"请输入S=1+1/(1+2)+1/(1+2+3)+…….+1/(1+2+3+4+……+n)中的n值:"<<endl;
cin>>n;
cout<<"fun("<<n<<"):"<<fun(n)<<endl;
} | ALGO | 0.999757 | 3.266561 |
14024c49-b8e3-45b7-93fc-96737aa5faea | 759713112/my_ceph | src/boost/libs/hana/benchmark/transform/execute.std.vector.erb.cpp | #include "measure.hpp"
#include <algorithm>
#include <cstdlib>
#include <vector>
int main () {
boost::hana::benchmark::measure([] {
long long result = 0;
for (int iteration = 0; iteration < 1 << 10; ++iteration) {
std::vector<int> values = {
<%= input_size.times.map { 's... | TEST | 0.878581 | 3.845236 |
e9f44201-a5f1-4e95-8ae6-db386ab04a8f | skadesplaire01/Secure-Online-Payment-System-Using-RSA-Encryption | payment_system.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <cmath>
// Function to perform modular exponentiation
long long modExp(long long base, long long exp, long long mod) {
long long result = 1;
base = base % mod; // Take mod of base
while (exp > 0) {
if (exp % 2 == 1) { // If exp is od... | ALGO | 0.997032 | 5.642004 |
af933d1c-a26e-4b9a-9c2e-01d18c52b290 | dabbingpenguin/17CFinalProject | CIS17CProject-Chess-AnshSrivastava/GeneralHashFunctions.cpp | #include "GeneralHashFunctions.hpp"
unsigned int RSHash(const std::string& str)
{
unsigned int b = 378551;
unsigned int a = 63689;
unsigned int hash = 0;
for(std::size_t i = 0; i < str.length(); i++)
{
hash = hash * a + str[i];
a = a * b;
}
return hash;
}
/* End Of RS Hash F... | ALGO | 0.998596 | 6.332363 |
445fb082-fac1-461b-a44c-45017da49cba | ccs-1l-f23/eiriniallolib | cookbook/blob/main.cpp |
#include "al/app/al_DistributedApp.hpp"
#include "al/math/al_Random.hpp"
#include "al/app/al_GUIDomain.hpp"
#include "al_ext/statedistribution/al_CuttleboneDomain.hpp"
#include "al_ext/statedistribution/al_CuttleboneStateSimulationDomain.hpp"
#include <Gamma/Noise.h>
using namespace al;
#include <iostream> // cou... | TOOL | 0.951424 | 6.436681 |
a2ae0a48-ff05-4119-a534-042e4062094e | JoseVerissimoLamas/UniversityProjects | 3rd Year/LaboratoriosProgramacaoAvancada/trabalho 3/SrcCodes/Cv2.cpp | #include <stdio.h>
#include <stdlib.h>
#include <climits>
/*
typedef struct edges{
double length;
double server;
}Coord;
*/
// variáveis gerai (todas são globais para minimizar a passagem de argumentos)
//int adjEdge[][] adjacency matrix - usamos um vetor linear
int *adjEdge; // edges of a undirected graph: a... | ALGO | 0.999205 | 3.309229 |
d8948b5c-a9f8-4ec7-aa51-553ccb315d94 | Ashishr1234/Leetcode-Solutions | C++/count-complete-tree-nodes.cpp | // Time: O(h * h) = O((logn)^2)
// Space: O(1)
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
int countNodes(TreeNode* root) {
int c... | ALGO | 0.999964 | 6.961207 |
252bf349-19e4-46d4-a006-3adf52c21b01 | valber-8/geosci | lmp/alt/KSPACE/pair_born_coul_msm.cpp | /* ----------------------------------------------------------------------
Contributing author: Stan Moore (SNL), Paul Crozier (SNL)
------------------------------------------------------------------------- */
#include "math.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "pair_born_coul_msm.h... | ALGO | 0.999787 | 5.884023 |
3e0389af-9f3c-4b47-8532-08d86da0e8aa | YoganshWagh/Leetcode | 2000-reverse-prefix-of-word/Approach_1.cpp | //QUESTION: https://leetcode.com/problems/reverse-prefix-of-word/description/
//Appraoch 1: Using Two pointer.
//T.C = O(n), in the worst case the character 'ch' will be in end.
//S.C = O(1), since extra amount of space is used.
class Solution {
public:
string reversePrefix(string word, char ch)
{
int ... | ALGO | 0.999974 | 6.329909 |
799a6536-9646-46c0-b78b-e62f07a6d986 | sezalmittal987/black-ravens-notes | 25Apr/0-1Knapsack.cpp | /*
*/
// solution 1
class Solution
{
public:
//Function to return max value that can be put in knapsack of capacity W.
// i -> current index
// w -> current weight
// v -> current value
int ans = 0;
void recur(int W, int wt[], int val[], int i, int w, int v ){
ans = max( ans, v);
... | ALGO | 0.999998 | 5.636461 |
0ca79d56-2929-4c3c-8fa0-335eb07c86fc | Zannatul-Naim/Compiler-Design-Lab | problem_04.cpp | #include <bits/stdc++.h>
using namespace std;
bool isInt(string word) {
if(word.size() == 0) return false;
if(word[0] == '0') return false;
for(int i = 1; i < word.size(); i++) {
if(!isdigit(word[i])) return false;
}
return true;
}
bool isVariable(string word) {
if(tolower(word[0]) < ... | ALGO | 0.991756 | 4.244293 |
389947dd-321a-46b1-a544-822d648c3abe | josepadial/UGR_GII_FP | Prácticas/Sesión 4/Tres valores ordenados.cpp | /*Nombre: Jos Antonio Padial Molina
Curso: 1C
Fecha: 12/10/2016
Sesin 4 Ejercicio 7
*/
#include<iostream>
using namespace std;
int main(){
// Vamos a declarar las variables
int entero1, entero2, entero3;
bool ordenado = false;
cout << "Introduzca un entero: ";
cin >> entero1;
cout << "Introduzca un ent... | ALGO | 0.998863 | 4.062278 |
6140a240-31c4-4761-a94c-5be71e208ae0 | Dranos-Nupper/BFACoreN | dep/g3dlite/source/stringutils.cpp | /**
\file stringutils.cpp
\maintainer Morgan McGuire, http://graphics.cs.williams.edu
\created 2000-09-09
\edited 2011-08-20
*/
#include "G3D/platform.h"
#include "G3D/stringutils.h"
#include "G3D/BinaryInput.h"
#include <algorithm>
#ifdef G3D_WINDOWS
extern "C" {
// Define functions for ffmpeg since w... | TOOL | 0.958146 | 6.404016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.