uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
55b66b9d-249b-4117-9527-c765c7135004 | DaniruAnime/branching-cycles | main.cpp | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
setlocale(LC_ALL,"rus");
const double g = 9.81; // ускорение силы тяжести
const double d = 19.1 / 100; // диаметр трубы в метрах
const int n = 6; // количество скоростей
double velocities[n] = {1, 2, 5, 10... | ALGO | 0.995674 | 4.540345 |
b1484e8e-ca00-4cb7-a2b2-7cf0cd6f06aa | trueilorp/Programming-challenges | container_with_most_water/main.cpp | #include <iostream>
#include <vector>
#include <random>
using namespace std;
const int N = 1000;
int max_water(vector<int> heights){
}
int main(){
int size = N;
vector<int> heights(size, 0);
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<> distrib(1, 100);
for(int i = 0; i < size; ++i) {... | ALGO | 0.993464 | 4.127988 |
be8b1a4d-81d6-4401-8b2c-581e4f265148 | snumrl/ys2010 | PyCommon/external_libraries/BaseLib/math/nr/cpp/recipes/mrqmin.cpp | #include "nr.h"
void NR::mrqmin(Vec_I_DP &x, Vec_I_DP &y, Vec_I_DP &sig, Vec_IO_DP &a,
Vec_I_BOOL &ia, Mat_O_DP &covar, Mat_O_DP &alpha, DP &chisq,
void funcs(const DP, Vec_I_DP &, DP &, Vec_O_DP &), DP &alamda)
{
static int mfit;
static DP ochisq;
int j,k,l;
int ma=a.size();
static Mat_DP oneda(ma,1);
static... | ALGO | 0.999909 | 4.650032 |
a77588af-63cc-488d-86c3-14500325c3c7 | VaibhavVerma2001/Cipher-School-CP-week3 | searching&sorting/find-first-and-last-position-of-element-in-sorted-array.cpp | // https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int firstOccurrence(vector<int> &nums, int start, int end, int target)
{
if (start > end)
return -1;
if (start == end)
... | ALGO | 0.999915 | 6.509943 |
a5475fcd-2674-4b2f-94d5-a9705c0f23c9 | arnold518/ps-notes | temp/teamnote/Math/Number Theoretic Transform/ntt.cpp | // mint must be included
namespace NTT
{
const mint G = 3; // primitive root of MOD
const int MAXB = 21;
const int MAXN = (1<<MAXB); // MAXN must divide MOD-1
vector<mint> W;
vector<int> rev;
void init()
{
W=vector<mint>(MAXN);
rev=vector<int>(MAXN);
W[0]=1; W[1]=m... | ALGO | 0.999846 | 4.080586 |
f3f3baea-cb44-445d-9e3f-0115700f3a73 | nikitonium/nikito | src/bip39.cpp | // Source:
// https://github.com/trezor/trezor-crypto
#include <bip39.h>
#include <bip39_english.h>
#include <crypto/sha256.h>
#include <random.h>
#include <openssl/evp.h>
SecureString CMnemonic::Generate(int strength)
{
if (strength % 32 || strength < 128 || strength > 256) {
return SecureString();
... | TOOL | 0.885618 | 6.366845 |
a3be74ea-9193-450f-b611-6e45a6ad44d8 | ishandutta2007/codeforces | davoth/normal/333/D.cpp | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll MAX_N=1e3+10;
ll a[MAX_N][MAX_N],n,m;
bool check(ll k){
bool b[MAX_N][MAX_N];
for(ll i=0; i<n; i++){
for(ll j=0; j<m; j++){
if(a[i][j]>=k) b[i][j]=1;
else b[i][j]=0;
}
}
bool c[MAX_N]... | ALGO | 0.99997 | 4.168842 |
c21df827-fa17-40e3-9ab7-75a07789628c | DhrutikS257/CSE-5311-Algo | HW2/src/insertion_sort/insertion_sort.cpp | #include "insertion_sort.hpp"
#include <iostream>
using namespace std;
#define SWAP(a, b) { uint32_t temp = a; a = b; b = temp; }
void print(uint32_t *arr, int size) {
if (size <= 20){
for(int i = 0; i < size; i++) {
cout << arr[i] << " ";
}
cout << endl;
}
}
void insertio... | ALGO | 0.999098 | 5.021119 |
e9ce70a0-1e05-4f39-8dc6-59a7d81f6730 | Cavan09/School_IOS_Mobile_Game_Framework | Source/Libraries/Box2D/Collision/b2DynamicTree.cpp | #include "b2DynamicTree.h"
#include <cstring>
#include <cfloat>
using namespace std;
b2DynamicTree::b2DynamicTree()
{
m_root = b2_nullNode;
m_nodeCapacity = 16;
m_nodeCount = 0;
m_nodes = (b2TreeNode*)b2Alloc(m_nodeCapacity * sizeof(b2TreeNode));
memset(m_nodes, 0, m_nodeCapacity * sizeof(b2TreeNode));
// Buil... | ALGO | 0.997893 | 7.718022 |
4ffd8e25-3428-4247-a804-222015e82e05 | CodeWilliamT/MyAlgorithms | C++_Algorithm/LeetCodeDemo/LeetCodeDemo/0228.cpp | using namespace std;
#include <iostream>
#include <vector>
#include <string>
//ģ
//
class Solution {
public:
vector<string> summaryRanges(vector<int>& nums) {
vector<string> rst;
int head,last = 0;
for (int& e : nums) {
if (rst.empty()||last+1!=e) {
rst.push_back(... | ALGO | 0.999983 | 5.901427 |
cda348a7-3a53-40e2-af06-579507dbb07e | ICraZZyBoY/Algorithms-Trainings | UNIVERSITY (ICPC, codeforces, contests, etc.)/!BNTU/02.10.2024/L.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
vector <int> diffColors;
vector < set <int> > colors;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n, k;
cin >> n >> k;
vector <int> c(n + 1);
vector <i... | ALGO | 0.999928 | 3.581848 |
76136d6f-c704-483e-9a15-65e15eded903 | xiebaoma/leetcode-cpp-interview-prep | LeetCode_Google/tribonacci.cpp | /**
* xiebaoma
* 2025-06-25
* 使用迭代比使用递归要快
*/
#include <vector>
using namespace std;
class Solution
{
public:
int tribonacci(int n)
{
if (n == 0)
{
return 0;
}
if (n == 1)
{
return 1;
}
if (n == 2)
{
return ... | ALGO | 0.99998 | 5.972636 |
0a5b2aa2-2690-46f6-94a4-4947848a8051 | yeputons/hse-2019-pb | 191128/sources/09-two-threads-bad-mutex.cpp | #include <assert.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
const int N = 500000;
const int M = 10000;
int data;
void* worker(void*) {
pthread_mutex_t m;
pthread_mutex_init(&m, NULL);
for (int i = 0; i < N; i++) {
pthread_mutex_lock(&m);
data++;
pthread_mutex_un... | ALGO | 0.974554 | 4.454906 |
a4d2fdde-c949-4bda-a074-05f618b0099e | PrasadB2003/oops | accenture/mangosdisrtu.cpp | #include <iostream>
using namespace std;
// Function to calculate factorial of a number
long long factorial(int n) {
long long result = 1;
for (int i = 2; i <= n; i++) {
result *= i;
}
return result;
}
// Function to calculate the binomial coefficient C(n, k)
long long binomialCoefficient(int ... | ALGO | 0.999999 | 6.447893 |
01b60af5-3479-4f4f-8979-4d8fdea36200 | SearchRPI/SearchRPI | src/query-processing/query.cpp | #include "query.hpp"
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <climits>
namespace query {
// Load dictionary from a file
std::unordered_set<std::string> loadDictionary(const std::string& filepath) {
std::unordered_set<std::string> dictionary;
std::ifstream file(f... | ALGO | 0.940813 | 5.949517 |
9b174e9d-8a02-4e2d-9fc3-059922c462ec | ishandutta2007/codeforces | maspy/normal/136/A.cpp | #line 1 "main.cpp"
#include <bits/stdc++.h>
#line 3 "/home/maspy/library/my_template.hpp"
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T> using vc = vector<T>;
template <class T> using vvc = vector<vc<T>>;
template <class T> using v... | ALGO | 0.999932 | 4.339245 |
a8bf717b-fb87-4dd0-9f59-8735e3502ba7 | omidm/nimbus | applications/physbam/physbam-lib/Public_Library/PhysBAM_Dynamics/Coupled_Evolution/FLUID_TO_SOLID_INTERPOLATION_PHI.cpp | using namespace PhysBAM;
//namespace PhysBAM{template<class TV> void Add_Debug_Particle(const TV& X, const VECTOR<typename TV::SCALAR,3>& color);}
//namespace PhysBAM{template<class TV,class ATTR> void Debug_Particle_Set_Attribute(ATTRIBUTE_ID id,const ATTR& attr);}
//###################################################... | ALGO | 0.994571 | 5.306194 |
27b8e901-1845-428b-a504-481695b965f1 | next-step-for-interview-prep/Daily-leetcode-problem_with_detailed_solutions | 208-26th_July-Find_city/code.cpp | class Solution
{
public:
int findTheCity(int n, vector<vector<int>> &edges, int distanceThreshold)
{
vector<vector<int>> dist(n, vector<int>(n, INT_MAX));
for (int i = 0; i < n; i++)
{
dist[i][i] = 0;
}
for (auto &edge : edges)
{
int u = e... | ALGO | 0.999987 | 5.870192 |
af5f0654-af5b-4ba7-b53f-5f286b0269c0 | Lonebear69/https-github.com-UberGuidoZ-FlipperZeroHondaFirmware | flipperzero-firmware/lib/mlib/bench/bench-find-sort.cpp | // program to find longest contiguous subsequence
// based on https://www.geeksforgeeks.org/longest-consecutive-subsequence/
#include <iostream>
#include <unordered_set>
using namespace std;
// Returns length of the longest contiguous subsequence
int cpp_find_longest(int arr[], int n)
{
unordered_set<int> S; ... | ALGO | 0.999742 | 5.267334 |
170c21b7-6dae-4c66-9888-ed287cffedf8 | dtkien205/CPP-PTIT | CPP06_Class/CPP0629.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
class DoanhNghiep {
public:
string ma, name;
int sl;
friend istream& operator>>(istream& in, DoanhNghiep& a)
{
in >> a.ma;
scanf("\n");
getline(in, a.name);
in >> a.sl;
return i... | ALGO | 0.999619 | 4.286343 |
c1bc8e21-0171-4135-8447-8d39f9f65257 | deserted335/baekjoon_record | class3/9375.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
// string : Sort of Clothes, int : # of Clothes of that Sort.
vector<pair<string, int>> WhatKindOf;
int KindIdx(string tmp){
// WhatKindOf.size() <= 30. So total O(N^2) method is fine.
for(int i = 0; i < WhatKindOf.size(); i++) {
if(W... | ALGO | 0.999787 | 4.165955 |
77de188d-0af6-4140-8ff1-b62405733e2e | Cebion/aquatic_bubble | src/enemigos.cpp | #include "enemigos.h"
#include "juego.h"
enum {PARADO, CAMINA, CORRE, SALTA, ENCERRADO, MUERE, COLISION};
/*!
* \brief imprime a pez.
*/
void enemigos :: imprimir(SDL_Surface *screen, SDL_Rect *rect)
{
ima->imprimir(animaciones[estado][paso], screen, rect, x, y, flip);
}
void enemigos :: colision_con_burbuja(void... | ALGO | 0.950479 | 4.095362 |
79f91a0d-1d0d-43d5-8302-90fa170bd61c | m-abdeltwab/cpp-problems | 09_Functions/01_Max_of_6_numbers.cpp | #include <iostream>
using namespace std;
int max(int a, int b, int c){
return max(a, max(b, c));
}
int max(int a, int b, int c, int d){
return max(max(a, b, c), d);
}
int max(int a, int b, int c, int d, int e){
return max(max(a, b, c, d), e);
}
int max(int a, int b, int c, int d, int e, int f){
retu... | ALGO | 0.999397 | 4.112446 |
12a9d4ae-f29e-4f1e-b0f4-322ce2ba1444 | butasebi/OOP | Homework2_v2_OOP.cpp | #include <iostream>
using namespace std;
// Clasa nod (pentru lista simplu inlantuita)
class Nod
{
int info;
Nod * next;
static int ct; //ct retine numarul total de noduri citite de program
public:
friend istream & operator >>(istream & in, Nod & alfa);
friend ostream & operator <<(os... | TOOL | 0.955404 | 3.044955 |
d5b267dc-81e3-454c-a4c8-92691a12d1e6 | anshyyy/CPP | Codeforces/1537B.cpp | #include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long int
#define loop(n) for(int i=0;i<n;i++)
using namespace std;
void solve(){
int n,m,x,y;
cin>>n>>m>>x>>y;
cout<<"1 1"<<" "<<n<<" "<<m<<endl;
}
int main() {
int t=1;
cin>>t;
while(t--){
solve();
}... | ALGO | 0.989528 | 3.067853 |
ec6d49fd-a52a-44ce-9a42-2d4a30ce3700 | gem5/gem5 | src/systemc/tests/systemc/misc/user_guide/chpt4.2/numgen.cpp | /*****************************************************************************
numgen.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************... | TOOL | 0.969668 | 5.198626 |
ded7cf69-13da-4b0e-83c3-07034dd772ed | liu946/HandwrittenNumeralRecognition_ANN_CUDA | HOST/functionandmain.cpp | #include <iostream>
#include <string>
#include <cmath>
#include <fstream>
using namespace std;
float sigmoid(float x){
return 1.0f / (1.0f + exp(-x));
}
template <typename T = float>
void initdata(string filename, unsigned int size, T * p){
fstream file(filename);
for (unsigned int i = 0; i<size; i++) {
... | DATA | 0.960967 | 3.938617 |
67d98a29-a41b-452e-be0b-557fe83e1418 | MaurerSimon/Computational-applied-methods | Q1/Q1dTbottom/main.cpp | #include <iostream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <cmath>
const double PI = 3.14159265358979323846264338327950288419716939937510;
int main(int argc, char* argv[])
{
//initial Data CASE2 Input
double alpha = 4.0;
double theta0 = 0.5*PI;
double T = 1.0;
int N;
... | ALGO | 0.99974 | 4.127653 |
17e25cee-ec5e-4ad9-ba52-47158ee86379 | NgrTushar/oneForAllCourse | cppex/dsa/recursion/fibo.cpp | #include<iostream>
using namespace std;
int fibo(int n)
{
if(n<=1) return n;
return fibo(n-1)+fibo(n-2);
}
int main()
{
int n;
cin>>n;
fibo(n);
return 0;
}
| ALGO | 0.999938 | 3.827244 |
efe6a5fb-bf4b-4a53-ab51-b172cec389f7 | aquelemiguel/road-to-swerc | spoj/june-2018/TRICOUNT.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0); // Input and output become more efficient.
cin.tie();
int t;
long long n;
scanf("%d", &t);
while (t--) {
scanf("%lld", &n);
printf("%lld\n", (long long) (n * (n+2) * (2*n+1))/8);
}
} | ALGO | 0.999545 | 4.823808 |
1e1f5658-b90e-4672-bd37-fc5d7aaa0df6 | kvebers/CPP | CPP08/ex01/Span.cpp | #include "Span.hpp"
Span::Span() : _maxLen(10) {}
Span::~Span() {}
Span &Span::operator=(const Span &idk) {
if (this == &idk) return *this;
_maxLen = idk._maxLen;
_span = idk._span;
return *this;
}
Span::Span(const Span &idk) {
_maxLen = idk._maxLen;
_span = idk._span;
}
Span::Span(unsigned int len) : _maxLe... | ALGO | 0.940793 | 4.721889 |
c17c1d31-c8b1-4c6c-895b-751f389dd964 | HONG-LOU/training | Daily_Training/24-4/9/c.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int n, m, c1, c2;
int dis[510], weight[510], e[510][510], num[510], w[510], pre[510];
bool visit[510];
const int inf = 99999999;
void printPath(int v) {
if(v == c1) {
printf("%d", v);
return ;
}
printPath(pre[v]);
printf(" %d", ... | ALGO | 0.999962 | 3.768812 |
d31efaa2-deec-4ad3-bf0c-8933376ac8dd | arundil/OCR7Segments | tess-two/jni/com_googlecode_tesseract_android/src/wordrec/segsearch.cpp | #include "wordrec.h"
#include "associate.h"
#include "language_model.h"
#include "matrix.h"
#include "params.h"
#include "lm_pain_points.h"
#include "ratngs.h"
namespace tesseract {
void Wordrec::DoSegSearch(WERD_RES* word_res) {
BestChoiceBundle best_choice_bundle(word_res->ratings->dimension());
// Run Segment... | ALGO | 0.998628 | 6.680286 |
1d47cf3b-6116-4104-b249-14da2ac06ab1 | shivangigoel1302/Data-Structures-and-algorithm | hashing/hashingsumofsubarray.cpp | #include<iostream>
#include<unordered_map>
using namespace std;
int ksubarraysum(int a[],int n)
{
unordered_map<int,int>mp;
int len=0;
int pre=0;
for(int i=0;i<n;i++)
{
pre+=a[i];
if(a[i]==k && len==0)
{
len=1;
}
if(pre==k)
{
le... | ALGO | 0.999986 | 4.573062 |
e0d18a5e-c441-4be0-bccb-1739863aa09f | aufanam/Competitive-Programming | 1739A.cpp | #include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
using namespace std;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n, m;
... | ALGO | 0.999774 | 4.861705 |
9f194cb9-6f8e-4e78-b1f9-c5b7a89cd9c9 | WinkingFaceAI/vllm-recooked | csrc/cpu/pos_encoding.cpp |
#include "cpu_types.hpp"
namespace {
template <typename scalar_t>
void rotary_embedding_impl(
const int64_t* __restrict__ positions, // [batch_size, seq_len] or
// [num_tokens]
scalar_t* __restrict__ query, /// [batch_size, seq_len, num_heads,
... | ALGO | 0.985555 | 7.519871 |
7fa3d483-77fb-4078-a8f8-ac03bc235452 | nkirov/nkirov.github.com | 2007/CSCB441/Volen/Hidden_Password.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int T, L;
string S;
vector<int> answers;
cin >> T;
for(int i = 0; i < T; i++)
{
vector<string> shifts;
cin >> L;
getl... | ALGO | 0.99959 | 3.248456 |
2155cd6f-2a41-4135-9ff0-2fa11d69a6ff | gitmanav/CppMastery | Difficulty: Easy/Split an array into two equal Sum subarrays/split-an-array-into-two-equal-sum-subarrays.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool canSplit(vector<int>& arr) {
// code here
int sum1=0,sum2=0;
int i=0,j=arr.size()-1;
while (i<=j){
if(sum1>=sum2) sum2+=arr[j--];
else s... | ALGO | 0.986943 | 6.06005 |
8d7e0b10-0d1c-4a73-8c0a-2469f023c7a4 | jaimeyu/FlightBookingSystem | COEN 345-Iteration2/c345Project/hashlib/hl_md5.cpp | //----------------------------------------------------------------------
//----------------------------------------------------------------------
/**
* @file hl_md5.cpp
* @brief This file contains the implementation of the MD5 class
* @date Mo 17 Sep 2007
*/
//--------------------------------------------... | ALGO | 0.996743 | 6.617315 |
3d6626f6-7e28-487c-a619-3aada697873f | adityanjr/code-DS-ALGO | Statistical Methods/1. Bisection Method.cpp | #include <iostream.h>
#include <conio.h>
#include <math.h>
float eq(float i)
{
return (pow(i, 3) - (4 * i) - 9); // original equation
}
void main()
{
float a, b, x, z;
clrscr();
for (int i = 0; i < 100; i++)
{
z = eq(i);
if (z >= 0)
{
b = i;
a = --i;
goto START;
}
}
START:
cout << "\nFirst i... | ALGO | 0.999995 | 3.833623 |
b857c5b7-c8b0-4428-829b-f5d594b89776 | darrylteo/cp4-solutions | 6 String Processing/1. Ad Hoc String Processing (Harder)/f. Really Ad Hoc/periodicstrings.cpp | #include <bits/stdc++.h>
using namespace std;
void rotate(string &s) {
s = s.back() + s.substr(0, s.size() - 1);
}
int main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//freopen("error.txt", "w", stderr);
std::ios::sync_with_stdio(false);
std::cin.tie(nullpt... | ALGO | 0.999945 | 4.28978 |
e2b9d605-50f3-4fa4-833f-e800d672268c | vishusharmaX/100DaysofCodeChallenge | Difficulty: Easy/Queue using two Stacks/queue-using-two-stacks.cpp | /* The structure of the class is
class StackQueue{
private:
// These are STL stacks ( http://goo.gl/LxlRZQ )
stack<int> s1;
stack<int> s2;
public:
void push(int);
int pop();
}; */
void StackQueue::push(int B) {
if(s1.empty() && s2.empty()){
s1.push(B);
}else{
while(!s1.empty... | ALGO | 0.99967 | 4.653398 |
f180ad46-3ef3-41fb-a5ce-2f4f9baa3323 | Nilesh-0203/Daily-Codes | Difficulty: Easy/Palindrome Sentence/palindrome-sentence.cpp | class Solution {
public:
bool isPalinSent(string &s) {
// code here
string ans="";
for(int i=0;i<s.length();i++){
if(s[i]>='A' && s[i]<='Z'){
ans+=s[i]+32;
}
else if(s[i]>='0' && s[i]<='9'){
ans+=s[i];
}
... | ALGO | 0.999741 | 6.040079 |
4972857d-f52f-474a-9b1d-11b6324df1cb | Dhiraj03/InterviewPrep | BinarySearch/MinMaxSubarraySum.cpp | /* Book allocation(IB) /Shipping weights(LC)
Approach - Binary Search - the start is the max in the array and the end is
the sum of all elements in the array - for every middle element,
check if this satisfies the condition, if it does, move to the left, if it
doesnt, move to the right
*/
class Solution
{
public:
i... | ALGO | 0.999987 | 5.730315 |
423a1b85-e9d6-48e6-8937-e2fb909ddf55 | eosspark/eos-sidechain | SideChain/contracts/libc++/upstream/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp | // <algorithm>
// template<InputIterator Iter, Callable<auto, Iter::reference> Function>
// requires CopyConstructible<Function>
// Function
// for_each(Iter first, Iter last, Function f);
#include <algorithm>
#include <cassert>
#include "test_iterators.h"
struct for_each_test
{
for_each_test(int c) : cou... | TEST | 0.950263 | 6.755924 |
fc784b3a-4b13-49d4-90da-c3537eb0eb2e | ishandutta2007/codeforces | chemthan/normal/856/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
... | ALGO | 0.999611 | 3.810541 |
f43f1527-ce9a-462f-9cdc-ab6329f20222 | p-sh07/cpp-course-extended | yandex/02.Производительность и оптимизация/01.Профилирование/09.Вглубь процессора/main.cpp | //
// 05.Производительность и оптимизация
// Тема 1.Профилируем и ускоряем
// Задача 09.Вглубь процессора (оптимизация)
//
// Created by Pavel Sh on 23.12.2023.
//
#include "log_duration.h"
#include <iostream>
#include <numeric>
#include <random>
#include <string>
#include <vector>
using namespace std;
vector<f... | ALGO | 0.997778 | 6.354384 |
4eb97517-2f26-4aea-bf58-639a8cb13a25 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-gpt4/Codenet/p02283/643337530/response_9.cpp | #include <iostream>
#include <memory>
#include <string>
struct Node {
int key;
std::shared_ptr<Node> left, right;
};
std::shared_ptr<Node> root;
void insert(int k) {
auto z = std::make_shared<Node>();
z->key = k;
if (root == nullptr) {
root = z;
} else {
std::shared_ptr<Node> ... | ALGO | 0.999931 | 5.932008 |
b20cb077-0ef6-4d25-82d4-15a5bc24b818 | RQuispeC/CPproblemsSolved | FlightPlanning.cpp | #include<bits/stdc++.h>
#define MAX (int) 2505
using namespace std;
typedef pair < int , int > pii;
typedef vector < int > vi;
typedef vector < pii > vii;
vector < vi > lista;
bool vis[MAX];
int p[MAX], dist[MAX], far[MAX], n;
pii diametro(int node)
{
memset(vis, 0, sizeof vis);
memset(p, -1, sizeof p);
queue < int ... | ALGO | 0.999903 | 4.053642 |
d9890ce9-2203-44d7-98bc-b346b6c4d409 | james61124/LeetCode | 0105-construct-binary-tree-from-preorder-and-inorder-traversal/0105-construct-binary-tree-from-preorder-and-inorder-traversal.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.999982 | 6.312427 |
6841efa8-ad9a-470f-ba1f-6aa7c3772823 | elunac19/test_repo_swe_agent | tests/test_findMax.cpp | #include "gtest/gtest.h" // GoogleTest header
#include "findMax.h" // Your header file with the findMax function
// Test Suite for findMax function
// The first parameter is the test suite name, and the second is the test case name.
// Test case for a typical vector with positive numbers
TEST(FindMaxTest, Handles... | TEST | 0.951903 | 7.205937 |
86a3c414-df48-4887-bab4-df1d5ebfb897 | Priyo002/AZ-Solution-Codes-VG-s-Style- | DP/Maximising The Cost.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define int long long
#define pb push_back
#define endl '\n'
co... | ALGO | 0.999591 | 5.299678 |
40056658-f9d4-439a-bef0-cd5a59c295bc | baskinburak/cf | round611-1283/e.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_set>
#include <map>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> x(n);
for(int i = 0; i < n; i++) { cin >> x[i]; }
sort(x.begin(), x.end());
vector<int> x_m = x;
x_m[0]--;
int max_count = 1... | ALGO | 0.999727 | 4.524897 |
a8fed8e6-eb9d-4764-b9bf-977aad0125bf | haopham24/CTDL-GT2021 | CTDL_so_khoi_lap_phuong.cpp | /*
Một số X được gọi là số khối lập phương nếu X là lũy thừa bậc 3 của số Y (X= Y^3). Cho số nguyên dương N, nhiệm vụ của bạn là tìm số khối lập phương lớn nhất bằng cách loại bỏ đi các chữ số của N. Ví dụ số 4125 ta có kết quả là 125 = 5^3.
Input:
Dòng đầu tiên đưa vào số lượng bộ test T.
Những dòng kế tiếp đưa vào ... | ALGO | 0.999927 | 4.763482 |
da720a2e-2257-4b6d-8822-fd23d94e3d3f | AhJo53589/leetcode-cn | problems/shortest-path-in-a-grid-with-obstacles-elimination/SOLUTION.cpp |
//////////////////////////////////////////////////////////////////////////
int shortestPath(vector<vector<int>>& grid, int k)
{
vector<vector<int>> dd = { {0,1},{1,0},{0,-1},{-1,0} };
int m = grid.size();
int n = grid[0].size();
vector<vector<vector<bool>>> vi(m, vector<vector<bool>>(n, vector<bool>(k + 1, false... | ALGO | 0.999967 | 5.590163 |
7d948c58-2211-4a08-a4c3-b91f7a5398ef | rahul-aggarwal000005/Data-Structures-and-Algorithms | Day-13/Largest rectangle in a histogram.cpp | class Solution {
public:
int largestRectangleArea(vector<int>& arr) {
int n = arr.size();
vector<int> right(n,n);
vector<int> left(n,-1);
stack<pair<int,int>> st;
for(int i=0;i<n;i++){
while(!st.empty() and st.top().first > arr[i]){
right[st.top().... | ALGO | 0.999925 | 6.207998 |
0ce62f79-9b99-4058-a946-0ee8ff6e8df1 | Harshydv09/CPP | sum.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int i,sum=0;
int arr[5]={1,2,3,4,5};
for(i=0;i<5;i++){
sum=sum+arr[i];
cout<<arr[i]<<endl;
}
cout<<sum<<endl;
return 0;
} | ALGO | 0.999551 | 3.080595 |
75321949-c99a-4549-9889-905404e308ef | kibernetik76/lab9 | main.cpp | #include <iostream>
using namespace std;
template<typename Type>
int HigherFunc(Type massiv[],int size) { // меньше ли заданное число числа 10
int A = 0;
for (int i = 0; i < size;i++){
if ((massiv[i])<10){
A++;
}
}
return A;
}
template<typename Type>
int SumFunc(Type massiv... | TOOL | 0.993443 | 3.444603 |
ee9ff2e1-9250-4ebb-9b9b-5d212594ae36 | shuoxuanli/USACO | Bronze/2019-2020/Open/social distancing I.cpp | #include <iostream>
#include <fstream>
using namespace std;
int find_largest_interior_gap(string s, int &gap_start) {
int biggest_gap = 0, current_start = -1, N = s.length();
for (int i=0; i<N; i++)
if (s[i] == '1') {
if (current_start!=-1 && i-current_start > biggest_gap) {
biggest_gap = i-current_st... | ALGO | 0.99999 | 4.068591 |
00933e75-0967-453f-9594-eb3a51a49993 | ishandutta2007/codeforces | qiuzx/normal/617/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,ans=0,i;
cin>>n;
while(n!=0)
{
for(i=5;i>0;i--)
{
if(n>=i)
{
break;
}
}
ans+=n/i;
n%=i;
}
cout<<ans<<endl;
return 0;
} | ALGO | 0.999978 | 3.884795 |
0bf8ea02-dfab-4584-9a78-3ceda2709a47 | Strawberry9583/LeetCode | Leetcode1_99/Leetcode_35/LeetCode_35/leetcode35.cpp | //35. Search Insert Position
//Given a sorted array and a target value, return the index if the target is found.If not, return the index where it would be if it were inserted in order.
//
//You may assume no duplicates in the array.
//
//Example 1:
//
//Input: [1, 3, 5, 6], 5
// Output : 2
// Example 2 :
//
// Input : ... | ALGO | 0.999992 | 6.116337 |
cdd7f92a-7c20-4565-a37f-4a2405895f20 | ixray-team/ixray-1.0-stsoc | src/xrQSlim/src/mat4.cpp | /************************************************************************
4x4 Matrix class
$Id: mat4.cxx,v 1.4 2000/12/04 06:18:37 garland Exp $
************************************************************************/
#include "stdafx.h"
#pragma hdrstop
#include "mat4.h"
Mat4 Mat4::I()
{
return Mat4(Ve... | ALGO | 0.99816 | 6.801439 |
86968a26-6d23-4421-9424-f0b5520f97f2 | qwertier24/AC | USACOTraning/2.3.2.cpp | /*
ID: mayukun3
PROG: nocows
LANG: C++
*/
#include <stdio.h>
#define MOD 9901
int d[300][300]={0},f[300]={0},n,h;
int main()
{
freopen("nocows.in","r",stdin);
freopen("nocows.out","w",stdout);
scanf("%d %d",&n,&h);
if(n%2==0)
{
printf("0\n");
return 0;
}
n=(n-1)/2;
h=h-1;
f[0]=1;
d[1][1]=1;
d[0][0]=1;
f... | ALGO | 0.999974 | 3.792875 |
8ee708bd-439a-4193-a3e7-9df661d154b8 | NipunAgrawal-SectionS51/C-assignment | 31. C program to find sum of all elements of array.cpp | #include <stdio.h>
int main()
{
int arr[100], size, i, sum = 0;
printf("Enter size of the array: ");
scanf("%d", &size);
printf("Enter elements of the array: ");
for(i=0; i<size; i++)
{
scanf("%d", &arr[i]);
sum = sum + arr[i];
}
printf("Sum of all elements of array =... | ALGO | 0.901779 | 3.445671 |
2ba4361d-04f4-4f20-8bc8-67c3ac8994b2 | vaibhavarya1622/competitive-programming | cses/String Algorithms/String_Functions.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#ifndef rd
#define trace(...)
#define endl '\n'
#endif
#define gc getchar_unlocked
#define ... | ALGO | 0.99979 | 3.968632 |
e399b9d3-858b-4732-a1a7-ebd8a5479efa | neerajrpatil/TLE-31 | 1000/1.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define nline "\n"
#define pb push_back
#define ppb pop_back
#define mp... | ALGO | 0.999965 | 5.430535 |
be2d9754-9f24-4c5f-a4ae-4eb02a2672fa | joshuabrandes/progs-exercises | aufgabe1/sqareroot/sqrt.cpp | // should implement the function newton_sqrt
#include <iostream>
#include <cmath>
#include <cassert>
// function to calculate square root using newton's method
double newton_sqrt(double x)
{
assert(x >= 0);
double guess = x;
double root = 0;
while (true)
{
root = (guess + x / guess) / 2;
... | ALGO | 0.998845 | 5.163631 |
dd71e2c9-46f1-4a7c-8df4-e2a88817b1d5 | UtkarshPathrabe/Competitive-Coding | SPOJ Solutions/GSS3.cpp | #include <cstdio>
#include <algorithm>
#define MAX 100000
using namespace std;
struct no {
int lsum, rsum, msum, sum;
};
no tree[ 4 * MAX + 1 ];
int sums[ MAX + 1 ], array[ MAX + 1 ];
void init( int node, int i, int j ) {
if ( i == j ) {
tree[ node ] = ( ( no ) { array[ i ], array[ i ], array[ i ], ... | ALGO | 0.999947 | 5.2511 |
3f5c822d-7486-49b8-9f99-1c48fc76e20b | BugsInCodeYT/Problem-Of-The-Day-gfg | Delete nodes having greater value on right[29-August-2023]/solution.cpp | // >> CPP CODE <<
class Solution
{
public:
Node* reverse(Node* head) {
Node* prev = nullptr;
Node* next = nullptr;
while (head != nullptr) {
next = head->next;
head->next = prev;
prev = head;
head = next;
}
retur... | ALGO | 0.999999 | 5.555382 |
bf2d7dc0-ba70-4531-b95a-9e475763a252 | gaodechen/OI_History | problems/uva12293.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main()
{
int N = 20;
bool w[N][N];
memset( w, 0, sizeof( w ) );
for( int k = 3; k < N; k ++ )
{
for( int n = 1; n < N; n ++ )
{
int m = k - n, t = max( n, m );
for( int i = 1; i < t; i ++ )
if( !w[i][n-i] )
w[n][... | ALGO | 0.997845 | 3.276814 |
e494a5bf-c396-4d45-a0ad-e9668cd03e9f | thingk0/codetree-TILs | 240423/숫자 등장 횟수/number-frequency.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
int n, m, t;
unordered_map<int, int> map;
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> t;
if (map.find(t) != map.end()) {
map[t]++;
} else {
map[t] = 1;
}
}
f... | ALGO | 0.999971 | 4.525467 |
cc16e2b2-374e-41f2-8558-fa7198f83421 | lybb/Cpp-code | LinkList_cpp/LinkList_cpp.cpp | #include"LinkList_cpp.h"
ostream& operator<<(ostream& os,Node& node)
{
os<<node.data<<" ";
return os;
}
ostream& operator<<(ostream& os,LinkList& list)
{
Node* cur = list.head;
while(cur)
{
os<<(*cur);
cur = cur->next;
}
return os;
}
void LinkList::Display()
{
Node* cur = head;
while(cur)
{
cout<<cur... | TOOL | 0.99698 | 4.213707 |
2e79a598-afb9-41d3-a4bb-e211f3191859 | KhronosGroup/LLVM-SPIRV-Backend | libcxx/test/std/algorithms/alg.modifying.operations/alg.partitions/ranges_partition_point.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
// <algorithm>
// template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
// indirect_unary_predicate<projected<I, Proj>> Pred>
// constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // Since C++20
//
// te... | TEST | 0.966333 | 7.646426 |
587aef23-8837-45c9-9167-be40bbb55387 | BinomialSheep/Competitive | AtcoderContest/ABC355/E.cpp | #pragma region header
#include <bits/stdc++.h>
// デバッグ用マクロ:https://naskya.net/post/0002/
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
using namespace std;
using ll = long long;
using vi = vector<int>... | ALGO | 0.996493 | 3.791621 |
d545a28a-2f86-4cf7-8447-a0fc27a2d6f5 | Zobio/atCoder-works | work/abc239d.cpp | #include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, n) for (long long i = 0; i < n; i++)
#define reps(i, n) for (long long i = 1; i <= n; i++)
#define rrep(i, n) for (long long i = n - 1; i >= 0; i--)
#define r... | ALGO | 0.999929 | 5.06829 |
2ee69be0-b171-42af-b304-85f5688fc85e | Sehee-Lee-01/algorithmCPP | class1/10818.cpp | #include <iostream>
using namespace std;
int num, temp, min_num=1000000, max_num=-1000000;
int main() {
scanf("%d", &num);
for(int i=0; i<num; i++) {
scanf("%d", &temp);
if(temp>max_num) max_num=temp;
if(temp<min_num) min_num=temp;
}
printf("%d %d", min_num, max_num);
} | ALGO | 0.999885 | 3.711792 |
10cea224-1893-4f56-82d6-820951277ea2 | AbdulShabazz/Boost-MultiprecisionIntegerLibrary-CPP20BigInt | libs/fiber/performance/fiber/numa/skynet_stealing_detach.cpp | // based on https://github.com/atemerev/skynet from Alexander Temerev
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <condition_variable>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <memory>
#include <mutex>
#include <nume... | TEST | 0.960688 | 5.359982 |
b3191816-cf3b-489f-8dc9-26172411ba6e | sparsh-1/Competitive-Programming | Codechef/XOR Operation - SSWK01D.cpp | // https://www.codechef.com/UASS001/problems/SSWK01D
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define ll long long
#define pll pair<long, long>
... | ALGO | 0.999979 | 4.455398 |
5f444f41-4a31-43fc-a9b9-01f7223453a0 | alexandraback/datacollection | solutions_1480487_1/C++/Conan630/A.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
#include <sstream>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rp(i,l,r) for ( int i=(int)(l); i<=(int)(r); ++i )
#define dp(i,l,r) for ... | ALGO | 0.999366 | 3.563201 |
faa113ac-51cc-41bc-b632-1e12747f84ce | acm-clan/algorithm-stone | user/leetcode/218.天际线问题.cpp | /*
* @lc app=leetcode.cn id=218 lang=cpp
*
* [218] 天际线问题
*/
// @lc code=start
class Solution {
public:
vector<vector<int>> getSkyline(vector<vector<int>>& buildings) {
vector<vector<int>> ans;
priority_queue<pair<int, int>> max_heap;
int i = 0, cur_x = 0, cur_h = 0, len = buildings.size... | ALGO | 0.999961 | 6.856847 |
43c0c01e-2b5c-4e57-9b8f-6ac539b5899c | dubey22rohit/CPP-DSA | InterviewPrep/Recursion/CombinationSum2.cpp | #include <iostream>
#include <vector>
using namespace std;
// https://leetcode.com/problems/combination-sum-ii/
void combinationSumHelper(vector<int>& candidates, int target,
vector<int>& curr, vector<vector<int>>& ans,
int idx) {
if (target == 0) {
ans.push_ba... | ALGO | 0.999741 | 6.225028 |
6e8d9cc8-2113-40c5-b4ce-46ec466c9361 | Dynesshely/Competition | source/website/www.luogu.com.cn/P3372.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int n, os;
long long arr[MAXN];
struct seg {
int ls, rs, l, r;
long long sum, tag;
} segement[MAXN << 2];
inline int summid(int l, int r) { return (l + r) >> 1; }
inline void build(int x, int l, int r) {
seg *cur = &segem... | ALGO | 0.999481 | 4.710543 |
4c5145d3-bf9f-461b-a990-0d9f99f72e8a | IgorPBorja/competitive-programming | problems/Codeforces/Div2-577/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vvc vector<vector<char>>
#define vvpi vector<vector<pair<int, int>>>
#define pii pair<int, int>
#define eb emplace_back
#define ep... | ALGO | 0.999984 | 3.893521 |
4d3a65bf-3a0f-42cb-82d5-50598f4d994b | zeng-hua/ukf_model | examples/test/spring_damping_system.cpp | //
// Created by zenghua on 7/28/22.
//
//#include "spring_damping_system.h"
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <cmath>
#include <iostream>
#include "UKF/Types.h"
#include "UKF/Integrator.h"
#include "UKF/StateVector.h"
#include "UKF/MeasurementVector.h"
#include "UKF/Core.h"
#include "UKF/Config... | ALGO | 0.996189 | 5.911895 |
2224aeb6-b9f6-4e49-889a-d27f6c862f42 | dako98/Introduction-to-Programming--2019-2020 | Practice-02--Data-types--Variables--Operators/Solutions/Problem-01.cpp | /**
* This file is part of the Introduction to Programming
* course 2019/20 held by Alexander and Dako.
* @file Problem-01.cpp
* @brief Solution for Problem 1 from Practice 2
* @author Alexander Dimitrov
* @author Dako Dimov
*
* Задача:
* Прочетете две цели числа от стандартния вход
* и изведете разликата им ... | ALGO | 0.997037 | 3.423536 |
2afacab9-410b-4d2d-ad11-bf03eb6da226 | dev-priyanshipatel/EXAM | sort-search-menudriven.cpp | #include <iostream>
#include <vector>
using namespace std;
class Sort
{
public:
void Display(vector<int>);
void selectionSort(vector<int> &);
void merge(vector<int> &, int, int, int);
void mergeSort(vector<int> &, int, int);
int binarySearch(vector<int> &, int, int, int);
int linearSearch(vect... | ALGO | 0.999925 | 4.589685 |
2c9698cc-299b-4ac5-84dd-5458efe20c79 | bluarry/prepare | new_coder/jian_offer/27.cpp | #include <bits/stdc++.h>
using namespace std;
//二叉树与双向链表
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};
class Solution {
public:
TreeNode* Convert(TreeNode* pRootOfTree)
{
TreeNode *treelast=NULL;
help... | ALGO | 0.999997 | 4.625794 |
6a6bb917-37ec-46e0-ab21-7437c26f2ba7 | puneet-pr-arya/Competitive-Programming | LeetCode/459. Repeated Substring Pattern.cpp | class Solution
{
public:
bool repeatedSubstringPattern(string s)
{
string s1, s3;
int ssize = s.size();
for (int i = 1; i <= ssize / 2; i++)
{
if (ssize % i == 0)
{
string subtr = repeat(s.substr(0, i), ssize / i);
if (subtr... | ALGO | 0.999878 | 5.713324 |
a979e356-c819-4dc0-b5ab-c24c849a939a | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J00565/explore/explore.cpp | #include <bits/stdc++.h>
using namespace std;
int t;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
freopen("explore.in","r",stdin);
freopen("explore.out","w",stdout);
cin>>t;
while(t){
int n,m,k,x,y,d;
queue<int>q,p;
string s;
cin>>n>>m>>k;
cin>>x>>y>>d;... | ALGO | 0.999894 | 3.954549 |
7c93b271-c665-4e0b-a80c-926666a4025e | synthesoul/OOP-Practice | Static-VS-Dynamic/main.cpp | #include <iostream>
/*
* Dynamic and Static Binding Example
* CJ Busca
*/
//Dynamic Binding
class Bravo
{
public:
// The Virtual Function
virtual void function(){
std::cout << "The base class function is called.\n";
}
};
class Delta: public Bravo{
public:
void function(){
std... | ALGO | 0.973761 | 5.401744 |
f8b5bfbf-9042-4c75-9992-af2c3cea1db8 | Sookmyung-Algos/2021algos | algos_assignment/2nd_grade/김윤지_vinblanx/week7/1011.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int t;
cin >> t;
long long x, y;
for(int i = 0; i < t; i++){
cin >> x >> y;
double dist = y - x;
double dpow = sqrt(dist);
int pow = round(sqrt(dist));
if(dpow <=... | ALGO | 0.99995 | 4.170989 |
8171d407-17cd-4fe6-89f4-dc31cee387ca | TwilightZrui/LeetCode | job/baidu_intern/dp.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n; // 输入序列长度
vector<int> nums(n);
for (int i = 0; i < n; i++) {
cin >> nums[i]; // 输入序列元素
}
vector<int> dp(n, 1); // dp[i] 表示以 nums[i] 结尾的最长上升子序列长度
int ans = 1; // 最终答案
for (int i = 1; i < n; ... | ALGO | 0.999964 | 5.339437 |
951218b5-6d79-4b86-8972-27f956b62905 | Divyanshu-Mishra9620/Dv.18 | ZigZagConversion.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
using namespace std;
string convert(string s, int numRows)
{
vector<string> ans(numRows);
if (numRows == 1) return s;
int i = 0;
int direction = 1;
int row = 0;
while (i < s.size())
{
if (direction == 1)
{
... | ALGO | 0.999994 | 5.100062 |
f3c6a92c-5c2e-416d-86f8-dc8d487d757d | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3287_7.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
unsigned long long n, m, k;
cin >> n >> m >> k;
unsigned long long r = k - 1, l = n - k;
unsigned long long lo = 1, hi = m - n + 1, mid;
while (lo < hi) {
mid = lo + (hi - lo + 1) / 2;
auto calc = [&mid](unsigned long long w) -> unsigned long ... | ALGO | 0.999974 | 3.77253 |
28bcb2d8-9080-432a-bdc4-4b480a061645 | mihirbshah/algorithms | src/integer_break.cpp | // 343. Integer Break
#include <iostream>
#include <vector>
using namespace std;
class Solution
{
public:
int integerBreak(int n)
{
vector<int> dp(max(2, n + 1), INT_MIN);
dp[0] = 0;
dp[1] = 1;
for (int i = 2; i <= n; ++i)
{
for (int j = 1; j <= i / 2; ++... | ALGO | 0.999962 | 5.733269 |
bd6e274e-132d-4ce6-8e17-ac85da929a88 | AdittyaPal/week5 | week4_20.cpp | #include <iostream>
using namespace std;
int main()
{
float basic=0.0f;
cout<<"Enter the basic salary of the employee."<<endl;
cin>>basic;
float total=0.0f;
if(basic<=10000)
total=basic+(0.2f*basic+0.8f*basic);
else if(basic>10000&&basic<=20000)
total=basic+(0.25f*basic+0.9f+basic);
else
total=basic+(0.3f*bas... | ALGO | 0.932818 | 3.21029 |
0a7fca11-a225-4d92-90a4-6698f0dc32dd | sanjaydraws/DatastrucureAndAlogorithms | array/cpp/Program8.cpp | // find uniques element in array
#include <iostream>
using namespace std;
int main() {
const int SIZE = 10;
int numbers[SIZE] = {1, 2, 2, 3, 3, 4, 5, 6, 6, 7};
cout << "Unique elements: ";
for (int i = 0; i < SIZE; i++) {
bool isUnique = true;
for (int j = 0; j < i; j++) {
... | ALGO | 0.997001 | 5.907398 |
f8647a02-cbcb-4c3f-8a48-abd0457c64e1 | WuJianeng/PAT | A1076.cpp | //2019.2.17 15:05
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
vector<int> G[1010];
bool vis[1010];
int le[1010];
void bfs(int query, int n, int level){
for(int i = 1; i <= n; ++i)
vis[i] = false;
queue<int> q;
q.push(query);
le[query] = 0;
int numMember = 0;
vis[query] = true;
whi... | ALGO | 0.999843 | 3.554258 |
cae62670-02b4-4319-b700-3fa2ee7296b0 | gxlvezzz/PECL-estructuras-de-datos | PECLGalvezEsquivelJulian/PECLGalvezEsquivelJulian/src/Source_FIles/Arbol.cpp | #include <src/Header_Files/Arbol.hpp>
#include <src/Header_Files/Lista.hpp>
Proceso dato;
/*Lista listaTiempoReal;
Lista listaNormal;*/
Arbol::Arbol(){
raiz = nullptr;
}
void Arbol::insertar(Proceso val) {
raiz = insertar(raiz, val);
}
int Arbol::contarNodos(pnodoAbb nodo) {
if (!nodo) return 0;
r... | ALGO | 0.999359 | 4.219564 |
54fe45ba-235f-49a6-ad65-af24a0dd717d | ishandutta2007/codeforces | ainta/normal/982/F.cpp | #include<cstdio>
#include<algorithm>
#include<vector>
#define N_ 201000
using namespace std;
vector<int>E[N_], G[N_];
int n, m, v[N_], Num[N_], w[N_], Q[N_], head, tail, Deg[N_], D[N_], cnt;
void Go(int a, int st) {
if (D[a] != -1)return;
int Mx = -1, pv = -2;
if (Num[a] != -1)Mx = (Num[a] + cnt - st) % cnt, pv = Nu... | ALGO | 0.999949 | 3.677009 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.