uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
639c4bc1-2975-4147-b24d-374c09823fd6 | YatinGupta777/DNS-Resolver | DNS Resolver/DNS Resolver.cpp | #include "pch.h"
#include <iostream>
#pragma comment(lib, "ws2_32.lib")
using namespace std;
/* constants */
#define MAX_DNS_LEN 512
#define MAX_ATTEMPTS 3
/* DNS query types */
#define DNS_A 1 /* name -> IP */
#define DNS_NS 2 /* name server */
#define DNS_CNAME 5 /* canonical name */
#define DNS_PTR 12 /* IP -> na... | WEB | 0.883749 | 3.333338 |
c9a4062f-794a-4fb1-91a6-697503e0a403 | jacobalexandervelasquez/CIS_5_Winter_2019 | Hmwk/Assignment_4/Gaddis_9thEd_Chap5_Prob23_Pattern/main.cpp | /*
* File: main.cpp
* Author: Jacob Velasquez
* Created on January 18, 2019
* Purpose: Pattern given an input of 10
*/
//System Libraries
#include <iostream> //Input/Output Library
using namespace std;
//User Libraries
//Global Constants, no Global Variables are allowed
//Math/Physics/Conversions/Higher Di... | ALGO | 0.999826 | 4.560457 |
3cc5f337-255d-4175-b9b3-930e997ed387 | zlm05170/asv_system | light_scan_sim/thirdparty/Box2D/Dynamics/Joints/b2WeldJoint.cpp | #include <Box2D/Dynamics/Joints/b2WeldJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Point-to-point constraint
// C = p2 - p1
// Cdot = v2 - v1
// = v2 + cross(w2, r2) - v1 - cross(w1, r1)
// J = [-I -r1_skew I r2_skew ]
// Identity used:
// w k % (rx i + ry j) = w * (-ry i ... | ALGO | 0.98595 | 6.654368 |
943f571e-8487-456f-8b61-921f2317178a | north-h/Match_code | 2024/AtCoder_-_AtCoder_Beginner_Contest_351/G_-_Hash_on_Tree.cpp | /*
* =========================================================
* Author: north_h
* Time: 2024-04-27 20:04:44 ms
*
* Problem: G - Hash on Tree
* Contest: AtCoder - AtCoder Beginner Contest 351
* URL: https://atcoder.jp/contests/abc351/tasks/abc351_g
* MemoryL: 1024 MB
* TimeL: 4000 ms
* =============... | ALGO | 0.99827 | 3.0803 |
5e19a09e-3d0d-4d86-a794-2ccfbe9b550c | MehrajShakil/Solving-problem-in-different-OJ | LightOJ/1294 - Positive Negative Sign.cpp | // BISMILLAHIR RAHMANIR RAHEEM
// ALLAH IS WATCHING ME
// ALLAH save us from COVID-19.Amin.
//โโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโ
/// Author : Md Mehraj Hossain
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/stand... | ALGO | 0.999919 | 4.91677 |
36789704-ebb0-47ac-af80-2da151be8935 | Ahmed0236/Object-Oriented-Programming | Object Oriented Programming/PA1/Q2.cpp | #include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <algorithm>
#include <ctype.h>
using namespace std;
class Word_index
{
public:
Word_index(string);
void Sort(vector <string>);
};
void Word_index::Sort(vector <string> a)
{
sort(a.begin(), a.end());
a.erase(std::unique(a.begin(),... | ALGO | 0.974395 | 3.842777 |
a5d308dd-a14e-463b-b9a1-9764dbf97015 | Sevda18/Introduction-to-programming | Sem.02/Pract.02/task10.cpp | #include <iostream>
int main()
{
double num1, num2;
char symbol;
std::cin >> num1 >> num2>>symbol;
if (symbol == '+')
{
std::cout << num1 + num2;
}
else if (symbol == '-')
{
std::cout << num1 - num2;
}
else if (symbol == '*')
{
std::cout << num1 * num2;
}
else if (symbol == '/' && num2 != 0)
{
s... | ALGO | 0.998042 | 4.690156 |
e698b8f6-a2e5-4f9d-ad46-e1cfedc15f03 | DyhaCreator/programming_tasks | acmp/1936.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const int INF = 1e9 + 7;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (auto &x : a)
cin >> x;
vector<ll> l(n);
l[0] = 1;
for (int i = 1; i < n; i++) {
if (a[i] > a[i... | ALGO | 0.999965 | 4.263199 |
62b05676-92da-405f-9ea7-280c5e30c5fc | ishandutta2007/codeforces | vepifanov/normal/575/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); i++)
#define re return
#define fi first
#define se second
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(abs(x))
#def... | ALGO | 0.999967 | 3.958902 |
971b7257-8722-43ed-8f1f-8c6d5d91c843 | alxbnct/blender | extern/audaspace/src/fx/ImpulseResponse.cpp | #include "fx/ImpulseResponse.h"
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
AUD_NAMESPACE_BEGIN
ImpulseResponse::ImpulseResponse(std::shared_ptr<StreamBuffer> impulseResponse) :
ImpulseResponse(impulseResponse, std::make_shared<FFTPlan>(0.0))
{
}
ImpulseResponse::ImpulseResponse(std:... | TOOL | 0.867544 | 6.40563 |
5e24dae0-cc7d-42b0-8b9c-e87f4f6b2ef5 | nicholasHu12ba/Tiny-Interesting | zigzagMatrix.cpp | #pragma warning(disable:4996)
#include <cstdio>
#include <tchar.h>
#include <iostream>
using namespace std;
/*
Author: Chikun Hu, <EMAIL>
Date: Aug 25, 2014
Problem: zigzag matrix
Difficulty: Easy
11
0 2 3 9 10 20 21 35 36 54 55
1 4 8 11 19 22 34 37 53 56 75
5 7 12 18 ... | ALGO | 0.997005 | 3.294278 |
3cbc694a-5a6a-4163-bc9a-d785680fb9a0 | alexandraback/datacollection | solutions_1485488_1/C++/IElenik/2011_2.cpp | // 2011_2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
FILE * in, * out;
#define fo(a,b,c) for(int a = ( b ); a < ( c ); ++ a )
#define fr(a,b) fo( a, 0, ( b ) )
#define fi(a) fr( i, ( a ) )
#define fj(a) fr( j, ( a ) )
#define fk(a) fr( k, ( a ) )
#define mp make_pair
#define pb... | ALGO | 0.997962 | 3.346031 |
4cac41ee-7333-41fb-b6fe-12da3e3e61cb | GuillerLT/programming-problems | solutions/ctci/03/05.cpp | #include <stack>
// Time O( n^2 )
template <class T>
std::stack<T> sort(std::stack<T> stack) {
std::stack<T> sorted;
while (!stack.empty()) {
T temp{std::move(stack.top())};
stack.pop();
while (!sorted.empty() && sorted.top() < temp) {
stack.push(std::move(sorted.top()));
sorted.pop();
... | ALGO | 0.999766 | 5.915352 |
f791e03b-013e-4066-8794-899d5829786e | newfeed123/C_Programming | buoi16/tk_nhiPhan.cpp | #include<iostream>
using namespace std;
//TK nhi phan : mang phai dc sx , O(logn)
void quick_sort(int a[], int left, int right){
int i = left, j = right;
int pivot = a[(left+right)/2];
while(i <= j){
while(a[i] < pivot && i < right)
i++;
while(a[j] > pivot && j > left)
j--;
if(i <= j){
int tmp = a[i];... | ALGO | 0.999991 | 3.841696 |
55500c66-993d-4513-a15c-f38450ffbcc0 | stulsani/Additional-WorkSpace | Data_Structure/C++/topViewBT.cpp | //Geeks for Geeks
#include <iostream>
#include <unordered_map>
#include <queue>
using namespace std;
// A binary Tree node
struct node
{
int data;
struct node *left, *right;
};
node* newnode(int data)
{
node *temp = new node;
temp->data = data;
temp->left = temp->right = NULL;
return temp;
}
... | ALGO | 0.999983 | 4.903414 |
b746417a-fa36-45c7-b569-2d1e1ed1afb0 | dbdbais/Solved_Problem_Storage | SWEA/Unrated/2105.โ
๏ผป๋ชจ์โ
SWโ
์ญ๋ํ
์คํธ๏ผฝโ
๋์ ํธโ
์นดํ/๏ผป๋ชจ์โ
SWโ
์ญ๋ํ
์คํธ๏ผฝโ
๋์ ํธโ
์นดํ.cpp | //
// Created by newbi on 2024-02-27.
//
#include <iostream>
#define For(i,a,b) for(int i=a;i<b;i++)
#define endl '\n'
using namespace std;
int dx[] = {1,-1,-1,1};
int dy[] = {1,1,-1,-1};
int N,T,startX,startY;
int arr[22][22];
int ans = -1;
bool dessert[101];
void fastIO(){
ios::sync_with_stdio(false);
cin... | ALGO | 0.999795 | 5.904916 |
f29718c4-cc67-4f96-8a64-773684719b37 | doblerk/graph-matching | third_party/boost/libs/math/test/compile_test/tools_toms748_inc_test.cpp | #define T double
#define Tol boost::math::tools::eps_tolerance<double>
typedef T (*F)(T);
template std::pair<T, T> boost::math::tools::toms748_solve<F, T, Tol >(F, const T&, const T&, const T&, const T&, Tol, boost::uintmax_t&);
template std::pair<T, T> boost::math::tools::toms748_solve<F, T, Tol>(F f, const T& ax, c... | TOOL | 0.999369 | 3.996881 |
3cb80853-9eaa-47e1-ab94-1278cd0cd7d0 | brushstrokes/cs211 | venus.cs.qc.cuny.edu/~alayev/cs211/code/lecture19/binarySearchRecursive.cpp | // binarySearchRecursive.cpp
/* Contains the recursive version of binary search for the searchAndSort
* program.
*
* Author: John D. Donath
*/
#include "searchAndSort.h"
/* binarySearch()
*
* Searches through the array and returns position of given parameter.
* Returns -1 if not found.
*
* Parameters:
* Na... | ALGO | 0.999994 | 6.958419 |
22af2a8c-008b-47a3-b202-5393ea593e22 | osmandapp/OsmAnd-external-qtbase | src/3rdparty/angle/src/compiler/translator/ForLoopUnroll.cpp | #include "compiler/translator/ForLoopUnroll.h"
namespace {
class IntegerForLoopUnrollMarker : public TIntermTraverser {
public:
virtual bool visitLoop(Visit, TIntermLoop* node)
{
// This is called after ValidateLimitations pass, so all the ASSERT
// should never fail.
// See ValidateL... | ALGO | 0.982906 | 7.462817 |
aeeb4065-28f9-43dd-9319-bb9871322c17 | Nature711/my-leetcode-notes | 0077-combinations/0077-combinations.cpp | class Solution {
public:
vector<vector<int>> combine(int n, int k) {
vector<vector<int>> res;
vector<int> curr;
backtrack(1, n, k, curr, res);
return res;
}
void backtrack(int currIdx, int n, int k, vector<int>& curr, vector<vector<int>>& res) {
if (curr.size() =... | ALGO | 0.999973 | 6.44155 |
9633df57-f49f-4cb5-af4a-2a4f4490b928 | tommy5198/acm | uva/uva10189.cpp | #include<iostream>
#include<cctype>
#include<cstring>
using namespace std;
int main(){
int x,y,t=1;
std::ios_base::sync_with_stdio(false);
while(cin>>y>>x){
if(!x&&!y)
break;
char mine[y+2][x+2];
memset(mine,0,sizeof(char)*(y+2)*(x+2));
for(int i=1;i<y+1;i++)
... | ALGO | 0.991927 | 3.141668 |
b55d3739-9b1a-4a49-a6a8-30c076e0910e | JamesDiDonato/CarND-Path-Planning | src/Eigen-3.3/bench/spbench/test_sparseLU.cpp | // Small bench routine for Eigen available in Eigen
// (C) Desire NUENTSA WAKAM, INRIA
#include <iostream>
#include <fstream>
#include <iomanip>
#include <unsupported/Eigen/SparseExtra>
#include <Eigen/SparseLU>
#include <bench/BenchTimer.h>
#ifdef EIGEN_METIS_SUPPORT
#include <Eigen/MetisSupport>
#endif
using namesp... | ALGO | 0.99265 | 4.283109 |
2e80863d-b970-450c-9a95-54fd2407d502 | surajrana45/LEETCODE | 415-add-strings/415-add-strings.cpp | class Solution {
public:
string addStrings(string nums1, string nums2) {
string result="";
int sum = 0;
int i = nums1.size()-1;
int j = nums2.size()-1;
while(i>=0 && j>=0)
{
sum = sum+(nums1[i--] - '0' + nums2[j--]-'0');
resul... | ALGO | 0.999933 | 6.728107 |
54b1d78e-93da-42a4-95ff-8ff249fcb196 | xfrnk2/1d1cpp | src/boj/p11k/p11000/P11024.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std;
int t;
int main(void) {
cin >> t;
cin.ignore();
while (t--> 0) {
string s;
int sum = 0;
getline(cin, s);
strin... | ALGO | 0.996048 | 4.730615 |
70db97f1-4230-4c74-9498-d65cc0310fae | kpenev/poet | poet_src/third_party_libs/alglib/alglib/src/diffequations.cpp | #include "stdafx.h"
#include "diffequations.h"
// disable some irrelevant warnings
#if (AE_COMPILER==AE_MSVC)
#pragma warning(disable:4100)
#pragma warning(disable:4127)
#pragma warning(disable:4702)
#pragma warning(disable:4996)
#endif
using namespace std;
////////////////////////////////////////////////////////////... | ALGO | 0.999526 | 7.241605 |
ea75521f-9eec-4cdc-9a78-38a1e3144e03 | EECS-NTNU/gem5-dom | src/systemc/tests/systemc/misc/sim_tests/cgen/cgen.cpp | /*****************************************************************************
cgen.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | TOOL | 0.929451 | 7.113578 |
e23d1d19-f1bd-44e9-a2b2-e7e0ff2f4ae0 | vbonnici/grafe-sim | analysis/data/p02271/s417435769.cpp |
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int n, q, A[25];
char t[25][2010];
bool check(int i, int m) {
if (m == 0) return true;
if (i >= n) return false;
if (t[i][m] > 0) return t[i][m] == 2;
bool res = check(i + 1, m) || check(i + 1, m - A[i]);
t[i][m] = res ? 2 : 1;
retur... | ALGO | 0.99994 | 4.354765 |
faf7d185-79de-4b4e-bc44-98e0b93af896 | Meet-6226/C-plus | swap_func5.cpp | #include<iostream>
using namespace std;
void swap(int x,int y)
{
int t=x;
x=y;
y=t;
cout<<"After Swapping :\n x = "<<x<<endl<<"y = "<<y<<endl;
}
int main()
{
int x=1,y=2;
cout<<"Before Swapping:\n x = "<<x<<endl<<"y ="<<y<<endl;
swap(x,y);
return 0;
}; | ALGO | 0.99829 | 4.384396 |
5ae7921e-8653-4355-b6aa-932b4c4b8480 | Nasima-Islam-Bithi/URI_solution | Code/1026.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
unsigned long int a,b;
while(scanf("%lu%lu",&a,&b)!=EOF)
{
printf("%lu\n",a^b);
}
}
| ALGO | 0.999825 | 3.454027 |
ba45fcbe-4e2a-4b6c-b640-55c7a415aff8 | mahadi-cse-21/Codeforces | F_Binary_Subsequence_Value_Sum.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
ll modexp(ll a, ll b, ll m=MOD) {
ll res = 1 % m;
a %= m;
while(b){
if(b & 1) res = (res * a) % m;
a = (a * a) % m;
b >>= 1;
}
return res;
}
ll modinv(ll a, ll m=MOD) {
r... | ALGO | 0.999974 | 4.857251 |
7521249e-4b3f-4b8c-aaf9-16c7c634560c | TzashiNorpu/Algorithm | Clion/ZeroTrac/1600_1800/mergeTriplets_1899.cpp | //
// Created by TzashiNorpu on 8/11/2022.
//
#include "../header/1600_1800.h"
using namespace ZeroTrac;
bool Solution::mergeTriplets(vector<vector<int>> &triplets, vector<int> &target) {
vector<int> res(3);
for (auto &t: triplets)
if (t[0] <= target[0] && t[1] <= target[1] && t[2] <= target[2])
res = {... | ALGO | 0.990943 | 5.751956 |
61dbd251-3cd4-4811-a0b8-61fc1eb02999 | iwantagf/Competitive-Code-Library | Competitive Code Library/Graph/Connected_Components_Undirected_Graph.cpp | #include<bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define ford(i, a, b) for (int i = a; i >= b; --i)
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define maxn (int) 1e5 + 7
using namespace std;
int cc = 0;
struct Graph {
vector<int> g[maxn], concom[maxn];
int q[maxn], color[m... | ALGO | 0.999903 | 4.929361 |
013c89ba-227f-4186-ac91-d998d0bb0b56 | CodingCossack/C-plus-plus | Learning/Basics/4. Arrays/array.cpp | // Create a double type array named numbers with values: 3.5, 8.9, 1.6, -4.8.
#include <iostream>
using namespace std;
int main() {
double numbers [4] = {3.5, 8.9, 1.6, -4.8}; // create double array
for (int i = 0; i < 4; ++i) { // access array using loop
cout << numbers[i] << endl;
}
r... | ALGO | 0.989243 | 4.108938 |
9b4ed14a-6b9b-4df7-b6a4-9463a6fdec9c | Gonzalomata96/WSQs | WSQ09recursion.cpp | #include <iostream>
#include "BigIntegerLibrary.hh"
using namespace std;
int factorial(int n){
if (n == 0){
return 1;
}
return n * factorial(n-1);
}
int main(){
long long n;
char answer, yes = 'y', no = 'n';
do{
cout << "Give me a positive number." << endl;
cin >> n;
cout << "The factorial of yo... | ALGO | 0.992351 | 4.333379 |
4515a46c-b03d-46aa-ab73-8f31e510e85f | kmjp/procon | codeforce/621-660/621/d.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999895 | 4.060063 |
3433eb84-1b1a-4c0d-8935-e7d10cb367ae | xrLil-Batya/xray-monolith-152 | src/xrGame/ai/monsters/burer/burer_fast_gravi.cpp | #include "stdafx.h"
#include "burer_fast_gravi.h"
#include "burer.h"
#include "../control_animation_base.h"
#include "../control_direction_base.h"
#include "../control_movement_base.h"
bool CBurerFastGravi::check_start_conditions()
{
if (is_active()) return false;
if (m_man->is_captured_pure()) return false;
if (!m... | ALGO | 0.939343 | 4.764907 |
225834dc-d525-4d54-9d90-ec222f89b905 | ng8165/USACO | Gold/2016-03/split_open2016.cpp | // Splitting the Field
// USACO Gold US Open 2016: http://www.usaco.org/index.php?page=viewproblem2&cpid=645
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct Cow {
int x, y;
bool operator<(const Cow& other) const {
return x < other.x;
}
};
int N;
Cow cows[50001];
ll ... | ALGO | 0.999979 | 5.219214 |
97fe20b1-7257-4cc3-8081-2d9571a92302 | xxxxyu/FlexNN | src/layer/gru.cpp | #include "gru.h"
#include <math.h>
namespace ncnn {
GRU::GRU()
{
one_blob_only = false;
support_inplace = false;
}
int GRU::load_param(const ParamDict& pd)
{
num_output = pd.get(0, 0);
weight_data_size = pd.get(1, 0);
direction = pd.get(2, 0);
return 0;
}
int GRU::load_model(const ModelBin&... | ALGO | 0.992915 | 7.087226 |
6cff808c-417e-4045-93c5-6f9e3d61bcbe | 09asad/Cpp-Programs | Stacks/3_pushAtBottom.cpp | #include<iostream>
#include<stack>
using namespace std;
void pushAtBottom(stack<int>&st, int val){
stack<int> temp;
while(st.size()>0){
temp.push(st.top());
st.pop();
}
st.push(val);
while(temp.size()>0){
st.push(temp.top());
temp.pop();
}
}
void print(stack<int>&... | ALGO | 0.997544 | 4.82355 |
6272e2c9-3ba4-44f7-8dfd-1b7aafa6fa21 | AdityaPachupate/PrepInstaTop100 | Difficulty: Easy/Array Leaders/array-leaders.cpp | //{ Driver Code Starts
// C++ program to remove recurring digits from
// a given number
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
// Function to find the leaders in the array.
public:
vector<int> leaders(int n, int arr[]) {
// Code here
int... | ALGO | 0.999939 | 6.206787 |
0f535f45-2a66-484d-a6bd-ea3884be40d3 | MayankKunal/LeetCodeproblems | 1744-number-of-ways-to-form-a-target-string-given-a-dictionary/number-of-ways-to-form-a-target-string-given-a-dictionary.cpp | class Solution {
public:
int numWays(vector<string>& words, string target) {
vector<vector<int>> dp(words[0].size(), vector<int>(target.size(), -1));
vector<vector<int>> charFrequency(words[0].size(), vector<int>(26, 0));
// Store the frequency of every character at every index.
for... | ALGO | 0.999997 | 6.367565 |
a1746a04-24a9-412e-a261-3237e100c1ac | dkhonker/sysu | ๆฐๆฎ็ปๆ/ๆฐๆฎ็ปๆๅฎ้ช่ฏพๆไปถ/EXP8/4.21ไปฃ็ /19322080/longest.cpp | #include<stdio.h>
const int MAXN = 12000;
int n, a[MAXN + 1], dp[MAXN + 1];
int longestNum(){
dp[1] = 1;
int t=2;
for (int i = 2; i <= n; i++) {
//add something here for computing dp[i]
dp[t]=1;
for(int j=i-1;j>=1;j--){
if(a[i]>a[j])
dp[t]=dp[t]>dp[j]+1?dp[t]:dp[j]+1;
}
//printf("%d\n",dp[t]);
t... | ALGO | 0.999766 | 3.78285 |
4670b468-c9ae-4a8c-8e41-81cfc30a8bad | lukechencqu/LIO-SAM-chenlu | src/featureExtraction.cpp | #include "utility.h"
#include "lio_sam/cloud_info.h"
struct smoothness_t{
float value; // roughness value.
size_t ind; // index.
};
struct by_value{
bool operator()(smoothness_t const &left, smoothness_t const &right) {
return left.value < right.value;
}
};
class FeatureExtraction : public... | ALGO | 0.991573 | 3.054782 |
e6c2a173-04eb-48dd-9357-f6360a2abe18 | mchensd/Competitive-Programming | R472/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define mp make_pair
#define pb push_back
int main() {
#ifdef SUBLIME_RUN
freopen("C.txt", "r", stdin);
#elif defined(USE_INPUT_FILE)
freopen("input.txt", "r", stdin);
#endif
... | ALGO | 0.99977 | 4.054805 |
81ffe837-ebb8-4a78-9abb-f717c0a2aba4 | naturalself/topcoder_srms | topcoder/ProblemsToSolve.cpp | // BEGIN CUT HERE
// END CUT HERE
#line 5 "ProblemsToSolve.cpp"
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#... | ALGO | 0.99961 | 4.997545 |
be3a460e-923b-4cc4-8145-dbc9e4f840c6 | lcary/tmp | cpp/recursion4.cpp | #include <iostream>
#include <string>
using namespace std;
void printAscDesc(int start, int end, int &depth);
int main() {
int depth = 0;
printAscDesc(0, 10, depth);
return 0;
}
void printAscDesc(int start, int end, int &depth)
{
depth++;
string margin = string(depth, ' ');
if (start == end)... | ALGO | 0.995732 | 4.744984 |
15e75092-e9c3-4dd7-88da-d96a291362fc | patel-reema/8189DSA-with-C-plus-plus | Lab_work/Looping/even_number.cpp | #include<iostream>
using namespace std;
main(){
int n, i;
cout<<"Enter the number:";
cin>>n;
for(i=1; i<=n; i++){
if(i%2==0){
cout<<" "<<i;
}
}
}
| ALGO | 0.999465 | 3.306207 |
749f2586-86fa-4b6c-948b-46db672cb1e2 | BerkeleyAutomation/legs_ros_ws | droid_slam_ros/thirdparty/lietorch/eigen/doc/examples/nullary_indexing.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
// [functor]
template<class ArgType, class RowIndexType, class ColIndexType>
class indexing_functor {
const ArgType &m_arg;
const RowIndexType &m_rowIndices;
const ColIndexType &m_colIndices;
public:
typedef Matrix<typename ArgType::Scalar,
... | ALGO | 0.987816 | 6.750382 |
7d2ef6d5-1a60-4333-afc3-cd23567ff96d | adi6409/browser-src | netwerk/base/nsURLHelper.cpp | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=4 sw=2 sts=2 et cindent: */
#include "nsURLHelper.h"
#include "mozilla/Encoding.h"
#include "mozilla/RangedPtr.h"
#include "mozilla/TextUtils.h"
#include <algorithm>
#include <iterator>
#include "nsASCIIMask.h"
#include "n... | TOOL | 0.882609 | 6.110456 |
d6670619-629f-45e2-a724-36111cb6ab61 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_3652_0.cpp | #include <stdio.h>
int main()
{
double r,s,l,p;
scanf("%d",r);
p=3.14159265358979???
s=r*r*p;
l=2*r*p;
printf("%f %f",s,l);
return 0;
} | ALGO | 0.99649 | 3.110475 |
c2f0b338-d335-42bc-a1eb-fd07215edfde | YukiTonegawa/Library | math/geometry/old_geometry/line.cpp |
/*
complexใงใฏใชใpointใฏใฉในใไฝใฃใ.
norm: ใใซใ
abs: ๅ็นใใใฎ่ท้ข
arg: ่งๅบฆ(โฯ
โ
ฯ
ใใฯ
ฯ
)
dot: ๅ
็ฉ
cross,det: ๅค็ฉ(่กๅๅผ)
proj: ็ด็ท(0,0),(x,y)ใธใฎๆญฃๅฐๅฝฑ
ccwใฏa->b->cใฎ้ ใง้ฒใใจใ
1ใชใccw(ๅๆ่จๅใ), -1ใชใcw(ๆ่จๅใ), 2ใชใๆใ่ฟใ, -2ใชใ็ด้ฒ, 0ใชใ็ทๅไธใซๆใ่ฟใ
*/
/*
namespace D2 {
const ld eps = 1e-7;
bool eq(const ld &a, const ld &b){ return std::abs(a-b)<eps;}
struct poi... | ALGO | 0.999198 | 3.351078 |
999a7c4c-a2f4-47ab-b6e1-c52e74e3f166 | zebangyang/Practice | Chapter12/12.5.cpp | /*
* ้ข็ฎๅ็งฐ๏ผ้่ฏ
* ้ข็ฎๆฅๆบ๏ผๅไบฌๅคงๅญฆๅค่ฏไธๆบ้ข
* ้ข็ฎ้พๆฅ๏ผhttp://dwz.win/Knc
* ไปฃ็ ไฝ่
๏ผๆจๆณฝ้ฆ(็็ฐ)
*/
#include <iostream>
#include <cstdio>
using namespace std;
const int MAXN = 100 + 10;
const int MAXM = 1000 + 10;
int dp[MAXM];
int value[MAXN]; //็ฉๅไปทๅผ
int weight[MAXN]; //็ฉๅ้้
int main() ... | ALGO | 0.999995 | 4.245904 |
ddb1302a-ef5a-4d0c-8c95-869bbbcfb212 | raincross7/code-similarity | codes/train_code/problem242/problem242_452.cpp | //#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int MAX =20... | ALGO | 0.99985 | 3.1903 |
03a94faf-6501-4cb7-8510-0af86a633dcd | lashgar/ipmacc | test-case/rodinia/ispc/mandelbrot_tasks/mandelbrot_tasks_serial.cpp | #include "../timing.h"
static int mandel(float c_re, float c_im, int count) {
// 11 lines
float z_re = c_re, z_im = c_im;
int i;
for (i = 0; i < count; ++i) {
if (z_re * z_re + z_im * z_im > 4.f)
break;
float new_re = z_re*z_re - z_im*z_im;
float new_im = 2.f * z_re... | ALGO | 0.995822 | 5.424306 |
353aa4e8-2e0c-4276-9aff-ae16d253e48a | Nasrum190/Codeforces | fibonacci.cpp | #include<iostream>
using namespace std;
int main(){
int num,count=0,first=0,second=1,fibo;
cout<<"please enter number=";
cin>>num;
while(count<num){
if(count<=1){
fibo=count;
}
else{
fibo=first+second;
first=second;
second=fibo;
} cout<<fi... | ALGO | 0.999947 | 3.493645 |
ce3ef3b6-42ac-477f-b72c-83d540bcee67 | TBxHiro/CP | Codeforces/B/1296-B-Food_Buying.cpp | #include <bits/stdc++.h>
#define fastread() (ios_base::sync_with_stdio(false), cin.tie(NULL));
using namespace std;
int main()
{
fastread();
int t;
cin >> t;
while (t--)
{
int s;
cin >> s;
cout << fixed << setprecision(0) << floor(s / 0.9) << endl;
}
} | ALGO | 0.999735 | 3.594257 |
d56d9dd4-863b-4bfa-bdca-68df8aaf019e | Mulab11/cntt2016-hw1 | TC-SRM-549-div1-250/sentews.cpp | #include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int a[111]={},b[111]={},c[111]={},d[111]={},n,m;
bool f[111][111]={};int y[111]={};bool vis[111]={};
int dfs(int x)
{
vis[x]=1;
for(int i=1;i<=m;i++)
if(f[x][i]&&(!y[i]||!vis[y[i]]&&dfs(y[i])))
{
y[i]=x;return 1;
}
return 0;
}
class ... | ALGO | 0.999512 | 3.879851 |
caa9031a-7020-45aa-9dd0-6e0f8e81303c | ishandutta2007/codeforces | sfiction/normal/1468/D.cpp | #include <bits/stdc++.h>
using namespace std;
int N, M, a, b;
int s[200010];
bool check(int x) {
int maxt = 0;
int B = b;
for (int i=1;i<=x;i++) {
maxt = max(maxt, i + s[x + 1 - i]);
}
B -= x;
if (B <= a) return false;
return x + B - 1 >= maxt;
}
int main() {
int T;
sca... | ALGO | 0.999962 | 3.873918 |
20482b7e-1730-4ea2-83a6-f143adaa7f9c | jorgejarai/busqueda_rutas | src/main.cpp | #include <fmt/core.h>
#include <fmt/ranges.h>
#include <iostream>
#include <string>
#include "graph.h"
#include "graphreader.h"
#include "solvers/a-star.h"
#include "solvers/dfs.h"
#include "solvers/greedy.h"
#include "solvers/solver.h"
#include "solvers/ucs.h"
int main(int argc, char* argv[]) {
if (argc != 3) {... | ALGO | 0.985108 | 5.528243 |
36ff84a9-3660-432b-b128-d2b4634a55d8 | Shu-ler/Practicum_CPlusPlus | sprint 6/Topic3/Lesson 8/Lesson 8/Lesson 8.cpp | #include <cassert>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <regex>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
using filesystem::path;
enum class IncludeType {
None,
WithRoot,
OnlySystem,
};
struct IncludeFile {
bool include_find = false;
IncludeType... | TOOL | 0.858047 | 4.740879 |
654b3851-33b3-4125-9ae0-34226c3b3763 | aroraadivya/LeetCode-Questions | 1886-minimum-limit-of-balls-in-a-bag/1886-minimum-limit-of-balls-in-a-bag.cpp | class Solution {
public:
int minimumSize(vector<int>& nums, int maxOps) {
int low = 1, high = *max_element(nums.begin(), nums.end());
while (low < high) {
int mid = low + (high - low) / 2;
int ops = 0;
for (int n : nums) if ((ops += (n - 1) / mid) > maxOps) break;... | ALGO | 0.999937 | 5.948826 |
fe384ae5-ece3-4610-b321-d73c737edb0a | allenthomas1001/calculator_flutter | 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.998773 | 6.77437 |
1302b6d0-7827-4c59-a9ed-a7c0a5de4792 | shawon-majid/Problem-Solving-Discussion | USACO/stick_length.cpp | //Bismillahir Rahman-ir Rahim
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << " : " << x << endl;
#define all(c) c.begin(), c.end()
#define F first
#define S second
typedef unsigned long long ull;
typedef long long ll;
int main() {
// freopen("input.txt", "r" , stdin);
// f... | ALGO | 0.999836 | 4.477045 |
555fd71d-4b57-4a82-b680-77be097e28af | PhucAnh0502/DSA | reachable.cpp | #include <iostream>
#include <vector>
#include <sstream>
using namespace std;
bool canReach(vector<int>& A, int i) {
if (i < 0 || i >= A.size() || A[i] < 0) {
return false;
}
if (A[i] == 0) {
return true;
}
int jump = A[i];
A[i] = -A[i];
return canReach(A, i + jump) || c... | ALGO | 0.999936 | 4.516961 |
291ad05e-33ed-4cc8-8a4a-759c802a5652 | muradhaji/ProblemSolutions | Codeforces/cpp/271A.cpp | //Link: https://codeforces.com/problemset/problem/271/A
#include <bits/stdc++.h>
using namespace std;
bool is_distinct(int y) {
int list[10] = {0};
while(y > 0) {
list[y%10] += 1;
y /= 10;
}
for(int i = 0 ; i < 10 ; i++)
if(list[i] > 1) return false;
return true;
}
int main() {
int y;
cin >> y;
while(t... | ALGO | 0.999068 | 4.379018 |
9fbe575a-580b-46f6-aced-4d9a71d4050e | teche74/Daily_Practise | 1720-crawler-log-folder/1720-crawler-log-folder.cpp | class Solution {
public:
int minOperations(vector<string>& logs) {
stack<string> s;
for(auto x:logs)
{
if(x=="../")
{
if(!s.empty())
s.pop();
}
else if(x!="./")
s.push("+");
}... | ALGO | 0.996346 | 5.083601 |
02eb70bc-a0a1-4e6c-94e8-6183a5827a3a | srskhan/Leetcode-Solutions | BST/minimum-absolute-difference-in-bst.cpp | /*
๐น Problem: minimum-absolute-difference-in-bst
๐ https://leetcode.com/problems/minimum-absolute-difference-in-bst/
๐ง Approach:
โฑ๏ธ Time:
๐ฆ Space:
*/
class Solution {
public:
void inorder_traversal(TreeNode* root, vector<int> &v)
{
if(root == nullptr)
return;
inorder... | ALGO | 0.999978 | 6.967731 |
34179d9b-8b8a-4e16-b7b5-13a80479379f | talha-10xE/LLVM-Profiler | flang/runtime/matmul.cpp | // Implements all forms of MATMUL (Fortran 2018 16.9.124)
//
// There are two main entry points; one establishes a descriptor for the
// result and allocates it, and the other expects a result descriptor that
// points to existing storage.
//
// This implementation must handle all combinations of numeric types and
// k... | ALGO | 0.989808 | 7.470087 |
02f72020-d63b-4c92-825b-93a2b1f89fa2 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10556_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, x2, x, y, y1, y2, zx, zy;
cin >> x >> y;
if (x > 0)
zx = 1;
else {
zx = -1;
x *= -1;
}
if (y > 0)
zy = 1;
else {
zy = -1;
y *= -1;
}
x1 = (x + y) * (zx > 0 ? 0 : zx);
x2 = (x + y) * (zx < 0 ? 0 : zx);
y2 = (... | ALGO | 0.999816 | 3.364879 |
f7876bcc-9b4f-4a3e-9fd1-c2d341826009 | shubhampawar574/Coding-Problems | Jan/GFG/29_Min operations.cpp | int solve(int a, int b) {
// code here
if(a==b) return 0;
else if((a&b)==b || (a&b)==a) return 1;
else return 2;
}
| ALGO | 0.999713 | 3.804881 |
955fc6c0-3119-4c76-9d95-33346701f714 | JeonJe/Algorithm | 4.programmers/๊ณ ๋์ kit_์คํ_ํ/ํ๋ก๊ทธ๋๋จธ์ค_ํ.cpp | //https://programmers.co.kr/learn/courses/30/lessons/42588
#include <string>
#include <vector>
#include <stack>
using namespace std;
vector<int> solution(vector<int> heights) {
vector<int> answer;
stack<pair<int, int>> st;
st.push(make_pair(0, heights[0]));
pair<int, int> current;
for (int i = 0; i < heights.... | ALGO | 0.999981 | 6.204576 |
4947d7be-479c-4552-ba29-4ca0ac0ec2a0 | njwardhan/DS-Algo | LeetCode/Strings/1910. RemoveOccurrenceofSubstr.cpp | // 1. O(N) time but the space ramification ain't the best here
class Solution {
public:
string removeOccurrences(string s, string part) {
int sub_size = part.size();
int i = 0;
while(i < s.size())
{
if(s[i] == part[0] && part == s.substr(i, sub_size))
... | ALGO | 0.999136 | 6.47274 |
235dc237-2602-47b1-a0bb-27bca17d0b0c | hjiang13/LLMs-in-IR | processed_data/DecompiledResults_Human_x_164_O0/GPT4o_Human_x_164_O0_decompiled/test/CPP_68.cpp | #include <vector>
#include <initializer_list>
#include <stdexcept>
class VectorWrapper {
public:
VectorWrapper() : v() {}
VectorWrapper(std::initializer_list<int> init) : v(init) {}
void pluck(const VectorWrapper& other) {
for (size_t i = 0; i < other.v.size(); ++i) {
int value = othe... | TOOL | 0.984094 | 6.037507 |
a31f596b-4285-432c-b977-c99f5900ff90 | filipenatanael/C_Project | Trabalho Inicio Sementre/Trabalho_Triangulo_V1.cpp | #include <stdio.h>
#include <stdlib.h>
int main(void){
int triangulo(int x, int y, int z);
int a,b,c;
bool resp;
char caracter[3] = {'A','B','C'};
for(int cont=0; cont<=2; ++cont){
printf("Digite o valor de %c: ",caracter[cont]);
switch(cont){
... | ALGO | 0.997294 | 4.390105 |
94ad6a04-b584-4ff4-a210-23918d0e5a16 | sud-dev/Algorithm-DS-Practice | CodingNinjas/Language Tools/tellposition.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int noOfStudents;
map<pair<string,int>, int> > mp;
cin>>noOfStudents;
int index = 0;
while(index<noOfStudents){
string name;int marks1, marks2, marks3, totalMarks;
cin>>name>>marks1>>marks2>>marks3;
int total=marks1+mark... | ALGO | 0.981184 | 3.763906 |
30acd542-51a4-4e7c-8a6b-c8f798eefc28 | Lucas-RCS/Listas-de-Exercicios | 1ยบ Semestre/C++/teste.cpp | #include <stdio.h>
#include <stdlib.h>
main(){
float vc,vd,vpc,ano; //vc=valor do carro, vd=valor do desconto,vpc= valor a ser pago pelo cliente
printf("Valor do carro: ");
scanf("%f",&vc);
printf("Ano do veiculo: ");
scanf("%f",&ano);
if(ano<=2000){
printf("Desconto de 12%%: %f\n",vc*0.12);
printf("Valo... | ALGO | 0.993304 | 3.683714 |
a238fc00-e131-4f6e-93d4-a92aa671c168 | PhamHung2020/Applied_Algorithms_Exercise | TTUD_Graph/TTUD_Graph_J/TTUD_Graph_J.cpp | #include <iostream>
#include <vector>
using namespace std;
int n, m, res;
bool edge[15][15];
vector<int> subgraph;
bool check(int u)
{
for (const int& v : subgraph)
{
if (!edge[u][v])
return false;
}
return true;
}
void solve(int u)
{
for (int i = u + 1; i <= n; ++i)
{
if (check(i))
{
subgraph.pus... | ALGO | 0.99983 | 4.841355 |
c62b10f4-87b5-4536-bbf3-5a7c8b672ed6 | satakuma/sio2-archive | wiekuisty-ontak-2014/jab.cpp | #include<bits/stdc++.h>
using namespace std;
#ifndef d
#define d(...)
#endif
#define st first
#define nd second
#define pb push_back
#define siz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
typedef long long LL;
typedef long double LD;
constexpr int INF=1e9+7;
constexpr LL INFL=1e18;
template<class L, class... | ALGO | 0.999994 | 5.147725 |
28bbb6de-ff17-4011-be53-40748e834142 | arshkhatwani/leetcode-problems | kth_smallest_element_in_a_sorted_matrix.cpp | #include <bits/stdc++.h>
using namespace std;
/*
Brute force => Priority Queue
push every element in a maxHeap and maintain k elements in in it
TC: O(n2) (nxn matrix)
SC: O(k)
Optimal => Binary Search
Initialise low as smallest element in matrix and high as largest element in matrix
Then while(low < high) calulate mi... | ALGO | 0.999985 | 5.531717 |
cc8d1bdf-d012-4901-a236-2818d28e22eb | metux/thunderbird | gfx/skia/skia/src/utils/SkTextBox.cpp | #include "SkTextBox.h"
#include "SkUtils.h"
static inline int is_ws(int c)
{
return !((c - 1) >> 5);
}
static size_t linebreak(const char text[], const char stop[],
const SkPaint& paint, SkScalar margin,
size_t* trailing = nullptr)
{
size_t lengthBreak = paint.b... | TOOL | 0.86375 | 6.07613 |
851b392c-69cc-4c94-8a3e-33c3ed5852e9 | ManglaPalak/DSA-cpp | Graphs/BFS DFS Problems/Count number of provinces.cpp | void dfs(vector<vector<int>>& adj,int i,vector<bool>& visited){
visited[i]=true;
for(int j:adj[i]){
if (!visited[j]){
dfs(adj,j,visited);
}
}
}
int findCircleNum(vector<vector<int>>& isConnected) {
int n=isConnected.size();
vector<v... | ALGO | 0.999987 | 6.077388 |
6cc95300-940a-4016-949a-1b7acf957062 | Aryaw1jaya/bodymassindex_flutter | 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.99887 | 6.783439 |
f67b7c95-e14b-4701-80e3-e7616fba0e97 | da1234cao/data_structure | leetcode/code/343_ๆดๆฐๆๅ.cpp | #include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int integerBreak(int n) {
// ้ข็ฎ้ๅฎ2<=n<=58
if(n==2)
return 1;
if(n==3)
return 2;
vector<int> dp(n+1,0);
dp[2] = 1;
dp[3] = 2; // ๅๅงๅ๏ผ่ฑ็ฆป้่ฆๅ่งฃๆ1็้จๅ
for... | ALGO | 0.99999 | 5.612983 |
e3b8dd0e-e22e-494a-8b96-82af33fb0e77 | Swordce/FaceDemo | sdk/src/main/cpp/megvii_facepp_jni.cpp | #include "include/MG_Facepp.h"
#include <android/log.h>
#include "megvii_facepp_jni.h"
#include <jni.h>
#include <vector>
#include <algorithm>
#include <string>
#include <chrono>
#include <cmath>
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,"mgf-c",__VA_ARGS__)
template<class point_t>
inline void rotate... | TOOL | 0.865446 | 5.294656 |
40d7326b-f43f-4185-ae4b-8a9db7ee728c | ishandutta2007/codeforces | sert/normal/22/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<vector<int>> ES;
const int INF = (int)1e9 + 41;
void dfsOrd(int v, const ES &es, vector<int> &ord, vector<bool> &u) {
if (u[v]) return;
u[v] = true;
for (int w : es[v]) dfsOrd(w, es, ord, u);
ord.push_back(v);
}
void dfsBack(int v, const ES... | ALGO | 0.999915 | 4.157201 |
69d8c5b6-e229-4254-aa98-fed81c3ff0f4 | Naseem4180/CPP-Program | decimaltooctal.cpp | #include<iostream>
using namespace std;
int main()
{
int i=1,octal=0,rem;
int decimal;
cout<<"The Number in decimal Format"<<endl;
cin>>decimal;
while(decimal!=0)
{
rem=decimal%8;
octal += rem*i;
decimal /=8;
i*=10;
}
cout<<"Decimal to Binary is: "<<octal;... | ALGO | 0.996901 | 4.757652 |
d0df09bc-5a8b-4a73-a19b-2f2777ca0ea0 | Tewatia5355/Lets_brew | 048_2Pointers.cpp | int isPlaindrome(string s)
{
int i = 0, j = s.size() - 1;
while (i < j)
{
if (s[i] != s[j])
return 0;
++i, --j;
}
return 1;
}
| ALGO | 0.99619 | 4.428308 |
cce23ff4-c7d3-46e3-91f2-8d914bbbb549 | sanjay-72/IMP-from-Jul-training-2023 | RecursionAndDP/allPossibleBinariesOfNLengthWithoutConsecutiveZeros.cpp | #include<iostream>
using namespace std;
string s0 = "0",s1 = "1";
int n;
void printNonRepBinaries(string s)
{
if(s.length() == n)
{
cout<<s<<endl;
return;
}
if(s.length() == 0 || s[s.length()-1] == '1')
printNonRepBinaries(s+"0");
printNonRepBinaries(s+"1");
}
int main()
{
c... | ALGO | 0.999981 | 4.27979 |
0c0c1947-413a-44da-b28c-724a843eb2c3 | sarvex/leetcode-brainfuck | solution/0000-0099/0053.Maximum Subarray/Solution.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int f = nums[0], res = nums[0];
for (int i = 1; i < nums.size(); ++i) {
f = nums[i] + max(f, 0);
res = max(res, f);
}
return res;
}
}; | ALGO | 0.999926 | 6.211869 |
113ee3ef-2f66-45ac-b70b-2ef25e164b61 | Gigvo/Praktikum-Pemrograman | Responsi/Responsi Soal 5/Soal_5_test.cpp | #include <iostream>
using namespace std;
void palindrom(string input) {
string temp;
temp = input;
int n = input.length();
for (int i = 0; i < n; i++) {
input[i] = temp[n - i - 1];
}
if (input == temp) {
cout << input << " adalah Palindrom" << endl;
}
else {
cout... | ALGO | 0.994315 | 5.667494 |
746db951-5cc5-448d-ac91-db1277068d85 | zimpha/acm-icpc | archived/CF#245/1C.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int a[30], b[30], son[30], n;
bool solve(int dep) {
if (dep == n) {
for (int i = 0; i < n; ++ i)
if (a[i] > 1 || (b[i] > 1 && son[i] < 2)) return false;
return true;
}
for (int i = 0; i < dep; ++ i) {
if (a[dep] < a[i] - (!son[i])) {
a[i] -=... | ALGO | 0.999997 | 3.676137 |
06aabe4a-2620-45e1-b5a5-e04ffff5e1df | sarvex/leetcode-powershell | solution/1700-1799/1763.Longest Nice Substring/Solution.cpp | class Solution {
public:
string longestNiceSubstring(string s) {
int n = s.size();
int k = -1, mx = 0;
for (int i = 0; i < n; ++i) {
int lower = 0, upper = 0;
for (int j = i; j < n; ++j) {
char c = s[j];
if (islower(c))
... | ALGO | 0.999966 | 6.320702 |
c61823eb-32eb-4a28-99bd-8c7431e12e4b | Riki-Coddee/Data-Structure-Algorithm | Dynamic Programming/bitonicSubsequence.cpp | #include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
#define rep(i,a,b) for(int i=a; i<b; i++)
#define vi vector<int>
#define vvi vector<vi>
const int N= 1e3+2, MOD = 1e9+7;
int main(){
int n = 8;
vector<int> a = {1,11,2,10,4,5,2,1};
vector<int> forward(n, 1), ... | ALGO | 0.999744 | 3.817547 |
0a82c8f6-b4a6-4a13-9284-5cc99749454a | Tan28bha/Data-Structures-Algorithms | Arrays.cpp/Easy/4.cpp | // OPTIMAL APPROACH -> If unsorted array is there first sort it , after that init i=0 then run a for loop for j till n and check for the condition mentioned and at last return i+1 which will give the number of unique elements
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int removeduplicates(int arr... | ALGO | 0.999611 | 5.962573 |
01b90bfa-2e99-4989-b3ab-c7812bd37bbc | by-student-2017/lammps-couple | src/nstencil_half_bin_3d_newton_tri.cpp | #include "nstencil_half_bin_3d_newton_tri.h"
#include "neighbor.h"
#include "neigh_list.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NStencilHalfBin3dNewtonTri::NStencilHalfBin3dNewtonTri(LAMMPS *lmp) :
NStencil(lmp) {}
/* -----------------------------... | ALGO | 0.861683 | 4.166811 |
f34dcc55-31de-4237-a43a-806318de3b7a | lmckenzie99/CSC212 | ha01/problem-g.cpp | #include <iostream>
#include <vector>
int main() {
int totalRooms, roomsBooked;
std::cin >> totalRooms >> roomsBooked;
std::vector<bool> booked(totalRooms + 1, false); // To track booked rooms (1-based index)
for (int i = 0; i < roomsBooked; i++) {
int room;
std::cin >> room;
... | ALGO | 0.999931 | 5.118924 |
1d2defac-ee1d-4b42-abd3-625caab25d8b | Kristiyan93/Cpp-Fundamentals | 05. STL Associative Containers/04CarProgram.cpp | #include <iostream>
#include <map>
int main() {
int count;
std::cin >> count;
std::string made, model;
int year;
std::multimap<std::string, std::pair<std::string, int> > cars;
for (int i = 0; i < count; ++i) {
std::cin >> made >> model >> year;
cars.emplace(made, std::make_pai... | ALGO | 0.998341 | 4.695366 |
d5dcd60e-f425-424f-93e4-e18898fe11b9 | linchik-l/Lesson42Solution | Task01/task02.cpp | void bubble_sort_asc(int* array,int size) {
for (int i = 0; i < size -1; i++)
{
bool flag = true;
for (int j = 0; j < size - 1 - i; j++)
{
if (array[j] > array[j + 1]) {
int t = array[j];
array[j] = array[j + 1];
array[j + 1] = t;
flag = false;
}
}
if (flag == true) {
break;
}
}
... | ALGO | 0.999932 | 4.29975 |
cf070b52-01e0-41f1-8ffc-b43321f7afcf | airejtashfeen/Leetcode | (M)delete_middle_node_of_linked_list.cpp | #include <iostream>
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* deleteMiddle(ListNode* head) {
if(head==NULL || ... | ALGO | 0.999928 | 6.499202 |
e05659fc-42bc-4058-b66a-1bc355fd278a | NguyennGiang/CP_tutorial | Competitive Programming 2/Dynamic programming 1/cuTa.cpp | #include <bits/stdc++.h>
using namespace std;
const int weight[6] = {1, 2, 5, 10, 15, 20};
const int INF = 1e9;
int main(){
int n;
cin >> n;
vector <int> p(n);
for (int &pi : p) cin >> pi;
int sum = 0;
for (int pi : p) sum += pi;
reverse(p.begin(), p.end());
int w; cin >> w;
int dp... | ALGO | 0.999945 | 4.06802 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.