uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5dd10042-bf72-48c5-bcae-a1ac4917ae89 | vivek-yamsani/IPMP | bit_manip/check_for_a_no_is_pow_of_two_or_not.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
if ((n & (n - 1)) == 0)
{
cout << "yes";
}
else
cout << "no";
return 0;
} | ALGO | 0.999828 | 4.272622 |
2e2db6a1-6bb5-43a7-9c88-f07a99d4d596 | WillowTI/OnlineJudge | DP/[DP] - EOJ1824.cpp | #include <cstdio>
#include <cstring>
int tower[105][105];//保存输入的数据
bool dp[105][105][10];//记录以(i,j)为起点,能不能使得答案为k
int main() {
//freopen("in.txt", "r", stdin);
int cas;
scanf("%d", &cas);
while (cas--) {
int n;
scanf("%d", &n);
memset(tower, 0, sizeof(tower));
memset(dp, f... | ALGO | 0.999933 | 3.632836 |
236e67df-d563-4937-9945-d64286a825cd | makotoyamaai/image-processing | region1.cpp | /////////////////
// region1.cpp //
/////////////////
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
////////////////////////////////////////////
// Define Point that contain detected box //
////////////////////////////////////////////
Point top_left_corner, bottom_right_corner;
////////////... | TOOL | 0.946372 | 4.730596 |
97cb2a5b-e499-4db4-b3d3-e5f7c091c00f | ishandutta2007/codeforces | subscriber/normal/425/B.cpp | #include<stdio.h>
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<memory.h>
#include<map>
#include<set>
#include<queue>
#include<list>
#include<sstream>
#include<cstring>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define SS stringstream
#define sqr... | ALGO | 0.999985 | 3.406092 |
152f5632-156a-460d-b05f-11efd437ca6c | AryanGuptaJi/CPP_DSA | Array/Sort_0_1.cpp | void sortZeroesAndOne(int *input, int size)
{
int count=0;
for(int i=0;i<size;i++)
{
if(input[i]==0)
{
count++;
}
}
for(int i=0;i<count;i++)
{
input[i]=0;
}
for(int i=count;i<size;i++)
{
input[i]=1;
}
} | ALGO | 0.999596 | 3.279853 |
6c3725df-2d38-441f-97fb-665c8af41c86 | QuantumBird/ACM_Team | gjz/contests/nanjing/BBBBB.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1e6 + 1;
typedef long long ll;
ll phi(ll n){
int ans=n,temp=n;
for(int i=2;i*i<=temp;i++){
if(temp%i==0){
ans-=ans/i;
while(temp%i== 0)
temp/=i;
}
}
if(... | ALGO | 0.999991 | 5.028496 |
b7d1032e-edab-4ebc-b663-d27b2a748b2d | MrChros/MIDILightDrawer | Source/Easings.cpp | #include "Easings.h"
namespace MIDILightDrawer
{
float Easings::Linear(float x)
{
if(x <= 1.0f) {
return x;
}
return 1.0f;
}
float Easings::Ease_In_Sine(float x)
{
if(x <= 1.0f) {
return (float)( 1 - System::Math::Cos((x * System::Math::PI) / 2.0f));
}
return 1.0f;
}
float Easings::Ease_O... | ALGO | 0.968891 | 5.481081 |
278b531d-2449-4d38-82fe-355d2016a371 | bobrovskayaa/fintech-algorithms-ds | 01_task/A_postfix.cpp | #include <iostream>
#include <string>
#include <stack>
using namespace std;
typedef long long int lli;
struct lastPair {
lli a, b;
};
lastPair getTwoLast(stack<lli> &postfix) {
lli a = postfix.top();
postfix.pop();
lli b = postfix.top();
postfix.pop();
return {a, b};
}
int main() {
stack... | ALGO | 0.999964 | 4.528751 |
df512e1e-5b26-4abd-981d-2b97e6573838 | Mrhuangyi/Ebooks-Shared | Cracking the Coding Interview-5th Edition/c++/Chapter 1/Question1_3/Question1_3.cpp | #include<iostream>
#include<string>
#include<algorithm>
#include "Question1_3.h"
using namespace std;
bool Question1_3::permutation(const string& a, const string& b)
{
// Create a copy of the two strings, we do not wish to modify those that were passed as parameters.
string str_a(a);
string str_b(b);
... | ALGO | 0.999467 | 4.749885 |
58af347a-6620-4065-a9a7-4581cc298409 | sampritipanda/IOI_Repository | SPOJ/SUBST1.cpp | // New Distinct Substrings
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
const int MAXN = 1 << 21;
string S;
int N, gap;
int sa[MAXN], pos[MAXN], tmp[MAXN], lcp[MAXN];
bool sufCmp(int i, int j)
{
if (pos[i] != pos[j])
retu... | ALGO | 0.999925 | 4.801692 |
2368981c-77ae-4912-aceb-d03c8d53d3d0 | ishandutta2007/codeforces | darkkcyan/normal/1543/D1.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ld eps = 1e-8;
// for matching the kactl notes
#define sz(x) ((int)x.size())
#define rep(i,a,b) for (int i = (int)(a); i < (int)(b); ++i)
#define all(a) (a).begin(), (a).end()
// #define constexpr(...) (__VA_ARGS__)
//... | ALGO | 0.999759 | 3.963847 |
41781e6c-886c-43f6-974c-7aff0a24cdf6 | siamthecoder/500-difficulty-rating-Codechef- | masterChef.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int x, t;
cin >> t;
while (t != 0)
{
cin >> x;
if (x <= 10)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
t--;
}
return 0;
} | ALGO | 0.998873 | 4.622957 |
8de9c76a-1de6-49d5-9065-65e58c019c27 | alexandraback/datacollection | solutions_1483488_0/C++/olimpo/Untitled1.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <bitset>
#include <cmath>
#include <complex>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <stdlib.h>
#include <utility>
#include <ctime>
#include <limi... | ALGO | 0.999633 | 4.048939 |
460b6634-298d-4591-b943-6dd48eebfe74 | RaveenaBhasin/Competitive-Programming | Minimum Platforms - GFG/minimum-platforms.cpp | // { Driver Code Starts
// Program to find minimum number of platforms
// required on a railway station
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
//Function to find the minimum number of platforms required at the
//railway station such that no train waits.... | ALGO | 0.999985 | 5.564314 |
a434a3fc-960d-4e17-ada9-378bffbde8d0 | thecarrito/guardian-biblioteca | Contests/rpc-08-06-19/1.cpp | #include<bits/stdc++.h>
#define forr(i,a,b) for(int i=a; i<b; i++)
#define forn(i,n) forr(i, 0, n)
#define zero(v) memset(v, 0, sizeof(v))
using namespace std;
#define MAX 10000000000
long long potencia(long long k){
long long r = 1;
forn(i,k){
r = r * 10;
}
return r;
}
int main(){
long long m, n, i = 1;
n =... | ALGO | 0.999972 | 3.956209 |
51132922-2b07-4a80-96de-ed0b29796ae0 | Chuck8080/animations-opensubdiv | opensubdiv/far/topologyRefinerFactory.cpp | namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
namespace Far {
//
// Methods for the Factory base class -- general enough to warrant including in
// the base class rather than the subclass template (and so replicated for each
// usage)
//
//
void
TopologyRefinerFactoryBase::validateComponentTopologySizing(T... | TOOL | 0.964704 | 7.474882 |
403f9634-1aba-4b0c-b171-a4bb1de6ab83 | raincross7/code-similarity | codes/train_code/problem412/problem412_426.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase... | ALGO | 0.999988 | 3.459768 |
9dda9e7b-187f-4394-b9e4-9879fe0ad8af | ahmadel1/LeetCode | 2396-strictly-palindromic-number/2396-strictly-palindromic-number.cpp | class Solution {
public:
bool checkPalindrome(string n){
for(int i= 0, j = n.size()-1; i<=j; i++, j--){
if(n[i] != n[j])
return false;
}
return true;
}
bool toBase(int n, int base){
string res = "";
while(n>0){
res = to_string(... | ALGO | 0.999501 | 5.517063 |
2e712ffc-1057-416b-be59-467c84a7b169 | mpdivecha/MPC-Project | src/MPC.cpp | #include "MPC.h"
#include <cppad/cppad.hpp>
#include <cppad/ipopt/solve.hpp>
#include "Eigen-3.3/Eigen/Core"
using CppAD::AD;
// TODO: Set the timestep length and duration
size_t N = 11;
double dt = 0.1;
// This value assumes the model presented in the classroom is used.
//
// It was obtained by measuring the radius... | ALGO | 0.99984 | 5.018393 |
1b26d5bc-f277-491c-a672-d400d4eb92df | ritikanagar09/LeetCode-Submission | 2149-rearrange-array-elements-by-sign/2149-rearrange-array-elements-by-sign.cpp | class Solution {
public:
vector<int> rearrangeArray(vector<int>& nums) {
int n=nums.size();
vector<int>ans(n);
int indx=0;
int indx1=1;
for(int i=0;i<nums.size();i++){
if(nums[i] > 0){
ans[indx]=nums[i];
indx+=2;
}else{
... | ALGO | 0.999938 | 5.345316 |
31f96c79-d4f4-41b4-8f4c-5c5525f816eb | abhi2666/CodeChef-Questions-2024 | anit-AdjacentSwaps.cpp | /*
swap any two elements that are not adjancent and check if you can make the array sorted or not..
Approach --> simply just check for the case of n = 2 and 3 only and for all the other cases it is always possible to sort the array following the above rules..
*/
#include <bits/stdc++.h>
using namespace std;
int main... | ALGO | 0.999841 | 4.31684 |
f9ce2197-d408-4581-b304-9c8de325d2d4 | 1622vishal/Data-Structures-and-Algorithms | LinkedLists/ArraytoLinkedList.cpp | /*----Written by :- Vishal Yadav----*/
/*----Date :- 30-11-23----*/
/*Program to convert Array to Linked List and return the head of Linked List*/
#include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data1)
{
data = data1;
next = nullptr... | ALGO | 0.999445 | 5.448616 |
42dbb449-c866-47ca-a4cf-9596ee68a6bf | yuanwangshui/Capstone-project | 代码/opencv/opencv-3.4.18/samples/dnn/human_parsing.cpp | //
// this sample demonstrates parsing (segmenting) human body parts from an image using opencv's dnn,
// based on https://github.com/Engineering-Course/LIP_JPPNet
//
// get the pretrained model from: https://www.dropbox.com/s/qag9vzambhhkvxr/lip_jppnet_384.pb?dl=0
//
#include <opencv2/dnn.hpp>
#include <opencv2/highg... | DATA | 0.952386 | 5.574778 |
7d7eb092-c43c-41fd-85cd-53dc67ee23d1 | kuity/grind75 | src/DFS/wordSearch2D.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
/*
Link: https://leetcode.com/problems/word-search/description/
Difficulty: Medium
Topics: array, string, backtracking, matrix
*/
class Solution {
private:
vector<vector<char>> B;
int nRows;
int nCols;
public:
bool helper(pair<int, int>... | ALGO | 0.999277 | 6.673841 |
46a5ecd2-69eb-4005-95d4-b2feaa845b65 | HITS-MCM/gromacs-ramd | src/gromacs/fft/gpu_3dfft_ocl_vkfft.cpp | /*
* OpenCL VkFFT support to GROMACS is based heavily on the SYCL VkFFT backend.
* View the respective source files in this directory for author attribution.
*/
/*! \internal \file
* \brief Implements GPU 3D FFT routines for OpenCL.
*
* \author Philip Turner <<EMAIL>>
* \ingroup module_fft
*/
#include "gmx... | ALGO | 0.930713 | 7.25197 |
56d40845-7b30-425e-aa56-bca4966d58fe | meitya/kajian-sunnah-hsi | 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.9988 | 6.76073 |
2e47538c-f5b7-4a5f-83e2-4c395c18db7c | COMBINE-lab/pufferfish | src/rank9b.cpp | #include <cassert>
#include <cstring>
#include "rank9b.hpp"
rank9b::rank9b() {}
rank9b::rank9b( const uint64_t * const bits, const uint64_t num_bits ) {
this->bits = bits;
num_words = ( num_bits + 63 ) / 64;
num_counts = ( ( num_bits + 64 * 8 - 1 ) / ( 64 * 8 ) ) * 2;
// Init rank structure
counts = new uint64... | ALGO | 0.999379 | 5.207846 |
25008238-cdcc-40c3-903d-a02a44578ab5 | sarvex/leetcode-cobol | solution/2000-2099/2095.Delete the Middle Node of a Linked List/Solution.cpp | /**
* Definition for singly-linked list.
* 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* deleteMiddl... | ALGO | 0.999936 | 5.861026 |
fb67c805-bb54-4b74-a5c8-5d1bb762f28f | Ir0h7/Informatics-1st-course | Homework/Howk 2/Hw 2_2/main.cpp | #include <stdio.h>
const int n = 8;
int count[] = {0,0,0,0,0,0,0,0}; //программный счетчик
int nominal[] = {50,20,15,10,5,3,2,1}; //номиналы монет
int limits[8]; //количество монет каждого достоинства
int res[8]; //найденная комбинация, позволяющая выдать сдачу
int change, en, k, kn, mink, i;
long komb;
int imin(int ... | ALGO | 0.997283 | 3.110171 |
4b8588ae-b3cf-44fe-b2e1-4b18a5538a47 | nuguri03/boj | c++/src/solved/Sort/[1181]WordSort.cpp | #include <iostream>
#include <algorithm> //std::sort, std::unique
#include <vector> //vector 배열 선언
#include <string> //string 활용
//const : 읽기 전용 선언
// & : 참조(call by value 가 아닌 주소를 활용해 메모리 사용 감소)
//str1 < str2 로 사전적 순서를 할 수 있다
bool compare(const std::string& str1, const std::string& str2) {
if (str1.length()... | ALGO | 0.999703 | 5.547151 |
ccdc2f2b-0c7f-4394-bce9-92a17a13968e | jylkkakai/advent-of-code | 2015/day_04/cpp/main.cpp | #include <iostream>
#include <openssl/evp.h>
int main() {
EVP_MD_CTX *mdctx;
const EVP_MD *md = EVP_md5();
std::string mess[] = {"abcdef609043", "pqrstuv1048970"};
std::string base = "bgvyzdsv";
// std::string mess = "pqrstuv1048970";
unsigned char md_value[EVP_MAX_MD_SIZE];
unsigned int md_len;
long ... | ALGO | 0.908184 | 5.117904 |
9ae1b071-6918-44ba-8678-d46e56fa4f62 | TinkerEdgeR-Android/external_libcxx | test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp | // UNSUPPORTED: c++98, c++03
// <algorithm>
// template<class T, class Compare>
// pair<T, T>
// minmax(initializer_list<T> t, Compare comp);
//
// Complexity: At most (3/2) * t.size() applications of the corresponding predicate.
#include <algorithm>
#include <functional>
#include <cassert>
#include "test_macr... | TEST | 0.997177 | 6.442186 |
fbd341b3-cc68-4443-9ec2-f27a3e9e15ef | alexandraback/datacollection | solutions_5769900270288896_0/C++/qingping/main.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <climits>
using namespace std;
typedef pair<int,int> PII;
const int INF=0x3f3f3f3f;
int onenum(int x)
{
int rnt=0;
while(x)
{
rnt+=(x&1);
... | ALGO | 0.998828 | 3.371137 |
19517c33-75f7-4b20-b328-2c1c33f8e633 | avijitgupta/contrail-avrotest | boost_1_49_0/libs/thread/tutorial/factorial2.cpp | #include <boost/thread/thread.hpp>
#include <boost/ref.hpp>
#include <iostream>
class factorial
{
public:
factorial(int x) : x(x), res(0) { }
void operator()() { res = calculate(x); }
int result() const { return res; }
private:
int calculate(int x) { return x <= 1 ? 1 : x * calculate(x-1); }
private:... | TOOL | 0.91643 | 6.074996 |
29d46ba8-24ba-4403-bf08-f33a6e8c5bc7 | silent-064/LocalRepo | programming c++/B_Replace_Character.cpp | /*
* Author : Protic Prappo Durjoy
* Date :
*/
#include <bits/stdc++.h>
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ft float
#define du double
#define ll long long
#define ull unsigned long long
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NU... | ALGO | 0.999994 | 4.386358 |
213c86a1-b861-4c55-b5e3-85ad2763f94e | reimunyancat/baekjoon | c++/1526.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <stack>
#include <list>
#include <iomanip>
#include <cmath>
#include <numeric>
#include <cctype>
using namespace std;
using ull = unsigned ll;
using ll = ll;
int main() {
int a, temp;
bool flag;
cin >> a;
... | ALGO | 0.998929 | 4.619183 |
490188f0-d930-49af-81bc-f50b35c8b3ca | ianCK/template | NoName/_string/debrujin/_lib.cpp | constexpr int kN = 20;
int cur[kN];
string s;
string GetString(int len) {
string res = "";
for (int i = 0; i < len; i++)
res += char('0' + cur[i]);
return res;
}
// n = length of key, k = number of different
// keys, m = number of characters
void Dfs(int n, int k, int m, int now, int last) {
if (now && n % ... | ALGO | 0.999875 | 3.914701 |
d8748c1b-cba5-4da3-b4cb-d66bcb65e953 | dizuo/xrender | text render/map_tile_log_processer.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <set>
#include <list>
using namespace std;
typedef set<string> SetType;
typedef pair<SetType::iterator, bool> RetType;
void process_tile_log(const char* filename)
{
ifstream infile(filename);
char line[1024];
SetType uniqueSet;
RetType ret;
int... | TOOL | 0.864611 | 3.621865 |
ecdafac7-6a54-464f-be1d-10df64335837 | Muhtadi13/LightOJ | trailing zeroes.cpp | #include <bits/stdc++.h>
#define lli long long
#define plli pair<lli, lli>
#define MAX 10003
#define MOD 1000000007LL
using namespace std;
vector<lli> fac;
vector<lli> ifac;
vector<lli> smallestprimedivisor(MAX + 1);
vector<lli> derangenums(MAX + 1);
vector<lli> getPrimeFactorization(lli x)
{
// logn time, uses ... | ALGO | 0.999641 | 4.25104 |
d2c79374-9879-4e16-be9f-d5419b0e3ebd | cnsuhao/cppcode | gamecode4-master/Source/GCC4/3rdParty/bullet-2.79/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp | ///btDbvtBroadphase implementation by Nathanael Presson
#include "btDbvtBroadphase.h"
//
// Profiling
//
#if DBVT_BP_PROFILE||DBVT_BP_ENABLE_BENCHMARK
#include <stdio.h>
#endif
#if DBVT_BP_PROFILE
struct ProfileScope
{
__forceinline ProfileScope(btClock& clock,unsigned long& value) :
m_clock(&clock),m_value(&valu... | ALGO | 0.990926 | 7.098301 |
32b91228-710d-4045-8d84-4ef8d7ce5f0e | Sagar-Mondal/GFG-POTD | 0342-power-of-four/0342-power-of-four.cpp | class Solution {
public:
bool isPowerOfFour(int num) {
if(num<0)return false;
for(int i=0;i<32;i+=2)if(num==1<<i)return true;
return false;
}
}; | ALGO | 0.997956 | 5.801256 |
408b64e5-72c7-486d-ae8c-1cd2d25e3a1d | Nishant717/DSA | code/Count_With_K_Different_Characters_CN.cpp | int countSubStrings(string str, int k)
{
// Write your code here.
map<char,int>mp;
int count=0;
for(int i=0;i<str.length();i++)
{
for(int j=i;j<str.length();j++)
{
mp[str[j]]++;
if(mp.size()==k)
{
count++;
}
... | ALGO | 0.999943 | 5.783442 |
9bbea688-d129-41ee-9506-fd27d59ffd2a | Kroenenn/ie0217 | Tareas/Tarea3/src/HashTable.cpp | /**
* @file HashTable.cpp
* @brief Archivo de implementación de la estructura HashTable.
*
* Este archivo contiene la implementación de la estructura HashTable.
* Contiene funciones como agregarContacto, eliminarContacto, buscarContacto, imprimirHashTable,
* mostrarTodosLosContactos y fusionarYOrdenarListas.
* ... | ALGO | 0.968881 | 5.092013 |
324f575e-d94c-41d1-bf8d-ba890cdad246 | feelpp/feelpp | benchmarks/ATTIC/navierstokes/ethiersteinman/ethiersteinman_osb1.cpp | /**
\file ethiersteinman_osb1.cpp
\author Christoph Winkelmann <<EMAIL>>
\date 2007-04-08
*/
#include "ethiersteinman.hpp"
namespace Feel
{
void
EthierSteinman::oseenUpdateBdf1( Oseen<space_u_type, space_p_type, imOrder, ENTITY>& oseen,
value_type dt,
... | ALGO | 0.991871 | 5.800664 |
dfb9bd43-be41-4257-88bc-8abd353a6ff3 | setnormTJC/1436-Chapter5 | Lab4a-Wilson/Source.cpp | //Programmer: Matthew Wislon
//Starting date: 3/06/2024
//Ending date: 3/06/2024
//Program description: To show the functionality of "if"s and "else if"s.
/*Programmer commentary-
Despite the assignment stating to look up products and assigning variables
to have those products and the values of those products, I prefe... | TOOL | 0.882296 | 4.689049 |
26d62901-9ff1-48af-a907-7fddfddec933 | onedayzhang/forstudy | algo/dp/198.cpp | class Solution {
public:
int rob(vector<int>& nums) {
if(nums.size()==0)
return 0;
if(nums.size()==1)
return nums[0];
if(nums.size()==2)
return max(nums[0],nums[1]);
vector<int> dp(nums.size());
int i;
dp[0]=nums[0];
dp[1]=max(nums[0],nums[1]);
for(i=2;i<nums.size();i++)
{
dp[i]=max(dp... | ALGO | 0.999846 | 5.67207 |
238f95a5-2b52-4fa5-891d-3a41d01a0191 | ambarmishraa/CPP | quicksort.cpp | #include<iostream>
using namespace std;
void swap(int arr[],int i,int j)
{
int temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
int partition(int arr[],int l,int r)
{
int pivot=arr[r];
int i=l-1;
for(int j=l;j<r;j++)
{
if(arr[j]<pivot)
{
i++;
swap(arr,i,j... | ALGO | 0.999982 | 4.676178 |
b836bb59-2c02-4854-9c37-a3a8de307db8 | phrimm136/Study | Bookshelf/C++ Primer Plus/Chapter 2/Exercise 5.cpp | #include <iostream>
int CtoF(int);
int main()
{
int Cel;
std::cout << "Please enter a Celsius Value: ";
std::cin >> Cel;
std::cout << Cel << " degrees Celsius is " << CtoF(Cel) << " degrees Fahrenheit." << std::endl;
return 0;
}
int CtoF(int Cel)
{
return Cel * 9 / 5 + 32;
}
| TOOL | 0.85721 | 4.687081 |
9272f08e-7c67-49ec-b2a9-bbd3ec534e93 | abdul1mannan/LeetCode | 0225-implement-stack-using-queues/0225-implement-stack-using-queues.cpp | class MyStack {
public:
queue<int>q1,q2;
MyStack() {
}
void push(int x) {
q1.push(x);
}
int pop() {
while(q1.size()>1){
int f=q1.front();
q1.pop();
q2.push(f);
}
int a=q1.f... | ALGO | 0.99947 | 5.483713 |
65bdaadd-309e-4209-8122-aaad51d7d09d | LVelezm/01_funciones | combinatoria.cpp | #include <iostream>
using namespace std;
int combin(int n,int k ){
if (n==k){
return 1;
}else if(k == 1){
return n;
}else{
return combin(n-1,k-1)+combin(n-1,k);
}
}
int main(){
int m, n;
int combinatoria;
cout<<"Introduce el valor de m: "<<endl;
cin>>m;
cout<<"Introduce el valor de n: "<<endl;
cin>>n;... | ALGO | 0.999848 | 4.658581 |
1b9fdc12-1b1a-485d-a31f-94733a082975 | KenBoi26/CPP-and-DSA | Assignments/01102024.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int testCases;
cin >> testCases;
while (testCases--) {
int k, d;
cin >> k >> d;
vector<int> gasStations(k);
for (int i = 0; i < k; ++i) {
cin >> gasStations[i];
... | ALGO | 0.999742 | 4.245582 |
4147da04-36a4-4fc3-838b-e2b3aec48f39 | omhpatil/CPP-Udemy | 003. Loops/for.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter number :";
cin>>n;
for(int i=1;i<=n;i++){
cout<<i<<endl;
}
return 0;
} | ALGO | 0.990268 | 3.379993 |
4431e9d6-3361-4ddd-9840-bad70a4a1330 | Andreascy01/Data-Structures-Project | NonSortedArray.cpp | #include "NonSortedArray.h"
#include<iomanip>
using namespace std;
struct KAST {
string word;
int times;
};
NonSortedArray::NonSortedArray() { // Κατασκευαστής του Αταξινόμητου Πίνακα
NSA=new KAST [size]; //Δημιουργία Πίνακα NSA
lekseis=0;
}
void NonSortedArray::Insert(string leksi) {
... | ALGO | 0.996881 | 3.337098 |
58aae3bb-4582-4585-a407-54f7ac46fe18 | c10uds/CodeTop | 215/215.cpp | #include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
return quickSelect(nums, 0, nums.size() - 1, k - 1);
}
int quickSelect(vector<int>& nums, int left, int right, int k) {
int index = part... | ALGO | 0.999984 | 5.195832 |
02b40cd5-89bb-4b52-b996-eb3cfd0840c2 | WillowSnyder/ThesisProject | perceptrionImpl/perceptronFunctions.cpp | //
// Created by wyatt on 7/10/18.
//
#include "perceptronFunctions.h"
const int MAX_POINTS = 250;
const int MIN_POINTS = 50;
const int MAX_ITERATIONS = 500;
const int PERCEPTRON_MAX_VALUE = 200;
using namespace std;
void perceptronLearning(vector<double>& perceptron,
vector<pair<vector<doubl... | ALGO | 0.997238 | 4.937332 |
4035952a-b4ee-46b7-9f18-1474a94aed67 | oVeron0615/baekjoon | solved.ac - CLASS/CLASS 3/boj_1654.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
ll K, N; cin >> K >> N;
vector<ll> lans(K);
for(ll& lan : lans) cin >> lan;
ll l = 1, r = INT_MAX;
ll ans;
while(l <= r)
{... | ALGO | 0.999963 | 4.227556 |
57e8fc88-c685-4e6e-99e0-3c403f819122 | harsha20599/algorithms | firstname_lastname_pointers.cpp | #include<stdlib.h>
#include<stdio.h>
void strcat(char *str1, char *str2){
int i,length;
for(i = 0;str1[i] != '\0';i++);
length = i;
str1[length] = ' ';
length++;
for(i=0;str2[i] != '\0';i++,length++){
str1[length] = str2[i];
}
str1[length] = '\0';
}
int main(){
char *firstName, *lastName;
firs... | TOOL | 0.924553 | 3.089415 |
03c13315-984c-47a2-98d0-1573ba2c9443 | cielavenir/procon | koj/tyama_koj0092.cpp | #include <vector>
#include <cstdio>
using namespace std;
template <class T>
struct fenwick_tree {
vector<T> x;
fenwick_tree(int n) : x(n, 0) { }
T sum(int i, int j) {
if (i == 0) {
T S = 0;
for (; j >= 0; j = (j & (j + 1)) - 1) S += x[j];
return S;
} else return sum(0, j) - sum(0, i-1);... | ALGO | 0.999411 | 3.578258 |
3758ae1a-a7a5-47e3-8f2b-de616a840564 | pavanbaloju/data-structures-and-algorithms | binary-search-trees/02_inorderSuccessor.cpp | #include <iostream>
#include <vector>
using namespace std;
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), left... | ALGO | 0.999987 | 5.648106 |
4264b436-7e90-4b21-8eb4-bcb9ecd2eef2 | AjushaLalasan/DAA_October2023 | minheap_insert.cpp | // Write a program to insert an element into a min heap and maintain the heap property.
#include <iostream>
using namespace std;
void insertIntoMinHeap(int heap[], int& size, int value) {
// Add the new element at the end of the heap
size++;
int currentIndex = size - 1;
heap[currentIndex] = value;
// Maintain the ... | ALGO | 0.999956 | 4.867975 |
7ecabd61-4ac5-4342-a955-434a4012d25f | orenov/usaco | bronze/complete_search_with_recursion/apple_division.cpp | #include <algorithm>
#include <cstdio>
#include <vector>
#include <iostream>
#include <map>
#include <climits>
#define LOCAL true
/*
Author: Oleksii Renov
https://cses.fi/problemset/task/1623
*/
using namespace std;
using ll = long long int;
void fun(size_t pos, vector<int>& a, ll sum, ll& res) {
if (po... | ALGO | 0.999995 | 4.642771 |
1476df12-960f-4965-bb55-52537d7ecdfe | raincross7/code-similarity | codes/train_code/problem011/problem011_105.cpp | #include <iostream>
using namespace std;
using ll = long long;
ll f(ll a, ll b){
if(a < b)
swap(a, b);
if(b == 0)
return -a;
else {
return f(a % b, b) + 2 * b * (a / b);
}
}
int main()
{
ll n, x;
cin >> n >> x;
cout << n + f(n - x, x);
return 0;
}
| ALGO | 0.999905 | 3.584581 |
105b67cd-6db4-4a29-9d11-fb98dbfd86f1 | Rittik-kumar19/Leetcode---solution | 2958-length-of-longest-subarray-with-at-most-k-frequency/2958-length-of-longest-subarray-with-at-most-k-frequency.cpp | class Solution {
public:
int maxSubarrayLength(vector<int>& nums, int k) {
int n = nums.size();
int i=0,j=0;
int cnt = 0;
int len = 0;
int mxcnt = INT_MIN;
map<int,int>mp;
while(j<n){
mp[nums[j]]++;
// mxcnt = max(mxcnt, mp... | ALGO | 0.999944 | 6.114418 |
5de99d8c-74f6-49b4-ab6d-bf403f11a799 | Tharun8008/COMPILER-DESIGN | dead code elimination.cpp | #include <stdio.h>
#include <string.h>
int main() {
char s1[100], s2[100], s3[100];
int i, j, flag1 = 0, flag2 = 0;
printf("S1=");
scanf("%s", s1);
printf("S2=");
scanf("%s", s2);
printf("S3=");
scanf("%s", s3);
for (i = 0, j = 0; i < strlen(s1) && j < strlen(s2); i++, j++) {
... | ALGO | 0.99842 | 3.085217 |
9387efb6-ad91-471d-a53d-ee3aedd2c7dc | alessandro-bugatti/guida_territoriali | materiali/problemi territoriali/2008_mappa/mappa.cpp | #include <fstream>
using namespace std;
int mappa[100][100];
int N;
void attraversa(int i, int j)
{
for (int r=-1; r<2; r++)
for (int s=-1; s<2; s++)
{
if (i+r<0 || i+r>N-1 || j+s < 0 || j+s > N-1);
else if (mappa[i+r][j+s] == 0 || mappa[i+r][j+s] > mappa[i][j] + 1 )
{
mappa[i+r][j+s] = mapp... | ALGO | 0.999684 | 3.513057 |
aeea18d0-ecf1-46eb-b4f0-3131b46ee17f | Dreams-N/platform_frameworks_av | media/libstagefright/codecs/amrnb/common/src/sqrt_l.cpp | /*
Pathname: ./audio/gsm-amr/c/src/sqrt_l.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template. Changed function interface to pass in a
pointer to overflow flag into the function instead of using a
global flag. ... | ALGO | 0.99996 | 5.869467 |
c9e02aa5-d90a-489a-ba76-a3d5fb28c582 | Yura0508/lab_02_1_repos | Lab_02.1/Lab_02.1.cpp | // Lab_02.cpp
// < Кісіль Юрій >
// Лабораторна робота № 2.
// Лінійні програми.
// Варіант 7
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double z1;
double z2;
double a;
double b;
double PI = 4 * atan(1.0);
cout << "a = "; cin >> a;
z1 = pow(cos(PI * 3 / 8 - a / 4), 2) - pow(cos((PI ... | ALGO | 0.997219 | 3.4739 |
cef4ca40-2861-41ef-b21c-b4fabb9c49b6 | fsy-juruo/noip-2021-js-answer | t2021/JS-0428/chess/chess.cpp | #include<bits/stdc++.h>
using namespace std;
struct Piece{
int col,lv,pos;
void Reset(int _pos){
col=-1;
lv=-1;
pos=_pos;
}
void Set(Piece A){
col=A.col;
lv=A.lv;
}
}a[100009];
int t,n,m,q;
string G[2][100009];
int ln[4][200009];
Piece chked[200009];
int d[4]={-m,-1,1,m};
bool vis[200009],cango[200009];i... | ALGO | 0.999164 | 4.053927 |
a50276ff-a4ed-4fdf-a632-7d90797dd141 | siddiq2604/GFG-Problems | Basic/Count Leaves in Binary Tree/count-leaves-in-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
};
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
return temp;
}
Node* buildTree(string str)... | ALGO | 0.997021 | 6.78181 |
066edaea-fd3d-4be4-a5ec-a8cb208e0ce9 | ajayjangid-51/1Kshot | similarPairs.cpp | #include <bits/stdc++.h>
using namespace std;
#define lb lower_bound
#define ub upper_bound
#define sz(x) x.size()
#define ll long long
#define pint unsigned int
#define pb push_back
#define vb vector<bool>
#define vi vector<int>
#define vs vector<string>
#define vvi vector<vi>
#define vvb vector<vb>
#define pii pair... | ALGO | 0.999927 | 4.019917 |
e95294e8-30c9-4b73-aaca-6966f17b41c9 | Thinker-08/Striver-s-SDE-Sheet | Arrays Part-III/Pow(X,n).cpp | #include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define int long long
using namespace std;
#define vi vector<int>
#define vvl vector<vector<int>>
#define vl vector<int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define newline cout<<'\n'
double calc(double x,int n)
{
... | ALGO | 0.999782 | 4.283904 |
532b180c-bc6e-4cd2-a59f-8725228505fb | krishna7602/codforces | chocolates.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll n;
cin>>n;
vector<ll> v(n);
for(ll i=0;i<n;i++){
cin>>v[i];
}
ll sum=0;
ll need=v[n-1];
for(int i=n-1;i>=0;i--){
if(v[i]>=need){
sum+=need;
need--;
... | ALGO | 0.999959 | 3.500417 |
777c51f5-0459-475f-901d-209f67311a24 | ishandutta2007/codeforces | aropan/normal/341/B.cpp | #include <queue>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <stack>
using namespace std;
template <typename T> T sqr(T x) { return x * x; }
template <typename T> T abs(T x) { return x < 0? -x : x; }
templ... | ALGO | 0.999993 | 3.939611 |
e63323d8-a3f3-451f-ad4f-4a9515b51c5c | rudrax14/DSA-CPP | searching & shorting/Assignment/K-ClosedEle.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// through sorting O(nlogn)
// vector<int> findClosestElements(vector<int> &arr, int k, int x)
// {
// vector<pair<int, int>> diffAndIndex; // making pair
// // for loop iteration
// for (int i = 0; i < arr.size(); i++)
// ... | ALGO | 0.999998 | 5.333763 |
de872869-dbec-4102-8c4d-0c8226c2099c | ceydacnrdl/Flutter_Transaction | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
56bb4161-e07e-4d9d-b08a-398fa10acc3f | MingzhenY/code-warehouse | CodingWebsites/LeetCode/CPP/Volume4/322.cpp | #include <cstdlib>
#include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <list>
#include <cmath>
#include <map>
#include <set>
#include <stack>
using namespace std;
class Solution {
public:
#define LL long long
int coinChange(vector<int>& coin... | ALGO | 0.999861 | 4.911592 |
0fc728ab-1f30-45ea-a75e-137d88536569 | hopark123/algorithm | 4.program/dfs/old)2차원동전뒤집기.cpp | #include <string>
#include <vector>
#include <cmath>
#include <iostream>
using namespace std;
int N, M;
int answer = 1e7;
int check(vector<vector<int> > board, vector<vector<int> > target) {
int res = 0;
for (int i = 0; i < M; ++i) {
int flag = 0;
for (int j = 0; j < N; ++j) {
flag ... | ALGO | 0.999986 | 5.045281 |
55311796-2868-4b21-8ea2-7fc83244c553 | hieupham1103/TINHOC | ONLINE OJ/CODEFORCES/Contest kho dam/BETA AND TESTING ROUND/Testing Round 9/C.cpp | #include<bits/stdc++.h>
#define ii pair <int,int>
#define fi first
#define se second
#define int long long
#define double long double
#define endl '\n'
#define all(x) x.begin(), x.end()
using namespace std;
const int maxN = 3e5 + 10;
int a[maxN];
int last[30];
map <int,int> res;
signed main(){
//freopen("input.IN... | ALGO | 0.999915 | 3.675853 |
53060eb4-d33e-48bc-a902-2d0cae778db7 | raincross7/code-similarity | codes/train_code/problem159/problem159_308.cpp | #include <bits/stdc++.h>
#include <vector>
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n-1,0)
using namespace std;
#define int long long
using ll = long long;
const int MX = 1e6;
const ll inf ... | ALGO | 0.999827 | 3.387664 |
a65b1b5b-b5aa-4d23-abc1-d18cd91e98a1 | juy13/LinkedListClass | LinkedList/LinkedList.cpp | // LinkedList.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include "LinkedListClass.h"
#include "ISorter.h"
#include <iostream>
#include "Human.h"
#include <time.h>
void test_func()
{
time_t start, end;
ISorter B;
LinkedListClass<int> a;
for (int i =... | ALGO | 0.962844 | 3.877909 |
5ec2f9f2-79cb-48e2-899b-a55f694569cf | raincross7/code-similarity | codes/train_code/problem060/problem060_496.cpp | #include<iostream>
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
int n;
vector<int> adj[100005];
int dp[100005][2];
int solve(int u,bool constraint,int parent){
if(dp[u][constraint]!=-1)
return dp[u][constraint];
int ans = 0;
int w1 = 1;
for(auto child: adj[u]){
if... | ALGO | 0.999223 | 4.406205 |
a0058f92-3d38-4d1b-b096-5cb63e5eddb8 | danielbuhr/REMM_SWATplus_SensitivityAnalysis | Sensitivity Analysis/Sensitivity_Function.cpp | #include <algorithm>
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
List Calc_Sort_C(NumericVector data, NumericMatrix density_total, int n, int m){
Rcpp::Environment base("package:KernSmooth");
Rcpp::Function bkde_r = base["bkde"];
NumericMatrix Smj(m, 512);
NumericVector Sm(m);
NumericMatrix li... | ALGO | 0.999876 | 5.190983 |
686e483e-7807-44e5-b4be-afbcb447b1de | XiaoyuNoFish/Data-Structrue | HFUT_Data_Structure/Unit_2/5.cpp | /* Ƽϵͳܶ㼰ŵıʽ */
#include <iostream>
#include <stack>
using namespace std;
char Compare(char a, char b)
{
int i, j;
char Table[9][8] = {
{' ', '+', '-', '*', '/', '(', ')', '='},
{'+', '>', '>', '<', '<', '<', '>', '>'},
{'-', '>', '>', '<', '<', '<', '>', '>'},
{'*', '>', '>', '... | ALGO | 0.999993 | 4.095727 |
827f8a98-ee9d-484b-8503-5e979671dc93 | a-mishra16/Laboratory-10-1 | Laboratory 10-1.cpp | /*
* Project: Laboratory 10-1
* Author: Aanika Mishra
* Date: 11-7-2024
* Description: This program intakes a string statement from the user and counts and returns the number of letters.
*/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int countLetters(string str);
int main()
{
str... | ALGO | 0.990633 | 5.701269 |
d7704d7f-dba7-42e7-a8df-8e2aaab0ea5c | Zirbo/IPCsim | lammps/postprocess/IPCpostprocess.cpp | #include <cstdlib>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include "IPCpostprocess.hpp"
#include "IPCpostprocessNeighbourAnalysis.hpp"
#include "IPCpostprocessOrientationsAnalysis.hpp"
#include "IPCpairCorrelation.hpp"
IPCpostprocess::IPCpostprocess(std::string const& trajFilen... | ALGO | 0.978145 | 5.084587 |
7f37b2fb-e104-4325-bf63-bf78c504d24e | ttnhathuy313/cp-career | Codeforces/Contest785/TaskD.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 5, MOD = 1e9 + 7;
int n, fac[N * 2];
string s;
int modPow(int x, int y) {
x %= MOD;
int ret = 1;
while (y) {
if (y & 1) ret = ret * x % MOD;
x = x * x % MOD;
y >>= 1;
}
return ret;
}
int inv(int x) {
return modPow(x,... | ALGO | 0.999963 | 4.312731 |
d3f5e9f1-f9e6-478a-bcd7-940fb37d0964 | alexandraback/datacollection | solutions_5644738749267968_1/C++/u8765/D.cpp | #include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cassert>
#include <cmath>
#include <deque>
#include <map>
#include <cstring>
#include <set>
using namespace std;
int conv( string s ) {
auto p = s.find('.');
assert( p != string::npos );
aut... | ALGO | 0.999783 | 3.824657 |
b380f37c-0e77-4828-b188-c3d31e432f6b | rupak-20/Problem-Solving | first-unique-character-in-a-string/first-unique-character-in-a-string.cpp | class Solution {
public:
int firstUniqChar(string s) {
unordered_map<char, int> u;
for(int i=0; i<s.length(); i++) {
++u[s[i]];
}
for(int i=0; i<s.length(); i++) {
if(u[s[i]] == 1)
return i;
}
return -... | ALGO | 0.999839 | 5.993457 |
0a5cb471-0fea-4a6b-abea-e61bdfb0fce6 | mrvivekthumar/CPP_Programming_Sem_2 | experiment 1/exp1_7.cpp | // Write A Progam To Print The Maximum Value Of Three Number.
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cout << "Enter Three Number : ";
cin >> a >> b >> c;
cout <<"Maximum Number Is : "<< ((a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c));
return 0;
} | ALGO | 0.999531 | 4.128987 |
c0b1994a-c77f-43f1-88eb-a4cf35ff0edc | tmuttaqueen/ContestTemplateLibrary | Zahin Vai Code/Manacher's Algorithm.cpp | #include <bits/stdtr1c++.h>
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
#define dbg(x) cout << #x << " = " << x << endl
using namespace std;
/*** Manacher's algorithm to generate longest palindromic substrings for all centers ***/
/// When i is even, pal[i] = largest palin... | ALGO | 0.999906 | 3.841263 |
eb90df19-cae6-427e-b58f-aa0ee9bbdf6b | alidevjimmy/advanced-programming-review-class | swap.cpp | #include <iostream>
using namespace std;
void swapWithPointer(int *a , int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
void swapWithRefrence(int &a , int &b) {
int temp = a;
a = b;
b = temp;
}
int main() {
int a[4] = {4,2,1,6};
swapWithRefrence(a[1],a[3]);
cout << a[1] << ' ' << a... | ALGO | 0.992828 | 4.020543 |
2674a110-5f01-49e1-9dd3-f68441376163 | Centinoughty/leetcode | 1438.cpp | // Longest continuous subarray with absolute difference less than or equal to limit
// MEDIUM
#include <vector>
#include <deque>
using namespace std;
class Solution {
public:
int longestSubarray(vector<int>& nums, int limit) {
int ans = 0;
deque<int> minQueue;
deque<int> maxQueue;
... | ALGO | 0.999994 | 5.946024 |
fadc297f-637c-4cd8-aaed-55f27eea4864 | YejeongKang/240429 | 240429/Iterator.cpp | //vector<int> ::iterator iter;
// * iterator
// ҿ ϱ .
// Ѻ 迭 ٸ ϴ 迭 .
// resize ϸ, ο ҵ س .
// ƿ ٸ ּҰ .
//int nums[10];
//int* p = nums;
//int* p = v; // X
// int* p = v.begin();
// ߺ
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main() {
... | ALGO | 0.966452 | 4.063638 |
268da88f-a38a-4f83-b680-a626ab64ed88 | shweaye810/csc340 | assignment_1/CSC340_Assignment_1_part_1.cpp | /*
Problem 1. Implement a C++ program that has the following functions:
1. Reads in a paragraph of English text up to 100 words from the
keyboard and stores this paragraph in a string object. Feel free to
include this task in the main() function.
2. Identifies the least frequent letter (case insensitive) in th... | ALGO | 0.999723 | 6.562269 |
c1db7b11-2b64-4edb-beca-7ae8758726a5 | RIYANSHGARG/DSA | DSA1/11. Recursion/ReversingArray.cpp | #include <iostream>
using namespace std;
void func(int *a, int si, int ei)
{
if (si >= ei)
return;
func(a, si + 1, ei - 1);
swap(a[si], a[ei]);
}
int main()
{
int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
func(a, 0, 9);
for (int i = 0; i < 10; i++)
{
cout << a[i] << " ";
... | ALGO | 0.999827 | 4.287888 |
c3a9ef7c-4ac9-473e-bc40-5fc8b740c014 | anetakaczmarczyk/Optymalizacja | Optymalizacja/Pliki/ode_solver.cpp | //Ten plik nie powinien by edytowany
#include"ode_solver.h"
matrix* solve_ode(matrix(*diff)(double, matrix, matrix, matrix), double t0, double dt, double tend, matrix Y0, matrix ud1, matrix ud2)
{
try
{
int N = static_cast<int>(floor((tend - t0) / dt) + 1);
if (N < 2)
throw string("matrix* solve_ode(...):\np... | ALGO | 0.999064 | 4.964795 |
37e59944-31c5-4ea7-843d-5cfbc85813f9 | FahimFBA/Codeforces-Solution | 266B Queue at the School/solve.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, t, i;
string str;
cin >> n >> t >> str;
while (t--)
{
for (i = 1; i < n; i++)
{
if (str[i] == 'G' && str[i - 1] == 'B')
{
str[i] = 'B';
str[i - 1] = 'G';
... | ALGO | 0.999832 | 4.153222 |
38fc27d1-2dc8-4305-b1ab-4bf151c12f05 | Starry0/ACM | 51nod/1562.cpp | #include <bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const int N = 200010;
struct Nod{
ll l, r;
}h[N],w[N];
struct op{
char op; int x;
}o[N];
int hh[N], ww[N];
ll ans[N];
bool vish[N], visw[N];
int main() {
int W, H, n;
cin >> W >> H >> n;
for(int i = 0; i < N; i ++) {
h[i].l... | ALGO | 0.999888 | 3.386325 |
b0b1c849-4f6b-4d65-900a-8ee90b5fcb3c | wh-acmer/acm-shiyuan | November/CF484A(bitmask).cpp | // Bits
// http://codeforces.com/problemset/problem/484/A
// bit mask
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <vector>
using namespace std;
typedef long long LL;
LL solve(LL l,LL r){
if(l==r) return l;
int i=63;
... | ALGO | 0.999852 | 4.467018 |
5d8639b3-6e6a-41f9-b304-6e964ed48969 | gougon/LeetCode | 658-FindKClosetElements/findKClosetElements.cpp | #include <iostream>
#include <bits/stdc++.h>
#include "../utils/Utils.cpp"
using namespace std;
class Solution {
public:
vector<int> findClosestElements(vector<int>& arr, int k, int x) {
return binarySearch(arr, k, x);
}
private:
vector<int> iteration(vector<int>& arr, int k, int x) {
queu... | ALGO | 0.999997 | 5.361438 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.