uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
08dd63e2-c2fd-459f-80b0-76057f222d00 | ishandutta2007/codeforces | ddytxdy/normal/1187/B.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=2e5+50;
int n,m,s[26][N],now[26];char b[N],c[N];
int main(){
scanf("%d%s",&n,b+1);
for(int i=1;i<=n;i++){
int ch=b[i]-'a';
now[ch]++;
s[ch][now[ch]]=i;
}
scanf("%d",&m);
for(int i=1;i<=m;i++){
memset(now,0,sizeof(now));
scanf("%s",c+1);
int l=str... | ALGO | 0.999928 | 3.947014 |
322ba0e3-82ba-4155-91a3-bcb0f8fcaefc | ishandutta2007/codeforces | noimi/normal/1280/B.cpp | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#defin... | ALGO | 0.999895 | 4.461291 |
a65398ca-3f9d-4c23-a01a-ecf426e2991e | kurisaW/ROS_Project-Team | ROS项目资料/资料包/my_slam_gmapping/src/part_slam/motionmodel/motionmodel.cpp | #include "motionmodel.h"
namespace GMapping {
double pf_ran_gaussian(double sigma)
{
double x1, x2, w;
double r;
do
{
do { r = drand48(); } while (r == 0.0);
x1 = 2.0 * r - 1.0;
do { r = drand48(); } while (r == 0.0);
x2 = 2.0 * drand48() - 1.0;
w = x1*x1 + x2*x2;
} while(w > 1.0 || w=... | ALGO | 0.96805 | 4.369916 |
830d7858-4410-4f93-bf43-94056f5546a2 | ilyabelow/algorithms_tasks | 2_term/2_module/Task5/main.cpp | #include <iostream>
#include <vector>
//Graph with adjacency matrix
class MatrixGraph {
private:
//Adjacency matrix
std::vector<std::vector<int>> adjacency_matrix;
public:
explicit MatrixGraph(int vertices_count);
~MatrixGraph() = default;
void AddEdge(int from, int to, int weight);
int VerticesCount(... | ALGO | 0.999924 | 5.052008 |
e9e64d2e-ed1d-4fe6-8c73-73408d64f3b7 | ArjunParajuli/DSA | string/add_Strings.cpp | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
void recursiveAdd(string &num1, int i, string &num2, int j, int carry, string &ans){
if(i<0 && j<0){
if(carry != 0){
ans += carry+'0';
}
return;
}
int n1 = ... | ALGO | 0.999923 | 5.461907 |
fe1b1fb3-fad9-4eaf-9a06-d0bd15bc1246 | ArielGarciaM/CompetitiveProgramming | Kattis/freeweights.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a, b;
bool check(int m) {
int lst = -1;
for(int i = 0; i < n; i++) {
if(a[i] <= m)
continue;
if(lst == -1) {
lst = a[i];
continue;
}
if(lst != a[i])
return false;
... | ALGO | 0.999992 | 3.980709 |
e73b3a8e-1cdc-4f07-a1ed-80dc1d69b382 | makio93/competitive-annualsites | Google/KickStart/2022/Round/E/Q4/1/main0.cpp | // 学習1回目,自力aAC
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i=0; i<(int)(n); ++(i))
#define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i))
#define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i))
#define rep3r(i, m, n) for (int i=(int)(n)-1; (i)>=(int)(m); --(i))... | ALGO | 0.999769 | 4.56989 |
0deefd6e-1111-4dde-ad14-055c7144533e | mart-gant/bank_app_mobile | 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.998733 | 6.76775 |
fd03261e-2a96-49aa-b646-cbc859a2c4fc | carlosten1989/Leetcode | code/cpp/ValidSudoku.cpp | class Solution {
public:
bool isvalid(int m, int n, vector<vector<char> > &board) {
int i,j;
for(i = 0;i < 9;i ++) {
if(i != m && board[i][n] == board[m][n]) {
return false;
}
}
for(j = 0;j < 9;j ++) {
if(j != n && board[m][j] == bo... | ALGO | 0.999382 | 6.402841 |
a5050a18-e64e-4d45-b4c4-a6500d61da3b | mhilmyh/algo-data-struct | leetcode/august-leetcoding-challenge/Valid-Palindrome.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
bool isLowerCase(char chr)
{
return 'a' <= chr && chr <= 'z';
}
bool isUpperCase(char chr)
{
return 'A' <= chr && chr <= 'Z';
}
bool isAlphabet(char chr)
{
return isLowerCase(chr) || isUpperCase(chr);... | ALGO | 0.999584 | 5.82173 |
5bed5aa5-3d6d-4b53-b9d4-bcfd582a4d5c | shivanshsanoria1/LeetcodeSolutions | CPP [1-500]/232.implement_queue_using_stacks [5].cpp | class MyQueue {
private:
// acts as 'rear' of the queue for pushing the elements
stack<int> in;
// acts as 'front' of the queue for popping the elements
stack<int> out;
// act as the front element of the queue
int front;
public:
MyQueue() {
front = -1;
}
// T.C.=O(1)
... | ALGO | 0.999468 | 5.76743 |
38ba7849-8393-48c0-8cbb-5c9888d186ec | Renni9807/competitive_programming | Leetcode/array_string/169_majority_element.py/sol.cpp | class Solution {
public:
int majorityElement(vector<int>& nums) {
int cnt=0, t;
for(auto& num:nums) {
if(t==num) cnt++;
else if(cnt==0) t=num, cnt++;
else cnt--;
}
return t;
}
}; | ALGO | 0.999868 | 5.661934 |
61fef499-dcf0-464a-9939-105cec40499e | CostaDiego/process-control | example-8.cpp | #include <errno.h>
#include <signal.h>
#include <sys/wait.h>
#include <stdio.h>
#include <unistd.h>
int main(){
int pid;
printf("I am parent process, PID = %d, and i'm going to create a child process\n\n", getpid());
pid = fork();
if(pid == -1){/* Error */
perror("Impossible to create a child... | TOOL | 0.859544 | 4.209694 |
3ca9f995-a3e8-4940-9e46-eebdb04d3d17 | Sahed-Hasan-007/My_Codeforces_Solve | 2009d.cpp | #include <bits/stdc++.h>
#include<string>
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long int
using namespace std;
#define int long long
int pp = 1000000007;
#define attack(x,k) ((x-k) + ((n^86)==134))
int32_t main() {
int t;
cin >> t;
while (t--) {
int n;
... | ALGO | 0.99957 | 4.024451 |
8b2ea509-9a56-4570-83ae-ec02102f53c9 | skmahin661/leetcode_solve | 0231-power-of-two/0231-power-of-two.cpp | class Solution {
public:
bool isPowerOfTwo(int n) {
for(int i=0;i<=31;i++)
{
if(pow(2,i)==n)
{
return true;
}
}
return false;
}
}; | ALGO | 0.997184 | 6.256978 |
0141b9c3-cb2b-4c7c-ac17-ca9c47f6b1a6 | auguzsto/pizzaria | 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.998762 | 6.786404 |
ee3afa64-df5d-40fd-ac9b-846bd70b2184 | Rijvi-Ahmed/HackerRank | 30days challenge/10.cpp | #include<bits/stdc++.h>
using namespace std;
int fact(int n){
int result;
if(n<=1){
return 1;
}
else
result=n*fact(n-1);
return result;
}
int main(){
int n;
cin>>n;
int result=fact(n);
cout<<result;
}
| ALGO | 0.999935 | 5.065944 |
846825f5-3c41-48ad-8ddd-647a48ae41c2 | bbidault/advent-of-code | 2024/day16/day.cpp | // https://adventofcode.com/2024/day/16
#include <fstream>
#include <limits.h>
#include <vector>
/**
* @brief A cell of the score map, defines the score of the cell for each heading.
*/
struct Cell
{
int mNorthScore = INT_MAX;
int mSouthScore = INT_MAX;
int mEastScore = INT_MAX;
int mWestScore = INT_M... | ALGO | 0.999857 | 6.281014 |
4f6fa2a9-1436-4c84-ab35-67631b43e6f6 | DexAsHisH/DSA-practice | clumsy/rev_integer_rec.cpp | #include<bits/stdc++.h>
using namespace std;
int sum = 0;
void rev(int n){
if(n <= 0){
return;
}
int rem = n%10;
sum = sum*10 + rem;
int num = n/10;
rev(num);
}
int main(){
rev(6969);
cout<<sum<<"\n";
} | ALGO | 0.999905 | 4.835642 |
9e86339e-051b-41c4-840a-b18ec382e369 | gaming-hacker/jburkardt_cpp_src | poisson_serial/poisson_serial.cpp | # include <cstdlib>
# include <iostream>
# include <iomanip>
# include <ctime>
# include <cmath>
using namespace std;
# define NX 11
# define NY 11
int main ( int argc, char *argv[] );
double r8mat_rms ( int m, int n, double a[NX][NY] );
void rhs ( int nx, int ny, double f[NX][NY] );
void sweep ( int nx, int ny, dou... | ALGO | 0.999903 | 5.044534 |
a1330b68-e003-4cb6-9065-90cd7fa320eb | viyamKUN/algorithm-problem-solving | cpp/287.cpp | // 287. Find the Duplicate Number
// Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive.
// There is only one repeated number in nums, return this repeated number.
// You must solve the problem without modifying the array nums and uses only constant extra space... | ALGO | 0.999978 | 6.404689 |
581bc0e8-c68a-461c-93ef-1358a2847a7e | abhisingh02/Leet_Code | 63.cpp | class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
int M = obstacleGrid.size(), N = obstacleGrid[0].size();
vector<long> memo(N, 0);
memo[N - 1] = 1;
for (int i = M - 1; i >= 0; --i) {
for (int j = N - 1; j >= 0; --j) {
... | ALGO | 0.999893 | 6.310359 |
ec03ee60-0473-4805-b298-5d7b087f1cb4 | ParisBG/Mas-C-PlusPlus | binary_conversion/binary_conversion/Source.cpp | /*
Input an integer containing only 0s and 1s(i.e., a binary integer)
and prints its decimal equivalent.
(Hint: Use the modulus and division operators to pick off the binary numbers digits one
at a time from right to left.
Just as in the decimal number system where the rightmost digit has a positional
... | ALGO | 0.998822 | 6.043221 |
aefeeba0-4c59-4f04-ad97-7a383a0b3b3e | USE-jx/LMPC_OSQP_EIGEN | src/Fast-Planner/uav_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/fpu.cpp | #include <iostream>
#include <numeric>
#include <cmath>
#include <vector>
#include <boost/numeric/odeint.hpp>
#ifndef M_PI //not there on windows
#define M_PI 3.1415927 //...
#endif
using namespace std;
using namespace boost::numeric::odeint;
//[ fpu_system_function
typedef vector< double > container_type;
struct ... | ALGO | 0.999564 | 5.286558 |
d67ecc4c-fd34-4577-b9b6-ea8ce019afdb | Kods10XXX/para_recommand_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 |
6cbe33c4-cf8c-42e9-a71a-d613b7520e5c | hanslovsky/exercise | cpp/mandelbrot/src/mandelbrot.cpp | // stl
#include <iostream>
#include <fstream>
#include <stdexcept>
// vigra
#include <vigra/impex.hxx>
#include <vigra/multi_array.hxx>
#include <vigra/multi_iterator.hxx>
#include <vigra/numpy_array.hxx>
#include <vigra/numpy_array_converters.hxx>
// own
#include "mandelbrot.hxx"
#include "complex.hxx"
void Mandelb... | ALGO | 0.941007 | 6.214839 |
7341a019-93e5-43bc-bead-b476e3d9205b | martin-pr/voxelizer | src/lib/grid.cpp | #include "grid.h"
#include <cmath>
#include <cassert>
#include <iostream>
#include "array_maths.h"
using std::cout;
using std::endl;
grid::grid(unsigned char depth, const ::bbox& box) : m_depth(depth), m_bbox(box), m_data(depth-1) {
m_depthPow = std::pow(2.0f, depth);
m_coordLimit = (unsigned)m_depthPow - 1;
}
... | ALGO | 0.898654 | 5.391598 |
6800562a-d25f-43d5-bcb2-5060c590412c | itsmeAman03/STL-Containers | vectormethod.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> v{1,2,3,4,5};
// add element
// push back O(1) for most of the case
v.push_back(10);
//pop back ---> remove element
v.pop_back();
// insert an element in the middle ----> O(N)
v.insert(v.begin()+3,100)... | ALGO | 0.973812 | 4.356631 |
3a3b2d63-d127-4748-b5a7-90f4e2891aad | madhav-bits/Coding_Practice | InterviewBit/Arrays/flip.cpp | /*
*
//********************************************************************Flip.***********************************************************
https://www.interviewbit.com/problems/flip/
*******************************************************************TEST CASES:********************************************************... | ALGO | 0.999977 | 6.044233 |
89d37de4-89ba-4a19-a71e-f2834f8b57f6 | Sandip-Kanzariya/Codeforces | Daily Dose/69_A_Buy_the_String.cpp | //#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_set>
#include <iomanip>
#include <bitset>
using namespace std;
using I = int;
using SI = short int;
using LI = long int;
using LLI = long long int;
using UI = unsigned int;
using USI = unsigned s... | ALGO | 0.999712 | 3.774131 |
5e9982ff-0557-416d-972e-bf4e71060ef5 | IzatIT/learning_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.998756 | 6.772262 |
4fa07679-6328-45fb-b164-b3cef97a5715 | dzugbruh/C | Start/2882022/main.cpp | #include <iostream>
using namespace std;
int main()
{
int a;
cin >> a;
for (int n=a;n>0;n--)
if(n>0)
{
cout << n << endl;
}
return 0;
}
| ALGO | 0.999681 | 3.277538 |
dabaef10-6ac4-4f98-bd39-befe6f2165f4 | Eunno-An/LeetCode | Biweekly Contest 77/Count Unguarded Cells in the Grid.cpp | class Solution {
public:
int countUnguarded(int m, int n, vector<vector<int>>& guards, vector<vector<int>>& walls) {
vector<vector<int>> mat(m, vector<int>(n, 0));
int ret = 0;
for(int i=0; i<guards.size(); i++){
int y = guards[i][0];
int x = guards[i][1];
... | ALGO | 0.999927 | 6.203186 |
c40b9d9a-6623-4b74-831d-ccf88d28a71a | MinQyu/algorithm | BOJ/BOJ10950.cpp | #include <iostream>
#include"H.h"
using namespace std;
void BOJ10950()
{
int T, A, B;
cin >> T;
int* C = new int[T];
for (int i = 1; i <= T; i++)
{
cin >> A >> B;
C[i] = A + B;
}
for (int i = 1; i <= T; i++)
{
cout << C[i] << "\n";
}
} | ALGO | 0.999695 | 4.669133 |
dd2c32e9-fbe5-4e01-b26e-3ef1456125fd | alexmenard/AdventOfCode2021 | day3/diagnostic.cpp | #include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
int main() {
string text;
ifstream MyReadFile("./input/input_day3.txt");
string gamma;
string epsilon;
int bits[12] = {};
int count = 0;
int count_2 = 0;
int value = 0;
while (getline(MyReadFile,... | ALGO | 0.999895 | 5.748125 |
17300962-d462-459f-94bf-a53ae251c034 | Sristy-72/Leetcode | 2416-evaluate-boolean-binary-tree/2416-evaluate-boolean-binary-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.999827 | 6.390452 |
53b4e266-3188-48fc-a1c3-4a30662117aa | SuperiorExtended/android_system_extras | simpleperf/runtest/function_fork.cpp | #include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
constexpr int LOOP_COUNT = 100000000;
volatile int a[2];
void ParentFunction() {
volatile int* p = a + atoi("0");
for (int i = 0; i < LOOP_COUNT; ++i) {
*p = i;
}
}
void ChildFunction() {
volatile int* p = a + atoi("1");
for (int i = 0; i < ... | TOOL | 0.957959 | 5.198478 |
88ac8a08-0761-4a1f-8ed1-9a893e01d5f8 | KimximyaFan/boost_1_77_0.tar | libs/math/tools/igamma_temme_large_coef.cpp | #include "mp_t.hpp"
#include <boost/math/special_functions/log1p.hpp>
#include <boost/math/special_functions/erf.hpp>
#include <boost/math/constants/constants.hpp>
#include <map>
#include <iostream>
#include <iomanip>
using namespace std;
using namespace boost::math;
//
// This program calculates the coefficients of ... | ALGO | 0.99933 | 4.484201 |
c977d426-60e7-425d-8f21-bb70f604265a | jimmi2051/util-ss5 | cryptoppVs2019/xtr.cpp | // cryptlib.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "xtr.h"
#include "nbtheory.h"
#include "algebra.cpp"
NAMESPACE_BEGIN(CryptoPP)
const GFP2Element & GFP2Element::Zero()
{
return Singleton<GFP2Element>().Ref();
}
void XTR_FindPrimesAndGenerator(RandomNumberGenerator &rn... | ALGO | 0.999344 | 5.132804 |
efe85de5-697f-4969-b6a7-ad6f9a67ba9b | just-kitkat/Competitive-Programming | CodeBreaker/Contests/SG IO Course Final Contest/babyproduction.cpp | // Author: JustKitkat
// Status: AC
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define int long long
#define el "\n"
#define arr array
#def... | ALGO | 0.999499 | 4.880776 |
e4c7380b-f1e1-4eb9-aeb3-79d1ec110ce8 | harshitmarmat/Placement-Preparation-2k22 | 25_06_2022/Array-3.cpp | // { Driver Code Starts
//Initial Template for C
#include <stdio.h>
#include <stdbool.h>
// } Driver Code Ends
//User function Template for C
// Function to find majority element in the array
// a: input array
// size: size of input array
int majorityElement(int a[], int size)
{
// your code here
... | ALGO | 0.999788 | 5.137359 |
c6cd0cc5-301c-42d8-b542-534f147ab277 | Aadarshg087/competitive-programming | Coding Ninjas/DSA Part - 2/Lec 20 - Graph 1/GraphImplementationBFS.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
void printBFS(int **edges, int n, int sv, bool *visited)
{
queue<int> pendingVertices;
pendingVertices.push(sv);
visited[sv] = true;
while (!pendingVertices.empty())
{
int currentVertex = pendingVertices.front();
cout... | ALGO | 0.999974 | 4.315969 |
b2901250-b35d-4e7e-94c2-545f35880f21 | shernshiou/CarND | Term2/05-CarND-MPC-Project/src/Eigen-3.3/demos/opengl/quaternion_demo.cpp | #include "quaternion_demo.h"
#include "icosphere.h"
#include <Eigen/Geometry>
#include <Eigen/QR>
#include <Eigen/LU>
#include <iostream>
#include <QEvent>
#include <QMouseEvent>
#include <QInputDialog>
#include <QGridLayout>
#include <QButtonGroup>
#include <QRadioButton>
#include <QDockWidget>
#include <QPushButton... | ALGO | 0.884997 | 5.860771 |
e763e821-999a-497d-8648-0ae356948ff8 | sonapraneeth-a/competitive-programming_submissions | platforms/leetcode/practice/non-premium/easy/1886__determine-whether-matrix-can-be-obtained-by-rotation/solutions.cpp | // clang-format off
/**
* FILE DESCRIPTION
*
* Filename: 1886__determine-whether-matrix-can-be-obtained-by-rotation/solutions.cpp
* Created on: 05 September 2021
* Last modified: 05 September 2021
* Author: sonapraneeth_a
* Description: LeetCode submission for 'Determine Whether Matri... | ALGO | 0.999962 | 6.498728 |
90649746-c60c-48b2-889e-026cf7dea836 | hiIgooTgar/beginner_cpp | learning_practice_1/bitwise_xor.cpp | #include <iostream>
using namespace std;
int main() {
int a = 6;
int b = 3;
int hasil;
hasil = a ^ b;
cout<<"Hasil a ^ b = "<<hasil<<endl;
return 0;
}
/*
Nama Operator Simbol di Java
AND &
OR |
XOR ^
NOT/komplemen ~
Left Shift <<
Right Shift >>
*/
| ALGO | 0.999251 | 3.934128 |
80e90522-052a-46e2-9bbf-c228d18c8fcd | Nayeem-Ahammed/Problems-Solved | Codeforces/C_Add_Zeros.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll maxL (vector <ll> &a, ll n) {
ll mx = 0;
for(ll i = 1; i < n; i++){
if(a[i] == n-i){
mx = n + maxL(a, n+i);
}
}
}
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
ll t = 1; cin >> t;
wh... | ALGO | 0.999518 | 4.068011 |
deca2e8e-c101-4da9-8d5b-c617acd944af | hadleyhzy34/data_structure_and_algorithm | array/leetcode_array/334_increasing_triplet_subsequence.cpp | //linear scan, set three different variables to inspect states
class Solution {
public:
bool increasingTriplet(vector<int>& nums) {
int i=0,j=nums.size()-1;
int first=INT_MAX,second=INT_MAX;
for(int i=0;i<nums.size();i++){
if(nums[i]<=first){
first=nums[i];
}else ... | ALGO | 0.999933 | 5.608792 |
cb4b1820-8a79-49e7-96ac-a0d84d2d8605 | BorisKGB/cpp_intro | apps/001_simple_app/main.cpp | #include <iostream>
int main()
{
int fib_num_prev = 0;
int fib_num = 1;
int tmp;
int count = 5;
while (count > 0)
{
std::cout << fib_num << ' ';
tmp = fib_num_prev;
fib_num_prev = fib_num;
fib_num += tmp;
count--;
}
std::cout << std::endl;
}
| ALGO | 0.999596 | 3.671984 |
59e7a82d-0aa2-4e60-a4be-a59796dbb992 | SaurabhYadav45/DSA-POTD | 2463-minimum-recolors-to-get-k-consecutive-black-blocks/minimum-recolors-to-get-k-consecutive-black-blocks.cpp | // *************Using Queue *********
// T.C = O (n)
// S.C = O (k) : Queue
class Solution {
public:
int minimumRecolors(string blocks, int k) {
int n = blocks.length();
queue<char>q;
int whiteCount = 0;
while(q.size()... | ALGO | 0.999907 | 6.023532 |
d97fefaa-fd22-4386-ac5f-e6214abbe2c8 | alibaba/nann | blaze-benchmark/thirdparty/boost_1_53_0/libs/graph/example/gerdemann.cpp | #include <boost/graph/adjacency_list.hpp>
/*
Thanks to Dale Gerdemann for this example, which inspired some
changes to adjacency_list to make this work properly.
*/
/*
Sample output:
0 --c--> 1 --j--> 1 --c--> 2 --x--> 2
1 --c--> 2 --d--> 3
2 --t--> 4
3 --h--> 4
4
merging ver... | ALGO | 0.999807 | 6.651409 |
879603fd-2e02-4fae-b5a2-63589904cd2d | sbn1/Competitive_programming | standart_problems/Arrays_and_Hashing/find_triplets_with_max_product.cpp | #include <iostream>
#include <algorithm>
//Time: O(N log N)
//Space: O(1)
void find_triplets_max_product(int arr[], int n)
{
if (n < 3){
return;
}
std::sort(arr, arr + n);
if (arr[0] * arr[1]*arr[n-1] > arr[n-1]*arr[n-2]*arr[n-3])
{
std::cout<<arr[0]<<" "<<arr[1]<<" "<<arr[n-1]<<s... | ALGO | 0.999905 | 4.350126 |
cb1d3de1-06b5-4cd5-8725-a5b8a8058b19 | enricotomasi/LeetCode_problems | Easy/905. Sort Array By Parity.cpp | class Solution
{
public:
vector<int> sortArrayByParity(vector<int> &nums)
{
vector<int> odd;
vector<int> even;
for (auto it : nums)
{
if (it % 2 == 0)
{
even.push_back(it);
}
else
{
odd.p... | ALGO | 0.999985 | 5.536119 |
a3328848-dfc9-42fa-80bd-ced5954ae401 | StyxProject-Devices/device_motorola_sdm660-common | gps/utils/LocHeap.cpp | #include <LocHeap.h>
class LocHeapNode {
friend class LocHeap;
// size of of the subtree, excluding self, 1 if no subtree
int mSize;
LocHeapNode* mLeft;
LocHeapNode* mRight;
LocRankable* mData;
public:
inline LocHeapNode(LocRankable& data) :
mSize(1), mLeft(NULL), mRight(NULL), mDa... | ALGO | 0.997493 | 6.427954 |
eb0451d6-9f8d-4ade-a198-306b1f40b125 | Certseeds/CS203_DSAA_template | algorithm/array/leetcode_31.cpp | #include "leetcode_31_test.hpp"
namespace leetcode_31 {
void leetcode_31::nextPermutation(vector<int32_t> &nums) {
if (nums.size() <= 1) {
return;
}
size_t j{nums.size() - 1};
for (; j > 0; j--) {
if (nums[j - 1] < nums[j]) {
break;
}
}
if (j == 0) {
... | ALGO | 0.999757 | 6.458206 |
76001678-6fb0-4093-86e8-b3763dd52c3e | Mohamed-Hashem/LeetCode | 2551-put-marbles-in-bags/2551-put-marbles-in-bags.cpp | class Solution {
public:
long long putMarbles(vector<int>& v, int k) {
int n = v.size();
long long mx = v[0] + v[n-1];
long long mn = v[0] + v[n-1];
vector<long long> adjSum;
for(int i = 0;i<n-1;i++)
... | ALGO | 0.999873 | 5.501225 |
9c872abd-9cba-4dc4-a9a8-8187569f055b | DJPranavo/My-C-Projects | Paris Olympics/parallel_tracks.cpp | #include <iostream>
#include <iomanip>
#include <string>
#include "parallel_tracks.h"
#include <sstream>
#include <fstream>
#include <stdexcept>
#include <limits>
#include <cctype>
using std::string;
using namespace std;
//-------------------------------------------------------
// Name: get_runner_data
// PreConditio... | DATA | 0.980752 | 4.439621 |
5802bf99-b18f-467c-94db-c78be15dc320 | wh04M1i/geeksforgeek | Medium/Min Time/min-time.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
long long dp[100001][2];
void fun(int indx,int tar,int prev,int it,int temp,int state_old,int state_new)
{/*
indx->pivot[left or right extreme of previous layer]
tar->left or right extre... | ALGO | 0.999914 | 6.06942 |
68fb6346-d336-4c14-91e6-b6dbfd0a58fe | hi-ogawa/practice | codeforces/contest/1408/b/main.cpp | // AC
#include <bits/stdc++.h>
using namespace std;
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, X, Y) for (auto I = decltype(Y)(X); I < (Y); ++I)
using ll = int64_t;
using ull = uint64_t;
namespace std {
template<class ...Ts> istream& operator>>(istream& i, tuple<Ts...>& x) { apply([&](auto&&...... | ALGO | 0.999627 | 4.346299 |
62cf7237-3668-46f1-a759-4e899a1e1850 | romeorizzi/portafoglioVoti_public | Algoritmi/2020-09-18/all-CMS-submissions-2020-09-18/20200918T100710.VR431583_id379osm.altopiano.cpp | /**
* user: VR431583_id379osm
* fname: MIRKO
* lname: ALBANESE
* task: altopiano
* score: 25.0
* date: 2020-09-18 10:07:10.111117
*/
//Polto-altopiano
#include <stdio.h>
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
void finalFunc(int *A, int start, int end){
bool is_contiguous = false, fo... | ALGO | 0.999465 | 4.19295 |
4dd4c1f0-a346-4d3a-99e0-e73f55da393d | hjiang13/LLMs-in-IR | POJ-104/36/1402.cpp | #include <iostream>
using namespace std;
int main()
{
char a[100],b[100];
cin>>a>>b;
int number1=strlen(a);
int number2=strlen(b);
if(number1!=number2)
cout<<"NO";
else
{
char record1[100],record2[100];
int num1[100]={
0}
,num2[100]={
0}
;
int i,k=0,m=0,j;
record1[k]=a[0];
record2[m]=b[0];
num1[k]=1;
num2[m]=1;
for(i=1... | ALGO | 0.999995 | 3.109467 |
64d33142-4602-45ad-9aa2-13c64571b6b9 | Sowmik23/CompetitiveProgramming | LeetCode/Daily-Challenge/Maximum Profit in Job Scheduling.cpp | class Solution {
public:
int jobScheduling(vector<int>& startTime, vector<int>& endTime, vector<int>& profit) {
vector<vector<int>> jobs;
for(int i=0;i<startTime.size();i++){
//jobs[0] = startTime[i];
//jobs[1] = endTime[i];
//jobs[2... | ALGO | 0.999977 | 5.913698 |
6aac83a5-339f-4b4c-a4d8-480896648de6 | sarvinshrivastava/Cpp.Leetcode | P-980.cpp | class Solution {
public:
int count = 0, cntObs = 0;
vector<pair<int, int>> move = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
void pathFinder(vector<vector<int>>& grid, vector<vector<bool>>& hasWalked, int& x, int& y, int& m, int& n, int cnt) {
if (grid[x][y] == 2 && cnt == n * m - 1 - cntObs) {
... | ALGO | 0.999789 | 6.124521 |
a9ffa3c7-9018-45e0-bd80-9f29ab08d6ff | ishandutta2007/codeforces | maximumshot/normal/1416/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long double ld;
const int inf = 1e9;
const ll inf64 = 1e18;
const int LOG = 30;
int main() {
#ifdef DEBUG
fre... | ALGO | 0.999915 | 3.506311 |
dfd64084-c851-4090-9757-8be5ee1c22cf | otavioon/COLA-2022-Tools | datasets/src/algo/codenet/0/s899201406.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define lpsbd(i, s, b, d) for(size_t i = (s); i < (b); i+=(d))
#define lpsb(i, s, b) for(size_t i = (s); i < (b); i++)
#define lpn(i, n) for(size_t i = 0; i < (n); i++)
#define fa(i, x) for(auto &i: x)
#define vcd(t, n, d) ve... | ALGO | 0.999839 | 4.5286 |
b97d906c-1add-4ef3-9948-f99a8052ebb2 | ikka0u0a/atcoder-log | src/abc/293/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int N;
cin >> N;
vector<int> A(N);
rep(i,N) cin >> A[i];
rep(i,N){
if (A[i] == 0) continue;
int index = A[i] - 1;
A[index] = 0;
}
vector<int> X;
rep(i,N){
if (A[i] == 0) conti... | ALGO | 0.999938 | 3.600301 |
5db2db5c-25fa-47cd-960d-1cdd0e50f5c0 | avanish-patel/CPP | callbyreference1.cpp | #include<iostream>
using namespace std;
void swap(int* a, int* b){
int swap;
swap = *a;
*a = *b;
*b = swap;
}
int main(){
int a= 20, b = 40;
cout << "Value of a before swap : " << a << endl;
cout << "Value of b before swap : " << b << endl;
swap(a,b);
cout << "Value of a af... | ALGO | 0.998044 | 4.206304 |
dae78bd7-8555-47c8-9cd5-ddfff444c422 | tr1ten/DNA | codeforces/specialist/1607D.cpp | #include <cstdio>
#include <bits/stdc++.h>
using namespace std;
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> ;
template<typename T>
using order... | ALGO | 0.998889 | 3.727647 |
a9eae079-d6a5-44cf-b411-3ab18da97032 | tsawke/OI | Luogu/P3XXX/P3259.cpp | //C++11 - Template
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <climits>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <unistd.h>
using namespace std;
typedef unsigned in... | ALGO | 0.999762 | 3.798484 |
8bf6f99d-6e03-4dcb-ae0b-9da415cc5a6d | enaenen/algorithm_box | barking_dog/input_test.cpp | #include <bits/stdc++.h>
int main( void ) {
std::ios::sync_with_stdio( 0 );
std::cin.tie( 0 );
std::string str;
getline( std::cin, str );
std::cout << str;
int arr[26] = { 0 };
for ( int i : str ) arr[i - 'a']++;
for ( int i : arr ) std::cout << i << ' ';
} | ALGO | 0.999251 | 3.934398 |
86789619-eec2-4a11-96bc-d712466fb50a | zwshen/notes-learning | skills/Acm/Others/chchwyacm/10929.cpp | /**
* UVa 10929 You can say 11 (AC)
* Author: chchwy
* Last Modified: 2010.01.30
*/
#include<iostream>
using namespace std;
int main(){
string num;
while( getline(cin,num) ){
if(num[0]=='0' && num.length()==1 ) break;
int sum=0;
for(int i=0;i<num.length();i+=2)
sum += ... | ALGO | 0.996169 | 3.662753 |
d8c81d00-8d8c-4908-8068-625d6e0561c1 | adityachintala/Elite-Questions | CPP/D14/d14p2.cpp | // AlphaCipher is a string formed from another string by rearranging its letters
// You are given a string S.
// Your task is to check, can any one of the AlphaCipher is a palindrome or not.
// Input Format:
// -------------
// A string S
// Output Format:
// --------------
// Print a boolean value.
// Sample Input... | ALGO | 0.999976 | 4.569477 |
bba3935e-9d05-453f-a6d1-43f565950d3c | FranklinDM/UXP | ipc/mscom/Registration.cpp | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
// COM registration data structures are built with C code, so we need to
// simulate that in our C++ code by defining CINTERFACE before including
// anything else that could possibly pull in Windows header files.
#define CINTERFACE
#inclu... | TOOL | 0.856784 | 7.376301 |
5b1e1f52-4d0e-4628-a1d8-8649016f539e | Rohan2309/dsa450 | Dynamic Programming/npr.cpp | /*
Permutation Coefficient
Difficulty Level : Easy
Permutation refers to the process of arranging all the members of a given set to form a sequence. The number of permutations on a set of n elements is given by n! , where “!” represents factorial.
The Permutation Coefficient represented by P(n, k) is used to represe... | ALGO | 0.999939 | 5.538871 |
d763679e-3d67-4a2a-b41c-df2a340d0904 | gustavojorge/metafeatures_landscape_extraction | src/adaptative_walk_pareto/modules/nsga2/binary_tournament.cpp | #include <utility>
#include "../headers/generate_rSolution.h"
#include "../headers/binary_tournament.h"
pair<Solution, Solution> binary_tournament(vector<Solution>& population){
pair<Solution, Solution> parents;
//Getting a random index for a solution
int i1 = rand() % population.size();
int i2 = rand() % po... | ALGO | 0.999995 | 4.99252 |
589450a4-394a-4b58-8ed4-527b4ebacba5 | Bungmint/competitiveprogramming | contest/codeforces/1634/1634A.cpp | // Problem: A. Reverse and Concatenate
// Contest: Codeforces - Codeforces Round #770 (Div. 2)
// URL: https://codeforces.com/contest/1634/problem/A
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
using namespace std;
using ll = long long;
using vi = vector<int>;
usin... | ALGO | 0.999978 | 4.639612 |
de5ef50b-71df-4534-82e3-5e97f091d153 | abatsakis/ch | src/Functions/locate.cpp | #include "FunctionsStringSearch.h"
#include "FunctionFactory.h"
#include "PositionImpl.h"
namespace DB
{
namespace
{
struct NameLocate
{
static constexpr auto name = "locate";
};
using FunctionLocate = FunctionsStringSearch<PositionImpl<NameLocate, PositionCaseSensitiveASCII>, ExecutionErrorPolicy::Throw, Haysta... | TOOL | 0.891262 | 6.54002 |
5f2580a2-23aa-4fb9-b727-3aaac71d4340 | Shivanshu840/POTD | 0237-delete-node-in-a-linked-list/0237-delete-node-in-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void deleteNode(ListNode* node) {
node->val = node->next->val;
node->next = node->next->next;
}
}; | ALGO | 0.999829 | 5.589011 |
ede32307-da2c-47b4-b6a1-2b9d944e1c53 | prakhs123/standalone-programs | t.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
double fact = 1.0;
for (int i = 100; i >= 1; i--)
fact = fact*(double)i;
printf("%.0f\n", fact);
return 0;
} | ALGO | 0.999755 | 3.171681 |
1f43590d-6ff2-40fb-b10b-4e913c29a97a | sarvex/leetcode-assembly | solution/2200-2299/2270.Number of Ways to Split Array/Solution.cpp | class Solution {
public:
int waysToSplitArray(vector<int>& nums) {
long long s = accumulate(nums.begin(), nums.end(), 0ll);
long long t = 0;
int ans = 0;
for (int i = 0; i < nums.size() - 1; ++i) {
t += nums[i];
ans += t >= s - t;
}
return ans;... | ALGO | 0.999948 | 5.693521 |
628fb0e4-1109-44a9-b32b-e903deb39c67 | Abhigaikwad123/New-Flutter | Class Apps/Stateful Apps/players_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.998645 | 6.76775 |
cf568c58-7ea8-4c7a-83c4-51170162d251 | RishikeshDwivedi-99/LeetCode | 42-trapping-rain-water/trapping-rain-water.cpp | class Solution {
public:
int trap(vector<int>& nums) {
int n = nums.size();
vector<int> right(n);
vector<int> left(n);
left [0] = nums[0];
for(int i=1;i<n;i++) {
left[i] = max(nums[i],left[i-1]);
}
right[n-1] = nums[n-1];
for(int i=... | ALGO | 0.99999 | 6.581014 |
5f14578b-9f0b-4c17-b860-90193c886a65 | Nur-Alam39/online-judges-problem-solutions | UVa/10550 Combination Lock.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int st,f,s,t,angle=0;
while(scanf("%d%d%d%d",&st,&f,&s,&t))
{
if(st==0&&f==0&&s==0&&t==0)
break;
angle+=720+360;
angle+=min(abs(st-f),abs(f-st))*9;
angle+=min(abs(f-s),abs(s-f))*9;
angle+=min(abs(s-... | ALGO | 0.999886 | 3.497847 |
0177e09e-e4c9-444a-9c52-9a9d7871c696 | 459893719/Summer-term1 | HRD/HRDgame/solution.cpp | #include "solution.h"
#include "ui_solution.h"
#include "level.h"
#include <cstring>
Solution::Solution(int preslevel, Level* level, QString levelName, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Solution)
{
memset(solution, 0, sizeof(solution));
this->presLevel = preslevel;
this->level = ne... | TOOL | 0.931942 | 3.955673 |
5134695b-30a8-42c3-b419-cc86baa6243f | MadhavGupta2004/codeforces | avtobus.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<limits.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
long long n,mn,mx;
cin>>n;
if(n%2==1 || n<4) cout<<-1<<endl;
else
{
mn = n/6;
if(n%6!=0) mn++;
... | ALGO | 0.999775 | 4.110704 |
69a55803-7518-4812-944d-baeeda3f6cf9 | Yuvraj2172/myleetcode | 0572-subtree-of-another-tree/0572-subtree-of-another-tree.cpp | class Solution {
public:
bool isSymmetric(TreeNode* root , TreeNode* subRoot){
if(root == NULL && subRoot== NULL)return true;
if(root == NULL || subRoot == NULL)return false;
if(root->val != subRoot->val) return false;
return isSymmetric(root->left, subRoot->left) && isSymmetric(root-... | ALGO | 0.999986 | 6.500215 |
a831779b-38f0-45f9-92a9-700459273f92 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/August/chefAndanswer_20200816194554.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999906 | 3.693168 |
df32091f-7612-49f8-b159-004c0c316f88 | gabrielmmf/competitive-programming | codeforces/1795B.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n_tests, n, k = 0;
vector<pair<int, int>> segments;
cin >> n_tests;
while (n_tests--)
{
int underLimit = 0;
int overLimit = 0;
segments.clear();
... | ALGO | 0.99994 | 4.743574 |
c1930156-6599-43bc-895d-9e8be666955d | raincross7/code-similarity | codes/train_code/problem340/problem340_139.cpp | #include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
using namespace std;
int main(){
int a=0,b=0,c=0,n,x,y,m;
cin>>n>>x>>y;
rep(i,0,n){
cin>>m;
if(m<=x) a++;
else if(m<=y) b++;
else c++;
}
a=min(a,b);
a=min(a,c);
co(a);
return 0;
} | ALGO | 0.999961 | 3.488239 |
70dddbff-71ee-46b9-ae54-cefe77d282c5 | ishandutta2007/codeforces | jiaqiyang/normal/449/C.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
const int N = 100000 + 10;
int p[N], cnt;
void sieve() {
static bool flag[N];
cnt = 0;
for (int i = 2; i < N; ++i) {
if (!flag[i]) p[++cnt] = i;
for (int j = 1; j <= cnt && i * p[j] < N; ++j) {
flag[i * p[j]] = true;
if (i % p[j] == 0... | ALGO | 0.999804 | 3.921026 |
20998927-a686-4905-8ca4-470b08d11e83 | jyczju/C_Program | 计算平均成绩.cpp | #include<stdio.h>
struct student{
char num[6];
char name[20];
int score;
};
int main(void){
int i,N,sum=0;
double ave;
struct student stu[1000];
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%s %s %d",stu[i].num,stu[i].name,&stu[i].score);
}
for(i=0;i<N;i++){
sum=sum+stu[i].score;
}
ave=sum/N;
pr... | ALGO | 0.998577 | 3.070798 |
99acd991-52d9-4631-a847-a5a0a831096d | mohitmallick17/LeetCodeSolutions | 2289-steps-to-make-array-non-decreasing/2289-steps-to-make-array-non-decreasing.cpp | class Solution {
public:
int totalSteps(vector<int>& nums) {
stack<pair<int, int>> stk;
int res=0;
for(int i=nums.size()-1;i>=0;i--){
int step_cnt=0; // steps needed to del all decreasing nos after i
while(!stk.empty() and stk.top().first < nums[i]){
s... | ALGO | 0.999965 | 6.19367 |
937eec0b-f279-4020-ac36-d140deed3395 | aytchell/kata_staircase | cpp_src/main.cpp | #include <iostream>
#include <map>
#include <vector>
const unsigned int num_stairs_start = 0;
const unsigned int num_stairs_end = 8;
const std::vector<unsigned int> step_widths = {1, 3, 5};
class StairWalker
{
public:
StairWalker(const std::vector<unsigned int>& step_widths);
unsigned int numWay(... | ALGO | 0.999053 | 4.648969 |
e120b773-1bd2-47b5-beb5-affb5b262a26 | leandrorochink/lima_vns_bmssc | src/DistanceMatrix.cpp | //============================================================================
// Author : Leandro R. Costa, Daniel Aloise, Nenad Mladenovic.
// Description : Implementation of the LIMA-VNS published in the paper "Less is
// more: basic variable neighborhood search heuristic for
// ba... | ALGO | 0.999918 | 5.561502 |
f7dbbb5c-1edf-4c4c-ae40-5388dc5a9096 | snewptl/stationaryTraveller | old-memory/XCPC_topic_training/动态规划/概率DP/SCOI2008_奖励关.cpp | #include<bits/stdc++.h>
using namespace std;
int K,n,v[16],state[16];
double dp[105][1<<15];
inline double Max(register double a,register double b){
return a>b?a:b;
}
int main(){
scanf("%d%d",&K,&n);
int tmp;
for(int i=1;i<=n;++i){
scanf("%d",&v[i]);
while(~scanf("%d",&tmp)){
if(!tmp)break;
state[i]|=(1<<... | ALGO | 0.999147 | 3.283945 |
0fabe8f5-d5a9-4fe4-a65c-99e5e92981f1 | MeshGeometry/IogramSource | Geometry/Geomlib_SunPosition.cpp | #include "Geomlib_SunPosition.h"
// C++ program calculating the solar position for
// the current date and a set location (latitude, longitude)
// Jarmo Lammi 1999
//
// Code refreshed to work in the newer versions of C++
// Compiled and tested with
// Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
// ... | ALGO | 0.999248 | 4.223379 |
d12d53d6-17af-4bf1-a7ed-c8ec770d1213 | mangoqwq/advent-of-code-2021 | 15a-chiton.cpp | #include <bits/stdc++.h>
using namespace std;
#define ms(x, a) memset(x, a, sizeof x)
typedef long long ll;
const int mod = 1e9 + 7, inf = 0x3f3f3f3f;
const int MN = 105; int N;
const string file = "txt.in";
int countlines(){ int c = 0; string l; ifstream f(file); while (getline(f, l)) c++; return c; }
int g[MN][MN];... | ALGO | 0.999822 | 4.287262 |
ee271556-60bd-452c-9628-33f7aa6380cc | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Mixtral/top0-100/find-pattern-in-infinite-stream-ii-Solution.findPattern/177865_DoS.cpp | PatternMatch(char *pat, int patdashes, char *string, int stringdashes)
{
char c,
t;
if (stringdashes < patdashes)
return 0;
for (;;) {
switch (c = *pat++) {
case '*':
if (!(c = *pat++))
return 1;
if (c == XK_minus) {
patdashes--;
for (;;) {
while ((t = *strin... | ALGO | 0.987637 | 5.773524 |
8baab37b-2f2f-467a-b9f7-526306721bfc | DownUnderCTF/Challenges_2024_Public | beginner/vector-overflow/src/vector_overflow.cpp | #include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
char buf[16];
std::vector<char> v = {'X', 'X', 'X', 'X', 'X'};
void lose() {
puts("Bye!");
exit(1);
}
void win() {
system("/bin/sh");
exit(0);
}
int main() {
char ductf[6] = "DUCTF";
char* d = ductf;
std::cin >> ... | ALGO | 0.980806 | 3.525864 |
d63afab8-0263-497f-ab17-4ec426ee3f83 | vishal1202verma/PW-C-and-DSA-full-cource | Week11Recursion/Recursion-3/PrintSequence.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
void PrintSubSequence(int arr[], int n, int idx, vector<int> ans, int k){
// base case
if(idx == n){
if(ans.size() == k){
for(int i=0; i<ans.size(); i++){
cout<<ans[i]<<" ";
}
cout<<endl;
}
return;
}
if(ans... | ALGO | 0.999583 | 4.299508 |
2ed774b4-ea50-4f3b-9612-006fdd69585a | protarie125/BOJ_5217 | src/main.cpp | #include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
cin >> t;
while (0 < (t--)) {
int n;
cin >> n;
cout << "Pairs for " << n << ": ";
for (int i = 1; 2 * i < n; ++i) {
if (1 < i) {
cout << ", ";
}
cout << i << ' ' << n - i;
}... | ALGO | 0.985955 | 4.739928 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.