uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9ebe3e46-2208-4bdc-83b6-10ce32ac0484 | yosukesan/traning | at_coder/abc061/a/main.cpp |
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <vector>
#include <queue>
typedef long long ll;
const ll LL_MAX (1LL<<60);
#define rep(i,s,e) for(ll i=(s); i<(e); i++)
using namespace std;
int main()
{
cin.tie(0);
ios::sync_with_stdio(f... | ALGO | 0.999967 | 3.70632 |
d840d65a-cbbd-4f98-a99c-dc8b89fd1134 | durgaprasadpara/192011183-DAA-Lab- | amstrong number.cpp | #include<stdio.h>
#include<conio.h>
int main()
{
int sum=0,temp;
int n;
int rem;
printf("enter the number:\n");
scanf("%d",&n);
temp=n;
while(n>0)
{
rem=n%10;
sum+=rem*rem*rem;
n=n/10;
}
if(temp==sum)
printf("amstrong number");
else
{
printf("not an amstrong number");
}
return 0;
}
| ALGO | 0.99966 | 3.075786 |
da7b3b0e-4abc-4adb-a8e7-fa3c157acbef | Madhusudan0012/StriverSDE | Longest subarray with sum k.cpp | #include<bits/stdc++.h>
int longestsubarrayWithSumK(vector<int> a , long long k){
int left = 0, right = 0 ;
long long sum =a[0];
int maxLen = 0;
int n = a.size();
while(right<n){
while(left<=right && sum>k){
sum-=a[left];
left++;
}
if(sum==k){
maxlen = max(maxLen , right - left + 1);
}
right... | ALGO | 0.999807 | 4.854224 |
82ab21f7-53bc-42c7-9fa0-3870c929fce3 | WCE-Programmers-Batch-24/Practice-Question | Day 17/Q.2]/Ravi.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
ll n,m,l;
cin>>n>>m>>l;
vector<ll> store(1000001,0);
// 1 2 3
// 4 5 6
// 7 9
// v... | ALGO | 0.999838 | 3.555699 |
d87fdc15-b6e0-4c63-9e32-ab70098440ea | ishandutta2007/codeforces | dragonslayerintraining/normal/675/C.cpp | #include <iostream>
#include <map>
long long N;
long long as[100000];
int main(){
std::cin>>N;
for(long long i=0;i<N;i++){
std::cin>>as[i];
}
long long prop=0;
std::map<long long ,long long > trans;
long long best=0;
for(long long i=0;i<N;i++){
prop+=as[i];
trans[prop]++;
best=std::max(b... | ALGO | 0.999388 | 3.988191 |
cf2b59ad-e451-46fb-a110-0ef28ecaf231 | mattjr/benthicQT | util/UF-3.2/GeographicConversions/ufECEF.cpp |
#include "ufECEF.h"
#include <cmath>
using namespace UF::GeographicConversions;
ECEF::ECEF( std::string const & EllipsoidName ) :
Ellipsoid( EllipsoidName )
, rtd(45.0/std::atan(1.0))
, dtr(std::atan(1.0)/45.0)
, pi2(2.0*std::atan(1.0))
{}
void ECEF::toECEF ( double const & latitude, double const & longitud... | ALGO | 0.96757 | 6.973348 |
fe370d8e-8580-4d97-9556-e1608672b64e | dawidox123/gitrepo | cpp/nieparzyste.cpp | /*
* nieparzyste.cpp
*
*
*
*/
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
int n;
cout << "podaj liczbe: ";
cin >> n;
for (int i =1;i<n;i+=2) {
cout << i << " ";
}
return 0;
}
| ALGO | 0.992927 | 3.925583 |
a58465dd-7ec6-4ff0-a425-b9050328d10a | RaniKumariGupta/15-Tile-Shifter | sliding_puzzle/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.998376 | 6.763549 |
09fd0d24-c7b5-46b6-a3ee-fe2e3d6c1d57 | sokampdx/ProjectEuler | pe035.cpp | #include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <cstring>
using namespace std;
const unsigned long MAX = 1000000;
const unsigned long LIMIT = 1000;
bool prime[MAX];
bool cirPrime[MAX];
void initialize() {
for (unsigned long i = 0; i < MAX; ++i) {
prime[i] = true;
cirPrime[i] ... | ALGO | 0.995818 | 4.714285 |
7983f8bb-d668-4736-b829-f8368cdeb055 | kim2001sh/codetree | 250129/팰린드롬 수 찾기/find-the-number-of-palindrome.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
// Please write your code here.
int x, y, cnt = 0;
cin >> x >> y;
for (int i = x; i <= y; i++) {
string s;
s = to_string(i);
bool flag = true;
for (int j = 0; j < s.length() / 2; j++) {
... | ALGO | 0.999956 | 4.510639 |
3ec68aca-c041-476a-9f8d-4c4611cb3acb | L1quid/Explosivo | jnetlib/ircclient.cpp | #ifdef _WIN32
#include <windows.h>
#include <malloc.h>
#else
#define Sleep(x) usleep((x)*1000)
#endif
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include "jnetlib.h"
#include "ircclient.h"
#include <string>
#include <algorithm>
#include <list>
bool g_settrace = false;
void dbgstr(const char *str,...);
... | WEB | 0.914804 | 4.184496 |
939c8396-a8e8-40d3-819e-f55b9d68255c | naumazeredo/competitive-programming | codeforces/586A.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
scanf("%d", &n);
int x = 0;
int l = -5;
for (int i = 0; i < n; ++i) {
int a;
scanf("%d", &a);
if (a) {
if (i-l!=2) x++;
else x+=2;
l = i;
}
}
printf("%d\n", x);
return 0;
}
| ALGO | 0.999818 | 3.810153 |
df2e3e07-0101-4e15-bf26-3b532d016d60 | ishandutta2007/codeforces | starlit/normal/864/D.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#define N 200005
using namespace std;
int n,a[N],num[N],b[N],ans,tot=1;
bool used[N],vis[N];
int main()
{
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",a+i),
used[a[i]]=1,num[a[i]]++;
for(int i=1;i<=n;i++)
if(num[i])ans+=num[i]-1;
for(int i=0... | ALGO | 0.999992 | 3.05404 |
cdd6b323-17c6-4f53-a14b-d368db60dca2 | shoupydad/CCDAuto | CCDAuto/dmat.cpp | #include <math.h>
void sla_DMAT(int N, double A[4][4], double Y[4], double D, int JF, int IW[4]) {
#define SFA 1.0d-20
int K, IMX, I, J, NP1MK, KI;
double AMX, T, AKK, YK AIK;
JF = 0;
D=1.0;
for (K=0; K<N; K++) {
AMX = fabs(A[K][K]);
IMX = K;
if (K != N) {
for (I=K+1; I<N; I++) {
T = fabs(A[I][K]... | ALGO | 0.999941 | 3.455503 |
4b48d938-91c2-48a7-90c0-5407210e5cbd | satvik-tha-god/Algorithms | Leetcode/linkedLists/gfgAndPractice/practiceGFG/reverseDLL.cpp | // problem link:https://www.geeksforgeeks.org/reverse-a-doubly-linked-list/
void reverse(Node **head_ref)
{
Node *temp = NULL;
Node *current = *head_ref;
/* swap next and prev for all nodes of
doubly linked list */
while (current != NULL)
{
temp = current->prev;
current->prev = ... | ALGO | 0.999925 | 3.431956 |
3447076e-9fe8-4dad-8000-e16f8ac479e9 | Handanhhhy/CSNote | notedoc/DataStructure/code/Deque.cpp | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
const int MaxSize = 6 + 1;
typedef int ElemType;
typedef struct queue
{
ElemType data[MaxSize];
int front, rear;
} Deque;
void InitQueue(Deque &S)
{
/*frontָͷrearָβһλ*/
S.front = S.rear = 0;
}
bool QueueEmpty(Deque &S)
... | ALGO | 0.992135 | 3.666993 |
7e05b1ec-ed62-4b1c-813f-d56a320b12c8 | katherine0504/Uva | 11597.cpp | #include <cstdio>
int n, cnt;
int main() {
cnt = 1;
while(scanf("%d", &n) != EOF) {
if (n == 0) {
break;
}
printf("Case %d: %d\n", cnt++, n/2);
}
return 0;
}
| ALGO | 0.996824 | 4.057141 |
80b8a574-0590-4151-898a-a167008a1f2e | sauravranjan07/leetcode-with-CPP | 0099-recover-binary-search-tree/0099-recover-binary-search-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.999994 | 6.258687 |
a9fb6460-9779-4456-b486-32b0fbf3f0c0 | Ajay-Goswami/leetcode | 12-integer-to-roman/12-integer-to-roman.cpp | class Solution {
public:
string intToRoman(int num) {
if (num == 0)
return string();
if (num >= 1000)
return "M" + intToRoman(num - 1000);
else if (num >= 900)
return "CM" + intToRoman(num - 900);
else if (num >= 500)
return "D" + intT... | ALGO | 0.999659 | 6.39324 |
e1e6e210-46de-4e02-b2e1-069748181cd4 | taesangkang/Bridge | Bridge/hw4/etk9373_hw4_q4.cpp | /*
*/
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int length_of_sequence;
bool breakCondition;
double userInput;
double product;
double mean;
cout << "Section A" << endl;
cout << "Please enter the length of the sequence: ";
cin >> length_of_sequence;
cout << "Please enter your sequence: " <... | ALGO | 0.999288 | 3.063593 |
7b6c2436-8d6c-4552-8628-f40138f9b7dc | ChoMk/algorithm | 투포인터/2143 두 배열의 합.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int T;
int N, M;
int A[1001], B[1001];
vector<int> va, vb;
long long ans;
int main() {
scanf("%d", &T);
scanf("%d", &N);
for (int n = 0; n < N; n++) scanf("%d", &A[n]);
scanf("%d", &M);
for (int n = 0; n < M; n++) scanf("%d... | ALGO | 0.999969 | 3.891302 |
5600649f-7b1f-4199-91d8-892b54a6dd93 | ishandutta2007/codeforces | jeroenodb/normal/1037/F.cpp | #include "bits/stdc++.h"
using namespace std;
#define all(x) begin(x),end(x)
typedef long long ll;
typedef vector<int> vi;
const long long MOD = 1e9+7;
struct mint {
int d;
mint () {d=0;}
mint (long long _d) : d((_d+MOD)%MOD){};
friend mint& operator+=(mint& a, const mint& o) {
a.d+=o.d;
... | ALGO | 0.999965 | 4.071107 |
415ae2de-0362-4fae-b34a-df087d8be407 | ht0919/atcoder | ABC/155/ABC155B.cpp | #include <iostream>
using namespace std;
int main() {
int N; cin>>N;
int A[N];
for (int i=0; i<N; i++) cin >> A[i];
bool f=true;
for (int i=0; i<N && f==true; i++) {
if (A[i]%2==0) {
if ((A[i]%3==0) || (A[i]%5==0))
;
else
f=false;
... | ALGO | 0.999942 | 4.666433 |
d29e9955-1458-41c2-84db-5b83f3323eaa | habib09/problem-solution | uva/10801 - Lift Hopping.cpp | #include <string.h>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <sstrea... | ALGO | 0.999213 | 3.939571 |
ee4f427f-fec0-4218-84f4-3e1d491402da | isha-web-dev/ib16 | reverse for while.cpp | #include<iostream>
using namespace std;
int main()
{
for(int i=10; i<=200; i++)
{
int reverse = 0, remain = 0, n = i, sod = 0;
while(n > 0)
{
remain = n % 10;
reverse = reverse * 10 + remain;
sod += remain;
n = n / 10;
}
if(reverse == i)
{
cout<<"palindrom"<<i<<"\t"<<"sum of digits is"<<s... | ALGO | 0.998397 | 4.179815 |
8a842d10-04e0-4fcd-814e-4c8012ade4d7 | PRANAVJARANDE/Leetcode-Solutions | medium/Maximum Product of First and Last Elements of a Subsequence.cpp | #define ll long long
class Solution {
public:
long long maximumProduct(vector<int>& nums, int m)
{
ll n=nums.size();
vector<ll>ps(n+1,INT_MIN),ns(n+1,INT_MAX);
for(int i=n-1;i>=0;i--)
{
ns[i]=min(ns[i+1],(ll)nums[i]);
ps[i]=max(ps[i+1],(ll)nums[i]);
... | ALGO | 0.999972 | 5.346582 |
5a253e7e-2cec-4780-9dc8-33635e3a2b5f | ahadulalam1005118/problemSolving | lightoj/1005.cpp | //
// Created by ahad on 5/29/18.
//
#include<iostream>
#include<algorithm>
#include<vector>
#include <cstring>
using namespace std;
unsigned long long int dp[35];
unsigned long long ncr[910][910];
unsigned long long int fact(int n) {
if(n==0) return dp[n] = 1;
if(dp[n]) return dp[n];
else return dp[n] = ... | ALGO | 0.999582 | 4.459277 |
ad304c3c-9b5c-437f-acb1-d1adcff2ff89 | nomospace/weseewe | frameworks/js-bindings/cocos2d-x/cocos/storage/local-storage/LocalStorageAndroid.cpp | /*
Local Storage support for the JS Bindings for iOS.
Works on cocos2d-iphone and cocos2d-x.
*/
#include "LocalStorage.h"
#include "base/CCPlatformMacros.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "jni.h"
#include "jni/JniHelper.h"
USING... | TOOL | 0.914645 | 6.225433 |
99e6cc8a-caf8-4327-9feb-b80dc44d39f0 | AI-4-SE/workload_coverage_companion | misc/code/z3/src/shell/dimacs_frontend.cpp | #include<iostream>
#include<time.h>
#include<signal.h>
#include "util/timeout.h"
#include "util/rlimit.h"
#include "util/gparams.h"
#include "sat/dimacs.h"
#include "sat/sat_params.hpp"
#include "sat/sat_solver.h"
#include "sat/tactic/goal2sat.h"
#include "sat/tactic/sat2goal.h"
#include "ast/reg_decl_plugins.h"
#inclu... | ALGO | 0.996326 | 5.238674 |
082fc6ef-b878-41bd-9e2e-cc732c49edfa | sh1min22/RCP | distributeData_relationships.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <fstream>
#include <sstream>
#include <sys/io.h>
#include <dirent.h>
using namespace std;
vector<vector<int>> conn_list;
vector<string> label_list;
vector<vector<int>> connected_component_list;
vector<string> relation... | DATA | 0.876006 | 3.466585 |
8b26ce5f-1ed5-44fd-849e-fbea69a49a69 | lsqyling/alg | oj/leetcode/sort.cpp | #include "../utilities.hpp"
namespace leetcode_912 {
class Solution {
public:
std::vector<int> sortArray(std::vector<int>& nums) {
merge_sort(nums, 0, (int)nums.size() - 1);
merge_sort_iterative(nums);
quick_3way_sort(nums, 0, (int)nums.size()-1);
quick_sort(nums, 0, (int)nums.size(... | ALGO | 0.99996 | 5.344676 |
064c1b25-f9d3-42c4-a188-1c0e81c97d5e | Ajinkya-24/Leetcode | 3682-count-the-number-of-arrays-with-k-matching-adjacent-elements/3682-count-the-number-of-arrays-with-k-matching-adjacent-elements.cpp | class Solution {
public:
const int MOD = 1e9 + 7;
vector<long long> fact, invFact;
// Modular exponentiation
long long power(long long x, long long y) {
long long res = 1;
x %= MOD;
while (y) {
if (y & 1) res = (res * x) % MOD;
x = (x * x) % MOD;
... | ALGO | 0.99999 | 5.562497 |
8ebc2ef0-0691-48ba-9b11-4e41994228a4 | DwyaneTalk/AlgorithmsAndDataSturctures | algorithmSolution/leetCodeC++/169_Majority Element.cpp | /* DwyaneTalk@gmail.co_m
* by lutao
* leetCodeC++ : Majority Element
* : https://leetcode.com/problems/majority-element/
*/
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#inclu... | ALGO | 0.99991 | 5.435706 |
9e03224f-5027-4f64-96db-32b30fd441a1 | rgosdin/my-Project | node-v10.16.0/deps/icu-small/source/i18n/collationcompare.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "unicode/ucol.h"
#include "cmemory.h"
#include "collation.h"
#include "collationcompare.h"
#include "collationiterator.h"
#include "collationsettings.h"
#include "uassert.h"
U_NAMESPACE_BEGIN
UCollationResult
CollationCompare::compareUpToQuaternary(Coll... | ALGO | 0.992831 | 7.350449 |
bb393bc4-1b6c-4f4b-93ba-c7d23e623831 | sarvex/leetcode-clojure | solution/1600-1699/1629.Slowest Key/Solution.cpp | class Solution {
public:
char slowestKey(vector<int>& releaseTimes, string keysPressed) {
char ans = keysPressed[0];
int mx = releaseTimes[0];
for (int i = 1, n = releaseTimes.size(); i < n; ++i) {
int d = releaseTimes[i] - releaseTimes[i - 1];
if (d > mx || (d == mx ... | ALGO | 0.999909 | 6.261845 |
ef73b810-d11c-49a4-9358-c29ae1d01db6 | opfeifle/SU2 | SU2_CFD/src/solver_adjoint_discrete.cpp | #include "../include/solver_structure.hpp"
CDiscAdjSolver::CDiscAdjSolver(void) : CSolver () {
}
CDiscAdjSolver::CDiscAdjSolver(CGeometry *geometry, CConfig *config) : CSolver() {
}
CDiscAdjSolver::CDiscAdjSolver(CGeometry *geometry, CConfig *config, CSolver *direct_solver, unsigned short Kind_Solver, unsigned sh... | ALGO | 0.99639 | 6.312923 |
d2a4fbb1-1bc7-4a97-8a5f-8432d19700bf | guptanikshay/DSA | 091_bst_questions1.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *left, *right;
Node(int val)
{
data = val;
left = right = NULL;
}
};
// CHECK WHETHER THE GIVEN TREE IS A VALID BST OR NOT
// Approach 1: Recursive with TC: O(N) and SC: O(N)
bool solve(Node *root, lo... | ALGO | 0.999984 | 5.56541 |
f6049586-6b2b-476d-8c90-d38bd655f680 | oudream/RobWork | RobWork/src/rw/math/ProjectionMatrix.cpp | #include "ProjectionMatrix.hpp"
#include <rw/math/Constants.hpp>
using namespace rw::math;
void ProjectionMatrix::setOrtho (double left, double right, double bottom, double top, double zNear,
double zFar)
{
double tx = -(right + left) / (right - left);
double ty = -(top + bot... | TOOL | 0.956951 | 6.431574 |
a6511302-9cdf-49a9-93b3-1427096af7d3 | jayakanth45/Data-structures-and-Algorithms | 1514-path-with-maximum-probability/1514-path-with-maximum-probability.cpp | class Solution {
public:
double maxProbability(int n, vector<vector<int>>& edges, vector<double>& succProb, int start_node, int end_node) {
vector<vector<pair<int, double>>> adj(n) ;
for(int i=0; i<edges.size(); i++)
{
adj[edges[i][0]].push_back({edges[i][1], succProb[i]}) ;
... | ALGO | 0.99998 | 6.625015 |
f71883a9-1295-4944-aaa6-2e6e4f164843 | ThisIsATest369/SensorsCalibration | lidar2imu/auto_calib/eigen3/bench/perf_monitoring/llt.cpp | #include "gemm_common.h"
#include <Eigen/Cholesky>
EIGEN_DONT_INLINE
void llt(const Mat &A, const Mat &B, Mat &C)
{
C = A;
C.diagonal().array() += 1000;
Eigen::internal::llt_inplace<Mat::Scalar, Lower>::blocked(C);
}
int main(int argc, char **argv)
{
return main_gemm(argc, argv, llt);
}
| ALGO | 0.998762 | 4.213493 |
0e326aab-e80b-40cf-9e8f-cac921d24054 | EasternMoonCN/leetcode | src/demo392.cpp | #include "utils/head.h"
/*
给定字符串 s 和 t ,判断 s 是否为 t 的子序列。
字符串的一个子序列是原始字符串删除一些(也可以不删除)字符而不改变剩余字符相对位置形成的新字符串。(例如,"ace"是"abcde"的一个子序列,而"aec"不是)。
进阶:
如果有大量输入的 S,称作 S1, S2, ... , Sk 其中 k >= 10亿,你需要依次检查它们是否为 T 的子序列。在这种情况下,你会怎样改变代码?
*/
class Solution
{
public:
static void printVal(int val)
{
cout << val <<... | ALGO | 0.999327 | 5.010038 |
1670484e-cd35-4e9f-9879-ccfc8c210f94 | s1neet/DataStructuresProblems | source/repos/Project5/Project5/UncrossedLinesDP.cpp | /*We write the integers of A and B (in the order they are given) on two separate horizontal lines.
Now, we may draw connecting lines: a straight line connecting two numbers A[i] and B[j] such that:
A[i] == B[j];
The line we draw does not intersect any other connecting (non-horizontal) line.
Note that a connecting lin... | ALGO | 0.99998 | 6.350772 |
a173e0bf-88fb-43c9-a29b-5d9ef50666e0 | FortressDEX/Fortress | src/coins.cpp | #include <coins.h>
#include <consensus/consensus.h>
#include <random.h>
#include <version.h>
bool CCoinsView::GetCoin(const COutPoint &outpoint, Coin &coin) const { return false; }
uint256 CCoinsView::GetBestBlock() const { return uint256(); }
std::vector<uint256> CCoinsView::GetHeadBlocks() const { return std::vecto... | TOOL | 0.852873 | 7.641175 |
690f3547-30ab-4938-b8c0-f6b31a1d9e92 | zackslay3r/C---Projects | PongDemo 3/aieBootstrap-master/dependencies/glm/test/core/core_func_integer_find_msb.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentatio... | ALGO | 0.999041 | 4.238858 |
eeee209d-4485-4e6d-9580-812f9e838387 | pavanbaloju/data-structures-and-algorithms | arrays/16_pivotIndex.cpp | #include <iostream>
#include <vector>
using namespace std;
// Function to find the pivot index in an array.
// A pivot index in an array is an index such that
// the sum of all elements to the left of it is equal to the sum of all elements to the right of it.
// If there is no such index, the function returns -1.
//... | ALGO | 0.999975 | 7.053568 |
12ac55f6-18a7-42be-9063-960caa14b1e9 | Imvajeed/DSA-with-cpp | samnple.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int arr[100],size=0;
int num;
while(cin>>num){
arr[size]=num;
size++;
}
for (int i = 0; i < size; i++)
{
if(arr[i]%3==0 && arr[i]%5==0){
cout<<"ThreeFive"<<" ";
}else if(arr... | ALGO | 0.999643 | 3.793002 |
d8b4ae6a-eacc-4b58-ab9d-526779d21f24 | JerryWu-code/IND5003-Lecture-NUS | python_notebooks/opencv-4.x/modules/gapi/src/compiler/passes/perform_substitution.cpp | #include "pattern_matching.hpp"
#include "ade/util/zip_range.hpp"
namespace cv { namespace gimpl {
namespace {
using Graph = GModel::Graph;
template<typename Iterator>
ade::NodeHandle getNh(Iterator it) { return *it; }
template<>
ade::NodeHandle getNh(SubgraphMatch::M::const_iterator it) { return it->second; }
tem... | TOOL | 0.895598 | 7.368718 |
ac774b7c-2eb9-4d41-8007-f8c79d18494b | heavenMOJANG/ICPC | .history/Codeforces/CF2019/B_20241017103015.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
void solve() {
int n, q; cin >> n >> q;
vector<int> a(n + 1);
for (int i = 1; i <= n; ++ i) cin >> a[i];
map<int ,in... | ALGO | 0.999597 | 3.948519 |
9a4bb07c-a35f-4dbb-9797-1e21193bb9f9 | Kawser-nerd/CLCDSA | Source Codes/AtCoder/abc048/B/2561574.cpp | #include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
#include<vector>
#include <string.h>
#include <math.h>
#include<map>
#include<string.h>
#define ll long long
using namespace std;
ll a,b,c;
int main()
{
cin>>a>>b>>c;
cout<<b/c-a/c+(bool)(a%c==0)<<endl;
... | ALGO | 0.999741 | 3.321093 |
958f6120-2b35-46aa-9275-c9c98500580b | 99sparsh/CodeforcesSolutions | E92/C.cpp | #include <bits/stdc++.h>
#define mod 1000000007
#define FOR(i, a, b) for (i = a; i < b; i++)
#define FastIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef priority_q... | ALGO | 0.99999 | 4.174003 |
c530eae8-aee5-4d91-a02d-6c44a463fc7e | thavananh/PTTKGT_GIUAKY_2024 | DeQuy/DynamicPrograming/CoinChange2.cpp | #include <iostream>
#include <vector>
#include <map>
using namespace std;
int soCach(vector<int>coins, map<int, int>& ghiNho, int amount, vector<bool> lock) {
if (amount == 0)
{
return 1;
}
if (amount < 0)
{
return 0;
}
int sum = 0;
for (size_t i = 0; i < coins.size... | ALGO | 0.999536 | 5.133607 |
71c2e3e6-b16f-4fc3-9434-43615cb85c19 | iamsile/ACM | Rock, Paper, or Scissors?.cpp | #include <iostream>
using namespace::std;
int main()
{
int m;
cin >> m;
while(m--)
{
int n,c=0,d=0;
char a,b;
cin >> n;
while(n--)
{
cin >> a >> b;
if((a=='R'&&b=='S')||(a=='S'&&b=='P')||(a=='P'&&b=='R'))
c++;
else if((b=='R'&&a=='S')||(b=='S'&&a=='P')||(b=='P'&&a=='R'))
d++;
}
if(c>... | ALGO | 0.999766 | 4.074546 |
04fb5896-5747-4459-aba2-14d326751630 | sqmedeiros/sblp2023-time-vs-energy | 1642-Sum_of_Four_Values/c++/rand30/907195.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fr first
#define sd second
#define mp make_pair
#define bg begin()
#define en end()
#define vi vector<int>
#define vll vector<ll... | ALGO | 0.999947 | 3.513759 |
dbdbaa56-e49b-47c3-923a-a367a380dd09 | MrAlexandrov/test | cpp/Contests/Codeforces Round #639 (Div. 2)/C/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pll;
string solve() {
ll n;
cin >> n;
vector <ll> a(n);
set <ll> s;
for (ll i = 0; i < n; ++i) {
cin >> a[i];
a[i] = ((a[i] % n) + n) % n;
s.insert((i + a[i]) % n);
}
return (s.... | ALGO | 0.999757 | 4.485117 |
252fbfd0-b5d8-43d1-8906-41a74f812d03 | DeepankRx/LeetCode | 383-ransom-note/383-ransom-note.cpp | class Solution {
public:
bool canConstruct(string ransomNote, string magazine) {
sort(ransomNote.begin(),ransomNote.end());
sort(magazine.begin(),magazine.end());
int i = 0;
int j = 0;
while(magazine[j]!='\0')
{
if(ransomNote[i]==magazine[j])
... | ALGO | 0.999942 | 5.747329 |
8e8fa1a9-b158-4d31-943c-7d282b989e2e | riteshbarman02/data-structure-and-algorithms | array/case.cpp | #include<iostream>
using namespace std;
int main(){
char a ;
cin >> a ;
if (a >= 'a' && a <= 'z'){
cout << "lowercase" ;
}
else if (a >= 'A' && a <= 'B'){
cout << "uppercase" ;
}
return 0;
} | ALGO | 0.973425 | 3.738298 |
7c46c831-15d7-49f9-9ee5-4b8e12e1957e | ProtonAOSP/android_frameworks_av | media/libstagefright/codecs/amrnb/common/src/lsp_az.cpp | /*
Pathname: ./audio/gsm-amr/c/src/lsp_az.c
Funtions: Get_lsp_pol
Lsp_Az
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template. First attempt at
optimizing C code.
Description: Deleted all Lo... | ALGO | 0.991586 | 6.412684 |
53835b4c-973d-4272-b30c-e87d8c07770c | DsylviaM/cpp_modul | cpp08/ex01/Span.cpp | #include "Span.hpp"
Span::Span() : N(0){
sorted = false;
}
Span::Span(unsigned int N) : N(N){
sorted = false;
}
Span::~Span() {}
Span::Span(Span const & src){
*this = src;
}
Span &Span::operator=(Span const & src){
std::vector<int>::const_iterator begin = src.content.begin();
std::vector<int>::const_itera... | ALGO | 0.953647 | 4.605638 |
838d7586-f538-43a6-a3c1-426427552cdf | ShamimAkhtar-bot/project4900 | project_flappy/FlappyBird.cpp | #include <iostream>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include <windows.h>
#include <time.h>
#define WIN_WIDTH 70
#define SCREEN_WIDTH 90
#define SCREEN_HEIGHT 26
#define GAP_SIZE 7
using namespace std;
void play();
void instructions();
void drawBorder();
void genPipe(int ind);
void updateScore... | TOOL | 0.929024 | 4.149783 |
3c0e382e-f36d-4375-9c2a-68017ab01514 | fadyZaherEng/ZegoApp | 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.998809 | 6.763549 |
368ff56d-d0b6-46c3-9b4a-3b3aade32b65 | mdhlimonmia/Codeforces_Problem_Solution | Fixing_Floor.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define Limon() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lli long long int
int main()
{
Limon();
lli x,y;cin>>x>>y;
lli a = x*y;
lli q = sqrt(a);
while(1)
{
if(a%(q*q) == 0 && x%q == 0 && y%q == 0){
... | ALGO | 0.999975 | 4.690205 |
3522a156-6bf3-48ca-9216-9588e160dc88 | Susilkandu/DSA | day5/rotateMatrix/rotate180Approach2.cpp | /*
rotate a matrix via 90 degree
given matrix is :-
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
outup will come :-
16 15 14 13
12 11 10 9
8 7 6 5
4 3 2 1
*/
#i... | ALGO | 0.9999 | 5.196882 |
81eba52b-a3ef-4e49-ab04-945f83650cfd | Dest1n640/OOP | 06_array/main.cpp | #include "./h/array.h"
#include <iostream>
using namespace std;
void task(int N, int k);
int main(void) {
try {
Array arr(4);
for (int i = 0; i < 4; i++)
arr.insert(i + 1);
cout << arr << endl;
for (int i = 0; i < 8; i += 2)
arr.insert(10 + i, i);
cout << arr << endl;
for (int i ... | ALGO | 0.985274 | 4.192493 |
23479e8e-6a64-4a71-951d-ccd1c5c37581 | ishandutta2007/codeforces | maximumshot/normal/995/B.cpp | #ifdef debug
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
#define vec vector
#define ALL(x) begin(x), end(x)
typedef unsigned int ui;
typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef pair< long long, long long > pll;
const int inf = 1e9;
const ll in... | ALGO | 0.999792 | 3.841698 |
c8ba50ee-cb2e-4aa6-9bc1-95821185e722 | llukito/leetCode | 1061-lexicographically-smallest-equivalent-string/1061-lexicographically-smallest-equivalent-string.cpp | class Solution {
public:
// DFS to find the smallest lex character in the component
char dfs(unordered_map<char, vector<char>>& adj, char cur, vector<int>& vis) {
vis[cur - 'a'] = 1;
char minChar = cur;
for (char neighbor : adj[cur]) {
if (vis[neighbor - 'a'] == 0) {
... | ALGO | 0.999985 | 6.539179 |
d8c6ea64-7558-4540-8419-01411a53ced1 | Bookworm-bit/competitive-programming | USACO/Guide/Bronze/Introduction to Sets & Maps/whereami.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void setIO(string s) {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
int main() {
setIO("whereami");
int N;
cin >> N;
s... | ALGO | 0.999948 | 3.829497 |
de4eaa18-703c-4854-8375-4d71ed38bda7 | raincross7/code-similarity | codes/train_code/problem273/problem273_4.cpp | #include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define ... | ALGO | 0.999846 | 4.089937 |
367ae81e-1d94-4d1b-90b7-eb8949d2b0e7 | mdmakky/Problem_solving | codechef/Possible_Victory.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
// int t;
// cin>>t;
// while (t--)
{
int r, o, c;
cin >> r >> o >> c;
if (((20 - o) * 6 * 6) + c > r)
{
cout << "YES" << endl;
}
else
cout << "NO" << endl;
... | ALGO | 0.999307 | 3.47616 |
ef782d15-e7a0-4487-ad6a-8216d99ec284 | psette/Project-Euler-Solutions-Cpp | PE060.cpp | #include <iostream>
#include <vector>
std::vector<bool> SieveOfEratosthenes(int n){
bool prime[n+1];
std::vector<bool> result;
for ( int i = 0; i <= n; i++) prime[i] = true;
for (int j = 2; j * j <= n; j++){
if (prime[j] == true)
for (int i = j * 2; i <= n; i += j) prime[i] = false;
}
result.push_bac... | ALGO | 0.999266 | 3.970968 |
6502fddb-b227-4096-9d51-aaf1e33edbe6 | PabloNicolasCassina/POO_2024 | Guia_1/Ejercicio_5/ejercicio_5/main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm> // Para std::sort
int main() {
std::vector<std::string> expresiones_idiomaticas;
expresiones_idiomaticas.push_back("A caballo regalado no se le miran los dientes");
expresiones_idiomaticas.push_back("Mas vale pajaro en mano que c... | ALGO | 0.995604 | 5.944981 |
9ccf9ac9-c4a9-42d6-ac2c-ec4aee4ee814 | kamalafidele/cpp_programs | REVISION/data-structures/singly-linkedlist.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Node() {
this->next = NULL;
}
Node(int value) {
this->data = value;
this->next = NULL;
}
};
class DoublyList {
public:
Node* node;
DoublyList() {
... | ALGO | 0.9767 | 5.713817 |
721dd8ec-bad5-4812-949b-82b79b7d2a82 | anandhu720/Leetcode-Solutions | 1226-the-dining-philosophers/1226-the-dining-philosophers.cpp | class Semaphore {
private:
mutex m;
condition_variable cv;
int count;
public:
void setCount(int count) {
this->count = count;
}
void wait() {
unique_lock<mutex> lock(m);
count--;
while(count < 0) {
cv.wait(lock);
}
}
void sign... | ALGO | 0.99978 | 5.062085 |
9714f494-82c0-4894-94f4-afea73ed61e8 | Nayanita657/Competitive-coding | Array/Sort the array consist of 0,1,2 with sorting.cpp |
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
void sort_array(int *a,int n)
{
int count_zero =0;
int count_one = 0;
int count_two = 0;
for(int i=0;i<n;i++)
{
if(a[i] == 0)
{
count_zero++;
}
else if(a[i] == 1)
{
... | ALGO | 0.999361 | 4.540635 |
6adaaa36-6989-478a-8de7-10a6ac04e607 | PrakharPatni08/DSA | Loops/BinaryToDecimal.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
cout << "Enter a binary number: ";
cin >> n;
int i = 0;
int ans = 0;
while(n != 0) {
int digit = n % 10;
if(digit == 1){
ans = ans + pow(2, i);
}
n = n / 10;
i++;
... | ALGO | 0.998606 | 5.128514 |
9bd0255d-7ef6-477b-ad23-c44af59f7f23 | sinian666/codes_86_2 | cpp_副本21/chapter_backtracking/permutations_i.cpp | /**
* File: permutations_i.cpp
* Created Time: 2023-04-24
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 回溯算法:全排列 I */
void backtrack(vector<int> &state, const vector<int> &choices, vector<bool> &selected, vector<vector<int>> &res) {
// 当状态长度等于元素数量时,记录解
if (state.size() == choices.size()... | ALGO | 0.999959 | 5.593585 |
72585204-80a9-4155-8339-92ccd1aad27e | kg-kartik/Hackerrank_cpp | stl/vectorerase.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n,i,x,a,b,y;
cin>>n;
vector<int> v;
for(i=0;i<n;i++)
{
cin>>y;
v.push_back(y);
}
cin>>x>>a>>b;
v.erase(v.begin()+x-1);
v.erase(v.begin()... | ALGO | 0.999623 | 3.055955 |
4c561aa9-4219-4e7a-b60c-cc7c879f0196 | EvanSinasac/Physics2Project2 | EvanSinasacPhysics2Project1/src/physics/particle_contact_generators.cpp | #include <physics/particle_contact_generators.h>
#include <iostream>
#include "../../globalThings.h"
namespace nPhysics
{
cPlaneParticleContactGenerator::cPlaneParticleContactGenerator(glm::vec3 normal, float distance)
: mNormal(glm::normalize(normal)), // Safety check to ensure the normal is normalized
distanc... | ALGO | 0.992524 | 4.121756 |
632aa554-8b2f-4942-9e31-4d102e123afa | bira37/problem-solving | CSES/StickGame.cpp | #include <bits/stdc++.h>
using namespace std;
int grundy[1000100];
int main(){
int n,k;
cin>>n>>k;
vector<int> v(k);
for(int i=0;i<k;i++)cin>>v[i];
grundy[0]=0;
for(int i=1;i<=n;i++){
int flag = false;
for(int j=0;j<k;j++){
if(i-v[j]>=0){
if(grundy[i-v[j]]==0){
flag = true;
break;
}
}... | ALGO | 0.999985 | 3.230895 |
7262a7f3-2d40-4649-8d65-10d09efea151 | RATAN1369/graph | bfs_k_walls.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
vector<vector<char>> v;
vector<vector<vector<ll>>> dis;
ll n,m,k;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};
bool is_valid(ll x, ll y){
return x>=0 && x<n && y>=0 && y<m;
}
vector<pair<ll,ll>> neighbours(ll x, ll ... | ALGO | 0.999958 | 4.109129 |
12be47c1-1fd9-4584-98e2-603c913b8913 | spfrood/CPP-references | Book/GaddisSourceCode/Chapter 06/Pr6-27.cpp | // This program uses overloaded functions.
#include <iostream>
#include <iomanip>
using namespace std;
// Function prototypes
int square(int);
double square(double);
int main()
{
int userInt;
double userFloat;
// Get an int and a double.
cout << fixed << showpoint << setprecision(2);
cout << "Enter an... | TOOL | 0.965874 | 6.792056 |
806d415a-8be5-415c-9e87-759c70ddb646 | sky-bro/AC | leetcode.com/Weekly Contest 185/1/main.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
string reformat(string s) {
vector<char> d;
vector<char> c;
for (char cc : s) {
if (cc <= '9')
d.push_back(cc);
else
c.push_back(cc);
}
int a = d.size(), b = c.size();
if (abs(a - b) > 1) retur... | ALGO | 0.999838 | 6.295621 |
4f869388-7bdb-4131-834e-066c468a398c | seeitsmanish/Cpp_Competitive_Repo | Practise/13_Jul_2021/squareroot.cpp | //Link :
#include<bits/stdc++.h>
using namespace std;
#define sort(v) sort(v.begin(),v.end())
#define print(v) for(auto n:v) cout<<n<<" "
#define rev(v) reverse(v.begin(), v.end())
#define l long
#define ll long long
#define vi vector<int>
#define pb push_back
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r"... | ALGO | 0.999447 | 3.237407 |
ee246903-8cfb-4a67-8fbd-b437ed989062 | rhaps0dy/UPF-SWERC | notebook2015/Data Structures/Square Root Trick.cpp | /* Partitions an array in sqrt(n) blocks of size sqrt(n) to support
* O(sqrt(n)) range sum queries, O(sqrt(n)) range sum updates, and O(1)
* point updates */
void update(LL *S, LL *A, int i, int k, int x) {
S[i/k] = S[i/k] - A[i] + x;
A[i] = x;
}
LL query(LL *S, LL *A, int lo, int hi, int k) {
int sum=0, i=... | ALGO | 0.999432 | 3.839879 |
ac64e866-5be7-496b-a90c-6facfa9e359a | weekend27/leetcode | majorityElement/majorityElement.cpp | // Source : https://leetcode.com/problems/majority-element/
// Author : weekend27
// Date : 2015-12-03
/**********************************************************************************
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.
Y... | ALGO | 0.999916 | 5.574752 |
bb680d6c-992d-48bf-9549-b69fb8356764 | dezhonger/LeetCode | Leetcode0375.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
//dp[i][j] = min(k + max(dp[i][k-1], dp[k+1][j])
class Solution {
public:
int dfs(vector<vector<int>>& dp, int l, int r) {
if(l >= r) return 0;
if(dp[l][r] != 0) return dp[l][r];
dp[l][r] = 0x7fffffff;
for(... | ALGO | 0.999918 | 5.21368 |
8f7d83ae-149a-44c6-b3e8-369771a957a5 | Bhavanabandaru912/Bhavanabandaru912 | sum of even numbers using while.cpp | #include<stdio.h>
main()
{int n,i=2,sum=0;
printf("enter any number");
scanf("%d",&n);
while(i<=n)
{printf("%d\n",i);
sum=sum+i;
i=i+2;
}
printf("%d\n",sum);
}
| ALGO | 0.994889 | 3.088728 |
6a7a3624-a587-48d7-9277-33c9ba2294b3 | repos-cl/NumCSE | Assignments/Codes/LeastSquares/LinearDataFit/CodeExpert/solution/main.cpp | #include <Eigen/Dense>
#include "linfit.hpp"
#include "matplotlibcpp.h"
using namespace Eigen;
namespace plt = matplotlibcpp;
int main() {
VectorXd t = VectorXd::LinSpaced(10, 0.1, 1.0);
MatrixXd A = make_A(t);
std::cout << "\nThe matrix A is defined by \n" << A << std::endl;
VectorXd f(10);
f << 100... | ALGO | 0.998742 | 5.188961 |
bc8897c1-49a0-4141-9f25-0ca8033fb0e9 | TownSparrow/ITMO_CompGraph_MyFramework | MyGraphicFramework/FirstPersonCamera.cpp | #include "FirstPersonCamera.h"
#include "Game.h"
#include <iostream>
#include <unordered_set>
#include "Keys.h"
// --- Init --- //
void FirstPersonCamera::Initialize() {
// Vector values
cameraPosition = Vector3(0.0f, 0.0f, -1.0f);
cameraWatchTarget = Vector3(0.0f, 0.0f, 1.0f);
cameraUpAxis = Vector3(0.0f, 1.0f, ... | TOOL | 0.884518 | 5.505661 |
2e63db5d-50ba-478b-a22e-4a5b5e32c214 | ngng628/competitive-programming | atcoder/ABC/ABC182/F/main.cpp | // ______ ______ ______
// .-----..-----..-----..-----.| __||__ || __ |
// | || _ || || _ || __ || __|| __ |
// |__|__||___ ||__|__||___ ||______||______||______|
// |_____| |_____|
//
# include <bits/stdc++.h>
# define cauto const auto
# define i... | ALGO | 0.999949 | 3.720947 |
7cd61f86-3e07-4fdb-a829-f8c2309cdac8 | Amandev02/Gitcode | ZigZag Tree Traversal - GFG/zig-zag-tree-traversal.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val) {
Node* temp = new Node;
temp->data = val... | ALGO | 0.999871 | 6.365507 |
dfdf0d7c-911c-42b0-bfcf-d640f108e144 | amanBhawsar/Coding-Tree | LeetCode/202. Happy Number.cpp | class Solution {
public:
long int digSq(long int n){
long int ans=0;
while(n){
ans+=(n%10)*(n%10);
n/=10;
}
return ans;
}
bool isHappy(int n) {
unordered_map<int,int> umap;
umap[n]++;
while(n!=1){
n=digSq(n);
... | ALGO | 0.999976 | 5.903788 |
4eba5709-963b-461f-a35f-b7e0561fb010 | arpg/simba | Applications/PathPlanner/PathPlanner.cpp | #include "PathPlanner.h"
#include <thread>
#include <iostream>
PathPlanner::PathPlanner() {
map_tau_ = 0; //Something random, why not.
debug_level_ = 0;
params_file_name_ =
"/Users/Trystan/Code/simba/Applications/Examples/PathPlannerTest/gui_params.csv";
Reset();
}
/////////////////////////////////////... | ALGO | 0.980679 | 4.297021 |
d0fb90a5-f369-4405-bbcd-354fcc019a2e | MasterIceZ/IMSO | competition_upsolve/ioi25_souvenirs/grader.cpp | #include "souvenirs.h"
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <utility>
#include <vector>
namespace {
const int CALLS_CNT_LIMIT = 10'000;
int calls_cnt;
int N;
std::vector<long long> P;
std::vector<int> Q;
void quit(const char* message) {
printf("%s\n", message);
exit(0);
}
} // namespa... | ALGO | 0.999954 | 3.762044 |
1c191d45-5b09-4177-9049-7ddc8d413ac2 | MospanMyroslav/TASK_04 | decrypt_encrypt/main.cpp | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
void decrypt()
{
int number;
cout << "Введіть шифрований номер для разшифровки: ";
cin >> number;
int a = ( number / 1000 + 3 ) % 10;
int b = ( number % 1000 / 100 + 3 ) % 10;
int c = ( number % 100 / 10 + 3 ) % 10;
int d... | ALGO | 0.991084 | 3.313932 |
fc79f559-e7b3-4778-8520-c841fe7da28d | MapleSystem/secure-c | libcxx/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp | // <random>
// template<class RealType = double>
// class chi_squared_distribution
// template<class _URNG> result_type operator()(_URNG& g);
#include <random>
#include <cassert>
#include <vector>
#include <numeric>
#include <cstddef>
template <class T>
inline
T
sqr(T x)
{
return x * x;
}
int main(int, char**)... | TEST | 0.968577 | 4.167628 |
fe47c1a0-e10a-4bdf-b999-b844cf8d8c4e | suraj15122000/ALL-CPP-PROGRAMS | DelteX.cpp | #include <iostream>
#include <string>
using namespace std;
// Function to generate the Nth ticket code
string generateTicketCode(int N) {
if (N == 1) {
return "A";
} else {
string previousCode = generateTicketCode(N - 1);
string currentCode = "";
int i = 0;
while... | ALGO | 0.999804 | 6.673542 |
69f394ca-1dd2-45ee-97a8-929abbee6423 | SouMy16/Algo-Problems | B.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<class T> using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// orde... | ALGO | 0.999991 | 4.815334 |
fa0b4e30-4f7c-401b-a069-8ba814de5774 | karanmishra8/DSA_Prep | Stack/5_valid_parenthesis.cpp | #include<iostream>
#include<stack>
using namespace std;
bool valid(string s)
{
stack<char>st;
for(int i=0;i<s.length();i++)
{
char ch=s[i];
if(ch=='{' || ch=='(' || ch=='[')
{
st.push(ch);
}
else
{
if(!st.empty())
{
char ch1=st.top();
if(ch=='}' && ch1== '{')
{
st.pop();
}
... | ALGO | 0.999041 | 4.98859 |
0a251ed9-eb8d-4442-9ae5-2fc4095f4f93 | ebbll/BOJ | cpp/10808.cpp | #include <iostream>
#include <vector>
int main(void)
{
std::cin.tie(NULL);
std::ios::sync_with_stdio(false);
std::vector<int> vec(26, 0);
std::string str;
std::cin >> str;
for (std::string::iterator it = str.begin(); it != str.end(); ++it)
{
++(vec.at(static_cast<int>(*it) - static_cast<int>('a')));
}
f... | ALGO | 0.999269 | 4.464555 |
93a09275-c1da-42d6-8512-fdeca1ec8274 | alvinpiter/competitive-programming | Codeforces/edu070/A.cpp | #include<bits/stdc++.h>
using namespace std;
int t;
string x, y;
int main() {
cin >> t;
for (int cases = 1; cases <= t; cases++) {
cin >> x >> y;
int lsbY;
for (int i = y.length(); i >= 0; i--) {
if (y[i] == '1') {
lsbY = y.length() - i;
bre... | ALGO | 0.999914 | 5.067121 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.