uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
65bdb81d-8d20-4400-8786-85142617bf87 | gabia38/AOC-2024 | Day16P1.cpp | #include <iostream>
#include <string>
#include <vector>
#include <climits>
using namespace std;
void find_path(vector<string> &matrix,vector<vector<vector<int>>> &minscores,int i,int j,int score,int direction,int &mini);
int main()
{
string line;
vector<string> matrix;
while(cin>>line)
{
matrix.... | ALGO | 0.999901 | 3.924402 |
77cf0537-1d02-4542-a743-2e30bc992215 | abcvincent/opencv420_archive | opencv_contrib-4.2.0/modules/tracking/src/tldModel.cpp | #include "tldModel.hpp"
#include <opencv2/core/utility.hpp>
namespace cv
{
namespace tld
{
//Constructor
TrackerTLDModel::TrackerTLDModel(TrackerTLD::Params params, const Mat& image, const Rect2d& boundingBox, Size minSize):
timeStampPositiveNext(0), timeStampNegativeNext(0), minSize_(minSize), params_(param... | ALGO | 0.992377 | 6.076368 |
7159aeb9-da36-416d-ac76-980eaf228687 | kuna2512/CPP-DSA_BY_PW_skills | _9_pointers/_18Pointer_Arithmatic.cpp | /*
Pointer Arithmetic
Increment and Decrement
---------------------------------
hexaDecimal No. :-
0 1 2 3 4 5 6 7 8 9 a b c d e f
| | | | | | | | | | | | | | | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
int x= 9;
int* ptr = &x;
cout<... | ALGO | 0.992658 | 3.190242 |
9f473d76-e40d-4070-8daa-a7e67c3bf18c | FalleNGooddess/SE226_Labs | LAB 6_5/C++/lab6.5_1.cpp | #include <iostream>
using namespace std;
void find_common_elements(int donut[], int donut_size, int nutella[], int nutella_size) {
cout << "Common ones are: ";
for (int d = 0; d < donut_size; d++) {
for (int n = 0; n < nutella_size; n++) {
if (donut[d] == nutella[n]) {
cout ... | TOOL | 0.975913 | 4.381492 |
0bbf58e4-f451-40ee-8c1e-df3e20d4d329 | saranaranjo4430/InfiniteScroller | GameTest/MyGame/Utils/Vectors.cpp | //------------------------------------------------------------------------
#include "stdafx.h"
#include <math.h>
#include "..\app\app.h"
#include "Vectors.h"
//------------------------------------------------------------------------
//***********************************************************************
// Vector ... | TOOL | 0.946786 | 6.455499 |
04f2ba41-a4b4-4a54-b7a2-46d4a76d9d71 | 4doe/enigma2-old | lib/gdi/font_arabic.cpp | /*
* This was taken from pango.
* Modified for enigma by Felix Domke <<EMAIL>>.
* I removed support for vowels and ligatures. Sorry.
*
* Original header:
*
* This is part of Pango - Arabic shaping module
*
* (C) 2000 Karl Koehler <<EMAIL>>
* (C) 2001 Roozbeh Pournader <<EMAIL>>
*
*/
#include <vector>
#in... | TOOL | 0.882777 | 6.118139 |
5c3416b5-9548-4348-a1e1-b77164459faf | ChanJoon/Exploration-PX4-Gazebo | uav_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/simple1d.cpp | #include <iostream>
#include <boost/numeric/odeint.hpp>
using namespace std;
using namespace boost::numeric::odeint;
/* we solve the simple ODE x' = 3/(2t^2) + x/(2t)
* with initial condition x(1) = 0.
* Analytic solution is x(t) = sqrt(t) - 1/t
*/
void rhs(const double x, double& dxdt, const double t) {
dxdt =... | ALGO | 0.999953 | 6.94523 |
25a97846-e6d5-45ea-ba54-7661d65fcbf3 | Makhber/makhber | src/analysis/MultiPeakFit.cpp | #include "MultiPeakFit.h"
#include "analysis/fit_gsl.h"
#include "plot2D/PlotCurve.h"
#include "plot2D/FunctionCurve.h"
#include "core/ColorButton.h"
#include "aspects/column/Column.h"
#include <QLocale>
#include <QMessageBox>
#include <cmath>
MultiPeakFit::MultiPeakFit(ApplicationWindow *parent, Graph *g, PeakProf... | TOOL | 0.892431 | 5.501621 |
200d7e4c-626e-4d69-a91a-8acfdaa8f2ca | dasidorin/YellowBelt | Week_1/AvgTemperature/main.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n = 0;
cin >> n;
vector <long int> temp;
for (int i = 0; i < n; ++i) {
long int current_temp = 0;
cin >> current_temp;
temp.push_back(current_temp);
}
long int avg = 0;
for (size_t i = 0;... | ALGO | 0.99973 | 3.936674 |
51168ce0-eb28-4d78-86d5-7adec21a41df | krzysiekbienias/clicker-plus-plus | src/linked_list/single_linked_list.cpp | #include "linked_list/single_linked_list.hpp"
// Constructor
LinkedList::LinkedList() : head(nullptr) {}
// Desctructor
LinkedList::~LinkedList() {
Node *current = head;
while (current != nullptr) {
Node *nextNode = current->next;
delete current;
current = nextNode;
}
}
int LinkedList::size() cons... | ALGO | 0.935594 | 4.671574 |
3b38b66d-885a-45c9-aeae-6a419359c7ae | HimalRana2610/Leetcode | Online Stock Span.cpp | #include <bits/stdc++.h>
using namespace std;
class StockSpanner
{
stack<pair<int, int>> st;
public:
StockSpanner() {}
int next(int price)
{
int ans = 1;
while (!st.empty() && st.top().first <= price)
{
ans += st.top().second;
st.pop();
}
... | ALGO | 0.999373 | 5.916249 |
68a2a0d3-137b-4ca8-a5e7-73fd680ec8f4 | maromontemarc/465-proj1 | proj1/proj1/proj1.cpp | // Programming project 1
// Marc Maromonte
#include "pch.h"
#include <iostream>
#include <stack>
#include <fstream>
#include <array>
#include <algorithm>
using namespace std;
int main()
{
// Opens the lab1in.txt file
//
ifstream inFile;
inFile.open("lab1in.txt");
// If unable to open file exit
//
if (!inFile... | ALGO | 0.999794 | 4.248795 |
2e047d8b-4add-49a4-8cb3-4b7eed26e647 | Kashaf15/PD-2 | Task1.cpp | #include<iostream>
using namespace std;
main()
{
int n,sum;
cout<<"Number of sides in polygon=";
cin>>n;
sum=(n-2)*180;
cout<<"Sum of internal angkes in "<<n<<"-sided polygon="<<sum;
return 0;
}
| ALGO | 0.984936 | 3.174455 |
9a52f3bb-094f-47fd-926e-749b6cc63c0a | ShivamShrivastav26112005/DSA-C-REVISION | Pointers/Pass By Value And Pass By Reference.cpp |
// ******* Pass by value and pass by reference -: *********
// 1-: Pass by value -:
// ex-> swapping two no.s -:
#include<iostream>
using namespace std;
int swapping(int x, int y){
int temp=x;
x=y;
y=temp;
}
int main(){
int x=4;
int y=5;
cout<<x<<" "<<y<<endl;
swapping(x,y);
cout<<x<... | TOOL | 0.998989 | 5.064422 |
2041aebe-de01-46d8-91f1-81c54009ebeb | 4npg/btap | 75LT1/BAI04.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll int
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr)
struct po {
ll x, y;
ll index;
};
void READFILE(){
freopen("INP.TXT","r",stdin);
freopen("OUT.TXT","w",stdout);
}
int main() {
fast;
ll n;cin >> n;
... | ALGO | 0.999936 | 4.58147 |
209c44f3-2364-4cad-8881-2858a135b55b | ishandutta2007/codeforces | niyaznigmatul/normal/231/A.cpp | #include <cstdio>
int main() {
int n;
scanf("%d", &n);
int ans = 0;
for (int i = 0; i < n; i++) {
int x, y, z;
scanf("%d%d%d", &x, &y, &z);
if (x + y + z > 1) ++ans;
}
printf("%d\n", ans);
} | ALGO | 0.999469 | 4.30673 |
9abe4926-0290-4425-8691-49ff317a09aa | changsongzhu/leetcode | C++/by_difficulty/hard/460_h.cpp | /**
460[H]. LFU Cache
Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: get and put.
get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
put(key, value) - Set or insert the value if the ... | ALGO | 0.999402 | 6.141169 |
69a00271-3e07-4599-88b7-2ec2f6b04bd6 | alexandraback/datacollection | solutions_5670465267826688_1/C++/JayXon/C.cpp | #include <iostream>
#include <fstream>
#include <cstring>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdint>
#include <vector>
using namespace std;
char multiply(char a, char b)
{
if (a < 0)
return -multiply(-a, b);
if (b < 0)
return -multiply(a, -... | ALGO | 0.999927 | 3.842134 |
da033713-3a7c-4cb2-aafe-260ca906ac5d | mahajanmohit4/Data-Structure | data structure/day3 link list 1/dll using class.cpp | #include<iostream>
#include<stdlib.h>
using namespace std;
class node
{
public:
int data;
node *next;
node *pvr;
};
node *firstnode(int input)
{
node *n=new node();
n->data=input;
n->next=NULL;
n->pvr=NULL;
return n;
}
node *createnode(int input)
{
node *n1=new node();
n1->dat... | ALGO | 0.999733 | 3.935068 |
7bc84f46-4a06-4d6e-9684-788c8ff596fd | zmx4/MySteps | codeforces/BC/A. Vasya the Hipster.cpp | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int a, b;
cin >> a >> b;
int popularday = min(a, b);
int totalDay;
if (max(a, b) - popularday >= 2)
totalDay = (max(a, b) - popularday) / 2;
else
totalDay = 0... | ALGO | 0.999828 | 4.369481 |
aec89b68-6c13-46ee-a52b-9042d31c12ca | zzirco/HEROBOT | catkin_ws/src/next_goal/src/next_goal.cpp | #include "next_goal.h"
point::point()
{
ros::NodeHandle nh;
//publish
goal_pub = nh.advertise<geometry_msgs::PoseStamped>("/move_base_simple/goal",10);
//subscibe
goal_sub = nh.subscribe("/move_base_simple/goal",10,&point::goal_callback,this);
current_sub = nh.subscribe("/amcl_pose",10,&point:... | ALGO | 0.992642 | 3.428379 |
e03a0db1-1ce1-40aa-bb99-d13574dd5afa | sarvex/leetcode-coffeescript | solution/0100-0199/0150.Evaluate Reverse Polish Notation/Solution.cpp | class Solution {
public:
int evalRPN(vector<string>& tokens) {
stack<int> stk;
for (auto& t : tokens) {
if (t.size() > 1 || isdigit(t[0])) {
stk.push(stoi(t));
} else {
int y = stk.top();
stk.pop();
int x = stk.t... | ALGO | 0.999885 | 6.477369 |
96967b85-465e-47bd-92fe-0a5af94996e5 | MasterGeneiJin/ProjectEuler | ProjectEuler/Euler_50.cpp | #include <numeric>
#include "Euler.h"
int Euler::ConsecutivePrimeSum()
{
std::vector<int> primes = EulerUtility::getPrimesUnderCeiling(1000000);
std::vector<int> primes2 = EulerUtility::getPrimesUnderCeilingIndexed(1000000);
int highestPotential = 0;
for (int i = 0; i < 600; ++i)
{
int potentialPrime = std::... | ALGO | 0.999241 | 4.489489 |
f2ce994b-455d-4ce8-af0e-7054538cf8cf | mzadfar/OOP | 262_DivisorConundrum/test620.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int gcd(int x, int y) {
while (y != 0) {
int temp = y;
y = x % y;
x = temp;
}
return x;
}
int lcm(int x, int y) { return (x * y) / (gcd(x, y)); }
int main() {
int n;
cout << "Enter length of array: \n";
cin >> n;... | ALGO | 0.999743 | 4.346707 |
126a80b9-cb92-42fd-bec9-42a7f7587535 | tmastercoding/clang | USACO/Comps/SIlver2025Feb/s01-v6.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
int main(){
int t= 0;
cin >> t;
for(int c =0; c < t; c++){
int n, arr[200000] = {};
set<int, greater<int>> comp;
// idx, infront max
map<int, int> cnts;
vec... | ALGO | 0.999974 | 3.894201 |
c495d738-f433-450d-af0f-3997039a72f2 | AkaashSamson/OS_LAB | practice/psnp.cpp | // #include <iostream>
// using namespace std;
// struct fcfs
// {
// int pid, at, bt, ct, wt, tat, pri;
// };
// struct fcfs a[10];
// void prisort(fcfs a[], int n, int start, int sum)
// {
// for (int i = start; i < n; i++)
// {
// for (int j = i + 1; j < n; j++)
// {
// if ... | ALGO | 0.999984 | 4.674934 |
ac9754e0-4460-4b71-86f4-96a56d08c0ff | reeshipaul/leetcode | 2. Add Two Numbers.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* addTwoNumbe... | ALGO | 0.999964 | 6.182051 |
30e5fd12-d516-4e69-924d-c3e604c1f677 | Hadi-susant0/Algo22 | laporan 9 (Array)/Praktik_kelas3.cpp | #include <iostream>
using namespace std;
int main(){
int a[3] = {10,3,14};
int b[5] = {1,2,3,4,5};
int c[10];
c[2]= a[0] + b[4];
/*int b=3,c;
cout<<a[1]<<endl;
c=b + a[0];*/
cout<<c[2]<<endl;
cout<<b<<endl;
}
| ALGO | 0.974414 | 3.138353 |
5ec4994a-0c70-425e-97c2-2745b6f8b601 | RealityVirtually2019/ComposAR | CNNServer/Fusion/3rdparty/libigl/include/igl/fit_rotations.cpp | template <typename DerivedS, typename DerivedD>
IGL_INLINE void igl::fit_rotations(
const Eigen::PlainObjectBase<DerivedS> & S,
const bool single_precision,
Eigen::PlainObjectBase<DerivedD> & R)
{
using namespace std;
const int dim = S.cols();
const int nr = S.rows()/dim;
assert(nr * dim == S.rows());
a... | ALGO | 0.994724 | 6.264915 |
d4ea8a9a-b8bc-4793-9fe9-7ec57d15b355 | Mura-Tomo/ProgrammingContest | abc231/abc231_D.cpp | #include <bits/stdc++.h>
using namespace std;
int main (void) {
int N, M;
cin >> N >> M;
vector<pair<int, int>> p(M);
for (int i=0; i<M; i++) {
cin >> p[i].first >> p[i].second;
}
vector<vector<int>> x(N+1);
for (int i=0; i<M; i++) {
x[p[i].first].insert(p[i].second);
}... | ALGO | 0.999994 | 4.42592 |
c2b000cf-8ab0-43bb-a89b-1534e63e13e1 | darabmalik/DSA | Week-3/Ex_3.3_a.cpp | #include <iostream>
using namespace std;
void print(int n) {
if (n == 0)
cout << "0" << endl;
else {
cout << n << endl;
print(n - 1);
}
}
int main() {
int n;
cout << "Enter a starting point(n) \t";
cin >> n;
cout << endl;
print(n);
} | ALGO | 0.999301 | 4.631627 |
f3c39a7f-9ad7-42b6-bb4a-f9ec7255539c | ishandutta2007/codeforces | doped.silicon/normal/1155/B.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds; ... | ALGO | 0.999657 | 4.687111 |
6a3012d2-26a3-4637-9204-9a4376a841a0 | greeksachdeva/VScodes | B_Avoid_Local_Maximums.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define fo(i,n) for(ll i=0;i<n;i++)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define all(v) v.begin(), v.end()
#de... | ALGO | 0.999821 | 3.291883 |
04912ab8-364e-4e77-b429-b9b2b6df50ef | rishub/SnakePit | SnakePit/snakepit.cpp | // snakepit.cpp
#include <iostream>
#include <sstream>
#include <streambuf>
#include <string>
#include <set>
#include <cstdlib>
#include <cassert>
using namespace std;
void doBasicTests();
///////////////////////////////////////////////////////////////////////////
// Manifest constants
//////////////////////////////... | ALGO | 0.994313 | 3.714573 |
08021817-f904-450f-98c2-7ca4470bfe95 | Ginakira/Code-Archive | Luogu/SP2P1-PrimeGene.cpp | #include <iostream>
using namespace std;
bool isprime(int n) {
if(n == 1 || n == 0)
return false;
for (int i = 2; i * i <= n; ++i)
{
if(n % i == 0)
return false;
}
return true;
}
int main() {
int t, n, m;
cin >> t;
while (t--) {
cin >> n >> m;
... | ALGO | 0.999963 | 4.372249 |
b6f71564-7463-4a81-a5dd-fa3c51e88fa2 | JNXSTJ/games202_ | Assignment2/prt/ext/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
ArrayXXf a(2,2);
a << 1,2,
3,4;
cout << "(a > 0).all() = " << (a > 0).all() << endl;
cout << "(a > 0).any() = " << (a > 0).any() << endl;
cout << "(a > 0).count() = " << (a > 0).count() << endl... | ALGO | 0.96101 | 3.835741 |
b9fcd67e-8f06-408a-ba39-bd3efbec63e3 | riverstrom/6d_localization | src/EndpointModel.cpp | // SVN $HeadURL: http://alufr-ros-pkg.googlecode.com/svn/trunk/humanoid_stacks/humanoid_navigation/humanoid_localization/src/EndpointModel.cpp $
// SVN $Id: EndpointModel.cpp 3426 2012-10-17 13:33:04Z <EMAIL> $
#include <humanoid_localization/EndpointModel.h>
namespace humanoid_localization{
EndpointModel::EndpointM... | WEB | 0.925475 | 4.014592 |
68b2d33a-f76e-4c1f-b934-c69cdd48fbc6 | Allen1211/algorithm-problems-solutions | leetcode/925-Long Pressed Name.cpp | /* 925. 长按键入
你的朋友正在使用键盘输入他的名字 name。偶尔,在键入字符 c
时,按键可能会被长按,而字符可能被输入 1 次或多次。
你将会检查键盘输入的字符
typed。如果它对应的可能是你的朋友的名字(其中一些字符可能被长按),那么就返回
True。
示例 1:
输入:name = "alex", typed = "aaleex"
输出:true
解释:'alex' 中的 'a' 和 'e' 被长按。
示例 2:
输入:name = "saeed", typed = "ssaaedd"
输出:false
解释:'e' 一定需要被键入两次,但在 typed 的输出中不是这样。
示例 3:
输入:name =... | ALGO | 0.999588 | 5.956583 |
c889d23b-fb95-4bbe-b2fc-41ef51b4088c | ishandutta2007/codeforces | deemo/normal/304/D.cpp | #include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<utility>
using namespace std;
typedef long long ll;
ll n, m, x, y, a, b;
long double cal(pair<long double, long double> z){
long double dif = (z.first - x) * (z.first - x);
long double dif2 = (z.second - y) * (z.second - y);
return ... | ALGO | 0.999878 | 3.165811 |
440124c8-cfe9-4d32-b7fa-22902c37fe61 | Gouravbht/Data-Structures-and-Algorithm | Queue.cpp | #include<iostream>
using namespace std;
class queue {
int* arr;
int front;
int back;
int n; // added size of the queue
public:
queue() {
n = 100; // set the size of the queue
arr = new int[n];
front = -1;
back = -1;
}
void push(int x) {
if (back == n - 1) { // corrected comparison o... | TOOL | 0.958635 | 5.223759 |
67e0f13a-2e56-4752-8d38-befbb2ee5745 | thals1214/alg-study | 04 1차원배열/boj10818.cpp | #include <iostream>
int main() {
int input_num, max, min, temp;
std::cin >> input_num;
std::cin >> temp;
max = temp;
min = temp;
for (int i = 1; i < input_num; i++) {
std::cin >> temp;
if (temp > max) max = temp;
if (temp < min) min = temp;
}
std::cout << min << " " << max;
} | ALGO | 0.999949 | 4.298383 |
810fdc8f-e8e7-4c8a-a6fc-0252d99e7bdf | ishandutta2007/codeforces | maripium/normal/1286/A.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
int N;
int A[MAXN];
int dp[MAXN][MAXN][2];
void mnm(int &x, int y) {
x = min(x, y);
}
int main() {
ios_base::sync_with_stdio(false);
cin >> N;
for (int i = 1; i <= N; ++i) {
cin >> A[i];
}
memset(dp, 69, sizeof dp);
dp[0... | ALGO | 0.999979 | 4.105546 |
437b80bd-e58e-4a64-ab4a-19e14bf1f47e | VKS-24/Cpp_programs | swaping in_array.cpp | /*Problem statement
You have been given an array/list(ARR) of size N. You need to swap every pair of
alternate elements in the array.
You don't need to print or return anything, just change in the input array itself.
Detailed explanation ( Input/output format, Notes, Images )
Constraints :
0 <= N <= 10^5
Time Limit: ... | ALGO | 0.999892 | 4.895306 |
5e04375a-66b7-44a5-b3f4-27021ed248ad | trailofbits/llvm-sanitizer-tutorial | llvm/lib/Option/OptTable.cpp | #include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Option/OptSpecifier.h"
#include "llvm/Option/OptTable.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/... | TOOL | 0.982193 | 5.083229 |
5f9f36f3-31f2-4dfe-b677-7053cb860a67 | Sharafabdullah/CompetitiveProgramming | cses/introduction/grayCode.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()), ((v).end())
#define repv(i, v) for(int i=0;i<(v).size();++i)
#define rep(i, j, n) for(int i=(j);i<(int)(n);++i)
#define dow(i, j, n) for(int i=(j);i>=(int)(n);--i)
#define pb push_back
#define mp make_pair
#define p(x) cout<<#x... | ALGO | 0.999997 | 4.191521 |
05dd68e5-08fd-4b23-b08d-e9d06763d568 | ishandutta2007/codeforces | xuanquang1999/normal/604/D.cpp | //84104971101048411497 - Can you guess what does this mean?
using namespace std;
#include <bits/stdc++.h>
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(ll i = (r); i >= (l); --i)
#define fto(... | ALGO | 0.999974 | 3.816805 |
df7a2352-e336-4758-9bfa-98326e5bde8b | wishForget/MiniMineCraft | MineCraftDemo/HelloOpenGL_00/includes/BulletDynamics/ConstraintSolver/btContactConstraint.cpp | #include "btContactConstraint.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
#include "LinearMath/btVector3.h"
#include "btJacobianEntry.h"
#include "btContactSolverInfo.h"
#include "LinearMath/btMinMax.h"
#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h"
btContactConstraint::btContactConstraint(b... | ALGO | 0.97833 | 3.424985 |
df70b129-8820-4c41-ae4a-0c0e19a6e347 | TecOrb-Developers/chat-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.998859 | 6.785645 |
5fa0b5c9-dbe0-4fcd-b334-092771d8e78e | ishandutta2007/codeforces | dingdingsb/normal/512/D.cpp | #include<bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define pc putchar
#define chkmx(a,b) (a)=max((a),(b))
#define chkmn(a,b) (a)=min((a),(b))
#define fi first
#define se second
using namespace std;
template<class T>
void read(T&x){x=0;char c=getchar();bool f=... | ALGO | 0.99998 | 4.220015 |
4afd67a5-0183-453b-8443-477f164feeb1 | rajveer-09/DSAleetcode | 0231-power-of-two/0231-power-of-two.cpp | class Solution {
public:
bool isPowerOfTwo(int n) {
if (n <= 0) {
return false;
}
// A number is a power of two if and only if it has exactly one set bit (binary).
// So, we use the bitwise AND operation to check for this condition.
return (n & (n - 1)) == 0;
}
};
1. U... | ALGO | 0.999771 | 7.162578 |
45ac6dff-a0a4-42cb-bd11-dcd76c0c4dcb | reddyshr/dd_bot | include/Eigen/doc/examples/TutorialLinAlgSVDSolve.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3, 2);
cout << "Here is the matrix A:\n" << A << endl;
VectorXf b = VectorXf::Random(3);
cout << "Here is the right hand side b:\n" << b << endl;
cout << "The least-squares ... | ALGO | 0.999806 | 4.20012 |
e7b9ef4d-0a67-4919-951c-32e82e32ac08 | Gnaroshi/practice-algorithm-solvedac | With_Levels/Bronze/Bronze_1/2846.cpp | // problem: 오르막길
// id: 2846
// time taken:
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, b, s, t, mx = 0;
cin >> n >> b;
n--;
s = b;
while (n--)
{
cin >> t;
if (t <= b)
{
s = b = ... | ALGO | 0.999872 | 3.624933 |
c301d5bd-c3a9-440c-aa87-5768cc2fc30d | EngrMatin/Algorithms | Exams/Theory Assignment-01/10.DFS_Iterative.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5;
int visited[N];
vector<int> adj_list[N]; //list of vector or array of vector
void dfs(int node)
{
stack<int> st;
st.push(node);
while (!st.empty())
{
int node = st.top();
st.pop();
if (!visited[node])
... | ALGO | 0.999993 | 5.068741 |
3fd7ff5c-00ce-4d06-9bf3-5e7fa8f8fb1c | openkylin/codec2 | cml/source/CreateUmtsInterleaver.cpp | #include <math.h>
#include <mex.h>
#include <Matrix.h>
#include <stdlib.h>
/* library of functions */
#include "./include/interleaver.h"
/* Input Arguments */
#define INPUT prhs[0]
/* Output Arguments */
#define OUTPUT plhs[0]
/* main function that interfaces with MATLAB */
void mexFunction(
int n... | ALGO | 0.99261 | 4.239048 |
5720d3a2-3ffc-494c-b481-d21f24b77df4 | Reriiii/marisaoj-practice | level-1/prefix-sum/introduction-to-prefix-sum/61.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int cur = 0;
unordered_map<int, int> cnt;
cnt[0] = 1;
long long res = 0;
for (auto ch : s) {
if (ch == '1') cur++;
else cur--;
if (cnt.find(cur) != cnt.end())
res +... | ALGO | 0.99997 | 4.347337 |
04328ada-f129-4263-865f-536f3e89598d | ishandutta2007/codeforces | hongzy/normal/1528/C.cpp | #include <bits/stdc++.h>
#define LOG(FMT...) fprintf(stderr, FMT);
#define rep(i, j, k) for(int i = j; i <= k; ++ i)
#define per(i, j, k) for(int i = j; i >= k; -- i)
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef double db;
typedef ... | ALGO | 0.998776 | 3.847582 |
85613f14-8d94-406b-97c3-98f4ced49e33 | Owmicron/CPStuff | Codeforces/RoundCorridor.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typede... | ALGO | 0.998912 | 3.487504 |
b5850a35-e8e6-416b-97ef-29903d281f31 | anishLearnsToCode/hackerrank-cpp | debugging/messages_order.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
class Message {
private:
string text;
static int id;
int current_id;
public:
Message() { current_id = ++id; }
Message(string t){ current_id = ++id; text=t; }
const string& get_text() {
return text;
}
... | ALGO | 0.995807 | 5.702079 |
0df7ac4d-93dd-4faf-a1f9-795e81907741 | Kaulwarmythri/DSA | 1662-check-if-two-string-arrays-are-equivalent/1662-check-if-two-string-arrays-are-equivalent.cpp | class Solution {
public:
bool arrayStringsAreEqual(vector<string>& w1, vector<string>& w2) {
for(int i=1; i<w1.size(); i++)
w1[0] += w1[i];
for(int i=1; i<w2.size(); i++)
w2[0] += w2[i];
return w1[0] == w2[0];
}
}; | ALGO | 0.998736 | 5.978312 |
0d8bb6d5-2f3a-4954-90a9-f6b95fec5584 | OLR-xray/OLR-3.0 | src/3rd party/nvtt/src/nvimage/Filter.cpp | // This code is in the public domain -- <EMAIL>
/** @file Filter.cpp
* @brief Image filters.
*
* Jonathan Blow articles:
* http://number-none.com/product/Mipmapping, Part 1/index.html
* http://number-none.com/product/Mipmapping, Part 2/index.html
*
* References from Thacher Ulrich:
* See _Graphics Gems III_ "G... | ALGO | 0.994391 | 5.140921 |
e0c83652-8702-4363-9c11-fb783ce17198 | yangxiao-cd/learn2024 | 循环——while语句(求最小公倍数).cpp | #include<iostream>
using namespace std;
int main(){
int x,y,temp,s,i=1;
cout<<"2ȥС" ;
cin>>x>>y;
if(x>y){
temp=x;
x=y;
y=temp;
}
s=y*i;
while(s%x!=0){
i++;
s=y*i;
}
cout<<"СΪ" <<s<<endl;
return 0;
}
| ALGO | 0.999054 | 3.106601 |
09c85ff8-4aba-4426-a230-77bbe1e4f464 | hrjp/kcctnavigation | src/pure_posePursuit.cpp | /**
* @file pure_posePursuit.cpp
* @brief pursuit target pose
* @author Michikuni Eguchi
* @date 2021.9.22
* @details 受け取ったtarget way point に追従するようにpure pursuit
*/
#include <ros/ros.h>
#include <geometry_msgs/Twist.h>
#include <geometry_msgs/Pose.h>
#include <std_msgs/String.h>
#include <vector>
#include <string>
#incl... | TOOL | 0.983882 | 4.601994 |
4dfa337b-9e9d-4cea-9f75-0cec41a669aa | papilong123/LeetCode | cpp/Array/118_Pascal'sTriangle.cpp | #include <vector>
using namespace std;
class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> res(numRows);
if(numRows==0) return res;//返回空数组
for(int i=0;i<numRows;i++){//给数组一个一个赋值
for(int j=0;j<=i;j++){
if((j==0||j==i))... | ALGO | 0.999958 | 5.178254 |
238d4896-cc40-49ff-bd0f-58b0182b3038 | singlarohan/leetcode_sol | 0008-string-to-integer-atoi/2022-08-11 23.49.28 - Wrong Answer - runtime NA - memory NA.cpp | class Solution {
public:
int myAtoi(string s) {
bool ifneg{false}, flag{false};
double ans{0};
for(int i = 0; i<s.size(); i++){
if(s[i] == '-' && !flag){
ifneg = true;
flag = true;
}
if(s[i] == '+' && !flag){
... | ALGO | 0.999528 | 4.904522 |
2c0f5844-3b68-43e4-89fe-9638cc080846 | DanielSR16/VACORO-PROYECT-FRONT | 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.998693 | 6.797273 |
829181db-21ce-49de-a7b9-3ca2cdf9ad83 | wisteria2gp/ComPro | ABC/165-c.cpp |
#include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
template <class T>
using vec = std::vector<T>;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool ... | ALGO | 0.999874 | 4.017965 |
7497560b-a2ce-431f-878c-6c1f5a265722 | kmjp/procon | leetcode/biweekly/081-120/120/2973.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a)... | ALGO | 0.999676 | 4.396806 |
94eadbc8-342b-4de9-91a6-1f62bac48ca7 | usernameisavailablee/DigitalMediaProcessingAlgorithms | third_lab/testg++/opencv/samples/cpp/tutorial_code/ImgTrans/imageSegmentation.cpp | /**
* @brief Sample code showing how to segment overlapping objects using Laplacian filtering, in addition to Watershed and Distance Transformation
* @author OpenCV Team
*/
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
using namespace std;
using names... | ALGO | 0.990793 | 7.526256 |
caf0dc0f-acb2-40d6-903c-f1a1014cf7d2 | Code-Mars/LeetCode | 2045-second-minimum-time-to-reach-destination/2045-second-minimum-time-to-reach-destination.cpp | class Solution {
public:
using int2 = pair<int, int>;
inline static int wtime(int step, int time, int change) {
int ans=0;
for(int i=0; i < step; i++) {
int gr=ans/change;
if (gr&1) // If it's a red light
ans=(gr+ 1)*change;
ans+=time;
... | ALGO | 0.999928 | 5.424224 |
699eee34-2c71-428e-af78-46a664c98490 | Rodrigo61/GUAXINIM | Kattis/megainversions/main.cpp | bool debug = false;
//<editor-fold desc="GUAXINIM TEMPLATE">
/******** All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include ... | ALGO | 0.999939 | 3.497888 |
32b410a0-3eb5-45de-b361-65a2105b826a | socc-io/algostudy | baekjoon/smilu/utils/manacher.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> manacher_primitive(string s) {
int n = s.size();
vector<int> a(n);
int r = 0, p = 0;
for (int i = 0; i < n; i++) {
a[i] = i <= r ? min(a[2*p-i], r-i) : 0;
while (i-a[i]-1 >= 0 && i+a[i]+1 < n && s[i-a[i]-1] == s[i+a[i]+1]) ++a[i];
... | ALGO | 0.999954 | 5.244128 |
bb145384-3e0f-4051-9d24-ffa9ef95e72d | YuriyNikolaev/Cpp | Cpp_Освой/03_dz_3.cpp | // 03_dz_3.cpp
#include <iostream>
using namespace std;
int main()
{
// запрос радиуса круга
cout << "Введите радиус круга: ";
double radiusCircle = 0;
cin >> radiusCircle;
// вводим число Пи
const double pi = 3.1415926;
cout << "Значение pi равно: " << pi << endl;
// расчет площади круга
double squareCirc... | ALGO | 0.993846 | 4.195812 |
2479fc2a-e69f-4653-9f1d-db61a54d8278 | hjiang13/LLMs-in-IR | POJ-104/39/319.cpp | #include <iostream>
using namespace std;
void main()
{
int n;
cin >> "%d",&n);
struct student
{
char name[20];
int score;
int judge;
char work;
char west;
int paper;
int money;
}
stu[100];
int i;
for(i=0; i<n; i++)
{
stu[i].money=0;
cin >> "%s%d%d %c %c%d",stu[i].name,&stu[i].score,&stu[i].judge,&stu[i].work,&stu[i].we... | ALGO | 0.983866 | 3.073655 |
6192423b-c7b5-49c5-aa28-21e36731f83b | MuhammadMouostafa/Algorithms | binary_search.cpp | #include <bits/stdc++.h>
using namespace std;
int n,a[1000000+5];
int binary_search(int val){
int lo=1,hi=n;
while(lo<=hi){
int mid=(lo+hi)/2;
if(a[mid]==val)return mid;
if(a[mid]<val){
lo = mid + 1;
}else {
hi = mid - 1;
}
}
return -1;
} ... | ALGO | 0.999919 | 5.024152 |
0bfa07f9-8d2d-4a48-b191-593faf765655 | kushagra414/100-Days-of-Code | KushagraShekhawat/Programs/Day 72/155. Longest consecutive subsequence.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
int findLongestConseqSubseq(int arr[], int n);
// Driver program
int main()
{
int t,n,i,a[100001];
cin>>t;
while(t--)
{
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
cout<<findLongestConseqSubseq(a, n)<<endl;
}
return 0;
}// } Drive... | ALGO | 0.999447 | 5.398294 |
48915375-910a-4830-8676-3b622d323dc7 | MRM-AIA-TP-2026/MRM_TanavGupta | C++/Course 1/Week 3/exercise3.cpp | #include <iostream>
using namespace std;
int main(int argc, char** argv) {
int x = stoi(argv[1]);
//add code below this line
if(x%5 == 0 && x%2==0){
cout << x << " is divisible by 5 and even" << endl;
}
else {
cout << x << " is not divisible by 5 or it is odd" << endl;
}
//add code above t... | ALGO | 0.988536 | 4.469098 |
464ace0e-d600-474d-ad40-535f64929cbc | Y3U18/ollvm-poject | llvm/tools/dsymutil/MachOUtils.cpp | #include "MachOUtils.h"
#include "BinaryHolder.h"
#include "DebugMap.h"
#include "LinkUtils.h"
#include "llvm/CodeGen/NonRelocatableStringpool.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCMachObjectWriter.h"
#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreame... | TOOL | 0.919782 | 7.007649 |
298f217f-7f0c-4645-918d-7119ec778df3 | SRIJAN-KUMAR7/Codeforces... | drinks.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
double s = 0;
for (int i = 0; i < n; i++) {
cin >> arr[i];
s += arr[i];
}
double fract = s / n;
cout << fixed << setprecision(12) << fract << endl;
return 0;
}
| ALGO | 0.997625 | 4.364466 |
f96aacec-a4a0-49cc-bd01-fdc4ed8a7c50 | Noubissie/Cpp-tutorial | ReferenceAndValue.cpp | #include <iostream>
#include <vector>
void parse_by_value(std::vector<int> data){
data.push_back(7);
for (int i=0; i<data.size();i++){
std::cout << data[i] << "\t";
}
std::cout <<"\n";
}
void parse_by_reference(std::vector<int> &data){
data.push_back(7);
for (int i=0; i<data.size(... | TOOL | 0.954207 | 4.78798 |
e8a0f6e8-dd95-4139-8f25-19a71ff80665 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_8055_12.cpp | #include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005];
int main() {
int n, m, k;
cin >> n >> m >> k;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < m; i++) cin >> b[i];
sort(a, a + n);
sort(b, b + n);
int ok = 0;
if (n > m) ok = 1;
for (int i = 0; i < n; i++)
if (a[i... | ALGO | 0.999987 | 3.3191 |
3d2e275d-fcab-4417-a89b-b52e7ba5fa2c | ishandutta2007/codeforces | dorijanlendvaj/normal/758/A.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int h[10001];
int ma,sol;
int main()
{
cin>>n;
for (int i=0;i<n;++i)
{
cin>>h[i];
ma=max(h[i],ma);
}
for (int i=0;i<n;++i)
{
sol+=ma-h[i];
}
cout<<sol<<endl;
} | ALGO | 0.999723 | 3.559936 |
9597302f-ba20-4723-a358-5f320553c592 | dreamerweee/Algorithm | LeetCode/GetIntersectionNode.cpp | /*
* 编写一个程序,找到两个单链表相交的起始节点。
* 注意:
* 如果两个链表没有交点,返回 null.
* 在返回结果后,两个链表仍须保持原有的结构。
* 可假定整个链表结构中没有循环。
* 程序尽量满足 O(n) 时间复杂度,且仅用 O(1) 内存。
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
// 时间复杂度O(A*B)
ListNod... | ALGO | 0.999792 | 5.113133 |
00211004-e7ea-4fb3-8689-bd4ace2e6fb8 | UserBits/OI-Codes | Luogu/P3384[模板][线段树]树链剖分.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
char ss[1 << 17], * A = ss, * B = ss;
inline char gc() {
return A == B && (B = (A = ss) + fread(ss, 1, 1 << 17, stdin), A == B) ? EOF : *A++;
}
template<typename qRead>
inline void qr(qRead& s) {
char c = gc();
s = 0;
for(; c < '0' || c > '9'; c = gc());... | ALGO | 0.99994 | 3.926025 |
1cc6b557-3fb8-4833-8e19-97d716395034 | AKALight/Programs-Finals | Programs this Final/Test otin.cpp | #include <iostream>
using namespace std;
int main(){
int *arrayList,size,index,lowestNum;
cout<<"Enter the size: ";
cin>>size;
arrayList = new int[size];
for(int index = 0; index < size; index++)
{
cout<<"Enter a number: ";
cin>>arrayList[index];
}
lowestNum = 0;
for(int index = 0; index <... | ALGO | 0.998013 | 3.284332 |
36d97ba2-3abc-4cc7-b45d-57fe8f7bdbaa | shenghuanjie/poj | problems/B_Trees Made to Order.cpp | /*
B: Trees Made to Order
http://cxsjsx.openjudge.cn/contest1788/B/
描述
We can number binary trees using the following scheme: The empty tree is numbered 0.The single-node tree is numbered 1.All binary trees having m nodes have numbers less than all those having m+1 nodes.Any binary tree having m nodes with left and ri... | ALGO | 0.999867 | 4.106446 |
f515d07c-8521-4e6a-898f-f3ac5b0a54cb | wla-98/worse-pose-but-better-3DGS | Thirdparty/g2o/g2o/types/types_six_dof_expmap.cpp | #include "types_six_dof_expmap.h"
#include "../core/factory.h"
#include "../stuff/macros.h"
namespace g2o {
using namespace std;
Vector2d project2d(const Vector3d& v) {
Vector2d res;
res(0) = v(0)/v(2);
res(1) = v(1)/v(2);
return res;
}
Vector3d unproject2d(const Vector2d& v) {
Vector3d res;
res(0) =... | ALGO | 0.966405 | 5.55332 |
d51fc038-653a-4956-83d2-9cecc018929a | rorubyy/leetcode-C | leetcode/leetcode1523.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
int countOdds(int low, int high)
{
return (low % 2 == 0 && high % 2 == 0) ? (high - low) / 2 : (high - low) / 2 + 1;
}
int main()
{
int low = 3, high = 7;
countOdds(low, high);
return 0;
} | ALGO | 0.999274 | 4.941701 |
4020920e-af69-41c3-a8a2-70930c92d1f1 | Rishabhgith/Data-Structures-and-Algorithms | BINARY_TREE/KDISTANCE_NODE_FROM_ROOT.cpp | #include<bits/stdc++.h>
using namespace std;
struct node
{
int val;
node *right;
node *left;
};
node *addnode(int data)
{
node *t=new node();
t->val=data;
t->right=NULL;
t->left=NULL;
return t;
}
void kdistance(node *root,int k,vector<int>&v)
{
if(!root)
return;
if(k==0)
{
v.push_back(root->val);
retur... | ALGO | 0.999978 | 3.694474 |
b305bb56-b664-4c15-8a64-890f7686f37a | liamlin1102/advent_of_code | 1202.cpp | #include<iostream>
#include <bits/stdc++.h>
#include <map>
using namespace std;
class Solution {
public:
std::vector<int> split(const std::string& str, char delimiter) {
std::vector<int> tokens;
size_t start = 0;
size_t end = str.find(delimiter);
while (end != std::string::npos) {
... | ALGO | 0.999789 | 4.59443 |
694575f7-601b-4b3b-8a92-7f921891f0ff | mkltaneja/Leetcode | Weekly_Contest_#212/1630_Arithmetic_Subarrays.cpp |
bool checkarith(vector<int> &a)
{
int n = a.size();
for (int i = 2; i < n; i++)
if (a[i] - a[i - 1] != a[1] - a[0])
return false;
return true;
}
vector<bool> checkArithmeticSubarrays(vector<int> &nums, vector<int> &l, vector<int> &r)
{
int n = l.size();
vector<bool> ans(n);
... | ALGO | 0.999832 | 5.064886 |
a8c6adee-1db6-4852-b37d-78f3f0ba8ab4 | Hasil-Sharma/leet-code | 046. Permutations/permutations-4.cpp | //
#define mp(A, B) make_pair(A, B)
#define ff(i, m, n) for(i = m; i < n; i++)
#define ffr(i, m, n) for(i = m; i >= n; i--)
#define ss(v) sort(v.begin(), v.end())
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<pair<int, int>> vpii;
... | ALGO | 0.999995 | 5.542576 |
342fad4b-5a4c-488c-8b05-760600bfef46 | lamiiiii/Advanced-Programming | Midterm/5Week/5Week Test.cpp | // 5주차 과제 및 실습
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define ARRAY_SIZE 20
#define GENERATION_SIZE 50 //250번쯤 해야 fitness가 20인 population을 찾아내는 확률이 높아짐
/*
* - 한 배열의 최대 길이가 20인 문제를 풀기 위한 유전 알고리즘 구현
* - 각 chromosome의 fitness는 1의 개수
* - tournament selection
* - one-po... | ALGO | 0.999941 | 5.193121 |
6036db09-14ad-48ba-815d-818dc74795a1 | iceeyyy/DSA_Answers | 0122-best-time-to-buy-and-sell-stock-ii/0122-best-time-to-buy-and-sell-stock-ii.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
//Tabulation Solution with space optimization
int n=prices.size();
vector<int> prev(2,0);
vector<int> cur(2,0);
//base Case
prev[0]=prev[1]=0;
for(int ind=n-1;ind>=0;ind--){
f... | ALGO | 0.999749 | 6.106452 |
640c3463-b181-4318-85dd-03e51b13a585 | f4t4nt/competitive-programming | archive/Kattis/shoppingplan.cpp | #include <algorithm>
#include <cmath>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <s... | ALGO | 0.99874 | 4.275915 |
fe7b5137-72bf-4efd-9f8b-3b7edae9348f | mynk-rjpt/project1 | counting_sort.cpp | #include <iostream>
using namespace std;
void countSort(int array[], int size) {
int output[10];
int count[10];
int max = array[0];
for (int i = 1; i < size; i++) {
if (array[i] > max)
max = array[i];
}
for (int i = 0; i <= max; ++i) {
count[i] = 0;
}
for (int i = 0; i < size; i++) {
... | ALGO | 0.999917 | 5.58637 |
796716ad-4396-4abf-aaf6-8f2420de171f | mchanthagithub/finite-volume | src/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.996248 | 6.251058 |
12aec5c1-46af-4091-8adb-be44466f6508 | sarvex/leetcode-clojure | solution/1300-1399/1362.Closest Divisors/Solution.cpp | class Solution {
public:
vector<int> closestDivisors(int num) {
auto f = [](int x) {
for (int i = sqrt(x);; --i) {
if (x % i == 0) {
return vector<int>{i, x / i};
}
}
};
vector<int> a = f(num + 1);
vector<int... | ALGO | 0.999981 | 5.815267 |
74e648bc-2f6d-4e81-8c5e-84c99877d940 | pret/pokediamond | tools/scaninc/scaninc.cpp | #include <cstdio>
#include <cstdlib>
#include <list>
#include <queue>
#include <set>
#include <string>
#include "scaninc.h"
#include "source_file.h"
bool CanOpenFile(std::string path)
{
FILE *fp = std::fopen(path.c_str(), "rb");
if (fp == NULL)
return false;
std::fclose(fp);
return true;
}
c... | TOOL | 0.942076 | 4.211177 |
ae84237d-9bcf-499b-b81a-ef617a46c56d | saguila/EDA | GIS-01.cpp | /* autor: Sebastián Águila */
#include<iostream>
using namespace std;
int calculaSerie(int base,int exponente);
bool calculo();
int main(){
while(calculo());
return 0;
}
bool calculo(){
int base,exponente;
cin >> base >> exponente;
if(!cin)return false;
cout << calculaSerie(base,exponente) << endl;
return ... | ALGO | 0.999948 | 4.567178 |
9288e36e-decc-488f-bf96-3867cbbd3a40 | ypm1999/Blazar_my | template/source/graph-theory/pointtwo.cpp | void Dfs(int x, int lst){
dfn[x] = ++dfc;
low[x] = dfn[x];
stack[++cnt] = x;
int son = 0;
for (int i = g[x]; i; i = nxt[i]){
if (!dfn[adj[i]]){
++son;
Dfs(adj[i], i);
low[x] = min(low[x], low[adj[i]]);
if (low[adj[i]] >= dfn[x]){
int Tmp;
iscut[x] = 1;
++block;
E[x].push_back(block ... | ALGO | 0.999862 | 4.507778 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.