uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
77d7eb61-a283-4782-ae3c-979b46ac9b9e | ADARSH-IIIT/recursion_notes_question_vimp | easy_recursion/10_sum_of_vector.cpp |
// way 1
//////////////////// sum of ele of arr /// from -------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
/// agar koi mujhe 0 to lastindex-1 tak ka sum dede , then usme main arr[lastind] add krke ans retur... | ALGO | 0.999731 | 5.012043 |
74e3c130-445b-4fd9-9ee8-cfbe7ada3af0 | SAKSHAMSAXENA1/leetcode_problems | 1669-minimum-cost-to-cut-a-stick/minimum-cost-to-cut-a-stick.cpp | class Solution {
public:
/*
// Memoization
int f(int i,int j,vector<int> &cuts,vector<vector<int>> &dp)
{
if(i==j-1) // no cut to be made in this piece, therefore no cost incurred from this piece
return 0;
if(dp[i][j]!=-1) return dp[i][j];
int mini=INT_MAX;
for(int k=i+1;k<j;k++)
{
int c... | ALGO | 0.999905 | 5.715844 |
9672d40b-c1cc-4b23-9086-97d39abda240 | KrisCTer/PTIT-Online-Judge | CPP/CPP0321 - HIỆU HAI SỐ NGUYÊN LỚN.cpp | #include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<set>
#include<stack>
#include<queue>
#include <algorithm>
#include<sstream>
#define ll long long
using namespace std;
bool sosanh(string a,string b)
{
if(a.size()==b.size()) return a>b;
else return a.size()>b.size();
}
void sol... | ALGO | 0.999991 | 5.197978 |
879d0449-8821-4bdc-b466-e0acef881de5 | upple/BOJ | src/17000/17174.cpp17.cpp | #include <iostream>
using namespace std;
int main()
{
int n, m;
int ans=0;
cin>>n>>m;
while(n)
{
ans+=n;
n=n/m;
}
cout<<ans;
} | ALGO | 0.999813 | 3.846785 |
97168a60-40bb-4c6e-ab91-df382b150c26 | makio93/competitive-othersites | LeetCode/Contest/BC/66/Q3/main0-2.cpp | #include <bits/stdc++.h>
using namespace std;
// 本番TLE
using ll = long long;
class Solution {
public:
int minCost(vector<int>& startPos, vector<int>& homePos, vector<int>& rowCosts, vector<int>& colCosts) {
int m = rowCosts.size(), n = colCosts.size();
int dr = homePos[0] - startPos[0], dc = homeP... | ALGO | 0.999922 | 4.874198 |
9eb49c94-5b40-46c6-9ab2-dccb5c556d03 | YeonWon123/2019_Winter_Data_Structure | Week 7/준규/ALGraph/ALGraph.cpp |
#include <stdio.h>
#include <stdlib.h>
#include "DLinkedList.h"
#include "ALGraph.h"
#include <iostream>
#include <string>
using namespace std;
int WhoIsPreced(int data1, int data2);
void GraphInit(ALGraph* pg, int nv)
{
int i;
pg->adjList = (List*)malloc(sizeof(List)*nv);
pg->numV = nv;
pg->numE = 0;
for (... | ALGO | 0.997908 | 3.61603 |
338fcbe3-973d-4e66-a48e-71d8b2f7d6d6 | RufatAhmadli/ComputerGraphics_task1 | Library/PackageCache/com.unity.ide.visualstudio@2.0.22/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.94874 | 6.933585 |
3858c84e-2681-4a44-a025-21c9f42693f2 | erixalv/Atividades-ED | Algoritmos de Ordenação/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <chrono>
#include "ordenacoes.h"
int main() {
fstream sort_time_arq("../sort_time.txt", ios::out);
sort_time_arq << "Tempos de execução do Insertion Sort (em ms):" << endl;
sort_time_arq << arqSort("../instancias-num/num.1... | ALGO | 0.993452 | 4.494138 |
83188ba8-2932-4ba2-a474-ee035dc97395 | overhelmingcoder/CSE_182 | lab7prctc8.cpp |
// C++ Program to Insert an element
#include <iostream>
using namespace std;
int* insertX(int n, int arr[],
int x, int pos)
{
int i;
n++;
for (i = n; i >= pos; i--)
arr[i] = arr[i - 1];
arr[pos - 1] = x;
return arr;
}
int main()
{
int arr[100] = { 0 };
int i, x, pos, n = 10;
for (i = 0; i < 10; i+... | ALGO | 0.999921 | 4.640979 |
0d939c23-f2b3-430b-b06a-3b65417fc49d | tamofplease/atcoder_abc | abc096/d/main.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
#define ALL(v) v.begin(), v.end()
const ll MOD = 1000000007;
vector<ll> divisor(ll n) {
vector<ll> ret;
for (ll i = 1;... | ALGO | 0.999757 | 3.891957 |
9244fa8e-3ceb-4cb4-8681-c65fae976cbe | RicardoLou/If_You_Do | 娄子熇/CompilePrinciple/exp3_1/main.cpp | #include<bits/stdc++.h>
#include<unordered_set>
using namespace std;
// 使用 unordered_set 代替数组,提高查找效率
unordered_set<string> KEYWORD = {"if", "else", "void", "return", "do", "while", "for",
"int", "char", "double", "float", "case", "cin", "cout"};
unordered_set<char> SEPARATER = {';', ',', '{', '}', '[', ']', '(', ')', ... | ALGO | 0.984806 | 3.738694 |
677b55ac-5371-41f4-be20-7657e98c3da8 | Gyuri02917/Programozas-I. | 6.labor/6.3.cpp | #include <iostream>
using namespace std;
int main()
{
int kocka[8], TAR[6] = { 0 }, i; //a TAR[] -ban számoljuk, az egyes dobásokból mennyi
for (i = 0; i < 8; i++)//ellenőrzött dobás bekérés
{
do
{
cout << "Adja meg az " << i + 1 << ". dobas eredmenyet: ";
cin >>... | ALGO | 0.991511 | 4.015534 |
070da7fd-48e8-47e3-a262-57fee0b1672d | QuiverDance/Algorithm | week5/1911.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int n, l, ret;
vector<pair<int, int>> v;
int main(void){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> l;
int a, b;
for(int i = 0; i < n; i++){
cin >> a >> b;
v.push_back({a, b});
}
... | ALGO | 0.999976 | 3.533437 |
1918c9fe-e9d1-4ede-9ed7-87c4629d9234 | hustpython/algorithm_cpp | dijkstra/main.cpp | # include "Dijkstra.h"
bool check(int Vexnum,int edge)
{
if(Vexnum<=0 || edge <=0 || ((Vexnum*(Vexnum-1))/2)<edge)
{
return false;
}
return true;
}
int main()
{
/*
输入:
6 8
1 3 10
1 5 30
1 6 100
2 3 5
3 4 50
4 6 10
5 6 60
5 4 20
*/
int vexnum; ... | ALGO | 0.999873 | 4.03254 |
b4927405-c852-435a-a057-a936362e44a4 | andreemidio/opencv_ci | modules/stitching/perf/perf_matchers.cpp | #include "perf_precomp.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/opencv_modules.hpp"
#include "opencv2/flann.hpp"
namespace opencv_test
{
using namespace perf;
typedef TestBaseWithParam<size_t> FeaturesFinderVec;
typedef TestBaseWithParam<string> match;
typedef tuple<string, int> matchVector_t;
typedef ... | TEST | 0.879113 | 6.842914 |
096fb42f-1bef-4e6d-8799-bf0bc4f8efa9 | firebird00/Tomuhawc | tomuhawc_src/Equilibrium.cpp | // Equilibrium.cpp
#include "Tomuhawc.h"
// ###########################################
// Function to read in equilibrium metric data
//
// sw = 0: read in metric data
// sw = 1: clean up
//
// interactive .. set if in interactive mode
//
// ###########################################
void Thawc::Equilibrium (int ... | ALGO | 0.984831 | 3.894506 |
7d17e068-f8a8-42ca-ae03-2a6ff5c71f4f | toproof25/OK-problem-solving | 프로그래머스/0/181912. 배열 만들기 5/배열 만들기 5.cpp | #include <string>
#include <vector>
using namespace std;
string substr_string(string &str, int s, int l){
string number = "";
number.reserve(l);
for (int idx=s; idx < s+l; ++idx)
number += str[idx];
return number;
}
int string_to_int(string &str){
int number = 0;
for (int idx=0; ... | ALGO | 0.996724 | 4.065769 |
367e26c9-9d05-4813-81d1-d9b8165b90fd | Akhileshramks/LeetCode_Solution | 0424-longest-repeating-character-replacement/0424-longest-repeating-character-replacement.cpp | class Solution {
public:
int characterReplacement(string s, int k) {
int left = 0,right = 0,n = s.size();
unordered_map<char,int> freqCount;
int ans = 0,maxFreq = 0;
for(right = 0;right <n;right++){
freqCount[s[right]]++;
maxFreq = max(maxFreq,freqCount[s[righ... | ALGO | 0.999984 | 6.376796 |
b4faaef1-f1f9-4f40-aed5-7fde65d123ca | om-ashish-soni/Competitive-Programming | problemset/company_wise_problems/GOOGLE/search_in_2d_matrix_ii.cpp | // problem link : https://leetcode.com/problems/search-a-2d-matrix-ii/
// solution : below code
class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int rowlimit=lower_bound(matrix[0].begin(),matrix[0].end(),target)-matrix[0].begin();
if(rowlimit==matrix[0].size()) r... | ALGO | 0.999987 | 6.509703 |
77af0ef7-df86-45b9-947c-2ec45c62ee29 | SpatikaP/DSA-solutions | 0443-string-compression/0443-string-compression.cpp | class Solution {
public:
int compress(vector<char>& chars) {
int j=0, count=1;
if(chars.size()==1) return 1;
for(int i=1; i<=chars.size(); i++){
while(i<chars.size() && chars[i]==chars[i-1]){
count++;
i++;
}
chars[j++]=chars... | ALGO | 0.999994 | 6.317699 |
4267b13c-56d3-4916-8595-fa772f714df3 | Ethan7144/Daily_Coding | Binary Search/125-valid-palindrome/valid-palindrome.cpp | /*
* Problem: Valid Palindrome (Leetcode 125)
*
* Goal:
* Determine if a given string is a palindrome, considering only alphanumeric characters and ignoring case.
*
* Approach:
* - Use two pointers: one starting from the beginning, one from the end.
* - Skip any non-alphanumeric characters using isalnum().
* -... | ALGO | 0.999861 | 7.179666 |
d1fcff7b-469d-4a7b-be80-3b77187b0744 | pratippatel/LeetCode | 8-string-to-integer-atoi/8-string-to-integer-atoi.cpp | class Solution {
public:
int myAtoi(string s) {
int ans=0;
bool negative = false;
int i=0;
while(i<s.length() && s[i]==' '){
i++;
}
if(s[i]=='-'){
i++;
negative = true;
}
else if(s[i]=='+'){
i++;
... | ALGO | 0.998525 | 5.034372 |
90f9d959-d038-47e9-9d7e-70c99852a473 | benninghoven/smart-aquarium | src/flutter/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.997698 | 6.761023 |
ffb36981-3945-4246-aa11-28fb6ef0cdef | seonyoung169/Algorithm | BOJ/2961_BruteForce.cpp | #include <iostream>
#include <vector>
#include <stdlib.h>
#include <algorithm>
using namespace std;
// N개의 숫자 중 조합 구하기
vector<vector<int>> getCombinations(int N){
vector<vector<int>> combinations;
vector<int> candidates; // 0-1-2-3
for (int i = 0; i < N; ++i) {
candidates.push_back(i);
}
... | ALGO | 0.999942 | 4.355513 |
d8573eaa-1d27-4cc6-b597-ff1be6fbef48 | aryashsaxena/leetcode_problems | 92-reverse-linked-list-ii/reverse-linked-list-ii.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:
vector<ListNode*> rev... | ALGO | 0.999998 | 5.597505 |
5b1f2a28-42b6-45b7-93df-0a17b27127b7 | akhilred36/coScheduling | apps/lammps/src/OPENMP/dihedral_charmm_omp.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "dihedral_charmm_omp.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include... | ALGO | 0.998874 | 6.920063 |
2ea65147-c66b-4546-8c21-28a84fafb611 | ProSan03/Cpp_Seminar_Personal-Study | 교재 5_3.cpp | #include <iostream>
using namespace std;
class Circle {
int radius;
public:
Circle(int r) {
radius = r;
}
int getRadius() {
return radius;
}
void setRadius(int r) { // int 1 Ű radius Ű ʱȭ
radius = r;
}
void show() { // º
cout << " " << radius << " " << endl;
}
};
void increaseBy(Circle& a, ... | ALGO | 0.925911 | 4.803248 |
403ae7a2-eecc-4b06-8a59-8f38c0fb967a | NitaiBanik/My-algorithm | Dp/anniversary_party.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll>graph[6005];
ll dp[6005][5];
ll val[6005];
int vis[6005];
int par[6005];
void fun(int src)
{
if(vis[src] == 1)
return ;
vis[src] = 1;
dp[src][0] = 0;
dp[src][1] = val[src];
for(int i=0; i<graph[src].size(); i+... | ALGO | 0.999875 | 3.92184 |
417dcce3-2e9f-4974-b673-fb08fd629ba2 | Booooooooooo/wyb---ACM | 图论/F.cpp | #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstring>
const int INF=1000000009;
using namespace std;
int n,m;
int dis[605][605],cow[605];
void floyd()
{
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
for(int k=1;k<=n;k++)
dis[j][k]=min(dis[j][k],dis[j][i]+dis[i][k]);
}
}
}
int m... | ALGO | 0.999918 | 3.654155 |
6a441c2c-66bd-49ef-80aa-49b950b99285 | ChessCoder1729/Competitive-Programming | CSES/Tree Algorithms/2. TreeMatching.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define endl '\n';
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(... | ALGO | 0.99917 | 4.357359 |
da150fd8-dbd4-4abe-9e51-407fb16f04ae | bed-com-27-23/Lab-3.0---3.1 | OperatorPrecedence.cpp | #include <iostream>
using namespace std;
int main(){
int a=20;
int b = 10;
int c = 15;
int d = 5;
int e;
e = (a+b) * c/d; //(30*15)/5
cout<<"Value of (a+b)*c/d is: " << e <<endl;
e = ((a+b)*c)/d; //(30*15)/5
cout<<"Value of ((a+b)*c)/d is: "<< e<<endl;
e = (a+b)*(c/d);
co... | ALGO | 0.993152 | 3.286031 |
e8723893-9c35-4cc7-8504-27df70136bfb | Srishtik16/Leetcode-Submissions | 0974-subarray-sums-divisible-by-k/0974-subarray-sums-divisible-by-k.cpp | class Solution {
public:
int subarraysDivByK(vector<int>& nums, int k) {
map<int, int> m;
int pref = 0, n = (int)nums.size(), ans = 0;
for(int i = 0; i < n; i++) {
pref += nums[i];
if(((pref % k) + k) % k == 0) {
ans++;
}
if(m.f... | ALGO | 0.999956 | 5.886745 |
9ef01ef7-c634-44b2-b806-8b8e0ffbe16f | juniormaxxx/learning | prijestupne godine.cpp | #include<iostream>
using namespace std;
void leapYears(int a, int b)
{
int startPoint;
int endPoint;
if (a < b)
{
startPoint = a;
endPoint = b;
}
else if (a > b)
{
startPoint = b;
endPoint = a;
}
else
{
cout << "years are equal" << endl;
return;
}
while ((startPoint % 4) != 0)
{
startPoint... | ALGO | 0.994309 | 3.179261 |
a015be0a-bcb7-453b-b5b8-a344aa02ee68 | voe09/CPPPlayGround | Round1/Stack/BinarySearchTreeIterator.cpp | /*
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
Note: next() and hasNext() should run in average O(1) time and uses O(h) memory, where h is the height of the tree.
*/
/**
* Defini... | ALGO | 0.999993 | 6.465747 |
4eaad300-c78d-4122-b599-3cc100458cab | GIBIS-UNIFESP/wiRedPanda | app/logicelement/logicor.cpp | #include "logicor.h"
#include <functional>
LogicOr::LogicOr(const int inputSize)
: LogicElement(inputSize, 1)
{
}
void LogicOr::updateLogic()
{
if (!updateInputs()) {
return;
}
const auto result = std::accumulate(m_inputValues.cbegin(), m_inputValues.cend(), false, std::bit_or<>());
setO... | TOOL | 0.967454 | 5.779131 |
48be4c52-6ac9-4d0a-b8ef-bea33d4808be | George-Anyas/notes_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998809 | 6.763549 |
b796996f-43a2-4f49-ad9e-58c1b88c3b62 | louie140/openCV | modules/gapi/src/compiler/passes/perform_substitution.cpp | #include "pattern_matching.hpp"
#include "ade/util/zip_range.hpp"
namespace cv { namespace gimpl {
namespace {
using Graph = GModel::Graph;
template<typename Iterator>
ade::NodeHandle getNh(Iterator it) { return *it; }
template<>
ade::NodeHandle getNh(SubgraphMatch::M::const_iterator it) { return it->second; }
tem... | TOOL | 0.921848 | 7.36473 |
251709b6-1a85-4688-8eec-6df70a627c7e | ishandutta2007/codeforces | vkgainz/normal/1333/D.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
void print(vector<int> &x){
printf("%d ",x.size());
for(int i : x) printf("%d ",i);
printf("\n");
}
int main(){
int n,k;
cin >> n >> k;
string s; cin >> s;
vector<int> buckets[5000];
int num = 0;
int tot = 0;
bool ... | ALGO | 0.999878 | 3.392262 |
829e544d-b3f9-4cda-ad80-7f5292ea730d | Sowmik23/CompetitiveProgramming | CP-Algorithms/Data Structures/Trees/2_spoj_DQUERY - D-query.cpp | #include <bits/stdc++.h>
using namespace std;
/// Find the number of distinct element in a sub-array
/// BIT or Fenwick Tree
typedef long long ll;
const int MAXN = 4e6+9;
int n, arr[MAXN], BITree[MAXN];
ll last_visit[MAXN];
struct Query {
int l, r, idx;
};
bool cmp(Query x, Query y){
return x.r < y.r;
}
int getS... | ALGO | 0.999877 | 4.730309 |
0d3c2552-b653-4793-a1b3-62036e9186c8 | aura-uyt/cpp_chapters | College/sem1&2/Class/07.2.Remainder.cpp | #include <iostream>
using namespace std;
int main(){
int a,b,p;
cout<<"Enter the number you want to find divide : ";
cin>>a;
cout<<"Enter Dividend: ";
cin>>b;
p= a%b ;
cout<<"The Remainder is: "<<p<<"\n";
return 0;
} | ALGO | 0.908732 | 3.286189 |
e2933c55-3276-4d83-941b-4ef8ea602452 | raincross7/code-similarity | codes/train_code/problem001/problem001_63.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005
ll r , d , x;
int main()
{
_FastIO;
cin >> r >> d >> x;
for(ll i = 0; i < 10; i++){
x *= r;
x -= d;
... | ALGO | 0.999348 | 3.218395 |
51ff6cc5-73d0-4785-829f-f377bc211863 | desik98/COMPETITIVE-PROGRAMMING | Practice/Data Structures/Segment Tree/1089 - Points in Segments (II).cpp | /*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li int32_t
#define lli long long
#define ulli unsigned long long
#define pn printf("\n")
#define nl cout<<'\n'
#define sf(N) scanf("%lld",&N)
... | ALGO | 0.999424 | 3.601406 |
1e156f28-d7dd-4f80-84e6-ee7307bfc35e | IraShinking/CPP-Programming-Homework | Lab3_3.cpp | //4_9.cpp
//ԭC++ṩfloorȡ recordеıСλҲԲοʹ
//ھʵзһ ·ʱעԭļкͬ˽кrecord
//˹ʽͳһ
#include<iostream>
#include<cmath>
using namespace std;
class SavingsAccount
{
private:
int id;
double balance;
double rate;
int lastDate;
double accumulation;
void record(int date,double amount);
double accumulate(int ... | TOOL | 0.887921 | 4.148956 |
64866ba5-6bbd-464a-a767-560ab056c595 | Roykesydon/uva_pratice | 優化類型/快速冪/ZJ-a451-10229 - Modular Fibonacci -/新文件1.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll tmp;
vector<vector<ll>> operator*(vector<vector<ll>> a, vector<vector<ll>> b)
{
vector<vector<ll>> vec(a.size(), vector<ll>(b[0].size(), 0));
for (int i = 0; i < a.size(); i++)
{
for (int j = 0; j < b[0].size(); j++)
{
... | ALGO | 0.999991 | 3.708673 |
9f6d6038-e5b1-43e8-aa0e-ba7a212e6eb6 | Koi-TF2/team-comtress-2-backup-june-5th-2022 | src/game/client/splinepatch.cpp | #include "mathlib/vmatrix.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Catmull rom blend weights
//-----------------------------------------------------------------------------
static VMat... | ALGO | 0.913549 | 4.753193 |
487ce79c-eb83-4bee-9216-7866e4984e2d | mati2002103/College_Basic_Programming | College_Basic_Programming_C++/Homeworks/6.CommandLineArguments/nominals.cpp | #include <iostream>
#include <vector>
#include <cstdlib>
int main(int argc, char *argv[]){
int nominal = std::atoi(argv[1]);
std::vector<int> bills = {200,100,50,20,10,5,2,1};
std::vector<int> billsOut;
for(int j = 0; j < bills.size() && nominal > 0;) {
if(nominal>=bills[j]... | ALGO | 0.98048 | 3.994815 |
3ee21ba3-573c-4255-844a-40d63bd35ec6 | amreenabbas/Leet-Code-Solutions | 226.Invert Binary Tree.cpp | Question Link : https://leetcode.com/problems/invert-binary-tree/
//created by js0805
//simply using the concept of mirror
//replacing left node with right and right with left using a temp node
//and doing a post order traversal for the above operation.
class Solution {
public:
TreeNode* invertTree(TreeNode* root) {... | ALGO | 0.999998 | 6.59487 |
1d931622-e521-471b-8124-370c701d9efd | nhoa-project/nhoa_bt | nhoa_bt/src/plan_navigation.cpp | #include <plan_navigation.h>
// ROS headers
#include <ros/ros.h>
// UPO includes.
#include "nhoa_approach_action/ApproachAction.h"
// =====================================
plan_navigation::plan_navigation(ros::NodeHandle *nodehandle): nh_(*nodehandle),
... | TOOL | 0.893541 | 5.129481 |
6ddc6265-a2c5-4979-8b84-5a7a06f912aa | vlluvia/algorithm | pat/甲级/1047.cpp | #include<bits/stdc++.h>
#define INF 1<<29
using namespace std;
int n, k;
vector<string> result[2505];
bool cmp(string a, string b) {
return a < b;
}
void pat1047() {
cin >> n >> k;
for (int i = 1; i <= n; ++i) {
string name;
int a = 0;
cin >> name >> a;
for (int j = 0; j... | ALGO | 0.999567 | 3.386824 |
22d90d2d-6b3a-4231-87fc-775d86b66ba6 | maxioul/DaliyMindRefresh | 1759.cpp | //https://leetcode.com/problems/count-number-of-homogenous-substrings/?envType=daily-question&envId=2023-11-09
//At first place, I want to count the length of substrings and use equation to get the ans, however I got a wrong ans at the case of 10000 length of same charater.
//Wy wrong code:
class Solution {
public:
... | ALGO | 0.999996 | 6.502133 |
48688360-dd63-45f3-af43-950de93fa7a7 | aritra741/Competitive-Programming | SPOJ/NUMDIV (Pollard Rho).cpp | #include <bits/stdc++.h>
#define mx 1000007
#define ll long long
using namespace std;
bool arr[mx];
int prime[mx];
int cnt= 0;
vector<ll> Q;
ll Mx;
ll sq( ll n )
{
ll s= sqrt(n);
if( (s-1)*(s-1)==n )
return s-1;
if( (s+1)*(s+1)==n )
return s+1;
return s;
}
void sieve()
{
prime[cn... | ALGO | 0.999895 | 4.057806 |
4e4fd1ae-82ca-43ac-99e7-743acf61b880 | BitManipulators/275_mini2 | sync_server.cpp | #include "collision_manager/collision_manager.hpp"
#include "collision_proto_converter.hpp"
#include "query_proto_converter.hpp"
#include "myconfig.hpp"
#include <omp.h>
#include <grpcpp/grpcpp.h>
#include <future>
#include <filesystem>
#include <iostream>
#include <atomic>
#include <map>
#include <vector>
const std::... | WEB | 0.969148 | 5.212797 |
1a2bc07a-109f-44cf-bfe7-81f85e24f5af | Kamalkumar786/leetcode-problem-solution | 11-container-with-most-water/container-with-most-water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int n=height.size();
int j=n-1;
int i=0;
int maxi=INT_MIN;
while(i<j){
maxi=max(maxi,((j-i)*min(height[i],height[j])));
if(height[i]<height[j]) i++;
else
j--;
... | ALGO | 0.999965 | 6.570808 |
a5228e47-2ec5-48ae-a0f6-4d6596ac0eaf | qs22/ExtendedKalmanFilter | src/kalman_filter.cpp | #include "kalman_filter.h"
#include <cmath>
#include <iostream>
using Eigen::MatrixXd;
using Eigen::VectorXd;
// Please note that the Eigen library does not initialize
// VectorXd or MatrixXd objects with zeros upon creation.
KalmanFilter::KalmanFilter() {}
KalmanFilter::~KalmanFilter() {}
void KalmanFilter::Init(... | ALGO | 0.994368 | 6.169122 |
b1e17b07-6bed-488f-b1cc-080cd6cb7f64 | TuilaTammmmm/Code | CodePTIT/CPP0210.cpp |
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
void TestCase()
{
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; ++i)
cin >> a[i];
int r = -1;
for (int i = 0; i + 1 < n; ++i)
{
for (int j = i + 1; j < n; ++j)
{
continue;
... | ALGO | 0.999786 | 4.642698 |
57840e8d-0308-4f62-87c3-991da6a394e6 | nunesg/Ahozinho | Material/orderset.cpp | #include <bits/stdc++.h>
#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i= int(ini); i<int(lim); ++i)
#define ford(i, ini, lim) for(int i= int(ini); i>=int(lim); --i)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
#include <ext/pb_ds/... | ALGO | 0.99993 | 3.378859 |
38e266b1-612f-4287-8cde-fb4f97a59923 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/final-array-state-after-k-multiplication-operations-ii-Solution2.getFinalState/177766_DoS.cpp | static bool ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree)
{
int i;
switch (tree->operation) {
case LDB_OP_AND:
case LDB_OP_OR:
asn1_push_tag(data, ASN1_CONTEXT(tree->operation==LDB_OP_AND?0:1));
for (i=0; i<tree->u.list.num_elements; i++) ... | ALGO | 0.997867 | 4.634062 |
32901e43-587c-4713-b735-ce9ca220e47a | pingchungchang/CP | CF1169C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
vector<ll> v;
ll n,m;
bool f(ll val){
ll pre = 0;
for(auto i:v){
if(i+val<pre)return false;
if(i+val<... | ALGO | 0.999986 | 3.889208 |
74c87f71-1306-461b-ae98-920314aef40e | MadaraUchiha-314/competitive-coding | spoj/problems/problems/ALTSEQ/solution/solution.cpp | #include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
bool is_increasing(int a, int b) {
return abs(a) > abs(b);
}
bool is_alternate(long long a, long long b) {
return a * b < 0;
}
int main() {
int N;
int A[5000], dp[5000];
scanf("%d", &N);
for (int i = 0; i < N; i++... | ALGO | 0.999918 | 4.41911 |
cc07b54c-5625-45cc-8f37-1f9d943a3f53 | Lchuxian/SLAM-Environment | OpenCV3_and_OpenCV4_coexist/opencv-3.4.6-build/modules/video/src/camshift.cpp | #include "precomp.hpp"
int cv::meanShift( InputArray _probImage, Rect& window, TermCriteria criteria )
{
CV_INSTRUMENT_REGION();
Size size;
int cn;
Mat mat;
UMat umat;
bool isUMat = _probImage.isUMat();
if (isUMat)
umat = _probImage.getUMat(), cn = umat.channels(), size = umat.siz... | ALGO | 0.999511 | 6.413995 |
26093c94-6429-468e-836b-99f3c927262e | alexandraback/datacollection | solutions_5686275109552128_0/C++/dans/B.cpp | #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <list>
#include <iomanip>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstring>
#inclu... | ALGO | 0.999819 | 3.90166 |
2bb2bcb2-e338-4f75-9397-88ffdcd0f3d7 | himanshusisodiya6377/DSA-QUESTIONS | 0238-product-of-array-except-self/0238-product-of-array-except-self.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int n=nums.size();
vector<int>pre(n,1);
vector<int>suff(n,1);
for(int i=1;i<n;i++) pre[i]*=(pre[i-1]*nums[i-1]);
for(int i=n-2;i>=0;i--) suff[i]*=(suff[i+1]*nums[i+1]);
for(int i=0;i<n;i++) nu... | ALGO | 0.999961 | 6.216738 |
1a3b0038-a2f3-435b-b849-36e5d3fa06b1 | anialsonus/gpdb | src/backend/gporca/libgpopt/src/search/CBinding.cpp | #include "gpopt/search/CBinding.h"
#include "gpos/base.h"
#include "gpopt/operators/CPattern.h"
#include "gpopt/search/CGroupProxy.h"
#include "gpopt/search/CMemo.h"
using namespace gpopt;
//---------------------------------------------------------------------------
// @function:
// CBinding::PgexprNext
//
// @doc... | TOOL | 0.868141 | 6.279528 |
e5bb3886-1ecc-482c-afff-f34517ce700b | Hifzu04/codeforces | Contests/DIV3/Round 1034 (div.3)/C.cpp | #include <bits/stdc++.h>
using ll = long long;
#define f(i,n) for (ll i = 0; (i) < (n); (i)++)
using namespace std;
#define yes cout << "YES\n"
#define no cout << "NO\n"
void solve() {
ll n ; cin>>n ;
vector<ll>vec(n);
ll smallest = LLONG_MAX;
ll largest = LLONG_MIN;
f(i,n){
cin>>vec[i];
... | ALGO | 0.999985 | 3.930351 |
ccf5247a-d36a-490c-a1a3-295fd0b36979 | AbhisekhNayek/DSA-A-TO-Z-Code-Studio | Triangle.cpp | void triangle(int n)
{
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
cout<<i<<" ";
}
cout<<endl;
}
}
| ALGO | 0.999819 | 4.14687 |
4aadc006-7a1f-485e-97d4-2f5c883bb070 | Apress/practical-cpp-financial-programming | FinancialCppSamples/FinancialSamples/MIPSolver.cpp | //
// MIPSolver.cpp
//
// (c) 2015 Carlos Oliveira
// This code is part of the book "Practical C++ Financial Programming"
// by Carlos Oliveira, Apress, 2015.
// For more information, visit http://coliveira.net
#include "MIPSolver.h"
#include "Matrix.h"
#include <glpk.h>
#include <iostream>
using std::vector;
u... | ALGO | 0.998409 | 5.920203 |
7099eda2-8b40-460c-b410-a02a4637f208 | sinian666/code_41_12 | cpp_副本10/chapter_stack_and_queue/deque.cpp | /**
* File: deque.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
/* 初始化双向队列 */
deque<int> deque;
/* 元素入队 */
deque.push_back(2);
deque.push_back(5);
deque.push_back(4);
deque.push_front(3);
deque.push_fron... | TEST | 0.877452 | 5.774346 |
e9f809af-04be-4f71-b1c8-c0046524c575 | DamDC91/Maze_Ball | src/cube_face.cpp | #include <GL/glu.h>
#include "sphere.h"
#include "cube_face.h"
CubeFace::CubeFace(Vector v1, Vector v2, Point org, double l, double w, Color cl)
{
vdir1 = 1.0 / v1.norm() * v1;
vdir2 = 1.0 / v2.norm() * v2;
anim.setPos(org);
length = l;
width = w;
col = cl;
}
void CubeFace::update(double delt... | ALGO | 0.983398 | 5.151569 |
e2f68dc7-c0db-4836-8e9b-a53072cde1ac | sahityatiwari/Codeforces-Submissions | B_Olya_and_Game_with_Arrays.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int maxBeautyOfArrays(int n, vector<vector<int>> &mat)
{
for (int i = 0; i < n; i++)
sort(mat[i].begin(), mat[i].end());
int sf = 0, ss = 0, minif = INT_MAX, minis = INT_MAX;
for (int i = 0; i < n; i++)
{
sf += mat[i... | ALGO | 0.999955 | 4.727872 |
ce31b93d-fd19-42d4-8672-9eb573e7e31c | GMani9/CS254__220001009 | Assign 7/Que 1/akg1dp.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, Limit;
cin >> n >> Limit;
vector<int> weights(n), values(n);
for (int i = 0; i < n; i++) {
cin >> values[i] >> weights[i];
}
vector<vector<int>> dp(n + 1, vector<int>(Limit + 1, 0));
for (int i = 1; i <= n; i++) {
... | ALGO | 0.999998 | 5.294198 |
aac5266b-7978-45c9-9be9-dc6a61b15329 | shidlingayya/LeetCodeSolutions | Arr_targetMinAndMaxIndex.cpp | #include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
std::vector<int> searchRange(std::vector<int> myArr, int target)
{
std::vector<int> index{};
for (auto i = 0; i < myArr.size(); i++)
{
if (myArr[i] == target)
{
index.push_back(i);
}
}
... | ALGO | 0.999928 | 5.556054 |
9955b317-19f4-49e6-9fda-ff712388eb47 | iam1513/CPP-DSA | C59iExamMarks.cpp | #include<iostream>
#include<unordered_set>
using namespace std;
int main(){
int n,q,p;
cin>>n>>p>>q;
unordered_set<int> s;
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++){
int correct = i;
int incorrect = j;
int unattended = n-(i+j);
if(unattende... | ALGO | 0.997485 | 3.532876 |
048ba52f-a9af-4fea-b6dc-a341f1e0264a | TaQuangDuy180804/TaQuangDuy_MonC | chuong7/Pc7.10.cpp | #include <iostream>
using namespace std;
int main() {
const char correctAnswers[] = {
'A', 'D', 'B', 'B', 'C', 'B', 'A', 'B', 'C', 'D',
'A', 'C', 'D', 'B', 'D', 'C', 'C', 'A', 'D', 'B'
};
char studentAnswers[20];
cout << "Enter the student's answers for each question (A, B, C, or D... | ALGO | 0.996062 | 7.100483 |
dee1dbf4-b79f-40d5-8fb0-2feb4e1511ee | Ayush1724/Learning-DSA-C- | strong number.cpp | #include <iostream>
using namespace std;
int main(){
int fact,b,n,t,sum=0;
cout<<"Enter the number :- ";
cin>>n;
b=n;
while(b>0){
t=b%10;
fact=1;
int i=1;
while (i<=t){
fact = fact*i;
i++;
}
sum =sum +fact;
b=b/10;
}
if (sum==n){
cout<<"Number is a strong number :- "<<sum<<endl;
}else{
c... | ALGO | 0.99991 | 3.844905 |
d0f2af7e-ee2f-4c35-a3df-2f1b8bb5bcf4 | hxzinh/VOI | DAG_PVH/main.cpp |
#include <bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
#define pii pair<int, int>
#define pll pair<long long, long long>
#define fi first
#define se second
#define ALL(v) (v).begin(), (v).end()
#define popcount(x) __builtin_popcount(x)
#define setp(x) setprecision(x)
#define MASK(x) (1LL << (x))
#define ... | ALGO | 0.99988 | 4.260927 |
b6196b83-0a55-4718-b994-a0e2c56d6256 | maiconda/Consumo-API-Flutter | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
5934fe87-eae6-4f02-ae58-b91c5d612efd | ustcyyw/algorithm | leetcode/medium/presum/bestClosingTime2483.cpp | /**
* @Time : 2022/11/30-11:12 AM
* @Author : yyw@ustc
* @E-mail : <EMAIL>
* @Github : https://github.com/ustcyyw
* @desc :
*/
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int bestClosingTime(string customers) {
int n = customers.size();
vector<int> preSum(n + 1, 0);... | ALGO | 0.999942 | 4.73386 |
461e825b-a695-404b-9e74-1f97cbe90969 | hh730/LeetCode-submission | 0 - 1 Knapsack Problem - GFG/0-1-knapsack-problem.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return max value that can be put in knapsack of capacity W.
// int knapSackHelper(int wt[],int val[],int W,int n,int**memo){
int knapSackHelper(int wt[],int val[],int W,int n... | ALGO | 0.999997 | 5.868054 |
a8c2cfe9-6cff-4c62-9d53-30770366323a | J0SAL/6Companies30days | Goldman Sachs/7.cpp | // solution link: https://practice.geeksforgeeks.org/viewSol.php?subId=50d6c6c6b34354a872f86007b56c2b6b&pid=704216&user=josal
class Solution {
public:
int findPosition(int N , int M , int K) {
// code here
if(N==1) return N;
int ans = (M%N+K-1);
if(ans == N) return ans;
re... | ALGO | 0.999979 | 4.67477 |
edf5b9dc-83c9-4cd7-a07c-7c254966f778 | flang-compiler/flang | tools/flang2/flang2exe/iltutil.cpp | /** \file
* \brief ILT utility module
*/
#include "iltutil.h"
#include "error.h"
#include "global.h"
#include "symtab.h" /* prerequisite for expand.h and ili.h */
#include "ilm.h"
#include "fih.h"
#include "ili.h"
#include "expand.h"
#include "ccffinfo.h"
#include <stdarg.h>
#define MAXILT 67108864
static int iltc... | TOOL | 0.884712 | 3.990672 |
feba19b4-729c-4809-b749-e6db7a999286 | ishandutta2007/codeforces | nikgaevoy/normal/1184/E3.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
mt19937 mt(736);
template<class T>
T &remin(T &x, T y)
{
return x = min(x, y);
}
template<class T>
T &remax(T &x, T y)
{
return x = max(x, y);
}
class dsu
{
vector<int> par, siz;
public:
dsu(int n) : par(n, -1), siz(n, 1)
{}
int get_par(in... | ALGO | 0.999996 | 4.815047 |
3ba3d74d-3711-4103-a806-09a031d6b363 | rover-7-7/Leetcode-Solutions | 501-find-mode-in-binary-search-tree/find-mode-in-binary-search-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999975 | 5.950893 |
fce14ecb-0708-455e-a3a8-f727c321ea3b | WilliamX1/leetcode | Solutions/Uncrossed-Lines.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int maxUncrossedLines(vector<int> &nums1, vector<int> &nums2)
{
/* 动态规划 */
int n1 = nums1.size(), n2 = nums2.size();
vector<vector<int>> dp(n1 + 1, vector<int>(n2 + 1, 0));
/* dp[i][j] = max(dp[k][s]) + wh... | ALGO | 0.999985 | 5.528757 |
f4c57ac2-a5d5-48e3-aa6f-9a6edb82427c | VidnyaniU/LeetCode | String/checkPalindrome.cpp | #include <bits/stdc++.h>
using namespace std;
string reverse(string s)
{
int start = 0;
int end = s.size() - 1;
while (start < end)
{
swap(s[start++], s[end--]);
}
return s;
}
// using reverse
bool isPalindromeRev(string s)
{
if (s == reverse(s))
return true;
return fa... | ALGO | 0.999861 | 5.294172 |
030f649b-09e9-491a-a81e-9eab82ee1ea9 | clockzhong/WrapLAMP | Boost/libs/math/example/bernoulli_example.cpp | #pragma warning (disable : 4100) // unreferenced formal parameter.
#pragma warning (disable : 4127) // conditional expression is constant.
//#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/math/special_functions/bernoulli.hpp>
#include <iostream... | ALGO | 0.99681 | 5.106843 |
19466fbf-3e4b-4561-aceb-faee7a2de638 | gustavoem/bcc | tamu/2semester/420/project/GeneticAlgorithm.cpp | #include "GeneticAlgorithm.h"
GeneticAlgorithm::GeneticAlgorithm (unsigned int population_size) : kGatesLimitk (20), kControlBitsLimitk (60),
kPrimesToTestk (600)
{
if (population_size < 5)
population_size = 5;
this->population_size = population_size;
startPopulation ();
output_file.open ... | ALGO | 0.999816 | 4.690162 |
4bc1956a-5f2a-4e5e-9493-8fbc4a2b484c | AhnMaph/23520027_BTTH1 | Code/bai2.cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
return a;
}
int sosanh(int tu_a,int mau_a,int tu_b, int mau_b)
{
if(mau_a*mau_b == 0) return -1;
int A = tu_a*mau_b;
... | ALGO | 0.99976 | 4.126838 |
a6195e01-d504-4ae2-837c-5ec49533d5e4 | dante-alves/Estudos | Linguagem C/Curso - Programe Seu Futuro/Aulas/Funções e Procedimentos/Aula 161 - Como somar os valores de um vetor com Função Recursiva.cpp | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
//Aula 161 - Como somar os valores de um vetor com Funo Recursiva
int soma (int vet[], int i) {
if (i == 0)
return vet[i];
else
return vet[i] + soma(vet, i - 1);
}
int main() {
int vet[5], tam;
for (int i = 0; i < 5; i++) {
printf("Insira o va... | ALGO | 0.998286 | 4.493926 |
7ba1e90e-aef7-44ff-a06d-10efac4c09a5 | mady4ever/Preparation | revision/questions/print-nodes-dont-sibling-binary-tree.cpp | /*
https://www.geeksforgeeks.org/print-nodes-dont-sibling-binary-tree/
sublings means: not have two childrens or have only one child or leaf nodes.
*/
#include<bits/stdc++.h>
using namespace std;
typedef struct Node{
int d;
Node *l,*r;
}Node;
Node *makeNode(int d)
{
Node *t = (Node *)malloc(sizeof(Node));
... | ALGO | 0.999962 | 4.476347 |
1e5b7314-e0ea-4a51-b3a9-0e36e9d3ea24 | j1sung/Algorithm-Main | Programmers/코딩테스트 입문/분수의 덧셈.cpp | #include <vector>
using namespace std;
// (분자1*분모2+분자2*분모1), (분모끼리 곱) 각각에 최대공약수(GDC)를 나눠준다.
// 최대공약수는 유클리드 호제법을 이용하여 구한다.
int gcd(int n, int d)
{
while(n!=0)
{
int temp = n;
n = d%n;
d = temp;
}
return d;
}
vector<int> solution(int numer1, int denom1, int numer2, int denom2) {... | ALGO | 0.999678 | 5.834662 |
feab65f2-1b58-4632-9dd2-f2d97cc3d563 | SravaniAvusherla/Kattis-Cpp | 3D Printed Statues.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
double n;
cin >> n;
n = log2(n);
n = ceil(n);
n++;
cout << n;
}
| ALGO | 0.999774 | 4.208071 |
1bb79b98-ac40-4270-b3e9-cd5d27629ba7 | bityangke/P3D-CTN | 2D-module/caffe-fast-rcnn-faster-rcnn-upstream-33f2445/src/caffe/solvers/adam_solver.cpp | #include <vector>
#include "caffe/sgd_solvers.hpp"
namespace caffe {
template <typename Dtype>
void AdamSolver<Dtype>::AdamPreSolve() {
// Add the extra history entries for Adam after those from
// SGDSolver::PreSolve
const vector<Blob<Dtype>*>& net_params = this->net_->learnable_params();
for (int i = 0; i ... | ALGO | 0.993905 | 7.598981 |
45fbeb40-ff5f-40fe-8243-a063d660477d | w-jin/leetcode | src/445_add_two_numbers_II.cpp | #include <stack>
#include "list.hpp"
class Solution {
public:
ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) {
// 对齐数位
ListNode *p1 = l1;
ListNode *p2 = l2;
while (p1 && p2) {
p1 = p1->next;
p2 = p2->next;
}
if (p2) { // 把长的放到l... | ALGO | 0.999743 | 5.961978 |
71a1bdef-c725-45bf-8091-30148b6e96c8 | kks227/BOJ | 2000/2097.cpp | #include <cstdio>
using namespace std;
const int INF = 1e9;
int main(){
int N, result = -1, temp = INF;
scanf("%d", &N);
for(int i=1; i*i<=N; i++){
int j = N/i + !!(N%i);
if(temp > j-i){
temp = j-i;
result = j+i-2;
}
}
if(result < 2) result = 2;
printf("%d\n", result*2);
} | ALGO | 0.999871 | 3.349307 |
95585a01-87db-4a09-a8e9-531d9c9ac9c5 | protarie125/BOJ_6764 | BOJ_6764/src/main.cpp | #include <iostream>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
auto isRising = bool{ true };
auto isDiving = bool{ true };
auto isConstant = bool{ true };
ll before;
cin >> before;
for (int i = 0; i < 3; ++i)
{
... | ALGO | 0.999432 | 4.231023 |
1d547092-7d53-4cb7-8eeb-0934bca37771 | hs094/CP | AtCoder/AtCoder Beginner Contest 399/d.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
struct Fenw {
... | ALGO | 0.999155 | 4.763946 |
b035be43-fb4e-482b-9b98-85ca70bfcf93 | gwynbleidd415/algos-and-codes | Algos/Sorting/quick3_sort.cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
class quick3_sort
{
public:
quick3_sort(T *arr, int n)
{
this->arr = arr;
this->n = n;
q_sort(0, n - 1);
}
private:
tuple<int, int> partition(int s, int e)
{
srand(time(NULL));
swap(arr[s + ran... | ALGO | 0.999782 | 5.384162 |
4dc4f5a5-c21b-4ef3-bf6c-e270716e4d3e | jiadaizhao/LintCode | 0401-0500/0463-Sort Integer/0463-Sort Integer.cpp | class Solution {
public:
/**
* @param A an integer array
* @return void
*/
void sortIntegers(vector<int>& A) {
// Write your code here
int n = A.size();
for (int j = 1; j < n; ++j) {
int temp = A[j];
int i = j - 1;
while (i >= 0 && A[i] ... | ALGO | 0.999995 | 6.188298 |
1c110001-0631-46e9-b518-9ee4cf7425ca | AhmedMohamedAbdelaty/LeetCode-Solutions | 0101-symmetric-tree/0101-symmetric-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999897 | 6.649118 |
e9abd963-a875-4595-a2e9-a8207539715f | raincross7/code-similarity | codes/train_code/problem041/problem041_483.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int a[10086],n,k,ans=0;
cin>>n>>k;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
sort(a,a+n);
for(int i=n-1;i>n-k-1;i--)
{
ans+=a[i];
}
cout<<ans<<endl;
return 0;
} | ALGO | 0.999973 | 3.204857 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.