uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
47549655-4bf6-4b15-ac91-e9eb4799728b | LorenzoBertinelli/School | EserciziC++/Es11pag144.cpp | #include <iostream>
using namespace std;
float velocita (float diametro, float giri){
double risultato = 3.1416 * diametro * giri * 6;
risultato=risultato*60/1000; //faccio la conversione da m/s a km/h
return risultato;
}
int main(){
float diametro, giri;
cout<<"inserici il diametro (num... | ALGO | 0.9945 | 3.839164 |
508c433a-da4e-4693-b9db-4060270ba213 | nafisatuli/os | round robin scheduling.cpp | /*Round Robin Scheduling*/
#include<bits/stdc++.h>
using namespace std;
struct st
{
string s;
double b;
};
int main()
{
st aa[1000];
int n,j;
double rem_bt[100],wt[1000],tq,t=0,temp=0;
vector<pair<double,string> >sum;
cin >> n;
for(int i=0; i<n; i++)
{
cin >> aa[i].s >> aa[i]... | ALGO | 0.999973 | 3.294361 |
cc2e12b7-4765-4385-9eb1-d52cc269b635 | rajansaini691/MAT240B | assignment/reverse_words.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
while (true) {
printf("Type a sentence (then hit return): ");
string line;
getline(cin, line);
if (!cin.good()) {
printf("Done\n");
return 0;
}
// put your code here
string curr;
for(int i = 0; i < ... | TOOL | 0.85145 | 4.38247 |
05ef6548-157e-4f45-9764-efc6930f4bce | johnhaq69/rismelku | 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 |
69103a4d-fe3c-4b44-8efb-c0b4e78525b6 | dosimpact/BOJ_PS | env_cpp/main.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int n, m, res;
char map[20][20];
bool range_check(int y, int x, int r) {
for (int i = -1; i <= 1; i+=2) {
int ty = y + r * i;
int tx = x + r * i;
if (ty < 0 || ty >= n || tx < 0 || tx >= m) return false;
}
return true;
}
int other() {
int tmp2 ... | ALGO | 0.999819 | 4.746178 |
55d7722d-bb4c-48f2-97ea-1a7505a7a67e | vvdvortsova/recursive_descent_parser | src/math_tree.cpp | /**
* @file math_tree.cpp
* @brief Definitions of methods for recursive descent parser
* @author Dvortsova Varvara BSE182 HSE
*/
#include "math_tree.h"
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <cmath>
#include <iostream>
#define EQUATION_... | ALGO | 0.87996 | 3.934297 |
bd13a5df-e11a-410b-905e-2d0dd1402b67 | LucasMMF/algorithms-studies | FAETERJ - Algoritmos II/Exercícios/Lista Júnior/Sequencial/Exercício 9/Exercicio9.cpp | //Area de declaracao de bibliotecas
#include <stdio.h> // printf e scanf do C
#include <iostream> // cout e cin do C++
#include <stdlib.h> // system pause e cls
//Area de prototipos de funcao
//Chamada da funcao main()
using namespace std;
main()
{
float Fa;
printf("************************************... | TOOL | 0.960428 | 3.463298 |
7d4585f1-d1a4-43b7-9a1c-2737e16b81aa | jonstewart/boost-svn | libs/graph/example/dfs-parenthesis.cpp | char name[] = "abcdefghij";
struct parenthesis_visitor : public boost::default_dfs_visitor
{
template <class Vertex, class Graph> void
start_vertex(Vertex v, const Graph &)
{
std::cout << ' ';
}
template <class Vertex, class Graph> void
discover_vertex(Vertex v, const Graph &)
{
std::cout << "(" ... | ALGO | 0.999719 | 6.166417 |
f201c4f8-e016-4a54-b53f-c1313895c536 | freepengui/MAMBA-asym | MAMBA-asym/src/LSSS/ShareData.cpp | #include "ShareData.h"
#include "config.h"
void ShareData::assign(const ShareData &SD)
{
type= SD.type;
Otype= SD.Otype;
Etype= SD.Etype;
M= SD.M;
nmacs= SD.nmacs;
threshold= SD.threshold;
if (type == Full)
{
RCt= SD.RCt;
ReconS= SD.ReconS;
}
else
{
Parity= SD.Parity;
... | TOOL | 0.979351 | 5.406713 |
c50a294b-d433-4065-8c47-91cf5e7f4307 | Merci24Dec/unitech_cpp_with_oops-course | programs_AtoZ/Conversion Decimal to Hexadecimal/using_udf.cpp | // C++ Decimal to Hexadecimal using Function
#include<iostream>
using namespace std;
int DecToHexDec(int dec, int);
char hexaDecNum[50];
int main()
{
int decimalNum, i;
cout<<"Enter the Decimal Number: ";
cin>>decimalNum;
i = DecToHexDec(decimalNum, 0);
cout<<"\nEquivalent Hexadecimal Value: ";
... | ALGO | 0.998987 | 5.918784 |
a57fb059-6eb7-410e-8f90-a7f2d6ee56e8 | StackDoubleFlow/LLVMStackPU | libcxx/src/random_shuffle.cpp | #include "algorithm"
#include "random"
#ifndef _LIBCPP_HAS_NO_THREADS
# include "mutex"
# if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB)
# pragma comment(lib, "pthread")
# endif
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
_LIBCPP_SAFE_STATIC static __libcpp_mutex_t __rs_mut... | TOOL | 0.89475 | 3.902596 |
a11b5bec-c324-4989-8502-a14abe21d6eb | actium/codeforces | 0900/20/920a.cpp | #include <iostream>
#include <vector>
template <typename T>
std::istream& operator >>(std::istream& input, std::vector<T>& v)
{
for (T& a : v)
input >> a;
return input;
}
void answer(unsigned v)
{
std::cout << v << '\n';
}
void solve(unsigned n, const std::vector<unsigned>& x)
{
const size_t... | ALGO | 0.999457 | 5.032974 |
9506c10f-a0ab-413f-99a6-a7b7937ead00 | meloalright/cpp-book | class1115_0.cpp | //class1115_0.cpp
#include <iostream>
#include <string>
using namespace std;
class Amy{
public:
Amy(int id=0,int val=0){
this->id = id;
this->val = val;
}
Amy operator+(const Amy &);//重载加法运算符
Amy operator-(const Amy &);//重载减法运算符
void display();
private:
int id;
int val;
};
Amy Amy::operator+(cons... | TOOL | 0.990371 | 4.611536 |
15902f1d-185a-4fc7-b0d7-d6021e17e4e4 | vinodindi8701/CodeLibrary | 1560A.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int check( int n )
{
int r, cp = n;
if( n%10 == 3 ){
return 1;
}
else{
return 0;
}
}
void fun( int a[] )
{
int c = 1, r, n, i = 1;
a... | ALGO | 0.999649 | 3.578776 |
26223662-707f-4f85-9977-799ef84ced24 | LexiMuMu/cpp | 124/ASS2/main1.cpp | /************************************************************
* Filename: sort.h *
* Login: lm890 *
* lab No: assignment 2 *
* File Description: Do pivot quick sort an array with *
* ten... | ALGO | 0.999614 | 4.931101 |
f70224ed-2734-423f-9d02-07e950d8c71b | Xrvitd/C_code | 1174 靶形数独.cpp | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cstdlib>
#include<string>
#include<bitset>
#include<iomanip>
#include<deque>
#include<ctime>
#define INF 1000000000
#define fi first
#define se ... | ALGO | 0.999888 | 3.779954 |
2efe4954-7143-4a8b-bf02-0f63c7c8ae49 | wohenniubi/codebattle | src/1396_Design_Underground_System/main.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
class UndergroundSystem {
public:
// Runtime: 160 ms, faster than 29.05%
// Memory Usage: 57.6 MB, less than 82.72%
unordered_map<int, pair<string, int>> caches;
// 还有种做法是将startStation名字和endStation名字连起来,这样就不需要嵌套的unordered_map了
unord... | ALGO | 0.986393 | 6.201238 |
c2559219-3a6e-4e6e-aff8-672a1fa3303c | kxonixnio/PJAText2 | isInputCorrect.cpp | //
// Created by Mikołaj on 08.06.2021.
//
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include "isInputCorrect.hpp"
#include "my_exception.hpp"
#include "o_flag.hpp"
auto should_exception_be_called = false;
namespace input_correctness {
auto replace_given_flag_alias_with_given_flag_... | TOOL | 0.880021 | 4.586351 |
347aef20-966b-401d-9de9-78c71145769c | project-qmc/QMC | src/rpcprotocol.cpp | #include "rpcprotocol.h"
#include "clientversion.h"
#include "tinyformat.h"
#include "util.h"
#include "utilstrencodings.h"
#include "utiltime.h"
#include "version.h"
#include <stdint.h>
#include "json/json_spirit_writer_template.h"
#include <boost/algorithm/string.hpp>
#include <boost/asio.hpp>
#include <boost/asio... | WEB | 0.875929 | 7.539889 |
3dc020ee-5d16-4d65-9717-d1b9f5e8447b | KNHui/algorithm | solve/JLIS.cpp | /*
합친 LIS
https://www.algospot.com/judge/problem/read/JLIS
주어진 두 수열의 'JLIS'를 구하는 문제다.
'LIS' 문제 해법을 변형해서 풀었다.
(https://github.com/KNHui/algorithm/blob/master/ALGOSPOT/LIS.cpp)
"int jlis(int idx_a, int idx_b)" 함수는 "A [idx_a, n)"과 "B [idx_b, m)"의 'JLIS' 길이를 반환한다.
"jlis(-1, -1)"와 같이 한 번의 호출로 'JLIS'의 길이를 구할 수 있다.
... | ALGO | 0.999977 | 4.508523 |
e40ec103-8548-4871-8145-4829fb344709 | dza810/atcoder | cpp/typical90/typical90_n/30981254.cpp | // Contest ID: typical90
// Problem ID: typical90_n ( https://atcoder.jp/contests/typical90/tasks/typical90_n )
// Title: 014. We Used to Sing a Song Together(★3)
// Language: C++ (GCC 9.2.1)
// Submitted: 2022-04-15 09:45:58 +0000 UTC ( https://atcoder.jp/contests/typical90/submissions/30981254 )
#include "bits/stdc... | ALGO | 0.99993 | 4.392378 |
a6e09f07-d0c9-4c79-a3e6-3bc92071fb65 | Nehagaddam2909/CP | codechef/CodeRythm 1.0/hiring_talent.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
string na;
ll a,ot;
multimap<ll,pair<string,ll>,greater<ll>> mp;
ll n;
cin >> n;
while... | ALGO | 0.998132 | 3.754653 |
cad893bc-6510-480d-a5e5-09ffeac45fed | KwanWaiPang/SF-Loc_comment | thirdparty/lietorch/eigen/bench/quat_slerp.cpp | #include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Q>
EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t)
{
return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized());
}
template<typename Q>
EIGEN_DONT_INL... | ALGO | 0.994856 | 6.251565 |
56ec6650-4ece-4971-9ab6-81293e77107b | ortemx/university | term1v2/пактика ЭВМ/C++/lab2a.cpp | #include <iostream>
#include <windows.h>
#include <iomanip>
#include <ctime>
using namespace std;
int main (){
int n;
double a;
cout << "enter n "; cin >> n;
cout << "enter a "; cin >> a;
double p = 1;
double s = 0;
for (int i = 0; i <= n; i++){
p *= (a + i);
s += 1 / p... | ALGO | 0.984058 | 3.471997 |
b4338caf-499f-49c2-b0d8-48a3ae1d629d | sourav600/Problem-Solving | UVa/10079 - Pizza Cutting/main.cpp | #include<iostream>
#include<string>
using namespace std;
typedef long long ll;
typedef unsigned long ulong;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ll n;
while(cin>>n && n>=0){
ll ans = (n*(n+1))/2;
cout<<ans... | ALGO | 0.999157 | 3.931328 |
3f27a043-79ed-4873-b24f-5893bddedfa9 | mozammilashraf/Daily_Leetcode_Questions | 1635-number-of-good-pairs/1635-number-of-good-pairs.cpp | class Solution {
public:
int numIdenticalPairs(vector<int>& nums) {
unordered_map<int,int>mp;
int n= nums.size();
int ans=0;
for(int i=0;i<n;i++){
ans+=mp[nums[i]];
mp[nums[i]]++;
}
return ans;
}
}; | ALGO | 0.999987 | 5.89611 |
43ba6d9f-fba7-4ca9-babd-f41f1963aba6 | hsgarg/Algorithms | selectionSort.cpp | #include<iostream>
using namespace std;
/// Selection Sort
/// At every point select the minimum element and bring it to the front
int main(){
int n;
cin>>n;
int a[1000];
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n-1;i++){
int minimum = a[i];
int minInde... | ALGO | 0.999979 | 3.953678 |
6b5e2fb5-625f-4a1c-bf5e-5c82d5458c15 | showgames/Stroustrup_programming | 4章/4_13.cpp | // エラトステネスの篩
// (1)素数の倍数は素数ではない
// eg. 2, 3, 5, 7は素数であるから
// 4, 6, 10, 14は素数でない
// (2)素数でない数(合成数)は必ずその数の平方根以下に分類できる
// eg. 98は合成数である。98の平方根は9ちょっとである
// 98 = 2 * 49
// どのようにしても、10以上の数2つに分解することはできない。なぜなら、
// 10 * 10 = 100
// だからである。
#include "../std_lib_facilities.h"
vector<int... | ALGO | 0.995962 | 5.238377 |
3b464e4c-55c5-44f4-8919-3734b55a37bd | SWEG-2015EC-Batch/Code-Warrior | ETS1303_15_TESFAMICHAEL_TAFERE/Activity 3.1/Printing patterns/Square.cpp | //Printing square
//By Tesfamichael
#include <iostream>
using namespace std;
int main()
{
int j, i, n=5;
for(i=1; i<=n; ++i){
for(j=1; j<=n; ++j){
cout<<"* ";
}
cout<<endl;
}
return 0;
}
| ALGO | 0.999052 | 3.598168 |
05481ead-9923-47c4-8a5e-6e1ba594cdd1 | gogoalswo/Unreal_Study | UnrealEngine-4.27/Engine/Source/ThirdParty/ICU/icu4c-64_1/source/common/ucharstrieiterator.cpp | #include "unicode/utypes.h"
#include "unicode/ucharstrie.h"
#include "unicode/unistr.h"
#include "uvectr32.h"
U_NAMESPACE_BEGIN
UCharsTrie::Iterator::Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLength,
UErrorCode &errorCode)
: uchars_(trieUChars),
pos_(uchars_... | ALGO | 0.970369 | 7.693824 |
4f26191f-7d76-49d1-9947-b78f708bc9c4 | Matej33/Programko-Cpp | Codeforces/Magnets.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define endl "\n"
#define db double
#define str string
#define vi vector<int>
#define pb push_back
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int counterX = 0, counterY = 0, counter = 1;
... | ALGO | 0.999748 | 3.964165 |
30a818d3-1f9e-449b-a6f7-c26beb431a7b | Gagan-jain-004/ShDSA | d-31 BT/HeightOfTree.cpp | // height = max distance of root to lead node also = edges(root to leaf)+1
// also height = level
// approach - go on level order traversal wherever u are adding next line just use count++ to get the height
// but majorly recursion is prefer for solving so see below
// so its approach is left subtree ki heig... | ALGO | 0.99985 | 5.37097 |
fe3c0868-8f02-4c9c-86c7-743b9c92689c | Decode2Code/CodingPractice | GeeksForGeeks/ToggleBits.cpp | /*
* https://practice.geeksforgeeks.org/problems/toggle-bits-given-range/0
* ToggleBits
*/
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
//code
int t;
cin>>t;
while(t--){
int num;
cin>>num;
int l, r;
cin>>r>>l;
int digits = l-r+1;
int mask = ((1<<digit... | ALGO | 0.999844 | 4.944064 |
857c75c9-54df-4f4a-9cb2-df526a54cb1e | Pedrotok/competitive_prog | Geometry/ConvexHull.cpp | template<typename T>
T D(pair<T,T> P, pair<T,T> Q, pair<T,T> R) {
return P.ff*Q.ss + P.ss*R.ff + Q.ff*R.ss - (Q.ss*R.ff + P.ff*R.ss + P.ss*Q.ff);
}
template<typename T>
vector<pair<T,T>> convex_hull(vector<pair<T,T>> S) {
vector<pair<T,T>> L, U;
for(auto& p : S) {
while(L.size() >= 2 && D(L[L.size()-2], L[L.size... | ALGO | 0.999778 | 5.003086 |
a3f767d3-62fe-4719-a6d0-2401bdd5dd11 | prabhat-work/Code_Lib | sun_leaf_nodes.cpp | #include<bits/stdc++.h>
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
#define pb push_back
#define endl "\n"
typedef long long ll;
struct Node{
int data;
Node *left,*right;
};
Node *newnode(int data)
{
Node *temp=new Node;
temp->data=data;
temp->left=NULL;
temp->right=NU... | ALGO | 0.999947 | 3.73997 |
33e749ff-f2e1-4f31-bdb9-c5b76a48e6d6 | sunilkumarswami/LeetCode-Pratice | 0863-all-nodes-distance-k-in-binary-tree/0863-all-nodes-distance-k-in-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void solve(TreeNode* node,int dist,int k,vector<int> &ans,unordered_map<TreeNode*,bool> &vis,ma... | ALGO | 0.999998 | 5.769994 |
e1a93524-ee92-4e11-acc3-d29d1cfab42c | SoonHyeongLim/2015440123- | linkedlist2/linkedlist.cpp | #include <stdio.h>
#include <stdlib.h>
typedef struct node{
int score;
struct node* pNext;
}Node;
Node* createNode (int input){
Node* ptr;
ptr=(Node*)malloc(sizeof(Node));
ptr->score=input; ptr->pNext=NULL;
return ptr;
}
void printLL(Node* ptr){
while(ptr!=NULL){
printf("score=%d\n",ptr->score);
ptr=ptr->... | ALGO | 0.998605 | 3.735533 |
ecea9958-8a26-4379-9330-afcaae0a5b20 | babuvar/D_to_Pi0Pi | Offline_Analysis/PiPi/Data/A_CP4/acp_MD_sim4bin_alt.cpp | #ifndef __CINT__
#include "RooGlobalFunc.h"
#endif
#include "RooRealVar.h"
#include "RooDataSet.h"
#include "RooGaussian.h"
#include "RooConstVar.h"
#include "RooChebychev.h"
#include "RooAddPdf.h"
#include "RooSimultaneous.h"
#include "RooCategory.h"
#include "TCanvas.h"
#include "TAxis.h"
#include "RooPlot.h"
using n... | DATA | 0.959506 | 3.937045 |
6eaa49f7-f135-4585-b50b-78afe8b9539e | yoyobuzz/codeforces-solution | 20010.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast_io std::ios::sync_with_stdio(0); cin.tie(0);
#define int long long
#define test int ttttt; cin>>ttttt; while(ttttt--) solve();
#define nl "\n"
typedef vector<int> vi;
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define f(i, p, n) for(int i=p; ... | ALGO | 0.999603 | 3.713613 |
315762e7-f36b-4af5-948d-b928d53418cc | luoyongheng/opencv_add_contrib | modules/photo/src/denoising.cpp | #include "precomp.hpp"
#include "fast_nlmeans_denoising_invoker.hpp"
#include "fast_nlmeans_multi_denoising_invoker.hpp"
#include "fast_nlmeans_denoising_opencl.hpp"
template<typename ST, typename IT, typename UIT, typename D>
static void fastNlMeansDenoising_( const Mat& src, Mat& dst, const std::vector<float>& h,
... | ALGO | 0.999088 | 5.967382 |
2598821a-88f1-405a-8674-c34359cdbf4d | ishandutta2007/codeforces | tute7627/normal/1618/D.cpp | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define spa << " " <<
#define fi first
#... | ALGO | 0.99983 | 3.753522 |
acfcaa01-58ed-4bba-bbba-117ca11d806c | Anshuu-Sharma/LeetCode-my-solutions | 0934-bitwise-ors-of-subarrays/0934-bitwise-ors-of-subarrays.cpp | class Solution {
public:
//KNK
int subarrayBitwiseORs(vector<int>& arr) {
vector<int> s;
int l = 0;
for (const int a : arr) {
const int r = s.size();
s.push_back(a);
// s[l..r) are values generated in the previous iteration
for (int i = l; i < r; ++i)
if (s.back() != (s[... | ALGO | 0.999821 | 5.978457 |
a49e3101-7fed-4bd4-9a1a-51131c14a52d | sid18d/C_plus_plus | Accenture_TCS/accStringINString.cpp | /*
Q.String within String
Given two strings, ‘X’ and ‘Y’ (length(X)>=1, length(Y)<=10000), find out if ‘Y’ is contained in ‘X’
Example 1:
Input 1: abac
Input 2: ab
Output: yes
Explanation:
ab is present with abac
Example 2:
Input 1: xyac
Input 2: xz
Output: no
*/
#include <bits/stdc++.h>
#include <iostream>
us... | ALGO | 0.999969 | 5.447354 |
881298aa-81a0-470a-8b61-b9351d5c4b33 | themennice/programming-challenges | GridSearch.cpp | /*
https://www.hackerrank.com/challenges/the-grid-search/problem
This solution identifies if a given 2D grid exists within a bigger grid
*/
string gridSearch(vector<string> G, vector<string> P) {
int found=0;
// for each row in the bigger grid minus the height of smaller grid
for(int i = 0; i <= G.size... | ALGO | 0.999654 | 4.777907 |
5b56a48c-f492-4db1-950e-5d2bbecec0a2 | yanhai307/cpp_study | 02-class/dm01_类的封装和访问控制.cpp | //
// Created by YANHAI on 2019/5/4.
//
/**
* 类的基本概念
* 1. 类、对象、成员变量、成员函数
* 2. 面向对象三大概念
* 封装、继承、多态
* 3. 编程实践
* 类的定义和对象的定义。对象的使用
* 求圆的面积
* 定义Teacher类,打印Teacher的信息(把类的声明和类的实现分开)
*/
/*
* 类的封装
* 1. 封装是面向对象程序设计最基本的特性,把数据(属性)和函数(操作)合成一个整体,
* 这在计算机世界里是类与对象实现的。
* 封装,也就是把客观事物封装成抽象的类,并且类可以把自... | TOOL | 0.898832 | 5.812319 |
3b22f9f2-f9d5-48c6-a5c4-8e3fb5f27e00 | radhika1999/Data-structures | heap_sort.cpp | #include "heap_create.cpp"
void circulatedown(int H[], int i){
if(H[i]>H[2*i+1]){
swap(H[i], H[2*i+1]);
circulatedown(H, 2*i+1);
}
else if(H[i]>H[2*i+2]){
swap(H[i], H[2*i+2]);
circulatedown(H, 2*i+2);
}
else
return;
}
void heapsort(int H[], int n){
if(n!=... | ALGO | 0.999911 | 4.277874 |
c5736c47-09e3-476e-b828-c92e57be018e | redcpp/Competitive-Programming | codejam/2016/1A/C/C.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <unordered_map>
#define F first
#define S second
#define PB push_back
typedef long long ll;
using namespace std;
vector<int> color;
unordered_map<int, int> graph;
int circleSize() {
for (auto &kv: graph) {
}
}
int main() {
ios_base::sync_... | ALGO | 0.99804 | 5.248951 |
c33acc20-d45f-45fc-b0f4-4707321ca408 | mdevana/Sensor_Fusion_unscented_kalman_filter | src/tools.cpp | #include "tools.h"
#include <iostream>
#include <math.h>
using Eigen::VectorXd;
using std::vector;
Tools::Tools() {}
Tools::~Tools() {}
VectorXd Tools::CalculateRMSE(const vector<VectorXd> &estimations,
const vector<VectorXd> &ground_truth) {
/**
* Calculate the RMSE.
*/
Vec... | ALGO | 0.986441 | 5.97695 |
23ccfbb2-8e91-45ce-b08a-720ea0167fc5 | Suraj-Encoding/Third-Year | CGG/Program/smile.cpp | #include<graphics.h>
main()
{
int gd = DETECT, gm, area, temp1, temp2, left = 25, top = 75;
void *p;
initgraph(&gd, &gm, NULL);
setcolor(YELLOW);
circle(50, 100, 25);
setfillstyle(SOLID_FILL, YELLOW);
floodfill(50, 100, YELLOW);
setcolor(BLACK);
setfillstyle(SOLID_FILL, BLACK);
fillelli... | ALGO | 0.881884 | 3.319832 |
784b9983-d909-496c-b12f-1eff22f4f9a2 | ankit-0369/Solving-DSA-Problems | Postorder Traversal - GFG/postorder-traversal.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
... | ALGO | 0.999755 | 7.066492 |
7037f0af-2086-4f1a-8cf6-602d1acee040 | hobbang2/Algorithm | legacy/알고리즘풀이/단계별풀기/BFS와DFS/2606_바이러스.cpp | #include <cstdio>
#include <queue>
using namespace std;
int map[101][101] = { 0, };
bool visited[101] = { false, };
int N = 0, connection = 0;
int infection(int num) {
int cnt = 0;
queue <int> q;
q.push(num);
visited[num] = true;
int curNum = 0;
while (q.empty() == false) {
curNum = q.front(); q.pop();
fo... | ALGO | 0.997488 | 3.8169 |
d45e0247-481f-4831-acca-31e56870d3b0 | ishandutta2007/codeforces | golikovnik/normal/1389/C.cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using ui64 = uint64_t;
#ifdef GOLIKOV
mt19937_64 rng(566);
#else
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#endif
template <typename T>
T rnd_helper(T from, T to, true_type) {
return uniform_int_distribution<T>(from, ... | ALGO | 0.999792 | 6.012384 |
694551fa-fe83-4d4d-928a-676fac6a5f62 | zahidaliayub/DIEM | src/bitcoinrpc.cpp | #include "init.h"
#include "util.h"
#include "sync.h"
#include "ui_interface.h"
#include "base58.h"
#include "bitcoinrpc.h"
#include "db.h"
#include <boost/asio.hpp>
#include <boost/asio/ip/v6_only.hpp>
#include <boost/bind.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/iostreams/con... | WEB | 0.959574 | 4.789808 |
99337bb0-6221-4731-950e-a95e5b504110 | Buzdygan/ai-arena | ai_arena/media/game_judges_sources/test_game_kk/kk_judge.cpp | #include <iostream>
#define N 3
#define M 3
#define K 3
#define DEBUG
using namespace std;
int endGame(void);
void makeMove(int, int);
void printBoard(void);
char board[N][M];
bool ruch;
string TAG = "Sedzia: ";
int main(){
string com;
bool end = false;
int X, Y;
for(int i = 0; i < N; ++i)
... | ALGO | 0.986954 | 3.980309 |
25c0a027-1293-40b0-9d71-7f2c188e2173 | cybernetik7/Tapcoin | src/key.cpp | #include <map>
#include <openssl/ecdsa.h>
#include <openssl/obj_mac.h>
#include "key.h"
// Generate a private key from just the secret parameter
int EC_KEY_regenerate_key(EC_KEY *eckey, BIGNUM *priv_key)
{
int ok = 0;
BN_CTX *ctx = NULL;
EC_POINT *pub_key = NULL;
if (!eckey) return 0;
const EC_... | TOOL | 0.963288 | 6.954512 |
a469c978-3ea0-4c1b-8e67-c5cd8b31bd6a | Meet-cyber816/LeetCode | Two_Pointers/max_water_container.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int Mode(int x){
if( x < 0)
return -x;
return x;
}
int maxArea(vector<int>& height) {
int max=0;int d;
for(size_t i=0;i< height.size(); i++){
for(size_t j=i+1;j<height.size(); j++){
... | ALGO | 0.99983 | 5.197804 |
416de9b6-d2c0-4a34-84a7-c68c8b9b7fb4 | devartstar/Algorithms | codeChef/b.cpp | /*
-------------------------------------
| |
| Author - Devjit Choudhury |
| Date - ___________________ |
| |
-------------------------------------
Link -
*/
#include <bits/stdc++.h>
using namespace std;
#define ar array
#define ll long long
#... | ALGO | 0.999893 | 4.469925 |
13bd4f1b-705a-40e0-bb8e-bc88a4fc9eed | LSQsjtu/lsqlsq | oj/1338.cpp | #include <cstdio>
using namespace std;
void quickSort(long long *s, int l, int r)
{
if (l>=r)return;
if (l < r)
{
int i = l, j = r, x = s[l];
while (i < j)
{
while (i < j && s[j] >= x) // 从右向左找第一个小于x的数
j--;
if (i < j)
s[i++] =... | ALGO | 0.99999 | 3.31602 |
bdabd47d-43f7-469e-b349-246d515c3079 | hmanshug/c-plus-plus-programs | C++ by balaguruswamy book solutions/4.7.cpp | #include <iostream>
using namespace std;
double power(double, int j=2);
int power(int, int k=3);
int main()
{
int m;
int n;
cin>>m;
cout<<power(m);
}
double power(double x, int y)
{
double result=1;
for(int i=1;i<=y;i++)
{
result=result*x;
}
return result;
}
int power(int x, int y)
{
int result=1;
for... | ALGO | 0.999767 | 3.494846 |
3e7c6527-5d54-47fb-be7c-85d4e969369e | tudelft3d/3D_Urban_Mesh_Annotator | CGAL/examples/Alpha_shapes_2/ex_periodic_alpha_shapes_2.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_2_Delaunay_triangulation_traits_2.h>
#include <CGAL/Periodic_2_Delaunay_triangulation_2.h>
#include <CGAL/Alpha_shape_2.h>
#include <CGAL/Alpha_shape_face_base_2.h>
#include <CGAL/Alpha_shape_vertex_base_2.h>
#include <fstream>
#... | ALGO | 0.996869 | 7.28076 |
55d78856-8688-47ab-9827-1eab8656cb6a | yaoxiaokui/linux_ever | cppprimer/ch11/settest1.cpp | /*************************************************************************
> File Name: settest1.cpp
> Author:
> Mail:
> Created Time: Sat 25 Mar 2017 10:45:44 PM CST
************************************************************************/
#include <iostream>
#include <set>
#include <string>
using namespace st... | ALGO | 0.943781 | 4.595495 |
02e084dd-767a-4377-8cfd-8516b3097c00 | arkaslittlemind/Striver-SDE-Sheet | Day 1/Set Matrix Zeroes.cpp | Question Link- https://leetcode.com/problems/set-matrix-zeroes/
class Solution {
public:
void setZeroes(vector<vector<int>>& a) {
int n = a.size();
int m = a[0].size();
bool firstRow = false; // do we need to set first row zero
bool firstCol = false; // do we need to set first co... | ALGO | 0.997992 | 5.457988 |
bdb51af8-af0c-49d0-8fb7-532dab37ccfc | GrootTheDeveloper/OLP-ICPC | Algo_Notes/DynamicProgramming/code/ioi99p1.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int F, V; cin >> F >> V;
vector<vector<int>> a(F + 1, vector<int>(V + 1)), f(F + 1, vector<int>(V + 1, INT_MIN));
for (int i = 1; i <= F; i++) {
for (int j = 1; j <= V; j++) {
cin >> a[i][j];
}
}
for (int j = 1... | ALGO | 0.99999 | 3.082914 |
a5f16842-2ca2-43bc-946f-95b08b3d938b | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3470_179.cpp | #include <bits/stdc++.h>
const int a[5] = {2, 3, 1, 2, 1};
int main() {
int n;
scanf("%d", &n);
n--;
printf("%d\n", a[n]);
}
| ALGO | 0.999617 | 3.183641 |
edecd4bb-dd69-41ca-910e-bcd57680ac52 | SingularDuo/C-COMPETITIVE-TRAINING | BT-CO-SUONG/23022025/HSG12/DucPhat_12_5/DAYCON.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define KING_PHAT signed main()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
void init()
{
freopen("DAYCON.INP","r",stdin);
freopen("DAYCON.OUT","w",stdout);
fast;
}
KING_PHAT
{
... | ALGO | 0.999993 | 3.890325 |
6ecf7eab-01a5-41eb-817c-80726349714c | albertogg99/PARSEC | pkgs/kernels/streamcluster/src/parsec_barrier.cpp | // Some comments on this barrier implementation and directions for possible improvements:
//
// * This is a straightforward two-phase centralized barrier implementation
// * It's main advantage is that it only requries the pthreads library (no atomic instructions),
// making it very portable and easy to maintai... | TOOL | 0.884342 | 6.56868 |
c16df94d-22eb-4afe-8242-3bf0dd2cccfb | nitesh-20-2003/Data_StructuresAnd_AlgoInCpp | Sorting/bubblesort/bubble_sort1.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int arr[5]={5,4,3,2,1};
for(int i=0;i<4;i++){
for(int j=0;j<4-i;j++){
if(arr[j]>arr[j+1])
swap(arr[j],arr[j+1]);
}
}
for(int i=0;i<5;i++){
cout<<arr[i]<<" ";
}
} | ALGO | 0.99994 | 3.377337 |
c614926c-78c3-4bc0-be11-5047ad12b882 | oceane-razafy/cpp_modules | cpp02/ex03/bsp.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bsp.cpp :+: :+: :+: ... | ALGO | 0.998881 | 5.291511 |
8c19669c-4644-4066-8198-9f90fdd4537b | mkohlhaas/Professional-CPP-Edition-6 | No-Modules/Examples/Ch27/07_future/03_async.cpp | #include <future>
#include <print>
using namespace std;
int calculateSum(int a, int b)
{
return a + b;
}
int main()
{
auto myFuture{async(calculateSum, 39, 3)};
// auto myFuture{ async(launch::async, calculateSum, 39, 3) };
// auto myFuture{ async(launch::deferred, calculateSum, 39, 3) };
// Do ... | TOOL | 0.916651 | 5.930844 |
0ea10f04-3b28-4c9a-bcc6-3e7ecffe9b84 | ishandutta2007/codeforces | fastmath/normal/962/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 2e5 + 7;
int a[MAXN];
map <int, set <int>> d;
set <int> ms;
void del(int pos, int val) {
d[val].erase(pos);
if (d[val].size() == 1) ms.erase(val);
}
void add(int pos, int val) {
d[val].insert(pos);
if (d[val].size(... | ALGO | 0.999976 | 3.948376 |
5384089e-312a-4603-bbff-68013b94ab6f | evanmak/savior-source | svf/SVF/lib/MSSA/SVFG.cpp | /*
* SVFG.cpp
*
* Created on: Oct 28, 2013
* Author: Yulei Sui
*/
#include "MSSA/SVFG.h"
#include "MSSA/SVFGOPT.h"
#include "MSSA/SVFGStat.h"
#include "Util/GraphUtil.h"
#include "Util/AnalysisUtil.h"
using namespace llvm;
using namespace analysisUtil;
static cl::opt<bool> DumpVFG("dump-svfg", cl::init(fa... | ALGO | 0.905533 | 4.03304 |
82b25043-3730-4b6e-8a54-fa1dbb4d44f3 | aaryan-iiitu/CSES_problemset | sorting/apartments.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
// your code goes here
ll n,m,k;
cin>>n>>m>>k;
vector<ll>a(n);
for(ll i=0;i<n;i++){
cin>>a[i];
}
vector<ll>b(m);
for(ll i=0;i<m;i++){
cin>>b[i];
}
sort(a.begin(),a.end());
sort(b.begin(),b.end());
ll cnt =0;
ll i=0,j... | ALGO | 0.999961 | 3.600397 |
c9e9776d-20e8-4af6-a2dd-9fcd1d31a59e | anonymouswin/Blockchain | 4.Mix/MVTO-Fork-Join/Graph/Lockfree/Graph.cpp | /********************************************************************
| ***** File: Graph.h ***** |
| ***** Created: on Aug 03, 2018, 02:40 AM ***** |
********************************************************************/
#include "Graph.h"
/******************... | ALGO | 0.959215 | 4.741614 |
a7e7a63f-611f-45e1-9480-e2588d8b6e02 | Jayfish134/test-repo | Lab1/Q3_Looping_with_for_loop.cpp | #include <iostream>
using namespace std;
#define MAX_LIMIT 52//Macro that replaced the original 50 to the value of e.g. 52
int main()
{
//Loop to print even numbers from 1 to MAX_LIMIT
for (unsigned int i = 2; i <= MAX_LIMIT; i += 2) //Using unsigned int instead of int
{
cout << i << " ";
}
... | ALGO | 0.979778 | 3.89472 |
c74b9958-bff4-4a3b-803b-567c0c82bf73 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_test_133_4.cpp | #include <bits/stdc++.h>
using namespace std;
void dbg_out() { cerr << "\b\b )" << '\n'; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
cerr << H << ", ";
dbg_out(T...);
}
template <class T>
using vc = vector<T>;
template <typename T1, typename T2>
pair<T1, T2>& operator+=(pair<T1, T... | ALGO | 0.99983 | 3.563004 |
310ebeae-f4d3-4814-8495-417d8c28e7ee | shahidul-brur/OnlineJudge-Solution | Codeforces/1104_B - Game with string (2).cpp | /*==============================================*\
ID: shahidul_brur
Name: Md. Shahidul Islam
Study: CSE, BRUR
Address: Rangpur, Bangladesh
mail: <EMAIL>
FB : fb.com/shahidul.brur
Blog: shahidul-brur.blogspot.com(in Bengali),
shahidul-brur-en.blogspot.com(in English)
\*==================... | ALGO | 0.999994 | 3.350604 |
90aed00e-d171-4c3b-a975-de55eb6ccfc7 | Linvoker/leetcode | 21.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
//可以用递归做一便
class Solution {
public:
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
if (l1 == nullptr) {
return l2;
}
... | ALGO | 0.999958 | 5.464692 |
1e9290d0-8860-43c7-b5e6-891b87c6b3ab | tiankonguse/ACM | contest/poj/shen10000/1423/10253764_AC_0MS_192K.cpp | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
const double e=2.7182818284590452354;
const double pi=3.141592653589793239;
int count_number_bit(int n){
double sum=0;
if(n<100000){
for(int i=1;i<=n;i++)
sum+=log10(i*1.0);
}else{
sum=log10(sqrt(2*pi*n))+n*log10(n/e);
}
int ans=(int)sum;
if(ans<=sum... | ALGO | 0.999314 | 3.255183 |
fe485680-1679-49f1-a072-c76892663e57 | AbidAlAzad2001/myCode | AtcoderProblems/dp_a.cpp | //#include<bits/stdc++.h>
//using namespace std;
//const int N = 1e5 + 5;
///*
//- state: stone(n) -> cost of reaching nth stone from 1st stone
//- recurrence: stone(n) = min(
// stone(n-1) + abs( h[n] - h[n-1])
// stone(n-2) + abs( h[n] - h[n-2])
// ... | ALGO | 0.999982 | 4.528628 |
11e70c1f-4554-4791-a13b-740604d08cec | Hiyabye/Baekjoon | 17xxx/17129.cpp | #include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};
void solve(void) {
int n, m; cin >> n >> m;
vector<vector<char>> a(n, vector<char>(m));
for (int i=0; i<n; i++) for (int j=0; j<m; j++) cin >> a[i][j];
queue<pa... | ALGO | 0.999779 | 5.345118 |
5f802c27-223f-4d1a-bc7f-20c978446211 | pavel-ryzhov/global_vars | runs/000597.cpp |
#include <vector>
#include <fstream>
#include <iostream>
#include <string>
#include <memory>
#include <stdlib.h>
using std::vector;
using std::string;
using std::cin;
using std::auto_ptr;
//////////////////////////////////////////////////////////////////////////
const int KMaxLineNum = 100;
const int KMaxInt = 21474... | ALGO | 0.870764 | 3.17228 |
700e3806-6d4f-47d2-813e-604997f253cb | NguyenCongPhong81/ThuatToanUngDung | BaitapTuLuyen/sum23.cpp | #include <iostream>
#include <map>
using namespace std;
map <int, long long> f;
long long F(int n)
{
if (n <= 0)
return (n == 0) ? 1 : 0;
if (f[n] == 0)
f[n] = F(n - 2) + F(n - 3);
return f[n];
}
int main()
{
int n;
cin >> n;
cout << F(n);
return 0;
} | ALGO | 0.999991 | 4.341577 |
d2b450a2-db52-47c0-b38b-c6f75f83ac39 | iranarang/coe322-iranarang | hw8/dynrect.cpp | // Names: Christine Goh, Ira Narang, Rhea Samuel
// UTEIDs: cxg96, in2933, rss3488
// TACC Usernames: christinegoh, iranarang, rheasamuel12
#include <memory>
#include <iostream>
#include <cmath>
using std::make_shared;
using std::shared_ptr;
class Point
{
private:
float x, y;
public:
Point(float xCoord, flo... | TOOL | 0.948585 | 5.911654 |
33a1ff83-d562-48e3-ac0f-ba49f8f006e6 | jrojer/sport | trash/problems/dynamic/binomial/c.cpp | #include <iostream>
#include <cstdint>
struct Binomial
{
uint64_t Compute(int n, int k)
{
if(cached[n][k])
return cache[n][k];
if(k == 0)
return 1;
if(n == 0)
return 0;
uint64_t value = Compute(n-1,k-1) + Compute(n-1,k);... | ALGO | 0.999937 | 5.231149 |
d158822e-cdaa-440a-887b-e37d01c71cc2 | Jotiram75/DSA | pattern2.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter the No.:";
cin>>n;
for(int i=0; i<n; i++){
char ch='A';
for(int j=0; j<n; j++){
cout<<ch<<" ";
ch=ch+1;
}
cout<<endl;
}
return 0;
} | ALGO | 0.999312 | 3.672727 |
15a56467-8d61-496a-9bba-56ee9dccd0b8 | ByeonWoojin/Baekjoon | 2903.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int dot = 2;
while (n--)
{
dot = dot * 2 - 1;
}
cout << dot * dot;
return 0;
} | ALGO | 0.999787 | 3.438519 |
92102965-a16c-4e3d-886f-21a784379b0f | AvCoder999/STL | Containers/MultiMap/templates/MultiMap.cpp | #include "headers/MultiMap.hpp"
#include <Queue.hpp>
#include <stack>
#include <limits>
#include <iomanip>
#include <cassert>
template <typename Key1, typename Data1> std::ostream& operator<<(std::ostream& out, const std::pair<Key1, Data1> rhv)
{
out << rhv.first << ":" << rhv.second;
return out;
}
template <... | ALGO | 0.962265 | 4.58032 |
3f844f07-79dd-4cef-9176-8c784cf9d746 | ozzing/boj | codeplus/1748_수 이어 쓰기 1.cpp | #include <iostream>
#include <cmath>
using namespace std;
long long pre[10];
int main(){
int n;
cin >> n;
int digit=1, tmp=n;
for(int i=0;i<9;i++){
if(tmp/10>0){
digit++;
tmp/=10;
}
else break;
}
pre[0]=0; pre[1]=9;
for(int i=2;i<=9;i++){
... | ALGO | 0.999936 | 4.173228 |
55cf379d-2ab1-46ad-9c30-b8865c1fc498 | olegshnitko/libboost | libs/graph/example/dfs.cpp | #include <vector>
#include <algorithm>
#include <utility>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/depth_first_search.hpp>
#include <boost/graph/visitors.hpp>
/*
This calculates the discover finishing time.
Sample Output
Tree edge: 0 --> 2
Tree edge: 2 --> 1
Back edge: 1 --> 1
Tre... | ALGO | 0.999895 | 5.027763 |
ffb114bd-0e96-4fad-af84-e600d0ffaa0b | Soumithra-DNS/Problem_Solving | Codeforces/894A.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
string s; cin >> s;
int n = s.size();
int cnt[n] = {};
if(s[0] == 'Q'){
cnt[0]++;
}
for(int i = 1; i < n; i++){
if(s[i] == 'Q'){
cnt[i] = cnt[i - 1] + 1;
}else{
cnt... | ALGO | 0.9896 | 4.022964 |
662855fe-a8d0-4843-9614-c6056033dad7 | nabil0203/Phitron_DS | mod-11/11.1_Middle_of_the_Linked_List.cpp | // https://leetcode.com/problems/middle-of-the-linked-list/description/
class Solution {
public:
int size(ListNode *&head){
ListNode *temp = head;
int count = 0;
while(temp != NULL){
count++;
temp = temp->next;
}
return count;
}
ListNode* m... | ALGO | 0.999688 | 5.906553 |
37572a9f-bd2e-462f-baf8-c3ed88e4865e | tripathiaman0709/-leetcode | DCP-06-25/Maximum-Candies-You-Can-Get-from-Boxes.cpp | class Solution {
public:
int maxCandies(vector<int>& status, vector<int>& candies, vector<vector<int>>& keys, vector<vector<int>>& containedBoxes, vector<int>& initialBoxes) {
//easy question
//bfs ya dfs lagao
int n=status.size();
int ans=0;
//firstly using bfs
q... | ALGO | 0.999924 | 5.567624 |
85290007-5ac9-4897-afdb-a725105dd6ff | seunghye218/problem-solving | 프로그래머스/lv0/120903. 배열의 유사도/배열의 유사도.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<string> s1, vector<string> s2) {
int answer = 0;
for (vector<string>::iterator i = s1.begin(), end = s1.end();
i != end;
++i) {
if (s2.end() != find(s2.begin(), s2.end(), *i)) ++answer; ... | ALGO | 0.999233 | 4.713356 |
0c9023db-7f30-4a97-890d-5f4e7df5adac | MalcolmMielle/VoDiGrEx | include/voronoidiagram/ThinkerEVG.cpp | #include "ThinkerEVG.hpp"
void AASS::vodigrex::ThinkerEVG::think(const cv::Mat& map_in)
{
reset();
map_in.copyTo(_map_in);
// std::cout << "Channel " <<_map_in.channels() << std::endl;
cv::Mat chan1;
if(_map_in.channels() == 3){
cv::cvtColor(_map_in, chan1, cv::COLOR_RGB2GRAY);
}
else{
map_in.copyTo(ch... | ALGO | 0.919244 | 3.876924 |
1a413bf8-b575-4b90-8057-364715aa2ed3 | zpt1376241/algorithms | code/luogu/P1304.cpp | #include<cstdio>
#include<iostream>
using namespace std;
int f(int n)
{
if(n<2||(n!=2&&n%2==0))
return 0;
for(int i=3;i*i<=n;i+=2)
{
if(n%i==0)
return 0;
}
return 1;
}
int main()
{
int n;
cin>>n;
for(int i=1;i<=(n-2)/2;i++)
{
for(int j=2;j<=2*i+2;j... | ALGO | 0.99972 | 3.342149 |
db245128-4b2d-4944-9296-f51e775e5dfe | ibrahimahmad-id/Mamadcube-Marlin | Marlin-2.1.2/Marlin/src/gcode/lcd/M995.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
#include "../gcode.h"
#if HAS_TFT_LVGL_UI
#include "../../lcd/extui/mks_ui/draw_touch_calibration.h"
#else
#include "../../lcd/menu/menu.h"
#endif
/**
* M995: Touch screen calibration for TFT display
*/
void GcodeSuite::M995() {
#if ... | ALGO | 0.868241 | 6.624789 |
7cb67ce7-edf4-4c14-9ae4-d78be5bb491d | raincross7/code-similarity | codes/train_code/problem245/problem245_144.cpp | #include <stdio.h>
long long n, k, s, x, z, y, m, b, l;
long long p[5000];
long long c[5000];
int main() {
scanf("%lld%lld", &n, &k);
for (int i = 0; i < n; i++) {
scanf("%lld", p + i);
p[i]--;
}
for (int i = 0; i < n; i++) {
scanf("%lld", c + i);
}
m = -1000000000;
for (int i = 0; i < n; i++) {
s = i;
... | ALGO | 0.999976 | 3.033461 |
1e0ee950-1942-416d-a7a4-8ef66398ece1 | chongin12/Problem_Solving | acmicpc.net/7578.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long int;
const int MN=500000;
ll seg[MN*4+1];
ll id[MN*2+1];
ll Query(int L, int R, int n, int l, int r){
if(r<L || R<l) return 0;
if(L<=l && r<=R) return seg[n];
int mid=(l+r)/2;
return Query(L,R,n*2,l,mid)+Query(L,R,n*2+1,mid+1,r);
}
ll Update(int idx,... | ALGO | 0.999909 | 3.723837 |
1bd7b345-f892-4849-9def-4b284c43990c | anishamukh/MODHE | openfhe-development/src/binfhe/examples/pke/boolean-truth-tables-pke.cpp | /*
Example for the FHEW scheme; it prints out the truth tables for all supported binary gates
*/
#include "binfhecontext.h"
using namespace lbcrypto;
int main() {
// Sample Program: Step 1: Set CryptoContext
auto cc = BinFHEContext();
std::cerr << "Generate cryptocontext" << std::endl;
// STD128... | TOOL | 0.983025 | 4.035496 |
819692a1-1f72-4833-911e-4f5a69c8b5d8 | ApurbaApd/Leetcode | Perfect Sum Problem - GFG/perfect-sum-problem.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int mod = 1e9+7;
int perfectSum(int arr[], int n, int sum) {
// DP->Tabulation
// Declare the Dp
vector<vector<int>> dp(n, vector<int>(sum + 1, 0));
// Base ca... | ALGO | 0.999872 | 5.93466 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.